diff --git a/Changelog b/Changelog index 0c1f9f612..a2a9cda6b 100644 --- a/Changelog +++ b/Changelog @@ -31,6 +31,7 @@ - COSMETIC: Made program preferences scrollable for usability on small screens (e.g. netbooks) - COSMETIC: Added a "torrent status" column to transfer list - COSMETIC: Display Seeds and Peers in two separate columns + - COSMETIC: New deletion confirmation dialog (Merged delete/delete permanently actions) * Thu Sep 3 2009 - Christophe Dumez - v1.5.0 - FEATURE: Added Magnet URI support diff --git a/src/GUI.cpp b/src/GUI.cpp index 9abce1c44..f890ca8f9 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -121,8 +121,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis prioSeparator2 = menu_Edit->insertSeparator(actionDecreasePriority); prioSeparator->setVisible(false); prioSeparator2->setVisible(false); - actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); - actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); actionCreate_torrent->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/new.png"))); // Fix Tool bar layout toolBar->layout()->setSpacing(7); @@ -158,7 +156,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis connect(actionPause, SIGNAL(triggered()), transferList, SLOT(pauseSelectedTorrents())); connect(actionPause_All, SIGNAL(triggered()), transferList, SLOT(pauseAllTorrents())); connect(actionDelete, SIGNAL(triggered()), transferList, SLOT(deleteSelectedTorrents())); - connect(actionDelete_Permanently, SIGNAL(triggered()), transferList, SLOT(deletePermSelectedTorrents())); connect(actionIncreasePriority, SIGNAL(triggered()), transferList, SLOT(increasePrioSelectedTorrents())); connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents())); @@ -397,10 +394,8 @@ void GUI::createKeyboardShortcuts() { connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab())); switchRSSShortcut = new QShortcut(QKeySequence(tr("Alt+4", "shortcut to switch to fourth tab")), this); connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab())); - actionTorrent_Properties->setShortcut(QKeySequence(QString::fromUtf8("Alt+P"))); actionOptions->setShortcut(QKeySequence(QString::fromUtf8("Alt+O"))); actionDelete->setShortcut(QKeySequence(QString::fromUtf8("Del"))); - actionDelete_Permanently->setShortcut(QKeySequence(QString::fromUtf8("Shift+Del"))); actionStart->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+S"))); actionStart_All->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Shift+S"))); actionPause->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+P"))); diff --git a/src/Icons/oxygen/dialog-warning.png b/src/Icons/oxygen/dialog-warning.png new file mode 100644 index 000000000..0666a3903 Binary files /dev/null and b/src/Icons/oxygen/dialog-warning.png differ diff --git a/src/MainWindow.ui b/src/MainWindow.ui index e3fe70399..f1c467d2e 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -25,7 +25,7 @@ 0 0 914 - 23 + 27 @@ -38,10 +38,8 @@ - - @@ -107,9 +105,6 @@ - - - @@ -174,16 +169,6 @@ Visit website - - - Delete Permanently - - - - - Torrent Properties - - Download from URL diff --git a/src/TransferListWidget.cpp b/src/TransferListWidget.cpp index cbd5c5e8d..72aab6e97 100644 --- a/src/TransferListWidget.cpp +++ b/src/TransferListWidget.cpp @@ -35,6 +35,7 @@ #include "previewSelect.h" #include "speedlimitdlg.h" #include "options_imp.h" +#include "deletionconfirmationdlg.h" #include #include #include @@ -477,46 +478,19 @@ void TransferListWidget::pauseAllTorrents() { void TransferListWidget::deleteSelectedTorrents() { QModelIndexList selectedIndexes = selectionModel()->selectedRows(); if(!selectedIndexes.empty()) { - int ret = QMessageBox::question( - this, - tr("Deletion confirmation"), - tr("Are you sure you want to delete the selected torrents from transfer list?"), - tr("&Yes"), tr("&No"), - QString(), 0, 1); - if(ret) return; - QStringList hashes; - foreach(const QModelIndex &index, selectedIndexes) { - // Get the file hash - hashes << getHashFromRow(proxyModel->mapToSource(index).row()); + bool delete_local_files = false; + if(DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) { + QStringList hashes; + foreach(const QModelIndex &index, selectedIndexes) { + // Get the file hash + hashes << getHashFromRow(proxyModel->mapToSource(index).row()); + } + foreach(const QString &hash, hashes) { + deleteTorrent(getRowFromHash(hash), false); + BTSession->deleteTorrent(hash, delete_local_files); + } + refreshList(); } - foreach(const QString &hash, hashes) { - deleteTorrent(getRowFromHash(hash), false); - BTSession->deleteTorrent(hash, false); - } - refreshList(); - } -} - -void TransferListWidget::deletePermSelectedTorrents() { - QModelIndexList selectedIndexes = selectionModel()->selectedRows(); - if(!selectedIndexes.empty()) { - int ret = QMessageBox::question( - this, - tr("Deletion confirmation"), - tr("Are you sure you want to delete the selected torrents from transfe list and hard disk?"), - tr("&Yes"), tr("&No"), - QString(), 0, 1); - if(ret) return; - QStringList hashes; - foreach(const QModelIndex &index, selectedIndexes) { - // Get the file hash - hashes << getHashFromRow(proxyModel->mapToSource(index).row()); - } - foreach(const QString &hash, hashes) { - deleteTorrent(getRowFromHash(hash), false); - BTSession->deleteTorrent(hash, true); - } - refreshList(); } } @@ -765,8 +739,6 @@ void TransferListWidget::displayListMenu(const QPoint&) { connect(&actionSet_upload_limit, SIGNAL(triggered()), this, SLOT(setUpLimitSelectedTorrents())); QAction actionSet_download_limit(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")), tr("Limit download rate"), 0); connect(&actionSet_download_limit, SIGNAL(triggered()), this, SLOT(setDlLimitSelectedTorrents())); - QAction actionDelete_Permanently(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png")), tr("Delete Permanently"), 0); - connect(&actionDelete_Permanently, SIGNAL(triggered()), this, SLOT(deletePermSelectedTorrents())); QAction actionOpen_destination_folder(QIcon(QString::fromUtf8(":/Icons/oxygen/folder.png")), tr("Open destination folder"), 0); connect(&actionOpen_destination_folder, SIGNAL(triggered()), this, SLOT(openSelectedTorrentsFolder())); QAction actionBuy_it(QIcon(QString::fromUtf8(":/Icons/oxygen/wallet.png")), tr("Buy it"), 0); @@ -833,7 +805,6 @@ void TransferListWidget::displayListMenu(const QPoint&) { } listMenu.addSeparator(); listMenu.addAction(&actionDelete); - listMenu.addAction(&actionDelete_Permanently); listMenu.addSeparator(); if(one_not_seed) listMenu.addAction(&actionSet_download_limit); diff --git a/src/TransferListWidget.h b/src/TransferListWidget.h index adae1aa66..3516b7174 100644 --- a/src/TransferListWidget.h +++ b/src/TransferListWidget.h @@ -92,7 +92,6 @@ public slots: void pauseSelectedTorrents(); void pauseAllTorrents(); void deleteSelectedTorrents(); - void deletePermSelectedTorrents(); void increasePrioSelectedTorrents(); void decreasePrioSelectedTorrents(); void buySelectedTorrents() const; diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index e1bc8ea4b..29cd36f10 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -526,7 +526,7 @@ void bittorrent::banIP(QString ip) { // Delete a torrent from the session, given its hash // permanent = true means that the torrent will be removed from the hard-drive too -void bittorrent::deleteTorrent(QString hash, bool permanent) { +void bittorrent::deleteTorrent(QString hash, bool delete_local_files) { qDebug("Deleting torrent with hash: %s", hash.toLocal8Bit().data()); QTorrentHandle h = getTorrentHandle(hash); if(!h.is_valid()) { @@ -536,7 +536,7 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) { QString savePath = h.save_path(); QString fileName = h.name(); // Remove it from session - if(permanent) + if(delete_local_files) s->remove_torrent(h.get_torrent_handle(), session::delete_files); else s->remove_torrent(h.get_torrent_handle()); @@ -551,10 +551,10 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) { TorrentPersistentData::deletePersistentData(hash); // Remove tracker errors trackersErrors.remove(hash); - if(permanent) - addConsoleMessage(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName)); + if(delete_local_files) + addConsoleMessage(tr("'%1' was removed from transfer list and hard disk.", "'xxx.avi' was removed...").arg(fileName)); else - addConsoleMessage(tr("'%1' was removed.", "'xxx.avi' was removed.").arg(fileName)); + addConsoleMessage(tr("'%1' was removed from transfer list.", "'xxx.avi' was removed...").arg(fileName)); emit deletedTorrent(hash); } diff --git a/src/bittorrent.h b/src/bittorrent.h index cf0a6cb4c..84a710621 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -119,7 +119,7 @@ class bittorrent : public QObject { void loadSessionState(); void saveSessionState(); void downloadFromUrl(QString url); - void deleteTorrent(QString hash, bool permanent = false); + void deleteTorrent(QString hash, bool delete_local_files = false); void startUpTorrents(); /* Needed by Web UI */ void pauseAllTorrents(); diff --git a/src/confirmdeletiondlg.ui b/src/confirmdeletiondlg.ui new file mode 100644 index 000000000..4ea212e69 --- /dev/null +++ b/src/confirmdeletiondlg.ui @@ -0,0 +1,123 @@ + + + confirmDeletionDlg + + + + 0 + 0 + 377 + 138 + + + + Deletion confirmation - qBittorrent + + + + + 30 + 100 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 90 + 0 + 281 + 61 + + + + Are you sure you want to delete the selected torrents from the transfer list? + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 20 + 70 + 351 + 23 + + + + + true + + + + Delete the files on the hard disk as well + + + + + + 10 + 0 + 61 + 61 + + + + + + + :/Icons/oxygen/dialog-warning.png + + + + + + + + + buttonBox + accepted() + confirmDeletionDlg + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + confirmDeletionDlg + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/deletionconfirmationdlg.h b/src/deletionconfirmationdlg.h new file mode 100644 index 000000000..845cc1d19 --- /dev/null +++ b/src/deletionconfirmationdlg.h @@ -0,0 +1,60 @@ +/* + * Bittorrent Client using Qt4 and libtorrent. + * Copyright (C) 2006 Christophe Dumez + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give permission to + * link this program with the OpenSSL project's "OpenSSL" library (or with + * modified versions of it that use the same license as the "OpenSSL" library), + * and distribute the linked executables. You must obey the GNU General Public + * License in all respects for all of the code used other than "OpenSSL". If you + * modify file(s), you may extend this exception to your version of the file(s), + * but you are not obligated to do so. If you do not wish to do so, delete this + * exception statement from your version. + * + * Contact : chris@qbittorrent.org + */ + +#ifndef DELETIONCONFIRMATIONDLG_H +#define DELETIONCONFIRMATIONDLG_H + +#include +#include "ui_confirmdeletiondlg.h" + +class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { + Q_OBJECT + + public: + DeletionConfirmationDlg(QWidget *parent=0): QDialog(parent) { + setupUi(this); + } + + bool shouldDeleteLocalFiles() const { + return checkPermDelete->isChecked(); + } + + static bool askForDeletionConfirmation(bool *delete_local_files) { + DeletionConfirmationDlg dlg; + if(dlg.exec() == QDialog::Accepted) { + *delete_local_files = dlg.shouldDeleteLocalFiles(); + return true; + } + return false; + } + +}; + +#endif // DELETIONCONFIRMATIONDLG_H diff --git a/src/icons.qrc b/src/icons.qrc index 239136387..d554cb511 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -120,6 +120,7 @@ Icons/oxygen/gear.png Icons/oxygen/draw-triangle2.png Icons/oxygen/remove.png + Icons/oxygen/dialog-warning.png Icons/oxygen/peer.png Icons/oxygen/browse.png Icons/oxygen/unsubscribe16.png diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp index ff1413f7b..5d721b2a7 100644 --- a/src/propertieswidget.cpp +++ b/src/propertieswidget.cpp @@ -67,6 +67,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer url_seeds_button->setStyleSheet(DEFAULT_BUTTON_CSS); files_button->setStyleSheet(DEFAULT_BUTTON_CSS); main_infos_button->setStyleSheet(DEFAULT_BUTTON_CSS); + main_infos_button->setShortcut(QKeySequence(QString::fromUtf8("Alt+P"))); // Set Properties list model PropListModel = new TorrentFilesModel(); diff --git a/src/src.pro b/src/src.pro index 62eaeb9c2..f184a39f8 100644 --- a/src/src.pro +++ b/src/src.pro @@ -18,7 +18,8 @@ DEFINES += VERSION=\\\"v2.0.0beta2\\\" DEFINES += VERSION_MAJOR=2 DEFINES += VERSION_MINOR=0 DEFINES += VERSION_BUGFIX=0 -#!mac:QMAKE_LFLAGS += -Wl,--as-needed + +# !mac:QMAKE_LFLAGS += -Wl,--as-needed contains(DEBUG_MODE, 1) { CONFIG += debug CONFIG -= release @@ -192,7 +193,8 @@ HEADERS += GUI.h \ reverseresolution.h \ preferences.h \ geoip.h \ - peeraddition.h + peeraddition.h \ + deletionconfirmationdlg.h FORMS += MainWindow.ui \ options.ui \ about.ui \ @@ -210,7 +212,8 @@ FORMS += MainWindow.ui \ console.ui \ FeedDownloader.ui \ propertiesWidget.ui \ - peer.ui + peer.ui \ + confirmdeletiondlg.ui SOURCES += GUI.cpp \ main.cpp \ options_imp.cpp \