Fix comments from r482.
This commit is contained in:
parent
2e35831b0b
commit
b6e3c52f44
@ -41,7 +41,9 @@ MPRIS::MPRIS(QObject* parent)
|
||||
}
|
||||
|
||||
QString MPRIS::Identity() {
|
||||
return "Clementine 0.2";
|
||||
return QString("%1 %2").arg(
|
||||
QCoreApplication::applicationName(),
|
||||
QCoreApplication::applicationVersion());
|
||||
}
|
||||
|
||||
Version MPRIS::MprisVersion() {
|
||||
|
@ -38,20 +38,20 @@
|
||||
#ifdef Q_WS_X11
|
||||
QDBusArgument& operator<< (QDBusArgument& arg, const DBusStatus& status) {
|
||||
arg.beginStructure();
|
||||
arg << status.Play;
|
||||
arg << status.Random;
|
||||
arg << status.Repeat;
|
||||
arg << status.RepeatPlaylist;
|
||||
arg << status.play;
|
||||
arg << status.random;
|
||||
arg << status.repeat;
|
||||
arg << status.repeat_playlist;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument& operator>> (const QDBusArgument& arg, DBusStatus& status) {
|
||||
arg.beginStructure();
|
||||
arg >> status.Play;
|
||||
arg >> status.Random;
|
||||
arg >> status.Repeat;
|
||||
arg >> status.RepeatPlaylist;
|
||||
arg >> status.play;
|
||||
arg >> status.random;
|
||||
arg >> status.repeat;
|
||||
arg >> status.repeat_playlist;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
@ -298,7 +298,7 @@ void Player::EngineMetadataReceived(const Engine::SimpleMetaBundle& bundle) {
|
||||
int Player::GetCaps() const {
|
||||
int caps = CAN_HAS_TRACKLIST;
|
||||
if (current_item_.is_valid()) { caps |= CAN_PROVIDE_METADATA; }
|
||||
if (GetState() == Engine::Playing && current_item_.filetype() != Song::Type_Stream) {
|
||||
if (GetState() == Engine::Playing && current_item_options_ & PlaylistItem::PauseDisabled) {
|
||||
caps |= CAN_PAUSE;
|
||||
}
|
||||
if (GetState() == Engine::Paused) {
|
||||
@ -322,19 +322,19 @@ DBusStatus Player::GetStatus() const {
|
||||
switch (GetState()) {
|
||||
case Engine::Empty:
|
||||
case Engine::Idle:
|
||||
status.Play = 2;
|
||||
status.play = DBusStatus::Mpris_Stopped;
|
||||
break;
|
||||
case Engine::Playing:
|
||||
status.Play = 0;
|
||||
status.play = DBusStatus::Mpris_Playing;
|
||||
break;
|
||||
case Engine::Paused:
|
||||
status.Play = 1;
|
||||
status.play = DBusStatus::Mpris_Paused;
|
||||
break;
|
||||
}
|
||||
status.Random = playlist_->sequence()->shuffle_mode() == PlaylistSequence::Shuffle_Off ? 0 : 1;
|
||||
status.random = playlist_->sequence()->shuffle_mode() == PlaylistSequence::Shuffle_Off ? 0 : 1;
|
||||
PlaylistSequence::RepeatMode repeat_mode = playlist_->sequence()->repeat_mode();
|
||||
status.Repeat = repeat_mode == PlaylistSequence::Repeat_Track ? 1 : 0;
|
||||
status.RepeatPlaylist = (repeat_mode == PlaylistSequence::Repeat_Album ||
|
||||
status.repeat = repeat_mode == PlaylistSequence::Repeat_Track ? 1 : 0;
|
||||
status.repeat_playlist = (repeat_mode == PlaylistSequence::Repeat_Album ||
|
||||
repeat_mode == PlaylistSequence::Repeat_Playlist) ? 1 : 0;
|
||||
return status;
|
||||
}
|
||||
@ -474,9 +474,9 @@ int Player::AddTrack(const QString& track, bool play_now) {
|
||||
if (play_now) {
|
||||
Next();
|
||||
}
|
||||
return 0;
|
||||
return 0; // Success.
|
||||
}
|
||||
return -1;
|
||||
return -1; // Anything else for failure.
|
||||
}
|
||||
|
||||
void Player::DelTrack(int index) {
|
||||
|
16
src/player.h
16
src/player.h
@ -30,11 +30,17 @@ class Playlist;
|
||||
class Settings;
|
||||
class LastFMService;
|
||||
|
||||
struct DBusStatus { // From Amarok.
|
||||
int Play; // Playing = 0, Paused = 1, Stopped = 2
|
||||
int Random; // Linearly = 0, Randomly = 1
|
||||
int Repeat; // Go_To_Next = 0, Repeat_Current = 1
|
||||
int RepeatPlaylist; // Stop_When_Finished = 0, Never_Give_Up_Playing = 1
|
||||
struct DBusStatus { // From Amarok.
|
||||
int play; // Playing = 0, Paused = 1, Stopped = 2
|
||||
int random; // Linearly = 0, Randomly = 1
|
||||
int repeat; // Go_To_Next = 0, Repeat_Current = 1
|
||||
int repeat_playlist; // Stop_When_Finished = 0, Never_Give_Up_Playing = 1, Never_Let_You_Down = 42
|
||||
|
||||
enum MprisPlayState {
|
||||
Mpris_Playing = 0,
|
||||
Mpris_Paused = 1,
|
||||
Mpris_Stopped = 2,
|
||||
};
|
||||
};
|
||||
Q_DECLARE_METATYPE(DBusStatus);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user