From 2f065bd9eaf86842961d0dab590dd594df587fc3 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 29 Mar 2007 20:24:23 +0000 Subject: [PATCH] - Bring main window to foreground when it is minimized on exit confirmation --- src/GUI.cpp | 6 ++++-- src/GUI.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 42a8e9cd7..926dc643c 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -129,6 +129,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ connect(options, SIGNAL(status_changed(const QString&, bool)), this, SLOT(OptionsSaved(const QString&, bool))); // Configure BT session according to options configureSession(true); + force_exit = false; // Resume unfinished torrents BTSession.resumeUnfinishedTorrents(); // Add torrent given on command line @@ -401,7 +402,7 @@ void GUI::displayDLListMenu(const QPoint& pos){ // Necessary if we want to close the window // in one time if "close to systray" is enabled void GUI::forceExit(){ - hide(); + force_exit = true; close(); } @@ -808,13 +809,14 @@ void GUI::showAbout(){ void GUI::closeEvent(QCloseEvent *e){ QSettings settings("qBittorrent", "qBittorrent"); bool goToSystrayOnExit = settings.value("Options/Misc/Behaviour/GoToSystrayOnExit", false).toBool(); - if(goToSystrayOnExit && !this->isHidden()){ + if(!force_exit && goToSystrayOnExit && !this->isHidden()){ hide(); e->ignore(); return; } if(settings.value("Options/Misc/Behaviour/ConfirmOnExit", true).toBool()){ show(); + showNormal(); if(QMessageBox::question(this, tr("Are you sure you want to quit?")+" -- "+tr("qBittorrent"), tr("Are you sure you want to quit qBittorrent?"), diff --git a/src/GUI.h b/src/GUI.h index 6d29f1fb3..1ebaa0427 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -81,6 +81,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ SearchListDelegate *SearchDelegate; unsigned int nbTorrents; QLabel *connecStatusLblIcon; + bool force_exit; // Preview previewSelect *previewSelection; QProcess *previewProcess;