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"
22 #include "playercontrol.h"
24 PlayerContainer::PlayerContainer(Player::Ptr m_player
, QObject
* parent
)
25 : DataContainer(parent
)
31 setObjectName(m_player
->name());
33 connect(this, SIGNAL(updateRequested(DataContainer
*)),
34 this, SLOT(updateInfo()));
37 Plasma::Service
* PlayerContainer::service(QObject
* parent
)
40 kDebug() << "Creating controller";
41 m_controller
= new PlayerControl(parent
, m_player
);
42 connect(this, SIGNAL(updateRequested(DataContainer
*)),
43 m_controller
, SLOT(updateEnabledOperations()));
48 void PlayerContainer::updateInfo()
50 if (!m_player
->isRunning()) {
51 kDebug() << objectName() << "isn't running";
55 switch(m_player
->state()) {
57 setData("State", "playing");
60 setData("State", "paused");
63 setData("State", "stopped");
67 setData("Artist", m_player
->artist());
68 setData("Album", m_player
->album());
69 setData("Title", m_player
->title());
70 setData("Track number", m_player
->trackNumber());
71 setData("Comment", m_player
->comment());
72 setData("Genre", m_player
->genre());
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"