mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-10 15:22:30 +01:00
Some hiding fixes.
This commit is contained in:
parent
6bbedcf703
commit
6d587c0e03
@ -61,6 +61,7 @@
|
||||
#define AUTO_UPDATE_INTERVAL 60000
|
||||
#define STARTUP_UPDATE_DELAY 1500
|
||||
#define TIMEZONE_OFFSET_LIMIT 6
|
||||
#define CHANGE_EVENT_DELAY 250
|
||||
|
||||
#define APP_DB_TEST_MYSQL "MySQLTest"
|
||||
#define APP_DB_MYSQL_PORT 3306
|
||||
|
@ -137,12 +137,8 @@ void FormMain::prepareMenus() {
|
||||
m_trayMenu = new QMenu(APP_NAME, this);
|
||||
#endif
|
||||
|
||||
// Add "check for updates" item on some platforms.
|
||||
m_ui->m_actionCheckForUpdates->setIcon(IconThemeFactory::instance()->fromTheme("check-for-updates"));
|
||||
m_ui->m_actionCheckForUpdates->setToolTip(tr("Check if new update for the application is available for download."));
|
||||
|
||||
// Add needed items to the menu.
|
||||
m_trayMenu->addAction(m_ui->m_actionSwitchMainWindowTray);
|
||||
m_trayMenu->addAction(m_ui->m_actionSwitchMainWindow);
|
||||
m_trayMenu->addSeparator();
|
||||
m_trayMenu->addAction(m_ui->m_actionUpdateAllFeeds);
|
||||
m_trayMenu->addAction(m_ui->m_actionMarkAllFeedsRead);
|
||||
@ -187,12 +183,27 @@ void FormMain::switchMainMenu() {
|
||||
m_ui->m_menuBar->setVisible(m_ui->m_actionSwitchMainMenu->isChecked());
|
||||
}
|
||||
|
||||
void FormMain::switchVisibility() {
|
||||
if (isVisible()) {
|
||||
hide();
|
||||
void FormMain::switchVisibility(bool force_hide) {
|
||||
// TODO: Kdyz neni povolena tray ikona, tak je povolena satle polozka "switch window" v menu.
|
||||
// v pripade ze tedy neni povolena tray ikona, tak polozku switch bud disabnout
|
||||
// nebo upravit jeji chovani aby provedla minimalizaci a ne hide.
|
||||
// aktualne nastaveno na tu minimalizaci
|
||||
if (force_hide || isVisible()) {
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
hide();
|
||||
}
|
||||
else {
|
||||
setWindowState(windowState() & Qt::WindowMinimized);
|
||||
}
|
||||
m_ui->m_actionSwitchMainWindow->blockSignals(true);
|
||||
m_ui->m_actionSwitchMainWindow->setChecked(false);
|
||||
m_ui->m_actionSwitchMainWindow->blockSignals(false);
|
||||
}
|
||||
else {
|
||||
display();
|
||||
m_ui->m_actionSwitchMainWindow->blockSignals(true);
|
||||
m_ui->m_actionSwitchMainWindow->setChecked(true);
|
||||
m_ui->m_actionSwitchMainWindow->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,6 +273,7 @@ void FormMain::setupIcons() {
|
||||
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme("application-settings"));
|
||||
m_ui->m_actionQuit->setIcon(icon_theme_factory->fromTheme("application-exit"));
|
||||
m_ui->m_actionAboutGuard->setIcon(icon_theme_factory->fromTheme("application-about"));
|
||||
m_ui->m_actionCheckForUpdates->setIcon(IconThemeFactory::instance()->fromTheme("check-for-updates"));
|
||||
m_ui->m_actionDefragmentDatabase->setIcon(icon_theme_factory->fromTheme("defragment-database"));
|
||||
|
||||
// View.
|
||||
@ -372,8 +384,8 @@ void FormMain::createConnections() {
|
||||
|
||||
// Menu "View" connections.
|
||||
connect(m_ui->m_actionFullscreen, SIGNAL(toggled(bool)), this, SLOT(switchFullscreenMode()));
|
||||
connect(m_ui->m_actionSwitchMainWindow, SIGNAL(triggered()), this, SLOT(switchVisibility()));
|
||||
connect(m_ui->m_actionSwitchMainMenu, SIGNAL(toggled(bool)), this, SLOT(switchMainMenu()));
|
||||
connect(m_ui->m_actionSwitchMainWindow, SIGNAL(toggled(bool)), this, SLOT(switchVisibility()));
|
||||
|
||||
// Menu "Tools" connections.
|
||||
connect(m_ui->m_actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
|
||||
@ -431,7 +443,8 @@ void FormMain::changeEvent(QEvent *event) {
|
||||
Settings::instance()->value(APP_CFG_GUI,
|
||||
"hide_when_minimized",
|
||||
false).toBool()) {
|
||||
QTimer::singleShot(250, this, SLOT(hide()));
|
||||
event->ignore();
|
||||
QTimer::singleShot(CHANGE_EVENT_DELAY, this, SLOT(switchVisibility()));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -90,7 +90,7 @@ class FormMain : public QMainWindow {
|
||||
void display();
|
||||
|
||||
// Switches visibility of main window.
|
||||
void switchVisibility();
|
||||
void switchVisibility(bool force_hide = false);
|
||||
|
||||
// Turns on/off fullscreen mode
|
||||
void switchFullscreenMode();
|
||||
|
@ -371,7 +371,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Main &window</string>
|
||||
@ -450,7 +450,7 @@
|
||||
<string>Check for &updates</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check if new application updates are available.</string>
|
||||
<string>Check if new update for the application is available for download.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionSwitchMainMenu">
|
||||
@ -494,17 +494,6 @@
|
||||
<string>Auto-load &images</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionSwitchMainWindowTray">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Switch visibility of main &window</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Hides main window if it is visible and shows it if it is hidden.</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -115,7 +115,7 @@ int main(int argc, char *argv[]) {
|
||||
false).toBool() &&
|
||||
SystemTrayIcon::isSystemTrayActivated()) {
|
||||
qDebug("Hiding the main window when the application is starting.");
|
||||
main_window.hide();
|
||||
main_window.switchVisibility(true);
|
||||
}
|
||||
else {
|
||||
qDebug("Showing the main window when the application is starting.");
|
||||
|
Loading…
Reference in New Issue
Block a user