Probably fixed #16.

This commit is contained in:
Martin Rotter 2014-02-13 19:25:57 +01:00
parent 972e888fbb
commit 4be2d8b54a
4 changed files with 48 additions and 20 deletions

View File

@ -210,10 +210,6 @@ void FormMain::onAboutToQuit() {
}
}
bool FormMain::event(QEvent *event) {
return QMainWindow::event(event);
}
void FormMain::setupIcons() {
IconThemeFactory *icon_theme_factory = IconThemeFactory::instance();
@ -355,10 +351,12 @@ void FormMain::loadWebBrowserMenu(int index) {
void FormMain::changeEvent(QEvent *event) {
switch (event->type()) {
case QEvent::WindowStateChange: {
if (SystemTrayIcon::isSystemTrayActivated()) {
if (this->windowState() & Qt::WindowMinimized) {
QTimer::singleShot(250, this, SLOT(hide()));
}
if (this->windowState() & Qt::WindowMinimized &&
SystemTrayIcon::isSystemTrayActivated() &&
Settings::instance()->value(APP_CFG_GUI,
"hide_when_minimized",
false).toBool()) {
QTimer::singleShot(250, this, SLOT(hide()));
}
break;

View File

@ -54,7 +54,6 @@ class FormMain : public QMainWindow {
// Event handler reimplementations.
void changeEvent(QEvent *event);
bool event(QEvent *event);
// Sets up proper icons for this widget.
void setupIcons();

View File

@ -607,9 +607,6 @@ void FormSettings::loadInterface() {
m_ui->m_radioTrayOff->setChecked(!settings->value(APP_CFG_GUI,
"use_tray_icon",
true).toBool());
m_ui->m_checkHidden->setChecked(settings->value(APP_CFG_GUI,
"start_hidden",
false).toBool());
}
// Tray icon is not supported on this machine.
else {
@ -618,6 +615,13 @@ void FormSettings::loadInterface() {
m_ui->m_grpTray->setDisabled(true);
}
m_ui->m_checkHidden->setChecked(settings->value(APP_CFG_GUI,
"start_hidden",
false).toBool());
m_ui->m_checkHideWhenMinimized->setChecked(settings->value(APP_CFG_GUI,
"hide_when_minimized",
false).toBool());
// Load settings of icon theme.
QString current_theme = IconThemeFactory::instance()->currentIconTheme();
@ -715,8 +719,6 @@ void FormSettings::saveInterface() {
if (SystemTrayIcon::isSystemTrayAvailable()) {
settings->setValue(APP_CFG_GUI, "use_tray_icon",
m_ui->m_radioTrayOn->isChecked());
settings->setValue(APP_CFG_GUI, "start_hidden",
m_ui->m_checkHidden->isChecked());
if (settings->value(APP_CFG_GUI, "use_tray_icon", true).toBool()) {
SystemTrayIcon::instance()->show();
FormMain::instance()->tabWidget()->feedMessageViewer()->feedsView()->notifyWithCounts();
@ -727,6 +729,12 @@ void FormSettings::saveInterface() {
}
}
settings->setValue(APP_CFG_GUI, "start_hidden",
m_ui->m_checkHidden->isChecked());
settings->setValue(APP_CFG_GUI,
"hide_when_minimized",
m_ui->m_checkHideWhenMinimized->isChecked());
// Save selected icon theme.
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
QString original_icon_theme = IconThemeFactory::instance()->currentIconTheme();

View File

@ -17,7 +17,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5">
@ -286,8 +286,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>564</width>
<height>363</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -364,8 +364,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>209</width>
<height>245</height>
<width>558</width>
<height>337</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -508,13 +508,20 @@ Authors of this application are NOT responsible for lost data.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkHidden">
<property name="text">
<string>Start application hidden</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkHideWhenMinimized">
<property name="text">
<string>Hide main window when it is minimized</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1229,5 +1236,21 @@ Authors of this application are NOT responsible for lost data.</string>
</hint>
</hints>
</connection>
<connection>
<sender>m_radioTrayOn</sender>
<signal>toggled(bool)</signal>
<receiver>m_checkHideWhenMinimized</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>515</x>
<y>94</y>
</hint>
<hint type="destinationlabel">
<x>357</x>
<y>117</y>
</hint>
</hints>
</connection>
</connections>
</ui>