summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 4ec5989..0b33dfd 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -31,145 +31,159 @@
31 31
32*/ 32*/
33 33
34// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qlibrary.h> 37#include <qpe/qlibrary.h>
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <qvaluelist.h> 39#include <qvaluelist.h>
40#include <qobject.h> 40#include <qobject.h>
41#include <qdir.h> 41#include <qdir.h>
42#include "mediaplayerstate.h" 42#include "mediaplayerstate.h"
43 43
44 44
45 45
46//#define MediaPlayerDebug(x) qDebug x 46//#define MediaPlayerDebug(x) qDebug x
47#define MediaPlayerDebug(x) 47#define MediaPlayerDebug(x)
48 48
49 49
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
51 : QObject( parent, name ) { 51 : QObject( parent, name ) {
52 Config cfg( "OpiePlayer" ); 52 Config cfg( "OpiePlayer" );
53 readConfig( cfg ); 53 readConfig( cfg );
54 isStreaming = false; 54 isStreaming = false;
55 isSeekable = true;
55} 56}
56 57
57 58
58MediaPlayerState::~MediaPlayerState() { 59MediaPlayerState::~MediaPlayerState() {
59} 60}
60 61
61 62
62void MediaPlayerState::readConfig( Config& cfg ) { 63void MediaPlayerState::readConfig( Config& cfg ) {
63 cfg.setGroup("Options"); 64 cfg.setGroup("Options");
64 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 65 isFullscreen = cfg.readBoolEntry( "FullScreen" );
65 isScaled = cfg.readBoolEntry( "Scaling" ); 66 isScaled = cfg.readBoolEntry( "Scaling" );
66 isLooping = cfg.readBoolEntry( "Looping" ); 67 isLooping = cfg.readBoolEntry( "Looping" );
67 isShuffled = cfg.readBoolEntry( "Shuffle" ); 68 isShuffled = cfg.readBoolEntry( "Shuffle" );
68 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 69 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
69 videoGamma = cfg.readNumEntry( "VideoGamma" ); 70 videoGamma = cfg.readNumEntry( "VideoGamma" );
70 usePlaylist = TRUE; 71 usePlaylist = TRUE;
71 isPlaying = FALSE; 72 isPlaying = FALSE;
72 isStreaming = FALSE; 73 isStreaming = FALSE;
73 isPaused = FALSE; 74 isPaused = FALSE;
74 curPosition = 0; 75 curPosition = 0;
75 curLength = 0; 76 curLength = 0;
76 curView = 'l'; 77 curView = 'l';
77} 78}
78 79
79 80
80void MediaPlayerState::writeConfig( Config& cfg ) const { 81void MediaPlayerState::writeConfig( Config& cfg ) const {
81 cfg.setGroup( "Options" ); 82 cfg.setGroup( "Options" );
82 cfg.writeEntry( "FullScreen", isFullscreen ); 83 cfg.writeEntry( "FullScreen", isFullscreen );
83 cfg.writeEntry( "Scaling", isScaled ); 84 cfg.writeEntry( "Scaling", isScaled );
84 cfg.writeEntry( "Looping", isLooping ); 85 cfg.writeEntry( "Looping", isLooping );
85 cfg.writeEntry( "Shuffle", isShuffled ); 86 cfg.writeEntry( "Shuffle", isShuffled );
86 cfg.writeEntry( "UsePlayList", usePlaylist ); 87 cfg.writeEntry( "UsePlayList", usePlaylist );
87 cfg.writeEntry( "VideoGamma", videoGamma ); 88 cfg.writeEntry( "VideoGamma", videoGamma );
88} 89}
89 90
90 91
91// public stuff 92// public stuff
92 93
93 94
94bool MediaPlayerState::streaming() { 95bool MediaPlayerState::streaming() {
95 return isStreaming; 96 return isStreaming;
96} 97}
97 98
99bool MediaPlayerState::seekable() {
100 return isSeekable;
101}
102
98bool MediaPlayerState::fullscreen() { 103bool MediaPlayerState::fullscreen() {
99 return isFullscreen; 104 return isFullscreen;
100} 105}
101 106
102bool MediaPlayerState::scaled() { 107bool MediaPlayerState::scaled() {
103 return isScaled; 108 return isScaled;
104} 109}
105 110
106bool MediaPlayerState::looping() { 111bool MediaPlayerState::looping() {
107 return isLooping; 112 return isLooping;
108} 113}
109 114
110bool MediaPlayerState::shuffled() { 115bool MediaPlayerState::shuffled() {
111 return isShuffled; 116 return isShuffled;
112} 117}
113 118
114 119
115bool MediaPlayerState:: playlist() { 120bool MediaPlayerState::playlist() {
116 return usePlaylist; 121 return usePlaylist;
117} 122}
118 123
119bool MediaPlayerState::paused() { 124bool MediaPlayerState::paused() {
120 return isPaused; 125 return isPaused;
121} 126}
122 127
123bool MediaPlayerState::playing() { 128bool MediaPlayerState::playing() {
124 return isPlaying; 129 return isPlaying;
125} 130}
126 131
127bool MediaPlayerState::stop() { 132bool MediaPlayerState::stop() {
128 return isStoped; 133 return isStoped;
129} 134}
130 135
131long MediaPlayerState::position() { 136long MediaPlayerState::position() {
132 return curPosition; 137 return curPosition;
133} 138}
134 139
135long MediaPlayerState::length() { 140long MediaPlayerState::length() {
136 return curLength; 141 return curLength;
137} 142}
138 143
139char MediaPlayerState::view() { 144char MediaPlayerState::view() {
140 return curView; 145 return curView;
141} 146}
142 147
143// slots 148// slots
144void MediaPlayerState::setIsStreaming( bool b ) { 149void MediaPlayerState::setIsStreaming( bool b ) {
145 150
146 if ( isStreaming == b ) { 151 if ( isStreaming == b ) {
147 return; 152 return;
148 } 153 }
149 isStreaming = b; 154 isStreaming = b;
150} 155}
151 156
157void MediaPlayerState::setIsSeekable( bool b ) {
158
159 //if ( isSeekable == b ) {
160 // return;
161 // }
162 isSeekable = b;
163 emit isSeekableToggled(b);
164}
165
152 166
153void MediaPlayerState::setFullscreen( bool b ) { 167void MediaPlayerState::setFullscreen( bool b ) {
154 if ( isFullscreen == b ) { 168 if ( isFullscreen == b ) {
155 return; 169 return;
156 } 170 }
157 isFullscreen = b; 171 isFullscreen = b;
158 emit fullscreenToggled(b); 172 emit fullscreenToggled(b);
159} 173}
160 174
161 175
162void MediaPlayerState::setBlanked( bool b ) { 176void MediaPlayerState::setBlanked( bool b ) {
163 if ( isBlanked == b ) { 177 if ( isBlanked == b ) {
164 return; 178 return;
165 } 179 }
166 isBlanked = b; 180 isBlanked = b;
167 emit blankToggled(b); 181 emit blankToggled(b);
168} 182}
169 183
170 184
171void MediaPlayerState::setScaled( bool b ) { 185void MediaPlayerState::setScaled( bool b ) {
172 if ( isScaled == b ) { 186 if ( isScaled == b ) {
173 return; 187 return;
174 } 188 }
175 isScaled = b; 189 isScaled = b;