summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-05-06 13:15:16 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-05-10 11:19:22 +0200
commit87c09c0ab5e1334e9877ee6fd7adeb1eb70d5929 (patch)
tree3f407f9d0fc947427729913cf60e2e5f9b962ce0 /gui
parent604914db84d0468c6c8d04dfe6491e3c15b670f7 (diff)
options: don't create QSettings all the time
Update usages.
Diffstat (limited to 'gui')
-rw-r--r--gui/main-window.cpp8
-rw-r--r--gui/mapping-window.cpp11
2 files changed, 12 insertions, 7 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index d64858c4..96be298e 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -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();
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();
});
}
}