From 77cf67d61c8f6ae7ec00fd069b0e6586927069a3 Mon Sep 17 00:00:00 2001 From: DaMichel Date: Thu, 8 Sep 2016 16:43:12 +0200 Subject: tracklogging: begone file selector gui. Now a file select dialog will pop up when the tracker starts. --- gui/options-dialog.cpp | 23 ------------------ gui/options-dialog.hpp | 1 - gui/options-dialog.ui | 65 ++++---------------------------------------------- 3 files changed, 5 insertions(+), 84 deletions(-) (limited to 'gui') diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index dfd99e7b..0df5f854 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -75,7 +75,6 @@ OptionsDialog::OptionsDialog(std::function pause_keybindings) : tie_setting(main.center_method, ui.center_method); tie_setting(main.tracklogging_enabled, ui.tracklogging_enabled); - tie_setting(main.tracklogging_filename, ui.tracklogging_filenameedit); struct tmp { @@ -108,8 +107,6 @@ OptionsDialog::OptionsDialog(std::function pause_keybindings) : connect(val.button, &QPushButton::clicked, this, [=]() -> void { bind_key(val.opt, val.label); }); } } - - connect(ui.tracklogging_fileselectbtn, SIGNAL(clicked()), this, SLOT(browse_datalogging_file())); } void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) @@ -172,26 +169,6 @@ void OptionsDialog::doCancel() emit closing(); } -void OptionsDialog::browse_datalogging_file() -{ - QString filename = ui.tracklogging_filenameedit->text(); - if (filename.isEmpty()) - filename = OPENTRACK_BASE_PATH; - /* Sometimes this function freezes the app before opening the dialog. - Might be related to https://forum.qt.io/topic/49209/qfiledialog-getopenfilename-hangs-in-windows-when-using-the-native-dialog/8 - and be a known problem. Possible solution is to use the QFileDialog::DontUseNativeDialog flag. - Since the freeze is apparently random, I'm not sure it helped. - */ - QString newfilename = QFileDialog::getSaveFileName(this, tr("Select Filename"), filename, tr("CSV File (*.csv)"), nullptr, QFileDialog::DontUseNativeDialog); - if (!newfilename.isEmpty()) - ui.tracklogging_filenameedit->setText(newfilename); - - // dialog likes to mess with current directory - QDir::setCurrent(OPENTRACK_BASE_PATH); -} - void OptionsDialog::update_widgets_states(bool tracker_is_running) { - ui.tracklogging_enabled->setEnabled(!tracker_is_running); - ui.tracklogging_fileselectbtn->setEnabled(!tracker_is_running); } diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp index f11513bf..4ab8301e 100644 --- a/gui/options-dialog.hpp +++ b/gui/options-dialog.hpp @@ -24,5 +24,4 @@ private slots: void doOK(); void doCancel(); void bind_key(key_opts &kopts, QLabel* label); - void browse_datalogging_file(); }; diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui index 97ccffff..412fc183 100644 --- a/gui/options-dialog.ui +++ b/gui/options-dialog.ui @@ -33,7 +33,7 @@ - 0 + 2 @@ -1237,7 +1237,7 @@ It won't work properly with translation compensation enabled. - + 0 0 @@ -1245,77 +1245,23 @@ It won't work properly with translation compensation enabled. 0 - 20 + 50 - Data Logging + CSV Data Logging 0 - - - - - 0 - 0 - - - - Record pose data in a csv file. WARNING: overwrites file contents without warning every time the tracker is started. - - - true - - - - Enable + Enable - You will be asked for a filename whenever the tracker starts - - - - - 0 - - - 1 - - - - - Select File ... - - - - - - - true - - - Qt::NoFocus - - - - - - - - - true - - - - - - @@ -1436,7 +1382,6 @@ It won't work properly with translation compensation enabled. src_z invert_z tracklogging_enabled - tracklogging_fileselectbtn -- cgit v1.2.3