mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
Notify users on 1st time close/minimize to tray
This commit is contained in:
parent
5fa3d9f19c
commit
06ebe756e8
3 changed files with 40 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue