diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp
index 7646416ca..0458ad801 100644
--- a/src/gui/formsettings.cpp
+++ b/src/gui/formsettings.cpp
@@ -42,6 +42,9 @@ void FormSettings::loadInterface() {
m_ui->m_cmbTrayClose->setCurrentIndex(Settings::getInstance()->value(APP_CFG_GUI,
"close_win_action",
0).toInt());
+ m_ui->m_checkHidden->setChecked(Settings::getInstance()->value(APP_CFG_GUI,
+ "start_hidden",
+ false).toBool());
}
// Tray icon is not supported on this machine.
else {
@@ -90,9 +93,8 @@ void FormSettings::saveInterface() {
m_ui->m_radioTrayOn->isChecked());
Settings::getInstance()->setValue(APP_CFG_GUI, "close_win_action",
m_ui->m_cmbTrayClose->currentIndex());
- // TODO: Switch tray icon here (destroy it/create it) and
- // if icon is should be destroyed and no main window is visible,
- // then show main window and then destroy tray icon.
+ Settings::getInstance()->setValue(APP_CFG_GUI, "start_hidden",
+ m_ui->m_checkHidden->isChecked());
if (Settings::getInstance()->value(APP_CFG_GUI, "use_tray_icon", true).toBool()) {
SystemTrayIcon::getInstance()->show();
}
diff --git a/src/gui/formsettings.ui b/src/gui/formsettings.ui
index a01290c87..736a39ec6 100644
--- a/src/gui/formsettings.ui
+++ b/src/gui/formsettings.ui
@@ -23,7 +23,7 @@
- -1
+ 0
-
@@ -100,7 +100,7 @@
-
+
Notifications
@@ -149,6 +149,13 @@
+ -
+
+
+ Start application hidden
+
+
+
@@ -159,6 +166,16 @@
Fonts
+
+
+ Miscellaneous
+
+
+
+ QFormLayout::AllNonFixedFieldsGrow
+
+
+
@@ -228,38 +245,6 @@
-
- m_radioTrayOff
- toggled(bool)
- m_lblTrayClose
- setDisabled(bool)
-
-
- 370
- 82
-
-
- 292
- 135
-
-
-
-
- m_radioTrayOff
- toggled(bool)
- m_cmbTrayClose
- setDisabled(bool)
-
-
- 370
- 82
-
-
- 478
- 135
-
-
-
m_radioTrayOn
toggled(bool)
@@ -292,5 +277,21 @@
+
+ m_radioTrayOn
+ toggled(bool)
+ m_checkHidden
+ setVisible(bool)
+
+
+ 417
+ 108
+
+
+ 417
+ 162
+
+
+
diff --git a/src/gui/systemtrayicon.cpp b/src/gui/systemtrayicon.cpp
index 478d114a8..9a01038e9 100644
--- a/src/gui/systemtrayicon.cpp
+++ b/src/gui/systemtrayicon.cpp
@@ -111,9 +111,7 @@ void SystemTrayIcon::setNumber(int number) {
Qt::AlignVCenter | Qt::AlignCenter ,
QString::number(number));
}
-
trayPainter.end();
-
QSystemTrayIcon::setIcon(QIcon(background));
}
}
diff --git a/src/main.cpp b/src/main.cpp
index 0b71b83a4..7fe4ec649 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -77,8 +77,14 @@ int main(int argc, char *argv[]) {
}
// Display main window.
- // TODO: Switchable "start minimized" function.
- window.show();
+ if (Settings::getInstance()->value(APP_CFG_GUI, "start_hidden",
+ false).toBool() &&
+ SystemTrayIcon::isSystemTrayActivated()) {
+ window.hide();
+ }
+ else {
+ window.show();
+ }
// Display tray icon if it is enabled and available.
if (SystemTrayIcon::isSystemTrayActivated()) {