diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-05 10:55:56 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-05 14:59:10 +0200 |
commit | 7918bce1422fb217b59131111c6fb1ccdf52ddc4 (patch) | |
tree | 369fce128f1b021c0c88455039c0011a2014b9d7 /src/session | |
parent | Disable plugins as broken (diff) | |
download | smolbote-7918bce1422fb217b59131111c6fb1ccdf52ddc4.tar.xz |
Code cleanup
- Replace Browser::getProfileManager with WebProfileManager::instance
- Make WebProfileManager::profileMenu a free function
- Replace Browser::loadProfile with Browser::loadProfiles
Diffstat (limited to 'src/session')
-rw-r--r-- | src/session/savesessiondialog.cpp | 6 | ||||
-rw-r--r-- | src/session/session.cpp | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/session/savesessiondialog.cpp b/src/session/savesessiondialog.cpp index ffc53f7..507cddb 100644 --- a/src/session/savesessiondialog.cpp +++ b/src/session/savesessiondialog.cpp @@ -9,9 +9,9 @@ #include "savesessiondialog.h" #include "browser.h" #include "mainwindow/mainwindow.h" -#include "webengine/webprofilemanager.h" #include "subwindow/subwindow.h" #include "ui_savesessiondialog.h" +#include "webengine/webprofilemanager.h" #include "webengine/webview.h" #include <QFileDialog> #include <QPointer> @@ -36,7 +36,7 @@ SaveSessionDialog::SaveSessionDialog(QWidget *parent) for(const SubWindow *subwindow : window->subWindows()) { auto *subwindowItem = new QTreeWidgetItem(windowItem); subwindowItem->setText(0, tr("Subwindow")); - subwindowItem->setText(1, browser->getProfileManager()->id(subwindow->profile())); + subwindowItem->setText(1, WebProfileManager::instance()->id(subwindow->profile())); ui->treeWidget->expandItem(subwindowItem); @@ -44,7 +44,7 @@ SaveSessionDialog::SaveSessionDialog(QWidget *parent) auto *tabItem = new QTreeWidgetItem(subwindowItem); auto *view = subwindow->view(i); tabItem->setText(0, view->title()); - tabItem->setText(1, browser->getProfileManager()->id(view->profile())); + tabItem->setText(1, WebProfileManager::instance()->id(view->profile())); } } } diff --git a/src/session/session.cpp b/src/session/session.cpp index 9e6fa7d..c97c22b 100644 --- a/src/session/session.cpp +++ b/src/session/session.cpp @@ -9,15 +9,15 @@ #include "session.h" #include "../webengine/webview.h" #include "browser.h" +#include "configuration.h" #include "mainwindow/mainwindow.h" -#include "webengine/webprofilemanager.h" #include "subwindow/subwindow.h" +#include "webengine/webprofilemanager.h" #include "webengine/webview.h" #include <QJsonArray> #include <QJsonObject> #include <QWebEngineHistory> #include <memory> -#include "configuration.h" QJsonObject Session::fromCommandLine(const QString &profile, const QStringList &urls) { @@ -78,7 +78,7 @@ QJsonObject Session::_window(const MainWindow *window) QJsonObject Session::_subwindow(const SubWindow *subwindow) { - auto *profileManager = dynamic_cast<Browser *>(qApp)->getProfileManager(); + const auto *profileManager = WebProfileManager::instance(); Q_CHECK_PTR(profileManager); QJsonObject subwindowData; @@ -98,7 +98,7 @@ QJsonObject Session::_subwindow(const SubWindow *subwindow) QJsonObject Session::view(const WebView *view) { - auto *profileManager = dynamic_cast<Browser *>(qApp)->getProfileManager(); + const auto *profileManager = WebProfileManager::instance(); Q_CHECK_PTR(profileManager); QByteArray historyData; @@ -116,7 +116,7 @@ QJsonObject Session::view(const WebView *view) void Session::restoreView(WebView *view, const QJsonObject &data) { - auto *profileManager = dynamic_cast<Browser *>(qApp)->getProfileManager(); + const auto *profileManager = WebProfileManager::instance(); Q_CHECK_PTR(profileManager); auto *profile = profileManager->profile(data["profile"].toString()); @@ -138,7 +138,7 @@ void Session::restoreSession(const QJsonObject &sessionData) { auto *browser = dynamic_cast<Browser *>(qApp); Q_CHECK_PTR(browser); - auto *profileManager = browser->getProfileManager(); + const auto *profileManager = WebProfileManager::instance(); Q_CHECK_PTR(profileManager); for(const auto subwindowData : sessionData["subwindows"].toArray()) { |