summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -365,6 +365,7 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState );
+ mediaPlayerState.setBackendInitialized();
}
void MediaPlayer::reloadSkins()
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
@@ -53,6 +53,7 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
readConfig( cfg );
streaming = false;
seekable = true;
+ backendInitialized = false;
}
@@ -85,6 +86,18 @@ void MediaPlayerState::writeConfig( Config& cfg ) const {
cfg.writeEntry( "VideoGamma", videoGamma );
}
+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
{
return m_displayType;
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
@@ -61,6 +61,7 @@ public:
bool isPaused() const { return paused; }
bool isPlaying() const { return playing; }
bool isStopped() const { return stopped; }
+ bool isInitialized() const;
long position() const { return curPosition; }
long length() const { return curLength; }
DisplayType displayType() const;
@@ -97,6 +98,7 @@ public slots:
void toggleBlank();
void writeConfig( Config& cfg ) const;
+ void setBackendInitialized();
signals:
void fullscreenToggled( bool );
@@ -116,6 +118,8 @@ signals:
void prev();
void next();
+ void initialized();
+
private:
bool streaming : 1;
bool seekable : 1;
@@ -128,6 +132,7 @@ private:
bool paused : 1;
bool playing : 1;
bool stopped : 1;
+ bool backendInitialized : 1;
long curPosition;
long curLength;
DisplayType m_displayType;
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
@@ -65,7 +65,7 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
"opieplayer2/remove_from_playlist",
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 );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
&mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
@@ -151,6 +151,8 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
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
@@ -121,16 +121,15 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
tabWidget = new QTabWidget( hbox6, "tabWidget" );
- 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);
Playout->setMargin( 2);
// Add the playlist area
- QVBox *vbox3 = new QVBox( pTab );
+ QVBox *vbox3 = new QVBox( playListTab );
d->playListFrame = vbox3;
QHBox *hbox2 = new QHBox( vbox3 );
@@ -204,3 +203,26 @@ void PlayListWidgetGui::setActiveWindow() {
mediaPlayerState.setDisplayType( origDisplayType ); // now switch back
}
+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
@@ -70,6 +70,7 @@ public:
class ToolButton : public QToolButton {
+ Q_OBJECT
public:
ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
: QToolButton( parent, name ) {
@@ -83,6 +84,23 @@ 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;
+};
class MenuItem : public QAction {
@@ -122,6 +140,7 @@ protected:
QVBox *vbox1;
QVBox *vbox5;
QPEToolBar *bar;
+ QWidget *playListTab;
void setActiveWindow(); // need to handle this to show the right view
void setView( char );