summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 00:03:47 (UTC)
committer simon <simon>2002-12-11 00:03:47 (UTC)
commite9d1213578b83f8380c4681186246a2b32ae6375 (patch) (side-by-side diff)
tree8d18cd8172ff45c85c8438cf5f16d630a7bb5aeb
parent7f4bd526d59aacbf750e9ee58337b6cf640ba28b (diff)
downloadopie-e9d1213578b83f8380c4681186246a2b32ae6375.zip
opie-e9d1213578b83f8380c4681186246a2b32ae6375.tar.gz
opie-e9d1213578b83f8380c4681186246a2b32ae6375.tar.bz2
- added initialize states to MediaPlayerState
- the play button is now of type PlayButton, inheritting from ToolButton and checking the media player initialization state in setEnabled
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp32
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h19
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()
xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState );
+ mediaPlayerState.setBackendInitialized();
}
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 )
seekable = true;
+ backendInitialized = false;
}
@@ -87,2 +88,14 @@ void MediaPlayerState::writeConfig( Config& cfg ) const {
+bool MediaPlayerState::isInitialized() const
+{
+ return backendInitialized; // for now, more to come (skin stuff)
+}
+
+void MediaPlayerState::setBackendInitialized()
+{
+ assert( backendInitialized == false );
+ backendInitialized = true;
+ emit initialized();
+}
+
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:
bool isStopped() const { return stopped; }
+ bool isInitialized() const;
long position() const { return curPosition; }
@@ -99,2 +100,3 @@ public slots:
+ void setBackendInitialized();
@@ -118,2 +120,4 @@ signals:
+ void initialized();
+
private:
@@ -130,2 +134,3 @@ private:
bool stopped : 1;
+ bool backendInitialized : 1;
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
this , SLOT(removeSelected() ) );
- d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
+ d->tbPlay = new PlayButton( mediaPlayerState, bar, tr( "Play" ), "opieplayer2/play",
this , SLOT( btnPlay( bool) ), TRUE );
@@ -153,2 +153,4 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
loadList(DocLnk( currentPlaylist ) );
+
+ tabWidget->showPage( playListTab );
}
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
- QWidget *pTab;
- pTab = new QWidget( tabWidget, "pTab" );
- tabWidget->insertTab( pTab, "Playlist");
+ playListTab = new QWidget( tabWidget, "PlayListTab" );
+ tabWidget->insertTab( playListTab, "Playlist");
- QGridLayout *Playout = new QGridLayout( pTab );
+ QGridLayout *Playout = new QGridLayout( playListTab );
Playout->setSpacing( 2);
@@ -132,3 +131,3 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
// Add the playlist area
- QVBox *vbox3 = new QVBox( pTab );
+ QVBox *vbox3 = new QVBox( playListTab );
d->playListFrame = vbox3;
@@ -206 +205,24 @@ void PlayListWidgetGui::setActiveWindow() {
+PlayButton::PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name,
+ const QString &icon, QObject *handler, const QString &slot, bool t )
+ : ToolButton( parent, name, icon, handler, slot, t ), mediaPlayerState( _mediaPlayerState ),
+ m_lastEnableStatus( true )
+{
+ connect( &mediaPlayerState, SIGNAL( initialized() ),
+ this, SLOT( checkInitializationStatus() ) );
+}
+
+void PlayButton::setEnabled( bool enable )
+{
+ m_lastEnableStatus = enable;
+
+ enable &= mediaPlayerState.isInitialized();
+
+ ToolButton::setEnabled( enable );
+}
+
+void PlayButton::checkInitializationStatus()
+{
+ setEnabled( m_lastEnableStatus );
+}
+
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:
class ToolButton : public QToolButton {
+ Q_OBJECT
public:
@@ -85,2 +86,19 @@ public:
+class PlayButton : public ToolButton
+{
+ Q_OBJECT
+public:
+ PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name,
+ const QString& icon, QObject *handler, const QString& slot, bool t = FALSE );
+
+protected:
+ virtual void setEnabled( bool enable );
+
+private slots:
+ void checkInitializationStatus();
+
+private:
+ MediaPlayerState &mediaPlayerState;
+ bool m_lastEnableStatus : 1;
+};
@@ -124,2 +142,3 @@ protected:
QPEToolBar *bar;
+ QWidget *playListTab;
void setActiveWindow(); // need to handle this to show the right view