From 288befdfd7544e43ab9239ac169bd82569db900b Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Fri, 11 Apr 2014 17:40:18 +0000 Subject: [PATCH] Add clear to playqueue. Currently no icon!!! --- ubuntu/backend/mpdbackend.cpp | 1 + ubuntu/backend/mpdbackend.h | 4 +++- ubuntu/qml/cantata/CurrentlyPlayingPage.qml | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ubuntu/backend/mpdbackend.cpp b/ubuntu/backend/mpdbackend.cpp index 2dae11c0f..96908fef6 100644 --- a/ubuntu/backend/mpdbackend.cpp +++ b/ubuntu/backend/mpdbackend.cpp @@ -62,6 +62,7 @@ MPDBackend::MPDBackend(QObject *parent) : QObject(parent) // connect(this, SIGNAL(setSeekId(qint32, quint32)), MPDConnection::self(), SLOT(setSeekId(qint32, quint32))); connect(this, SIGNAL(startPlayingSongId(qint32)), MPDConnection::self(), SLOT(startPlayingSongId(qint32))); connect(this, SIGNAL(setDetails(const MPDConnectionDetails &)), MPDConnection::self(), SLOT(setDetails(const MPDConnectionDetails &))); + connect(this, SIGNAL(clear()), MPDConnection::self(), SLOT(clear())); // connect(this, SIGNAL(setPriority(const QList &, quint8 )), MPDConnection::self(), SLOT(setPriority(const QList &, quint8))); // connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &))); diff --git a/ubuntu/backend/mpdbackend.h b/ubuntu/backend/mpdbackend.h index 182f38beb..73d462dfe 100644 --- a/ubuntu/backend/mpdbackend.h +++ b/ubuntu/backend/mpdbackend.h @@ -58,6 +58,7 @@ public: Q_INVOKABLE void playPause(); Q_INVOKABLE void nextSong(); Q_INVOKABLE void previousSong(); + Q_INVOKABLE void clearPlayQueue() { emit clear(); } Q_INVOKABLE bool getIsConnected() { return MPDConnection::self()->isConnected(); } Q_INVOKABLE void addAlbum(int index, bool replace); Q_INVOKABLE void removeFromPlayQueue(int index); @@ -74,7 +75,7 @@ public: Q_INVOKABLE bool getAlbumsFound() { return AlbumsModel::self()->rowCount() != 0; } -signals: +Q_SIGNALS: void onConnectedChanged(); void onPlayingStatusChanged(); void onCurrentSongChanged(); @@ -117,6 +118,7 @@ Q_SIGNALS: void updateLibrary(); void add(const QStringList &files, bool replace, quint8 priorty); //Album void setVolume(int volume); + void clear(); private: void updateStatus(MPDStatus * const status); diff --git a/ubuntu/qml/cantata/CurrentlyPlayingPage.qml b/ubuntu/qml/cantata/CurrentlyPlayingPage.qml index dde84b9d3..0a142c616 100644 --- a/ubuntu/qml/cantata/CurrentlyPlayingPage.qml +++ b/ubuntu/qml/cantata/CurrentlyPlayingPage.qml @@ -55,6 +55,13 @@ Page { opened: true locked: root.width > units.gu(60) && opened //"&& opened": prevents the bar from being hidden and locked at the same time pageStack: pageStack + ToolbarButton { + //iconSource: Qt.resolvedUrl("../../icons/toolbar/help.svg") + action: Action { + text: i18n.tr("Clear") + onTriggered: backend.clearPlayQueue() + } + } } Row {