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 "playercontrol.h"
21
#include "playeractionjob.h"
25
PlayerControl::PlayerControl(QObject* parent, Player::Ptr player)
26
: Plasma::Service(parent),
29
setObjectName( QLatin1String("nowplaying controller" ));
30
setName("nowplaying");
32
setDestination(m_player->name());
33
setObjectName( QLatin1String("nowplaying controller for" ) + m_player->name());
34
kDebug() << "Created a player control for" << m_player->name();
36
kDebug() << "Created a dead player control";
38
updateEnabledOperations();
41
void PlayerControl::updateEnabledOperations()
45
kDebug() << "Updating operations:"
46
<< "\n Play:" << m_player->canPlay()
47
<< "\n Pause:" << m_player->canPause()
48
<< "\n Stop:" << m_player->canStop()
49
<< "\n Next:" << m_player->canGoNext()
50
<< "\n Previous:" << m_player->canGoPrevious()
51
<< "\n Volume:" << m_player->canSetVolume()
52
<< "\n Seek:" << m_player->canSeek();
54
setOperationEnabled("play", m_player->canPlay());
55
setOperationEnabled("pause", m_player->canPause());
56
setOperationEnabled("stop", m_player->canStop());
57
setOperationEnabled("next", m_player->canGoNext());
58
setOperationEnabled("previous", m_player->canGoPrevious());
59
setOperationEnabled("volume", m_player->canSetVolume());
60
setOperationEnabled("seek", m_player->canSeek());
62
kDebug() << "No player";
66
Plasma::ServiceJob* PlayerControl::createJob(const QString& operation,
67
QMap<QString,QVariant>& parameters)
69
kDebug() << "Job" << operation << "with arguments" << parameters << "requested";
70
return new PlayerActionJob(m_player, operation, parameters, this);
73
#include "playercontrol.moc"
75
// vim: sw=4 sts=4 et tw=100