Clicking on songs in playlists via remote control now respecting behavioural settings from GUI (either direct changes it or enques it)
This commit is contained in:
parent
f3aab34d3a
commit
465fa2ce87
@ -32,6 +32,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
IncomingDataParser::IncomingDataParser(Application* app) : app_(app) {
|
IncomingDataParser::IncomingDataParser(Application* app) : app_(app) {
|
||||||
|
// load settings initaily and sign up for updates
|
||||||
|
ReloadSettings();
|
||||||
|
connect(app_, SIGNAL(SettingsChanged()), SLOT(ReloadSettings()));
|
||||||
|
|
||||||
|
|
||||||
// Connect all the signals
|
// Connect all the signals
|
||||||
// due the player is in a different thread, we cannot access these functions
|
// due the player is in a different thread, we cannot access these functions
|
||||||
// directly
|
// directly
|
||||||
@ -47,6 +52,7 @@ IncomingDataParser::IncomingDataParser(Application* app) : app_(app) {
|
|||||||
connect(this, SIGNAL(PlayAt(int, Engine::TrackChangeFlags, bool)),
|
connect(this, SIGNAL(PlayAt(int, Engine::TrackChangeFlags, bool)),
|
||||||
app_->player(), SLOT(PlayAt(int, Engine::TrackChangeFlags, bool)));
|
app_->player(), SLOT(PlayAt(int, Engine::TrackChangeFlags, bool)));
|
||||||
connect(this, SIGNAL(SeekTo(int)), app_->player(), SLOT(SeekTo(int)));
|
connect(this, SIGNAL(SeekTo(int)), app_->player(), SLOT(SeekTo(int)));
|
||||||
|
connect(this, SIGNAL(Enque(int,int)), app_->playlist_manager(), SLOT(Enque(int,int)));
|
||||||
|
|
||||||
connect(this, SIGNAL(SetActivePlaylist(int)), app_->playlist_manager(),
|
connect(this, SIGNAL(SetActivePlaylist(int)), app_->playlist_manager(),
|
||||||
SLOT(SetActivePlaylist(int)));
|
SLOT(SetActivePlaylist(int)));
|
||||||
@ -80,6 +86,12 @@ IncomingDataParser::IncomingDataParser(Application* app) : app_(app) {
|
|||||||
|
|
||||||
IncomingDataParser::~IncomingDataParser() {}
|
IncomingDataParser::~IncomingDataParser() {}
|
||||||
|
|
||||||
|
void IncomingDataParser::ReloadSettings() {
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup(MainWindow::kSettingsGroup);
|
||||||
|
doubleclick_playlist_addmode_ = MainWindow::PlaylistAddBehaviour(s.value("doubleclick_playlist_addmode", MainWindow::PlaylistAddBehaviour_Enqueue).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
bool IncomingDataParser::close_connection() { return close_connection_; }
|
bool IncomingDataParser::close_connection() { return close_connection_; }
|
||||||
|
|
||||||
void IncomingDataParser::Parse(const pb::remote::Message& msg) {
|
void IncomingDataParser::Parse(const pb::remote::Message& msg) {
|
||||||
@ -194,8 +206,24 @@ void IncomingDataParser::ChangeSong(const pb::remote::Message& msg) {
|
|||||||
emit SetActivePlaylist(request.playlist_id());
|
emit SetActivePlaylist(request.playlist_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the selected song
|
switch (doubleclick_playlist_addmode_)
|
||||||
emit PlayAt(request.song_index(), Engine::Manual, false);
|
{
|
||||||
|
// Play the selected song
|
||||||
|
case MainWindow::PlaylistAddBehaviour_Play:
|
||||||
|
emit PlayAt(request.song_index(), Engine::Manual, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Enque the selected song
|
||||||
|
case MainWindow::PlaylistAddBehaviour_Enqueue:
|
||||||
|
emit Enque(request.playlist_id(), request.song_index());
|
||||||
|
if (app_->player()->GetState() != Engine::Playing)
|
||||||
|
{
|
||||||
|
emit PlayAt(request.song_index(), Engine::Manual, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncomingDataParser::SetRepeatMode(const pb::remote::Repeat& repeat) {
|
void IncomingDataParser::SetRepeatMode(const pb::remote::Repeat& repeat) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "remotecontrolmessages.pb.h"
|
#include "remotecontrolmessages.pb.h"
|
||||||
#include "remoteclient.h"
|
#include "remoteclient.h"
|
||||||
|
#include "ui/mainwindow.h"
|
||||||
|
|
||||||
class IncomingDataParser : public QObject {
|
class IncomingDataParser : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -16,6 +17,7 @@ class IncomingDataParser : public QObject {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Parse(const pb::remote::Message& msg);
|
void Parse(const pb::remote::Message& msg);
|
||||||
|
void ReloadSettings();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SendClementineInfo();
|
void SendClementineInfo();
|
||||||
@ -38,6 +40,7 @@ signals:
|
|||||||
void Previous();
|
void Previous();
|
||||||
void SetVolume(int volume);
|
void SetVolume(int volume);
|
||||||
void PlayAt(int i, Engine::TrackChangeFlags change, bool reshuffle);
|
void PlayAt(int i, Engine::TrackChangeFlags change, bool reshuffle);
|
||||||
|
void Enque(int id, int i);
|
||||||
void SetActivePlaylist(int id);
|
void SetActivePlaylist(int id);
|
||||||
void ShuffleCurrent();
|
void ShuffleCurrent();
|
||||||
void SetRepeatMode(PlaylistSequence::RepeatMode mode);
|
void SetRepeatMode(PlaylistSequence::RepeatMode mode);
|
||||||
@ -56,6 +59,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
Application* app_;
|
Application* app_;
|
||||||
bool close_connection_;
|
bool close_connection_;
|
||||||
|
MainWindow::PlaylistAddBehaviour doubleclick_playlist_addmode_;
|
||||||
|
|
||||||
void GetPlaylistSongs(const pb::remote::Message& msg);
|
void GetPlaylistSongs(const pb::remote::Message& msg);
|
||||||
void ChangeSong(const pb::remote::Message& msg);
|
void ChangeSong(const pb::remote::Message& msg);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "library/libraryplaylistitem.h"
|
#include "library/libraryplaylistitem.h"
|
||||||
#include "playlistparsers/playlistparser.h"
|
#include "playlistparsers/playlistparser.h"
|
||||||
#include "smartplaylists/generator.h"
|
#include "smartplaylists/generator.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@ -397,6 +398,15 @@ void PlaylistManager::ChangePlaylistOrder(const QList<int>& ids) {
|
|||||||
playlist_backend_->SetPlaylistOrder(ids);
|
playlist_backend_->SetPlaylistOrder(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlaylistManager::Enque(int id, int i) {
|
||||||
|
QModelIndexList dummyIndexList;
|
||||||
|
|
||||||
|
Q_ASSERT(playlists_.contains(id));
|
||||||
|
|
||||||
|
dummyIndexList.append(playlist(id)->index(i, 0));
|
||||||
|
playlist(id)->queue()->ToggleTracks(dummyIndexList);
|
||||||
|
}
|
||||||
|
|
||||||
void PlaylistManager::UpdateSummaryText() {
|
void PlaylistManager::UpdateSummaryText() {
|
||||||
int tracks = current()->rowCount();
|
int tracks = current()->rowCount();
|
||||||
quint64 nanoseconds = 0;
|
quint64 nanoseconds = 0;
|
||||||
|
@ -84,6 +84,8 @@ class PlaylistManagerInterface : public QObject {
|
|||||||
virtual void Open(int id) = 0;
|
virtual void Open(int id) = 0;
|
||||||
virtual void ChangePlaylistOrder(const QList<int>& ids) = 0;
|
virtual void ChangePlaylistOrder(const QList<int>& ids) = 0;
|
||||||
|
|
||||||
|
virtual void Enque(int id, int index) = 0;
|
||||||
|
|
||||||
virtual void SongChangeRequestProcessed(const QUrl& url, bool valid) = 0;
|
virtual void SongChangeRequestProcessed(const QUrl& url, bool valid) = 0;
|
||||||
|
|
||||||
virtual void SetCurrentPlaylist(int id) = 0;
|
virtual void SetCurrentPlaylist(int id) = 0;
|
||||||
@ -192,6 +194,8 @@ class PlaylistManager : public PlaylistManagerInterface {
|
|||||||
void Open(int id);
|
void Open(int id);
|
||||||
void ChangePlaylistOrder(const QList<int>& ids);
|
void ChangePlaylistOrder(const QList<int>& ids);
|
||||||
|
|
||||||
|
void Enque(int id, int index);
|
||||||
|
|
||||||
void SetCurrentPlaylist(int id);
|
void SetCurrentPlaylist(int id);
|
||||||
void SetActivePlaylist(int id);
|
void SetActivePlaylist(int id);
|
||||||
void SetActiveToCurrent();
|
void SetActiveToCurrent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user