diff --git a/src/GUI.cpp b/src/GUI.cpp
index 507b4dbff..a2a676246 100644
--- a/src/GUI.cpp
+++ b/src/GUI.cpp
@@ -548,24 +548,30 @@ void GUI::closeEvent(QCloseEvent *e) {
const bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
if(!force_exit && systrayIcon && goToSystrayOnExit && !this->isHidden()) {
hide();
- //e->ignore();
e->accept();
return;
}
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && BTSession->hasActiveTorrents()) {
- show();
- if(!isMaximized())
- showNormal();
if(e->spontaneous() || force_exit) {
- if(QMessageBox::question(this,
- tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
- tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"),
- tr("&Yes"), tr("&No"),
- QString(), 0, 1)) {
+ if(!isVisible())
+ show();
+ QMessageBox confirmBox(QMessageBox::Question, tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
+ tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"));
+ QPushButton *noBtn = confirmBox.addButton(tr("No"), QMessageBox::NoRole);
+ QPushButton *yesBtn = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
+ QPushButton *alwaysBtn = confirmBox.addButton(tr("Always"), QMessageBox::YesRole);
+ confirmBox.setDefaultButton(yesBtn);
+ confirmBox.exec();
+ if(!confirmBox.clickedButton() || confirmBox.clickedButton() == noBtn) {
+ // Cancel exit
e->ignore();
force_exit = false;
return;
}
+ if(confirmBox.clickedButton() == alwaysBtn) {
+ // Remember choice
+ Preferences::setConfirmOnExit(false);
+ }
}
}
hide();
@@ -580,7 +586,6 @@ void GUI::closeEvent(QCloseEvent *e) {
qApp->exit();
}
-
// Display window to create a torrent
void GUI::on_actionCreate_torrent_triggered() {
if(createTorrentDlg) {
diff --git a/src/options_imp.cpp b/src/options_imp.cpp
index ed161bd4b..9d8ddf9a9 100644
--- a/src/options_imp.cpp
+++ b/src/options_imp.cpp
@@ -193,7 +193,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// General tab
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
- connect(checkConfirmExit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkSpeedInTitle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@@ -386,7 +385,6 @@ void options_imp::saveOptions(){
settings.beginGroup("General");
settings.setValue(QString::fromUtf8("Locale"), getLocale());
settings.setValue(QString::fromUtf8("Style"), getStyle());
- settings.setValue(QString::fromUtf8("ExitConfirm"), confirmOnExit());
settings.setValue(QString::fromUtf8("SpeedInTitleBar"), speedInTitleBar());
settings.setValue(QString::fromUtf8("AlternatingRowColors"), checkAltRowColors->isChecked());
settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration());
@@ -617,7 +615,6 @@ void options_imp::loadOptions(){
// General preferences
setLocale(Preferences::getLocale());
setStyle(Preferences::getStyle());
- checkConfirmExit->setChecked(Preferences::confirmOnExit());
checkSpeedInTitle->setChecked(Preferences::speedInTitleBar());
checkAltRowColors->setChecked(Preferences::useAlternatingRowColors());
checkNoSystray->setChecked(!Preferences::systrayIntegration());
@@ -982,10 +979,6 @@ bool options_imp::closeToTray() const{
return checkCloseToSystray->isChecked();
}
-bool options_imp::confirmOnExit() const{
- return checkConfirmExit->isChecked();
-}
-
bool options_imp::isQueueingSystemEnabled() const {
return checkEnableQueueing->isChecked();
}
diff --git a/src/options_imp.h b/src/options_imp.h
index f9639895f..ff633d656 100644
--- a/src/options_imp.h
+++ b/src/options_imp.h
@@ -67,7 +67,6 @@ protected:
// General options
QString getLocale() const;
QString getStyle() const;
- bool confirmOnExit() const;
bool speedInTitleBar() const;
bool systrayIntegration() const;
bool minimizeToTray() const;
diff --git a/src/preferences.h b/src/preferences.h
index e81108247..4e30db55f 100644
--- a/src/preferences.h
+++ b/src/preferences.h
@@ -87,6 +87,11 @@ public:
settings.setValue(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), del);
}
+ static void setConfirmOnExit(bool confirm) {
+ QSettings settings("qBittorrent", "qBittorrent");
+ settings.setValue(QString::fromUtf8("Preferences/General/ExitConfirm"), confirm);
+ }
+
static bool confirmOnExit() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool();
diff --git a/src/ui/options.ui b/src/ui/options.ui
index 71081e384..caa4bdcfe 100644
--- a/src/ui/options.ui
+++ b/src/ui/options.ui
@@ -242,7 +242,7 @@
0
0
506
- 571
+ 543
@@ -335,16 +335,6 @@
- -
-
-
- Ask for confirmation on exit when download list is not empty
-
-
- true
-
-
-
-
@@ -571,7 +561,7 @@ QGroupBox {
0
- -298
+ 0
632
686
@@ -1116,8 +1106,8 @@ QGroupBox {
0
0
- 524
- 398
+ 447
+ 288
@@ -1361,8 +1351,8 @@ QGroupBox {
0
0
- 524
- 406
+ 364
+ 328
@@ -1776,7 +1766,7 @@ QGroupBox {
0
0
- 506
+ 459
407
@@ -2193,8 +2183,8 @@ QGroupBox {
0
0
- 524
- 406
+ 475
+ 308
@@ -2627,8 +2617,8 @@ QGroupBox {
0
0
- 524
- 406
+ 287
+ 124
@@ -2724,8 +2714,8 @@ QGroupBox {
0
0
- 524
- 406
+ 213
+ 221
@@ -2891,8 +2881,8 @@ QGroupBox {
0
0
- 524
- 406
+ 445
+ 192
@@ -3066,8 +3056,8 @@ QGroupBox {
0
0
- 524
- 406
+ 98
+ 28
@@ -3115,7 +3105,6 @@ QGroupBox {
tabOption
comboI18n
comboStyle
- checkConfirmExit
checkSpeedInTitle
checkNoSystray
checkCloseToSystray