aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-29 16:52:51 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-29 16:55:34 +0200
commit209d060b6eff7cc3f13b61758e01837087c99291 (patch)
treedd36aa62f0b8dbcd8b2b040645ea4d53fa714487 /src
parentBookmarksToolbar: add toggle shortcut (diff)
downloadsmolbote-209d060b6eff7cc3f13b61758e01837087c99291.tar.xz
MenuBar: Add Unlock toolbars toggle
Add BookmarksToolbar config toggles - bookmarks.toolbar.movable - bookmarks.toolbar.visible clang-format pass
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp8
-rw-r--r--src/mainwindow/menubar.cpp20
-rw-r--r--src/mainwindow/widgets/navigationbar.cpp2
3 files changed, 24 insertions, 6 deletions
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index b8747d8..52dcae2 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -8,6 +8,7 @@
#include "bookmarkstoolbar.h"
#include "bookmarkmodel.h"
+#include "configuration.h"
#include "mainwindow/mainwindow.h"
#include <QMenu>
@@ -15,9 +16,12 @@ BookmarksToolbar::BookmarksToolbar(const BookmarkModel *model, MainWindow *paren
: QToolBar(parent)
{
m_window = parent;
- setObjectName("bookmarkstoolbar");
+ Configuration conf;
+
+ setObjectName("bookmarks.toolbar");
setWindowTitle(tr("Bookmarks Toolbar"));
- setMovable(false);
+ setMovable(conf.value<bool>("bookmarks.toolbar.movable").value());
+ setVisible(conf.value<bool>("bookmarks.toolbar.visible").value());
setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
const auto *root = model->root();
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp
index f1b3565..b695a20 100644
--- a/src/mainwindow/menubar.cpp
+++ b/src/mainwindow/menubar.cpp
@@ -26,10 +26,10 @@
#include <QPrintDialog>
#include <QPrinter>
#include <QPrinterInfo>
+#include <QToolBar>
#include <QVBoxLayout>
#include <QWidgetAction>
#include <functional>
-#include <QToolBar>
inline void run_if(SubWindow *_subwindow, const std::function<void(SubWindow *, int)> &f)
{
@@ -170,15 +170,29 @@ MenuBar::MenuBar(MainWindow *parent)
window->addSeparator()->setText(tr("Toolbars"));
- for(auto *toolbar : parent->findChildren<QToolBar*>()) {
+ bool hasMovableToolbar = false;
+
+ for(auto *toolbar : parent->findChildren<QToolBar *>()) {
auto *action = window->addAction(toolbar->windowTitle());
action->setCheckable(true);
action->setChecked(toolbar->isVisible());
connect(toolbar, &QToolBar::visibilityChanged, action, &QAction::setChecked);
connect(action, &QAction::triggered, toolbar, &QToolBar::setVisible);
- setShortcut(action, qUtf8Printable("shortcuts."+toolbar->objectName()+".show"));
+ setShortcut(action, qUtf8Printable(toolbar->objectName() + ".show"));
+
+ if(toolbar->isMovable())
+ hasMovableToolbar = true;
}
+ auto *lockAction = window->addAction(tr("Unlock toolbars"));
+ lockAction->setCheckable(true);
+ lockAction->setChecked(hasMovableToolbar);
+ connect(lockAction, &QAction::triggered, parent, [parent](bool checked) {
+ for(auto *toolbar : parent->findChildren<QToolBar *>()) {
+ toolbar->setMovable(checked);
+ }
+ });
+
window->addSeparator()->setText(tr("Subwindows"));
}
diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp
index 75bc90c..725003d 100644
--- a/src/mainwindow/widgets/navigationbar.cpp
+++ b/src/mainwindow/widgets/navigationbar.cpp
@@ -10,6 +10,7 @@
#include "configuration.h"
#include "urllineedit.h"
#include "util.h"
+#include "webengine/webprofile.h"
#include "webengine/webview.h"
#include <QHBoxLayout>
#include <QMenu>
@@ -18,7 +19,6 @@
#include <QToolBar>
#include <QToolButton>
#include <QWebEngineHistory>
-#include "webengine/webprofile.h"
NavigationBar::NavigationBar(QWidget *parent)
: QToolBar(parent)