Commit 45084711 authored by Augustin Degomme's avatar Augustin Degomme

Feature : add an Interval Selection Window, allowing to select a displayable...

Feature : add an Interval Selection Window, allowing to select a displayable interval on the trace. (Preferences/Interval Selection)

Combined with IntervalOfContainers and Serialization, this allows to change the displayed interval and load only the data of the wanted interval, while freeing memory for non displayed zones.
parent d5e3f649
......@@ -101,6 +101,9 @@ SET(VITE_HDRS
interface/Interface_graphic.hpp
interface/Node_select.hpp
interface/viteqtreewidget.hpp
interface/Interval_select.hpp
interface/qxtspanslider.h
interface/qxtspanslider_p.h
# Core header
core/Core.hpp
core/getopt.h
......@@ -143,6 +146,7 @@ SET(VITE_UIS
interface/global_cmd.ui
interface/list_of_counter_to_export.ui
interface/node_select.ui
interface/interval_select.ui
)
SET(VITE_SRCS
......@@ -214,6 +218,8 @@ SET(VITE_SRCS
interface/Interface_graphic.cpp
interface/Node_select.cpp
interface/viteqtreewidget.cpp
interface/Interval_select.cpp
interface/qxtspanslider.cpp
# Plugin code file
plugin/Command_window.cpp
plugin/Plugin_window.cpp
......
......@@ -69,6 +69,8 @@ bool Info::Render::_key_alt = false;
bool Info::Render::_key_ctrl = false;
Element_pos Info::Render::_x_min_visible = 0.0;
Element_pos Info::Render::_x_max_visible = 0.0;
Element_pos Info::Render::_x_min = 0.0;
Element_pos Info::Render::_x_max = 0.0;
Element_pos Info::Render::_info_x = 0.0;
Element_pos Info::Render::_info_y = 0.0;
......@@ -84,8 +86,8 @@ bool Info::Splitter::load_splitted = false;
bool Info::Splitter::preview = false;
std::string Info::Splitter::path ;
std::string Info::Splitter::filename ;
Element_pos Info::Splitter::_x_min = 0.;
Element_pos Info::Splitter::_x_max = 0.;
Element_pos Info::Splitter::_x_min = 0.0;
Element_pos Info::Splitter::_x_max = 0.0;
int Info::Trace::depth=0;
......
......@@ -199,6 +199,16 @@ public:
*/
static Element_pos _x_min_visible;
/*!
* \brief Contains the trace maximum visible time.
*/
static Element_pos _x_max;
/*!
* \brief Contains the trace minimum visible time, uncorrected (state width isn't removed)
*/
static Element_pos _x_min;
/*!
* \brief Contains the trace maximum visible time.
*/
......
......@@ -119,6 +119,7 @@ Interface_graphic::Interface_graphic(Core* core, QWidget *parent):QMainWindow(pa
_plugin_window = NULL;
_ui_settings = NULL;
_ui_node_selection=NULL;
_ui_interval_selection=NULL;
// _cmd_window = NULL;
_cmd_window = new Command_window(this,this);
......@@ -130,6 +131,13 @@ Interface_graphic::Interface_graphic(Core* core, QWidget *parent):QMainWindow(pa
connect(quit, SIGNAL(triggered()), _ui_node_selection, SLOT(close()));
}
if (!_ui_interval_selection) {
_ui_interval_selection = new Interval_select(this, 0);
//connect( _ui_node_selection, SIGNAL(settings_changed()), this, SLOT(update_settings()));
// To close the window when we quit the application
connect(quit, SIGNAL(triggered()), _ui_interval_selection, SLOT(close()));
}
// For drag and drop operations
setAcceptDrops(true);
}
......@@ -436,6 +444,9 @@ void Interface_graphic::change_zoom_box_value(int new_value){
else{
_ui_zoom_box->setCurrentIndex(index);/* value exists, select it */
}
//update the interval selection display
if(_ui_interval_selection!=NULL)_ui_interval_selection->update_values();
}
......@@ -727,6 +738,7 @@ void Interface_graphic::on_close_triggered(){
void Interface_graphic::on_quit_triggered(){
((QWidget*)_ui_node_selection)->close();
((QWidget*)_ui_interval_selection)->close();
((QWidget*)_ui_help_window)->close();
((QWidget*)this)->close();
}
......@@ -863,6 +875,21 @@ void Interface_graphic::on_show_settings_triggered() {
//}
_ui_node_selection->show();
}
void Interface_graphic::on_interval_selection_triggered() {
//if (!_ui_node_selection) {
// _ui_node_selection = new Node_select(this, 0);
if(!_ui_interval_selection->get_trace() && _core->get_trace()){//first use
_ui_interval_selection->set_trace(_core->get_trace());
}
//connect( _ui_node_selection, SIGNAL(settings_changed()), this, SLOT(update_settings()));
// To close the window when we quit the application
//connect(quit, SIGNAL(triggered()), _ui_node_selection, SLOT(close()));
//}
_ui_interval_selection->show();
}
void Interface_graphic::on_actionCommand_triggered(){
if(_core->get_trace()){
......@@ -1004,6 +1031,9 @@ void Interface_graphic::closeEvent(QCloseEvent *event){
if(_ui_node_selection)
_ui_node_selection->close();
if(_ui_interval_selection)
_ui_interval_selection->close();
}
const std::string Interface_graphic::get_filename() const{
......@@ -1018,6 +1048,11 @@ Core * Interface_graphic::get_console(){
Node_select* Interface_graphic::get_node_select(){
return _ui_node_selection;
}
Interval_select* Interface_graphic::get_interval_select(){
return _ui_interval_selection;
}
void Interface_graphic::update_recent_files_menu() {
const QStringList filenames = Session::get_recent_files();
QString absoluteFilename;
......
......@@ -71,6 +71,7 @@ class QProgressDialog;
#include "interface/Interface.hpp"
#include "interface/Settings_window.hpp"
#include "interface/Node_select.hpp"
#include "interface/Interval_select.hpp"
/*!
*\brief This class is a graphical interface which creates a window, it inherited from the Interface interface.
......@@ -224,6 +225,11 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
*/
Node_select* _ui_node_selection;
/*!
* \brief Dialog box to allow user to select nodes to display
*/
Interval_select* _ui_interval_selection;
/*!
* \brief Text area which informs the user about the trace resume.
*/
......@@ -483,6 +489,13 @@ public:
*/
Node_select* get_node_select();
/*!
* \fn get_interval_select()
* \brief To get the node selection console
*/
Interval_select* get_interval_select();
/*!
* \fn update_recent_files_menu()
* \brief update the recent files opened menu
......@@ -607,6 +620,11 @@ protected slots:
*/
void on_node_selection_triggered();
/*!
*\brief A slot called when 'Node selection' in the menu is clicked.
*/
void on_interval_selection_triggered();
/*!
* \brief A slot called when 'command' in the menu is clicked.
*/
......
This diff is collapsed.
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
/*!
*\file Interval_select.hpp
*/
#ifndef INTERVAL_SELECT_HPP
#define INTERVAL_SELECT_HPP
class Interval_select;
/* For moc compilation */
#include <string>
#include <map>
#include <list>
/* -- */
#include <QWidget>
#include "ui_interval_select.h"
#include "trace/values/Values.hpp"
#include "trace/EntityValue.hpp"
#include "trace/EntityTypes.hpp"
#include "trace/Entitys.hpp"
#include "trace/tree/Interval.hpp"
#include "trace/Trace.hpp"
#include "interface/Interface_graphic.hpp"
/* -- */
/*!
* \class Node select
* \brief Class used to select which containers should be displayed
*
*/
class Interval_select : public QDialog, protected Ui::interval_selector {
Q_OBJECT
private:
Trace* _trace;
Interface_graphic *_console;
bool _applied;
bool _auto_refresh;
public:
/*!
* Default constructor
* \param parent The parent widget of the window.
*/
Interval_select( Interface_graphic *console, QWidget *parent = 0);
~Interval_select();
/*!
* \fn set_trace(Trace *trace)
* \brief Set the trace parsed (give the container names)
* \param trace The trace.
*/
void set_trace(Trace *trace);
/*!
* \fn get_trace()
* \brief returns the trace
*/
Trace * get_trace();
void apply_settings();
void update_values();
private slots:
void minSpinBoxValueChanged( double value );
void minSliderValueChanged( int value );
void maxSpinBoxValueChanged( double value );
void maxSliderValueChanged( int value );
void on_ok_button_clicked();
void on_cancel_button_clicked();
void on_reset_button_clicked();
void on_apply_button_clicked();
void on_auto_refresh_box_stateChanged();
signals:
void minValueChanged( double value );
void maxValueChanged( double value );
};
#endif // INTERVAL_SELECT_HPP
......@@ -260,7 +260,7 @@ void Stats_window::set_selected_nodes(string kind_of_state){
_nodes_displayed->clear();
//can we load that from _nodes_original instead ?
set_displayed_container_names();
Element_pos zoom[2]={Info::Render::_x_min_visible, Info::Render::_x_max_visible};
Element_pos zoom[2]={Info::Render::_x_min, Info::Render::_x_max};
Info::Render::_x_min_visible = 0.0;
Info::Render::_x_max_visible = 0.0;
_trace->set_view_root_containers(_displayed_containers);
......@@ -335,7 +335,7 @@ void Node_select::on_load_button_clicked(){
build_displayed_nodes(_displayed_containers);
_trace->set_view_root_containers(_displayed_containers);
Element_pos it[2]={Info::Render::_x_min_visible, Info::Render::_x_max_visible};
Element_pos it[2]={Info::Render::_x_min, Info::Render::_x_max};
Info::Render::_x_min_visible = 0.0;
Info::Render::_x_max_visible = 0.0;
......
......@@ -189,7 +189,6 @@ private slots:
void on_export_button_clicked();
void on_load_button_clicked();
public slots: // just for testing, remove
void on_display_button_clicked();
};
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>interval_selector</class>
<widget class="QDialog" name="interval_selector">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>522</width>
<height>283</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>522</width>
<height>283</height>
</size>
</property>
<property name="windowTitle">
<string>Interval Selection</string>
</property>
<widget class="QxtSpanSlider" name="interval_slider">
<property name="geometry">
<rect>
<x>60</x>
<y>140</y>
<width>401</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QDoubleSpinBox" name="minSpinBox">
<property name="geometry">
<rect>
<x>140</x>
<y>80</y>
<width>101</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QDoubleSpinBox" name="maxSpinBox">
<property name="geometry">
<rect>
<x>350</x>
<y>80</y>
<width>101</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>140</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Min</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>470</x>
<y>140</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Max</string>
</property>
</widget>
<widget class="QLabel" name="min_value">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
<widget class="QLabel" name="max_value">
<property name="geometry">
<rect>
<x>460</x>
<y>160</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>60</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>New min value :</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>270</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>New max value :</string>
</property>
</widget>
<widget class="QPushButton" name="ok_button">
<property name="geometry">
<rect>
<x>300</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
<widget class="QPushButton" name="cancel_button">
<property name="geometry">
<rect>
<x>390</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<widget class="QPushButton" name="reset_button">
<property name="geometry">
<rect>
<x>120</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
<widget class="QPushButton" name="apply_button">
<property name="geometry">
<rect>
<x>210</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
<widget class="QCheckBox" name="auto_refresh_box">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>350</x>
<y>180</y>
<width>171</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Auto Refresh (disable if slow)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QxtSpanSlider</class>
<extends>QSlider</extends>
<header>interface/qxtspanslider.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -249,6 +249,7 @@
<addaction name="separator"/>
<addaction name="show_settings"/>
<addaction name="node_selection"/>
<addaction name="interval_selection"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
......@@ -536,6 +537,11 @@
<string>Node Selection</string>
</property>
</action>
<action name="interval_selection">
<property name="text">
<string>Interval Selection</string>
</property>
</action>
<action name="shaded_states">
<property name="checkable">
<bool>true</bool>
......
/****************************************************************************
**
** Copyright (C) Adam Higerd <coda@bobandgeorge.com>. Some rights reserved.
**
** This file is part of the QxtCore module of the
** Qt eXTension library <http://libqxt.sourceforge.net>
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or any later version.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** There is aditional information in the LICENSE file of libqxt.
** If you did not receive a copy of the file try to download it or
** contact the libqxt Management
**
****************************************************************************/
/**
\class QxtPimpl QxtPimpl
\ingroup core
\brief Hide private details of a class
Application code generally doesn't have to be concerned about hiding its
implementation details, but when writing library code it is important to
maintain a constant interface, both source and binary. Maintaining a constant
source interface is easy enough, but keeping the binary interface constant
means moving implementation details into a private class. The PIMPL, or
d-pointer, idiom is a common method of implementing this separation. QxtPimpl
offers a convenient way to connect the public and private sides of your class.
\section start Getting Started
Before you declare the public class, you need to make a forward declaration
of the private class. The private class must have the same name as the public
class, followed by the word Private. For example, a class named MyTest would
declare the private class with:
\code
class MyTestPrivate;
\endcode
\subsection pub The Public Class
Generally, you shouldn't keep any data members in the public class without a
good reason. Functions that are part of the public interface should be declared
in the public class, and functions that need to be available to subclasses (for
calling or overriding) should be in the protected section of the public class.
To connect the private class to the public class, include the
QXT_DECLARE_PRIVATE macro in the private section of the public class. In the
example above, the private class is connected as follows:
\code
private:
QXT_DECLARE_PRIVATE(MyTest);
\endcode
Additionally, you must include the QXT_INIT_PRIVATE macro in the public class's
constructor. Continuing with the MyTest example, your constructor might look
like this:
\code
MyTest::MyTest() {
// initialization
QXT_INIT_PRIVATE(MyTest);
}
\endcode
\subsection priv The Private Class
As mentioned above, data members should usually be kept in the private class.
This allows the memory layout of the private class to change without breaking
binary compatibility for the public class. Functions that exist only as
implementation details, or functions that need access to private data members,
should be implemented here.
To define the private class, inherit from the template QxtPrivate class, and
include the QXT_DECLARE_PUBLIC macro in its public section. The template
parameter should be the name of the public class. For example:
\code
class MyTestPrivate : public QxtPrivate<MyTest> {
public:
MyTestPrivate();
QXT_DECLARE_PUBLIC(MyTest);
};
\endcode
\section cross Accessing Private Members
Use the qxt_d() function (actually a function-like object) from functions in
the public class to access the private class. Similarly, functions in the
private class can invoke functions in the public class by using the qxt_p()
function (this one's actually a function).
For example, assume that MyTest has methods named getFoobar and doBaz(),
and MyTestPrivate has a member named foobar and a method named doQuux().
The code might resemble this example:
\code
int MyTest::getFoobar() {
return qxt_d().foobar;
}
void MyTestPrivate::doQuux() {
qxt_p().doBaz(foobar);
}
\endcode
*/
#ifndef QXTPIMPL_H
#define QXTPIMPL_H
/*! \relates QxtPimpl
* Declares that a public class has a related private class.
*
* This shuold be put in the private section of the public class. The parameter is the name of the public class.
*/
#define QXT_DECLARE_PRIVATE(PUB) friend class PUB##Private; QxtPrivateInterface<PUB, PUB##Private> qxt_d;
/*! \relates QxtPimpl
* Declares that a private class has a related public class.
*
* This may be put anywhere in the declaration of the private class. The parameter is the name of the public class.
*/
#define QXT_DECLARE_PUBLIC(PUB) friend class PUB;
/*! \relates QxtPimpl
* Initializes resources owned by the private class.
*
* This should be called from the public class's constructor,
* before qxt_d() is used for the first time. The parameter is the name of the public class.
*/
#define QXT_INIT_PRIVATE(PUB) qxt_d.setPublic(this);
#ifdef QXT_DOXYGEN_RUN
/*! \relates QxtPimpl
* Returns a reference to the private class.
*
* This function is only available in a class using \a QXT_DECLARE_PRIVATE.
*/
QxtPrivate<PUB>& qxt_d();
/*! \relates QxtPimpl
* Returns a const reference to the private class.
*
* This function is only available in a class using \a QXT_DECLARE_PRIVATE.
* This overload will be automatically used in const functions.
*/
const QxtPrivate<PUB>& qxt_d();
/*! \relates QxtPimpl
* Returns a reference to the public class.
*
* This function is only available in a class using \a QXT_DECLARE_PUBLIC.
*/
PUB& qxt_p();
/*! \relates QxtPimpl
* Returns a const reference to the public class.
*
* This function is only available in a class using \a QXT_DECLARE_PUBLIC.