/* ============================================================ * The rekonq project * ============================================================ * SPDX-License-Identifier: GPL-2.0-or-later * Copyright (C) 2012-2013 by Andrea Diamantini * SPDX-License-Identifier: GPL-3.0-only * Copyright (C) 2022 aqua * ============================================================ * Description: Application Main Class * ============================================================ */ #pragma once #include "rekonq.hpp" #include #include #include #include // Forward Declarations class RekonqView; class RekonqWindow; class PluginLoader; class RekonqSettings; typedef QList> RekonqPluginList; typedef QList> RekonqWindowList; typedef QList> RekonqViewList; // --------------------------------------------------------------------------------------------------------------- /** * Rekonq Application class */ class Application : public SingleApplication { Q_OBJECT public: Application(int &argc, char *argv[]); ~Application() override; REKONQ_TEST_VIRTUAL bool registerPlugin(const QString &path) REKONQ_TEST_PURE; [[nodiscard]] auto pluginList() const { return m_plugins; }; // int newInstance(); static Application *instance() { return (qobject_cast(QCoreApplication::instance())); } [[nodiscard]] auto *settings() const { return m_settings; } // RekonqWindow *rekonqWindow(const QString &activityID = QString()); [[nodiscard]] auto windowList() const { return m_windows; } [[nodiscard]] auto viewList() const { return m_views; } /** * @returns the list of windows associated with activity whose id is @param activityID * @param activityID the ID of the activity (if empty, it is interpreted as the current activity) * @note If activities are disabled, returns the function returns the list of all tabs. */ // RekonqWindowList tabsForActivity(const QString &activityID = QString()); /** * @returns the true if there are windows associated with activity whose id is @param activityID * @param activityID the ID of the activity (if empty, it is interpreted as the current activity) * @note If activities are disabled, returns true if there are any tabs. */ // bool haveWindowsForActivity(const QString &activityID = QString()); // WebAppList webAppList(); // void bookmarksToolbarToggled(bool); public slots: /** * Parse the command line in @param message and carry out the required actions * @param instanceId if the current instance, check QCoreApplication::arguments instead of @param message * @param message the command line */ void parseCommandLine(quint32 instanceId, const QByteArray &message); /** * Save application's configuration * * @see ReKonfig::self()->writeConfig(); */ // void saveConfiguration() const; /** * @short load url * * @param url The url to load * @param type the type where loading the url. @see Rekonq::OpenType */ // void loadUrl(const KUrl& url, const Rekonq::OpenType& type = Rekonq::CurrentTab); // RekonqWindow *newWindow(bool withTab = true, bool PrivateBrowsingMode = false); // RekonqWindow *newWindow(WebPage *pg); REKONQ_TEST_VIRTUAL RekonqWindow *newWindow() REKONQ_TEST_PURE; REKONQ_TEST_VIRTUAL RekonqView *newView(const QUrl &url = QUrl(), RekonqWindow *window = nullptr) REKONQ_TEST_PURE; // void createWebAppShortcut(const QString & urlString = QString(), const QString & titleString = QString()); protected: // This is used to track which window was activated most recently // bool eventFilter(QObject *watched, QEvent *event); signals: void toggleBookmarksToolbar(bool); private: // void setWindowInfo(RekonqWindow *); private slots: // void updateConfiguration(); // clear private data // void clearPrivateData(); // void queryQuit(); // void newPrivateBrowsingWindow(); // void pageCreated(WebPage *); private: RekonqSettings *m_settings; RekonqPluginList m_plugins; RekonqWindowList m_windows; RekonqViewList m_views; };