aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-04-22 12:53:15 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-04-22 12:53:15 +0200
commitd6c51acd14574985c824d99a2bfb434e96787074 (patch)
tree4da2994d7a35afdbd2b075ff23fe6f0d05e7a22e /src
parentAdd boost include/link to poi-config (diff)
downloadsmolbote-d6c51acd14574985c824d99a2bfb434e96787074.tar.xz
Add tile and cascade actions to Window menu
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow/mainwindow.cpp17
-rw-r--r--src/mainwindow/mainwindow.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 23bc7da..6e4189e 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -66,7 +66,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
disconnect(navigationBarConnection);
disconnect(searchBoxConnection);
disconnect(statusBarConnection);
- windowMenu->setMenu(nullptr);
+ subWindowAction->setMenu(nullptr);
auto *w = qobject_cast<Window *>(window);
if(w == nullptr) {
@@ -76,7 +76,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
navigationToolBar->connectWebView(nullptr);
searchBox->setView(nullptr);
} else {
- windowMenu->setMenu(w->systemMenu());
+ subWindowAction->setMenu(w->systemMenu());
addressBar->connectWebView(w->currentView());
addressBarConnection = connect(w, &Window::currentViewChanged, addressBar, &AddressBar::connectWebView);
navigationToolBar->connectWebView(w->currentView());
@@ -87,11 +87,6 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
}
});
- auto *tileShortcut = new QShortcut(QKeySequence(config->value<std::string>("mainwindow.shortcuts.tileWindows").value().c_str()), this);
- connect(tileShortcut, &QShortcut::activated, this, [=]() {
- mdiArea->tileSubWindows();
- });
-
auto *searchShortcut = new QShortcut(QKeySequence(config->value<std::string>("mainwindow.shortcuts.search").value().c_str()), this);
connect(searchShortcut, &QShortcut::activated, this, [=]() {
searchBox->setVisible(!searchBox->isVisible());
@@ -108,6 +103,8 @@ MainWindow::~MainWindow()
void MainWindow::createMenuBar()
{
+ Q_CHECK_PTR(mdiArea);
+
auto *smolboteMenu = menuBar()->addMenu(qApp->applicationDisplayName());
smolboteMenu->addAction(tr("New tab group"), this, [this]() {
createSubWindow(QUrl::fromUserInput("about:blank"));
@@ -129,7 +126,11 @@ void MainWindow::createMenuBar()
smolboteMenu->addAction(tr("Quit"), qApp, &QApplication::quit,
QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.quit").value().c_str()));
- windowMenu = menuBar()->addAction(tr("Window"));
+ auto *windowMenu = menuBar()->addMenu(tr("Window"));
+ windowMenu->addAction(tr("Tile windows"), mdiArea, &QMdiArea::tileSubWindows, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.tileWindows").value().c_str()));
+ windowMenu->addAction(tr("Cascade windows"), mdiArea, &QMdiArea::cascadeSubWindows, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.cascadeWindows").value().c_str()));
+ subWindowAction = windowMenu->addAction(tr("Current window"));
+
toolsMenu = menuBar()->addMenu(tr("Tools"));
}
diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h
index 6ed9e5b..1257a56 100644
--- a/src/mainwindow/mainwindow.h
+++ b/src/mainwindow/mainwindow.h
@@ -46,7 +46,7 @@ protected:
void closeEvent(QCloseEvent *event) override;
private:
- QAction *windowMenu = nullptr;
+ QAction *subWindowAction = nullptr;
QMenu *toolsMenu = nullptr;
AddressBar *addressBar = nullptr;
SearchForm *searchBox = nullptr;