From b2950afd5ca9cd18a76c52775c1f35cb857f5ef4 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 7 Dec 2007 22:33:19 +0000 Subject: [PATCH] - FEATURE: Allow to buy downloads using ShareMonkey --- Changelog | 1 + src/FinishedTorrents.cpp | 3 +++ src/GUI.cpp | 20 ++++++++++++++++++++ src/GUI.h | 1 + src/download.ui | 5 +++++ src/downloadingTorrents.cpp | 3 +++ src/seeding.ui | 5 +++++ 7 files changed, 38 insertions(+) diff --git a/Changelog b/Changelog index df390fe82..46b33c189 100644 --- a/Changelog +++ b/Changelog @@ -4,6 +4,7 @@ - FEATURE: Allow to define double-click actions in torrents lists - FEATURE: Allow to open torrent destination folder - FEATURE: Real progress bar in torrent properties that displays downloaded pieces + - FEATURE: Allow to buy downloads using ShareMonkey - BUGFIX: Do not display seeds number in seeding list (always 0) - COSMETIC: Do not display progress bar in seeding list (always 100%) diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index 40001836b..518d4c8b0 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -73,6 +73,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_triggered())); connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); + connect(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); @@ -379,6 +380,8 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ myFinishedListMenu.addSeparator(); myFinishedListMenu.addAction(actionOpen_destination_folder); myFinishedListMenu.addAction(actionTorrent_Properties); + myFinishedListMenu.addSeparator(); + myFinishedListMenu.addAction(actionBuy_it); // Call menu // XXX: why mapToGlobal() is not enough? diff --git a/src/GUI.cpp b/src/GUI.cpp index 16d0c0a32..2f954fb5c 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -411,6 +411,26 @@ void GUI::openDestinationFolder() const { } } +void GUI::goBuyPage() const { + QStringList hashes; + switch(tabs->currentIndex()){ + case 0: + hashes = downloadingTorrentTab->getSelectedTorrents(true); + break; + case 1: + hashes = finishedTorrentTab->getSelectedTorrents(true); + break; + default: + return; + } + QString hash; + QStringList pathsList; + foreach(hash, hashes) { + QTorrentHandle h = BTSession->getTorrentHandle(hash); + QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+hash+"&fileName="+h.name()); + } +} + // Necessary if we want to close the window // in one time if "close to systray" is enabled void GUI::on_actionExit_triggered() { diff --git a/src/GUI.h b/src/GUI.h index 4bff4216d..50dbfe7dd 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -147,6 +147,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void trackerAuthenticationRequired(QTorrentHandle& h); void setTabText(int index, QString text) const; void openDestinationFolder() const; + void goBuyPage() const; protected: void closeEvent(QCloseEvent *); diff --git a/src/download.ui b/src/download.ui index 07d2c57b0..6bc0a2d55 100644 --- a/src/download.ui +++ b/src/download.ui @@ -428,6 +428,11 @@ ETA + + + Buy it + + diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index cd7f13ac1..c9ff8fcfb 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -98,6 +98,7 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); + connect(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); @@ -298,6 +299,8 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { myDLLlistMenu.addSeparator(); myDLLlistMenu.addAction(actionOpen_destination_folder); myDLLlistMenu.addAction(actionTorrent_Properties); + myDLLlistMenu.addSeparator(); + myDLLlistMenu.addAction(actionBuy_it); // Call menu // XXX: why mapToGlobal() is not enough? myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,60)); diff --git a/src/seeding.ui b/src/seeding.ui index 193bbcf04..2e4d77843 100644 --- a/src/seeding.ui +++ b/src/seeding.ui @@ -126,6 +126,11 @@ Ratio + + + Buy it + +