6 files changed, 68 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8a3d3e0..5e91561 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -362,12 +362,13 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
362 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 362 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
363 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 363 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
364 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 364 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
365 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 365 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
366 | 366 | ||
367 | xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); | 367 | xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); |
368 | mediaPlayerState.setBackendInitialized(); | ||
368 | } | 369 | } |
369 | 370 | ||
370 | void MediaPlayer::reloadSkins() | 371 | void MediaPlayer::reloadSkins() |
371 | { | 372 | { |
372 | audioUI->loadSkin(); | 373 | audioUI->loadSkin(); |
373 | videoUI->loadSkin(); | 374 | videoUI->loadSkin(); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 40fa1a4..d54d870 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -50,12 +50,13 @@ | |||
50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 50 | MediaPlayerState::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 | streaming = false; | 54 | streaming = false; |
55 | seekable = true; | 55 | seekable = true; |
56 | backendInitialized = false; | ||
56 | } | 57 | } |
57 | 58 | ||
58 | 59 | ||
59 | MediaPlayerState::~MediaPlayerState() { | 60 | MediaPlayerState::~MediaPlayerState() { |
60 | } | 61 | } |
61 | 62 | ||
@@ -82,12 +83,24 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
82 | cfg.writeEntry( "Scaling", scaled ); | 83 | cfg.writeEntry( "Scaling", scaled ); |
83 | cfg.writeEntry( "Looping", looping ); | 84 | cfg.writeEntry( "Looping", looping ); |
84 | cfg.writeEntry( "Shuffle", shuffled ); | 85 | cfg.writeEntry( "Shuffle", shuffled ); |
85 | cfg.writeEntry( "VideoGamma", videoGamma ); | 86 | cfg.writeEntry( "VideoGamma", videoGamma ); |
86 | } | 87 | } |
87 | 88 | ||
89 | bool MediaPlayerState::isInitialized() const | ||
90 | { | ||
91 | return backendInitialized; // for now, more to come (skin stuff) | ||
92 | } | ||
93 | |||
94 | void MediaPlayerState::setBackendInitialized() | ||
95 | { | ||
96 | assert( backendInitialized == false ); | ||
97 | backendInitialized = true; | ||
98 | emit initialized(); | ||
99 | } | ||
100 | |||
88 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | 101 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const |
89 | { | 102 | { |
90 | return m_displayType; | 103 | return m_displayType; |
91 | } | 104 | } |
92 | 105 | ||
93 | // slots | 106 | // slots |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index c887bb8..6fe6d76 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -58,12 +58,13 @@ public: | |||
58 | bool isScaled() const { return scaled; } | 58 | bool isScaled() const { return scaled; } |
59 | bool isLooping() const { return looping; } | 59 | bool isLooping() const { return looping; } |
60 | bool isShuffled() const { return shuffled; } | 60 | bool isShuffled() const { return shuffled; } |
61 | bool isPaused() const { return paused; } | 61 | bool isPaused() const { return paused; } |
62 | bool isPlaying() const { return playing; } | 62 | bool isPlaying() const { return playing; } |
63 | bool isStopped() const { return stopped; } | 63 | bool isStopped() const { return stopped; } |
64 | bool isInitialized() const; | ||
64 | long position() const { return curPosition; } | 65 | long position() const { return curPosition; } |
65 | long length() const { return curLength; } | 66 | long length() const { return curLength; } |
66 | DisplayType displayType() const; | 67 | DisplayType displayType() const; |
67 | 68 | ||
68 | public slots: | 69 | public slots: |
69 | void setIsStreaming( bool b ); | 70 | void setIsStreaming( bool b ); |
@@ -94,12 +95,13 @@ public slots: | |||
94 | void toggleShuffled(); | 95 | void toggleShuffled(); |
95 | void togglePaused(); | 96 | void togglePaused(); |
96 | void togglePlaying(); | 97 | void togglePlaying(); |
97 | void toggleBlank(); | 98 | void toggleBlank(); |
98 | void writeConfig( Config& cfg ) const; | 99 | void writeConfig( Config& cfg ) const; |
99 | 100 | ||
101 | void setBackendInitialized(); | ||
100 | 102 | ||
101 | signals: | 103 | signals: |
102 | void fullscreenToggled( bool ); | 104 | void fullscreenToggled( bool ); |
103 | void scaledToggled( bool ); | 105 | void scaledToggled( bool ); |
104 | void loopingToggled( bool ); | 106 | void loopingToggled( bool ); |
105 | void shuffledToggled( bool ); | 107 | void shuffledToggled( bool ); |
@@ -113,24 +115,27 @@ signals: | |||
113 | void isSeekableToggled( bool ); | 115 | void isSeekableToggled( bool ); |
114 | void blankToggled( bool ); | 116 | void blankToggled( bool ); |
115 | void videoGammaChanged( int ); | 117 | void videoGammaChanged( int ); |
116 | void prev(); | 118 | void prev(); |
117 | void next(); | 119 | void next(); |
118 | 120 | ||
121 | void initialized(); | ||
122 | |||
119 | private: | 123 | private: |
120 | bool streaming : 1; | 124 | bool streaming : 1; |
121 | bool seekable : 1; | 125 | bool seekable : 1; |
122 | bool fullscreen: 1; | 126 | bool fullscreen: 1; |
123 | bool scaled : 1; | 127 | bool scaled : 1; |
124 | bool blanked : 1; | 128 | bool blanked : 1; |
125 | bool looping : 1; | 129 | bool looping : 1; |
126 | bool shuffled : 1; | 130 | bool shuffled : 1; |
127 | bool usePlaylist : 1; | 131 | bool usePlaylist : 1; |
128 | bool paused : 1; | 132 | bool paused : 1; |
129 | bool playing : 1; | 133 | bool playing : 1; |
130 | bool stopped : 1; | 134 | bool stopped : 1; |
135 | bool backendInitialized : 1; | ||
131 | long curPosition; | 136 | long curPosition; |
132 | long curLength; | 137 | long curLength; |
133 | DisplayType m_displayType; | 138 | DisplayType m_displayType; |
134 | int videoGamma; | 139 | int videoGamma; |
135 | void readConfig( Config& cfg ); | 140 | void readConfig( Config& cfg ); |
136 | 141 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index cba7b6d..8e4f56d 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -62,13 +62,13 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
63 | "opieplayer2/add_to_playlist", | 63 | "opieplayer2/add_to_playlist", |
64 | this , SLOT(addSelected() ) ); | 64 | this , SLOT(addSelected() ) ); |
65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
66 | "opieplayer2/remove_from_playlist", | 66 | "opieplayer2/remove_from_playlist", |
67 | this , SLOT(removeSelected() ) ); | 67 | this , SLOT(removeSelected() ) ); |
68 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 68 | d->tbPlay = new PlayButton( mediaPlayerState, bar, tr( "Play" ), "opieplayer2/play", |
69 | this , SLOT( btnPlay( bool) ), TRUE ); | 69 | this , SLOT( btnPlay( bool) ), TRUE ); |
70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
71 | &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 71 | &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
73 | &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 73 | &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
74 | 74 | ||
@@ -148,12 +148,14 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
148 | populateSkinsMenu(); | 148 | populateSkinsMenu(); |
149 | initializeStates(); | 149 | initializeStates(); |
150 | 150 | ||
151 | cfg.setGroup("PlayList"); | 151 | cfg.setGroup("PlayList"); |
152 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 152 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
153 | loadList(DocLnk( currentPlaylist ) ); | 153 | loadList(DocLnk( currentPlaylist ) ); |
154 | |||
155 | tabWidget->showPage( playListTab ); | ||
154 | } | 156 | } |
155 | 157 | ||
156 | 158 | ||
157 | PlayListWidget::~PlayListWidget() { | 159 | PlayListWidget::~PlayListWidget() { |
158 | delete d; | 160 | delete d; |
159 | } | 161 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 5886458..23b7a70 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | |||
@@ -118,22 +118,21 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
118 | vbox5 = new QVBox( this ); | 118 | vbox5 = new QVBox( this ); |
119 | QVBox *vbox4 = new QVBox( vbox5 ); | 119 | QVBox *vbox4 = new QVBox( vbox5 ); |
120 | QHBox *hbox6 = new QHBox( vbox4 ); | 120 | QHBox *hbox6 = new QHBox( vbox4 ); |
121 | 121 | ||
122 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 122 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
123 | 123 | ||
124 | QWidget *pTab; | 124 | playListTab = new QWidget( tabWidget, "PlayListTab" ); |
125 | pTab = new QWidget( tabWidget, "pTab" ); | 125 | tabWidget->insertTab( playListTab, "Playlist"); |
126 | tabWidget->insertTab( pTab, "Playlist"); | ||
127 | 126 | ||
128 | QGridLayout *Playout = new QGridLayout( pTab ); | 127 | QGridLayout *Playout = new QGridLayout( playListTab ); |
129 | Playout->setSpacing( 2); | 128 | Playout->setSpacing( 2); |
130 | Playout->setMargin( 2); | 129 | Playout->setMargin( 2); |
131 | 130 | ||
132 | // Add the playlist area | 131 | // Add the playlist area |
133 | QVBox *vbox3 = new QVBox( pTab ); | 132 | QVBox *vbox3 = new QVBox( playListTab ); |
134 | d->playListFrame = vbox3; | 133 | d->playListFrame = vbox3; |
135 | 134 | ||
136 | QHBox *hbox2 = new QHBox( vbox3 ); | 135 | QHBox *hbox2 = new QHBox( vbox3 ); |
137 | d->selectedFiles = new PlayListSelection( hbox2 ); | 136 | d->selectedFiles = new PlayListSelection( hbox2 ); |
138 | 137 | ||
139 | vbox1 = new QVBox( hbox2 ); | 138 | vbox1 = new QVBox( hbox2 ); |
@@ -201,6 +200,29 @@ void PlayListWidgetGui::setActiveWindow() { | |||
201 | // When we get raised we need to ensure that it switches views | 200 | // When we get raised we need to ensure that it switches views |
202 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); | 201 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); |
203 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate | 202 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate |
204 | mediaPlayerState.setDisplayType( origDisplayType ); // now switch back | 203 | mediaPlayerState.setDisplayType( origDisplayType ); // now switch back |
205 | } | 204 | } |
206 | 205 | ||
206 | PlayButton::PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name, | ||
207 | const QString &icon, QObject *handler, const QString &slot, bool t ) | ||
208 | : ToolButton( parent, name, icon, handler, slot, t ), mediaPlayerState( _mediaPlayerState ), | ||
209 | m_lastEnableStatus( true ) | ||
210 | { | ||
211 | connect( &mediaPlayerState, SIGNAL( initialized() ), | ||
212 | this, SLOT( checkInitializationStatus() ) ); | ||
213 | } | ||
214 | |||
215 | void PlayButton::setEnabled( bool enable ) | ||
216 | { | ||
217 | m_lastEnableStatus = enable; | ||
218 | |||
219 | enable &= mediaPlayerState.isInitialized(); | ||
220 | |||
221 | ToolButton::setEnabled( enable ); | ||
222 | } | ||
223 | |||
224 | void PlayButton::checkInitializationStatus() | ||
225 | { | ||
226 | setEnabled( m_lastEnableStatus ); | ||
227 | } | ||
228 | |||
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h index 0d8af43..1aa8ac8 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h | |||
@@ -67,12 +67,13 @@ public: | |||
67 | PlayListSelection *selectedFiles; | 67 | PlayListSelection *selectedFiles; |
68 | bool setDocumentUsed; | 68 | bool setDocumentUsed; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | 71 | ||
72 | class ToolButton : public QToolButton { | 72 | class ToolButton : public QToolButton { |
73 | Q_OBJECT | ||
73 | public: | 74 | public: |
74 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 75 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
75 | : QToolButton( parent, name ) { | 76 | : QToolButton( parent, name ) { |
76 | setTextLabel( name ); | 77 | setTextLabel( name ); |
77 | setPixmap( Resource::loadPixmap( icon ) ); | 78 | setPixmap( Resource::loadPixmap( icon ) ); |
78 | setAutoRaise( TRUE ); | 79 | setAutoRaise( TRUE ); |
@@ -80,12 +81,29 @@ public: | |||
80 | setToggleButton( t ); | 81 | setToggleButton( t ); |
81 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 82 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
82 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 83 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
83 | } | 84 | } |
84 | }; | 85 | }; |
85 | 86 | ||
87 | class PlayButton : public ToolButton | ||
88 | { | ||
89 | Q_OBJECT | ||
90 | public: | ||
91 | PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name, | ||
92 | const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ); | ||
93 | |||
94 | protected: | ||
95 | virtual void setEnabled( bool enable ); | ||
96 | |||
97 | private slots: | ||
98 | void checkInitializationStatus(); | ||
99 | |||
100 | private: | ||
101 | MediaPlayerState &mediaPlayerState; | ||
102 | bool m_lastEnableStatus : 1; | ||
103 | }; | ||
86 | 104 | ||
87 | class MenuItem : public QAction { | 105 | class MenuItem : public QAction { |
88 | 106 | ||
89 | public: | 107 | public: |
90 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 108 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
91 | : QAction( text, QString::null, 0, 0 ) { | 109 | : QAction( text, QString::null, 0, 0 ) { |
@@ -119,12 +137,13 @@ protected: | |||
119 | FileSelector* playLists; | 137 | FileSelector* playLists; |
120 | QPopupMenu *skinsMenu; | 138 | QPopupMenu *skinsMenu; |
121 | PlayListWidgetPrivate *d; // Private implementation data | 139 | PlayListWidgetPrivate *d; // Private implementation data |
122 | QVBox *vbox1; | 140 | QVBox *vbox1; |
123 | QVBox *vbox5; | 141 | QVBox *vbox5; |
124 | QPEToolBar *bar; | 142 | QPEToolBar *bar; |
143 | QWidget *playListTab; | ||
125 | void setActiveWindow(); // need to handle this to show the right view | 144 | void setActiveWindow(); // need to handle this to show the right view |
126 | void setView( char ); | 145 | void setView( char ); |
127 | 146 | ||
128 | MediaPlayerState &mediaPlayerState; | 147 | MediaPlayerState &mediaPlayerState; |
129 | }; | 148 | }; |
130 | 149 | ||