|
|
|
@ -414,8 +414,13 @@ MainWindow::MainWindow(QWidget *parent)
@@ -414,8 +414,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
} |
|
|
|
|
else if (pref->startMinimized()) { |
|
|
|
|
showMinimized(); |
|
|
|
|
if (pref->minimizeToTray()) |
|
|
|
|
if (pref->minimizeToTray()) { |
|
|
|
|
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 { |
|
|
|
@ -1139,6 +1144,10 @@ void MainWindow::closeEvent(QCloseEvent *e)
@@ -1139,6 +1144,10 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
|
|
|
|
if (!m_forceExit && m_systrayIcon && goToSystrayOnExit && !this->isHidden()) { |
|
|
|
|
hide(); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
#endif // Q_OS_MAC
|
|
|
|
@ -1208,7 +1217,8 @@ bool MainWindow::event(QEvent *e)
@@ -1208,7 +1217,8 @@ bool MainWindow::event(QEvent *e)
|
|
|
|
|
// Now check to see if the window is minimised
|
|
|
|
|
if (isMinimized()) { |
|
|
|
|
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); |
|
|
|
|
// Check if there is a modal window
|
|
|
|
|
bool hasModalWindow = false; |
|
|
|
@ -1223,6 +1233,10 @@ bool MainWindow::event(QEvent *e)
@@ -1223,6 +1233,10 @@ bool MainWindow::event(QEvent *e)
|
|
|
|
|
qDebug("Minimize to Tray enabled, hiding!"); |
|
|
|
|
e->ignore(); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|