2007-08-31 16:06:31 +04:00
|
|
|
/*
|
2015-08-27 14:25:14 +03:00
|
|
|
* Bittorrent Client using Qt and libtorrent.
|
|
|
|
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
|
|
|
|
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
2007-08-31 16:06:31 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2009-04-05 21:00:55 +04:00
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
2007-08-31 16:06:31 +04:00
|
|
|
*/
|
|
|
|
|
2020-12-10 20:56:37 +03:00
|
|
|
#pragma once
|
2007-08-31 16:06:31 +04:00
|
|
|
|
2017-04-11 15:35:10 +03:00
|
|
|
#include <QDialog>
|
2020-12-09 08:48:59 +03:00
|
|
|
#include <QStringList>
|
2007-08-31 16:06:31 +04:00
|
|
|
|
2018-01-29 17:05:29 +03:00
|
|
|
#include "base/search/searchpluginmanager.h"
|
2020-12-28 06:59:36 +03:00
|
|
|
#include "base/settingvalue.h"
|
2017-05-02 15:31:34 +03:00
|
|
|
|
2007-09-02 13:01:22 +04:00
|
|
|
class QDropEvent;
|
2017-04-11 15:35:10 +03:00
|
|
|
class QTreeWidgetItem;
|
|
|
|
|
2019-03-01 10:38:16 +03:00
|
|
|
namespace Net
|
|
|
|
{
|
|
|
|
struct DownloadResult;
|
|
|
|
}
|
|
|
|
|
2017-04-11 15:35:10 +03:00
|
|
|
namespace Ui
|
|
|
|
{
|
2018-06-14 12:54:23 +03:00
|
|
|
class PluginSelectDialog;
|
2017-04-11 15:35:10 +03:00
|
|
|
}
|
|
|
|
|
2020-04-19 05:42:11 +03:00
|
|
|
class PluginSelectDialog final : public QDialog
|
2015-08-26 20:05:57 +03:00
|
|
|
{
|
2015-09-24 10:33:02 +03:00
|
|
|
Q_OBJECT
|
2021-06-29 09:45:23 +03:00
|
|
|
Q_DISABLE_COPY_MOVE(PluginSelectDialog)
|
2007-08-31 16:06:31 +04:00
|
|
|
|
2015-09-24 10:33:02 +03:00
|
|
|
public:
|
2018-06-14 12:54:23 +03:00
|
|
|
explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
|
2019-03-01 10:38:16 +03:00
|
|
|
~PluginSelectDialog() override;
|
2015-09-24 10:33:02 +03:00
|
|
|
|
2019-08-02 07:55:06 +03:00
|
|
|
QVector<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
|
2019-02-12 03:45:30 +03:00
|
|
|
QTreeWidgetItem *findItemWithID(const QString &id);
|
2007-08-31 16:06:31 +04:00
|
|
|
|
2015-09-24 10:33:02 +03:00
|
|
|
protected:
|
2018-06-14 14:46:50 +03:00
|
|
|
void dropEvent(QDropEvent *event) override;
|
|
|
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
2015-08-27 14:25:14 +03:00
|
|
|
|
2015-09-24 10:33:02 +03:00
|
|
|
private slots:
|
|
|
|
void on_actionUninstall_triggered();
|
|
|
|
void on_updateButton_clicked();
|
|
|
|
void on_installButton_clicked();
|
2007-08-31 16:06:31 +04:00
|
|
|
void on_closeButton_clicked();
|
2015-08-27 14:25:14 +03:00
|
|
|
void togglePluginState(QTreeWidgetItem*, int);
|
2019-02-12 03:45:30 +03:00
|
|
|
void setRowColor(int row, const QString &color);
|
2019-06-03 10:10:19 +03:00
|
|
|
void displayContextMenu(const QPoint &);
|
2010-12-12 22:37:59 +03:00
|
|
|
void enableSelection(bool enable);
|
2007-09-11 23:31:21 +04:00
|
|
|
void askForLocalPlugin();
|
|
|
|
void askForPluginUrl();
|
2019-03-01 10:38:16 +03:00
|
|
|
void iconDownloadFinished(const Net::DownloadResult &result);
|
2015-08-27 14:25:14 +03:00
|
|
|
|
2017-05-02 15:31:34 +03:00
|
|
|
void checkForUpdatesFinished(const QHash<QString, PluginVersion> &updateInfo);
|
2015-08-27 14:25:14 +03:00
|
|
|
void checkForUpdatesFailed(const QString &reason);
|
|
|
|
void pluginInstalled(const QString &name);
|
|
|
|
void pluginInstallationFailed(const QString &name, const QString &reason);
|
|
|
|
void pluginUpdated(const QString &name);
|
|
|
|
void pluginUpdateFailed(const QString &name, const QString &reason);
|
|
|
|
|
2015-09-24 10:33:02 +03:00
|
|
|
private:
|
2015-08-27 14:25:14 +03:00
|
|
|
void loadSupportedSearchPlugins();
|
2019-02-12 03:45:30 +03:00
|
|
|
void addNewPlugin(const QString &pluginName);
|
2015-08-27 14:25:14 +03:00
|
|
|
void startAsyncOp();
|
|
|
|
void finishAsyncOp();
|
2017-06-14 01:23:08 +03:00
|
|
|
void finishPluginUpdate();
|
2015-09-24 10:33:02 +03:00
|
|
|
|
2018-06-14 12:54:23 +03:00
|
|
|
Ui::PluginSelectDialog *m_ui;
|
2020-12-28 06:59:36 +03:00
|
|
|
SettingValue<QSize> m_storeDialogSize;
|
2018-01-29 17:05:29 +03:00
|
|
|
SearchPluginManager *m_pluginManager;
|
2017-06-14 01:23:08 +03:00
|
|
|
QStringList m_updatedPlugins;
|
2020-12-28 06:59:36 +03:00
|
|
|
int m_asyncOps = 0;
|
|
|
|
int m_pendingUpdates = 0;
|
2007-08-31 16:06:31 +04:00
|
|
|
};
|