author | llornkcor <llornkcor> | 2002-08-03 14:19:05 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-03 14:19:05 (UTC) |
commit | aa06a62511cabebeaad1d3dda34b30640f967dea (patch) (unidiff) | |
tree | a6887240b094f46de46b743135a2e918ba3254ad | |
parent | d3c13036415713932f1706e46fa7c99ef38188df (diff) | |
download | opie-aa06a62511cabebeaad1d3dda34b30640f967dea.zip opie-aa06a62511cabebeaad1d3dda34b30640f967dea.tar.gz opie-aa06a62511cabebeaad1d3dda34b30640f967dea.tar.bz2 |
audiowidget now shows time and slider moves.
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 5 |
7 files changed, 22 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 303834a..23f4329 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -230,97 +230,97 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | delete pixUp; | 233 | delete pixUp; |
234 | delete pixDn; | 234 | delete pixDn; |
235 | } | 235 | } |
236 | 236 | ||
237 | static bool audioSliderBeingMoved = FALSE; | 237 | static bool audioSliderBeingMoved = FALSE; |
238 | 238 | ||
239 | 239 | ||
240 | void AudioWidget::sliderPressed() { | 240 | void AudioWidget::sliderPressed() { |
241 | audioSliderBeingMoved = TRUE; | 241 | audioSliderBeingMoved = TRUE; |
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
245 | void AudioWidget::sliderReleased() { | 245 | void AudioWidget::sliderReleased() { |
246 | audioSliderBeingMoved = FALSE; | 246 | audioSliderBeingMoved = FALSE; |
247 | if ( slider.width() == 0 ) | 247 | if ( slider.width() == 0 ) |
248 | return; | 248 | return; |
249 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 249 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
250 | mediaPlayerState->setPosition( val ); | 250 | mediaPlayerState->setPosition( val ); |
251 | } | 251 | } |
252 | 252 | ||
253 | void AudioWidget::setPosition( long i ) { | 253 | void AudioWidget::setPosition( long i ) { |
254 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 254 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
255 | updateSlider( i, mediaPlayerState->length() ); | 255 | updateSlider( i, mediaPlayerState->length() ); |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | void AudioWidget::setLength( long max ) { | 259 | void AudioWidget::setLength( long max ) { |
260 | updateSlider( mediaPlayerState->position(), max ); | 260 | updateSlider( mediaPlayerState->position(), max ); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void AudioWidget::setView( char view ) { | 264 | void AudioWidget::setView( char view ) { |
265 | slider.show(); | 265 | slider.show(); |
266 | 266 | ||
267 | // this isnt working for some reason | 267 | // this isnt working for some reason |
268 | 268 | ||
269 | // if ( mediaPlayerState->streaming() ) { | 269 | // if ( mediaPlayerState->streaming() ) { |
270 | // qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 270 | // qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
271 | // if( !slider.isHidden()) slider.hide(); | 271 | // if( !slider.isHidden()) slider.hide(); |
272 | // disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 272 | // disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
273 | // disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 273 | // disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
274 | // } else { | 274 | // } else { |
275 | // this stops the slider from being moved, thus | 275 | // this stops the slider from being moved, thus |
276 | // does not stop stream when it reaches the end | 276 | // does not stop stream when it reaches the end |
277 | slider.show(); | 277 | slider.show(); |
278 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 278 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
279 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 279 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
280 | // } | 280 | // } |
281 | 281 | ||
282 | if ( view == 'a' ) { | 282 | if ( view == 'a' ) { |
283 | startTimer( 150 ); | 283 | startTimer( 150 ); |
284 | showMaximized(); | 284 | showMaximized(); |
285 | } else { | 285 | } else { |
286 | killTimers(); | 286 | killTimers(); |
287 | hide(); | 287 | hide(); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | 291 | ||
292 | static QString timeAsString( long length ) { | 292 | static QString timeAsString( long length ) { |
293 | length /= 44100; | ||
294 | int minutes = length / 60; | 293 | int minutes = length / 60; |
295 | int seconds = length % 60; | 294 | int seconds = length % 60; |
296 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 295 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
297 | } | 296 | } |
298 | 297 | ||
299 | void AudioWidget::updateSlider( long i, long max ) { | 298 | void AudioWidget::updateSlider( long i, long max ) { |
300 | 299 | ||
301 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 300 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
302 | 301 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | |
302 | |||
303 | if ( max == 0 ) { | 303 | if ( max == 0 ) { |
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | // Will flicker too much if we don't do this | 306 | // Will flicker too much if we don't do this |
307 | // Scale to something reasonable | 307 | // Scale to something reasonable |
308 | int width = slider.width(); | 308 | int width = slider.width(); |
309 | int val = int((double)i * width / max); | 309 | int val = int((double)i * width / max); |
310 | if ( !audioSliderBeingMoved ) { | 310 | if ( !audioSliderBeingMoved ) { |
311 | if ( slider.value() != val ) { | 311 | if ( slider.value() != val ) { |
312 | slider.setValue( val ); | 312 | slider.setValue( val ); |
313 | } | 313 | } |
314 | 314 | ||
315 | if ( slider.maxValue() != width ) { | 315 | if ( slider.maxValue() != width ) { |
316 | slider.setMaxValue( width ); | 316 | slider.setMaxValue( width ); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | void AudioWidget::setToggleButton( int i, bool down ) { | 322 | void AudioWidget::setToggleButton( int i, bool down ) { |
323 | if ( down != audioButtons[i].isDown ) { | 323 | if ( down != audioButtons[i].isDown ) { |
324 | toggleButton( i ); | 324 | toggleButton( i ); |
325 | } | 325 | } |
326 | } | 326 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 778cd1e..135c67c 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -88,48 +88,49 @@ bool MediaPlayerState::paused() { | |||
88 | } | 88 | } |
89 | 89 | ||
90 | bool MediaPlayerState::playing() { | 90 | bool MediaPlayerState::playing() { |
91 | return isPlaying; | 91 | return isPlaying; |
92 | } | 92 | } |
93 | 93 | ||
94 | bool MediaPlayerState::stop() { | 94 | bool MediaPlayerState::stop() { |
95 | return isStoped; | 95 | return isStoped; |
96 | } | 96 | } |
97 | 97 | ||
98 | long MediaPlayerState::position() { | 98 | long MediaPlayerState::position() { |
99 | return curPosition; | 99 | return curPosition; |
100 | } | 100 | } |
101 | 101 | ||
102 | long MediaPlayerState::length() { | 102 | long MediaPlayerState::length() { |
103 | return curLength; | 103 | return curLength; |
104 | } | 104 | } |
105 | 105 | ||
106 | char MediaPlayerState::view() { | 106 | char MediaPlayerState::view() { |
107 | return curView; | 107 | return curView; |
108 | } | 108 | } |
109 | 109 | ||
110 | // slots | 110 | // slots |
111 | void MediaPlayerState::setIsStreaming( bool b ) { | 111 | void MediaPlayerState::setIsStreaming( bool b ) { |
112 | |||
112 | if ( isStreaming == b ) { | 113 | if ( isStreaming == b ) { |
113 | return; | 114 | return; |
114 | } | 115 | } |
115 | isStreaming = b; | 116 | isStreaming = b; |
116 | } | 117 | } |
117 | 118 | ||
118 | 119 | ||
119 | void MediaPlayerState::setFullscreen( bool b ) { | 120 | void MediaPlayerState::setFullscreen( bool b ) { |
120 | if ( isFullscreen == b ) { | 121 | if ( isFullscreen == b ) { |
121 | return; | 122 | return; |
122 | } | 123 | } |
123 | isFullscreen = b; | 124 | isFullscreen = b; |
124 | emit fullscreenToggled(b); | 125 | emit fullscreenToggled(b); |
125 | } | 126 | } |
126 | 127 | ||
127 | 128 | ||
128 | void MediaPlayerState::setScaled( bool b ) { | 129 | void MediaPlayerState::setScaled( bool b ) { |
129 | if ( isScaled == b ) { | 130 | if ( isScaled == b ) { |
130 | return; | 131 | return; |
131 | } | 132 | } |
132 | isScaled = b; | 133 | isScaled = b; |
133 | emit scaledToggled(b); | 134 | emit scaledToggled(b); |
134 | } | 135 | } |
135 | 136 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 79ba579..887c527 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -27,48 +27,51 @@ | |||
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef MEDIA_PLAYER_STATE_H | 34 | #ifndef MEDIA_PLAYER_STATE_H |
35 | #define MEDIA_PLAYER_STATE_H | 35 | #define MEDIA_PLAYER_STATE_H |
36 | 36 | ||
37 | 37 | ||
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | 40 | ||
41 | class MediaPlayerDecoder; | 41 | class MediaPlayerDecoder; |
42 | class Config; | 42 | class Config; |
43 | 43 | ||
44 | 44 | ||
45 | class MediaPlayerState : public QObject { | 45 | class MediaPlayerState : public QObject { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | MediaPlayerState( QObject *parent, const char *name ); | 48 | MediaPlayerState( QObject *parent, const char *name ); |
49 | ~MediaPlayerState(); | 49 | ~MediaPlayerState(); |
50 | 50 | ||
51 | bool isPaused; | ||
52 | bool isPlaying; | ||
53 | bool isStoped; | ||
51 | bool streaming(); | 54 | bool streaming(); |
52 | bool fullscreen(); | 55 | bool fullscreen(); |
53 | bool scaled(); | 56 | bool scaled(); |
54 | bool looping(); | 57 | bool looping(); |
55 | bool shuffled(); | 58 | bool shuffled(); |
56 | bool playlist(); | 59 | bool playlist(); |
57 | bool paused(); | 60 | bool paused(); |
58 | bool playing(); | 61 | bool playing(); |
59 | bool stop(); | 62 | bool stop(); |
60 | long position(); | 63 | long position(); |
61 | long length(); | 64 | long length(); |
62 | char view(); | 65 | char view(); |
63 | 66 | ||
64 | public slots: | 67 | public slots: |
65 | void setIsStreaming( bool b ); | 68 | void setIsStreaming( bool b ); |
66 | void setFullscreen( bool b ); | 69 | void setFullscreen( bool b ); |
67 | void setScaled( bool b ); | 70 | void setScaled( bool b ); |
68 | void setLooping( bool b ); | 71 | void setLooping( bool b ); |
69 | void setShuffled( bool b ); | 72 | void setShuffled( bool b ); |
70 | void setPlaylist( bool b ); | 73 | void setPlaylist( bool b ); |
71 | void setPaused( bool b ); | 74 | void setPaused( bool b ); |
72 | void setPlaying( bool b ); | 75 | void setPlaying( bool b ); |
73 | void setStop( bool b ); | 76 | void setStop( bool b ); |
74 | void setPosition( long p ); | 77 | void setPosition( long p ); |
@@ -93,40 +96,37 @@ public slots: | |||
93 | signals: | 96 | signals: |
94 | void fullscreenToggled( bool ); | 97 | void fullscreenToggled( bool ); |
95 | void scaledToggled( bool ); | 98 | void scaledToggled( bool ); |
96 | void loopingToggled( bool ); | 99 | void loopingToggled( bool ); |
97 | void shuffledToggled( bool ); | 100 | void shuffledToggled( bool ); |
98 | void playlistToggled( bool ); | 101 | void playlistToggled( bool ); |
99 | void pausedToggled( bool ); | 102 | void pausedToggled( bool ); |
100 | void playingToggled( bool ); | 103 | void playingToggled( bool ); |
101 | void stopToggled( bool ); | 104 | void stopToggled( bool ); |
102 | void positionChanged( long ); // When the slider is moved | 105 | void positionChanged( long ); // When the slider is moved |
103 | void positionUpdated( long ); // When the media file progresses | 106 | void positionUpdated( long ); // When the media file progresses |
104 | void lengthChanged( long ); | 107 | void lengthChanged( long ); |
105 | void viewChanged( char ); | 108 | void viewChanged( char ); |
106 | 109 | ||
107 | void prev(); | 110 | void prev(); |
108 | void next(); | 111 | void next(); |
109 | 112 | ||
110 | private: | 113 | private: |
111 | bool isStreaming; | 114 | bool isStreaming; |
112 | bool isFullscreen; | 115 | bool isFullscreen; |
113 | bool isScaled; | 116 | bool isScaled; |
114 | bool isLooping; | 117 | bool isLooping; |
115 | bool isShuffled; | 118 | bool isShuffled; |
116 | bool usePlaylist; | 119 | bool usePlaylist; |
117 | bool isPaused; | ||
118 | bool isPlaying; | ||
119 | bool isStoped; | ||
120 | long curPosition; | 120 | long curPosition; |
121 | long curLength; | 121 | long curLength; |
122 | char curView; | 122 | char curView; |
123 | 123 | ||
124 | void readConfig( Config& cfg ); | 124 | void readConfig( Config& cfg ); |
125 | void writeConfig( Config& cfg ) const; | 125 | void writeConfig( Config& cfg ) const; |
126 | 126 | ||
127 | 127 | ||
128 | }; | 128 | }; |
129 | 129 | ||
130 | 130 | ||
131 | #endif // MEDIA_PLAYER_STATE_H | 131 | #endif // MEDIA_PLAYER_STATE_H |
132 | 132 | ||
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 448dd34..d8cacd0 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro | |||
@@ -1,21 +1,23 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #release | 3 | #release |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ | 5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ | 6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ |
7 | frame.h lib.h xinevideowidget.h \ | 7 | frame.h lib.h xinevideowidget.h \ |
8 | alphablend.h yuv2rgb.h | 8 | alphablend.h yuv2rgb.h |
9 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ | 10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ |
11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ |
12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \ | 12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \ |
13 | alphablend.c yuv2rgb.c yuv2rgb_mlib.c yuv2rgb_mmx.c | 13 | alphablend.c yuv2rgb.c yuv2rgb_mlib.c yuv2rgb_mmx.c |
14 | TARGET = opieplayer2 | 14 | TARGET = opieplayer2 |
15 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
16 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils | 17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils |
18 | MOC_DIR=qpeobj | ||
19 | OBJECTS_DIR=qpeobj | ||
18 | 20 | ||
19 | INCLUDEPATH += $(OPIEDIR)/include | 21 | INCLUDEPATH += $(OPIEDIR)/include |
20 | DEPENDPATH += $(OPIEDIR)/include | 22 | DEPENDPATH += $(OPIEDIR)/include |
21 | 23 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index cce445b..1dee422 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -151,49 +151,49 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
151 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 151 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
152 | pmPlayList->insertSeparator(-1); | 152 | pmPlayList->insertSeparator(-1); |
153 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 153 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
154 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); | 154 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); |
155 | pmPlayList->insertSeparator(-1); | 155 | pmPlayList->insertSeparator(-1); |
156 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 156 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
157 | pmPlayList->insertSeparator(-1); | 157 | pmPlayList->insertSeparator(-1); |
158 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 158 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
159 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 159 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
160 | 160 | ||
161 | QPopupMenu *pmView = new QPopupMenu( this ); | 161 | QPopupMenu *pmView = new QPopupMenu( this ); |
162 | menu->insertItem( tr( "View" ), pmView ); | 162 | menu->insertItem( tr( "View" ), pmView ); |
163 | 163 | ||
164 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 164 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
165 | fullScreenButton->addTo(pmView); | 165 | fullScreenButton->addTo(pmView); |
166 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 166 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
167 | scaleButton->addTo(pmView); | 167 | scaleButton->addTo(pmView); |
168 | 168 | ||
169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
171 | 171 | ||
172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
173 | 173 | ||
174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
175 | tabWidget->setTabShape(QTabWidget::Triangular); | 175 | // tabWidget->setTabShape(QTabWidget::Triangular); |
176 | 176 | ||
177 | QWidget *pTab; | 177 | QWidget *pTab; |
178 | pTab = new QWidget( tabWidget, "pTab" ); | 178 | pTab = new QWidget( tabWidget, "pTab" ); |
179 | tabWidget->insertTab( pTab,"Playlist"); | 179 | tabWidget->insertTab( pTab,"Playlist"); |
180 | 180 | ||
181 | 181 | ||
182 | // Add the playlist area | 182 | // Add the playlist area |
183 | 183 | ||
184 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 184 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
185 | d->playListFrame = vbox3; | 185 | d->playListFrame = vbox3; |
186 | d->playListFrame ->setMinimumSize(235,260); | 186 | d->playListFrame ->setMinimumSize(235,260); |
187 | 187 | ||
188 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 188 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
189 | 189 | ||
190 | d->selectedFiles = new PlayListSelection( hbox2); | 190 | d->selectedFiles = new PlayListSelection( hbox2); |
191 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 191 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
192 | 192 | ||
193 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 193 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
194 | 194 | ||
195 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 195 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
196 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 196 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
197 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 197 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
198 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 198 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
199 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 199 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
@@ -405,48 +405,49 @@ void PlayListWidget::setDocument(const QString& fileref) { | |||
405 | } | 405 | } |
406 | 406 | ||
407 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 407 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
408 | readm3u( fileref); | 408 | readm3u( fileref); |
409 | } else if(fileref.find("pls",0,TRUE) != -1) { //is pls | 409 | } else if(fileref.find("pls",0,TRUE) != -1) { //is pls |
410 | readPls( fileref); | 410 | readPls( fileref); |
411 | } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | 411 | } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist |
412 | clearList(); | 412 | clearList(); |
413 | loadList(DocLnk(fileref)); | 413 | loadList(DocLnk(fileref)); |
414 | d->selectedFiles->first(); | 414 | d->selectedFiles->first(); |
415 | } else { | 415 | } else { |
416 | clearList(); | 416 | clearList(); |
417 | addToSelection( DocLnk( fileref ) ); | 417 | addToSelection( DocLnk( fileref ) ); |
418 | d->setDocumentUsed = TRUE; | 418 | d->setDocumentUsed = TRUE; |
419 | mediaPlayerState->setPlaying( FALSE ); | 419 | mediaPlayerState->setPlaying( FALSE ); |
420 | qApp->processEvents(); | 420 | qApp->processEvents(); |
421 | mediaPlayerState->setPlaying( TRUE ); | 421 | mediaPlayerState->setPlaying( TRUE ); |
422 | qApp->processEvents(); | 422 | qApp->processEvents(); |
423 | setCaption(tr("OpiePlayer")); | 423 | setCaption(tr("OpiePlayer")); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | 427 | ||
428 | void PlayListWidget::setActiveWindow() { | 428 | void PlayListWidget::setActiveWindow() { |
429 | qDebug("SETTING active window"); | ||
429 | // When we get raised we need to ensure that it switches views | 430 | // When we get raised we need to ensure that it switches views |
430 | char origView = mediaPlayerState->view(); | 431 | char origView = mediaPlayerState->view(); |
431 | mediaPlayerState->setView( 'l' ); // invalidate | 432 | mediaPlayerState->setView( 'l' ); // invalidate |
432 | mediaPlayerState->setView( origView ); // now switch back | 433 | mediaPlayerState->setView( origView ); // now switch back |
433 | } | 434 | } |
434 | 435 | ||
435 | 436 | ||
436 | void PlayListWidget::useSelectedDocument() { | 437 | void PlayListWidget::useSelectedDocument() { |
437 | d->setDocumentUsed = FALSE; | 438 | d->setDocumentUsed = FALSE; |
438 | } | 439 | } |
439 | 440 | ||
440 | 441 | ||
441 | const DocLnk *PlayListWidget::current() { // this is fugly | 442 | const DocLnk *PlayListWidget::current() { // this is fugly |
442 | 443 | ||
443 | switch (tabWidget->currentPageIndex()) { | 444 | switch (tabWidget->currentPageIndex()) { |
444 | case 0: //playlist | 445 | case 0: //playlist |
445 | { | 446 | { |
446 | qDebug("playlist"); | 447 | qDebug("playlist"); |
447 | if ( mediaPlayerState->playlist() ) { | 448 | if ( mediaPlayerState->playlist() ) { |
448 | return d->selectedFiles->current(); | 449 | return d->selectedFiles->current(); |
449 | } else if ( d->setDocumentUsed && d->current ) { | 450 | } else if ( d->setDocumentUsed && d->current ) { |
450 | return d->current; | 451 | return d->current; |
451 | } else { | 452 | } else { |
452 | return d->files->selected(); | 453 | return d->files->selected(); |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 878cd4a..19a9172 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -59,73 +59,72 @@ XineControl::~XineControl() { | |||
59 | void XineControl::play( const QString& fileName ) { | 59 | void XineControl::play( const QString& fileName ) { |
60 | libXine->play( fileName ); | 60 | libXine->play( fileName ); |
61 | mediaPlayerState->setPlaying( true ); | 61 | mediaPlayerState->setPlaying( true ); |
62 | // default to audio view until we know how to handle video | 62 | // default to audio view until we know how to handle video |
63 | // MediaDetect mdetect; | 63 | // MediaDetect mdetect; |
64 | char whichGui = mdetect.videoOrAudio( fileName ); | 64 | char whichGui = mdetect.videoOrAudio( fileName ); |
65 | if (whichGui == 'f') { | 65 | if (whichGui == 'f') { |
66 | qDebug("Nicht erkannter Dateityp"); | 66 | qDebug("Nicht erkannter Dateityp"); |
67 | return; | 67 | return; |
68 | } | 68 | } |
69 | 69 | ||
70 | if (whichGui == 'a') { | 70 | if (whichGui == 'a') { |
71 | libXine->setShowVideo( false ); | 71 | libXine->setShowVideo( false ); |
72 | } else { | 72 | } else { |
73 | libXine->setShowVideo( true ); | 73 | libXine->setShowVideo( true ); |
74 | } | 74 | } |
75 | 75 | ||
76 | // determine if slider is shown | 76 | // determine if slider is shown |
77 | // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); | 77 | // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); |
78 | mediaPlayerState->setIsStreaming( libXine->isSeekable() ); | 78 | mediaPlayerState->setIsStreaming( libXine->isSeekable() ); |
79 | // which gui (video / audio) | 79 | // which gui (video / audio) |
80 | mediaPlayerState->setView( whichGui ); | 80 | mediaPlayerState->setView( whichGui ); |
81 | length(); | 81 | length(); |
82 | position(); | 82 | position(); |
83 | |||
84 | } | 83 | } |
85 | 84 | ||
86 | void XineControl::stop( bool isSet ) { | 85 | void XineControl::stop( bool isSet ) { |
87 | if ( !isSet) { | 86 | if ( !isSet) { |
88 | libXine->stop(); | 87 | libXine->stop(); |
89 | mediaPlayerState->setList(); | 88 | mediaPlayerState->setList(); |
90 | //mediaPlayerState->setPlaying( false ); | 89 | //mediaPlayerState->setPlaying( false ); |
91 | } else { | 90 | } else { |
92 | // play again | 91 | // play again |
93 | } | 92 | } |
94 | } | 93 | } |
95 | 94 | ||
96 | void XineControl::pause( bool isSet) { | 95 | void XineControl::pause( bool isSet) { |
97 | libXine->pause(); | 96 | libXine->pause(); |
98 | } | 97 | } |
99 | 98 | ||
100 | int XineControl::currentTime() { | 99 | long XineControl::currentTime() { |
101 | // todo: jede sekunde überprüfen | 100 | // todo: jede sekunde überprüfen |
102 | m_currentTime = libXine->currentTime(); | 101 | m_currentTime = libXine->currentTime(); |
103 | return m_currentTime; | 102 | return m_currentTime; |
104 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 103 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
105 | } | 104 | } |
106 | 105 | ||
107 | void XineControl::length() { | 106 | void XineControl::length() { |
108 | m_length = libXine->length(); | 107 | m_length = libXine->length(); |
109 | mediaPlayerState->setLength( m_length ); | 108 | mediaPlayerState->setLength( m_length ); |
110 | } | 109 | } |
111 | 110 | ||
112 | long XineControl::position() { | 111 | long XineControl::position() { |
113 | qDebug("<<<<<<<<<<<< xinecontrol setPostion>>>>>>>>>"); | 112 | m_position = ( currentTime() ); |
114 | m_position = (m_currentTime/m_length*100); | ||
115 | mediaPlayerState->setPosition( m_position ); | 113 | mediaPlayerState->setPosition( m_position ); |
116 | long emitPos = (long)m_position; | 114 | long emitPos = (long)m_position; |
117 | emit positionChanged( emitPos ); | 115 | emit positionChanged( emitPos ); |
116 | if(mediaPlayerState->isPlaying) | ||
118 | // needs to be stopped the media is stopped | 117 | // needs to be stopped the media is stopped |
119 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 118 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
120 | qDebug("POSITION : " + m_position); | 119 | // qDebug("POSITION : %d", m_position); |
121 | return m_position; | 120 | return m_position; |
122 | } | 121 | } |
123 | 122 | ||
124 | void XineControl::setFullscreen( bool isSet ) { | 123 | void XineControl::setFullscreen( bool isSet ) { |
125 | libXine->showVideoFullScreen( isSet); | 124 | libXine->showVideoFullScreen( isSet); |
126 | } | 125 | } |
127 | 126 | ||
128 | void XineControl::seekTo( long second ) { | 127 | void XineControl::seekTo( long second ) { |
129 | // libXine-> | 128 | // libXine-> |
130 | } | 129 | } |
131 | 130 | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 07ad309..295d2b4 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -29,44 +29,43 @@ | |||
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef XINECONTROL_H | 34 | #ifndef XINECONTROL_H |
35 | #define XINECONTROL_H | 35 | #define XINECONTROL_H |
36 | 36 | ||
37 | #include "lib.h" | 37 | #include "lib.h" |
38 | #include "mediadetect.h" | 38 | #include "mediadetect.h" |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | class XineControl : public QObject { | 41 | class XineControl : public QObject { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | XineControl( QObject *parent = 0, const char *name =0 ); | 44 | XineControl( QObject *parent = 0, const char *name =0 ); |
45 | ~XineControl(); | 45 | ~XineControl(); |
46 | int m_length; | 46 | int m_length; |
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | void play( const QString& fileName ); | 49 | void play( const QString& fileName ); |
50 | void stop( bool ); | 50 | void stop( bool ); |
51 | void pause( bool ); | 51 | void pause( bool ); |
52 | void setFullscreen( bool ); | 52 | void setFullscreen( bool ); |
53 | int currentTime(); | 53 | long currentTime(); |
54 | void seekTo( long ); | 54 | void seekTo( long ); |
55 | // get length of media file and set it | 55 | // get length of media file and set it |
56 | void length(); | 56 | void length(); |
57 | |||
58 | long position(); | 57 | long position(); |
59 | 58 | ||
60 | private: | 59 | private: |
61 | XINE::Lib *libXine; | 60 | XINE::Lib *libXine; |
62 | MediaDetect mdetect; | 61 | MediaDetect mdetect; |
63 | int m_currentTime; | 62 | long m_currentTime; |
64 | long m_position; | 63 | long m_position; |
65 | 64 | ||
66 | signals: | 65 | signals: |
67 | void positionChanged( long ); | 66 | void positionChanged( long ); |
68 | 67 | ||
69 | }; | 68 | }; |
70 | 69 | ||
71 | 70 | ||
72 | #endif | 71 | #endif |