mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-06 06:03:23 +01:00
Androids like kittens, too
(cherry picked from commit 00fd9b4724c0a35937a89b4c14d8c1fbeb549615)
This commit is contained in:
parent
7983343e50
commit
d88d0d420e
@ -217,3 +217,13 @@ void NetworkRemote::CreateRemoteClient(QTcpSocket* client_socket) {
|
|||||||
incoming_data_parser_.get(), SLOT(Parse(pb::remote::Message)));
|
incoming_data_parser_.get(), SLOT(Parse(pb::remote::Message)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkRemote::EnableKittens(bool aww) {
|
||||||
|
if (outgoing_data_creator_.get())
|
||||||
|
outgoing_data_creator_->EnableKittens(aww);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkRemote::SendKitten(quint64 id, const QImage &kitten) {
|
||||||
|
if (outgoing_data_creator_.get())
|
||||||
|
outgoing_data_creator_->SendKitten(kitten);
|
||||||
|
}
|
||||||
|
@ -26,6 +26,8 @@ public slots:
|
|||||||
void StartServer();
|
void StartServer();
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
void AcceptConnection();
|
void AcceptConnection();
|
||||||
|
void EnableKittens(bool aww);
|
||||||
|
void SendKitten(quint64 id, const QImage& kitten);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::scoped_ptr<QTcpServer> server_;
|
boost::scoped_ptr<QTcpServer> server_;
|
||||||
|
@ -33,6 +33,7 @@ const quint32 OutgoingDataCreator::kFileChunkSize = 100000; // in Bytes
|
|||||||
|
|
||||||
OutgoingDataCreator::OutgoingDataCreator(Application* app)
|
OutgoingDataCreator::OutgoingDataCreator(Application* app)
|
||||||
: app_(app),
|
: app_(app),
|
||||||
|
aww_(false),
|
||||||
ultimate_reader_(new UltimateLyricsReader(this)),
|
ultimate_reader_(new UltimateLyricsReader(this)),
|
||||||
fetcher_(new SongInfoFetcher(this))
|
fetcher_(new SongInfoFetcher(this))
|
||||||
{
|
{
|
||||||
@ -314,21 +315,26 @@ void OutgoingDataCreator::SendFirstData(bool send_playlist_songs) {
|
|||||||
void OutgoingDataCreator::CurrentSongChanged(const Song& song, const QString& uri, const QImage& img) {
|
void OutgoingDataCreator::CurrentSongChanged(const Song& song, const QString& uri, const QImage& img) {
|
||||||
current_song_ = song;
|
current_song_ = song;
|
||||||
current_uri_ = uri;
|
current_uri_ = uri;
|
||||||
current_image_ = img;
|
|
||||||
|
|
||||||
if (!clients_->empty()) {
|
if (!aww_) {
|
||||||
// Create the message
|
current_image_ = img;
|
||||||
pb::remote::Message msg;
|
|
||||||
msg.set_type(pb::remote::CURRENT_METAINFO);
|
|
||||||
|
|
||||||
// If there is no song, create an empty node, otherwise fill it with data
|
|
||||||
int i = app_->playlist_manager()->active()->current_row();
|
|
||||||
CreateSong(
|
|
||||||
current_song_, img, i,
|
|
||||||
msg.mutable_response_current_metadata()->mutable_song_metadata());
|
|
||||||
|
|
||||||
SendDataToClients(&msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendSongMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutgoingDataCreator::SendSongMetadata() {
|
||||||
|
// Create the message
|
||||||
|
pb::remote::Message msg;
|
||||||
|
msg.set_type(pb::remote::CURRENT_METAINFO);
|
||||||
|
|
||||||
|
// If there is no song, create an empty node, otherwise fill it with data
|
||||||
|
int i = app_->playlist_manager()->active()->current_row();
|
||||||
|
CreateSong(
|
||||||
|
current_song_, current_image_, i,
|
||||||
|
msg.mutable_response_current_metadata()->mutable_song_metadata());
|
||||||
|
|
||||||
|
SendDataToClients(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutgoingDataCreator::CreateSong(
|
void OutgoingDataCreator::CreateSong(
|
||||||
@ -774,3 +780,15 @@ void OutgoingDataCreator::SendLibrary(RemoteClient *client) {
|
|||||||
// Remove temporary file
|
// Remove temporary file
|
||||||
file.remove();
|
file.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutgoingDataCreator::EnableKittens(bool aww) {
|
||||||
|
aww_ = aww;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutgoingDataCreator::SendKitten(const QImage& kitten) {
|
||||||
|
if (aww_) {
|
||||||
|
current_image_ = kitten;
|
||||||
|
SendSongMetadata();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ public slots:
|
|||||||
void PlaylistRenamed(int id, const QString& new_name);
|
void PlaylistRenamed(int id, const QString& new_name);
|
||||||
void ActiveChanged(Playlist*);
|
void ActiveChanged(Playlist*);
|
||||||
void CurrentSongChanged(const Song& song, const QString& uri, const QImage& img);
|
void CurrentSongChanged(const Song& song, const QString& uri, const QImage& img);
|
||||||
|
void SendSongMetadata();
|
||||||
void StateChanged(Engine::State);
|
void StateChanged(Engine::State);
|
||||||
void SendKeepAlive();
|
void SendKeepAlive();
|
||||||
void SendRepeatMode(PlaylistSequence::RepeatMode mode);
|
void SendRepeatMode(PlaylistSequence::RepeatMode mode);
|
||||||
@ -73,6 +74,8 @@ public slots:
|
|||||||
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
||||||
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
||||||
void SendLibrary(RemoteClient* client);
|
void SendLibrary(RemoteClient* client);
|
||||||
|
void EnableKittens(bool aww);
|
||||||
|
void SendKitten(const QImage& kitten);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Application* app_;
|
Application* app_;
|
||||||
@ -86,6 +89,7 @@ private:
|
|||||||
int keep_alive_timeout_;
|
int keep_alive_timeout_;
|
||||||
QMap<RemoteClient*, QQueue<DownloadItem> > download_queue_;
|
QMap<RemoteClient*, QQueue<DownloadItem> > download_queue_;
|
||||||
int last_track_position_;
|
int last_track_position_;
|
||||||
|
bool aww_;
|
||||||
|
|
||||||
boost::scoped_ptr<UltimateLyricsReader> ultimate_reader_;
|
boost::scoped_ptr<UltimateLyricsReader> ultimate_reader_;
|
||||||
ProviderList provider_list_;
|
ProviderList provider_list_;
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#include "library/libraryfilterwidget.h"
|
#include "library/libraryfilterwidget.h"
|
||||||
#include "library/libraryviewcontainer.h"
|
#include "library/libraryviewcontainer.h"
|
||||||
#include "musicbrainz/tagfetcher.h"
|
#include "musicbrainz/tagfetcher.h"
|
||||||
|
#include "networkremote/networkremote.h"
|
||||||
#include "playlist/playlistbackend.h"
|
#include "playlist/playlistbackend.h"
|
||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
#include "playlist/playlistlistcontainer.h"
|
#include "playlist/playlistlistcontainer.h"
|
||||||
@ -670,6 +671,7 @@ MainWindow::MainWindow(Application* app,
|
|||||||
SLOT(NowPlayingWidgetPositionChanged(bool)));
|
SLOT(NowPlayingWidgetPositionChanged(bool)));
|
||||||
connect(ui_->action_hypnotoad, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(AllHail(bool)));
|
connect(ui_->action_hypnotoad, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(AllHail(bool)));
|
||||||
connect(ui_->action_kittens, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(EnableKittens(bool)));
|
connect(ui_->action_kittens, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(EnableKittens(bool)));
|
||||||
|
connect(ui_->action_kittens, SIGNAL(toggled(bool)), app_->network_remote(), SLOT(EnableKittens(bool)));
|
||||||
// Hide the console
|
// Hide the console
|
||||||
//connect(ui_->action_console, SIGNAL(triggered()), SLOT(ShowConsole()));
|
//connect(ui_->action_console, SIGNAL(triggered()), SLOT(ShowConsole()));
|
||||||
NowPlayingWidgetPositionChanged(ui_->now_playing->show_above_status_bar());
|
NowPlayingWidgetPositionChanged(ui_->now_playing->show_above_status_bar());
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "covers/currentartloader.h"
|
#include "covers/currentartloader.h"
|
||||||
#include "covers/kittenloader.h"
|
#include "covers/kittenloader.h"
|
||||||
#include "library/librarybackend.h"
|
#include "library/librarybackend.h"
|
||||||
|
#include "networkremote/networkremote.h"
|
||||||
#include "ui/albumcoverchoicecontroller.h"
|
#include "ui/albumcoverchoicecontroller.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
|
|
||||||
@ -423,6 +424,7 @@ void NowPlayingWidget::EnableKittens(bool aww) {
|
|||||||
kittens_ = new KittenLoader(this);
|
kittens_ = new KittenLoader(this);
|
||||||
app_->MoveToNewThread(kittens_);
|
app_->MoveToNewThread(kittens_);
|
||||||
connect(kittens_, SIGNAL(ImageLoaded(quint64,QImage)), SLOT(KittenLoaded(quint64,QImage)));
|
connect(kittens_, SIGNAL(ImageLoaded(quint64,QImage)), SLOT(KittenLoaded(quint64,QImage)));
|
||||||
|
connect(kittens_, SIGNAL(ImageLoaded(quint64,QImage)), app_->network_remote(), SLOT(SendKitten(quint64,QImage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
aww_ = aww;
|
aww_ = aww;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user