Commit ab75fb6b authored by Johnny Jazeix's avatar Johnny Jazeix

Normes.

parent 9f66ad9c
......@@ -31,7 +31,7 @@ PROJECT_NAME = ViTE
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 2.0
PROJECT_NUMBER = 3.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
......@@ -487,7 +487,7 @@ WARN_IF_DOC_ERROR = YES
# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = NO
WARN_NO_PARAMDOC = YES
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
......@@ -513,7 +513,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = src/interface/ src/message/ src/parser/ src/render/ src/trace/ src/trace/values/ src/main.cpp src/main_resource.hpp tests/interface tests/message tests/parser tests/trace
INPUT = src/interface/ src/message/ src/parser/ src/render/ src/trace/ src/trace/values/ src/main.cpp src/main_resource.hpp tests/interface tests/message tests/parser tests/trace src/Tools.cpp src/Tools.hpp
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
......@@ -2,9 +2,9 @@
using namespace std;
double convert_to_double(const char *arg){
double convert_to_double(const string arg){
double value = -1.0; // value returned
string arg_temp = (string)arg + " 3";
string arg_temp = arg + " 3";
int useless;
if(sscanf(arg_temp.c_str(), "%lf %d", &value, &useless) == 2){
return value; // It is the good format
......
......@@ -13,7 +13,7 @@
* \brief Convert the string in double
* \arg arg : the string to be doublized.
*/
double convert_to_double(const char *arg);
double convert_to_double(const std::string arg);
#endif // TOOLS_HPP
......@@ -7,17 +7,14 @@ void Progress_bar_thread::init(Parser *p, Interface_console *i){
void Progress_bar_thread::run() {
_file_size = _parser->get_total_size_of_file();
_interface_console->get_progress_dialog()->setRange(0, 100);
int loaded = 0;
while(1) {
loaded = _parser->get_size_loaded()*10000/_file_size + 1;
loaded = _parser->get_size_loaded()*100/_file_size + 1;
msleep(500); // We wait 500 ms
_interface_console->get_progress_dialog()->setValue(loaded);
QApplication::processEvents();
_interface_console->get_progress_dialog()->update();
}
}
......@@ -109,8 +109,7 @@ bool Interface_console::draw_trace(const string & filename, const int format){
// Init of the thread
Progress_bar_thread thread;
thread.init(&parser, this);
_progress_dialog = new QProgressDialog(_main_window);
_progress_dialog->setLabelText("Parsing");
_progress_dialog = new QProgressDialog("Parsing", "Cancel", 0, 100, _main_window);
_progress_dialog->show();
thread.start();
......@@ -118,7 +117,7 @@ bool Interface_console::draw_trace(const string & filename, const int format){
try{
parser.parse(filename, trace);
}
catch (const string &error){
catch (const string &error) {
thread.terminate();
*Message::get_instance() << "Reason : " << error << Message::ende;
QApplication::restoreOverrideCursor();
......@@ -178,7 +177,7 @@ int Interface_console::run(){
/*
* If a window is displayed, enter in the Qt event loop.
*/
if ( true == _is_window_displayed){
if (_is_window_displayed){
return app->exec();
}
else{/* else, quit the application */
......@@ -222,7 +221,6 @@ int Interface_console::get_state(int argc, char** argv){
for(int i = 1 ; i < argc ; i ++){
cout << "argv[" << i <<"] : "<< argv[i] << endl;
if((string)argv[i] == "-h"){
// display the help message
return _STATE_DISPLAY_HELP;
......@@ -251,7 +249,7 @@ int Interface_console::get_state(int argc, char** argv){
return _STATE_UNKNOWN;
}
}
else if((string)argv[i] == "-t"){
else if((string)argv[i] == "-t") {
// We want to export the file which follow this argument
extract_times(argv[++ i]);
state |= _STATE_IN_AN_INTERVAL;
......@@ -259,49 +257,49 @@ int Interface_console::get_state(int argc, char** argv){
else if(argv[i][0] == '-') {
// This is here where we put new options !! (for filters for example or export)
if((string)argv[i] == "-epsilon"){
if((string)argv[i] == "-epsilon") {
i ++;
if(i > argc){
if(i > argc) {
cerr << "need an other argument for epsilon" << endl;
return _STATE_UNKNOWN;
}
else{
else {
double accuracy = convert_to_double(argv[i]);
if(accuracy < 0.) {
cerr << "need a positive accuracy for epsilon" << endl;
return _STATE_UNKNOWN;
}
else{
else {
Svg::set_accuracy(accuracy);
}
}
}
else if((string)argv[i] == "-interval"){
// else if((string)argv[i] == "-interval") {
if (!(i +2 < argc)) {
cerr << "interval argc" << endl;
return _STATE_UNKNOWN;
}
if (argv[i+1][0] == '-') {
cerr << "interval -" << endl;
return _STATE_UNKNOWN;
}
if (!(argv[i+2][0] != '-')) {
cerr << "interval -" << endl;
return _STATE_UNKNOWN;
}
// if (!(i +2 < argc)) {
// cerr << "interval argc" << endl;
// return _STATE_UNKNOWN;
// }
// if (argv[i+1][0] == '-') {
// cerr << "interval -" << endl;
// return _STATE_UNKNOWN;
// }
// if (!(argv[i+2][0] != '-')) {
// cerr << "interval -" << endl;
// return _STATE_UNKNOWN;
// }
double t1 = atof(argv[i+1]);
double t2 = atof(argv[i+2]);
// double t1 = atof(argv[i+1]);
// double t2 = atof(argv[i+2]);
if (t1 >= t2) {
cerr << "interval neg" << endl;
return _STATE_UNKNOWN;
}
Svg::set_interval(t1,t2);
i+=2;
}
// if (t1 >= t2) {
// cerr << "interval neg" << endl;
// return _STATE_UNKNOWN;
// }
// Svg::set_interval(t1,t2);
// i+=2;
// }
else if((string)argv[i] == "-wide") {
if (i + 1 >= argc) {
cerr << "wide argc" << endl;
......@@ -328,7 +326,7 @@ int Interface_console::get_state(int argc, char** argv){
Svg::set_height_factor(atof(argv[i+1]));
i++;
}
else if((string)argv[i] == "-scale"){
else if((string)argv[i] == "-scale"){
if (!(i + 1 < argc)) {
cerr << "scale argc" << endl;
return _STATE_UNKNOWN;
......@@ -355,9 +353,10 @@ int Interface_console::get_state(int argc, char** argv){
return state;
}
void Interface_console::extract_times(const char *name){
void Interface_console::extract_times(const char *name) {
bool has_time_start = false;
bool has_time_end = false;
string temp = name;
if(name[0] == '['){
has_time_start = true;
}
......@@ -365,14 +364,18 @@ void Interface_console::extract_times(const char *name){
has_time_end = true;
}
if(has_time_start && has_time_end){
sscanf(name, "[%lf]:[%lf]", &_time_start, &_time_end);
if(has_time_start && has_time_end) {
string start = temp.substr(temp.find('[')+1, temp.find(']')-1);
temp = temp.substr(temp.find(']')+1);
string end = temp.substr(temp.find('[')+1, temp.find(']')-2);
_time_start = convert_to_double(start);
_time_end = convert_to_double(end);
}
else if(has_time_start){
sscanf(name, "[%lf]:", &_time_start);
else if(has_time_start) {
_time_start = convert_to_double(temp.substr(temp.find('[')+1, temp.find(']')-1));
}
else if(has_time_end){
sscanf(name, ":[%lf]", &_time_end);
else if(has_time_end) {
_time_end = convert_to_double(temp.substr(temp.find('[')+1, temp.find(']')-2));
}
else{
_time_start = 0;
......@@ -391,12 +394,12 @@ void Interface_console::launch_action(int state, void* arg){
case _STATE_LAUNCH_GRAPHICAL_INTERFACE :
_main_window = new Interface_graphic(this);/* launch the window interface */
Message::set_interface(_main_window);/* define which interface will receive messages */
_render_opengl = new Render_opengl(_main_window);
_main_window->bind_render_area((QGLWidget*)_render_opengl);
_main_window = new Interface_graphic(this);/* launch the window interface */
Message::set_interface(_main_window);/* define which interface will receive messages */
_render_opengl = new Render_opengl(_main_window);
_main_window->bind_render_area((QGLWidget*)_render_opengl);
_is_window_displayed = true;
_is_window_displayed = true;
break;
case _STATE_OPEN_FILE:
......@@ -417,17 +420,14 @@ void Interface_console::launch_action(int state, void* arg){
case _STATE_EXPORT_FILE:
if (true == _file_opened.empty()){
if (_file_opened.empty()){
*Message::get_instance() << "Please to previously open a trace." << Message::endw;
return;
}
*Message::get_instance() << "export of " << _file_opened << " to " << _path_to_export << Message::endi;
///// Do the export /////
{
draw_trace(_file_opened, _DRAW_SVG);
}
/////////////////////////
draw_trace(_file_opened, _DRAW_SVG);
break;
......@@ -445,10 +445,10 @@ void Interface_console::launch_action(int state, void* arg){
else{
cout << "the end of the trace.";
}
///// Do the export /////
/////////////////////////
Svg::set_interval(_time_start, _time_end);
draw_trace(_file_opened, _DRAW_SVG);
break;
case _STATE_OPEN_FILE_IN_AN_INTERVAL:
......@@ -508,8 +508,8 @@ void Interface_console::launch_action(int state, void* arg){
break;
default:/* like _STATE_UNKNOWN */
display_help();
warning(string("Cannot determine the arguments past. Please check the correct syntax."));
display_help();
warning(string("Cannot determine the arguments past. Please check the correct syntax."));
}
}
......
......@@ -26,7 +26,7 @@ class Interface_console;
/*!
*\brief This class is an terminal interface, it inherited from the Interface interface.
*/
*/
class Interface_console : public Interface{
......@@ -252,7 +252,7 @@ protected:
public:
public:
/***********************************
......@@ -325,7 +325,7 @@ protected:
/*!
\arg string : the string to be displayed.
\brief The function takes a string then displayed it into the terminal, then killed the application.
*/
*/
void error(const std::string) const;
......@@ -345,14 +345,14 @@ protected:
/*!
*\arg string : the string to be displayed.
*\brief Only use in graphic interface.
*/
*/
void selection_information(const std::string) const{
}
/*!
*\brief Return the progress dialog used during threads.
*/
*/
QProgressDialog *get_progress_dialog();
};
......
......@@ -38,7 +38,7 @@ Interface_graphic::~Interface_graphic(){
/* Qt desallocates this, _ui_info_window and _render_area automatically */
/* Qt desallocates this, _ui_info_window and _render_area automatically */
}
......@@ -94,11 +94,11 @@ void Interface_graphic::load_windows(){
connect(_ui_export_ok_button, SIGNAL(pressed()),
this, SLOT( option_export_ok_pressed()));
this, SLOT( option_export_ok_pressed()));
/*
Special function of Qt which allows methods declared as slots and which name are 'on_[widget]_[action]()' to be called when the 'widget' triggered the signal corresponding to 'action'.
/!\ -> use NULL as argument, else messages will be duplicated!
*/
*/
QMetaObject::connectSlotsByName(NULL);
// QMetaObject::connectSlotsByName(_ui_time_selection_export);
......@@ -194,8 +194,8 @@ void Interface_graphic::opening_file(const string &path){
QApplication::setOverrideCursor(Qt::WaitCursor);
/* if (_core->draw_trace(path)==false){
error("Draw trace failed");
}*/
error("Draw trace failed");
}*/
// _ui_render_area->build();
......@@ -375,17 +375,17 @@ void Interface_graphic::on_help_triggered(){
void Interface_graphic::on_about_triggered(){
/* QMessageBox::about(this, tr("About ViTE"),
tr("<b>ViTE</b> is a trace format visualizer developped "
"by french engineering school students for INRIA researchers (<a href='http://www.inria.fr'>http://www.inria.fr</a>).<br/><br/>"
"It is licensed under <i>CECILL-A</i>."));*/
tr("<b>ViTE</b> is a trace format visualizer developped "
"by french engineering school students for INRIA researchers (<a href='http://www.inria.fr'>http://www.inria.fr</a>).<br/><br/>"
"It is licensed under <i>CECILL-A</i>."));*/
QMessageBox::about(this, tr("About ViTE"),
tr("<h2>ViTE</h2>"
"the <b>Vi</b><i>sual </i><b>T</b><i>race</i> <b>E</b><i>xplorer</i> - <i>version 0.3</i> - <i>March 2009</i>.<br /><br />"
"Under the CeCILL A licence. The content can be found <a href=\"http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt\">here</a>."
"<p><b>Developers:</b><ul><li>Kevin COULOMB</li><li>Johnny JAZEIX</li><li>Olivier LAGRASSE</li><li>Jule MARCOUEILLE</li><li>Pascal NOISETTE</li><li>Arthur REDONDY</li><li>Cl&eacute;ment VUCHENER</li></ul></p>"
"This software was made for a school engineering project for INRIA researchers.<br />"
"The main page project is: <a href=\"https://gforge.inria.fr/projects/vite/\">https://gforge.inria.fr/projects/vite/</a>.<br /><br />"));
"<p><b>Developers:</b><ul><li>Kevin COULOMB</li><li>Johnny JAZEIX</li><li>Olivier LAGRASSE</li><li>Jule MARCOUEILLE</li><li>Pascal NOISETTE</li><li>Arthur REDONDY</li><li>Cl&eacute;ment VUCHENER</li></ul></p>"
"This software was made for a school engineering project for INRIA researchers.<br />"
"The main page project is: <a href=\"https://gforge.inria.fr/projects/vite/\">https://gforge.inria.fr/projects/vite/</a>.<br /><br />"));
}
......@@ -420,7 +420,7 @@ void Interface_graphic::on_goto_start_triggered(){
else/* on X axe */
id = Info::Render::X_TRACE_BEGINNING;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
}
void Interface_graphic::on_goto_end_triggered(){
......
......@@ -23,15 +23,12 @@ class Interface_graphic;
/*!
*\brief This class is a graphical interface which creates a window, it inherited from the Interface interface.
*/
*/
class Interface_graphic : public QMainWindow, protected Ui::main_window, public Interface{
Q_OBJECT
protected:
protected:
/***********************************
......@@ -68,9 +65,9 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
*/
QAction* _ui_toolbar_check;
/*
*\brief This variable contains the toolbar
*/
/*
*\brief This variable contains the toolbar
*/
QToolBar* _ui_toolbar;
/*!
......@@ -129,7 +126,7 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
*/
QTextEdit* _ui_info_selection_text;
/*!
/*!
* \brief Text area which informs the user about the selected entity information.
*/
QPushButton* _ui_export_ok_button;
......@@ -195,14 +192,14 @@ public:
/*!
*\arg string : the string to be displayed.
*\brief The function takes strings and/or numbers then displayed an info box containing it, then the program go on with an indeterminated behaviour.
*/
*/
void warning(const std::string) const;
/*!
*\arg string : the string to be displayed.
*\brief The function takes strings and/or numbers then displayed an info box containing it, then the program go on.
*/
*/
void information(const std::string) const;
......@@ -216,7 +213,7 @@ public:
/*!
*\arg string : the string to be displayed.
*\brief The function takes strings and/or numbers then displayed it in the entity informative text area in the info window.
*/
*/
void selection_information(const std::string) const;
......@@ -231,7 +228,7 @@ public:
/*!
* \brief Create a Parser and a DataStructure to display a trace file.
* \arg path The path of the file.
*/
*/
void opening_file(const std::string &path);
/*!
......@@ -268,12 +265,12 @@ protected slots:
/*!
*\brief A slot called when 'open' in the menu is clicked.
*/
*/
void on_open_triggered();
/*!
*\brief A slot called when 'export' in the menu is clicked.
*/
*/
void on_export_file_triggered();
/*!
......@@ -283,52 +280,52 @@ protected slots:
/*!
*\brief A slot called when 'close' in the menu is clicked.
*/
*/
void on_close_triggered();
/*!
*\brief A slot called when 'quit' in the menu is clicked.
*/
*/
void on_quit_triggered();
/*!
*\brief A slot called when 'fullscreen' in the menu is clicked.
*/
*/
void on_fullscreen_triggered();
/*!
*\brief A slot called when 'Show tool bar' in the menu is clicked.
*/
*/
void on_toolbar_menu_triggered();
/*!
*\brief A slot called when 'show infos' in the menu is clicked.
*/
*/
void on_show_info_triggered();
/*!
*\brief A slot called when 'help' in the menu is clicked.
*/
*/
void on_help_triggered();
/*!
*\brief A slot called when 'about' in the menu is clicked.
*/
*/
void on_about_triggered();
/*!
*\brief A slot called when 'no_warning' in the menu is clicked.
*/
*/
void on_no_warning_triggered();
/*!
*\brief A slot called when 'zoom_in' in the menu is clicked.
*/
*/
void on_zoom_in_triggered();
/*!
*\brief A slot called when 'zoom_out' in the menu is clicked.
*/
*/
void on_zoom_out_triggered();
/*!
......@@ -350,7 +347,7 @@ protected slots:
*\brief A slot called when 'zoom_box' widget is triggered.
*
* \arg s The new string value of the zoom box.
*/
*/
void on_zoom_box_textChanged(QString s);
/*!
......
......@@ -341,12 +341,12 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>81</x>
<y>36</y>
<x>92</x>
<y>30</y>
</hint>
<hint type="destinationlabel" >
<x>131</x>
<y>100</y>
<x>136</x>
<y>65</y>
</hint>
</hints>
</connection>
......@@ -357,12 +357,12 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>125</x>
<y>41</y>
<x>136</x>
<y>30</y>
</hint>
<hint type="destinationlabel" >
<x>249</x>
<y>100</y>
<x>270</x>
<y>65</y>
</hint>
</hints>
</connection>
......@@ -373,8 +373,8 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>93</x>
<y>173</y>
<x>103</x>
<y>113</y>
</hint>
<hint type="destinationlabel" >
<x>69</x>
......@@ -389,12 +389,12 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>45</x>
<y>205</y>
<x>66</x>
<y>160</y>
</hint>
<hint type="destinationlabel" >
<x>51</x>
<y>240</y>
<x>73</x>
<y>195</y>
</hint>
</hints>
</connection>
......@@ -405,12 +405,12 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>37</x>
<y>273</y>
<x>58</x>
<y>234</y>
</hint>
<hint type="destinationlabel" >
<x>35</x>
<y>308</y>
<x>57</x>
<y>269</y>
</hint>
</hints>
</connection>
......@@ -425,8 +425,8 @@
<y>29</y>
</hint>
<hint type="destinationlabel" >
<x>45</x>
<y>69</y>
<x>57</x>
<y>65</y>
</hint>
</hints>
</connection>
......@@ -437,12 +437,44 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>169</x>
<y>32</y>
<x>180</x>
<y>30</y>
</hint>
<hint type="destinationlabel" >
<x>163</x>
<y>85</y>
<x>194</x>
<y>65</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancel</sender>
<signal>clicked()</signal>
<receiver>time_selector</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>104</x>
<y>318</y>
</hint>
<hint type="destinationlabel" >
<x>105</x>
<y>300</y>
</hint>
</hints>
</connection>
<connection>
<sender>option_export_ok</sender>
<signal>pressed()</signal>
<receiver>time_selector</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>180</x>
<y>312</y>
</hint>
<hint type="destinationlabel" >
<x>180</x>
<y>291</y>
</hint>
</hints>
</connection>
......
......@@ -19,14 +19,13 @@
*\brief The main function of ViTE.
*/
int main(int argc, char **argv) {
int main(int argc, char **argv) {
Q_INIT_RESOURCE(vite);
Q_INIT_RESOURCE(vite);
Info::Render::_key_alt = false;/* no CTRL key pushed */
Info::Render::_key_alt = false;/* no CTRL key pushed */
Interface_console console(argc, argv);
Interface_console console(argc, argv);
return console.run();
}
return console.run();
}
......@@ -13,12 +13,6 @@
#include <cstdlib> /* for macros EXIT_SUCCESS and EXIT_FAILURE */
/*!
* \brief unity for count elements such as number of states or events... NOT USED YET
*/
......@@ -38,9 +32,6 @@ typedef double Element_col;
typedef double Times;
/* Message management */
#include "message/Message.hpp"
......@@ -48,7 +39,7 @@ typedef double Times;