Commit a13157a3 authored by Olivier Lagrasse's avatar Olivier Lagrasse

reorganisation dans l'ordre croissant des conteneurs + correction bug encodage...

reorganisation dans l'ordre croissant des conteneurs + correction bug encodage + correction bug reecriture du texte des conteneurs + remplacement des barres temporaires de deplacement et de zoom + affichage nom fichier dans barre titre + reorganisation code : en cours de separation du dessin de la trace avec l'algorithme de parcours
parent bb356348
......@@ -22,11 +22,24 @@ using namespace std;
Interface_console::Interface_console(int argc, char ** argv){
int state;
bool useGUI;/* if window interface can be displayed */
useGUI = true;
app = new QApplication(argc, argv, useGUI);/* create the Qt application */
/* Qt uses the default system encoding for QString (used when opening a file) */
QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
if (!useGUI){
cerr << "Error: Graphical window cannot be displayed." << endl;
exit(EXIT_FAILURE);
}
_main_window=NULL;
state = get_state(argc, argv);
launch_action(state);
}
......@@ -40,6 +53,24 @@ Interface_console::~Interface_console(){
/***********************************
*
*
*
* Running function.
*
*
*
**********************************/
int Interface_console::run(){
return app->exec();
}
/***********************************
*
......
......@@ -36,6 +36,7 @@ protected:
*/
Interface_graphic* _main_window;
QApplication* app;
/***********************************
......@@ -125,6 +126,19 @@ protected:
/***********************************
*
* Running function.
*
**********************************/
/*!
* \brief This function launch Qt event loop.
*/
int run();
/***********************************
*
* Informative message functions.
......
......@@ -24,11 +24,13 @@ Interface_graphic::Interface_graphic(QWidget *parent):QWidget(parent){
_is_rendering_trace = false;
load_windows();
}
Interface_graphic::Interface_graphic(const string file_path, QWidget *parent):QWidget(parent){
_is_rendering_trace = false;
load_windows();
......@@ -158,10 +160,12 @@ void Interface_graphic::opening_file(string const &path){
if (build(&trace)==false)
error("Open file : an error occured with wait screen releasing.");
_is_rendering_trace = true;
_ui_render_area->update();
}
......@@ -203,7 +207,6 @@ void Interface_graphic::on_open_triggered(){
*/
QString filename = QFileDialog::getOpenFileName(_ui_main_window);
if (!filename.isEmpty()){
if(_is_rendering_trace == true){/* Realease the previous trace */
......@@ -211,13 +214,49 @@ void Interface_graphic::on_open_triggered(){
warning("Cannot opening an other file");
}
else
else{
opening_file(filename.toStdString());
_ui_main_window->setWindowTitle(QString("ViTE :: ")+filename);
}
}
}
void Interface_graphic::on_export_triggered(){
QString filename = QFileDialog::getSaveFileName(_ui_main_window, tr("Export File"),
"",
tr("Images (*.svg)"));
if (!filename.isEmpty()){
/* QApplication::setOverrideCursor(Qt::WaitCursor);
out << textEdit->toPlainText();
QApplication::restoreOverrideCursor();
*/
information(string("Exporting trace to ")+filename.toStdString());
}
else
error("No file specified for exportation");
}
void Interface_graphic::on_close_triggered(){
if(_is_rendering_trace == false)
......@@ -232,6 +271,8 @@ void Interface_graphic::on_close_triggered(){
_ui_render_area->update();
_ui_main_window->setWindowTitle(QString("ViTE"));
}
......@@ -306,6 +347,7 @@ void Interface_graphic::on_translate_state_valueChanged(int new_value){
}
void Interface_graphic::on_main_window_hide(){
cerr << "GoodBye"<<endl;
......
......@@ -224,6 +224,11 @@ protected slots:
*/
void on_open_triggered();
/*!
*\brief A slot which called when 'export' in the menu is clicked.
*/
void on_export_triggered();
/*!
*\brief A slot which called when 'close' in the menu is clicked.
*/
......@@ -256,6 +261,7 @@ protected slots:
void on_scale_state_valueChanged(int new_value);/* temporary slot */
void on_translate_state_valueChanged(int new_value);/* temporary slot */
void on_main_window_hide();
};
......
......@@ -40,12 +40,15 @@
</widget>
</item>
<item>
<widget class="QSlider" name="translate_state" >
<property name="maximum" >
<number>10000</number>
<widget class="QScrollBar" name="translate_state" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="singleStep" >
<number>1</number>
<property name="maximum" >
<number>100000</number>
</property>
<property name="pageStep" >
<number>1</number>
......@@ -67,25 +70,22 @@
</widget>
</item>
<item>
<widget class="QSlider" name="scale_state" >
<property name="minimum" >
<number>1</number>
<widget class="QScrollBar" name="scale_state" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum" >
<number>100000</number>
</property>
<property name="singleStep" >
<number>1</number>
</property>
<property name="pageStep" >
<number>1</number>
</property>
<property name="value" >
<number>10</number>
</property>
<property name="sliderPosition" >
<number>10</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
......@@ -109,6 +109,7 @@
<string>&amp;File</string>
</property>
<addaction name="open" />
<addaction name="export" />
<addaction name="separator" />
<addaction name="close" />
<addaction name="separator" />
......@@ -215,6 +216,14 @@
<string>Show infos window</string>
</property>
</action>
<action name="export" >
<property name="text" >
<string>&amp;Export</string>
</property>
<property name="shortcut" >
<string>Ctrl+E</string>
</property>
</action>
</widget>
<resources>
<include location="vite.qrc" />
......
This diff is collapsed.
......@@ -6,10 +6,6 @@
#define RENDER_AREA_HPP
typedef long Element_count ;
typedef double Element_pos;
typedef double Element_col;
class Render_area;
typedef double Level;
......@@ -131,8 +127,8 @@ class Render_area : public QGLWidget
* \brief The wait GLu list.
*/
GLuint _wait_list;
GLuint list_containers;
GLuint list_states;
GLuint _list_containers;
GLuint _list_states;
/*!
* \brief Rotation angle for the wait.
......@@ -229,10 +225,6 @@ class Render_area : public QGLWidget
double _container_x_max;
double _container_y_max;
double _state_x_max;
// double _state_y_max;
double _state_x_min;
// double _state_y_min;
/***********************************
* Trace Drawing functions and attributes.
......@@ -257,29 +249,9 @@ class Render_area : public QGLWidget
Container* get_container(const std::list <Container*> *list_container, const int pos) const;
/*!
* \brief Draw a container according to the parameters
* \param x the x position of the container
* \param y the y position of the container
* \param w the width of the container
* \param h the height of the container
*/
void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h) const;
/*!
* \brief Draw a state of the trace.
* \param r the red color rate of the state.
* \param g the green color rate of the state.
* \param b the blue color rate of the state.
* \param start the beginning time of the state.
* \param end the ending time of the state.
* \param level refer to the container which state belongs to.
*/
void draw_state(const Element_pos start , const Element_pos end, const Element_count level, const Element_col r, const Element_col g, const Element_col b) const;
int _state_scale;/* temporary */
int _state_translate;/* temporary */
int _container_view_size;/* temporary */
public:
......@@ -322,7 +294,50 @@ class Render_area : public QGLWidget
void change_scale(int scale);/* temporary -> to change the scale to view states */
void change_translate(int translate);/* temporary -> to change the translate to view states */
void change_container_view(int view_size);/* temporary -> to change the size of container view */
inline void start_draw();
inline void start_draw_containers();
/*!
* \brief Draw a container according to the parameters
* \param x the x position of the container
* \param y the y position of the container
* \param w the width of the container
* \param h the height of the container
*/
inline void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h);
/*!
* \brief Draw the text of a container.
* \param x the x position of the text.
* \param y the y position of the text.
* \param value the string value of the text.
*/
inline void draw_container_text(const Element_pos x, const Element_pos y, const string value);
inline void end_draw_containers();
inline void start_draw_states();
/*!
* \brief Draw a state of the trace.
* \param start the beginning time of the state.
* \param end the ending time of the state.
* \param base vertical position of the state.
* \param height the state height.
* \param r the red color rate of the state.
* \param g the green color rate of the state.
* \param b the blue color rate of the state.
*/
inline void draw_state(const Element_pos start , const Element_pos end, const Element_pos base, const Element_pos height, const Element_col r, const Element_col g, const Element_col b);
inline void end_draw_states();
inline void end_draw();
};
#endif
......@@ -40,7 +40,8 @@ HEADERS += interface.hpp \
../../trace/src/values/Integer.hpp \
../../trace/src/values/Name.hpp \
../../trace/src/values/String.hpp \
../../trace/src/values/Value.hpp
../../trace/src/values/Value.hpp \
../../trace/src/DrawTrace.hpp
FORMS += info_window.ui main_window.ui maquette.ui
SOURCES += interface_console.cpp interface_graphic.cpp render_area.cpp \
......
......@@ -15,11 +15,9 @@
*/
int main(int argc, char **argv)
{
QApplication app(argc, argv);
glutInit(&argc, argv);
Interface_console console(argc, argv);
return app.exec();
return console.run();
}
......@@ -61,14 +61,21 @@
class Interface;
class Interface_console;
class Interface_graphic;
class Render_area;
typedef long Element_count ;
typedef double Element_pos;
typedef double Element_col;
//include "interface/tests/test_trace.hpp"
#include "trace/src/Trace.hpp"
#include "trace/src/DrawTrace.hpp"
#include "parser/src/ParserPaje.hpp"
......
This diff is collapsed.
/*!
*\file resource.hpp
*\brief This file gives some common header files for the trace classes.
*/
#ifndef RESOURCE_HPP
#define RESOURCE_HPP
#include "../../main_resource.hpp"
#endif
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