Browse Source

- 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.

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
88c56d8250
  1. 1
      Changelog
  2. 12
      src/GUI.h
  3. 6
      src/searchengine.cpp

1
Changelog

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

12
src/GUI.h

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

6
src/searchengine.cpp

@ -301,6 +301,11 @@ void SearchEngine::saveResultsColumnsWidth() {
} }
void SearchEngine::downloadTorrent(QString engine_url, QString torrent_url) { 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); QProcess *downloadProcess = new QProcess(this);
connect(downloadProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(downloadFinished(int,QProcess::ExitStatus))); connect(downloadProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(downloadFinished(int,QProcess::ExitStatus)));
downloaders << downloadProcess; downloaders << downloadProcess;
@ -310,6 +315,7 @@ void SearchEngine::downloadTorrent(QString engine_url, QString torrent_url) {
params << torrent_url; params << torrent_url;
// Launch search // Launch search
downloadProcess->start("python", params, QIODevice::ReadOnly); downloadProcess->start("python", params, QIODevice::ReadOnly);
}
} }
void SearchEngine::searchStarted(){ void SearchEngine::searchStarted(){

Loading…
Cancel
Save