Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 5a3162f7 authored by Johnny Jazeix's avatar Johnny Jazeix

Doxygen comments + Some suppression of Windows warnings (mostly casts

not done) + Little moving for the container names in the stats diagram
parent 4ad436a1
......@@ -152,13 +152,15 @@ bool Interface_console::draw_trace(const string & filename, const int format){
if (loaded_f>0.0f){
/* divided by to have in second 1000 since time_elapsed.elapsed() returns ms */
time_buf = time_elapsed.elapsed() * (1.0 / loaded_f - 1.0) / 1000;
time_buf = (int)(time_elapsed.elapsed() * (1.0 / loaded_f - 1.0) / 1000);
if (time_buf>=3600){/* convert second in hour and min */
buf_txt << "Parsing... Remaining: " << time_buf/3600 << " h " << (time_buf%3600)/60 << " min " << time_buf%60 << " s";
}else if (time_buf>=60){/* convert second in min */
}
else if (time_buf>=60){/* convert second in min */
buf_txt << "Parsing... Remaining: " << time_buf/60 << " min " << time_buf%60 << " s";
}else{
}
else{
buf_txt << "Parsing... Remaining: " << time_buf << " s";
}
......
......@@ -38,7 +38,7 @@ Interface_graphic::Interface_graphic(Interface_console* core, QWidget *parent):Q
_help_widget = new Help();
_stats_window = new Stats_window(_core, this);
_stats_window = new Stats_window(this);
}
......@@ -275,17 +275,17 @@ Element_pos Interface_graphic::real_to_virtual_scroll_unit(int scroll_position,
int Interface_graphic::virtual_to_real_scroll_unit(Element_pos scroll_position, const char &axe){
switch (axe){
case 'x':
return (scroll_position*_x_factor_virtual_to_real);
return (int)(scroll_position*_x_factor_virtual_to_real);
break;
case 'y':
return (scroll_position*_y_factor_virtual_to_real);
return (int)(scroll_position*_y_factor_virtual_to_real);
break;
default:
error("Option not recognized.");
break;
}
return scroll_position;
return (int)scroll_position;
}
void Interface_graphic::change_zoom_box_value(int new_value){
......@@ -554,6 +554,7 @@ void Interface_graphic::on_about_triggered(){
void Interface_graphic::on_show_stats_triggered(){
if(_core->get_trace() != NULL) {
_stats_window->set_filename(_core->get_filename());
_stats_window->set_trace(_core->get_trace());
_stats_window->init_window();
_stats_window->show();
......
......@@ -779,7 +779,7 @@ inline void Render_opengl_dl::display_container(Element_count , Element_count ){
float length = 0;
const unsigned int buf_text_size = buf_txt.length();
const int size_of_container = 20*_x_scale_container_state*_render_width/_container_x_max;
const int size_of_container = (const int)(20*_x_scale_container_state*_render_width/_container_x_max);
for(unsigned int i = 0 ; i < buf_text_size ; i ++){
const char letter = buf_txt.c_str()[i];
length += glutBitmapWidth(GLUT_BITMAP_HELVETICA_10, letter);
......
......@@ -112,12 +112,17 @@ public:
void draw_axis(const Element_pos x, const Element_pos y, const Element_pos size_x, const Element_pos size_y);
/*!
* \brief Draw a rectangle.
* \param x the x position of the text.
* \param y the y position of the text.
* \param value the string value of the text.
* \param x the x position of the rectangle.
* \param y the y position of the rectangle.
* \param w the width of the rectangle.
* \param h the height position of the rectangle.
* \param r the red component color of the rectangle.
* \param g the green component color of the rectangle.
* \param b the blue component color of the rectangle.
*/
void draw_rect(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h, const Element_pos r, const Element_pos g, const Element_pos b);
/*!
* \fn end_draw()
* \brief Proceeds with the end of draw functions.
*/
void end_draw();
......@@ -136,15 +141,23 @@ public:
void translate_x(int value);
/*!
* \fn set_total_height(Element_pos h)
* \brief Set the height of the render area.
* \param h the new height.
*/
void set_total_height(Element_pos h);
/*!
* \fn set_total_width(Element_pos w)
* \brief Set the width of the render area.
* \param w the new width.
*/
void set_total_width(Element_pos w);
/*!
* \fn clear()
* \brief Reinitialize the render.
*/
void clear();
};
......@@ -170,8 +183,8 @@ inline void Render_stats_opengl::draw_horizontal_line(const Element_pos x, const
glBegin(GL_LINES);
{
glColor3ub(0, 0, 0);
glVertex2i(x, y);
glVertex2i(x+size_x, y);
glVertex2d(x, y);
glVertex2d(x+size_x, y);
}
glEnd();
}
......@@ -180,8 +193,8 @@ inline void Render_stats_opengl::draw_vertical_line(const Element_pos x, const E
glBegin(GL_LINES);
{
glColor3ub(0, 0, 0);
glVertex2i(x, y);
glVertex2i(x, y+size_y);
glVertex2d(x, y);
glVertex2d(x, y+size_y);
}
glEnd();
}
......@@ -190,28 +203,28 @@ inline void Render_stats_opengl::draw_axis(const Element_pos x, const Element_po
glBegin(GL_LINES);
{
glColor3ub(0, 0, 0);
glVertex2i(x, y);
glVertex2i(x+size_x, y);
glVertex2i(x, y);
glVertex2i(x, y+size_y);
glVertex2d(x, y);
glVertex2d(x+size_x, y);
glVertex2d(x, y);
glVertex2d(x, y+size_y);
}
glEnd();
glBegin(GL_TRIANGLES);/* create an arrow */
{
glColor3d(0, 0, 0);
glVertex2i(x-5, y+size_y-5);
glVertex2i(x, y+size_y);
glVertex2i(x+5, y+size_y-5);
glVertex2d(x-5, y+size_y-5);
glVertex2d(x, y+size_y);
glVertex2d(x+5, y+size_y-5);
}
glEnd();
glBegin(GL_TRIANGLES);/* create an arrow */
{
glColor3d(0, 0, 0);
glVertex2i(x+size_x-5, y+5);
glVertex2i(x+size_x, y);
glVertex2i(x+size_x-5, y-5);
glVertex2d(x+size_x-5, y+5);
glVertex2d(x+size_x, y);
glVertex2d(x+size_x-5, y-5);
}
glEnd();
}
......
......@@ -62,7 +62,7 @@ public:
/*!
* \brief The destructor
*/
~Render_stats_svg();
virtual ~Render_stats_svg();
/*!
* \brief Proceeds with the initialization of draw functions.
......@@ -108,30 +108,59 @@ public:
void draw_axis(const Element_pos x, const Element_pos y, const Element_pos size_x, const Element_pos size_y);
/*!
* \brief Draw a rectangle.
* \param x the x position of the text.
* \param y the y position of the text.
* \param value the string value of the text.
* \param x the x position of the rectangle.
* \param y the y position of the rectangle.
* \param w the width of the rectangle.
* \param h the height position of the rectangle.
* \param r the red component color of the rectangle.
* \param g the green component color of the rectangle.
* \param b the blue component color of the rectangle.
*/
void draw_rect(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h, const Element_pos r, const Element_pos g, const Element_pos b);
/*!
* \fn end_draw()
* \brief Proceeds with the end of draw functions.
*/
void end_draw();
/*!
* \fn set_total_height(Element_pos h)
* \brief Set the height of the render area.
* \param h the new height.
*/
void set_total_height(Element_pos h);
/*!
* \fn set_total_width(Element_pos w)
* \brief Set the width of the render area.
* \param w the new width.
*/
void set_total_width(Element_pos w);
/*!
* \fn clear()
* \brief Reinitialize the render.
*/
void clear();
/*!
* \fn height()
* \brief Return the height of the render area.
*/
inline double height(){return _RENDER_HEIGHT_DEFAULT;}
/*!
* \fn width()
* \brief Return the width of the render area.
*/
inline double width(){return _RENDER_WIDTH_DEFAULT;}
/*!
* \fn updateGL()
* \brief Unused for svg (openGL only)
*/
void updateGL(){}
/*!
......
......@@ -345,7 +345,7 @@ public:
void end_draw();
~Svg();
virtual ~Svg();
};
......@@ -477,7 +477,7 @@ inline void Svg::end_draw(){
}
void Svg::rectangle(const char* name,Element_pos w, Element_pos h,Element_pos x1,Element_pos y1, unsigned int r, unsigned int g, unsigned int b) {
void Svg::rectangle(const char* name, Element_pos w, Element_pos h,Element_pos x1,Element_pos y1, unsigned int r, unsigned int g, unsigned int b) {
_buffer << "\n<rect class='"<<name<<"' title='"<<name<<"' width='" << w
<<"' height='"<< h
<<"' x='" << x1
......@@ -686,7 +686,7 @@ inline void Svg::draw_state(const Element_pos start , const Element_pos end, con
}
Svg::rectangle("state",w,h, x,y,r*255 , g*255, b*255);
Svg::rectangle("state", w, h, x, y, (unsigned int)r*255, (unsigned int)g*255, (unsigned int)b*255);
}
......
......@@ -67,6 +67,12 @@ public:
end_draw(draw_object);
}
/*!
* \fn draw_container_name(T* draw_object, const int container_id) const
* \brief Print the i-th container name
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \param container_id the id of the container.
*/
virtual void draw_container_name(T* draw_object, const int container_id) const {
// Get the position for the i-th container name
......@@ -78,6 +84,12 @@ public:
draw_object->draw_text(pos_x, pos_y, name);
}
/*!
* \fn draw_diagram(T* draw_object, const int container_id)
* \brief Print the i-th diagram
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \param container_id the id of the container.
*/
virtual void draw_diagram(T* draw_object, const int container_id) {
Statistic *stat_temp = new Statistic();
this->_containers_to_print[container_id]->fill_stat(stat_temp, Interval(this->_start_time, this->_end_time));
......@@ -130,6 +142,12 @@ public:
delete stat_temp;
}
/*!
* \fn draw_legend(T* draw_object, const int container_id)
* \brief Print the legend for the i-th element (eg the color of each stats)
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \param container_id the id of the container.
*/
virtual void draw_legend(T* draw_object, const int container_id) {
Element_pos pos_x = _POS_X_CONTAINER_NAME + _POS_X_LEGEND_DEFAULT;
Element_pos pos_y = -this->_size_for_one_container * (container_id) + _POS_Y_LEGEND_DEFAULT;
......@@ -172,6 +190,9 @@ public:
/*!
* \fn get_max_percentage(std::map<const EntityValue*, stats*> &temp_states) const
* \brief Get the biggest percentage of times for all the stats
* \param temp_states The stats where we want to get the longest
*
* \return a value between 0. and 1.
*
......@@ -188,17 +209,25 @@ public:
}
value = max_length/(this->_end_time-this->_start_time);
//std::cerr << value << std::endl;
return value;
}
/*!
* \fn set_width(T* draw_object)
* \brief Set the total width for the draw object
* \param draw_object The kind of object which will be drawn (OpenGL, SVG...).
*/
virtual void set_width(T* draw_object) {
draw_object->set_total_width(this->_max_width);
}
/*!
* \fn set_geometrical_informations()
* \brief Set some infos for the displaying
*/
void set_geometrical_informations() {
this->_pos_x_container_name = _POS_X_CONTAINER_NAME;
this->_pos_y_container_name = this->_size_for_one_container - 30;
this->_pos_y_container_name = this->_size_for_one_container - 50;
this->_percentage_height_default = (this->_size_for_one_container - _START_HISTOGRAM_Y_DEFAULT - 20) / 100.;
......
......@@ -119,6 +119,12 @@ public:
end_draw(draw_object);
}
/*!
* \fn draw_diagram(T* draw_object, const int container_id)
* \brief Print the i-th diagram
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \param container_id the id of the container.
*/
void draw_diagram(T* draw_object, const int container_id) {
Statistic *stat_temp;
std::map<const EntityValue*, stats*> temp_states;
......@@ -182,8 +188,14 @@ public:
delete stat_temp;
}
void draw_legend(T* draw_object, int pos_x, int pos_y)
{
/*!
* \fn draw_legend(T* draw_object, int pos_x, int pos_y)
* \brief Print the legend for the i-th element (eg the color of each stats)
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \param pos_x the x position of the legend.
* \param pos_y the y position of the legend.
*/
void draw_legend(T* draw_object, int pos_x, int pos_y) {
std::set<const EntityValue *>::const_iterator it;
std::set<const EntityValue *>::const_iterator end;
const double w = this->_width_for_rect_legend;
......
......@@ -32,7 +32,7 @@
* \brief The default y position for the container name.
* The origin is set at the north west.
*/
#define _POS_Y_CONTAINER_NAME _HEIGHT_FOR_ONE_CONTAINER_DEFAULT-10.0f
#define _POS_Y_CONTAINER_NAME _HEIGHT_FOR_ONE_CONTAINER_DEFAULT-50.0f
/*!
* \def _WIDTH_HISTOGRAM_DEFAULT
......@@ -121,21 +121,31 @@ public:
*/
virtual void build(T* draw_object, std::vector<Container *> containers_to_print) = 0;
void set_max_width(T* draw_object);
/*!
* \fn end_draw(T* draw_object)
* \brief Set the end of the draw.
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \todo An improvment can be done by keeping the previous stats and if the user wants to have stats with an interval including the previous one.
*/
inline void end_draw(T* draw_object) {
_previous_start_time = _start_time;
_previous_end_time = _end_time;
draw_object->end_draw();
}
/*!
* \fn set_times(const double start, const double end)
* \brief Set the beginning and ending times of the draw.
*/
inline void set_times(const double start, const double end) {
_start_time = start;
_end_time = end;
}
/*!
*
* \fn get_max_percentage(std::map<const EntityValue*, stats*> &temp_states) const
* \brief Get the biggest percentage of times for all the stats
* \param temp_states The stats where we want to get the longest
* \return a value between 0. and 1.
*
*/
......@@ -152,13 +162,22 @@ public:
value = max_length/(_end_time-_start_time);
//std::cerr << value << std::endl;
return value;
return value;
}
/*!
* \fn updateGL(T* draw_object) const
* \brief Update the render window(only for OpenGL render)
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
*/
virtual void updateGL(T* draw_object) const {
draw_object->updateGL();
}
/*!
* \fn set_geometrical_informations()
* \brief Set some infos for the displaying
*/
virtual void set_geometrical_informations() {
_pos_x_container_name = _POS_X_CONTAINER_NAME;
_pos_y_container_name = _POS_Y_CONTAINER_NAME;
......
......@@ -2,11 +2,9 @@
using namespace std;
Stats_window::Stats_window(Interface_console* core, QWidget *parent) : QMainWindow(parent) {
Stats_window::Stats_window(QWidget *parent) : QMainWindow(parent) {
setupUi(this);
_core = core;
CKFP(_ui_stats_area_layout = qFindChild<QVBoxLayout *>(this, "stats_area"), "Cannot find the stats_area_layout in the .ui file");
_ui_stats_area = new Render_stats_opengl(this);
......@@ -63,6 +61,11 @@ void Stats_window::set_container_names_rec(QTreeWidgetItem *current_node, Contai
}
}
void Stats_window::set_filename(string filename){
_file_viewed = filename;
}
void Stats_window::set_trace(Trace *trace) {
_trace = trace;
}
......@@ -168,8 +171,7 @@ void Stats_window::on_export_button_clicked(){
_start_time = _start_time_widget->text().toDouble();
_end_time = _end_time_widget->text().toDouble();
const string &path = _core->get_filename();
const QString path_by_default = QString(path.substr(0, path.find_last_of('.')).c_str()) + ".svg";
const QString path_by_default = QString(_file_viewed.substr(0, _file_viewed.find_last_of('.')).c_str()) + ".svg";
QString filename = QFileDialog::getSaveFileName(this, tr("Export File"),
path_by_default,
......
......@@ -24,6 +24,11 @@ class Stats_window;
#include "DrawDiagram.hpp"
#include "DrawHDiagram.hpp"
/*!
* \enum stattype
* \brief Enumeration for the kind of chart to print stats.
*
*/
typedef enum stattype {
_HDIAGRAM_INDEX,
_DIAGRAM_INDEX,
......@@ -32,6 +37,7 @@ typedef enum stattype {
/*!
* \class Stats_window
* \brief Class used to display statistics of containers.
*
*/
......@@ -42,7 +48,7 @@ class Stats_window : public QMainWindow, protected Ui::stats_viewer {
private:
Interface_console* _core;
std::string _file_viewed;
Trace *_trace;
double _start_time;
double _end_time;
......@@ -58,9 +64,37 @@ class Stats_window : public QMainWindow, protected Ui::stats_viewer {
int _screen_width, _screen_height;
public:
Stats_window(Interface_console* core, QWidget *parent);
/*!
* Default constructor
* \param parent The parent widget of the window.
*/
Stats_window(QWidget *parent);
/*!
* \fn set_container_names()
* \brief Set the names of the containers in the tree
*/
void set_container_names();
/*!
* \fn set_filename(std::string filename)
* \brief Set the name of the file trace.
* \param filename The file name.
*/
void set_filename(std::string filename);
/*!
* \fn set_trace(Trace *trace)
* \brief Set the trace parsed (give the container names)
* \param trace The trace.
*/
void set_trace(Trace *trace);
/*!
* \fn init_window()
* \brief Initialise the statistic window : set the container names,
the times and clear what could have been here before
*/
void init_window();
void Reinit_scroll_bars();
......
......@@ -271,7 +271,8 @@ public:
Variable *var;
const list<pair<Date, Double> > *variable_values;
int position;
int lvl_zoom;
Element_pos lvl_zoom;
if(zoom>=0)
lvl_zoom = zoom;
else
......@@ -282,7 +283,7 @@ public:
c != _entity_containers.end();
c++) {
container = *c;
position = _container_positions[container];
position = (int)_container_positions[container];
state_tree = container->get_states();
event_tree = container->get_events();
......@@ -334,7 +335,7 @@ public:
c != _entity_containers.end();
c++) {
container = *c;
position = _container_positions[container];
position = (int)_container_positions[container];
if (!container->get_states()->empty() || !container->get_events()->empty())
position++;
// Browse variables
......@@ -385,9 +386,9 @@ public:
* \param start Line of the start of the link
* \param end Line of the end of the link
*/
inline void draw_link(T *draw_object, double starttime, double endtime, int start, int end) {
Element_pos y1 = ((double)start+0.5)*(_container_height+_container_v_space);
Element_pos y2 = ((double)end+0.5)*(_container_height+_container_v_space);
inline void draw_link(T *draw_object, double starttime, double endtime, double start, double end) {
Element_pos y1 = (start+0.5)*(_container_height+_container_v_space);
Element_pos y2 = (end+0.5)*(_container_height+_container_v_space);
draw_object->draw_arrow(starttime, endtime, y1, y2);
}
......
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