Commit 7b9620c3eb4931086344ebfccb2f9f3268d0c093
Simplify Player class a bit
No need for that data to be class members.
Author: xaizek
Author date (UTC): 2016-04-20 16:50
Committer name: xaizek
Committer date (UTC): 2016-04-20 16:50
Parent(s): 8dcff69bc9796bc5cde126eb4710f406611aeb0f
Signing key:
Tree: 7d2fa2039069ac9aea6ecb5e0ff5100e9c34d009
File src/Player.cpp changed (mode: 100644) (index 2cabf74..4e3baa8) |
... |
... |
static std::string getStateMark(MpdState state); |
33 |
33 |
|
|
34 |
34 |
Player::Player(const ColorScheme& colorScheme, std::string host, int port) |
Player::Player(const ColorScheme& colorScheme, std::string host, int port) |
35 |
35 |
: Field(colorScheme) |
: Field(colorScheme) |
36 |
|
, host(std::move(host)) |
|
37 |
|
, port(port) |
|
38 |
36 |
{ |
{ |
39 |
|
std::thread([this]() |
|
|
37 |
|
std::thread([=]() |
40 |
38 |
{ |
{ |
41 |
39 |
while (true) { |
while (true) { |
42 |
40 |
try { |
try { |
43 |
|
MpdClient mpdClient(this->host, this->port); |
|
|
41 |
|
MpdClient mpdClient(host, port); |
44 |
42 |
|
|
45 |
43 |
while (true) { |
while (true) { |
46 |
44 |
const std::string song = mpdClient.getCurrentSong(); |
const std::string song = mpdClient.getCurrentSong(); |
File src/Player.hpp changed (mode: 100644) (index c4acdfa..f3755cf) |
... |
... |
public: |
33 |
33 |
virtual void update() override; |
virtual void update() override; |
34 |
34 |
|
|
35 |
35 |
private: |
private: |
36 |
|
const std::string host; |
|
37 |
|
const int port; |
|
38 |
|
|
|
39 |
36 |
std::shared_ptr<std::string> status; |
std::shared_ptr<std::string> status; |
40 |
37 |
}; |
}; |
41 |
38 |
|
|