From 4401b60d51ff4d2e355e1d396ff9d5024bb5ef3b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 8 Nov 2007 18:31:41 +0000 Subject: [PATCH] - cleaned up arnaud's code for double-click action --- src/GUI.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index d638e3d50..e93bba9c0 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -969,25 +969,19 @@ void GUI::torrentDoubleClicked(QString hash, bool finished) { int action; QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QTorrentHandle h = BTSession->getTorrentHandle(hash); - QString fileName; - int ret; - settings.beginGroup("Preferences"); - settings.beginGroup("Downloads"); if(finished) { - action = settings.value(QString::fromUtf8("DblClOnTorFN"), 0).toInt(); + action = settings.value(QString::fromUtf8("Preferences/Downloads/DblClOnTorFN"), 0).toInt(); } else { - action = settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt(); + action = settings.value(QString::fromUtf8("Preferences/Downloads/DblClOnTorDl"), 0).toInt(); } - settings.endGroup(); - settings.endGroup(); switch(action) { - case TOGGLE_PAUSE : + case TOGGLE_PAUSE: this->togglePausedState(hash); break; - case DELETE_IT : - ret = QMessageBox::question( + case DELETE_IT: { + int ret = QMessageBox::question( this, tr("Are you sure? -- qBittorrent"), tr("Are you sure you want to delete the selected item(s) from download list and from hard drive?"), @@ -995,7 +989,7 @@ void GUI::torrentDoubleClicked(QString hash, bool finished) { QString(), 0, 1); if(ret) return; - fileName = h.name(); + QString fileName = h.name(); // Remove the torrent BTSession->deleteTorrent(hash, true); // Delete item from list @@ -1006,7 +1000,8 @@ void GUI::torrentDoubleClicked(QString hash, bool finished) { } // Update info bar downloadingTorrentTab->setInfoBar(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName)); - break; + break; + } case SHOW_PROPERTIES : if(finished) { finishedTorrentTab->showPropertiesFromHash(hash);