diff options
-rw-r--r-- | lib/configuration/configuration.cpp | 14 | ||||
-rw-r--r-- | plugins/ProfileEditor/ProfileEditor.json | 2 | ||||
-rw-r--r-- | src/subwindow/subwindow.cpp | 23 |
3 files changed, 27 insertions, 12 deletions
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp index c83e743..4447202 100644 --- a/lib/configuration/configuration.cpp +++ b/lib/configuration/configuration.cpp @@ -87,12 +87,14 @@ Configuration::Configuration(QObject *parent) ("addressbar.shortcuts.focus", po::value<std::string>()->default_value("F4")) ("addressbar.shortcuts.menu", po::value<std::string>()->default_value("F2")) - // window - ("window.shortcuts.new", po::value<std::string>()->default_value("Ctrl+T")) - ("window.shortcuts.close", po::value<std::string>()->default_value("Ctrl+X")) - ("window.shortcuts.left", po::value<std::string>()->default_value("Ctrl+O")) - ("window.shortcuts.right", po::value<std::string>()->default_value("Ctrl+P")) - ("window.shortcuts.fullscreen", po::value<std::string>()->default_value("F11")) + // subwindow + ("subwindow.shortcuts.new", po::value<std::string>()->default_value("Ctrl+T")) + ("subwindow.shortcuts.close", po::value<std::string>()->default_value("Ctrl+X")) + ("subwindow.shortcuts.left", po::value<std::string>()->default_value("Ctrl+O")) + ("subwindow.shortcuts.moveLeft", po::value<std::string>()->default_value("Ctrl+Shift+O")) + ("subwindow.shortcuts.right", po::value<std::string>()->default_value("Ctrl+P")) + ("subwindow.shortcuts.moveRight", po::value<std::string>()->default_value("Ctrl+Shift+P")) + ("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value("F11")) // Filter settings ("filter.path", po::value<std::string>()->default_value(filter_path)) diff --git a/plugins/ProfileEditor/ProfileEditor.json b/plugins/ProfileEditor/ProfileEditor.json index 504eea4..8381e9a 100644 --- a/plugins/ProfileEditor/ProfileEditor.json +++ b/plugins/ProfileEditor/ProfileEditor.json @@ -1,5 +1,5 @@ { "name": "Profile Editor", "author": "Aqua-sama", - "shortcut": "Ctrl+Shift+P" + "shortcut": "Ctrl+Shift+E" } diff --git a/src/subwindow/subwindow.cpp b/src/subwindow/subwindow.cpp index 580bf68..56bf821 100644 --- a/src/subwindow/subwindow.cpp +++ b/src/subwindow/subwindow.cpp @@ -21,6 +21,7 @@ #include <webprofile.h> #include "profilemanager.h" #include <configuration.h> +#include <QTabBar> SubWindow::SubWindow(const std::unique_ptr<Configuration> &config, QWidget *parent, Qt::WindowFlags flags) : QMdiSubWindow(parent, flags) @@ -68,7 +69,7 @@ SubWindow::SubWindow(const std::unique_ptr<Configuration> &config, QWidget *pare 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<QString>("window.shortcuts.new").value())); + newTab_button->setShortcut(QKeySequence(config->value<QString>("subwindow.shortcuts.new").value())); connect(newTab_button, &QToolButton::clicked, this, [=]() { auto index = addTab(WebProfile::defaultProfile()->newtab()); tabWidget->setCurrentIndex(index); @@ -76,22 +77,34 @@ SubWindow::SubWindow(const std::unique_ptr<Configuration> &config, QWidget *pare tabWidget->setCornerWidget(newTab_button, Qt::TopRightCorner); // general actions - auto *closeTab_shortcut = new QShortcut(QKeySequence(config->value<QString>("window.shortcuts.close").value()), this); + auto *closeTab_shortcut = new QShortcut(QKeySequence(config->value<QString>("subwindow.shortcuts.close").value()), this); connect(closeTab_shortcut, &QShortcut::activated, this, [=]() { tabWidget->deleteTab(tabWidget->currentIndex()); }); - auto *leftTab_shortcut = new QShortcut(QKeySequence(config->value<QString>("window.shortcuts.left").value()), this); + auto *leftTab_shortcut = new QShortcut(QKeySequence(config->value<QString>("subwindow.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<QString>("window.shortcuts.right").value()), this); + auto *moveTabLeft_shortcut = new QShortcut(QKeySequence(config->value<QString>("subwindow.shortcuts.moveLeft").value()), this); + connect(moveTabLeft_shortcut, &QShortcut::activated, this, [=]() { + auto idx = tabWidget->currentIndex(); + tabWidget->tabBar()->moveTab(idx, idx - 1); + }); + + auto *rightTab_shortcut = new QShortcut(QKeySequence(config->value<QString>("subwindow.shortcuts.right").value()), this); connect(rightTab_shortcut, &QShortcut::activated, this, [=]() { tabWidget->setCurrentIndex(qMin(tabWidget->currentIndex() + 1, tabWidget->count() - 1)); }); - auto *fullScreen_shortcut = new QShortcut(QKeySequence(config->value<QString>("window.shortcuts.fullscreen").value()), this); + auto *moveTabRight_shortcut = new QShortcut(QKeySequence(config->value<QString>("subwindow.shortcuts.moveRight").value()), this); + connect(moveTabRight_shortcut, &QShortcut::activated, this, [=]() { + auto idx = tabWidget->currentIndex(); + tabWidget->tabBar()->moveTab(idx, idx + 1); + }); + + auto *fullScreen_shortcut = new QShortcut(QKeySequence(config->value<QString>("subwindow.shortcuts.fullscreen").value()), this); connect(fullScreen_shortcut, &QShortcut::activated, this, [=]() { auto *w = this->window(); if(w->isFullScreen()) |