1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-09 06:17:58 +00:00

Attempt to make Ishan's patch lighter (the new patch may not take into consideration all use cases but it seems to work ok)

This commit is contained in:
Christophe Dumez 2010-06-10 19:54:20 +00:00
parent eef6f600c9
commit bce7959332
2 changed files with 2 additions and 22 deletions

View File

@ -580,20 +580,6 @@ void GUI::on_actionCreate_torrent_triggered() {
}
}
bool GUI::checkForModals() const {
//Returns true if there are any modal windows visible
QList<QDialog*> dialog_list = findChildren<QDialog*>();
QList<QDialog*>::const_iterator i;
for(i = dialog_list.begin(); i != dialog_list.constEnd(); i++) {
if((*i)->isModal() && (*i)->isVisible()) {
return true;
}
}
return false;
}
bool GUI::event(QEvent * e) {
if(e->type() == QEvent::WindowStateChange) {
qDebug("Window change event");
@ -602,16 +588,11 @@ bool GUI::event(QEvent * e) {
qDebug("minimisation");
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
if(checkForModals())
{
qDebug("Minimize to Tray enabled, but not hiding because of a modal dialog");
}
else
{
if(!qApp->activeWindow() || !qApp->activeWindow()->isModal()) {
qDebug("Minimize to Tray enabled, hiding!");
e->accept();
QTimer::singleShot(0, this, SLOT(hide()));
return true;
return true;
}
}
}

View File

@ -68,7 +68,6 @@ public:
~GUI();
// Methods
int getCurrentTabIndex() const;
bool checkForModals() const;
TransferListWidget* getTransferList() const { return transferList; }
QMenu* getTrayIconMenu();