diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..08b3bc60a0caa3117128dc5cfac74659bfbb98b3 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +#### +# +# /*! +# * \brief The ViTE main makefile. +# * +# * Commands are : \ +# * make all : compiles the released version. +# * make doc : create the documentation with Doxygen. +# * make debugs : compiles with debug informations. +# * make clean : deletes generated files. +# */ +# +### + + + +all: + cd interface/src && qmake-qt4 && make + @echo " " + @echo "Compilation completed! File created in 'bin' folder." + @echo " " + +doc: + doxygen Doxyfile + @echo " " + @echo "Documentation generated successfully !" + @echo "Please open index.html in 'html' folder for a web documentation, or use 'make' in the 'latex' folder for a pdf documentation." + @echo " " + + +debugs: + cd interface && make debugs + @echo " " + @echo "Compilation completed! (debug)" + @echo " " + + +clean: + make -i -f Makefile wash # The washing is launched to ignore errors. + @echo " " + @echo "Cleaned!" + @echo " " + + +# Must be called with option -i, otherwise an error occured in the first instructions, the followings won't be executed. +wash: + cd interface && make clean + cd bin && rm * diff --git a/interface/Makefile b/interface/Makefile index d88f65502603792b71e5c0e2a46cf44a635d6c5d..66254b5b7e65c885b240134b93927effa370a970 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -27,7 +27,7 @@ doc: build: - cd ./src && qmake-qt4 -project "RESOURCES= vite.qrc" "OBJECTS_DIR=../bin" "DESTDIR=../bin" "CONFIG+=uitools" "QT+=opengl" && qmake-qt4 -makefile -o Makefile src.pro && make all + 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 " " @@ -64,7 +64,7 @@ clean: # Must be called with option -i, otherwise an error occured in the first instructions, the followings won't be executed. wash: - cd ./src && rm *~ *.o *pro Makefile qrc_vite.cpp core + cd ./src && rm *~ *.o Makefile qrc_vite.cpp core cd ./tests && rm *~ *.o *pro Makefile core cd ./bin && rm *.o cd ./debug && rm * diff --git a/interface/src/info_window.ui b/interface/src/info_window.ui index 5cc32dc2cc6810a8f9a3f381f1742516b427b8e8..8ec4d5251d8f69d325f48d30d146629b45903a0e 100644 --- a/interface/src/info_window.ui +++ b/interface/src/info_window.ui @@ -5,8 +5,8 @@ 0 0 - 472 - 199 + 565 + 229 @@ -20,88 +20,154 @@ + + 0 + + + 0 + - - - - 300 - 16777215 - + + + 0 - - Qt::StrongFocus - - - Trace Resume - - - - - - Qt::ScrollBarAsNeeded - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + Qt::StrongFocus + + + Trace Resume + + + + + + Qt::ScrollBarAsNeeded + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + info_trace_text + info_trace_clear + verticalLayoutWidget + verticalLayoutWidget_2 + + + + + + clear trace resume + + + + - - - Selection Informations + + + 0 - - - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + 0 + + + + + Selection Informations + + + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + clear informations + + + + + horizontalLayoutWidget + horizontalLayoutWidget + verticalLayoutWidget + gridLayoutWidget + verticalLayoutWidget + info_trace_clear + verticalLayoutWidget + verticalLayoutWidget_2 + info_trace - - - - 0 - 0 - 472 - 26 - - - - - + + + info_trace_clear + clicked() + info_trace_text + clear() + + + 47 + 217 + + + 152 + 120 + + + + + pushButton + clicked() + info_selection_text + clear() + + + 369 + 217 + + + 372 + 164 + + + + diff --git a/interface/src/interface_graphic.cpp b/interface/src/interface_graphic.cpp index 1176b75ee82528cf5120e7e96c5316f5c177a68f..c67364599f25b60a2350d426c9db7a73ba439558 100644 --- a/interface/src/interface_graphic.cpp +++ b/interface/src/interface_graphic.cpp @@ -107,12 +107,14 @@ void Interface_graphic::on_open_triggered(){ If 'this' is put, the application closes after the getOpenFilename() dialog box closes. */ QString filename = QFileDialog::getOpenFileName(_ui_main_window); - if (!filename.isEmpty()) + if (!filename.isEmpty()){ /*******************************************************/ /* Not Yet Implemented -> Send file path to the parser */ /*******************************************************/ + _ui_render_area->build(); + error("Open : not yet implemented"); information(string("Open file : ")+ filename.toStdString()); /* @@ -124,6 +126,7 @@ void Interface_graphic::on_open_triggered(){ _list_container = _trace->get_root_containers(); */ + } } @@ -134,6 +137,8 @@ void Interface_graphic::on_close_triggered(){ /* Not Yet Implemented -> Stop the parser and the data structure if they are still implemented */ /***********************************************************************************************/ + _ui_render_area->unbuild(); + error("Close : not yet implemented"); } diff --git a/interface/src/render_area.cpp b/interface/src/render_area.cpp index 4787c7dc8d169d8eb110885e3b0d4a4c8cc3d1c3..70808860017b5d24a027ffd128b63ed7c7a64fa8 100644 --- a/interface/src/render_area.cpp +++ b/interface/src/render_area.cpp @@ -20,21 +20,22 @@ Render_area::Render_area(QWidget *parent) exit(EXIT_FAILURE); } - _drawing_state = DRAWING_STATE_WAINTING; + _drawing_state = DRAWING_STATE_WAINTING;/* At the beginning, no trace is drawing */ - rot=0.0f; - - - - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); - timer->start(10); + /* init the wait animation */ + _wait_list = 0;/* init list */ + _wait_angle=0.0f;/* begin with 0 rad angle */ + _wait_timer = NULL; + _wait_spf=10;/* 10 milliseconds per frame */ + + _drawing_list=0; + } Render_area::~Render_area() { - if (glIsList(_rabbit_list)==GL_TRUE) - glDeleteLists(_rabbit_list, 1); + if (glIsList(_wait_list)==GL_TRUE) + glDeleteLists(_wait_list, 1); if (glIsList(_drawing_list)==GL_TRUE) glDeleteLists(_drawing_list, 1); @@ -47,7 +48,7 @@ void Render_area::initializeGL() glEnable(GL_DEPTH_TEST); - _rabbit_list = draw_rabbit(); + _wait_list = draw_wait(); } void Render_area::resizeGL(int width, int height) @@ -57,7 +58,9 @@ void Render_area::resizeGL(int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(45,(double)640/480,0.1,1000); + // gluPerspective(45,(double)640/480,0.1,1000); + + glOrtho(0, 200, 0, 200, 0, 1000); glMatrixMode(GL_MODELVIEW); } @@ -72,13 +75,16 @@ void Render_area::paintGL() switch(_drawing_state){ - case DRAWING_STATE_WAINTING:/* A rabbit is drawn */ - - glRotatef(-rot*(360.0f/(2*PI)), 0.0f, 1.0f, 0.0f); - rot+=PI/720.0f; - if (rot>=2.0f*PI) rot=0.0f; + case DRAWING_STATE_WAINTING:/* A wait is drawn */ + + /* 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; - glCallList(_rabbit_list); + glCallList(_wait_list); break; case DRAWING_STATE_DRAWING:/* A trace is drawn */ @@ -88,6 +94,8 @@ void Render_area::paintGL() default: _parent->error("Undefined value for the drawing state attribute - Render area"); } + + glFlush(); @@ -96,7 +104,7 @@ void Render_area::paintGL() -GLuint Render_area::draw_rabbit() +GLuint Render_area::draw_wait() { GLuint object; GLuint texture; @@ -123,6 +131,7 @@ GLuint Render_area::draw_rabbit() } glEnd(); + } glEndList();/* close the list */ @@ -135,6 +144,14 @@ GLuint Render_area::draw_rabbit() glEnable(GL_BLEND);/* enable blending for the alpha color */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + /* Now, timer is set */ + _wait_angle = 0.0f; + + _wait_timer = new QTimer(this); + connect(_wait_timer, SIGNAL(timeout()), this, SLOT(updateGL())); + _wait_timer->start(_wait_spf); + return object; } @@ -171,8 +188,11 @@ GLuint Render_area::draw_trace() bool Render_area::build(){ - if (glIsList(_rabbit_list)==GL_TRUE)/* if the list exists */ - glDeleteLists(_rabbit_list, 1); + if (glIsList(_wait_list)==GL_TRUE)/* if the list exists */ + glDeleteLists(_wait_list, 1); + + if (_wait_timer->isActive()==true)/* if timer for the wait animation is running */ + _wait_timer->stop(); if (glIsList(_drawing_list)==GL_FALSE) _drawing_list = draw_trace();/* create the trace draw */ @@ -201,24 +221,30 @@ bool Render_area::build(){ bool Render_area::unbuild(){ - if (glIsList(_drawing_list)==GL_TRUE)/* if the list exists */ - glDeleteLists(_drawing_list, 1); - - if (glIsList(_rabbit_list)==GL_FALSE) - _rabbit_list = draw_rabbit();/* create the rabbit draw */ + if (glIsList(_drawing_list)==GL_TRUE)/* if the list exists */ + glDeleteLists(_drawing_list, 1); + + if (_wait_timer->isActive()==true)/* if timer for the wait animation is running */ + _wait_timer->stop(); + + if (glIsList(_wait_list)==GL_FALSE) + _wait_list = draw_wait();/* create the wait draw */ else { - _parent->warning("The rabbit draw was not released."); + _parent->warning("The wait draw was not released."); return false; } - - /* if there is an error, do not display the rabbit an return immediatly */ - if (_rabbit_list!=0) + + /* if there is an error, do not display the wait an return immediatly */ + if (_wait_list!=0) { - _parent->warning("Cannot create the rabbit draw."); + _parent->warning("Cannot create the wait draw."); return false; } + if (_wait_timer->isActive()==false)/* if timer for the wait animation is running */ + _wait_timer->start(_wait_spf); + _drawing_state = DRAWING_STATE_WAINTING;/* change the drawing state */ /* enable some OpenGL features*/ @@ -230,6 +256,38 @@ bool Render_area::unbuild(){ glEnable(GL_BLEND);/* enable blending for the alpha color */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - + return true; } + + + +void draw_container(const Level level, const string &name){ + + /* QPainter painter(this); + qreal a = 100; + painter.drawText(QRectF::QRectF(a, a, a, a), Qt::AlignCenter, tr("coucou")); + */ + glBegin(GL_QUADS);/* create a quads */ + { + glVertex2f(0, level); + glVertex2f(0, level+10); + glVertex2f(name.size(), level+10); + glVertex2f(name.size(), level); + } + glEnd(); + +} + +/*void draw_state(const Date start, const Date end, const Level level) const{ + + glBegin(GL_QUADS); + { + glVertex2f(start, level); + glVertex2f(end, level+10); + glVertex2f(end, level+10); + glVertex2f(start, level); + } + glEnd(); + + }*/ diff --git a/interface/src/render_area.hpp b/interface/src/render_area.hpp index 4a74a96032f9e2601038b8bf893382d7b20e2b40..5dd849addb45d7c0432b2428cf70b6645c614e32 100644 --- a/interface/src/render_area.hpp +++ b/interface/src/render_area.hpp @@ -9,6 +9,10 @@ class Render_area; +typedef double Level; + +typedef double Date; + #include "resource.hpp" #include "interface_graphic.hpp" @@ -33,9 +37,27 @@ class QDESIGNER_WIDGET_EXPORT Render_area : public QGLWidget protected: - GLuint _rabbit_list; + /*! + * \brief The wait GLu list. + */ + GLuint _wait_list; + + /*! + * \brief Rotation angle for the wait. + */ + float _wait_angle; + + /*! + * \brief Timer to animate the wait. + */ + QTimer* _wait_timer; + + /*! + * \brief Wait animation seconds per frame. + */ + int _wait_spf; + GLuint _drawing_list; - float rot; Interface_graphic* _parent; int _drawing_state; @@ -57,10 +79,10 @@ class QDESIGNER_WIDGET_EXPORT Render_area : public QGLWidget void paintGL(); /*! - * \brief Display a rabbit on the screen if there is no file opened. - * \return Asset value of the rabbit. + * \brief Display a wait on the screen if there is no file opened. + * \return Asset value of the wait. */ - GLuint draw_rabbit(); + GLuint draw_wait(); /*! * \brief Display the trace on the screen if there is a file opened. @@ -69,6 +91,9 @@ class QDESIGNER_WIDGET_EXPORT Render_area : public QGLWidget GLuint draw_trace(); + void draw_container(const Level level, const string &name); + // void draw_state(const Date start, const Date end, const Level level) const; + public: /*! diff --git a/interface/src/src.pro b/interface/src/src.pro new file mode 100644 index 0000000000000000000000000000000000000000..390c98467f9f9ac6e76ef23d0b4af89a14ec301c --- /dev/null +++ b/interface/src/src.pro @@ -0,0 +1,24 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue Feb 3 22:27:18 2009 +###################################################################### + +TARGET = vite +RESOURCES= vite.qrc +SOURCES+=../../main.cpp +OBJECTS_DIR=../bin +DESTDIR=../../bin +CONFIG+=uitools +QT+=opengl +TEMPLATE = app +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += interface.hpp \ + interface_console.hpp \ + interface_graphic.hpp \ + render_area.hpp \ + resource.hpp +FORMS += info_window.ui main_window.ui maquette.ui +SOURCES += interface_console.cpp interface_graphic.cpp render_area.cpp +RESOURCES += vite.qrc diff --git a/interface/src/main.cpp b/main.cpp similarity index 100% rename from interface/src/main.cpp rename to main.cpp