mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-14 18:35:16 +01:00
- Send songrating to client.
- Receive songrating as float (like saved in Song). - On RemoteClient destructor check if socket is still connected before calling waitForDisconnect()
This commit is contained in:
parent
4e8dba16d4
commit
9237356e33
@ -81,6 +81,7 @@ message SongMetadata {
|
||||
optional bool is_local = 15;
|
||||
optional string filename = 16;
|
||||
optional int32 file_size = 17;
|
||||
optional float rating = 18; // 0 (0 stars) to 1 (5 stars)
|
||||
}
|
||||
|
||||
// Playlist informations
|
||||
@ -270,12 +271,12 @@ message ResponseSongOffer {
|
||||
}
|
||||
|
||||
message RequestRateSong {
|
||||
optional int32 rating = 1; // 0 to 5
|
||||
optional float rating = 1; // 0 to 1
|
||||
}
|
||||
|
||||
// The message itself
|
||||
message Message {
|
||||
optional int32 version = 1 [default=10];
|
||||
optional int32 version = 1 [default=11];
|
||||
optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message?
|
||||
|
||||
optional RequestConnect request_connect = 21;
|
||||
|
@ -77,8 +77,8 @@ IncomingDataParser::IncomingDataParser(Application* app)
|
||||
connect(this, SIGNAL(Close(int)),
|
||||
app_->playlist_manager(), SLOT(Close(int)));
|
||||
|
||||
connect(this, SIGNAL(RateCurrentSong(int)),
|
||||
app_->playlist_manager(), SLOT(RateCurrentSong(int)));
|
||||
connect(this, SIGNAL(RateCurrentSong(double)),
|
||||
app_->playlist_manager(), SLOT(RateCurrentSong(double)));
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
connect(this, SIGNAL(Love()),
|
||||
@ -300,7 +300,6 @@ void IncomingDataParser::ClosePlaylist(const pb::remote::Message &msg) {
|
||||
}
|
||||
|
||||
void IncomingDataParser::RateSong(const pb::remote::Message &msg) {
|
||||
int rating = qBound(0, msg.request_rate_song().rating(), 5);
|
||||
|
||||
double rating = (double) msg.request_rate_song().rating();
|
||||
emit RateCurrentSong(rating);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ signals:
|
||||
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
||||
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
||||
void SendLibrary(RemoteClient* client);
|
||||
void RateCurrentSong(int);
|
||||
void RateCurrentSong(double);
|
||||
|
||||
private:
|
||||
Application* app_;
|
||||
|
@ -353,6 +353,7 @@ void OutgoingDataCreator::CreateSong(
|
||||
song_metadata->set_is_local(song.url().scheme() == "file");
|
||||
song_metadata->set_filename(DataCommaSizeFromQString(song.basefilename()));
|
||||
song_metadata->set_file_size(song.filesize());
|
||||
song_metadata->set_rating(song.rating());
|
||||
|
||||
// Append coverart
|
||||
if (!art.isNull()) {
|
||||
|
@ -53,7 +53,8 @@ RemoteClient::RemoteClient(Application* app, QTcpSocket* client)
|
||||
|
||||
RemoteClient::~RemoteClient() {
|
||||
client_->close();
|
||||
client_->waitForDisconnected(2000);
|
||||
if (client_->state() == QAbstractSocket::ConnectedState)
|
||||
client_->waitForDisconnected(2000);
|
||||
}
|
||||
|
||||
void RemoteClient::setDownloader(bool downloader) {
|
||||
|
Loading…
Reference in New Issue
Block a user