diff --git a/src/core/Core.cpp b/src/core/Core.cpp index 521444da8aa2b44cf58a5fc3358d2379b5db9130..909b980fccea61d7fb1bf99b0921688388102eb1 100644 --- a/src/core/Core.cpp +++ b/src/core/Core.cpp @@ -226,33 +226,39 @@ bool Core::draw_trace(const string & filename, const int format){ int time_buf; time_buf = 0; - - // Get the parser in function of the extension of the file - const string::size_type position_of_dot = filename.find_last_of('.'); - if (position_of_dot != string::npos) { - if(filename.substr(position_of_dot) == ".trace") { - parser = new ParserPaje(); - } + if (!_is_trace_loaded){ + // Get the parser in function of the extension of the file + const string::size_type position_of_dot = filename.find_last_of('.'); + if (position_of_dot != string::npos) { + if(filename.substr(position_of_dot) == ".trace") { + parser = new ParserPaje(); + } #ifdef WITH_OTF - else if(filename.substr(position_of_dot) == ".otf") { - parser = new ParserOTF(); - } + else if(filename.substr(position_of_dot) == ".otf") { + parser = new ParserOTF(); + } #endif //WITH_OTF - else if(filename.substr(position_of_dot) == ".ept") { - parser = new ParserVite(); + else if(filename.substr(position_of_dot) == ".ept") { + parser = new ParserVite(); + } + else { + Error::set(Error::_BAD_FILE_EXTENSION, Error::_WARNING); + parser = new ParserPaje(); + } } else { Error::set(Error::_BAD_FILE_EXTENSION, Error::_WARNING); parser = new ParserPaje(); } + + + + parser->set_file_to_parse(filename); } else { - Error::set(Error::_BAD_FILE_EXTENSION, Error::_WARNING); - parser = new ParserPaje(); + _render_opengl->clear_arrow (); + _render_opengl->clear_text (); } - - - parser->set_file_to_parse(filename); QApplication::setOverrideCursor(Qt::WaitCursor); @@ -362,7 +368,11 @@ bool Core::draw_trace(const string & filename, const int format){ if (Info::Render::_x_min_visible == Info::Render::_x_max_visible){// first time _trace->set_interval_constrained(new Interval(0,_trace->get_max_date())); }else{ - _trace->set_interval_constrained(new Interval(Info::Render::_x_min_visible, Info::Render::_x_max_visible)); + // _trace->set_interval_constrained(new Interval(Info::Render::_x_min_visible, Info::Render::_x_max_visible)); + // + // WARNING I HAVE COMMENTED THIS LINE BECAUSE I FOUND IT USELESS. I TRIED AFTER AND NO BUG APPEARED + // MOREOVER IT ENABLES THE PLUGIN TIME SELECTION + // } @@ -662,12 +672,12 @@ void Core::extract_times(const char *name) { void Core::launch_action(int state, void* arg) { DrawTrace buf; - QGLFormat format(QGL::HasOverlay); + QGLFormat format (QGL::HasOverlay); switch(state) { case _STATE_DISPLAY_HELP : - display_help(); + display_help (); break; case _STATE_LAUNCH_GRAPHICAL_INTERFACE : @@ -717,7 +727,7 @@ void Core::launch_action(int state, void* arg) { _main_window->opening_file(_file_opened);/* Must be called after binding the render area to the main window */ if(false==draw_trace(_file_opened, _DRAW_OPENGL)) - message << QObject::tr("Draw trace failed").toStdString () << Message::ende; + message << QObject::tr ("Draw trace failed").toStdString () << Message::ende; } _is_window_displayed = true; @@ -726,7 +736,6 @@ void Core::launch_action(int state, void* arg) { case _STATE_OPEN_FILE_IN_AN_INTERVAL: launch_action(_STATE_OPEN_FILE, NULL); - break; case _STATE_RELEASE_RENDER_AREA: @@ -734,6 +743,7 @@ void Core::launch_action(int state, void* arg) { message << "Close file : an error occured with trace releasing." << Message::ende; _file_opened.clear(); + if (false == _is_trace_loaded){ *Message::get_instance() << "Try to release a render area whereas no file was loaded" << Message::ende; }else{ diff --git a/src/core/Core.hpp b/src/core/Core.hpp index 1d3fbb5c5902037860307aefe929a109283d6dd6..0c8be5f20980da345532ee763899c41abd0c9fcd 100644 --- a/src/core/Core.hpp +++ b/src/core/Core.hpp @@ -244,7 +244,7 @@ protected: /*! * \brief Use to know if a trace is loaded. * - * This attributes is used to know for an export if a trace has already be parsed. + * This attributes is used to know for an export if a trace has already been parsed. */ bool _is_trace_loaded; diff --git a/src/interface/Interface_graphic.cpp b/src/interface/Interface_graphic.cpp index a16c923bd0cde42352a9771138a48eb8b0767c94..f1ad483dad821431d420ed027a55867a4c445523 100644 --- a/src/interface/Interface_graphic.cpp +++ b/src/interface/Interface_graphic.cpp @@ -117,8 +117,16 @@ Interface_graphic::Interface_graphic(Core* core, QWidget *parent):QMainWindow(pa Interface_graphic::~Interface_graphic(){ - if(_stats_window != NULL) + if(_stats_window != NULL){ delete _stats_window; + _stats_window = NULL; + } + + if (_cmd_window != NULL){ + delete _cmd_window; + _cmd_window = NULL; + } + /* Qt desallocates this, _ui_info_window and _render_area automatically */ } @@ -666,8 +674,14 @@ void Interface_graphic::on_close_triggered(){ //_stats_window->close_window(); _core->launch_action(Core::_STATE_RELEASE_RENDER_AREA); - - + if (_cmd_window){ + delete _cmd_window; + _cmd_window = NULL; + } + if (_stats_window){ + delete _stats_window; + _stats_window = NULL; + } _is_rendering_trace = false; @@ -754,6 +768,8 @@ void Interface_graphic::on_about_triggered(){ } void Interface_graphic::on_show_stats_triggered(){ + + if(_core->get_trace() != NULL) { if(_stats_window == NULL) { //Creation of the window @@ -771,9 +787,9 @@ void Interface_graphic::on_show_stats_triggered(){ } void Interface_graphic::on_actionCommand_triggered(){ - //TODO if(_core->get_trace()){ - // _cmd_window = new Command_window(_core->get_trace(),this); + if (!_cmd_window) + _cmd_window = new Command_window (this, this); _cmd_window->set_trace(_core->get_trace()); _cmd_window->init_window(); _cmd_window->show(); diff --git a/src/plugin/Command_window.cpp b/src/plugin/Command_window.cpp index d4d2513490ef66007e642a6cb749049651861529..f5a511e874aed2de1122fa54b2804c6fa9c7ae8a 100644 --- a/src/plugin/Command_window.cpp +++ b/src/plugin/Command_window.cpp @@ -96,6 +96,7 @@ void Command_window::init_window() { // By default, cmd = useless void Command_window::on_execute_button_clicked(){ + const QString cmd = _ui_cmd_box->text(); QString start_time = _ui_start_box->text(); QString end_time = _ui_end_box->text(); @@ -145,8 +146,10 @@ void Command_window::on_execute_button_clicked(){ _trace->set_interval_constrained(new Interval(start_time.toDouble(),end_time.toDouble())); _trace->set_filter(filter.toDouble()); - _console->get_console()->launch_action(Core::_STATE_RELEASE_RENDER_AREA); + _console->get_console()->launch_action(Core::_STATE_RENDER_UPDATE); _console->get_console()->draw_trace(_console->get_filename(),Core::_DRAW_OPENGL); + + } @@ -232,3 +235,13 @@ void Command_window::show_error(){ // break; // } } +/* +Command_window::~Command_window (){ + delete _ui_layout; + delete _ui_cmd_box; + delete _ui_start_box; + delete _ui_end_box; + delete _ui_filter_box; + delete _ui_tree_box; +} +*/ diff --git a/src/plugin/Command_window.hpp b/src/plugin/Command_window.hpp index 08c8e01b209962c0952c1479ca236b51226d3eab..f68947c7376a6c8df7e77e5d45ca9e9c0ed9c7ef 100644 --- a/src/plugin/Command_window.hpp +++ b/src/plugin/Command_window.hpp @@ -86,6 +86,7 @@ private : public : void set_selected_nodes(); Command_window( QWidget *parent, Interface_graphic * i); + // ~Command_window (); void init_window(); void set_trace(Trace * t); diff --git a/src/render/Render_opengl.cpp b/src/render/Render_opengl.cpp index 61a4e58973391595d2c7cbb6e4708214485b93a4..357783adf5510be52b23afe30574992b783ab291 100644 --- a/src/render/Render_opengl.cpp +++ b/src/render/Render_opengl.cpp @@ -970,3 +970,12 @@ void Render_opengl::draw_stored_circles(){ } } + + +void Render_opengl::clear_arrow (){ + _arrows.clear(); +} + +void Render_opengl::clear_text (){ + _texts.clear(); +} diff --git a/src/render/Render_opengl.hpp b/src/render/Render_opengl.hpp index 20b3eaaa4dabaec21e8f9e90de7b217336767a6c..bc1ad18929c31ce3cc37597bda4d5a1955a7a358 100644 --- a/src/render/Render_opengl.hpp +++ b/src/render/Render_opengl.hpp @@ -562,6 +562,11 @@ public: void draw_stored_circles(); void draw_stored_texts(); + + // Function that only delette the arrows of the screen + void clear_arrow (); + // Function that only delette the text of the screen + void clear_text (); };