Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b35799c3 authored by Olivier Lagrasse's avatar Olivier Lagrasse
Browse files

debut codage classes de l'interface

parent 80205203
No related branches found
No related tags found
No related merge requests found
......@@ -5,10 +5,13 @@ FINAL=-03
_test:
@echo "Compilation of tests :"
make -f test/Makefile
@echo "End compilation of tests"
all:
cd ./src && qmake-qt4 -project && qmake-qt4 -makefile -o Makefile "CONFIG+=uitools opengl" "DESTDIR = ../bin" src.pro && make all
debug:
cd ./src && qmake-qt4 -project && qmake-qt4 -makefile -o Makefile "CONFIG+=uitools opengl debug" "DESTDIR = ../debug" src.pro && make all
clean:
rm *~ *.o
\ No newline at end of file
cd ./src && rm *~ *.o
\ No newline at end of file
/*!
*\file interface.h
*\brief This is an interface, used by the terminal and graphical interfaces.
*/
#ifndef INTERFACE_H
#define INTERFACE_H
#include "resource.h"
/*!
*\brief This class is an interface for the human interaction with the program.
*/
class Interface{
public:
/*!
\arg string : the string to be displayed.
\brief The function takes a string then displayed it either on the terminal if there is an Interface_console instance, or on a dialof box for the Interface_graphic. Then, it killed the application.
*/
bool error(string);
/*!
\arg string : the string to be displayed.
\brief The function takes a string then displayed it either on the terminal if there is an Interface_console instance, or on a dialof box for the Interface_graphic. Then the program go on.
*/
bool warning(string);
};
#endif
/*!
*\file interface_console.h
*\brief This is a terminal interface.
*/
#ifndef INTERFACE_CONSOLE_H
#define INTERFACE_CONSOLE_H
/*!
*\brief This class is an terminal interface, it inherited from the Interface interface.
*/
class Interface_console : public Interface{
public:
/*!
\arg string : the string to be displayed.
\brief The function takes a string then displayed it into the terminal, then killed the application.
*/
bool error(string);
/*!
\arg string : the string to be displayed.
\brief The function takes a string then displayed it into the terminal, then the program go on.
*/
bool warning(string);
};
#endif
/*!
*\file interface_graphic.cpp
*\brief This is graphical interface C source code.
*/
#include "interface_graphic.h"
Interface_graphic::Interface_graphic(){
QUiLoader loader;
QFile file(UI_MAIN_WINDOW_NAME);
file.open(QFile::ReadOnly);
_main_window = loader.load(&file, this);
file.close();
}
Interface_graphic::~Interface_graphic(){
delete _main_window;
}
/*!
*\file interface_graphic.h
*\brief This is a graphical interface.
*/
#ifndef INTERFACE_GRAPHIC_H
#define INTERFACE_GRAPHIC_H
#include "interface.h"
#define UI_MAIN_WINDOW_NAME "main_window.ui"/* name of the main window ui file. This file must be included in the same folder than the compiled program. */
/*!
*\brief This class is a graphical interface which creates a window, it inherited from the Interface interface.
*/
class Interface_graphic : public Interface, public QWidget{
/*!
* \brief Containt the instance of the window class.
*/
QWidget* _main_window;
public:
/*!
* \brief The default constructor
*/
Interface_graphic();
/*!
* \brief The destructor
*/
~Interface_graphic();
/*!
* \arg string : the string to be displayed.
*\brief The function takes a string then displayed an info box containing it, then the application will be killed.
*/
bool error(string);
/*!
*\arg string : the string to be displayed.
*\brief The function takes a string then displayed an info box containing it, then the program go on.
*/
bool warning(string);
};
#endif
/*!
*\file ressource.h
*\brief This file gives some common header files for the interface classes.
*/
#ifndef RESOURCE_H
#define RESOURCE_H
#include <QtGui>/* for all of the Qt's Widgets */
#include <QtUiTools>/* for the run-time loading .ui file */
#include <iostream>/* to use the C standard library input output functions */
using namespace std;
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment