aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/configuration/configuration.cpp3
-rw-r--r--src/mainwindow/mainwindow.cpp17
-rw-r--r--src/mainwindow/mainwindow.h2
3 files changed, 12 insertions, 10 deletions
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index 01bf1c6..48f051d 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -35,6 +35,7 @@ Configuration::Configuration()
("mainwindow.shortcuts.search", po::value<std::string>()->default_value("F3"))
("mainwindow.shortcuts.tileWindows", po::value<std::string>()->default_value("F9"))
+ ("mainwindow.shortcuts.cascadeWindows", po::value<std::string>()->default_value("F10"))
// navigation
("navigation.movable", po::value<bool>()->default_value(false))
@@ -47,7 +48,7 @@ Configuration::Configuration()
// address bar
("addressbar.shortcuts.focus", po::value<std::string>()->default_value("F4"))
("addressbar.shortcuts.pageMenu", po::value<std::string>()->default_value("F2"))
- ("addressbar.shortcuts.toolsMenu", po::value<std::string>()->default_value("F10"))
+ ("addressbar.shortcuts.toolsMenu", po::value<std::string>()->default_value("F12"))
// window
("window.shortcuts.new", po::value<std::string>()->default_value("Ctrl+T"))
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;