summaryrefslogtreecommitdiffhomepage
path: root/gui/ui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-29 13:05:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-29 13:18:32 +0200
commit6482a7e2582867d51c19bb12d513bc52dde2cc66 (patch)
tree51f02c20e6601404330c9ea7610ce044dfbbac74 /gui/ui.cpp
parent2dd8064c20d88c26a11240c6a871f670b5109d71 (diff)
compat/options: separate module dll names from rest of settings
The other settings are modified by the options dialog. These are in the main ui. We need to be able to save modules without saving the options dialog.
Diffstat (limited to 'gui/ui.cpp')
-rw-r--r--gui/ui.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/gui/ui.cpp b/gui/ui.cpp
index ca66104f..9e81d137 100644
--- a/gui/ui.cpp
+++ b/gui/ui.cpp
@@ -51,21 +51,21 @@ MainWindow::MainWindow() :
connect(&config_list_timer, SIGNAL(timeout()), this, SLOT(refresh_config_list()));
config_list_timer.start(1000 * 3);
- tie_setting(s.tracker_dll, ui.iconcomboTrackerSource);
- tie_setting(s.protocol_dll, ui.iconcomboProtocol);
- tie_setting(s.filter_dll, ui.iconcomboFilter);
+ tie_setting(m.tracker_dll, ui.iconcomboTrackerSource);
+ tie_setting(m.protocol_dll, ui.iconcomboProtocol);
+ tie_setting(m.filter_dll, ui.iconcomboFilter);
connect(ui.iconcomboTrackerSource,
&QComboBox::currentTextChanged,
- [&](QString) -> void { if (pTrackerDialog) pTrackerDialog = nullptr; save(); });
+ [&](QString) -> void { if (pTrackerDialog) pTrackerDialog = nullptr; save_modules(); });
connect(ui.iconcomboProtocol,
&QComboBox::currentTextChanged,
- [&](QString) -> void { if (pProtocolDialog) pProtocolDialog = nullptr; save(); });
+ [&](QString) -> void { if (pProtocolDialog) pProtocolDialog = nullptr; save_modules(); });
connect(ui.iconcomboFilter,
&QComboBox::currentTextChanged,
- [&](QString) -> void { if (pFilterDialog) pFilterDialog = nullptr; save(); });
+ [&](QString) -> void { if (pFilterDialog) pFilterDialog = nullptr; save_modules(); });
connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker()));
connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker()));
@@ -146,6 +146,20 @@ void MainWindow::register_shortcuts()
work->reload_shortcuts();
}
+void MainWindow::warn_on_config_not_writable()
+{
+#if defined(__unix) || defined(__linux)
+ QString currentFile = group::ini_pathname();
+ QByteArray bytes = QFile::encodeName(currentFile);
+ const char* filename_as_asciiz = bytes.constData();
+
+ if (access(filename_as_asciiz, R_OK | W_OK))
+ {
+ QMessageBox::warning(this, "Something went wrong", "Check permissions and ownership for your .ini file!", QMessageBox::Ok, QMessageBox::NoButton);
+ }
+#endif
+}
+
bool MainWindow::get_new_config_name_from_dialog(QString& ret)
{
new_file_dialog dlg;
@@ -158,7 +172,7 @@ MainWindow::~MainWindow()
if (tray)
tray->hide();
stopTracker();
- save();
+ save_modules();
}
void MainWindow::set_working_directory()
@@ -166,26 +180,10 @@ void MainWindow::set_working_directory()
QDir::setCurrent(QCoreApplication::applicationDirPath());
}
-void MainWindow::save_mappings()
+void MainWindow::save_modules()
{
- pose.save_mappings();
-}
-
-void MainWindow::save()
-{
- s.b->save();
- //save_mappings();
-
-#if defined(__unix) || defined(__linux)
- QString currentFile = group::ini_pathname();
- QByteArray bytes = QFile::encodeName(currentFile);
- const char* filename_as_asciiz = bytes.constData();
-
- if (access(filename_as_asciiz, R_OK | W_OK))
- {
- QMessageBox::warning(this, "Something went wrong", "Check permissions and ownership for your .ini file!", QMessageBox::Ok, QMessageBox::NoButton);
- }
-#endif
+ m.b->save();
+ warn_on_config_not_writable();
}
void MainWindow::load_mappings()
@@ -197,6 +195,7 @@ void MainWindow::load_mappings()
void MainWindow::load_settings()
{
+ m.b->reload();
s.b->reload();
load_mappings();
}
@@ -314,7 +313,7 @@ void MainWindow::startTracker()
return;
}
- save();
+ save_modules();
work = std::make_shared<Work>(pose, libs, winId());
@@ -358,7 +357,7 @@ void MainWindow::stopTracker()
if (pFilterDialog)
pFilterDialog->unregister_filter();
- save();
+ save_modules();
work = nullptr;
libs = SelectedLibraries();
@@ -522,7 +521,7 @@ void MainWindow::profile_selected(const QString& name)
if (old_name != new_name)
{
- save();
+ save_modules();
{
QSettings settings(OPENTRACK_ORG);