]> git.sur5r.net Git - minitube/commitdiff
Shortcuts for back and forward
authorFlavio <flavio@odisseo.local>
Mon, 28 Jan 2013 09:33:22 +0000 (10:33 +0100)
committerFlavio <flavio@odisseo.local>
Mon, 28 Jan 2013 09:33:22 +0000 (10:33 +0100)
src/sidebarheader.cpp

index a2fc787a806853c2d91c519cead3566fb2aef99d..91670a94503c89539f6ae1481a11380715f6f059 100644 (file)
@@ -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);