diff options
Diffstat (limited to 'src/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 7fb7d9e..fa8b23a 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -9,7 +9,7 @@ #include "mainwindow.h" #include "addressbar.h" #include "browser.h" -#include "config.h" +#include "conf.hpp" #include "configuration.h" #include "menubar.h" #include "webprofilemanager.h" @@ -39,14 +39,11 @@ #include <KWindowEffects> #endif -MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *parent) +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) - , configuration(config.get()) , mdiArea(new QMdiArea(this)) { - Q_ASSERT(config); - - m_menuBar = new MenuBar(config.get(), this); + m_menuBar = new MenuBar(this); this->setMenuBar(m_menuBar); #ifdef CONFIG_PLASMA_BLUR @@ -54,10 +51,12 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa KWindowEffects::enableBlurBehind(this->winId(), true); #endif + Configuration config; + // create UI - setWindowTitle(config->value<QString>("mainwindow.title").value()); - resize(config->value<int>("mainwindow.width").value(), config->value<int>("mainwindow.height").value()); - if(config->value<bool>("mainwindow.maximized").value()) { + setWindowTitle(config.value<QString>("mainwindow.title").value()); + resize(config.value<int>("mainwindow.width").value(), config.value<int>("mainwindow.height").value()); + if(config.value<bool>("mainwindow.maximized").value_or(false)) { setWindowState(Qt::WindowMaximized); } show(); @@ -66,7 +65,7 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa { QAction *subwindowMenuAction = new QAction(this); QMainWindow::addAction(subwindowMenuAction); - config->setShortcut(subwindowMenuAction, "subwindow.shortcuts.menu"); + setShortcut(subwindowMenuAction, "shortcuts.subwindow.menu"); connect(subwindowMenuAction, &QAction::triggered, this, [this]() { QMdiSubWindow *window = mdiArea->currentSubWindow(); if(window != nullptr) { @@ -78,12 +77,12 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa }); } - navigationToolBar = new NavigationBar(config.get(), this); - navigationToolBar->setMovable(config->value<bool>("navigation.movable").value()); + navigationToolBar = new NavigationBar(this); + navigationToolBar->setMovable(config.value<bool>("navigation.movable").value_or(false)); addToolBar(Qt::TopToolBarArea, navigationToolBar); navigationToolBar->connectWebView(nullptr); - addressBar = new AddressBar(config->section("addressbar"), this); + addressBar = new AddressBar(this); navigationToolBar->addWidget(addressBar); mdiArea->setBackground(Qt::NoBrush); @@ -134,7 +133,7 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa // search box auto *searchAction = new QAction(this); - config->setShortcut(searchAction, "mainwindow.shortcuts.search"); + setShortcut(searchAction, "shortcuts.window.search"); connect(searchAction, &QAction::triggered, this, [=]() { /* QTBUG-18665 * When focusing out of the search box and hiding it, the first @@ -224,7 +223,7 @@ SubWindow *MainWindow::createSubWindow(WebProfile *profile, bool openProfileNewt shouldMaximize = currentWindow->isMaximized(); } - auto *w = new SubWindow(configuration, this); + auto *w = new SubWindow(this); m_menuBar->insertSubWindow(w); w->setProfile(profile); |