• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

playercontrol.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2008  Alex Merry <alex.merry@kdemail.net>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00017  * Boston, MA  02110-1301  USA
00018  */
00019 
00020 #include "playercontrol.h"
00021 #include "playeractionjob.h"
00022 
00023 #include <kdebug.h>
00024 
00025 PlayerControl::PlayerControl(QObject* parent, Player::Ptr player)
00026     : Plasma::Service(parent),
00027       m_player(player)
00028 {
00029     setObjectName("nowplaying controller");
00030     setName("nowplaying");
00031     if (m_player) {
00032         setDestination(m_player->name());
00033         setObjectName("nowplaying controller for" + m_player->name());
00034         kDebug() << "Created a player control for" << m_player->name();
00035     } else {
00036         kDebug() << "Created a dead player control";
00037     }
00038     updateEnabledOperations();
00039 }
00040 
00041 void PlayerControl::updateEnabledOperations()
00042 {
00043     if (m_player) {
00044         /*
00045         kDebug() << "Updating operations:"
00046                  << "\n    Play:" << m_player->canPlay()
00047                  << "\n    Pause:" << m_player->canPause()
00048                  << "\n    Stop:" << m_player->canStop()
00049                  << "\n    Next:" << m_player->canGoNext()
00050                  << "\n    Previous:" << m_player->canGoPrevious()
00051                  << "\n    Volume:" << m_player->canSetVolume()
00052                  << "\n    Seek:" << m_player->canSeek();
00053                  */
00054         setOperationEnabled("play", m_player->canPlay());
00055         setOperationEnabled("pause", m_player->canPause());
00056         setOperationEnabled("stop", m_player->canStop());
00057         setOperationEnabled("next", m_player->canGoNext());
00058         setOperationEnabled("previous", m_player->canGoPrevious());
00059         setOperationEnabled("volume", m_player->canSetVolume());
00060         setOperationEnabled("seek", m_player->canSeek());
00061     } else {
00062         kDebug() << "No player";
00063     }
00064 }
00065 
00066 Plasma::ServiceJob* PlayerControl::createJob(const QString& operation,
00067                                              QMap<QString,QVariant>& parameters)
00068 {
00069     kDebug() << "Job" << operation << "with arguments" << parameters << "requested";
00070     return new PlayerActionJob(m_player, operation, parameters, this);
00071 }
00072 
00073 #include "playercontrol.moc"
00074 
00075 // vim: sw=4 sts=4 et tw=100

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal