summaryrefslogtreecommitdiffhomepage
path: root/gui/main-window.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-09 22:52:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-09 22:52:17 +0200
commit75c9406abf2d090208a06bb6fa7871a141c1fa02 (patch)
treebc9a5d4c0bf98b9d34ad7651e4e840712772766a /gui/main-window.cpp
parent0f5f3894da2f32e8a3787730f113cd09629ec80b (diff)
gui/main-window: be more robust when our current config disappears from disk
Diffstat (limited to 'gui/main-window.cpp')
-rw-r--r--gui/main-window.cpp51
1 files changed, 38 insertions, 13 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index 4daf7560..89316f9e 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -349,34 +349,59 @@ void MainWindow::refresh_config_list(bool warn)
return;
}
+ bool file_ok = false;
+
QString current = group::ini_filename();
+ QIcon icon(":/images/settings16.png");
{
- inhibit_qt_signals l(*ui.iconcomboProfile);
+ {
+ inhibit_qt_signals l(*ui.iconcomboProfile);
- ui.iconcomboProfile->clear();
- ui.iconcomboProfile->addItems(ini_list);
+ ui.iconcomboProfile->clear();
+ ui.iconcomboProfile->addItems(ini_list);
- QIcon icon(":/images/settings16.png");
+ {
+ const int sz = ini_list.size();
- {
- const int sz = ini_list.size();
+ for (int i = 0; i < sz; i++)
+ ui.iconcomboProfile->setItemIcon(i, icon);
+ }
- for (int i = 0; i < sz; i++)
- ui.iconcomboProfile->setItemIcon(i, icon);
+ ui.iconcomboProfile->setCurrentText(current);
}
- {
- const QString pathname = group::ini_pathname();
+ const QString pathname = group::ini_pathname();
- if (!QFile(pathname).exists())
+ if (!QFile(pathname).exists())
+ {
{
QFile file(pathname);
(void) file.open(QFile::ReadWrite);
}
- }
- ui.iconcomboProfile->setCurrentText(current);
+ const QStringList ini_list = group::ini_list();
+
+ if (ini_list.contains(current))
+ {
+ {
+ inhibit_qt_signals q(ui.iconcomboProfile);
+
+ ui.iconcomboProfile->clear();
+ ui.iconcomboProfile->addItems(ini_list);
+ for (int i = 0; i < ini_list.size(); i++)
+ ui.iconcomboProfile->setItemIcon(i, icon);
+ ui.iconcomboProfile->setCurrentText(current);
+ }
+
+ options::detail::bundler::refresh_all_bundles(true);
+ }
+ }
+ else
+ {
+ file_ok = true;
+ ui.iconcomboProfile->setCurrentText(current);
+ }
}
set_title();