From 6e3b570be4deb19fb38c74510f17cd8f4817cc39 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 21 May 2010 15:42:17 +0000 Subject: [PATCH] Add a setting to also delete torrents files on hard disk as a default --- src/deletionconfirmationdlg.h | 3 +++ src/options_imp.cpp | 3 +++ src/preferences.h | 10 ++++++++++ src/ui/options.ui | 9 ++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/deletionconfirmationdlg.h b/src/deletionconfirmationdlg.h index b5c0edd89..4cf089b39 100644 --- a/src/deletionconfirmationdlg.h +++ b/src/deletionconfirmationdlg.h @@ -33,6 +33,7 @@ #include #include "ui_confirmdeletiondlg.h" +#include "preferences.h" #include "misc.h" class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { @@ -42,6 +43,8 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { DeletionConfirmationDlg(QWidget *parent=0): QDialog(parent) { setupUi(this); move(misc::screenCenter(this)); + checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault()); + buttonBox->setFocus(); } bool shouldDeleteLocalFiles() const { diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 45b802026..e9bd56291 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -197,6 +197,7 @@ comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/saoudi_arabia.png"))) connect(checkSystrayBalloons, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDisplayToolbar, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(checkDeleteTorrentFiles, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); // Downloads tab connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -385,6 +386,7 @@ void options_imp::saveOptions(){ settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled()); settings.setValue(QString::fromUtf8("ToolbarDisplayed"), isToolbarDisplayed()); settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled()); + Preferences::setDeleteTorrentFilesAsDefault(checkDeleteTorrentFiles->isChecked()); // End General preferences settings.endGroup(); // Downloads preferences @@ -595,6 +597,7 @@ void options_imp::loadOptions(){ checkNoSystray->setChecked(!Preferences::systrayIntegration()); checkDisplayToolbar->setChecked(Preferences::isToolbarDisplayed()); checkNoSplash->setChecked(Preferences::isSlashScreenDisabled()); + checkDeleteTorrentFiles->setChecked(Preferences::deleteTorrentFilesAsDefault()); if(checkNoSystray->isChecked()) { disableSystrayOptions(); } else { diff --git a/src/preferences.h b/src/preferences.h index e8b50c0e2..1af30d7ef 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -63,6 +63,16 @@ public: settings.setValue(QString::fromUtf8("Preferences/General/Style"), style); } + static bool deleteTorrentFilesAsDefault() { + QSettings settings("qBittorrent", "qBittorrent"); + return settings.value(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), false).toBool(); + } + + static void setDeleteTorrentFilesAsDefault(bool del) { + QSettings settings("qBittorrent", "qBittorrent"); + settings.setValue(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), del); + } + 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 2e63fd99f..c91486522 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -242,7 +242,7 @@ 0 0 506 - 543 + 571 @@ -369,6 +369,13 @@ + + + + On torrent deletion, also delete files on hard disk as a default + + +