KMediaPlayer::Player

#include <player.h>

Inheritance diagram for KMediaPlayer::Player:

Public Types

enum  State { Empty, Stop, Pause, Play }
 

Properties

bool hasLength
 
qlonglong length
 
bool looping
 
qlonglong position
 
bool seekable
 
State state
 
- Properties inherited from QObject
 objectName
 

Signals

void loopingChanged (bool isLooping)
 
void stateChanged (KMediaPlayer::Player::State newState)
 
- Signals inherited from KParts::ReadOnlyPart
void canceled (const QString &errMsg)
 
void completed ()
 
void completed (bool pendingAction)
 
void started (KIO::Job *job)
 
void urlChanged (const QUrl &url)
 
- Signals inherited from KParts::Part
void setStatusBarText (const QString &text)
 
void setWindowCaption (const QString &caption)
 

Public Slots

virtual void pause ()=0
 
virtual void play ()=0
 
virtual void seek (qlonglong msec)=0
 
void setLooping (bool on)
 
virtual void stop ()=0
 
- Public Slots inherited from KParts::ReadOnlyPart
virtual bool openUrl (const QUrl &url)
 

Public Member Functions

 Player (QObject *parent)
 
 Player (QWidget *parentWidget, const char *widgetName, QObject *parent)
 
virtual ~Player ()
 
virtual bool hasLength () const =0
 
bool isLooping () const
 
virtual bool isSeekable () const =0
 
virtual qlonglong length () const =0
 
virtual qlonglong position () const =0
 
State state () const
 
virtual Viewview ()=0
 
- Public Member Functions inherited from KParts::ReadOnlyPart
 ReadOnlyPart (QObject *parent=nullptr)
 
OpenUrlArguments arguments () const
 
BrowserExtensionbrowserExtension () const
 
bool closeStream ()
 
virtual bool closeUrl ()
 
bool isProgressInfoEnabled () const
 
bool openStream (const QString &mimeType, const QUrl &url)
 
void setArguments (const OpenUrlArguments &arguments)
 
void setProgressInfoEnabled (bool show)
 
void showProgressInfo (bool show)
 
QUrl url () const
 
bool writeStream (const QByteArray &data)
 
- Public Member Functions inherited from KParts::Part
 Part (QObject *parent=nullptr)
 
virtual void embed (QWidget *parentWidget)
 
virtual ParthitTest (QWidget *widget, const QPoint &globalPos)
 
KIconLoadericonLoader ()
 
bool isSelectable () const
 
PartManagermanager () const
 
void setAutoDeletePart (bool autoDeletePart)
 
void setAutoDeleteWidget (bool autoDeleteWidget)
 
virtual void setManager (PartManager *manager)
 
virtual void setSelectable (bool selectable)
 
virtual QWidgetwidget ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Member Functions inherited from KParts::PartBase
void setPartObject (QObject *object)
 
- Public Member Functions inherited from KXMLGUIClient
 KXMLGUIClient (KXMLGUIClient *parent)
 
QActionaction (const char *name) const
 
virtual QActionaction (const QDomElement &element) const
 
virtual KActionCollectionactionCollection () const
 
QList< KXMLGUIClient * > childClients ()
 
KXMLGUIBuilderclientBuilder () const
 
virtual QString componentName () const
 
virtual QDomDocument domDocument () const
 
KXMLGUIFactoryfactory () const
 
void insertChildClient (KXMLGUIClient *child)
 
KXMLGUIClientparentClient () const
 
void plugActionList (const QString &name, const QList< QAction * > &actionList)
 
void reloadXML ()
 
void removeChildClient (KXMLGUIClient *child)
 
void replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false)
 
void setClientBuilder (KXMLGUIBuilder *builder)
 
void setFactory (KXMLGUIFactory *factory)
 
void setXMLGUIBuildDocument (const QDomDocument &doc)
 
void unplugActionList (const QString &name)
 
virtual QString xmlFile () const
 
QDomDocument xmlguiBuildDocument () const
 

Protected Slots

void setState (State state)
 
- Protected Slots inherited from KParts::Part
void slotWidgetDestroyed ()
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from KXMLGUIClient
static QString findVersionNumber (const QString &xml)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Types inherited from KParts::PartBase
enum  PluginLoadingMode
 
- Protected Member Functions inherited from KParts::ReadOnlyPart
void abortLoad ()
 
virtual bool doCloseStream ()
 
virtual bool doOpenStream (const QString &mimeType)
 
virtual bool doWriteStream (const QByteArray &data)
 
void guiActivateEvent (GUIActivateEvent *event) override
 
bool isLocalFileTemporary () const
 
QString localFilePath () const
 
virtual bool openFile ()
 
void setLocalFilePath (const QString &localFilePath)
 
void setLocalFileTemporary (bool temp)
 
void setUrl (const QUrl &url)
 
- Protected Member Functions inherited from KParts::Part
void customEvent (QEvent *event) override
 
QWidgethostContainer (const QString &containerName)
 
void loadPlugins ()
 
virtual void partActivateEvent (PartActivateEvent *event)
 
virtual void partSelectEvent (PartSelectEvent *event)
 
virtual void setWidget (QWidget *widget)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KParts::PartBase
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
virtual void setComponentData (const KAboutData &componentData)
 
virtual void setComponentData (const KAboutData &pluginData, bool loadPlugins)
 
void setPluginInterfaceVersion (int version)
 
void setPluginLoadingMode (PluginLoadingMode loadingMode)
 
- Protected Member Functions inherited from KXMLGUIClient
void loadStandardsXmlFile ()
 
virtual void setComponentName (const QString &componentName, const QString &componentDisplayName)
 
virtual void setDOMDocument (const QDomDocument &document, bool merge=false)
 
virtual void setLocalXMLFile (const QString &file)
 
virtual void setXML (const QString &document, bool merge=false)
 
virtual void setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true)
 
virtual void stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse)
 
- Static Protected Member Functions inherited from KXMLGUIClient
static QString standardsXmlFileLocation ()
 
- Protected Attributes inherited from KParts::PartBase
 DoNotLoadPlugins
 
 LoadPlugins
 
 LoadPluginsIfEnabled
 

Detailed Description

KPart interface to allow controlling and querying playback of a media track.

This class provides methods to control playback of a single media track, as well as providing information on the current playback state. It can optionally provide access to a user interface that can be displayed to the user.

There are two servicetypes for this KParts interface: KMediaPlayer/Player and KMediaPlayer/Engine. KMediaPlayer/Player provides a user interface (see view()), while KMediaPlayer/Engine just provides direct control via this class.

Definition at line 51 of file player.h.

Member Enumeration Documentation

The possible states of the player.

Enumerator
Empty 

No track is loaded.

Most functions will not work in this state.

Stop 

A track is loaded, but playback is stopped.

The position should always be 0 in this state. Playback will start from the beginning when play() is called.

Pause 

Playback is temporarily suspended.

Playback will resume from the current position when play() is called.

Play 

The media is currently being output.

Definition at line 202 of file player.h.

Property Documentation

bool KMediaPlayer::Player::hasLength
read

Whether the length property is valid.

Not all media tracks have a length (for example, some streams are continuous).

Definition at line 61 of file player.h.

qlonglong KMediaPlayer::Player::length
read

The length of the media track in milliseconds.

The value is undefined if hasLength is false.

Definition at line 67 of file player.h.

bool KMediaPlayer::Player::looping
readwrite

Whether playback should loop.

As this interface has no concept of a playlist, this indicates whether the current media track will play repeatedly.

Definition at line 74 of file player.h.

qlonglong KMediaPlayer::Player::position
read

The position in the media track in milliseconds.

Definition at line 78 of file player.h.

bool KMediaPlayer::Player::seekable
read

Whether seek() can be expected to work on the current media track.

Some streams cannot be seeked.

Definition at line 84 of file player.h.

KMediaPlayer::Player::State KMediaPlayer::Player::state
readwrite

The current state of the player.

Definition at line 88 of file player.h.

Constructor & Destructor Documentation

KMediaPlayer::Player::Player ( QObject parent)
explicit

Constructs a Player instance with no associated GUI.

This should be used when a KMediaPlayer/Engine is requested.

Definition at line 53 of file player.cpp.

KMediaPlayer::Player::Player ( QWidget parentWidget,
const char *  widgetName,
QObject parent 
)

Constructs a Player instance with a GUI.

This should be used when a KMediaPlayer/Player is requested.

Definition at line 46 of file player.cpp.

KMediaPlayer::Player::~Player ( )
virtual

Cleans up any associated resources.

This should not explicitly delete any widget returned by view(): if it has been reparented, it is up to the caller to dispose of it properly.

Definition at line 60 of file player.cpp.

Member Function Documentation

virtual bool KMediaPlayer::Player::hasLength ( ) const
pure virtual

Returns whether the current media track has a length.

bool KMediaPlayer::Player::isLooping ( ) const

Returns whether playback will loop.

Definition at line 73 of file player.cpp.

virtual bool KMediaPlayer::Player::isSeekable ( ) const
pure virtual

Returns whether seek() can be expected to work on the current media track.

virtual qlonglong KMediaPlayer::Player::length ( ) const
pure virtual

Returns the length of the current media track.

The returned value is undefined if hasLength() returns false.

void KMediaPlayer::Player::loopingChanged ( bool  isLooping)
signal

Indicates that the value of isLooping() has changed.

Parameters
isLoopingThe new value.
virtual void KMediaPlayer::Player::pause ( )
pure virtualslot

Pauses playback of the media track.

If the media track is not already paused, this should have no effect.

virtual void KMediaPlayer::Player::play ( )
pure virtualslot

Starts playing the media track.

If the media track is already playing, this should have no effect.

virtual qlonglong KMediaPlayer::Player::position ( ) const
pure virtual

Returns the current playback position in milliseconds.

virtual void KMediaPlayer::Player::seek ( qlonglong  msec)
pure virtualslot

Moves the current playback position.

This will have no effect if isSeekable() is false.

Parameters
msecThe new playback position in milliseconds.
void KMediaPlayer::Player::setLooping ( bool  on)
slot

Sets whether playback should loop.

Parameters
onIf true, playback will resume from the start of the track when the end is reached; if false it will not.

Definition at line 65 of file player.cpp.

void KMediaPlayer::Player::setState ( State  state)
protectedslot

Sets the current state.

This allows implementors to alter the playback state. This will emit the stateChanged() signal as appropriate.

Definition at line 78 of file player.cpp.

State KMediaPlayer::Player::state ( ) const

Returns the current state of the player.

void KMediaPlayer::Player::stateChanged ( KMediaPlayer::Player::State  newState)
signal

Indicates that the value returned by state() has changed.

Parameters
newStateThe new value.
virtual void KMediaPlayer::Player::stop ( )
pure virtualslot

Stops playback of the media track and returns it to the beginning.

virtual View* KMediaPlayer::Player::view ( )
pure virtual

Returns the widget associated with this player.

If the part's service type is KMediaPlayer/Player, this should not return 0. However, if the part's service is just KMediaPlayer/Engine, this may return 0.

Returns
A widget to view and control this Player instance, or 0 if there is no GUI.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:44:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.