summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 00:03:47 (UTC)
committer simon <simon>2002-12-11 00:03:47 (UTC)
commite9d1213578b83f8380c4681186246a2b32ae6375 (patch) (unidiff)
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
@@ -365,6 +365,7 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
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
370void MediaPlayer::reloadSkins() 371void 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 )
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
@@ -85,6 +86,18 @@ void MediaPlayerState::writeConfig( Config& cfg ) const {
85 cfg.writeEntry( "VideoGamma", videoGamma ); 86 cfg.writeEntry( "VideoGamma", videoGamma );
86} 87}
87 88
89bool MediaPlayerState::isInitialized() const
90{
91 return backendInitialized; // for now, more to come (skin stuff)
92}
93
94void MediaPlayerState::setBackendInitialized()
95{
96 assert( backendInitialized == false );
97 backendInitialized = true;
98 emit initialized();
99}
100
88MediaPlayerState::DisplayType MediaPlayerState::displayType() const 101MediaPlayerState::DisplayType MediaPlayerState::displayType() const
89{ 102{
90 return m_displayType; 103 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:
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;
@@ -97,6 +98,7 @@ public slots:
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
101signals: 103signals:
102 void fullscreenToggled( bool ); 104 void fullscreenToggled( bool );
@@ -116,6 +118,8 @@ signals:
116 void prev(); 118 void prev();
117 void next(); 119 void next();
118 120
121 void initialized();
122
119private: 123private:
120 bool streaming : 1; 124 bool streaming : 1;
121 bool seekable : 1; 125 bool seekable : 1;
@@ -128,6 +132,7 @@ private:
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;
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
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 );
@@ -151,6 +151,8 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
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
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
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 );
@@ -204,3 +203,26 @@ void PlayListWidgetGui::setActiveWindow() {
204 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back 203 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back
205} 204}
206 205
206PlayButton::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
215void PlayButton::setEnabled( bool enable )
216{
217 m_lastEnableStatus = enable;
218
219 enable &= mediaPlayerState.isInitialized();
220
221 ToolButton::setEnabled( enable );
222}
223
224void 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
@@ -70,6 +70,7 @@ public:
70 70
71 71
72class ToolButton : public QToolButton { 72class ToolButton : public QToolButton {
73 Q_OBJECT
73public: 74public:
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 ) {
@@ -83,6 +84,23 @@ public:
83 } 84 }
84}; 85};
85 86
87class PlayButton : public ToolButton
88{
89 Q_OBJECT
90public:
91 PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name,
92 const QString& icon, QObject *handler, const QString& slot, bool t = FALSE );
93
94protected:
95 virtual void setEnabled( bool enable );
96
97private slots:
98 void checkInitializationStatus();
99
100private:
101 MediaPlayerState &mediaPlayerState;
102 bool m_lastEnableStatus : 1;
103};
86 104
87class MenuItem : public QAction { 105class MenuItem : public QAction {
88 106
@@ -122,6 +140,7 @@ protected:
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