diff --git a/TODO b/TODO
index e730efb9e..f7a532ceb 100644
--- a/TODO
+++ b/TODO
@@ -25,7 +25,7 @@
(http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces)
- When favicon can't be downloaded, try to parse the webpage for:
- * Be carefull, the link can be relative
+ * Be careful, the link can be relative
// in v1.2.0
- Allow user to organize the downloads into categories/folders?
@@ -46,12 +46,7 @@
- Display in torrent addition dialog:
* free disk space on selected drive
* free disk space after torrent download (and/or torrent size)
-- Start minimized option in program preferences
-- In finished list, replace "Seeds/Leechs" column by "Leechers" because Seeds are always 0.
-- Use ShareMonkey Web service (http://www.sharemonkey.com/)
-- Allow to change action on double-click
- -> in download list
- -> in seeding list
+ - Use ShareMonkey Web service (http://www.sharemonkey.com/)
// in v1.0.0 - FEATURE FREEZE
- Fix all (or almost all) opened bugs in bug tracker
diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp
index 6dc947e7b..972496cd7 100644
--- a/src/FinishedTorrents.cpp
+++ b/src/FinishedTorrents.cpp
@@ -42,7 +42,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
finishedListModel->setHeaderData(F_PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed"));
- finishedListModel->setHeaderData(F_SEEDSLEECH, Qt::Horizontal, tr("Seeds/Leechs", "i.e: full/partial sources"));
+ finishedListModel->setHeaderData(F_SEEDSLEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources"));
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio"));
finishedList->setModel(finishedListModel);
// Hide ETA & hash column
@@ -81,7 +81,7 @@ FinishedTorrents::~FinishedTorrents(){
void FinishedTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row();
QString hash = getHashFromRow(row);
- emit torrentDoubleClicked(hash);
+ emit torrentDoubleClicked(hash, true);
}
void FinishedTorrents::addTorrent(QString hash){
@@ -97,7 +97,7 @@ void FinishedTorrents::addTorrent(QString hash){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name()));
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size()));
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.));
- finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant("0/0"));
+ finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant("0"));
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str())));
finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
@@ -231,7 +231,7 @@ void FinishedTorrents::updateFinishedList(){
setRowColor(row, QString::fromUtf8("orange"));
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate()));
- finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(misc::toQString(h.num_seeds(), true)+"/"+misc::toQString(h.num_peers() - h.num_seeds(), true)));
+ finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), misc::toQString(h.num_peers() - h.num_seeds(), true));
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
}
@@ -253,7 +253,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
Q_ASSERT(row != -1);
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0));
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole);
- finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(QString::fromUtf8("0/0")));
+ finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(QString::fromUtf8("0")));
setRowColor(row, QString::fromUtf8("red"));
}
@@ -291,6 +291,13 @@ void FinishedTorrents::showProperties(const QModelIndex &index){
prop->show();
}
+void FinishedTorrents::showPropertiesFromHash(QString hash){
+ QTorrentHandle h = BTSession->getTorrentHandle(hash);
+ properties *prop = new properties(this, BTSession, h);
+ connect(prop, SIGNAL(filteredFilesChanged(QString)), this, SLOT(updateFileSize(QString)));
+ prop->show();
+}
+
void FinishedTorrents::updateFileSize(QString hash){
int row = getRowFromHash(hash);
QTorrentHandle h = BTSession->getTorrentHandle(hash);
diff --git a/src/FinishedTorrents.h b/src/FinishedTorrents.h
index 35be2156c..ee4ae035e 100644
--- a/src/FinishedTorrents.h
+++ b/src/FinishedTorrents.h
@@ -70,10 +70,11 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void resumeTorrent(QString hash);
void propertiesSelection();
void deleteTorrent(QString hash);
+ void showPropertiesFromHash(QString hash);
signals:
void torrentMovedFromFinishedList(QString);
- void torrentDoubleClicked(QString hash);
+ void torrentDoubleClicked(QString hash, bool finished);
void finishedTorrentsNumberChanged(unsigned int);
};
diff --git a/src/GUI.cpp b/src/GUI.cpp
index 855fe606c..8d5106d51 100644
--- a/src/GUI.cpp
+++ b/src/GUI.cpp
@@ -120,12 +120,13 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
vboxLayout->addWidget(tabs);
connect(downloadingTorrentTab, SIGNAL(unfinishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateUnfinishedTorrentNumber(unsigned int)));
- connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString)), this, SLOT(togglePausedState(QString)));
+ connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool)));
// Finished torrents tab
finishedTorrentTab = new FinishedTorrents(this, BTSession);
tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0)"));
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
- connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString)), this, SLOT(togglePausedState(QString)));
+ connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool)));
+
connect(finishedTorrentTab, SIGNAL(finishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateFinishedTorrentNumber(unsigned int)));
// Smooth torrent switching between tabs Downloading <--> Finished
connect(downloadingTorrentTab, SIGNAL(torrentFinished(QString)), finishedTorrentTab, SLOT(addTorrent(QString)));
@@ -163,7 +164,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
connect(previewProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanTempPreviewFile(int, QProcess::ExitStatus)));
// Accept drag 'n drops
setAcceptDrops(true);
- show();
+ if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), true).toBool()) {
+ show();
+ }
createKeyboardShortcuts();
qDebug("GUI Built");
}
@@ -961,6 +964,59 @@ void GUI::updateFinishedTorrentNumber(unsigned int nb) {
tabs->setTabText(1, tr("Finished") +QString::fromUtf8(" (")+misc::toQString(nb)+QString::fromUtf8(")"));
}
+// Allow to change action on double-click
+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"), 1).toInt();
+ } else {
+ action = settings.value(QString::fromUtf8("DblClOnTorDl"), 1).toInt();
+ }
+ settings.endGroup();
+ settings.endGroup();
+
+ switch(action) {
+ case TOGGLE_PAUSE :
+ this->togglePausedState(hash);
+ break;
+ case DELETE_IT :
+ 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?"),
+ tr("&Yes"), tr("&No"),
+ QString(), 0, 1);
+ if(ret)
+ return;
+ fileName = h.name();
+ // Remove the torrent
+ BTSession->deleteTorrent(hash, true);
+ // Delete item from list
+ if(finished) {
+ finishedTorrentTab->deleteTorrent(hash);
+ } else {
+ downloadingTorrentTab->deleteTorrent(hash);
+ }
+ // Update info bar
+ downloadingTorrentTab->setInfoBar(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName));
+ break;
+ case SHOW_PROPERTIES :
+ if(finished) {
+ finishedTorrentTab->showPropertiesFromHash(hash);
+ } else {
+ downloadingTorrentTab->showPropertiesFromHash(hash);
+ }
+ break;
+ }
+}
+
// Toggle paused state of selected torrent
void GUI::togglePausedState(QString hash) {
if(tabs->currentIndex() > 1) return;
diff --git a/src/GUI.h b/src/GUI.h
index 7ab54eae1..f0fc961b3 100644
--- a/src/GUI.h
+++ b/src/GUI.h
@@ -96,6 +96,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void readParamsOnSocket();
void acceptConnection();
void togglePausedState(QString hash);
+ void torrentDoubleClicked(QString hash, bool finished);
void on_actionPreview_file_triggered();
void previewFile(QString filePath);
void cleanTempPreviewFile(int, QProcess::ExitStatus) const;
diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp
index f1a0c0f22..9d80936ab 100644
--- a/src/downloadingTorrents.cpp
+++ b/src/downloadingTorrents.cpp
@@ -110,7 +110,7 @@ DownloadingTorrents::~DownloadingTorrents() {
void DownloadingTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row();
QString hash = getHashFromRow(row);
- emit torrentDoubleClicked(hash);
+ emit torrentDoubleClicked(hash, false);
}
void DownloadingTorrents::addLogPeerBlocked(QString ip) {
@@ -162,6 +162,13 @@ void DownloadingTorrents::showProperties(const QModelIndex &index) {
prop->show();
}
+void DownloadingTorrents::showPropertiesFromHash(QString hash) {
+ QTorrentHandle h = BTSession->getTorrentHandle(hash);
+ properties *prop = new properties(this, BTSession, h);
+ connect(prop, SIGNAL(filteredFilesChanged(QString)), this, SLOT(updateFileSizeAndProgress(QString)));
+ prop->show();
+}
+
void DownloadingTorrents::resumeTorrent(QString hash){
int row = getRowFromHash(hash);
Q_ASSERT(row != -1);
diff --git a/src/downloadingTorrents.h b/src/downloadingTorrents.h
index 9db8a23b5..aaa1fe25e 100644
--- a/src/downloadingTorrents.h
+++ b/src/downloadingTorrents.h
@@ -54,7 +54,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
signals:
void unfinishedTorrentsNumberChanged(unsigned int);
- void torrentDoubleClicked(QString hash);
+ void torrentDoubleClicked(QString hash, bool finished);
void torrentFinished(QString hash);
protected slots:
@@ -91,7 +91,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void propertiesSelection();
void sortProgressColumnDelayed();
void updateFileSizeAndProgress(QString hash);
-
+ void showPropertiesFromHash(QString hash);
};
#endif
diff --git a/src/options.ui b/src/options.ui
index d45f60be8..9fd70029f 100644
--- a/src/options.ui
+++ b/src/options.ui
@@ -6,7 +6,7 @@
0
0
663
- 560
+ 586
@@ -293,6 +293,13 @@
+ -
+
+
+ Start minimized
+
+
+
-
@@ -376,6 +383,12 @@
-
+
+
+ 0
+ 0
+
+
File system
@@ -451,6 +464,12 @@
-
+
+
+ 0
+ 0
+
+
When adding a torrent
@@ -477,6 +496,12 @@
-
+
+
+ 0
+ 0
+
+
Folder watching
@@ -547,17 +572,114 @@
-
-
-
- Qt::Vertical
+
+
+
+ 0
+ 0
+
-
-
- 557
- 21
-
+
+ Action on double click in transfer lists
-
+
+
-
+
+
-
+
+
+ In download list:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 0
+
+
-
+
+ Pause/Start torrent
+
+
+ -
+
+ Delete torrent
+
+
+ -
+
+ Show torrent's properties
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+ In seeding list:
+
+
+
+ -
+
+
-
+
+ Pause/Start torrent
+
+
+ -
+
+ Delete torrent
+
+
+ -
+
+ Show torrent's properties
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
diff --git a/src/options_imp.cpp b/src/options_imp.cpp
index e42923d95..17590fbce 100644
--- a/src/options_imp.cpp
+++ b/src/options_imp.cpp
@@ -127,6 +127,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int)));
// Downloads tab
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int)));
+ connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
+ connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
// Connection tab
connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int)));
connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int)));
@@ -151,6 +153,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
+ connect(checkStartMinimized, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkSystrayBalloons, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(textMediaPlayer, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Downloads tab
@@ -261,6 +264,7 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration());
settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray());
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
+ settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled());
settings.setValue(QString::fromUtf8("MediaPlayer"), getPreviewProgram());
// End General preferences
@@ -272,6 +276,8 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog());
settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause());
settings.setValue(QString::fromUtf8("ScanDir"), getScanDir());
+ settings.setValue(QString::fromUtf8("DblClOnTorDl"), getActionOnDblClOnTorrentDl());
+ settings.setValue(QString::fromUtf8("DblClOnTorFn"), getActionOnDblClOnTorrentFn());
// End Downloads preferences
settings.endGroup();
// Connection preferences
@@ -404,6 +410,7 @@ void options_imp::loadOptions(){
enableSystrayOptions();
checkCloseToSystray->setChecked(settings.value(QString::fromUtf8("CloseToTray"), false).toBool());
checkMinimizeToSysTray->setChecked(settings.value(QString::fromUtf8("MinimizeToTray"), false).toBool());
+ checkStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
checkSystrayBalloons->setChecked(settings.value(QString::fromUtf8("NotificationBaloons"), true).toBool());
}
textMediaPlayer->setText(settings.value(QString::fromUtf8("MediaPlayer"), QString()).toString());
@@ -430,6 +437,9 @@ void options_imp::loadOptions(){
textScanDir->setText(strValue);
enableDirScan(2);
}
+ actionTorrentDlOnDblClBox->setCurrentIndex(settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt());
+ actionTorrentFnOnDblClBox->setCurrentIndex(settings.value(QString::fromUtf8("DblClOnTorFn"), 0).toInt());
+ intValue = settings.value(QString::fromUtf8("DblClOnTorFn"), 1).toInt();
// End Downloads preferences
settings.endGroup();
// Connection preferences
@@ -649,6 +659,11 @@ bool options_imp::OSDEnabled() const {
return checkSystrayBalloons->isChecked();
}
+bool options_imp::startMinimized() const {
+ if(checkStartMinimized->isChecked()) return true;
+ return checkStartMinimized->isChecked();
+}
+
bool options_imp::systrayIntegration() const{
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return (!checkNoSystray->isChecked());
@@ -980,6 +995,20 @@ QString options_imp::getScanDir() const {
}
}
+// Return action on double-click on a downloading torrent set in options
+int options_imp::getActionOnDblClOnTorrentDl() const {
+ if(actionTorrentDlOnDblClBox->currentIndex()<1)
+ return 1;
+ return actionTorrentDlOnDblClBox->currentIndex();
+}
+
+// Return action on double-click on a finished torrent set in options
+int options_imp::getActionOnDblClOnTorrentFn() const {
+ if(actionTorrentFnOnDblClBox->currentIndex()<1)
+ return 1;
+ return actionTorrentFnOnDblClBox->currentIndex();
+}
+
// Display dialog to choose scan dir
void options_imp::on_browseScanDirButton_clicked() {
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath());
diff --git a/src/options_imp.h b/src/options_imp.h
index 58946b432..6aeebd65f 100644
--- a/src/options_imp.h
+++ b/src/options_imp.h
@@ -25,16 +25,27 @@
#include "ui_options.h"
#include
+/*#include
+#include
+#include "ui_options.h"
+#include "ui_dialog.h"
+#include */
+
#define HTTP 1
#define SOCKS5 2
#define HTTP_PW 3
#define SOCKS5_PW 4
+// actions on double-click on torrents
+#define TOGGLE_PAUSE 0
+#define DELETE_IT 1
+#define SHOW_PROPERTIES 2
+
using namespace libtorrent;
class QCloseEvent;
-class options_imp : public QDialog, private Ui::Dialog{
+class options_imp : public QDialog, private Ui::Dialog {
Q_OBJECT
private:
@@ -60,6 +71,7 @@ class options_imp : public QDialog, private Ui::Dialog{
bool systrayIntegration() const;
bool minimizeToTray() const;
bool closeToTray() const;
+ bool startMinimized() const;
bool OSDEnabled() const;
QString getPreviewProgram() const;
// Downloads
@@ -69,6 +81,8 @@ class options_imp : public QDialog, private Ui::Dialog{
bool addTorrentsInPause() const;
bool isDirScanEnabled() const;
QString getScanDir() const;
+ int getActionOnDblClOnTorrentDl() const;
+ int getActionOnDblClOnTorrentFn() const;
// Connection options
std::pair getPorts() const;
bool isUPnPEnabled() const;