author | harlekin <harlekin> | 2002-07-03 15:42:34 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-03 15:42:34 (UTC) |
commit | 3035c46ce448317f786d974094f78ce43e594a57 (patch) (unidiff) | |
tree | f0c84f34ee2ecbae4d00ed6cfde3cb955802a470 | |
parent | e1e4956ec7ffa9a07f98b03e831f0f9627556a6c (diff) | |
download | opie-3035c46ce448317f786d974094f78ce43e594a57.zip opie-3035c46ce448317f786d974094f78ce43e594a57.tar.gz opie-3035c46ce448317f786d974094f78ce43e594a57.tar.bz2 |
even more code cleanups .-)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 195 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 75 |
4 files changed, 227 insertions, 67 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 1b0de5d..125fd72 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -57,4 +57,2 @@ void Ticker::drawContents( QPainter *p ) { | |||
57 | 57 | ||
58 | |||
59 | |||
60 | struct MediaButton { | 58 | struct MediaButton { |
@@ -66,4 +64,2 @@ struct MediaButton { | |||
66 | 64 | ||
67 | |||
68 | |||
69 | // Layout information for the audioButtons (and if it is a toggle button or not) | 65 | // Layout information for the audioButtons (and if it is a toggle button or not) |
@@ -85,4 +81,3 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | |||
85 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 81 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
86 | QWidget( parent, name, f ) | 82 | QWidget( parent, name, f ) { |
87 | { | ||
88 | setCaption( tr("OpiePlayer - Audio") ); | 83 | setCaption( tr("OpiePlayer - Audio") ); |
@@ -129,6 +124,4 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
129 | setPlaying( mediaPlayerState->playing() ); | 124 | setPlaying( mediaPlayerState->playing() ); |
130 | |||
131 | } | 125 | } |
132 | 126 | ||
133 | |||
134 | AudioWidget::~AudioWidget() { | 127 | AudioWidget::~AudioWidget() { |
@@ -158,3 +151,2 @@ void AudioWidget::sliderReleased() { | |||
158 | 151 | ||
159 | |||
160 | void AudioWidget::setPosition( long i ) { | 152 | void AudioWidget::setPosition( long i ) { |
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 687aff6..c13ea63 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp | |||
@@ -13,9 +13,9 @@ | |||
13 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 13 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
14 | : QDialog( parent, name, modal, fl ) | 14 | : QDialog( parent, name, modal, fl ) { |
15 | { | 15 | if ( !name ) { |
16 | if ( !name ) | 16 | setName( "InputDialog" ); |
17 | setName( "InputDialog" ); | 17 | } |
18 | resize( 234, 115); | 18 | resize( 234, 115); |
19 | setMaximumSize( QSize( 240, 40)); | 19 | setMaximumSize( QSize( 240, 40)); |
20 | setCaption( tr(name ) ); | 20 | setCaption( tr( name ) ); |
21 | 21 | ||
@@ -32,6 +32,4 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags | |||
32 | */ | 32 | */ |
33 | InputDialog::~InputDialog() | 33 | InputDialog::~InputDialog() { |
34 | { | ||
35 | inputText= LineEdit1->text(); | 34 | inputText= LineEdit1->text(); |
36 | |||
37 | } | 35 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index d1d30e4..2f24b00 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -19,3 +19,3 @@ | |||
19 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 19 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
20 | : QObject( parent, name ), decoder( NULL ) { | 20 | : QObject( parent, name ) { |
21 | Config cfg( "OpiePlayer" ); | 21 | Config cfg( "OpiePlayer" ); |
@@ -57,13 +57,188 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
57 | 57 | ||
58 | struct MediaPlayerPlugin { | ||
59 | #ifndef QT_NO_COMPONENT | ||
60 | QLibrary *library; | ||
61 | #endif | ||
62 | MediaPlayerPluginInterface *iface; | ||
63 | MediaPlayerDecoder *decoder; | ||
64 | MediaPlayerEncoder *encoder; | ||
65 | }; | ||
66 | 58 | ||
67 | 59 | ||
68 | static QValueList<MediaPlayerPlugin> pluginList; | 60 | // public stuff |
61 | bool MediaPlayerState::fullscreen() { | ||
62 | return isFullscreen; | ||
63 | } | ||
64 | |||
65 | bool MediaPlayerState::scaled() { | ||
66 | return isScaled; | ||
67 | } | ||
68 | |||
69 | bool MediaPlayerState::looping() { | ||
70 | return isLooping; | ||
71 | } | ||
72 | |||
73 | bool MediaPlayerState::shuffled() { | ||
74 | return isShuffled; | ||
75 | } | ||
76 | |||
77 | |||
78 | bool MediaPlayerState:: playlist() { | ||
79 | return usePlaylist; | ||
80 | } | ||
81 | |||
82 | bool MediaPlayerState::paused() { | ||
83 | return isPaused; | ||
84 | } | ||
85 | |||
86 | bool MediaPlayerState::playing() { | ||
87 | return isPlaying; | ||
88 | } | ||
89 | |||
90 | long MediaPlayerState::position() { | ||
91 | return curPosition; | ||
92 | } | ||
93 | |||
94 | long MediaPlayerState::length() { | ||
95 | return curLength; | ||
96 | } | ||
97 | |||
98 | char MediaPlayerState::view() { | ||
99 | return curView; | ||
100 | } | ||
101 | |||
102 | // slots | ||
103 | void MediaPlayerState::setFullscreen( bool b ) { | ||
104 | if ( isFullscreen == b ) { | ||
105 | return; | ||
106 | } | ||
107 | isFullscreen = b; | ||
108 | emit fullscreenToggled(b); | ||
109 | } | ||
110 | |||
111 | |||
112 | void MediaPlayerState::setScaled( bool b ) { | ||
113 | if ( isScaled == b ) { | ||
114 | return; | ||
115 | } | ||
116 | isScaled = b; | ||
117 | emit scaledToggled(b); | ||
118 | } | ||
119 | |||
120 | void MediaPlayerState::setLooping( bool b ) { | ||
121 | if ( isLooping == b ) { | ||
122 | return; | ||
123 | } | ||
124 | isLooping = b; | ||
125 | emit loopingToggled(b); | ||
126 | } | ||
127 | |||
128 | void MediaPlayerState::setShuffled( bool b ) { | ||
129 | if ( isShuffled == b ) { | ||
130 | return; | ||
131 | } | ||
132 | isShuffled = b; | ||
133 | emit shuffledToggled(b); | ||
134 | } | ||
135 | |||
136 | void MediaPlayerState::setPlaylist( bool b ) { | ||
137 | if ( usePlaylist == b ) { | ||
138 | return; | ||
139 | } | ||
140 | usePlaylist = b; | ||
141 | emit playlistToggled(b); | ||
142 | } | ||
143 | |||
144 | void MediaPlayerState::setPaused( bool b ) { | ||
145 | if ( isPaused == b ) { | ||
146 | return; | ||
147 | } | ||
148 | isPaused = b; | ||
149 | emit pausedToggled(b); | ||
150 | } | ||
151 | |||
152 | void MediaPlayerState::setPlaying( bool b ) { | ||
153 | if ( isPlaying == b ) { | ||
154 | return; | ||
155 | } | ||
156 | isPlaying = b; | ||
157 | emit playingToggled(b); | ||
158 | } | ||
159 | |||
160 | void MediaPlayerState::setPosition( long p ) { | ||
161 | if ( curPosition == p ) { | ||
162 | return; | ||
163 | } | ||
164 | curPosition = p; | ||
165 | emit positionChanged(p); | ||
166 | } | ||
167 | |||
168 | void MediaPlayerState::updatePosition( long p ){ | ||
169 | if ( curPosition == p ) { | ||
170 | return; | ||
171 | } | ||
172 | curPosition = p; | ||
173 | emit positionUpdated(p); | ||
174 | } | ||
175 | |||
176 | void MediaPlayerState::setLength( long l ) { | ||
177 | if ( curLength == l ) { | ||
178 | return; | ||
179 | } | ||
180 | curLength = l; | ||
181 | emit lengthChanged(l); | ||
182 | } | ||
183 | |||
184 | void MediaPlayerState::setView( char v ) { | ||
185 | if ( curView == v ) { | ||
186 | return; | ||
187 | } | ||
188 | curView = v; | ||
189 | emit viewChanged(v); | ||
190 | } | ||
191 | |||
192 | void MediaPlayerState::setPrev(){ | ||
193 | emit prev(); | ||
194 | } | ||
195 | |||
196 | void MediaPlayerState::setNext() { | ||
197 | emit next(); | ||
198 | } | ||
199 | |||
200 | void MediaPlayerState::setList() { | ||
201 | setPlaying( FALSE ); | ||
202 | setView('l'); | ||
203 | } | ||
204 | |||
205 | void MediaPlayerState::setVideo() { | ||
206 | setView('v'); | ||
207 | } | ||
208 | |||
209 | void MediaPlayerState::setAudio() { | ||
210 | setView('a'); | ||
211 | } | ||
212 | |||
213 | |||
214 | |||
215 | void MediaPlayerState::toggleFullscreen() { | ||
216 | setFullscreen( !isFullscreen ); | ||
217 | } | ||
218 | |||
219 | void MediaPlayerState::toggleScaled() { | ||
220 | setScaled( !isScaled); | ||
221 | } | ||
222 | |||
223 | void MediaPlayerState::toggleLooping() { | ||
224 | setLooping( !isLooping); | ||
225 | } | ||
226 | |||
227 | void MediaPlayerState::toggleShuffled() { | ||
228 | setShuffled( !isShuffled); | ||
229 | } | ||
230 | |||
231 | void MediaPlayerState::togglePlaylist() { | ||
232 | setPlaylist( !usePlaylist); | ||
233 | } | ||
234 | |||
235 | void MediaPlayerState::togglePaused() { | ||
236 | setPaused( !isPaused); | ||
237 | } | ||
238 | |||
239 | void MediaPlayerState::togglePlaying() { | ||
240 | setPlaying( !isPlaying); | ||
241 | } | ||
242 | |||
243 | |||
69 | 244 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 8a64939..7aa0ff2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -19,42 +19,39 @@ public: | |||
19 | bool isStreaming; | 19 | bool isStreaming; |
20 | bool fullscreen() { return isFullscreen; } | 20 | bool fullscreen(); |
21 | bool scaled() { return isScaled; } | 21 | bool scaled(); |
22 | bool looping() { return isLooping; } | 22 | bool looping(); |
23 | bool shuffled() { return isShuffled; } | 23 | bool shuffled(); |
24 | bool playlist() { return usePlaylist; } | 24 | bool playlist(); |
25 | bool paused() { return isPaused; } | 25 | bool paused(); |
26 | bool playing() { return isPlaying; } | 26 | bool playing(); |
27 | long position() { return curPosition; } | 27 | long position(); |
28 | long length() { return curLength; } | 28 | long length(); |
29 | char view() { return curView; } | 29 | char view(); |
30 | |||
31 | MediaPlayerDecoder *newDecoder( const QString& file ); | ||
32 | MediaPlayerDecoder *curDecoder(); | ||
33 | 30 | ||
34 | public slots: | 31 | public slots: |
35 | void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); } | 32 | void setFullscreen( bool b ); |
36 | void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); } | 33 | void setScaled( bool b ); |
37 | void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } | 34 | void setLooping( bool b ); |
38 | void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } | 35 | void setShuffled( bool b ); |
39 | void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } | 36 | void setPlaylist( bool b ); |
40 | void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } | 37 | void setPaused( bool b ); |
41 | void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } | 38 | void setPlaying( bool b ); |
42 | void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); } | 39 | void setPosition( long p ); |
43 | void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); } | 40 | void updatePosition( long p ); |
44 | void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); } | 41 | void setLength( long l ); |
45 | void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); } | 42 | void setView( char v ); |
46 | 43 | ||
47 | void setPrev() { emit prev(); } | 44 | void setPrev() ; |
48 | void setNext() { emit next(); } | 45 | void setNext(); |
49 | void setList() { setPlaying( FALSE ); setView('l'); } | 46 | void setList(); |
50 | void setVideo() { setView('v'); } | 47 | void setVideo(); |
51 | void setAudio() { setView('a'); } | 48 | void setAudio(); |
52 | 49 | ||
53 | void toggleFullscreen() { setFullscreen( !isFullscreen ); } | 50 | void toggleFullscreen(); |
54 | void toggleScaled() { setScaled( !isScaled); } | 51 | void toggleScaled(); |
55 | void toggleLooping() { setLooping( !isLooping); } | 52 | void toggleLooping(); |
56 | void toggleShuffled() { setShuffled( !isShuffled); } | 53 | void toggleShuffled(); |
57 | void togglePlaylist() { setPlaylist( !usePlaylist); } | 54 | void togglePlaylist(); |
58 | void togglePaused() { setPaused( !isPaused); } | 55 | void togglePaused(); |
59 | void togglePlaying() { setPlaying( !isPlaying); } | 56 | void togglePlaying(); |
60 | 57 | ||
@@ -88,4 +85,2 @@ private: | |||
88 | 85 | ||
89 | MediaPlayerDecoder *decoder; | ||
90 | |||
91 | void readConfig( Config& cfg ); | 86 | void readConfig( Config& cfg ); |