aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp12
-rw-r--r--src/settings.h1
-rw-r--r--src/widgets/webviewtabbar.cpp43
3 files changed, 19 insertions, 37 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 638e3bd..6a99728 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -90,18 +90,6 @@ bool Settings::isEmpty() const
return userValues.empty();
}
-bool Settings::contains(const QString &key)
-{
- const toml::Value *x = userValues.find(key.toStdString());
- const toml::Value *y = defaultValues.find(key.toStdString());
-
- if(x || y) {
- return true;
- } else {
- return false;
- }
-}
-
QVariant Settings::value(const QString &key) const
{
const toml::Value *cValue = userValues.find(key.toStdString());
diff --git a/src/settings.h b/src/settings.h
index 0c0cfc7..9a11010 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -35,7 +35,6 @@ public:
QString defaultsPath() const;
bool isEmpty() const;
- bool contains(const QString &key);
QVariant value(const QString &key) const;
private:
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index 7ec7f0b..9264a2a 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -24,6 +24,8 @@
#include <QContextMenuEvent>
#include <QMenu>
+#include <QShortcut>
+
WebViewTabBar::WebViewTabBar(WebEngineProfile *profile, QWidget *parent) :
QTabBar(parent)
{
@@ -37,30 +39,23 @@ WebViewTabBar::WebViewTabBar(WebEngineProfile *profile, QWidget *parent) :
connect(this, SIGNAL(currentChanged(int)), this, SLOT(handleCurrentChanged(int)));
connect(this, SIGNAL(tabMoved(int,int)), this, SLOT(updateVectorArrangement(int,int)));
- if(sSettings->contains("window.shortcuts.tabClose")) {
- QAction *tabCloseAction = new QAction(this);
- tabCloseAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabClose").toString()));
- connect(tabCloseAction, &QAction::triggered, [this]() {
- this->removeTab(currentIndex());
- });
- addAction(tabCloseAction);
- }
- if(sSettings->contains("window.shortcuts.tabLeft")) {
- QAction *tabLeftAction = new QAction(this);
- tabLeftAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabLeft").toString()));
- connect(tabLeftAction, &QAction::triggered, [this]() {
- this->setCurrentIndex(currentIndex()-1);
- });
- addAction(tabLeftAction);
- }
- if(sSettings->contains("window.shortcuts.tabRight")) {
- QAction *tabRightAction = new QAction(this);
- tabRightAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabRight").toString()));
- connect(tabRightAction, &QAction::triggered, [this]() {
- this->setCurrentIndex(currentIndex()+1);
- });
- addAction(tabRightAction);
- }
+ QShortcut *tabCloseShortcut = new QShortcut(this);
+ tabCloseShortcut->setKey(QKeySequence::fromString(qApp->settings()->value("window.shortcuts.tabClose").toString()));
+ connect(tabCloseShortcut, &QShortcut::activated, [this]() {
+ this->removeTab(currentIndex());
+ });
+
+ QShortcut *tabLeftShortcut = new QShortcut(this);
+ tabLeftShortcut->setKey(QKeySequence::fromString(qApp->settings()->value("window.shortcuts.tabLeft").toString()));
+ connect(tabLeftShortcut, &QShortcut::activated, [this]() {
+ this->setCurrentIndex(currentIndex()-1);
+ });
+
+ QShortcut *tabRightShortcut = new QShortcut(this);
+ tabRightShortcut->setKey(QKeySequence::fromString(qApp->settings()->value("window.shortcuts.tabRight").toString()));
+ connect(tabRightShortcut, &QShortcut::activated, [this]() {
+ this->setCurrentIndex(currentIndex()+1);
+ });
m_signalMapper = new QSignalMapper(this);
connect(m_signalMapper, SIGNAL(mapped(int)), this, SLOT(webAction(int)));