KMediaPlayer
player.h
Go to the documentation of this file.
00001 // Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com> 00002 // 00003 // Permission is hereby granted, free of charge, to any person obtaining a copy 00004 // of this software and associated documentation files (the "Software"), to deal 00005 // in the Software without restriction, including without limitation the rights 00006 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 // copies of the Software, and to permit persons to whom the Software is 00008 // furnished to do so, subject to the following conditions: 00009 // 00010 // The above copyright notice and this permission notice shall be included in 00011 // all copies or substantial portions of the Software. 00012 // 00013 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00017 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00018 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00019 // 00020 // Except as contained in this notice, the name(s) of the author(s) shall not be 00021 // used in advertising or otherwise to promote the sale, use or other dealings 00022 // in this Software without prior written authorization from the author(s). 00023 00024 #ifndef KMEDIAPLAYERPLAYER_H 00025 #define KMEDIAPLAYERPLAYER_H 00026 00027 #include <kparts/part.h> 00028 #include <kmediaplayer/view.h> 00029 00032 namespace KMediaPlayer 00033 { 00034 00045 class KMEDIAPLAYER_EXPORT Player : public KParts::ReadOnlyPart 00046 { 00047 Q_OBJECT 00048 Q_PROPERTY(bool hasLength READ hasLength) 00049 Q_PROPERTY(qlonglong length READ length) 00050 Q_PROPERTY(bool looping READ isLooping WRITE setLooping) 00051 Q_PROPERTY(qlonglong position READ position) 00052 Q_PROPERTY(bool seekable READ isSeekable) 00053 Q_PROPERTY(int state READ state WRITE setState) 00054 00055 public: 00059 Player(QObject *parent); 00060 00064 Player(QWidget *parentWidget, const char *widgetName, QObject *parent ); 00065 00066 virtual ~Player(void); 00067 00071 virtual View *view(void) = 0; 00072 00073 public Q_SLOTS: 00075 virtual void pause(void) = 0; 00076 00078 virtual void play(void) = 0; 00079 00081 virtual void stop(void) = 0; 00082 00087 virtual void seek(qlonglong msec) = 0; 00088 public: 00090 virtual bool isSeekable(void) const = 0; 00091 00093 virtual qlonglong position(void) const = 0; 00094 00097 virtual bool hasLength(void) const = 0; 00098 00100 virtual qlonglong length(void) const = 0; 00101 00102 public Q_SLOTS: 00106 void setLooping(bool); 00107 public: 00109 bool isLooping(void) const; 00110 Q_SIGNALS: 00112 void loopingChanged(bool); 00113 00114 public: 00116 enum State 00117 { 00119 Empty, 00121 Stop, 00123 Pause, 00125 Play 00126 }; 00128 int state(void) const; 00129 Q_SIGNALS: 00131 void stateChanged(int); 00132 00133 protected Q_SLOTS: 00136 void setState(int); 00137 00138 protected: 00139 /* Enable the stateChanged(QString&, ...) method that was hidden by 00140 the stateChanged(int) signal */ 00141 using KXMLGUIClient::stateChanged; 00142 00143 private: 00144 bool currentLooping; 00145 State currentState; 00146 00147 struct Data; 00148 Data *d; 00149 }; 00150 00151 } 00152 00153 #endif
KDE 4.6 API Reference