[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/generic/dataengines/nowplaying
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-12-10 0:53:37
Message-ID: 20101210005337.6C126AC8A6 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1205011 by aseigo:
* don't lower case source names, this breaks updating
* proper handling of the player source; it now updates as expected and doesn't \
include itself or other future sources; just the players
M +17 -4 nowplayingengine.cpp
--- trunk/KDE/kdebase/workspace/plasma/generic/dataengines/nowplaying/nowplayingengine.cpp \
#1205010:1205011 @@ -76,13 +76,12 @@
bool NowPlayingEngine::sourceRequestEvent(const QString& source)
{
kDebug() << "Source" << source << "was requested";
- QString lowerSource = source.toLower();
- if (lowerSource == "help") {
+ if (source == "help") {
setData(source, "Use 'players' to get a list of players.\n"
"Use 'properties' to get a list of all properties that may \
be returned." );
return true;
- } else if (lowerSource == "properties") {
+ } else if (source == "properties") {
setData(source, "State", "QString - playing|paused|stopped");
setData(source, "Artist", "QString - the artist metadata for the\n"
" current track, if available");
@@ -104,7 +103,7 @@
" between 0 and 1, or -1 if \
unknown");
setData(source, "Artwork", "QPixmap - the album artwork, if \
available"); return true;
- } else if (lowerSource == "players") {
+ } else if (source == "players") {
setData(source, sources());
return true;
}
@@ -125,12 +124,26 @@
void NowPlayingEngine::addPlayer(Player::Ptr player)
{
kDebug() << "Adding player" << player->name();
+ Plasma::DataContainer *container = containerForSource("players");
+ if (container) {
+ QStringList players = container->data()["players"].toStringList();
+ } else {
+ setData("players", QStringList() << player->name());
+ }
+
addSource(new PlayerContainer(player, this));
}
void NowPlayingEngine::removePlayer(Player::Ptr player)
{
kDebug() << "Player" << player->name() << "disappeared";
+ Plasma::DataContainer *container = containerForSource("players");
+ if (container) {
+ QStringList players = container->data()["players"].toStringList();
+ players.removeAll(player->name());
+ setData("players", players);
+ }
+
removeSource(player->name());
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic