From aa8198eec380659fd3538e058b50c24b0f88743c Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 1 Jul 2018 18:13:01 +0200 Subject: Code cleanup Clean up MainWindow Configuration is now a std::unique_ptr Connect downloads and request interceptor to all profiles --- src/mainwindow/subwindow.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/mainwindow/subwindow.cpp') diff --git a/src/mainwindow/subwindow.cpp b/src/mainwindow/subwindow.cpp index 5a1eeda..342fce8 100644 --- a/src/mainwindow/subwindow.cpp +++ b/src/mainwindow/subwindow.cpp @@ -20,8 +20,9 @@ #include #include #include "profilemanager.h" +#include -SubWindow::SubWindow(const QHash &config, QWidget *parent, Qt::WindowFlags flags) +SubWindow::SubWindow(const std::unique_ptr &config, QWidget *parent, Qt::WindowFlags flags) : QMdiSubWindow(parent, flags) , tabWidget(new TabWidget(this)) { @@ -62,7 +63,7 @@ SubWindow::SubWindow(const QHash &config, QWidget *parent, Qt: auto *newTab_button = new QToolButton(this); newTab_button->setIcon(style()->standardIcon(QStyle::SP_FileIcon)); newTab_button->setToolTip(tr("Add tab")); - newTab_button->setShortcut(QKeySequence(config.value("window.shortcuts.new"))); + newTab_button->setShortcut(QKeySequence(config->value("window.shortcuts.new").value())); connect(newTab_button, &QToolButton::clicked, this, [=]() { auto index = addTab(WebProfile::defaultProfile()->newtab()); tabWidget->setCurrentIndex(index); @@ -70,17 +71,17 @@ SubWindow::SubWindow(const QHash &config, QWidget *parent, Qt: tabWidget->setCornerWidget(newTab_button, Qt::TopRightCorner); // general actions - auto *closeTab_shortcut = new QShortcut(QKeySequence(config.value("window.shortcuts.close")), this); + auto *closeTab_shortcut = new QShortcut(QKeySequence(config->value("window.shortcuts.close").value()), this); connect(closeTab_shortcut, &QShortcut::activated, this, [=]() { tabWidget->deleteTab(tabWidget->currentIndex()); }); - auto *leftTab_shortcut = new QShortcut(QKeySequence(config.value("window.shortcuts.left")), this); + auto *leftTab_shortcut = new QShortcut(QKeySequence(config->value("window.shortcuts.left").value()), this); connect(leftTab_shortcut, &QShortcut::activated, this, [=]() { tabWidget->setCurrentIndex(qMax(0, tabWidget->currentIndex() - 1)); }); - auto *rightTab_shortcut = new QShortcut(QKeySequence(config.value("window.shortcuts.right")), this); + auto *rightTab_shortcut = new QShortcut(QKeySequence(config->value("window.shortcuts.right").value()), this); connect(rightTab_shortcut, &QShortcut::activated, this, [=]() { tabWidget->setCurrentIndex(qMin(tabWidget->currentIndex() + 1, tabWidget->count() - 1)); }); -- cgit v1.2.1