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. 13
      src/transferlistwidget.cpp

3
Changelog

@ -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 * Sun Jan 9 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.0
- FEATURE: Use system icons (Linux, Qt >= 4.6) - FEATURE: Use system icons (Linux, Qt >= 4.6)
- FEATURE: Improved ETA calculation - 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
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) #if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
USE_ICON_THEME, USE_ICON_THEME,
#endif #endif
ROW_COUNT }; CONFIRM_DELETE_TORRENT,
ROW_COUNT};
class AdvancedSettings: public QTableWidget { class AdvancedSettings: public QTableWidget {
Q_OBJECT Q_OBJECT
private: private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen, *spin_tracker_port; 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; QComboBox *combo_iface;
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) #if defined(Q_WS_WIN) || defined(Q_WS_MAC)
QCheckBox *cb_update_check; QCheckBox *cb_update_check;
@ -67,6 +68,7 @@ public:
delete cb_program_notifications; delete cb_program_notifications;
delete spin_tracker_port; delete spin_tracker_port;
delete cb_tracker_status; delete cb_tracker_status;
delete cb_confirm_torrent_deletion;
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) #if defined(Q_WS_WIN) || defined(Q_WS_MAC)
delete cb_update_check; delete cb_update_check;
#endif #endif
@ -119,6 +121,7 @@ public slots:
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) #if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
pref.useSystemIconTheme(cb_use_icon_theme->isChecked()); pref.useSystemIconTheme(cb_use_icon_theme->isChecked());
#endif #endif
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion->isChecked());
} }
protected slots: protected slots:
@ -255,6 +258,12 @@ protected slots:
cb_use_icon_theme->setChecked(pref.useSystemIconTheme()); cb_use_icon_theme->setChecked(pref.useSystemIconTheme());
setCellWidget(USE_ICON_THEME, VALUE, cb_use_icon_theme); setCellWidget(USE_ICON_THEME, VALUE, cb_use_icon_theme);
#endif #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() { void emitSettingsChanged() {

6
src/preferences/preferences.h

@ -1009,6 +1009,12 @@ public:
setValue(QString::fromUtf8("Preferences/Advanced/updateCheck"), enabled); setValue(QString::fromUtf8("Preferences/Advanced/updateCheck"), enabled);
} }
#endif #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 #endif // PREFERENCES_H

13
src/transferlistwidget.cpp

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

Loading…
Cancel
Save