Browse Source

FEATURE: Added option to skip torrent deletion confirmation (Ville Kiiskinen)

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
8fd7b86f45
  1. 3
      Changelog
  2. 13
      src/preferences/advancedsettings.h
  3. 6
      src/preferences/preferences.h
  4. 33
      src/transferlistwidget.cpp

3
Changelog

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v2.7.0
- FEATURE: Added option to skip torrent deletion confirmation (Ville Kiiskinen)
* Sun Jan 9 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.0
- FEATURE: Use system icons (Linux, Qt >= 4.6)
- FEATURE: Improved ETA calculation

13
src/preferences/advancedsettings.h

@ -18,14 +18,15 @@ enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_L @@ -18,14 +18,15 @@ enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_L
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
USE_ICON_THEME,
#endif
ROW_COUNT };
CONFIRM_DELETE_TORRENT,
ROW_COUNT};
class AdvancedSettings: public QTableWidget {
Q_OBJECT
private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen, *spin_tracker_port;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts, *cb_super_seeding, *cb_program_notifications, *cb_tracker_status;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts, *cb_super_seeding, *cb_program_notifications, *cb_tracker_status, *cb_confirm_torrent_deletion;
QComboBox *combo_iface;
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
QCheckBox *cb_update_check;
@ -67,6 +68,7 @@ public: @@ -67,6 +68,7 @@ public:
delete cb_program_notifications;
delete spin_tracker_port;
delete cb_tracker_status;
delete cb_confirm_torrent_deletion;
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
delete cb_update_check;
#endif
@ -119,6 +121,7 @@ public slots: @@ -119,6 +121,7 @@ public slots:
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
pref.useSystemIconTheme(cb_use_icon_theme->isChecked());
#endif
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion->isChecked());
}
protected slots:
@ -255,6 +258,12 @@ protected slots: @@ -255,6 +258,12 @@ protected slots:
cb_use_icon_theme->setChecked(pref.useSystemIconTheme());
setCellWidget(USE_ICON_THEME, VALUE, cb_use_icon_theme);
#endif
// Torrent deletion confirmation
setItem(CONFIRM_DELETE_TORRENT, PROPERTY, new QTableWidgetItem(tr("Confirm torrent deletion")));
cb_confirm_torrent_deletion = new QCheckBox();
connect(cb_confirm_torrent_deletion, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
cb_confirm_torrent_deletion->setChecked(pref.confirmTorrentDeletion());
setCellWidget(CONFIRM_DELETE_TORRENT, VALUE, cb_confirm_torrent_deletion);
}
void emitSettingsChanged() {

6
src/preferences/preferences.h

@ -1009,6 +1009,12 @@ public: @@ -1009,6 +1009,12 @@ public:
setValue(QString::fromUtf8("Preferences/Advanced/updateCheck"), enabled);
}
#endif
bool confirmTorrentDeletion() const {
return value(QString::fromUtf8("Preferences/Advanced/confirmTorrentDeletion"), true).toBool();
}
void setConfirmTorrentDeletion(bool enabled) {
setValue(QString::fromUtf8("Preferences/Advanced/confirmTorrentDeletion"), enabled);
}
};
#endif // PREFERENCES_H

33
src/transferlistwidget.cpp

@ -285,28 +285,29 @@ void TransferListWidget::pauseVisibleTorrents() { @@ -285,28 +285,29 @@ void TransferListWidget::pauseVisibleTorrents() {
void TransferListWidget::deleteSelectedTorrents() {
if(main_window->getCurrentTabWidget() != this) return;
const QStringList& hashes = getSelectedTorrentsHashes();
if(!hashes.empty()) {
bool delete_local_files = false;
if(DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) {
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
}
if(hashes.empty()) return;
bool delete_local_files = false;
if(Preferences().confirmTorrentDeletion() &&
!DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files))
return;
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
}
void TransferListWidget::deleteVisibleTorrents() {
if(nameFilterModel->rowCount() <= 0) return;
bool delete_local_files = false;
if(DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) {
QStringList hashes;
for(int i=0; i<nameFilterModel->rowCount(); ++i) {
const int row = mapToSource(nameFilterModel->index(i, 0)).row();
hashes << getHashFromRow(row);
}
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
if(Preferences().confirmTorrentDeletion() &&
!DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files))
return;
QStringList hashes;
for(int i=0; i<nameFilterModel->rowCount(); ++i) {
const int row = mapToSource(nameFilterModel->index(i, 0)).row();
hashes << getHashFromRow(row);
}
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
}

Loading…
Cancel
Save