mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
Notify users on 1st time close/minimize to tray
This commit is contained in:
@@ -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)
|
||||
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)
|
||||
// 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)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user