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:
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 *
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>472</width>
<height>199</height>
<width>565</width>
<height>229</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -20,88 +20,154 @@
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="info_trace" >
<property name="maximumSize" >
<size>
<width>300</width>
<height>16777215</height>
</size>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<property name="rightMargin" >
<number>0</number>
</property>
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
<property name="title" >
<string>Trace Resume</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<item>
<widget class="QTextEdit" name="info_trace_text" >
<property name="verticalScrollBarPolicy" >
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<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">
<item>
<widget class="QGroupBox" name="info_trace" >
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
<property name="title" >
<string>Trace Resume</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<item>
<widget class="QTextEdit" name="info_trace_text" >
<property name="verticalScrollBarPolicy" >
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<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">
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;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 name="textInteractionFlags" >
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</property>
<property name="textInteractionFlags" >
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
<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>
<widget class="QGroupBox" name="info_selection" >
<property name="title" >
<string>Selection Informations</string>
<layout class="QVBoxLayout" name="verticalLayout_4" >
<property name="rightMargin" >
<number>0</number>
</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">
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="info_selection" >
<property name="title" >
<string>Selection Informations</string>
</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">
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;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 name="textInteractionFlags" >
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</property>
<property name="textInteractionFlags" >
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton" >
<property name="text" >
<string>clear informations</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</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 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>
<resources>
<include location="vite.qrc" />
</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>
......@@ -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");
}
......
......@@ -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();
}*/
......@@ -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:
/*!
......
######################################################################
# 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
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