From 08cd1c9b0c2f522ce9d0a961b7c49d443f4ad99e Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 6 Oct 2013 18:42:56 +0300 Subject: [PATCH] Option to disallow bringing the torrent dialog to the front. --- src/addnewtorrentdialog.cpp | 3 +++ src/preferences/options.ui | 37 +++++++++++++++++++++------------ src/preferences/options_imp.cpp | 3 +++ src/preferences/preferences.h | 8 +++++++ 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/addnewtorrentdialog.cpp b/src/addnewtorrentdialog.cpp index 2340f23fd..91343f14e 100644 --- a/src/addnewtorrentdialog.cpp +++ b/src/addnewtorrentdialog.cpp @@ -141,6 +141,9 @@ void AddNewTorrentDialog::showMagnet(const QString& link) void AddNewTorrentDialog::showEvent(QShowEvent *event) { QDialog::showEvent(event); + Preferences pref; + if (!pref.AdditionDialogFront()) + return; activateWindow(); raise(); } diff --git a/src/preferences/options.ui b/src/preferences/options.ui index 8d8b49d08..310abb7c9 100755 --- a/src/preferences/options.ui +++ b/src/preferences/options.ui @@ -517,7 +517,7 @@ 0 0 458 - 872 + 905 @@ -536,16 +536,6 @@ 9 - - - - Display torrent content and some options - - - false - - - @@ -553,6 +543,28 @@ + + + + Display torrent content and some options + + + true + + + + + + Bring torrent dialog to the front + + + true + + + + + + @@ -1022,7 +1034,7 @@ 0 0 - 458 + 357 498 @@ -2765,7 +2777,6 @@ comboI18n textSavePath browseSaveDirButton - checkAdditionDialog checkStartPaused spinPort checkUPnP diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 19736bc1b..e84461a06 100755 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -161,6 +161,7 @@ options_imp::options_imp(QWidget *parent): connect(checkAppendqB, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkPreallocateAll, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(checkAdditionDialogFront, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkStartPaused, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkExportDir, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkExportDirFin, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -400,6 +401,7 @@ void options_imp::saveOptions() { pref.useIncompleteFilesExtension(checkAppendqB->isChecked()); pref.preAllocateAllFiles(preAllocateAllFiles()); pref.useAdditionDialog(useAdditionDialog()); + pref.AdditionDialogFront(checkAdditionDialogFront->isChecked()); pref.addTorrentsInPause(addTorrentsInPause()); ScanFoldersModel::instance()->makePersistent(); addedScanDirs.clear(); @@ -581,6 +583,7 @@ void options_imp::loadOptions() { checkAppendqB->setChecked(pref.useIncompleteFilesExtension()); checkPreallocateAll->setChecked(pref.preAllocateAllFiles()); checkAdditionDialog->setChecked(pref.useAdditionDialog()); + checkAdditionDialogFront->setChecked(pref.AdditionDialogFront()); checkStartPaused->setChecked(pref.addTorrentsInPause()); strValue = pref.getTorrentExportDir(); diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index b44594d08..5a44ab7d4 100755 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -282,6 +282,14 @@ public: setValue("Preferences/Downloads/NewAdditionDialog", b); } + bool AdditionDialogFront() const { + return value(QString::fromUtf8("Preferences/Downloads/NewAdditionDialogFront"), true).toBool(); + } + + void AdditionDialogFront(bool b) { + setValue("Preferences/Downloads/NewAdditionDialogFront", b); + } + bool addTorrentsInPause() const { return value(QString::fromUtf8("Preferences/Downloads/StartInPause"), false).toBool(); }