2
* Copyright 2008 Alex Merry <alex.merry@kdemail.net>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor,
17
* Boston, MA 02110-1301 USA
20
#include "playercontainer.h"
24
#include "playercontrol.h"
26
PlayerContainer::PlayerContainer(Player::Ptr player, QObject* parent)
27
: DataContainer(parent)
32
setObjectName(m_player->name());
34
connect(this, SIGNAL(updateRequested(DataContainer*)),
35
this, SLOT(updateInfo()));
38
Plasma::Service* PlayerContainer::service(QObject* parent)
40
kDebug() << "Creating controller";
41
Plasma::Service *controller = new PlayerControl(parent, m_player);
42
connect(this, SIGNAL(updateRequested(DataContainer*)),
43
controller, SLOT(updateEnabledOperations()));
47
void PlayerContainer::updateInfo()
49
if (!m_player->isRunning()) {
50
kDebug() << objectName() << "isn't running";
54
switch(m_player->state()) {
56
setData("State", "playing");
59
setData("State", "paused");
62
setData("State", "stopped");
66
setData("Artist", m_player->artist());
67
setData("Album", m_player->album());
68
setData("Title", m_player->title());
69
setData("Track number", m_player->trackNumber());
70
setData("Comment", m_player->comment());
71
setData("Genre", m_player->genre());
72
setData("Lyrics", m_player->lyrics());
73
setData("Length", m_player->length());
74
setData("Position", m_player->position());
75
setData("Volume", m_player->volume());
76
setData("Artwork", m_player->artwork());
82
#include "playercontainer.moc"