/* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote * * SPDX-License-Identifier: GPL-3.0 */ #ifndef SMOLBOTE_BROWSER_H #define SMOLBOTE_BROWSER_H #include "session/session.h" #include #include #include #include #include #include #include class UrlFilter; class Configuration; class BookmarksWidget; class DownloadsWidget; class MainWindow; class Profile; class WebProfileManager; class Browser : public SingleApplication { Q_OBJECT public: explicit Browser(int &argc, char *argv[], bool allowSecondary = true); ~Browser() final; public slots: void about(); public: // interface [[deprecated]] WebProfileManager *getProfileManager(); [[deprecated]] const QList> profileList() const; [[deprecated]] QPair loadProfile(const QString &id, bool isOffTheRecord = true); [[deprecated]] void removeProfile(const QString &id); QPluginLoader *addPlugin(const QString &path = QString()); void setup(QVector plugins); const QVector windows() const { return qAsConst(m_windows); } BookmarksWidget *bookmarks() const { return m_bookmarks.get(); } DownloadsWidget *downloads() const { return m_downloads.get(); } public slots: void showWidget(QWidget *widget, MainWindow *where) const; MainWindow *createWindow(); private: struct PluginInfo { explicit PluginInfo(QPluginLoader *l) { this->loader = l; } ~PluginInfo() { loader->unload(); for(auto *m : menus) m->deleteLater(); }; QPluginLoader *loader; QVector menus; }; void addPluginTo(PluginInfo *info, MainWindow *window); Q_DISABLE_COPY(Browser) std::shared_ptr m_bookmarks; std::unique_ptr m_downloads; WebProfileManager *m_profileManager = nullptr; QVector m_filters; QVector m_windows; QVector m_plugins; }; #endif // SMOLBOTE_BROWSER_H