diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow/widgets/navigationbar.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp index 648bb23..3e50b8a 100644 --- a/src/mainwindow/widgets/navigationbar.cpp +++ b/src/mainwindow/widgets/navigationbar.cpp @@ -8,8 +8,8 @@ #include "navigationbar.h" #include "mainwindow/mainwindow.h" -#include "webengine/webview.h" #include <QHBoxLayout> +#include <QShortcut> #include <QStyle> #include <QToolBar> #include <QToolButton> @@ -20,8 +20,10 @@ NavigationBar::NavigationBar(MainWindow *parent) { qStyle = parent->style(); + // Back button backButton = new QToolButton(parent); backButton->setIcon(qStyle->standardIcon(QStyle::SP_ArrowBack)); + backButton->setShortcut(QString::fromStdString(parent->m_config->value<std::string>("browser.shortcuts.back").value())); connect(backButton, &QToolButton::clicked, this, [this]() { m_view->history()->back(); }); @@ -39,8 +41,10 @@ NavigationBar::NavigationBar(MainWindow *parent) } }); + // Forward button forwardButton = new QToolButton(parent); forwardButton->setIcon(qStyle->standardIcon(QStyle::SP_ArrowForward)); + forwardButton->setShortcut(QString::fromStdString(parent->m_config->value<std::string>("browser.shortcuts.forward").value())); connect(forwardButton, &QToolButton::clicked, this, [this]() { m_view->history()->forward(); }); @@ -58,8 +62,10 @@ NavigationBar::NavigationBar(MainWindow *parent) } }); + // Stop/Refresh button stopReloadButton = new QToolButton(parent); stopReloadButton->setIcon(qStyle->standardIcon(QStyle::SP_BrowserReload)); + stopReloadButton->setShortcut(QString::fromStdString(parent->m_config->value<std::string>("browser.shortcuts.refresh").value())); connect(stopReloadButton, &QToolButton::clicked, this, [this]() { if(m_view->isLoaded()) m_view->reload(); @@ -67,8 +73,17 @@ NavigationBar::NavigationBar(MainWindow *parent) m_view->stop(); }); + auto *reloadShortcut = new QShortcut( + QString::fromStdString(parent->m_config->value<std::string>("browser.shortcuts.reload").value()), + parent); + connect(reloadShortcut, &QShortcut::activated, this, [this]() { + m_view->reload(); + }); + + // Home button homeButton = new QToolButton(parent); homeButton->setIcon(qStyle->standardIcon(QStyle::SP_DirHomeIcon)); + homeButton->setShortcut(QString::fromStdString(parent->m_config->value<std::string>("browser.shortcuts.home").value())); connect(homeButton, &QToolButton::clicked, this, [this, parent]() { m_view->load(parent->m_profile->homepage()); }); |