]> git.sesse.net Git - nageru/commitdiff
Make it possible to use PgUp/PgDown to switch audio pages.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 23 Sep 2016 19:44:02 +0000 (21:44 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 19 Oct 2016 22:55:44 +0000 (00:55 +0200)
mainwindow.cpp

index 3245fdde0254c75e8505e52bbfa0a4fcd568449c..e62594dc04554cb002d3e9c1bb4574b1c5d0658e 100644 (file)
@@ -189,6 +189,13 @@ MainWindow::MainWindow()
        connect(ui->full_prev_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
        connect(ui->full_next_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
 
+       // And bind the same to PgUp/PgDown.
+       auto switch_page = [this]{
+               ui->audio_views->setCurrentIndex(1 - ui->audio_views->currentIndex());
+       };
+       connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, switch_page);
+       connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, switch_page);
+
        last_audio_level_callback = steady_clock::now() - seconds(1);
 }