Commit 841051e8 authored by Olivier Lagrasse's avatar Olivier Lagrasse

Deplacement du fichier main, correction bug interface, debut code d'affichage...

Deplacement du fichier main, correction bug interface, debut code d'affichage de la trace, proposition d'ABR
parent 9171a24c
####
#
# /*!
# * \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 *
...@@ -27,7 +27,7 @@ doc: ...@@ -27,7 +27,7 @@ doc:
build: 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 " "
@echo "Built and compiled! (release)" @echo "Built and compiled! (release)"
@echo " " @echo " "
...@@ -64,7 +64,7 @@ clean: ...@@ -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. # Must be called with option -i, otherwise an error occured in the first instructions, the followings won't be executed.
wash: 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 ./tests && rm *~ *.o *pro Makefile core
cd ./bin && rm *.o cd ./bin && rm *.o
cd ./debug && rm * cd ./debug && rm *
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>472</width> <width>565</width>
<height>199</height> <height>229</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
...@@ -20,88 +20,154 @@ ...@@ -20,88 +20,154 @@
<layout class="QHBoxLayout" name="horizontalLayout_2" > <layout class="QHBoxLayout" name="horizontalLayout_2" >
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout" > <layout class="QHBoxLayout" name="horizontalLayout" >
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QGroupBox" name="info_trace" > <layout class="QVBoxLayout" name="verticalLayout_3" >
<property name="maximumSize" > <property name="rightMargin" >
<size> <number>0</number>
<width>300</width>
<height>16777215</height>
</size>
</property> </property>
<property name="focusPolicy" > <item>
<enum>Qt::StrongFocus</enum> <widget class="QGroupBox" name="info_trace" >
</property> <property name="focusPolicy" >
<property name="title" > <enum>Qt::StrongFocus</enum>
<string>Trace Resume</string> </property>
</property> <property name="title" >
<layout class="QHBoxLayout" name="horizontalLayout_3" > <string>Trace Resume</string>
<item> </property>
<widget class="QTextEdit" name="info_trace_text" > <layout class="QHBoxLayout" name="horizontalLayout_3" >
<property name="verticalScrollBarPolicy" > <item>
<enum>Qt::ScrollBarAsNeeded</enum> <widget class="QTextEdit" name="info_trace_text" >
</property> <property name="verticalScrollBarPolicy" >
<property name="readOnly" > <enum>Qt::ScrollBarAsNeeded</enum>
<bool>true</bool> </property>
</property> <property name="readOnly" >
<property name="html" > <bool>true</bool>
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> </property>
<property name="html" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> &lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;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;">&lt;/p>&lt;/body>&lt;/html></string> &lt;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;">&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
<property name="textInteractionFlags" > <property name="textInteractionFlags" >
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> <zorder>info_trace_text</zorder>
<zorder>info_trace_clear</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>verticalLayoutWidget_2</zorder>
</widget>
</item>
<item>
<widget class="QPushButton" name="info_trace_clear" >
<property name="text" >
<string>clear trace resume</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="info_selection" > <layout class="QVBoxLayout" name="verticalLayout_4" >
<property name="title" > <property name="rightMargin" >
<string>Selection Informations</string> <number>0</number>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4" > <property name="bottomMargin" >
<item> <number>0</number>
<widget class="QTextEdit" name="info_selection_text" > </property>
<property name="readOnly" > <item>
<bool>true</bool> <widget class="QGroupBox" name="info_selection" >
</property> <property name="title" >
<property name="html" > <string>Selection Informations</string>
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4" >
<item>
<widget class="QTextEdit" name="info_selection_text" >
<property name="readOnly" >
<bool>true</bool>
</property>
<property name="html" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> &lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;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;">&lt;/p>&lt;/body>&lt;/html></string> &lt;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;">&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
<property name="textInteractionFlags" > <property name="textInteractionFlags" >
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
<item>
<widget class="QPushButton" name="pushButton" >
<property name="text" >
<string>clear informations</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
<zorder>horizontalLayoutWidget</zorder>
<zorder>horizontalLayoutWidget</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>gridLayoutWidget</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>info_trace_clear</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>verticalLayoutWidget_2</zorder>
<zorder>info_trace</zorder>
</widget> </widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>472</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar" />
</widget> </widget>
<resources> <resources>
<include location="vite.qrc" /> <include location="vite.qrc" />
</resources> </resources>
<connections/> <connections>
<connection>
<sender>info_trace_clear</sender>
<signal>clicked()</signal>
<receiver>info_trace_text</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel" >
<x>47</x>
<y>217</y>
</hint>
<hint type="destinationlabel" >
<x>152</x>
<y>120</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>info_selection_text</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel" >
<x>369</x>
<y>217</y>
</hint>
<hint type="destinationlabel" >
<x>372</x>
<y>164</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>
...@@ -107,12 +107,14 @@ void Interface_graphic::on_open_triggered(){ ...@@ -107,12 +107,14 @@ void Interface_graphic::on_open_triggered(){
If 'this' is put, the application closes after the getOpenFilename() dialog box closes. If 'this' is put, the application closes after the getOpenFilename() dialog box closes.
*/ */
QString filename = QFileDialog::getOpenFileName(_ui_main_window); QString filename = QFileDialog::getOpenFileName(_ui_main_window);
if (!filename.isEmpty()) if (!filename.isEmpty()){
/*******************************************************/ /*******************************************************/
/* Not Yet Implemented -> Send file path to the parser */ /* Not Yet Implemented -> Send file path to the parser */
/*******************************************************/ /*******************************************************/
_ui_render_area->build();
error("Open : not yet implemented"); error("Open : not yet implemented");
information(string("Open file : ")+ filename.toStdString()); information(string("Open file : ")+ filename.toStdString());
/* /*
...@@ -124,6 +126,7 @@ void Interface_graphic::on_open_triggered(){ ...@@ -124,6 +126,7 @@ void Interface_graphic::on_open_triggered(){
_list_container = _trace->get_root_containers(); _list_container = _trace->get_root_containers();
*/ */
}
} }
...@@ -134,6 +137,8 @@ void Interface_graphic::on_close_triggered(){ ...@@ -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 */ /* Not Yet Implemented -> Stop the parser and the data structure if they are still implemented */
/***********************************************************************************************/ /***********************************************************************************************/
_ui_render_area->unbuild();
error("Close : not yet implemented"); error("Close : not yet implemented");
} }
......
...@@ -20,21 +20,22 @@ Render_area::Render_area(QWidget *parent) ...@@ -20,21 +20,22 @@ Render_area::Render_area(QWidget *parent)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
_drawing_state = DRAWING_STATE_WAINTING; _drawing_state = DRAWING_STATE_WAINTING;/* At the beginning, no trace is drawing */
rot=0.0f; /* init the wait animation */
_wait_list = 0;/* init list */
_wait_angle=0.0f;/* begin with 0 rad angle */
_wait_timer = NULL;
QTimer *timer = new QTimer(this); _wait_spf=10;/* 10 milliseconds per frame */
connect(timer, SIGNAL(timeout()), this, SLOT(updateGL()));
timer->start(10); _drawing_list=0;
} }
Render_area::~Render_area() Render_area::~Render_area()
{ {
if (glIsList(_rabbit_list)==GL_TRUE) if (glIsList(_wait_list)==GL_TRUE)
glDeleteLists(_rabbit_list, 1); glDeleteLists(_wait_list, 1);
if (glIsList(_drawing_list)==GL_TRUE) if (glIsList(_drawing_list)==GL_TRUE)
glDeleteLists(_drawing_list, 1); glDeleteLists(_drawing_list, 1);
...@@ -47,7 +48,7 @@ void Render_area::initializeGL() ...@@ -47,7 +48,7 @@ void Render_area::initializeGL()
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
_rabbit_list = draw_rabbit(); _wait_list = draw_wait();
} }
void Render_area::resizeGL(int width, int height) void Render_area::resizeGL(int width, int height)
...@@ -57,7 +58,9 @@ void Render_area::resizeGL(int width, int height) ...@@ -57,7 +58,9 @@ void Render_area::resizeGL(int width, int height)
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); 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); glMatrixMode(GL_MODELVIEW);
} }
...@@ -72,13 +75,16 @@ void Render_area::paintGL() ...@@ -72,13 +75,16 @@ void Render_area::paintGL()
switch(_drawing_state){ switch(_drawing_state){
case DRAWING_STATE_WAINTING:/* A rabbit is drawn */ case DRAWING_STATE_WAINTING:/* A wait is drawn */
glRotatef(-rot*(360.0f/(2*PI)), 0.0f, 1.0f, 0.0f); /* turn around y axis */
rot+=PI/720.0f; glTranslatef(100, 100, 0);
if (rot>=2.0f*PI) rot=0.0f; 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; break;
case DRAWING_STATE_DRAWING:/* A trace is drawn */ case DRAWING_STATE_DRAWING:/* A trace is drawn */
...@@ -88,6 +94,8 @@ void Render_area::paintGL() ...@@ -88,6 +94,8 @@ void Render_area::paintGL()
default: default:
_parent->error("Undefined value for the drawing state attribute - Render area"); _parent->error("Undefined value for the drawing state attribute - Render area");
} }
glFlush(); glFlush();
...@@ -96,7 +104,7 @@ void Render_area::paintGL() ...@@ -96,7 +104,7 @@ void Render_area::paintGL()
GLuint Render_area::draw_rabbit() GLuint Render_area::draw_wait()
{ {
GLuint object; GLuint object;
GLuint texture; GLuint texture;
...@@ -123,6 +131,7 @@ GLuint Render_area::draw_rabbit() ...@@ -123,6 +131,7 @@ GLuint Render_area::draw_rabbit()
} }
glEnd(); glEnd();
} }
glEndList();/* close the list */ glEndList();/* close the list */
...@@ -135,6 +144,14 @@ GLuint Render_area::draw_rabbit() ...@@ -135,6 +144,14 @@ GLuint Render_area::draw_rabbit()
glEnable(GL_BLEND);/* enable blending for the alpha color */ glEnable(GL_BLEND);/* enable blending for the alpha color */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 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; return object;
} }
...@@ -171,8 +188,11 @@ GLuint Render_area::draw_trace() ...@@ -171,8 +188,11 @@ GLuint Render_area::draw_trace()
bool Render_area::build(){ bool Render_area::build(){
if (glIsList(_rabbit_list)==GL_TRUE)/* if the list exists */ if (glIsList(_wait_list)==GL_TRUE)/* if the list exists */
glDeleteLists(_rabbit_list, 1); 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) if (glIsList(_drawing_list)==GL_FALSE)
_drawing_list = draw_trace();/* create the trace draw */ _drawing_list = draw_trace();/* create the trace draw */
...@@ -201,24 +221,30 @@ bool Render_area::build(){ ...@@ -201,24 +221,30 @@ bool Render_area::build(){
bool Render_area::unbuild(){ bool Render_area::unbuild(){
if (glIsList(_drawing_list)==GL_TRUE)/* if the list exists */ if (glIsList(_drawing_list)==GL_TRUE)/* if the list exists */
glDeleteLists(_drawing_list, 1); glDeleteLists(_drawing_list, 1);
if (glIsList(_rabbit_list)==GL_FALSE) if (_wait_timer->isActive()==true)/* if timer for the wait animation is running */
_rabbit_list = draw_rabbit();/* create the rabbit draw */ _wait_timer->stop();
if (glIsList(_wait_list)==GL_FALSE)
_wait_list = draw_wait();/* create the wait draw */
else else
{ {
_parent->warning("The rabbit draw was not released."); _parent->warning("The wait draw was not released.");
return false; return false;
} }
/* if there is an error, do not display the rabbit an return immediatly */ /* if there is an error, do not display the wait an return immediatly */
if (_rabbit_list!=0) if (_wait_list!=0)
{ {
_parent->warning("Cannot create the rabbit draw."); _parent->warning("Cannot create the wait draw.");
return false; 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 */ _drawing_state = DRAWING_STATE_WAINTING;/* change the drawing state */
/* enable some OpenGL features*/ /* enable some OpenGL features*/
...@@ -230,6 +256,38 @@ bool Render_area::unbuild(){ ...@@ -230,6 +256,38 @@ bool Render_area::unbuild(){
glEnable(GL_BLEND);/* enable blending for the alpha color */ glEnable(GL_BLEND);/* enable blending for the alpha color */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
return true; 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();
}*/
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
class Render_area; class Render_area;
typedef double Level;
typedef double Date;
#include "resource.hpp" #include "resource.hpp"
#include "interface_graphic.hpp" #include "interface_graphic.hpp"
...@@ -33,9 +37,27 @@ class QDESIGNER_WIDGET_EXPORT Render_area : public QGLWidget ...@@ -33,9 +37,27 @@ class QDESIGNER_WIDGET_EXPORT Render_area : public QGLWidget
protected: protected:
GLuint _rabbit_list; /*!
* \brief The wait GLu list.
*/
GLuint _wait_list;
/*!
* \brief Rotation angle for the wait.