From b7ea2fb51ad47c3b1d3d2a59f3102db2232c0dba Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 11 Sep 2007 19:31:21 +0000 Subject: [PATCH] - Allow to download plugins from their url --- TODO | 3 +-- src/engineSelectDlg.cpp | 17 +++++++++++++ src/engineSelectDlg.h | 2 ++ src/pluginSource.h | 56 +++++++++++++++++++++++++++++++++++++++++ src/pluginSource.ui | 52 ++++++++++++++++++++++++++++++++++++++ src/src.pro | 4 +-- 6 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 src/pluginSource.h create mode 100644 src/pluginSource.ui diff --git a/TODO b/TODO index d3c0098de..02bf83539 100644 --- a/TODO +++ b/TODO @@ -47,13 +47,11 @@ // in v1.0.0 (partial) - WIP - Fix all (or almost all) opened bugs in bug tracker -- Improve systray tooltip (again) - Keep documention up to date - Windows port (Chris - Peerkoel) * beta 7 - update doc for plugins (and add screenies) - update doc for options - - Allow to install search plugins from an url - Review torrent content selection * check the one in ktorrent - Translations update (IN PROGRESS) @@ -100,6 +98,7 @@ beta6->beta7 changelog: - FEATURE: Display RSS article date and author if available - FEATURE: Articles in a RSS feed are now ordered by date (newer at the top) - FEATURE: Read articles in a feed are not resetted when the feed is refreshed anymore +- FEATURE: Allow to install plugins from their url - BUGFIX: In torrent content, it is now easier to filter all torrents using right click menu - BUGFIX: Updated man page / README / INSTALL - BUGFIX: Paused torrents could be displayed as connected for a sec after checking diff --git a/src/engineSelectDlg.cpp b/src/engineSelectDlg.cpp index fb0a2e35f..6ca06764b 100644 --- a/src/engineSelectDlg.cpp +++ b/src/engineSelectDlg.cpp @@ -22,6 +22,7 @@ #include "engineSelectDlg.h" #include "downloadThread.h" #include "misc.h" +#include "pluginSource.h" #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #ifdef HAVE_MAGICK #include @@ -511,6 +513,21 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) { } void engineSelectDlg::on_installButton_clicked() { + pluginSourceDlg *dlg = new pluginSourceDlg(this); + connect(dlg, SIGNAL(askForLocalFile()), this, SLOT(askForLocalPlugin())); + connect(dlg, SIGNAL(askForUrl()), this, SLOT(askForPluginUrl())); +} + +void engineSelectDlg::askForPluginUrl() { + bool ok; + QString url = QInputDialog::getText(this, tr("New search engine plugin URL"), + tr("URL:"), QLineEdit::Normal, + "http://", &ok); + if (ok && !url.isEmpty()) + downloader->downloadUrl(url); +} + +void engineSelectDlg::askForLocalPlugin() { QStringList pathsList = QFileDialog::getOpenFileNames(0, tr("Select search plugins"), QDir::homePath(), #ifdef HAVE_ZZIP diff --git a/src/engineSelectDlg.h b/src/engineSelectDlg.h index 15d0a1ad2..97f19ddf0 100644 --- a/src/engineSelectDlg.h +++ b/src/engineSelectDlg.h @@ -66,6 +66,8 @@ class engineSelectDlg : public QDialog, public Ui::engineSelect{ void dropEvent(QDropEvent *event); void dragEnterEvent(QDragEnterEvent *event); void installPlugin(QString plugin_path, QString plugin_name); + void askForLocalPlugin(); + void askForPluginUrl(); #ifdef HAVE_ZZIP void installZipPlugin(QString path); #endif diff --git a/src/pluginSource.h b/src/pluginSource.h new file mode 100644 index 000000000..ed27ae849 --- /dev/null +++ b/src/pluginSource.h @@ -0,0 +1,56 @@ +/* + * Bittorrent Client using Qt4 and libtorrent. + * Copyright (C) 2006 Christophe Dumez + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contact : chris@qbittorrent.org + */ + +#ifndef PLUGIN_SOURCE_H +#define PLUGIN_SOURCE_H + +#include +#include "ui_pluginSource.h" + +class pluginSourceDlg: public QDialog, private Ui::pluginSourceDlg { + Q_OBJECT + + signals: + void askForUrl(); + void askForLocalFile(); + + protected slots: + void on_localButton_clicked() { + emit askForLocalFile(); + close(); + } + + void on_urlButton_clicked() { + emit askForUrl(); + close(); + } + + public: + pluginSourceDlg(QWidget* parent): QDialog(parent){ + setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + show(); + } + + ~pluginSourceDlg(){} +}; + +#endif diff --git a/src/pluginSource.ui b/src/pluginSource.ui new file mode 100644 index 000000000..ecfcbc49c --- /dev/null +++ b/src/pluginSource.ui @@ -0,0 +1,52 @@ + + pluginSourceDlg + + + + 0 + 0 + 207 + 76 + + + + Plugin source + + + + + + + 75 + true + true + + + + Search plugin source: + + + + + + + + + Local file + + + + + + + Web link + + + + + + + + + + diff --git a/src/src.pro b/src/src.pro index 7dbf36320..3fb450d93 100644 --- a/src/src.pro +++ b/src/src.pro @@ -136,12 +136,12 @@ HEADERS += GUI.h misc.h options_imp.h about_imp.h \ rss.h rss_imp.h FinishedTorrents.h \ allocationDlg.h FinishedListDelegate.h \ qtorrenthandle.h downloadingTorrents.h \ - engineSelectDlg.h + engineSelectDlg.h pluginSource.h FORMS += MainWindow.ui options.ui about.ui \ properties.ui createtorrent.ui preview.ui \ login.ui downloadFromURL.ui addTorrentDialog.ui \ search.ui rss.ui seeding.ui bandwidth_limit.ui \ - download.ui engineSelect.ui + download.ui engineSelect.ui pluginSource.ui SOURCES += GUI.cpp \ main.cpp \ options_imp.cpp \