Commit 8b63c5e7 authored by Olivier Lagrasse's avatar Olivier Lagrasse

ajout chargement fichier par ligne de commande + modification du Makefile de l'interface

parent bec6385a
......@@ -16,7 +16,7 @@ DIR_PARSER = parser
all:
cd interface/src && qmake-qt4 && make
cd interface/ && make
# @(cd $(DIR_PARSER) && make)
@echo " "
@echo "Compilation completed! File created in 'bin' folder."
......
......@@ -13,7 +13,7 @@
all:
cd ./src && make
cd ./src && qmake-qt4 && make all
@echo " "
@echo "Compilation completed! (release)"
@echo " "
......@@ -26,11 +26,11 @@ doc:
@echo " "
build:
cd ./src && qmake-qt4 -project "TARGET = vite" "RESOURCES= vite.qrc" "SOURCES+=../../main.cpp" "OBJECTS_DIR=../bin" "DESTDIR=../../bin" "CONFIG+=uitools" "QT+=opengl" && qmake-qt4 -makefile -o Makefile src.pro && make all
@echo " "
@echo "Built and compiled! (release)"
@echo " "
#build:
# cd ./src && qmake-qt4 -project "TARGET += vite" "RESOURCES= vite.qrc" "SOURCES+=../../main.cpp" "OBJECTS_DIR=../bin" "DESTDIR=../../bin" "CONFIG+=uitools" "QT+=opengl" && qmake-qt4 -makefile -o Makefile src.pro && make all
# @echo " "
# @echo "Built and compiled! (release)"
# @echo " "
plugins:
......@@ -40,17 +40,16 @@ plugins:
@echo " "
debugs:
cd ./src && qmake-qt4 -project && qmake-qt4 -makefile -o Makefile "RESOURCES= vite.qrc" "OBJECTS_DIR=../debug" "CONFIG+=uitools debug console" "QT+=opengl" "DESTDIR = ../debug" src.pro && make all
mv src/*.o bin/
@echo " "
@echo "Compilation completed! (debug)"
@echo " "
#debugs:
#cd ./src && qmake-qt4 -project && qmake-qt4 -makefile -o Makefile "RESOURCES= vite.qrc" "OBJECTS_DIR=../debug" "CONFIG+=uitools debug console" "QT+=opengl" "DESTDIR = ../debug" src.pro && make all
#mv src/*.o bin/
#@echo " "
#@echo "Compilation completed! (debug)"
#@echo " "
tests: build
cd ./tests && qmake-qt4 -project && qmake-qt4 -makefile -o Makefile "RESOURCES= vite.qrc" "OBJECTS_DIR=../bin" "CONFIG+=uitools" "QT+=opengl" "DESTDIR = ../bin" tests.pro && make all
mv tests/*.o bin/
cd ./tests && qmake-qt4 -project && qmake-qt4 -makefile -o Makefile "RESOURCES= ../src/vite.qrc" "OBJECTS_DIR=../bin" "CONFIG+=uitools" "QT+=opengl" "DESTDIR = ../bin" tests.pro && make all
@echo " "
@echo "Compilation completed! (test)"
@echo " "
......
......@@ -59,9 +59,15 @@ int Interface_console::get_state(int argc, char** argv){
}
else if (argc==2){/* There is one argument */
if (strncmp(argv[1], "-h", 2)==0)/* display the help message */
if (strncmp(argv[1], "-h", 2)==0){
/* display the help message */
return STATE_DISPLAY_HELP;
}
else{
/* should be a path of a file */
_file_opened = argv[1];/* store the path of the file */
return STATE_OPEN_FILE;
}
}
return STATE_UNKNOWN;
......@@ -79,12 +85,12 @@ void Interface_console::launch_action(int state){
break;
case STATE_LAUNCH_GRAPHICAL_INTERFACE :
_main_window = new Interface_graphic();/* launch the window interface */
break;
/* launch the window interface */
_main_window = new Interface_graphic();
case STATE_OPEN_FILE:
information(string("Opening the file: ")+string(_file_opened));
_main_window = new Interface_graphic(_file_opened);/* launch the window interface and open a file */
break;
default:/* like STATE_UNKNOWN */
......
......@@ -57,6 +57,16 @@ protected:
*/
static const int STATE_LAUNCH_GRAPHICAL_INTERFACE = 1;
/*!
*\brief A state which corresponds to display a the ViTE window and opening a file.
*/
static const int STATE_OPEN_FILE = 2;
/*!
*\brief If a file must be opened, this attributes contains its path.
*/
char* _file_opened;
/*!
* \brief Return the state of ViTE according to the arguments.
* \arg argc : the number of parameters given when the program was called.
......
......@@ -12,7 +12,7 @@
*
*
*
* Constructor and destructor.
* Constructors and destructor.
*
*
*
......@@ -21,19 +21,53 @@
Interface_graphic::Interface_graphic(QWidget *parent):QWidget(parent){
/*if (!QGLFormat::hasOpenGL())
qFatal("This system has no OpenGL support");
*/
/* Init pointer attributes */
// _parser = NULL;
//_trace = NULL;
QUiLoader loader;
QFile file_main(UI_MAIN_WINDOW_NAME);
QFile file_info(UI_INFO_WINDOW_NAME);
load_windows();
}
Interface_graphic::Interface_graphic(char* file_path, QWidget *parent):QWidget(parent){
/* Init pointer attributes */
// _parser = NULL;
//_trace = NULL;
load_windows();
information(string("File opened: ")+ string(file_path));
}
Interface_graphic::~Interface_graphic(){
/* Qt desallocates _ui_main_window, _ui_info_window and _render_area automatically */
}
/***********************************
*
*
*
* Window function.
*
*
*
**********************************/
void Interface_graphic::load_windows(){
QUiLoader loader;
QFile file_main(UI_MAIN_WINDOW_NAME);
QFile file_info(UI_INFO_WINDOW_NAME);
if (!QGLFormat::hasOpenGL())
qFatal("This system has no OpenGL support");
/* Load the main window from a .ui file */
file_main.open(QFile::ReadOnly);
CKFP(_ui_main_window = loader.load(&file_main, this), "Cannot open the .ui file : " << UI_MAIN_WINDOW_NAME);
......@@ -70,13 +104,6 @@ Interface_graphic::Interface_graphic(QWidget *parent):QWidget(parent){
Interface_graphic::~Interface_graphic(){
/* Qt desallocates _ui_main_window, _ui_info_window and _render_area automatically */
}
/***********************************
*
*
......@@ -143,8 +170,8 @@ void Interface_graphic::on_open_triggered(){
it's an interface class (Interface_graphic*). The real window is _ui_main_window.
If 'this' is put, the application closes after the getOpenFilename() dialog box closes.
*/
// QString filename = QFileDialog::getOpenFileName(_ui_main_window);
//if (!filename.isEmpty()){
QString filename = QFileDialog::getOpenFileName(_ui_main_window);
if (!filename.isEmpty()){
/*******************************************************/
/* Not Yet Implemented -> Send file path to the parser */
......@@ -154,7 +181,7 @@ void Interface_graphic::on_open_triggered(){
error("Open file : an error occured with wait screen releasing.");
error("Open : not yet implemented");
// information(string("Open file : ")+ filename.toStdString());
information(string("File opened: ")+ filename.toStdString());
/*
_trace = new Trace();
_parser = new Parser();
......@@ -164,7 +191,7 @@ void Interface_graphic::on_open_triggered(){
_list_container = _trace->get_root_containers();
*/
// }
}
}
......
......@@ -26,6 +26,18 @@ class Interface_graphic : public QWidget, public Interface{
protected:
/***********************************
*
* Window function.
*
**********************************/
/*!
* \brief This functions load the windows from .ui files and init widgets.
*/
void load_windows();
/***********************************
*
......@@ -109,15 +121,24 @@ public:
/***********************************
*
* Constructor and destructor.
* Constructors and destructor.
*
**********************************/
/*!
* \brief The default constructor
* \arg parent: the parent widget of the graphical interface. Should be ignored.
*/
Interface_graphic(QWidget *parent = 0);
/*!
* \brief The constructor which open a file
* \arg file_path: the file which be parsed then displayed.
* \arg parent: the parent widget of the graphical interface. Should be ignored.
*/
Interface_graphic(char* file_path, QWidget *parent = 0);
/*!
* \brief The destructor
*/
......
......@@ -105,10 +105,10 @@ void Render_area::paintGL()
/* turn around y axis */
glTranslatef(100, 100, 0);
glScalef(3, 3, 0);
glRotatef(_wait_angle*(-360.0f/(2*PI)), 0.0f, 1.0f, 0.0f);
_wait_angle+=PI/720.0f;
if (_wait_angle>=2.0f*PI) _wait_angle=0.0f;
glRotatef(-_wait_angle, 0.0f, 1.0f, 0.0f);
_wait_angle+=0.1f;
if (_wait_angle>=360) _wait_angle=0.0f;
glCallList(_wait_list);
break;
......
......@@ -27,7 +27,6 @@ using namespace std;
#define UI_MAIN_WINDOW_NAME ":/window/main_window.ui"/* The main window ui file. */
#define UI_INFO_WINDOW_NAME ":/window/info_window.ui"/* The info window ui file. */
#define PI 3.14159265
......
######################################################################
# Automatically generated by qmake (2.01a) dim. fvr. 8 18:47:09 2009
######################################################################
TARGET = vite
RESOURCES= vite.qrc
SOURCES+=../../main.cpp
......@@ -10,7 +6,6 @@ DESTDIR=../../bin
CONFIG+=uitools
QT+=opengl
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment