From a9b7da5b3b9209be9f8f96bccb0cf991a2a18669 Mon Sep 17 00:00:00 2001 From: Flavio Date: Mon, 28 Jan 2013 10:33:22 +0100 Subject: [PATCH] Shortcuts for back and forward --- src/sidebarheader.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/sidebarheader.cpp b/src/sidebarheader.cpp index a2fc787..91670a9 100644 --- a/src/sidebarheader.cpp +++ b/src/sidebarheader.cpp @@ -14,15 +14,22 @@ void SidebarHeader::setup() { backAction = new QAction( Utils::icon("go-previous"), tr("&Back"), this); + backAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Left)); connect(backAction, SIGNAL(triggered()), MediaView::instance(), SLOT(goBack())); addAction(backAction); forwardAction = new QAction( Utils::icon("go-next"), tr("&Back"), this); + forwardAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Right)); connect(forwardAction, SIGNAL(triggered()), MediaView::instance(), SLOT(goForward())); addAction(forwardAction); + foreach (QAction* action, actions()) { + window()->addAction(action); + action->setAutoRepeat(false); + } + /* QWidget *spacerWidget = new QWidget(this); spacerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -43,11 +50,14 @@ void SidebarHeader::updateInfo() { bool canGoForward = MediaView::instance()->canGoForward(); forwardAction->setVisible(canGoForward); + forwardAction->setEnabled(canGoForward); if (canGoForward) { VideoSource *nextVideoSource = history.at(currentIndex + 1); forwardAction->setStatusTip( tr("Forward to %1") - .arg(nextVideoSource->getName())); + .arg(nextVideoSource->getName()) + + " (" + forwardAction->shortcut().toString(QKeySequence::NativeText) + ")" + ); } bool canGoBack = MediaView::instance()->canGoBack(); @@ -58,7 +68,9 @@ void SidebarHeader::updateInfo() { VideoSource *previousVideoSource = history.at(currentIndex - 1); backAction->setStatusTip( tr("Back to %1") - .arg(previousVideoSource->getName())); + .arg(previousVideoSource->getName()) + + " (" + backAction->shortcut().toString(QKeySequence::NativeText) + ")" + ); } VideoSource *currentVideoSource = history.at(currentIndex); -- 2.39.5