#include "browser.h" #include "mainwindow.h" #include "settings.h" #include Browser::Browser(QString configPath, QObject *parent) : QObject(parent) { if(configPath.isEmpty()) { // set default config path Settings::setFilepath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini"); } else { // set custom config path Settings::setFilepath(configPath); } // TODO Restore previous session QtWebEngine::initialize(); } Browser::~Browser() { // TODO Save session // cleanup qDeleteAll(m_windows); m_windows.clear(); } void Browser::addWindow(MainWindow *window) { if(m_windows.contains(window)) { return; } m_windows.append(window); connect(window, &QObject::destroyed, [this, window]() { this->removeWindow(window); }); window->show(); } void Browser::removeWindow(MainWindow *window) { m_windows.removeOne(window); }