Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
vite
Commits
0939918c
Commit
0939918c
authored
Apr 30, 2009
by
Johnny Jazeix
Browse files
Debut d'ajout des stats (non fonctionnel). Ca affiche un peu sur la
ligne de commande mais ca bug des fois.
parent
510fbeb3
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
src/interface/interface_console.cpp
View file @
0939918c
...
...
@@ -273,9 +273,6 @@ int Interface_console::get_state(int argc, char** argv){
int
state
=
_STATE_DISPLAY_HELP
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
((
string
)
argv
[
i
]
==
"-h"
)
{
...
...
@@ -283,7 +280,7 @@ int Interface_console::get_state(int argc, char** argv){
return
_STATE_DISPLAY_HELP
;
}
else
if
((
string
)
argv
[
i
]
==
"-f"
||
(
string
)
argv
[
i
]
==
"-a"
)
{
// We want to open the file which follow this argument
// We want to open the file which follow
s
this argument
i
++
;
if
(
i
<
argc
)
{
_file_opened
=
argv
[
i
];
...
...
@@ -295,7 +292,7 @@ int Interface_console::get_state(int argc, char** argv){
}
}
else
if
((
string
)
argv
[
i
]
==
"-e"
)
{
// We want to export the file which follow this argument
// We want to export the file which follow
s
this argument
i
++
;
if
(
i
<
argc
)
{
_path_to_export
=
argv
[
i
];
...
...
@@ -307,7 +304,7 @@ int Interface_console::get_state(int argc, char** argv){
}
}
else
if
((
string
)
argv
[
i
]
==
"-t"
)
{
// We want to export the file which follow this argument
// We want to export the file which follow
s
this argument
extract_times
(
argv
[
++
i
]);
if
(
_time_end
==
-
1
||
_time_start
==
-
1
){
cerr
<<
"One of the time do not exist"
<<
endl
;
...
...
@@ -320,7 +317,7 @@ int Interface_console::get_state(int argc, char** argv){
state
|=
_STATE_IN_AN_INTERVAL
;
}
else
if
(
argv
[
i
][
0
]
==
'-'
)
{
// This is here where we put new options !! (for filters for example
or export
)
// This is here where we put new options !! (for filters for example)
if
((
string
)
argv
[
i
]
==
"-epsilon"
)
{
i
++
;
...
...
@@ -339,6 +336,51 @@ int Interface_console::get_state(int argc, char** argv){
}
}
}
else
if
((
string
)
argv
[
i
]
==
"-wide"
)
{
i
++
;
if
(
i
>
argc
)
{
cerr
<<
"need an other argument for wide"
<<
endl
;
return
_STATE_UNKNOWN
;
}
double
wide
=
convert_to_double
(
argv
[
i
]);
if
(
wide
<
0.
)
{
cerr
<<
"need a positive width for the export"
<<
endl
;
return
_STATE_UNKNOWN
;
}
else
{
Svg
::
set_wide_factor
(
wide
);
}
}
else
if
((
string
)
argv
[
i
]
==
"-grow"
)
{
i
++
;
if
(
i
>
argc
)
{
cerr
<<
"need an other argument for grow"
<<
endl
;
return
_STATE_UNKNOWN
;
}
double
grow
=
convert_to_double
(
argv
[
i
]);
if
(
grow
<
0.
)
{
cerr
<<
"need a positive grown for the export"
<<
endl
;
return
_STATE_UNKNOWN
;
}
else
{
Svg
::
set_height_factor
(
grow
);
}
}
else
if
((
string
)
argv
[
i
]
==
"-scale"
)
{
i
++
;
if
(
i
>
argc
)
{
cerr
<<
"need an other argument for scale"
<<
endl
;
return
_STATE_UNKNOWN
;
}
double
scale
=
convert_to_double
(
argv
[
i
]);
if
(
scale
<
0.
)
{
cerr
<<
"need a positive scale for the export"
<<
endl
;
return
_STATE_UNKNOWN
;
}
else
{
Svg
::
set_scale_frequency
(
scale
);
}
}
else
if
((
string
)
argv
[
i
]
==
"-interval"
)
{
if
(
!
(
i
+
2
<
argc
))
{
...
...
@@ -360,49 +402,10 @@ int Interface_console::get_state(int argc, char** argv){
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
;
return
_STATE_UNKNOWN
;
}
if
(
argv
[
i
+
1
][
0
]
==
'-'
)
{
cerr
<<
"wide -"
<<
endl
;
return
_STATE_UNKNOWN
;
}
Svg
::
set_wide_factor
(
atof
(
argv
[
i
+
1
]));
i
++
;
}
else
if
((
string
)
argv
[
i
]
==
"-grow"
)
{
if
(
!
(
i
+
1
<
argc
))
{
cerr
<<
"grow argc"
<<
endl
;
return
_STATE_UNKNOWN
;
}
if
(
argv
[
i
+
1
][
0
]
==
'-'
)
{
cerr
<<
"grow -"
<<
endl
;
return
_STATE_UNKNOWN
;
}
Svg
::
set_height_factor
(
atof
(
argv
[
i
+
1
]));
i
++
;
}
else
if
((
string
)
argv
[
i
]
==
"-scale"
)
{
if
(
!
(
i
+
1
<
argc
))
{
cerr
<<
"scale argc"
<<
endl
;
return
_STATE_UNKNOWN
;
}
if
(
argv
[
i
+
1
][
0
]
==
'-'
)
{
cerr
<<
"scale -"
<<
endl
;
return
_STATE_UNKNOWN
;
}
Svg
::
set_scale_frequency
(
atof
(
argv
[
i
+
1
]));
i
++
;
}
else
{
cerr
<<
"the argument "
<<
argv
[
i
]
<<
" is unknown."
<<
endl
;
...
...
@@ -676,3 +679,7 @@ void Interface_console::set_min_value_for_export(const double d) {
void
Interface_console
::
set_max_value_for_export
(
const
double
d
)
{
_time_end
=
d
;
}
Trace
*
Interface_console
::
get_trace
()
const
{
return
_trace
;
}
src/interface/interface_console.hpp
View file @
0939918c
...
...
@@ -404,7 +404,10 @@ public:
*\param d The double.
*/
void
set_max_value_for_export
(
const
double
d
);
Trace
*
get_trace
()
const
;
public
slots
:
/*!
...
...
src/interface/interface_graphic.cpp
View file @
0939918c
...
...
@@ -37,6 +37,9 @@ Interface_graphic::Interface_graphic(Interface_console* core, QWidget *parent):Q
setMouseTracking
(
true
);
/* to catch mouse events */
_help_widget
=
new
Help
();
_stats_window
=
new
Stats_window
(
_core
,
this
);
}
Interface_graphic
::~
Interface_graphic
(){
...
...
@@ -542,6 +545,16 @@ void Interface_graphic::on_about_triggered(){
"The main page project is: <a href=
\"
http://vite.gforge.inria.fr/
\"
>http://vite.gforge.inria.fr/</a>.<br /><br />"
));
}
void
Interface_graphic
::
on_show_stats_triggered
(){
if
(
_core
->
get_trace
()
!=
NULL
)
{
_stats_window
->
set_trace
(
_core
->
get_trace
());
_stats_window
->
init_window
();
_stats_window
->
show
();
}
else
{
error
(
"Must load a trace before viewing stats"
);
}
}
void
Interface_graphic
::
on_no_warning_triggered
(){
_no_warning
=
!
_no_warning
;
...
...
src/interface/interface_graphic.hpp
View file @
0939918c
...
...
@@ -13,7 +13,7 @@ class Interface_graphic;
#include
"../ui_main_window.h"
/* the main window graphical interface */
/* Global informations */
#include
"info/info.hpp"
#include
"
../
info/info.hpp"
#include
"interface.hpp"
#include
"interface_console.hpp"
...
...
@@ -21,6 +21,8 @@ class Interface_graphic;
#include
"resource.hpp"
#include
"help.hpp"
#include
"../statistics/Stats_window.hpp"
/*!
*\brief This class is a graphical interface which creates a window, it inherited from the Interface interface.
*/
...
...
@@ -212,6 +214,10 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
*/
Help
*
_help_widget
;
/*!
* \brief The window used to print stats.
*/
Stats_window
*
_stats_window
;
/***********************************
*
...
...
@@ -434,6 +440,11 @@ protected slots:
*/
void
on_about_triggered
();
/*!
*\brief A slot called when 'statistics' in the menu is clicked.
*/
void
on_show_stats_triggered
();
/*!
*\brief A slot called when 'no_warning' in the menu is clicked.
*/
...
...
src/interface/main_window.ui
View file @
0939918c
This diff is collapsed.
Click to expand it.
src/interface/stats_viewer.ui
0 → 100644
View file @
0939918c
<ui version="4.0" >
<class>stats_viewer</class>
<widget class="QMainWindow" name="stats_viewer" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>482</height>
</rect>
</property>
<property name="windowTitle" >
<string>statistics viewer</string>
</property>
<property name="windowIcon" >
<iconset resource="vite.qrc" >
<normaloff>:/icon/icon/vite.png</normaloff>:/icon/icon/vite.png</iconset>
</property>
<widget class="QWidget" name="centralwidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>26</y>
<width>660</width>
<height>456</height>
</rect>
</property>
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>20</x>
<y>87</y>
<width>621</width>
<height>351</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QVBoxLayout" name="stats_area" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
</layout>
</item>
<item>
<widget class="QScrollBar" name="y_scroll" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_5" >
<property name="geometry" >
<rect>
<x>20</x>
<y>10</y>
<width>621</width>
<height>79</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Selected node :</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="_nodes_selected" >
<property name="selectionMode" >
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="headerHidden" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout1" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>start time</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="_start_time_widget" />
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>end time</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="_end_time_widget" />
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Kind of viewing</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox" >
<item>
<property name="text" >
<string>Chart</string>
</property>
</item>
<item>
<property name="text" >
<string>Horizontal percentage</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QPushButton" name="reload_button" >
<property name="text" >
<string>Reload</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="export_button" >
<property name="text" >
<string>Export</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>26</height>
</rect>
</property>
</widget>
</widget>
<resources>
<include location="vite.qrc" />
</resources>
<connections/>
</ui>
src/interface/vite.qrc
View file @
0939918c
...
...
@@ -26,5 +26,6 @@
<file>info_window.ui</file>
<file>main_window.ui</file>
<file>option_export_window.ui</file>
<file>stats_viewer.ui</file>
</qresource>
</RCC>
src/render/render_opengl.hpp
View file @
0939918c
...
...
@@ -87,15 +87,11 @@ struct Selection_{
/*!
* \brief This class redefined the OpenGL widget - QGLWidget - to display the trace.
*/
class
Render_opengl
:
public
QGLWidget
,
public
Render
{
class
Render_opengl
:
public
QGLWidget
,
public
Render
{
Q_OBJECT
protected:
/*!
* \brief Contains container text coordinates.
*/
...
...
src/render/render_stats.hpp
0 → 100644
View file @
0939918c
/*!
*\file render_stats.hpp
*/
#ifndef RENDER_STATS_HPP
#define RENDER_STATS_HPP
class
Render_stats
;
#include
"resource.hpp"
/*!
* \brief This class provides an interface for render_stats classes like OpenGL or SVG.
*/
class
Render_stats
{
protected:
/*!
* \brief The opengl render area width in pixels.
*/
Element_pos
_screen_width
;
/*!
* \brief The opengl render area height in pixels.
*/
Element_pos
_screen_height
;
/*!
* \brief The opengl visibled scene width in the OpenGL units.
*/
Element_pos
_render_width
;
/*!
* \brief The opengl visibled scene height in the OpenGL units.
*/
Element_pos
_render_height
;
public:
/*!
* \brief Proceeds with the initialization of draw functions.
*/
virtual
void
start_draw
()
=
0
;
/*!
* \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.
*/
virtual
void
draw_container_name
(
const
Element_pos
x
,
const
Element_pos
y
,
const
std
::
string
value
)
=
0
;
/*!
* \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
*/
virtual
void
draw_container
(
const
Element_pos
x
,
const
Element_pos
y
,
const
Element_pos
w
,
const
Element_pos
h
)
=
0
;
/*!
* \brief Set the height of the render area.
*/
virtual
void
set_total_height
(
Element_pos
h
)
=
0
;
};
#endif
src/render/render_stats_opengl.cpp
0 → 100644
View file @
0939918c
/*!
*\file render_opengl.cpp
*/
#include
"render_opengl.hpp"
using
namespace
std
;
#define message *Message::get_instance() << "(" << __FILE__ << " l." << __LINE__ << "): "
Render_stats_opengl
::
Render_stats_opengl
(
QWidget
*
parent
)
:
QGLWidget
(
parent
){
}
Render_stats_opengl
::~
Render_stats_opengl
(){
}
void
Render_stats_opengl
::
initializeGL
(){
makeCurrent
();
glClearColor
(
1.0
,
0.5
,
0.55
,
1.0
);
//glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable
(
GL_DEPTH_TEST
);
}
void
Render_stats_opengl
::
resizeGL
(
int
width
,
int
height
){
makeCurrent
();
glViewport
(
0
,
0
,
width
,
height
);
/* update informations about widget size */
_screen_width
=
width
;
_screen_height
=
height
;
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glOrtho
(
0
,
_render_width
,
0
,
_render_height
,
0
,
-
1000
);
glMatrixMode
(
GL_MODELVIEW
);
cout
<<
"resize: ("
<<
width
<<
", "
<<
height
<<
")."
<<
endl
;
doneCurrent
();
}
void
Render_stats_opengl
::
paintGL
(){
makeCurrent
();
// resizeGL(width(), height());
glLoadIdentity
();
glMatrixMode
(
GL_PROJECTION
);
gluOrtho2D
(
0
,
_screen_width
,
0
,
_screen_height
);
glPushMatrix
();
glTranslated
(
0
,
10
,
0
);
glBegin
(
GL_QUADS
);
{
glColor3ub
(
255
,
123
,
0
);
glVertex2d
(
0
,
10
);
glVertex2d
(
125
,
10
);
glVertex2d
(
125
,
25
);
glVertex2d
(
0
,
25
);
}
glEnd
();
glPopMatrix
();
doneCurrent
();
}
void
Render_stats_opengl
::
start_draw
(){
}
void
Render_stats_opengl
::
draw_container_name
(
const
Element_pos
x
,
const
Element_pos
y
,
const
std
::
string
value
)
{
cout
<<
"container name: "
<<
value
<<
" pos : ("
<<
x
<<
","
<<
y
<<
")."
<<
endl
;
}
void
Render_stats_opengl
::
draw_container
(
const
Element_pos
x
,
const
Element_pos
y
,
const
Element_pos
w
,
const
Element_pos
h
)
{
cout
<<
"draw_container: "
<<
endl
<<
"
\t
pos: ("
<<
x
<<
","
<<
y
<<
"), taille: ("
<<
w
<<
","
<<
h
<<
")."
<<
endl
;
}
void
Render_stats_opengl
::
set_total_height
(
Element_pos
h
)
{
_render_height
=
h
;
cout
<<