author | simon <simon> | 2002-12-02 23:22:22 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 23:22:22 (UTC) |
commit | 24a00c944aace8d7627c1eb0d7cc0ebf40731c57 (patch) (unidiff) | |
tree | 3ae5406e15f169849a50e12fec01faa4cfc035e3 | |
parent | 779219b813f0eba82a8d9236fafd28dbafc594d1 (diff) | |
download | opie-24a00c944aace8d7627c1eb0d7cc0ebf40731c57.zip opie-24a00c944aace8d7627c1eb0d7cc0ebf40731c57.tar.gz opie-24a00c944aace8d7627c1eb0d7cc0ebf40731c57.tar.bz2 |
- AudioWidget and VideoWidget are no more singletons via audioUI and
videoUI. this allows switching skins at run-time (the appropriate
connections are already made and it works quite nicely :)
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 11 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 39 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 6 |
7 files changed, 56 insertions, 31 deletions
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index 7d11ca0..7fc7b94 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp | |||
@@ -1,32 +1,25 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include "mediaplayerstate.h" | 3 | #include "mediaplayerstate.h" |
4 | #include "playlistwidget.h" | 4 | #include "playlistwidget.h" |
5 | #include "audiowidget.h" | ||
6 | #include "videowidget.h" | ||
7 | #include "mediaplayer.h" | 5 | #include "mediaplayer.h" |
8 | 6 | ||
9 | PlayListWidget *playList; | 7 | PlayListWidget *playList; |
10 | AudioWidget *audioUI; | ||
11 | VideoWidget *videoUI; | ||
12 | 8 | ||
13 | int main(int argc, char **argv) { | 9 | int main(int argc, char **argv) { |
14 | QPEApplication a(argc,argv); | 10 | QPEApplication a(argc,argv); |
15 | 11 | ||
16 | MediaPlayerState st( 0, "mediaPlayerState" ); | 12 | MediaPlayerState st( 0, "mediaPlayerState" ); |
17 | PlayListWidget pl( st, 0, "playList" ); | 13 | PlayListWidget pl( st, 0, "playList" ); |
18 | playList = &pl; | 14 | playList = &pl; |
19 | pl.showMaximized(); | 15 | pl.showMaximized(); |
20 | AudioWidget aw( st, 0, "audioUI" ); | ||
21 | audioUI = &aw; | ||
22 | VideoWidget vw( st, 0, "videoUI" ); | ||
23 | videoUI = &vw; | ||
24 | a.processEvents(); | ||
25 | MediaPlayer mp( st, 0, "mediaPlayer" ); | 16 | MediaPlayer mp( st, 0, "mediaPlayer" ); |
17 | QObject::connect( &pl, SIGNAL( skinSelected() ), | ||
18 | &mp, SLOT( recreateAudioAndVideoWidgets() ) ); | ||
26 | 19 | ||
27 | a.showMainDocumentWidget(&pl); | 20 | a.showMainDocumentWidget(&pl); |
28 | 21 | ||
29 | return a.exec(); | 22 | return a.exec(); |
30 | } | 23 | } |
31 | 24 | ||
32 | 25 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index eccb5d9..a9c74c4 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -11,69 +11,62 @@ | |||
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | 12 | ||
13 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
14 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | 18 | ||
19 | #include "mediaplayerstate.h" | 19 | #include "mediaplayerstate.h" |
20 | 20 | ||
21 | // for setBacklight() | 21 | // for setBacklight() |
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <sys/file.h> | 23 | #include <sys/file.h> |
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | 25 | ||
26 | 26 | ||
27 | extern AudioWidget *audioUI; | ||
28 | extern VideoWidget *videoUI; | 27 | extern VideoWidget *videoUI; |
29 | extern PlayListWidget *playList; | 28 | extern PlayListWidget *playList; |
30 | 29 | ||
31 | 30 | ||
32 | #define FBIOBLANK 0x4611 | 31 | #define FBIOBLANK 0x4611 |
33 | 32 | ||
34 | MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 33 | MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
35 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { | 34 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { |
36 | 35 | ||
36 | audioUI = 0; | ||
37 | videoUI = 0; | ||
38 | xineControl = 0; | ||
39 | recreateAudioAndVideoWidgets(); | ||
40 | |||
37 | fd=-1;fl=-1; | 41 | fd=-1;fl=-1; |
38 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); | 42 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); |
39 | 43 | ||
40 | qApp->processEvents(); | 44 | qApp->processEvents(); |
41 | // QPEApplication::grabKeyboard(); // EVIL | 45 | // QPEApplication::grabKeyboard(); // EVIL |
42 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 46 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
43 | 47 | ||
44 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 48 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
45 | 49 | ||
46 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 50 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
47 | 51 | ||
48 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 52 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
49 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 53 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
50 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 54 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
51 | 55 | ||
52 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
53 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
54 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
55 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
56 | |||
57 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
58 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
59 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
60 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
61 | |||
62 | volControl = new VolumeControl; | 56 | volControl = new VolumeControl; |
63 | xineControl = new XineControl( mediaPlayerState ); | ||
64 | Config cfg( "OpiePlayer" ); | 57 | Config cfg( "OpiePlayer" ); |
65 | cfg.setGroup("PlayList"); | 58 | cfg.setGroup("PlayList"); |
66 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 59 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
67 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 60 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
68 | } | 61 | } |
69 | 62 | ||
70 | MediaPlayer::~MediaPlayer() { | 63 | MediaPlayer::~MediaPlayer() { |
71 | delete xineControl; | 64 | delete xineControl; |
72 | delete volControl; | 65 | delete volControl; |
73 | } | 66 | } |
74 | 67 | ||
75 | void MediaPlayer::pauseCheck( bool b ) { | 68 | void MediaPlayer::pauseCheck( bool b ) { |
76 | if ( b && !mediaPlayerState.isPlaying() ) { | 69 | if ( b && !mediaPlayerState.isPlaying() ) { |
77 | mediaPlayerState.setPaused( FALSE ); | 70 | mediaPlayerState.setPaused( FALSE ); |
78 | } | 71 | } |
79 | } | 72 | } |
@@ -338,16 +331,38 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | |||
338 | break; | 331 | break; |
339 | case Key_F13: //mail | 332 | case Key_F13: //mail |
340 | qDebug("Blank here"); | 333 | qDebug("Blank here"); |
341 | // mediaPlayerState->toggleBlank(); | 334 | // mediaPlayerState->toggleBlank(); |
342 | break; | 335 | break; |
343 | } | 336 | } |
344 | } | 337 | } |
345 | 338 | ||
346 | void MediaPlayer::cleanUp() {// this happens on closing | 339 | void MediaPlayer::cleanUp() {// this happens on closing |
347 | Config cfg( "OpiePlayer" ); | 340 | Config cfg( "OpiePlayer" ); |
348 | mediaPlayerState.writeConfig( cfg ); | 341 | mediaPlayerState.writeConfig( cfg ); |
349 | playList->writeDefaultPlaylist( ); | 342 | playList->writeDefaultPlaylist( ); |
350 | 343 | ||
351 | // QPEApplication::grabKeyboard(); | 344 | // QPEApplication::grabKeyboard(); |
352 | // QPEApplication::ungrabKeyboard(); | 345 | // QPEApplication::ungrabKeyboard(); |
353 | } | 346 | } |
347 | |||
348 | void MediaPlayer::recreateAudioAndVideoWidgets() | ||
349 | { | ||
350 | delete xineControl; | ||
351 | delete audioUI; | ||
352 | delete videoUI; | ||
353 | audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" ); | ||
354 | videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" ); | ||
355 | |||
356 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
357 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
358 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
359 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
360 | |||
361 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
362 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
363 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
364 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
365 | |||
366 | xineControl = new XineControl( videoUI, mediaPlayerState ); | ||
367 | } | ||
368 | |||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 6aeac7c..0d6f722 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -29,49 +29,58 @@ | |||
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_H | 34 | #ifndef MEDIA_PLAYER_H |
35 | #define MEDIA_PLAYER_H | 35 | #define MEDIA_PLAYER_H |
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qframe.h> | 38 | #include <qframe.h> |
39 | 39 | ||
40 | #include "xinecontrol.h" | 40 | #include "xinecontrol.h" |
41 | 41 | ||
42 | class DocLnk; | 42 | class DocLnk; |
43 | class VolumeControl; | 43 | class VolumeControl; |
44 | class MediaPlayerState; | 44 | class MediaPlayerState; |
45 | class AudioWidget; | ||
46 | class VideoWidget; | ||
45 | 47 | ||
46 | class MediaPlayer : public QObject { | 48 | class MediaPlayer : public QObject { |
47 | Q_OBJECT | 49 | Q_OBJECT |
48 | public: | 50 | public: |
49 | MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); | 51 | MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); |
50 | ~MediaPlayer(); | 52 | ~MediaPlayer(); |
53 | |||
54 | public slots: | ||
55 | void recreateAudioAndVideoWidgets(); | ||
56 | |||
51 | private slots: | 57 | private slots: |
52 | void setPlaying( bool ); | 58 | void setPlaying( bool ); |
53 | void pauseCheck( bool ); | 59 | void pauseCheck( bool ); |
54 | void play(); | 60 | void play(); |
55 | void next(); | 61 | void next(); |
56 | void prev(); | 62 | void prev(); |
57 | void startIncreasingVolume(); | 63 | void startIncreasingVolume(); |
58 | void startDecreasingVolume(); | 64 | void startDecreasingVolume(); |
59 | void stopChangingVolume(); | 65 | void stopChangingVolume(); |
60 | void cleanUp(); | 66 | void cleanUp(); |
61 | void blank( bool ); | 67 | void blank( bool ); |
62 | 68 | ||
63 | protected: | 69 | protected: |
64 | void timerEvent( QTimerEvent *e ); | 70 | void timerEvent( QTimerEvent *e ); |
65 | void keyReleaseEvent( QKeyEvent *e); | 71 | void keyReleaseEvent( QKeyEvent *e); |
66 | private: | 72 | private: |
73 | |||
67 | bool isBlanked, l, r; | 74 | bool isBlanked, l, r; |
68 | int fd, fl; | 75 | int fd, fl; |
69 | int volumeDirection; | 76 | int volumeDirection; |
70 | XineControl *xineControl; | 77 | XineControl *xineControl; |
71 | VolumeControl *volControl; | 78 | VolumeControl *volControl; |
72 | MediaPlayerState &mediaPlayerState; | 79 | MediaPlayerState &mediaPlayerState; |
80 | AudioWidget *audioUI; | ||
81 | VideoWidget *videoUI; | ||
73 | }; | 82 | }; |
74 | 83 | ||
75 | 84 | ||
76 | #endif // MEDIA_PLAYER_H | 85 | #endif // MEDIA_PLAYER_H |
77 | 86 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 7ba342b..6bda71e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1082,38 +1082,40 @@ void PlayListWidget::populateSkinsMenu() { | |||
1082 | if( skinName == "default" ) { | 1082 | if( skinName == "default" ) { |
1083 | defaultSkinIndex = item; | 1083 | defaultSkinIndex = item; |
1084 | } | 1084 | } |
1085 | if( skinName == skin ) { | 1085 | if( skinName == skin ) { |
1086 | skinsMenu->setItemChecked( item, TRUE ); | 1086 | skinsMenu->setItemChecked( item, TRUE ); |
1087 | } | 1087 | } |
1088 | ++it; | 1088 | ++it; |
1089 | } | 1089 | } |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | void PlayListWidget::skinsMenuActivated( int item ) { | 1092 | void PlayListWidget::skinsMenuActivated( int item ) { |
1093 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1093 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1094 | skinsMenu->setItemChecked( i, FALSE ); | 1094 | skinsMenu->setItemChecked( i, FALSE ); |
1095 | } | 1095 | } |
1096 | skinsMenu->setItemChecked( item, TRUE ); | 1096 | skinsMenu->setItemChecked( item, TRUE ); |
1097 | 1097 | ||
1098 | Config cfg( "OpiePlayer" ); | 1098 | { |
1099 | cfg.setGroup("Options"); | 1099 | Config cfg( "OpiePlayer" ); |
1100 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1100 | cfg.setGroup("Options"); |
1101 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1101 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1102 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1102 | } |
1103 | } | 1103 | |
1104 | emit skinSelected(); | ||
1105 | } | ||
1104 | 1106 | ||
1105 | PlayListWidget::TabType PlayListWidget::currentTab() const | 1107 | PlayListWidget::TabType PlayListWidget::currentTab() const |
1106 | { | 1108 | { |
1107 | static const TabType indexToTabType[ TabTypeCount ] = | 1109 | static const TabType indexToTabType[ TabTypeCount ] = |
1108 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 1110 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
1109 | 1111 | ||
1110 | int index = tabWidget->currentPageIndex(); | 1112 | int index = tabWidget->currentPageIndex(); |
1111 | assert( index < TabTypeCount && index >= 0 ); | 1113 | assert( index < TabTypeCount && index >= 0 ); |
1112 | 1114 | ||
1113 | return indexToTabType[ index ]; | 1115 | return indexToTabType[ index ]; |
1114 | } | 1116 | } |
1115 | 1117 | ||
1116 | PlayListWidget::Entry PlayListWidget::currentEntry() const | 1118 | PlayListWidget::Entry PlayListWidget::currentEntry() const |
1117 | { | 1119 | { |
1118 | if ( currentTab() == CurrentPlayList ) { | 1120 | if ( currentTab() == CurrentPlayList ) { |
1119 | const DocLnk *lnk = current(); | 1121 | const DocLnk *lnk = current(); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 3f52e63..ad5c9a3 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -81,32 +81,35 @@ public: | |||
81 | void useSelectedDocument(); | 81 | void useSelectedDocument(); |
82 | int selected; | 82 | int selected; |
83 | TabType currentTab() const; | 83 | TabType currentTab() const; |
84 | 84 | ||
85 | Entry currentEntry() const; | 85 | Entry currentEntry() const; |
86 | 86 | ||
87 | public slots: | 87 | public slots: |
88 | bool first(); | 88 | bool first(); |
89 | bool last(); | 89 | bool last(); |
90 | bool next(); | 90 | bool next(); |
91 | bool prev(); | 91 | bool prev(); |
92 | void writeDefaultPlaylist( ); | 92 | void writeDefaultPlaylist( ); |
93 | QString currentFileListPathName() const; | 93 | QString currentFileListPathName() const; |
94 | protected: | 94 | protected: |
95 | void keyReleaseEvent( QKeyEvent *e); | 95 | void keyReleaseEvent( QKeyEvent *e); |
96 | 96 | ||
97 | signals: | ||
98 | void skinSelected(); | ||
99 | |||
97 | private: | 100 | private: |
98 | int defaultSkinIndex; | 101 | int defaultSkinIndex; |
99 | bool audioScan, videoScan, audioPopulated, videoPopulated; | 102 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
100 | void readm3u(const QString &); | 103 | void readm3u(const QString &); |
101 | void readPls(const QString &); | 104 | void readPls(const QString &); |
102 | void initializeStates(); | 105 | void initializeStates(); |
103 | void populateAudioView(); | 106 | void populateAudioView(); |
104 | void populateVideoView(); | 107 | void populateVideoView(); |
105 | 108 | ||
106 | QListView *currentFileListView() const; | 109 | QListView *currentFileListView() const; |
107 | 110 | ||
108 | bool inFileListMode() const; | 111 | bool inFileListMode() const; |
109 | 112 | ||
110 | private slots: | 113 | private slots: |
111 | void populateSkinsMenu(); | 114 | void populateSkinsMenu(); |
112 | void skinsMenuActivated(int); | 115 | void skinsMenuActivated(int); |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 071ef7c..b4ae783 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -27,35 +27,34 @@ | |||
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 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | #include "videowidget.h" | 41 | #include "videowidget.h" |
42 | 42 | ||
43 | extern VideoWidget *videoUI; | 43 | XineControl::XineControl( VideoWidget *videoWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
44 | XineControl::XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 44 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), videoUI( videoWidget ) { |
45 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) { | ||
46 | 45 | ||
47 | libXine = new XINE::Lib( videoUI->vidWidget() ); | 46 | libXine = new XINE::Lib( videoUI->vidWidget() ); |
48 | 47 | ||
49 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); | 48 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); |
50 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 49 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
51 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); | 50 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); |
52 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 51 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
53 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 52 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
54 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 53 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
55 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 54 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
56 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 55 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
57 | 56 | ||
58 | disabledSuspendScreenSaver = FALSE; | 57 | disabledSuspendScreenSaver = FALSE; |
59 | } | 58 | } |
60 | 59 | ||
61 | XineControl::~XineControl() { | 60 | XineControl::~XineControl() { |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 00486f2..24e966b 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -26,36 +26,38 @@ | |||
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
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 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 <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | 41 | ||
42 | class VideoWidget; | ||
43 | |||
42 | class XineControl : public QObject { | 44 | class XineControl : public QObject { |
43 | Q_OBJECT | 45 | Q_OBJECT |
44 | public: | 46 | public: |
45 | XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); | 47 | XineControl( VideoWidget *videoWidget, MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); |
46 | ~XineControl(); | 48 | ~XineControl(); |
47 | 49 | ||
48 | bool hasVideo() const { return hasVideoChannel; } | 50 | bool hasVideo() const { return hasVideoChannel; } |
49 | bool hasAudio() const { return hasAudioChannel; } | 51 | bool hasAudio() const { return hasAudioChannel; } |
50 | 52 | ||
51 | public slots: | 53 | public slots: |
52 | void play( const QString& fileName ); | 54 | void play( const QString& fileName ); |
53 | void stop( bool ); | 55 | void stop( bool ); |
54 | 56 | ||
55 | /** | 57 | /** |
56 | * Pause the media stream | 58 | * Pause the media stream |
57 | * @param if pause or not | 59 | * @param if pause or not |
58 | */ | 60 | */ |
59 | void pause( bool ); | 61 | void pause( bool ); |
60 | 62 | ||
61 | /** | 63 | /** |
@@ -100,20 +102,22 @@ public slots: | |||
100 | 102 | ||
101 | 103 | ||
102 | private: | 104 | private: |
103 | XINE::Lib *libXine; | 105 | XINE::Lib *libXine; |
104 | long m_currentTime; | 106 | long m_currentTime; |
105 | long m_position; | 107 | long m_position; |
106 | int m_length; | 108 | int m_length; |
107 | QString m_fileName; | 109 | QString m_fileName; |
108 | bool disabledSuspendScreenSaver : 1; | 110 | bool disabledSuspendScreenSaver : 1; |
109 | bool hasVideoChannel : 1; | 111 | bool hasVideoChannel : 1; |
110 | bool hasAudioChannel : 1; | 112 | bool hasAudioChannel : 1; |
111 | MediaPlayerState &mediaPlayerState; | 113 | MediaPlayerState &mediaPlayerState; |
112 | 114 | ||
113 | signals: | 115 | signals: |
114 | void positionChanged( long ); | 116 | void positionChanged( long ); |
115 | 117 | ||
118 | private: | ||
119 | VideoWidget *videoUI; | ||
116 | }; | 120 | }; |
117 | 121 | ||
118 | 122 | ||
119 | #endif | 123 | #endif |