Commit e900b81f authored by Kevin Coulomb's avatar Kevin Coulomb

Segfault deleted and added some selection on proc

parent 9c18ef6e
......@@ -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{
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
}
*/
......@@ -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);
......
......@@ -970,3 +970,12 @@ void Render_opengl::draw_stored_circles(){
}
}
void Render_opengl::clear_arrow (){
_arrows.clear();
}
void Render_opengl::clear_text (){
_texts.clear();
}
......@@ -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 ();
};
......
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