Finalized "start minimized" option.
This commit is contained in:
parent
5ae3415ad4
commit
1706a36b66
@ -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();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentRow">
|
||||
<number>-1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -100,7 +100,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<widget class="QWidget" name="m_tabNotifications">
|
||||
<attribute name="title">
|
||||
<string>Notifications</string>
|
||||
</attribute>
|
||||
@ -149,6 +149,13 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkHidden">
|
||||
<property name="text">
|
||||
<string>Start application hidden</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -159,6 +166,16 @@
|
||||
<string>Fonts</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_tabMisc">
|
||||
<attribute name="title">
|
||||
<string>Miscellaneous</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -228,38 +245,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_radioTrayOff</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_lblTrayClose</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>370</x>
|
||||
<y>82</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>292</x>
|
||||
<y>135</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_radioTrayOff</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_cmbTrayClose</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>370</x>
|
||||
<y>82</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>478</x>
|
||||
<y>135</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_radioTrayOn</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
@ -292,5 +277,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_radioTrayOn</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_checkHidden</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>417</x>
|
||||
<y>108</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>417</x>
|
||||
<y>162</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
@ -111,9 +111,7 @@ void SystemTrayIcon::setNumber(int number) {
|
||||
Qt::AlignVCenter | Qt::AlignCenter ,
|
||||
QString::number(number));
|
||||
}
|
||||
|
||||
trayPainter.end();
|
||||
|
||||
QSystemTrayIcon::setIcon(QIcon(background));
|
||||
}
|
||||
}
|
||||
|
10
src/main.cpp
10
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()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user