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. 186
      src/GUI.h
  3. 24
      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)

186
src/GUI.h

@ -59,104 +59,104 @@ 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?
// GUI related // GUI related
QTimer *guiUpdater; QTimer *guiUpdater;
QTabWidget *tabs; QTabWidget *tabs;
StatusBar *status_bar; StatusBar *status_bar;
QPointer<options_imp> options; QPointer<options_imp> options;
QPointer<QSystemTrayIcon> systrayIcon; QPointer<QSystemTrayIcon> systrayIcon;
QPointer<QTimer> systrayCreator; QPointer<QTimer> systrayCreator;
QMenu *myTrayIconMenu; QMenu *myTrayIconMenu;
TransferListWidget *transferList; TransferListWidget *transferList;
TransferListFiltersWidget *transferListFilters; TransferListFiltersWidget *transferListFilters;
PropertiesWidget *properties; PropertiesWidget *properties;
bool displaySpeedInTitle; bool displaySpeedInTitle;
bool force_exit; bool force_exit;
// Keyboard shortcuts // Keyboard shortcuts
QShortcut *switchSearchShortcut; QShortcut *switchSearchShortcut;
QShortcut *switchSearchShortcut2; QShortcut *switchSearchShortcut2;
QShortcut *switchTransferShortcut; QShortcut *switchTransferShortcut;
QShortcut *switchRSSShortcut; QShortcut *switchRSSShortcut;
// Widgets // Widgets
QAction *prioSeparator; QAction *prioSeparator;
QAction *prioSeparator2; QAction *prioSeparator2;
QSplitter *hSplitter; QSplitter *hSplitter;
QSplitter *vSplitter; QSplitter *vSplitter;
// Search // Search
SearchEngine *searchEngine; SearchEngine *searchEngine;
// RSS // RSS
QPointer<RSSImp> rssWidget; QPointer<RSSImp> rssWidget;
// 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);
void toggleVisibility(QSystemTrayIcon::ActivationReason e); void toggleVisibility(QSystemTrayIcon::ActivationReason e);
void on_actionAbout_triggered(); void on_actionAbout_triggered();
void on_actionCreate_torrent_triggered(); void on_actionCreate_torrent_triggered();
void on_actionWebsite_triggered() const; void on_actionWebsite_triggered() const;
void on_actionBugReport_triggered() const; void on_actionBugReport_triggered() const;
void on_actionShow_console_triggered(); void on_actionShow_console_triggered();
void readParamsOnSocket(); void readParamsOnSocket();
void acceptConnection(); void acceptConnection();
void balloonClicked(); void balloonClicked();
void writeSettings(); void writeSettings();
void readSettings(); void readSettings();
void on_actionExit_triggered(); void on_actionExit_triggered();
void createTrayIcon(); void createTrayIcon();
void fullDiskError(QTorrentHandle& h, QString msg) const; void fullDiskError(QTorrentHandle& h, QString msg) const;
void handleDownloadFromUrlFailure(QString, QString) const; void handleDownloadFromUrlFailure(QString, QString) const;
void createSystrayDelayed(); void createSystrayDelayed();
void tab_changed(int); void tab_changed(int);
// Keyboard shortcuts // Keyboard shortcuts
void createKeyboardShortcuts(); void createKeyboardShortcuts();
void displayTransferTab() const; void displayTransferTab() const;
void displaySearchTab() const; void displaySearchTab() const;
void displayRSSTab() const; void displayRSSTab() const;
// Torrent actions // Torrent actions
void on_actionSet_global_upload_limit_triggered(); void on_actionSet_global_upload_limit_triggered();
void on_actionSet_global_download_limit_triggered(); void on_actionSet_global_download_limit_triggered();
void on_actionDocumentation_triggered() const; void on_actionDocumentation_triggered() const;
void on_actionOpen_triggered(); void on_actionOpen_triggered();
void updateGUI(); void updateGUI();
void loadPreferences(bool configure_session=true); void loadPreferences(bool configure_session=true);
void processParams(const QStringList& params); void processParams(const QStringList& params);
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(); void optionsSaved();
void optionsSaved(); // HTTP slots
// HTTP slots 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();
// Methods // Methods
int getCurrentTabIndex() const; int getCurrentTabIndex() const;
QPoint screenCenter() const; QPoint screenCenter() const;
}; };
#endif #endif

24
src/searchengine.cpp

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

Loading…
Cancel
Save