/* * 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.hpp" #include "webengine/webprofilemanager.h" #include #include #include #include #include #include #include class Configuration; class BookmarksWidget; class DownloadsWidget; class MainWindow; class Browser final : public SingleApplication { Q_OBJECT public: explicit Browser(int &argc, char *argv[], bool allowSecondary = true); ~Browser() final; void loadPlugins( const QStringList &paths, const std::function &callback = [](const auto) {}); void setup(); 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 about(); void aboutPlugins(); void showWidget(QWidget *widget, MainWindow *where) const; void open(const QVector &data, bool merge = true); private: struct PluginInfo { explicit PluginInfo(QPluginLoader *l) { this->loader = l; } ~PluginInfo() { loader->unload(); for(auto *m : qAsConst(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; std::unique_ptr> m_profileManager{ nullptr }; QVector m_windows; QVector m_plugins; }; #endif // SMOLBOTE_BROWSER_H