Commit 0ffd64b0 authored by Johnny Jazeix's avatar Johnny Jazeix

Ajout du début de la fenetre pour les options de l'export.

Non parfaitement opérationnel
parent 207abbe0
......@@ -192,7 +192,6 @@ int Interface_console::get_state(int argc, char** argv){
Svg::set_accuracy(0.1);
Svg::set_scale_frequency(50);
//Error::set_priority_min_printable(Error::_EVERYTHING);
if(argc == 1){
// just the name of the program, launch the window interface
return _STATE_LAUNCH_GRAPHICAL_INTERFACE;
......@@ -343,25 +342,25 @@ void Interface_console::extract_times(const char *name){
bool has_time_start = false;
bool has_time_end = false;
if(name[0] == '['){
has_time_start = true;
}
if(name[strlen(name)-1] == ']'){
has_time_end = true;
}
has_time_start = true;
}
if(name[strlen(name)-1] == ']'){
has_time_end = true;
}
if(has_time_start && has_time_end){
sscanf(name, "[%d]:[%d]", &_time_start, &_time_end);
}
else if(has_time_start){
sscanf(name, "[%d]:", &_time_start);
}
else if(has_time_end){
sscanf(name, ":[%d]", &_time_end);
}
else{
_time_start = 0;
_time_end = 0;
}
if(has_time_start && has_time_end){
sscanf(name, "[%d]:[%d]", &_time_start, &_time_end);
}
else if(has_time_start){
sscanf(name, "[%d]:", &_time_start);
}
else if(has_time_end){
sscanf(name, ":[%d]", &_time_end);
}
else{
_time_start = 0;
_time_end = 0;
}
}
double Interface_console::convert_to_double(const char *arg){
......
......@@ -57,6 +57,8 @@ void Interface_graphic::load_windows(){
QUiLoader loader;
QFile file_main(UI_MAIN_WINDOW_NAME);
QFile file_info(UI_INFO_WINDOW_NAME);
QFile file_selection_export(":/window/option_export_window.ui");
if (!QGLFormat::hasOpenGL())
qFatal("This system has no OpenGL support");
......@@ -66,6 +68,12 @@ void Interface_graphic::load_windows(){
CKFP(_ui_info_window = loader.load(&file_info, this), "Cannot open the .ui file : " << UI_MAIN_WINDOW_NAME);
file_info.close();
/* Load the _option_export_window from a .ui file */
file_selection_export.open(QFile::ReadOnly);
CKFP(_ui_time_selection_export = loader.load(&file_selection_export, this), "Cannot open the .ui file : " << "option_export_window.ui");
_ui_time_selection_export->setWindowFlags(_ui_time_selection_export->windowFlags() | Qt::WindowStaysOnTopHint);
file_selection_export.close();
/* Set some windows properties */
_ui_info_window->setWindowFlags(_ui_info_window->windowFlags() | Qt::WindowStaysOnTopHint);/* Always display info_window on top */
......@@ -79,14 +87,16 @@ void Interface_graphic::load_windows(){
CKFP(_ui_toolbar = qFindChild<QToolBar*>(this, "toolBar"), "Cannot find the tool bar in the .ui file");
CKFP(_ui_x_scroll = qFindChild<QScrollBar*>(this, "x_scroll"), "Cannot find the horizontal scroll bar in the .ui file");
/*
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!
*/
QMetaObject::connectSlotsByName(NULL);
QMetaObject::connectSlotsByName(_ui_time_selection_export);
/* Display the main window */
this->show();
}
......@@ -250,6 +260,12 @@ void Interface_graphic::on_open_triggered(){
void Interface_graphic::on_export_file_triggered(){
_ui_time_selection_export->show();
}
void Interface_graphic::on_option_export_ok_clicked(){
// We have to save the option from _ui_time_selection_export and hide her if it is not do automatically
QString filename = QFileDialog::getSaveFileName(this, tr("Export File"),
"",
......@@ -257,6 +273,7 @@ void Interface_graphic::on_export_file_triggered(){
if (!filename.isEmpty()){
information(string("Exporting trace to ")+filename.toStdString());
_core->set_path_to_export(filename.toStdString());
......@@ -265,8 +282,8 @@ void Interface_graphic::on_export_file_triggered(){
}
else
error("No file specified for exportation");
}
}
void Interface_graphic::on_close_triggered(){
......
......@@ -115,6 +115,10 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
*/
QTextEdit* _ui_info_selection_text;
/*!
* \brief This variable contains the floatting info box window of the application.
*/
QWidget* _ui_time_selection_export;
/***********************************
......@@ -241,6 +245,11 @@ protected slots:
*/
void on_export_file_triggered();
/*!
*\brief A slot which is called when the options in export are ok.
*/
void on_option_export_ok_clicked();
/*!
*\brief A slot which called when 'close' in the menu is clicked.
*/
......
This diff is collapsed.
......@@ -51,7 +51,7 @@ HEADERS += interface.hpp \
../../message/src/message_ns.hpp \
../../trace/src/DrawTrace.hpp
FORMS += info_window.ui main_window.ui maquette.ui
FORMS += info_window.ui main_window.ui maquette.ui option_export_window.ui
SOURCES += interface_console.cpp \
interface_graphic.cpp\
render_area.cpp \
......
<RCC>
<qresource prefix="icon" >
<file>icon/cancel.png</file>
<file>icon/ok.png</file>
<file>icon/zoom_out.png</file>
<file>icon/zoom_in.png</file>
<file>icon/export_svg.png</file>
<file>icon/about.png</file>
<file>icon/more_options_export.png</file>
<file>icon/less_options_export.png</file>
<file>icon/fileclose.png</file>
<file>icon/vite.png</file>
<file>icon/fullscreen_mode.png</file>
......@@ -20,5 +24,6 @@
<qresource prefix="window" >
<file>info_window.ui</file>
<file>main_window.ui</file>
<file>option_export_window.ui</file>
</qresource>
</RCC>
......@@ -61,7 +61,7 @@ HEADERS += message/Message.hpp \
trace/values/String.hpp \
trace/values/Value.hpp \
trace/values/Values.hpp
FORMS += interface/info_window.ui interface/main_window.ui interface/maquette.ui
FORMS += interface/info_window.ui interface/main_window.ui interface/maquette.ui interface/option_export_window.ui
SOURCES += message/Message.cpp \
message/Errors.cpp \
main.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