When 'Return'/'Enter' is pressed when play queue has focus, start playing from the first selected song.

BUG:16
This commit is contained in:
craig.p.drummond
2012-05-18 16:46:42 +00:00
parent d06dbf624d
commit f46d670ea7
3 changed files with 14 additions and 0 deletions

View File

@@ -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
-----

View File

@@ -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) {

View File

@@ -190,6 +190,7 @@ public:
const QDateTime & getDbUpdate() const;
protected:
void keyPressEvent(QKeyEvent *event);
void closeEvent(QCloseEvent *event);
private: