2012-07-11 18:30:00 +02:00
|
|
|
/* ============================================================
|
|
|
|
* GreaseMonkey plugin for QupZilla
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
|
2012-07-11 18:30:00 +02: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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#ifndef GM_MANAGER_H
|
|
|
|
#define GM_MANAGER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QStringList>
|
2012-12-20 14:45:35 +01:00
|
|
|
#include <QPointer>
|
2013-06-02 19:09:41 +02:00
|
|
|
#include <QHash>
|
2012-07-11 18:30:00 +02:00
|
|
|
|
|
|
|
class QUrl;
|
|
|
|
class QNetworkRequest;
|
|
|
|
|
2013-06-02 19:09:41 +02:00
|
|
|
class QupZilla;
|
2012-07-11 18:30:00 +02:00
|
|
|
class GM_Script;
|
2013-04-02 11:21:12 +02:00
|
|
|
class GM_JSObject;
|
2012-09-11 11:31:28 +02:00
|
|
|
class GM_Settings;
|
2013-06-02 19:09:41 +02:00
|
|
|
class GM_Icon;
|
2012-07-11 18:30:00 +02:00
|
|
|
|
|
|
|
class GM_Manager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit GM_Manager(const QString &sPath, QObject* parent = 0);
|
|
|
|
|
|
|
|
void showSettings(QWidget* parent);
|
|
|
|
void downloadScript(const QNetworkRequest &request);
|
|
|
|
|
|
|
|
QString settinsPath() const;
|
|
|
|
QString scriptsDirectory() const;
|
|
|
|
QString requireScripts(const QStringList &urlList) const;
|
|
|
|
|
2012-09-11 11:31:28 +02:00
|
|
|
void unloadPlugin();
|
2012-07-11 18:30:00 +02:00
|
|
|
|
|
|
|
QList<GM_Script*> allScripts() const;
|
|
|
|
bool containsScript(const QString &fullName) const;
|
|
|
|
|
|
|
|
void enableScript(GM_Script* script);
|
|
|
|
void disableScript(GM_Script* script);
|
|
|
|
|
|
|
|
bool addScript(GM_Script* script);
|
2013-01-30 14:12:09 +01:00
|
|
|
bool removeScript(GM_Script* script, bool removeFile = true);
|
2012-07-11 18:30:00 +02:00
|
|
|
|
|
|
|
void showNotification(const QString &message, const QString &title = QString());
|
|
|
|
|
|
|
|
static bool canRunOnScheme(const QString &scheme);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void scriptsChanged();
|
|
|
|
|
|
|
|
public slots:
|
2013-06-02 19:09:41 +02:00
|
|
|
void mainWindowCreated(QupZilla* window);
|
|
|
|
void mainWindowDeleted(QupZilla* window);
|
|
|
|
|
2012-07-11 18:30:00 +02:00
|
|
|
void pageLoadStart();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void load();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_settingsPath;
|
|
|
|
QString m_bootstrap;
|
2012-12-20 14:45:35 +01:00
|
|
|
QPointer<GM_Settings> m_settings;
|
2012-07-11 18:30:00 +02:00
|
|
|
|
|
|
|
QStringList m_disabledScripts;
|
2013-04-02 11:21:12 +02:00
|
|
|
GM_JSObject* m_jsObject;
|
2012-07-11 18:30:00 +02:00
|
|
|
QList<GM_Script*> m_endScripts;
|
|
|
|
QList<GM_Script*> m_startScripts;
|
2013-06-02 19:09:41 +02:00
|
|
|
|
|
|
|
QHash<QupZilla*, GM_Icon*> m_windows;
|
2012-07-11 18:30:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GM_MANAGER_H
|