From: Flavio Date: Mon, 28 Jan 2013 09:33:22 +0000 (+0100) Subject: Shortcuts for back and forward X-Git-Tag: 2.0~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a9b7da5b3b9209be9f8f96bccb0cf991a2a18669;p=minitube Shortcuts for back and forward --- 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);