- Added support for magnet links in search engine. Most search Web sites provides magnet links now and in the futures, they may provide only the magnet links.

This commit is contained in:
Christophe Dumez 2010-01-05 22:31:06 +00:00
parent fca24a8f84
commit 88c56d8250
3 changed files with 109 additions and 102 deletions

View file

@ -12,6 +12,7 @@
- FEATURE: Torrents can be renamed in transfer list
- FEATURE: Display torrent addition dialog for magnet links too
- FEATURE: Files contained in a torrent are opened on double click (files panel)
- FEATURE: Added support for magnet links in search engine
- BUGFIX: Use XDG folders (.cache, .local) instead of .qbittorrent
- COSMETIC: Use checkboxes to filter torrent content instead of comboboxes
- COSMETIC: Use alternating row colors in transfer list (set in program preferences)

View file

@ -59,7 +59,7 @@ class StatusBar;
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
private:
private:
// Bittorrent
Bittorrent *BTSession;
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
@ -93,7 +93,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
// Misc
QLocalServer *localServer;
protected slots:
protected slots:
// GUI related slots
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
@ -130,7 +130,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void addTorrent(QString path);
void addUnauthenticatedTracker(QPair<QTorrentHandle,QString> tracker);
void processDownloadedFiles(QString path, QString url);
void downloadFromURLList(const QStringList& urls);
void finishedTorrent(QTorrentHandle& h) const;
// Options slots
void on_actionOptions_triggered();
@ -139,18 +138,19 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionDownload_from_URL_triggered();
public slots:
public slots:
void trackerAuthenticationRequired(QTorrentHandle& h);
void setTabText(int index, QString text) const;
void showNotificationBaloon(QString title, QString msg) const;
void downloadFromURLList(const QStringList& urls);
protected:
protected:
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
bool event(QEvent * event);
void displayRSSTab(bool enable);
public:
public:
// Construct / Destruct
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
~GUI();

View file

@ -301,6 +301,11 @@ void SearchEngine::saveResultsColumnsWidth() {
}
void SearchEngine::downloadTorrent(QString engine_url, QString torrent_url) {
if(torrent_url.startsWith("magnet:")) {
QStringList urls;
urls << torrent_url;
parent->downloadFromURLList(urls);
} else {
QProcess *downloadProcess = new QProcess(this);
connect(downloadProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(downloadFinished(int,QProcess::ExitStatus)));
downloaders << downloadProcess;
@ -310,6 +315,7 @@ void SearchEngine::downloadTorrent(QString engine_url, QString torrent_url) {
params << torrent_url;
// Launch search
downloadProcess->start("python", params, QIODevice::ReadOnly);
}
}
void SearchEngine::searchStarted(){