summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h6
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp9
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h5
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
@@ -248,13 +248,13 @@ void AudioWidget::sliderReleased() {
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
253void AudioWidget::setPosition( long i ) { 253void 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
259void AudioWidget::setLength( long max ) { 259void AudioWidget::setLength( long max ) {
260 updateSlider( mediaPlayerState->position(), max ); 260 updateSlider( mediaPlayerState->position(), max );
@@ -287,22 +287,22 @@ void AudioWidget::setView( char view ) {
287 hide(); 287 hide();
288 } 288 }
289} 289}
290 290
291 291
292static QString timeAsString( long length ) { 292static 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
299void AudioWidget::updateSlider( long i, long max ) { 298void 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();
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
@@ -106,12 +106,13 @@ long MediaPlayerState::length() {
106char MediaPlayerState::view() { 106char MediaPlayerState::view() {
107 return curView; 107 return curView;
108} 108}
109 109
110// slots 110// slots
111void MediaPlayerState::setIsStreaming( bool b ) { 111void 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
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
@@ -45,12 +45,15 @@ class Config;
45class MediaPlayerState : public QObject { 45class MediaPlayerState : public QObject {
46Q_OBJECT 46Q_OBJECT
47public: 47public:
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();
@@ -111,15 +114,12 @@ 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;
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 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3#release 3#release
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ 5HEADERS = 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
9SOURCES = main.cpp \ 9SOURCES = 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
14TARGET = opieplayer2 14TARGET = opieplayer2
15INCLUDEPATH += $(OPIEDIR)/include 15INCLUDEPATH += $(OPIEDIR)/include
16DEPENDPATH += $(OPIEDIR)/include 16DEPENDPATH += $(OPIEDIR)/include
17LIBS += -lqpe -lpthread -lopie -lxine -lxineutils 17LIBS += -lqpe -lpthread -lopie -lxine -lxineutils
18MOC_DIR=qpeobj
19OBJECTS_DIR=qpeobj
18 20
19INCLUDEPATH += $(OPIEDIR)/include 21INCLUDEPATH += $(OPIEDIR)/include
20DEPENDPATH += $(OPIEDIR)/include 22DEPENDPATH += $(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
@@ -169,13 +169,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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
@@ -423,12 +423,13 @@ void PlayListWidget::setDocument(const QString& fileref) {
423 setCaption(tr("OpiePlayer")); 423 setCaption(tr("OpiePlayer"));
424 } 424 }
425} 425}
426 426
427 427
428void PlayListWidget::setActiveWindow() { 428void 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
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
@@ -77,13 +77,12 @@ void XineControl::play( const QString& fileName ) {
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
86void XineControl::stop( bool isSet ) { 85void XineControl::stop( bool isSet ) {
87 if ( !isSet) { 86 if ( !isSet) {
88 libXine->stop(); 87 libXine->stop();
89 mediaPlayerState->setList(); 88 mediaPlayerState->setList();
@@ -94,33 +93,33 @@ void XineControl::stop( bool isSet ) {
94} 93}
95 94
96void XineControl::pause( bool isSet) { 95void XineControl::pause( bool isSet) {
97 libXine->pause(); 96 libXine->pause();
98} 97}
99 98
100int XineControl::currentTime() { 99long 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
107void XineControl::length() { 106void 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
112long XineControl::position() { 111long 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
124void XineControl::setFullscreen( bool isSet ) { 123void XineControl::setFullscreen( bool isSet ) {
125 libXine->showVideoFullScreen( isSet); 124 libXine->showVideoFullScreen( isSet);
126} 125}
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
@@ -47,23 +47,22 @@ public:
47 47
48public slots: 48public 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
60private: 59private:
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
66signals: 65signals:
67 void positionChanged( long ); 66 void positionChanged( long );
68 67
69}; 68};