From 5a4af5208db2eb9fb09191c3617fa7e6d854bb64 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 31 Jul 2016 07:25:25 +0200 Subject: gui/options: use and restore program directory around dialog --- gui/options-dialog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index 9dcb7879..814cf298 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -8,6 +8,7 @@ #include "options-dialog.hpp" #include "keyboard.h" +#include "opentrack-library-path.h" #include #include #include @@ -173,7 +174,7 @@ void OptionsDialog::browse_datalogging_file() { QString filename = ui.tracklogging_filenameedit->text(); if (filename.isEmpty()) - filename = QDir::currentPath(); + 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. @@ -182,10 +183,13 @@ void OptionsDialog::browse_datalogging_file() 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); -} \ No newline at end of file +} -- cgit v1.2.3