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 | |||
@@ -367,2 +367,3 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
367 | xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); | 367 | xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); |
368 | mediaPlayerState.setBackendInitialized(); | ||
368 | } | 369 | } |
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 | |||
@@ -55,2 +55,3 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | |||
55 | seekable = true; | 55 | seekable = true; |
56 | backendInitialized = false; | ||
56 | } | 57 | } |
@@ -87,2 +88,14 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
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 |
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 | |||
@@ -63,2 +63,3 @@ public: | |||
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; } |
@@ -99,2 +100,3 @@ public slots: | |||
99 | 100 | ||
101 | void setBackendInitialized(); | ||
100 | 102 | ||
@@ -118,2 +120,4 @@ signals: | |||
118 | 120 | ||
121 | void initialized(); | ||
122 | |||
119 | private: | 123 | private: |
@@ -130,2 +134,3 @@ private: | |||
130 | bool stopped : 1; | 134 | bool stopped : 1; |
135 | bool backendInitialized : 1; | ||
131 | long curPosition; | 136 | long curPosition; |
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 | |||
@@ -67,3 +67,3 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
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 ); |
@@ -153,2 +153,4 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
153 | loadList(DocLnk( currentPlaylist ) ); | 153 | loadList(DocLnk( currentPlaylist ) ); |
154 | |||
155 | tabWidget->showPage( playListTab ); | ||
154 | } | 156 | } |
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 | |||
@@ -123,7 +123,6 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
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); |
@@ -132,3 +131,3 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
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; |
@@ -206 +205,24 @@ void PlayListWidgetGui::setActiveWindow() { | |||
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 | |||
@@ -72,2 +72,3 @@ public: | |||
72 | class ToolButton : public QToolButton { | 72 | class ToolButton : public QToolButton { |
73 | Q_OBJECT | ||
73 | public: | 74 | public: |
@@ -85,2 +86,19 @@ public: | |||
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 | ||
@@ -124,2 +142,3 @@ protected: | |||
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 |