|
|
@ -414,8 +414,13 @@ MainWindow::MainWindow(QWidget *parent) |
|
|
|
} |
|
|
|
} |
|
|
|
else if (pref->startMinimized()) { |
|
|
|
else if (pref->startMinimized()) { |
|
|
|
showMinimized(); |
|
|
|
showMinimized(); |
|
|
|
if (pref->minimizeToTray()) |
|
|
|
if (pref->minimizeToTray()) { |
|
|
|
hide(); |
|
|
|
hide(); |
|
|
|
|
|
|
|
if (!pref->minimizeToTrayNotified()) { |
|
|
|
|
|
|
|
showNotificationBaloon(tr("qBittorrent is minimized to tray"), tr("This behavior can be changed in the settings. You won't be reminded again.")); |
|
|
|
|
|
|
|
pref->setMinimizeToTrayNotified(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
@ -1139,6 +1144,10 @@ void MainWindow::closeEvent(QCloseEvent *e) |
|
|
|
if (!m_forceExit && m_systrayIcon && goToSystrayOnExit && !this->isHidden()) { |
|
|
|
if (!m_forceExit && m_systrayIcon && goToSystrayOnExit && !this->isHidden()) { |
|
|
|
hide(); |
|
|
|
hide(); |
|
|
|
e->accept(); |
|
|
|
e->accept(); |
|
|
|
|
|
|
|
if (!pref->closeToTrayNotified()) { |
|
|
|
|
|
|
|
showNotificationBaloon(tr("qBittorrent is closed to tray"), tr("This behavior can be changed in the settings. You won't be reminded again.")); |
|
|
|
|
|
|
|
pref->setCloseToTrayNotified(true); |
|
|
|
|
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // Q_OS_MAC
|
|
|
|
#endif // Q_OS_MAC
|
|
|
@ -1208,7 +1217,8 @@ bool MainWindow::event(QEvent *e) |
|
|
|
// Now check to see if the window is minimised
|
|
|
|
// Now check to see if the window is minimised
|
|
|
|
if (isMinimized()) { |
|
|
|
if (isMinimized()) { |
|
|
|
qDebug("minimisation"); |
|
|
|
qDebug("minimisation"); |
|
|
|
if (m_systrayIcon && Preferences::instance()->minimizeToTray()) { |
|
|
|
Preferences *const pref = Preferences::instance(); |
|
|
|
|
|
|
|
if (m_systrayIcon && pref->minimizeToTray()) { |
|
|
|
qDebug() << "Has active window:" << (qApp->activeWindow() != nullptr); |
|
|
|
qDebug() << "Has active window:" << (qApp->activeWindow() != nullptr); |
|
|
|
// Check if there is a modal window
|
|
|
|
// Check if there is a modal window
|
|
|
|
bool hasModalWindow = false; |
|
|
|
bool hasModalWindow = false; |
|
|
@ -1223,6 +1233,10 @@ bool MainWindow::event(QEvent *e) |
|
|
|
qDebug("Minimize to Tray enabled, hiding!"); |
|
|
|
qDebug("Minimize to Tray enabled, hiding!"); |
|
|
|
e->ignore(); |
|
|
|
e->ignore(); |
|
|
|
QTimer::singleShot(0, this, &QWidget::hide); |
|
|
|
QTimer::singleShot(0, this, &QWidget::hide); |
|
|
|
|
|
|
|
if (!pref->minimizeToTrayNotified()) { |
|
|
|
|
|
|
|
showNotificationBaloon(tr("qBittorrent is minimized to tray"), tr("This behavior can be changed in the settings. You won't be reminded again.")); |
|
|
|
|
|
|
|
pref->setMinimizeToTrayNotified(true); |
|
|
|
|
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|