diff --git a/ChangeLog b/ChangeLog index 7127738b0..c5fd021c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ 7. Have cantata-dynamic helper script send a dbus message when it starts and stops - so that cantata main window can show the current status if the helper is started externally. +8. When 'Return'/'Enter' is pressed when play queue has focus, start playing + from the first selected song. 0.7.0 ----- diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 58b975727..43217a68b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1234,6 +1234,17 @@ void MainWindow::mpdConnectionStateChanged(bool connected) } } +void MainWindow::keyPressEvent(QKeyEvent *event) +{ + if ((Qt::Key_Enter==event->key() || Qt::Key_Return==event->key()) && + playQueue->hasFocus() && !playQueue->selectionModel()->selectedRows().isEmpty()) { + //play the first selected song + QModelIndexList selection=playQueue->selectionModel()->selectedRows(); + qSort(selection); + playQueueItemActivated(selection.first()); + } +} + void MainWindow::closeEvent(QCloseEvent *event) { if (trayItem) { diff --git a/gui/mainwindow.h b/gui/mainwindow.h index fd1aaf3dc..78ffacb23 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -190,6 +190,7 @@ public: const QDateTime & getDbUpdate() const; protected: + void keyPressEvent(QKeyEvent *event); void closeEvent(QCloseEvent *event); private: