• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KMediaPlayer

  • interfaces
  • kmediaplayer
player.h
Go to the documentation of this file.
1// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
17// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19//
20// Except as contained in this notice, the name(s) of the author(s) shall not be
21// used in advertising or otherwise to promote the sale, use or other dealings
22// in this Software without prior written authorization from the author(s).
23
24#ifndef KMEDIAPLAYERPLAYER_H
25#define KMEDIAPLAYERPLAYER_H
26
27#include <kparts/part.h>
28#include <kmediaplayer/view.h>
29
32namespace KMediaPlayer
33{
34
45class KMEDIAPLAYER_EXPORT Player : public KParts::ReadOnlyPart
46{
47Q_OBJECT
48Q_PROPERTY(bool hasLength READ hasLength)
49Q_PROPERTY(qlonglong length READ length)
50Q_PROPERTY(bool looping READ isLooping WRITE setLooping)
51Q_PROPERTY(qlonglong position READ position)
52Q_PROPERTY(bool seekable READ isSeekable)
53Q_PROPERTY(int state READ state WRITE setState)
54
55public:
59 Player(QObject *parent);
60
64 Player(QWidget *parentWidget, const char *widgetName, QObject *parent );
65
66 virtual ~Player(void);
67
71 virtual View *view(void) = 0;
72
73public Q_SLOTS:
75 virtual void pause(void) = 0;
76
78 virtual void play(void) = 0;
79
81 virtual void stop(void) = 0;
82
87 virtual void seek(qlonglong msec) = 0;
88public:
90 virtual bool isSeekable(void) const = 0;
91
93 virtual qlonglong position(void) const = 0;
94
97 virtual bool hasLength(void) const = 0;
98
100 virtual qlonglong length(void) const = 0;
101
102public Q_SLOTS:
106 void setLooping(bool);
107public:
109 bool isLooping(void) const;
110Q_SIGNALS:
112 void loopingChanged(bool);
113
114public:
116 enum State
117 {
119 Empty,
121 Stop,
123 Pause,
125 Play
126 };
128 int state(void) const;
129Q_SIGNALS:
131 void stateChanged(int);
132
133protected Q_SLOTS:
136 void setState(int);
137
138protected:
139 /* Enable the stateChanged(QString&, ...) method that was hidden by
140 the stateChanged(int) signal */
141 using KXMLGUIClient::stateChanged;
142
143private:
144 bool currentLooping;
145 State currentState;
146
147 struct Data;
148 Data *d;
149};
150
151}
152
153#endif
KMediaPlayer::Player
Player is the center of the KMediaPlayer interface.
Definition: player.h:46
KMediaPlayer::Player::loopingChanged
void loopingChanged(bool)
Emitted when the looping state is changed.
KMediaPlayer::Player::length
virtual qlonglong length(void) const =0
Returns the length of the current track.
KMediaPlayer::Player::position
virtual qlonglong position(void) const =0
Returns the current playback position in the track.
KMediaPlayer::Player::isSeekable
virtual bool isSeekable(void) const =0
Returns whether the current track honors seek requests.
KMediaPlayer::Player::seek
virtual void seek(qlonglong msec)=0
Move the current playback position to the specified time in milliseconds, if the track is seekable.
KMediaPlayer::Player::pause
virtual void pause(void)=0
Pause playback of the media track.
KMediaPlayer::Player::State
State
The possible states of the Player.
Definition: player.h:117
KMediaPlayer::Player::Stop
@ Stop
Not playing.
Definition: player.h:121
KMediaPlayer::Player::Empty
@ Empty
No track is loaded.
Definition: player.h:119
KMediaPlayer::Player::Pause
@ Pause
Playing is temporarily suspended.
Definition: player.h:123
KMediaPlayer::Player::play
virtual void play(void)=0
Begin playing the media track.
KMediaPlayer::Player::stop
virtual void stop(void)=0
Stop playback of the media track and return to the beginning.
KMediaPlayer::Player::stateChanged
void stateChanged(int)
Emitted when the state changes.
KMediaPlayer::Player::view
virtual View * view(void)=0
A convenience function returning a pointer to the View for this Player, or 0 if this Player has no GU...
KMediaPlayer::Player::hasLength
virtual bool hasLength(void) const =0
Returns whether the current track has a length.
KMediaPlayer::Player::state
int state(void) const
Return the current state of the player.
KMediaPlayer::View
View is part of the user interface of a Player.
Definition: view.h:35
KParts::ReadOnlyPart
KXMLGUIClient::stateChanged
virtual void stateChanged(const QString &newstate, ReverseStateChange reverse=StateNoReverse)
QObject
QWidget
KMediaPlayer
KMediaPlayer contains an interface to reusable media player components.
Definition: player.h:33
part.h
view.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMediaPlayer

Skip menu "KMediaPlayer"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal