Commit 40c2662b authored by Johnny Jazeix's avatar Johnny Jazeix

export graphique. (les boutons pour cacher ou non ne servent a rien)

parent 1b306f0f
/*!
*\file info.cpp
*/
#include "info.hpp"
int Info::Container::x_min = 0;
int Info::Container::x_max = 0;
int Info::Entity::x_min = 0;
int Info::Entity::x_max = 0;
bool Info::Render::_key_alt = false;
bool Info::Render::_key_ctrl = false;
Element_pos Info::Render::_x_min_visible = 0;;
Element_pos Info::Render::_x_max_visible = 0.;
......@@ -138,7 +138,4 @@ public:
};
#endif
......@@ -6,12 +6,17 @@
#include "interface_console.hpp"
#include <iostream>
/*!
* \class Progress_bar_thread
* \brief Contains the progress bar while loading of a trace
* Doesn't work well so not added to the soft yet.
*/
class Progress_bar_thread : public QThread {
Q_OBJECT
private:
Interface_console *_interface_console;
long _file_size;
Parser *_parser;
public:
......
......@@ -206,7 +206,7 @@ int Interface_console::get_state(int argc, char** argv){
/*The folowing statics must be initialised in case their are not overrided by a command line request*/
Svg::set_height_factor (20);
Svg::set_wide_factor (100);
Svg::set_interval(0,0);
Svg::set_interval(0, 0);
Svg::set_accuracy(0.1);
Svg::set_scale_frequency(50);
......@@ -242,7 +242,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
i ++;
if(i < argc){
if(i < argc) {
_path_to_export = argv[i];
state = _STATE_EXPORT_FILE;
}
......@@ -299,8 +299,8 @@ int Interface_console::get_state(int argc, char** argv){
return _STATE_UNKNOWN;
}
Svg::set_interval(t1,t2);
i+=2;
Svg::set_interval(t1, t2);
i += 2;
}
else if((string)argv[i] == "-wide") {
if (i + 1 >= argc) {
......@@ -585,11 +585,15 @@ const QString* Interface_console::get_runenv() const{
return _run_env;
}
QProgressDialog *Interface_console::get_progress_dialog(){
return _progress_dialog;
}
void Interface_console::update_progress_bar(int loaded){
void Interface_console::update_progress_bar(const int loaded){
_progress_dialog->setValue(loaded);
_progress_dialog->update();
}
void Interface_console::set_min_value_for_export(const double d) {
_time_start = d;
}
void Interface_console::set_max_value_for_export(const double d) {
_time_end = d;
}
......@@ -362,7 +362,7 @@ public:
void information(const std::string) const;
/*!
*\arg string : the string to be displayed.
*\param string : the string to be displayed.
*\brief Only use in graphic interface.
*/
void selection_information(const std::string) const{
......@@ -370,12 +370,19 @@ public:
/*!
*\brief Return the progress dialog used during threads.
*\brief Set the minimum for export
*\param d : the double.
*/
QProgressDialog *get_progress_dialog();
void set_min_value_for_export(const double d);
/*!
*\brief Set the minimum for export
*\param d : the double.
*/
void set_max_value_for_export(const double d);
public slots:
void update_progress_bar(int loaded);
void update_progress_bar(const int loaded);
};
......
......@@ -8,7 +8,6 @@
using namespace std;
/***********************************
*
*
......@@ -97,13 +96,17 @@ void Interface_graphic::load_windows(){
CKFP(_ui_zoom_box = qFindChild<QComboBox*>(this, "zoom_box"), "Cannot find the zoom box in the .ui file");
// Export window
CKFP(_ui_export_ok_button = qFindChild<QPushButton*>(_ui_time_selection_export, "option_export_ok"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_min_time_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "min_time"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_max_time_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "max_time"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_wide_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "wide"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_grow_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "grow"), "Cannot find the ok push button in the export dialog .ui file");
connect(_ui_export_ok_button, SIGNAL(pressed()),
this, SLOT( option_export_ok_pressed()));
this, SLOT(option_export_ok_pressed()));
/*
Special function of Qt which allows methods declared as slots and which name are 'on_[widget]_[action]()' to be called when the 'widget' triggered the signal corresponding to 'action'.
/!\ -> use NULL as argument, else messages will be duplicated!
......@@ -352,6 +355,11 @@ void Interface_graphic::on_open_triggered(){
void Interface_graphic::on_export_file_triggered(){
char temp[10];
sprintf(temp, "%9lf", Info::Render::_x_min_visible);
_ui_min_time_export->setText(temp);
sprintf(temp, "%9lf", Info::Render::_x_max_visible);
_ui_max_time_export->setText(temp);
_ui_time_selection_export->show();
}
......@@ -363,14 +371,25 @@ void Interface_graphic::option_export_ok_pressed(){
"",
tr("Images (*.svg)"));
if (!filename.isEmpty()){
if (!filename.isEmpty()) {
information(string("Exporting trace to ")+filename.toStdString());
_core->set_path_to_export(filename.toStdString());
// _core->draw_trace(_trace_path, Interface_console::_DRAW_SVG);
_core->launch_action(Interface_console::_STATE_EXPORT_FILE);
// _core->draw_trace(_trace_path, Interface_console::_DRAW_SVG);
_core->set_min_value_for_export(convert_to_double(_ui_min_time_export->text().toStdString()));
_core->set_max_value_for_export(convert_to_double(_ui_max_time_export->text().toStdString()));
// We configure the svg exporter
double height = convert_to_double(_ui_grow_export->text().toStdString());
if(height != -1.)
Svg::set_height_factor(height);
double wide = convert_to_double(_ui_wide_export->text().toStdString());
if(wide != -1.)
Svg::set_wide_factor(wide);
_core->launch_action(Interface_console::_STATE_EXPORT_FILE_IN_INTERVAL);
}
else
error("No file specified for exportation");
......
......@@ -90,6 +90,14 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
*/
QScrollBar* _ui_y_scroll;
/*!
* \brief Define for export
*/
QLineEdit *_ui_min_time_export;
QLineEdit *_ui_max_time_export;
QLineEdit *_ui_wide_export;
QLineEdit *_ui_grow_export;
/*!
* \brief Contains the Interface_console parent instance.
*/
......
......@@ -70,16 +70,16 @@
<string>minimal value of time for export</string>
</property>
<property name="inputMask" >
<string>9999999999; </string>
<string/>
</property>
<property name="text" >
<string/>
</property>
<property name="maxLength" >
<number>10</number>
<number>32767</number>
</property>
<property name="cursorPosition" >
<number>10</number>
<number>0</number>
</property>
<property name="show" stdset="0" >
<bool>false</bool>
......@@ -105,7 +105,7 @@
<string>maximal value of time for export</string>
</property>
<property name="inputMask" >
<string>9999999999; </string>
<string/>
</property>
<property name="text" >
<string/>
......@@ -223,6 +223,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>200.0</string>
</property>
<property name="frame" >
<bool>true</bool>
</property>
......@@ -273,6 +276,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>15.0</string>
</property>
</widget>
</item>
</layout>
......
......@@ -34,12 +34,6 @@ public:
*/
virtual const int get_size_loaded() const = 0;
/*!
* \fn const int get_total_size_of_file() const = 0
* \return the size of the file parsed
*/
virtual const int get_total_size_of_file() const = 0;
};
#endif // PARSER_HPP
......@@ -74,11 +74,3 @@ void ParserPaje::set_file_to_parse(const string filename){
const int ParserPaje::get_size_loaded() const{
return (TokenSource::get_size_loaded());
}
const int ParserPaje::get_total_size_of_file() const{
struct stat buf;
if(stat(_file_to_parse.c_str(), &buf) == -1){
perror(_file_to_parse.c_str());
}
return buf.st_size; // In bytes / octets
}
......@@ -51,13 +51,6 @@ public:
* \return the size already loaded of the file by the parser
*/
const int get_size_loaded() const;
/*!
* \fn get_total_size_of_file() const
* \brief get the size of the file parsed.
* \return the size of the file parsed
*/
const int get_total_size_of_file() const;
};
#endif // PARSERPAJE_HPP
......
......@@ -6,11 +6,6 @@
#include "render_opengl.hpp"
bool Info::Render::_key_alt;
bool Info::Render::_key_ctrl;
Element_pos Info::Render::_x_min_visible = 0;
Element_pos Info::Render::_x_max_visible = 0;
using namespace std;
......
......@@ -116,13 +116,13 @@ public:
* \def MARGIN
* \brief Distance between two container
*/
static const double MARGIN = 10;
static const double MARGIN = 10.;
/*
* \def ARROWSIZE
* \brief Spike size
*/
static const double ARROWSIZE = 2 ;
static const double ARROWSIZE = 2.;
/*
......@@ -135,25 +135,25 @@ public:
* \def MARGINTOP
* \brief offset between the top and the picture due to the scale
*/
static const double MARGINTOP = 20;
static const double MARGINTOP = 20.;
/*
* \def WAIT_NEW_CHRONO
* \brief a State of chronogramme drawer automaton
*/
static const double WAIT_NEW_CHRONO = 0;
static const double WAIT_NEW_CHRONO = 0.;
/*
* \def INIT
* \brief a State of chronogramme drawer automaton
*/
static const double INIT = 1;
static const double INIT = 1.;
/*
* \def WAIT_FOR_POINT
* \brief a State of chronogramme drawer automaton
*/
static const double WAIT_FOR_POINT = 2;
static const double WAIT_FOR_POINT = 2.;
/*!
......
......@@ -75,6 +75,8 @@ SOURCES += message/Message.cpp \
message/Errors.cpp \
Tools.cpp \
main.cpp \
# Info code file
info/info.cpp \
# Interface code files
interface/interface_console.cpp \
interface/interface_graphic.cpp \
......
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