summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/main-window.cpp16
-rw-r--r--gui/main-window.hpp8
-rw-r--r--gui/main.cpp4
-rw-r--r--gui/mapping-window.cpp11
4 files changed, 22 insertions, 17 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index d64858c4..aa8e16f3 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -74,13 +74,13 @@ MainWindow::MainWindow() :
{
modules.filters().push_front(std::make_shared<dylib>("", dylib::Filter));
- for (mem<dylib>& x : modules.trackers())
+ for (std::shared_ptr<dylib>& x : modules.trackers())
ui.iconcomboTrackerSource->addItem(x->icon, x->name);
- for (mem<dylib>& x : modules.protocols())
+ for (std::shared_ptr<dylib>& x : modules.protocols())
ui.iconcomboProtocol->addItem(x->icon, x->name);
- for (mem<dylib>& x : modules.filters())
+ for (std::shared_ptr<dylib>& x : modules.filters())
ui.iconcomboFilter->addItem(x->icon, x->name);
}
@@ -277,6 +277,14 @@ void MainWindow::die_on_config_not_writable()
bool MainWindow::maybe_die_on_config_not_writable(const QString& current, QStringList* ini_list_)
{
+ const bool writable =
+ group::with_settings_object([&](QSettings& s) {
+ return s.isWritable();
+ });
+
+ if (writable)
+ return false;
+
const bool open = QFile(group::ini_combine(current)).open(QFile::ReadWrite);
const QStringList ini_list = group::ini_list();
@@ -593,7 +601,7 @@ inline bool MainWindow::mk_window(ptr<t>& place, Args&&... params)
}
template<typename t>
-bool MainWindow::mk_dialog(mem<dylib> lib, ptr<t>& d)
+bool MainWindow::mk_dialog(std::shared_ptr<dylib> lib, ptr<t>& d)
{
const bool just_created = mk_window_common(d, [&]() -> t* {
if (lib && lib->Dialog)
diff --git a/gui/main-window.hpp b/gui/main-window.hpp
index 71e372f0..ef6143e7 100644
--- a/gui/main-window.hpp
+++ b/gui/main-window.hpp
@@ -68,15 +68,15 @@ class MainWindow : public QMainWindow, private State
menu_action_tracker, menu_action_filter, menu_action_proto,
menu_action_options, menu_action_mappings;
- mem<dylib> current_tracker()
+ std::shared_ptr<dylib> current_tracker()
{
return modules.trackers().value(ui.iconcomboTrackerSource->currentIndex(), nullptr);
}
- mem<dylib> current_protocol()
+ std::shared_ptr<dylib> current_protocol()
{
return modules.protocols().value(ui.iconcomboProtocol->currentIndex(), nullptr);
}
- mem<dylib> current_filter()
+ std::shared_ptr<dylib> current_filter()
{
return modules.filters().value(ui.iconcomboFilter->currentIndex(), nullptr);
}
@@ -99,7 +99,7 @@ class MainWindow : public QMainWindow, private State
// only use in impl file since no definition in header!
template<typename t>
- bool mk_dialog(mem<dylib> lib, ptr<t>& d);
+ bool mk_dialog(std::shared_ptr<dylib> lib, ptr<t>& d);
// idem
template<typename t, typename... Args>
diff --git a/gui/main.cpp b/gui/main.cpp
index 80040732..16e08b6e 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -129,13 +129,13 @@ main(int argc, char** argv)
if (!QSettings(OPENTRACK_ORG).value("disable-translation", false).toBool())
{
- (void) t.load(QLocale(), "", "", QCoreApplication::applicationDirPath() + "/" + OPENTRACK_I18N_PATH, ".qm");
+ (void) t.load(QLocale(), "", "", QCoreApplication::applicationDirPath() + "/" OPENTRACK_I18N_PATH, ".qm");
(void) QCoreApplication::installTranslator(&t);
}
do
{
- mem<MainWindow> w = std::make_shared<MainWindow>();
+ std::shared_ptr<MainWindow> w = std::make_shared<MainWindow>();
if (!w->isEnabled())
break;
diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp
index 0ee8c562..0a5d3049 100644
--- a/gui/mapping-window.cpp
+++ b/gui/mapping-window.cpp
@@ -114,18 +114,15 @@ void MapWidget::closeEvent(QCloseEvent*)
void MapWidget::save_dialog()
{
- mem<QSettings> settings_ = group::ini_file();
- QSettings& settings = *settings_;
-
- s.b_map->save_deferred(settings);
+ s.b_map->save();
for (int i = 0; i < 6; i++)
{
m.forall([&](Map& s)
{
- s.spline_main.save(settings);
- s.spline_alt.save(settings);
- s.opts.b_mapping_window->save_deferred(settings);
+ s.spline_main.save();
+ s.spline_alt.save();
+ s.opts.b_mapping_window->save();
});
}
}