summaryrefslogtreecommitdiff
Unidiff
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
@@ -344,32 +344,33 @@ void MediaPlayer::cleanUp() {// this happens on closing
344 344
345// QPEApplication::grabKeyboard(); 345// QPEApplication::grabKeyboard();
346// QPEApplication::ungrabKeyboard(); 346// QPEApplication::ungrabKeyboard();
347} 347}
348 348
349void MediaPlayer::recreateAudioAndVideoWidgets() 349void MediaPlayer::recreateAudioAndVideoWidgets()
350{ 350{
351 delete xineControl; 351 delete xineControl;
352 delete audioUI; 352 delete audioUI;
353 delete videoUI; 353 delete videoUI;
354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
356 356
357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
361 361
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
370void MediaPlayer::reloadSkins() 371void MediaPlayer::reloadSkins()
371{ 372{
372 audioUI->loadSkin(); 373 audioUI->loadSkin();
373 videoUI->loadSkin(); 374 videoUI->loadSkin();
374} 375}
375 376
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
@@ -32,80 +32,93 @@
32*/ 32*/
33 33
34// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qlibrary.h> 37#include <qpe/qlibrary.h>
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <qvaluelist.h> 39#include <qvaluelist.h>
40#include <qobject.h> 40#include <qobject.h>
41#include <qdir.h> 41#include <qdir.h>
42#include "mediaplayerstate.h" 42#include "mediaplayerstate.h"
43 43
44#include <assert.h> 44#include <assert.h>
45 45
46//#define MediaPlayerDebug(x) qDebug x 46//#define MediaPlayerDebug(x) qDebug x
47#define MediaPlayerDebug(x) 47#define MediaPlayerDebug(x)
48 48
49 49
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::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
59MediaPlayerState::~MediaPlayerState() { 60MediaPlayerState::~MediaPlayerState() {
60} 61}
61 62
62 63
63void MediaPlayerState::readConfig( Config& cfg ) { 64void MediaPlayerState::readConfig( Config& cfg ) {
64 cfg.setGroup("Options"); 65 cfg.setGroup("Options");
65 fullscreen = cfg.readBoolEntry( "FullScreen" ); 66 fullscreen = cfg.readBoolEntry( "FullScreen" );
66 scaled = cfg.readBoolEntry( "Scaling" ); 67 scaled = cfg.readBoolEntry( "Scaling" );
67 looping = cfg.readBoolEntry( "Looping" ); 68 looping = cfg.readBoolEntry( "Looping" );
68 shuffled = cfg.readBoolEntry( "Shuffle" ); 69 shuffled = cfg.readBoolEntry( "Shuffle" );
69 videoGamma = cfg.readNumEntry( "VideoGamma" ); 70 videoGamma = cfg.readNumEntry( "VideoGamma" );
70 playing = FALSE; 71 playing = FALSE;
71 streaming = FALSE; 72 streaming = FALSE;
72 paused = FALSE; 73 paused = FALSE;
73 curPosition = 0; 74 curPosition = 0;
74 curLength = 0; 75 curLength = 0;
75 m_displayType = MediaSelection; 76 m_displayType = MediaSelection;
76} 77}
77 78
78 79
79void MediaPlayerState::writeConfig( Config& cfg ) const { 80void MediaPlayerState::writeConfig( Config& cfg ) const {
80 cfg.setGroup( "Options" ); 81 cfg.setGroup( "Options" );
81 cfg.writeEntry( "FullScreen", fullscreen ); 82 cfg.writeEntry( "FullScreen", fullscreen );
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
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;
91} 104}
92 105
93// slots 106// slots
94void MediaPlayerState::setIsStreaming( bool b ) { 107void MediaPlayerState::setIsStreaming( bool b ) {
95 streaming = b; 108 streaming = b;
96} 109}
97 110
98void MediaPlayerState::setIsSeekable( bool b ) { 111void MediaPlayerState::setIsSeekable( bool b ) {
99 seekable = b; 112 seekable = b;
100 emit isSeekableToggled(b); 113 emit isSeekableToggled(b);
101} 114}
102 115
103 116
104void MediaPlayerState::setFullscreen( bool b ) { 117void MediaPlayerState::setFullscreen( bool b ) {
105 if ( fullscreen == b ) { 118 if ( fullscreen == b ) {
106 return; 119 return;
107 } 120 }
108 fullscreen = b; 121 fullscreen = b;
109 emit fullscreenToggled(b); 122 emit fullscreenToggled(b);
110} 123}
111 124
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
@@ -40,102 +40,107 @@
40#include <qobject.h> 40#include <qobject.h>
41 41
42 42
43class MediaPlayerDecoder; 43class MediaPlayerDecoder;
44class Config; 44class Config;
45 45
46 46
47class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
48Q_OBJECT 48Q_OBJECT
49public: 49public:
50 enum DisplayType { Audio, Video, MediaSelection }; 50 enum DisplayType { Audio, Video, MediaSelection };
51 51
52 MediaPlayerState( QObject *parent, const char *name ); 52 MediaPlayerState( QObject *parent, const char *name );
53 ~MediaPlayerState(); 53 ~MediaPlayerState();
54 54
55 bool isStreaming() const { return streaming; } 55 bool isStreaming() const { return streaming; }
56 bool isSeekable() const { return seekable; } 56 bool isSeekable() const { return seekable; }
57 bool isFullscreen() const { return fullscreen; } 57 bool isFullscreen() const { return fullscreen; }
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
68public slots: 69public slots:
69 void setIsStreaming( bool b ); 70 void setIsStreaming( bool b );
70 void setIsSeekable( bool b ); 71 void setIsSeekable( bool b );
71 void setFullscreen( bool b ); 72 void setFullscreen( bool b );
72 void setScaled( bool b ); 73 void setScaled( bool b );
73 void setLooping( bool b ); 74 void setLooping( bool b );
74 void setShuffled( bool b ); 75 void setShuffled( bool b );
75 void setPaused( bool b ); 76 void setPaused( bool b );
76 void setPlaying( bool b ); 77 void setPlaying( bool b );
77 void setStopped( bool b ); 78 void setStopped( bool b );
78 void setPosition( long p ); 79 void setPosition( long p );
79 void updatePosition( long p ); 80 void updatePosition( long p );
80 void setLength( long l ); 81 void setLength( long l );
81 void setDisplayType( MediaPlayerState::DisplayType displayType ); 82 void setDisplayType( MediaPlayerState::DisplayType displayType );
82 void setBlanked( bool b ); 83 void setBlanked( bool b );
83 void setVideoGamma( int v ); 84 void setVideoGamma( int v );
84 85
85 void setPrev(); 86 void setPrev();
86 void setNext(); 87 void setNext();
87 void setList(); 88 void setList();
88 void setVideo(); 89 void setVideo();
89 void setAudio(); 90 void setAudio();
90 91
91 void toggleFullscreen(); 92 void toggleFullscreen();
92 void toggleScaled(); 93 void toggleScaled();
93 void toggleLooping(); 94 void toggleLooping();
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
101signals: 103signals:
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 );
106 void pausedToggled( bool ); 108 void pausedToggled( bool );
107 void playingToggled( bool ); 109 void playingToggled( bool );
108 void stopToggled( bool ); 110 void stopToggled( bool );
109 void positionChanged( long ); // When the slider is moved 111 void positionChanged( long ); // When the slider is moved
110 void positionUpdated( long ); // When the media file progresses 112 void positionUpdated( long ); // When the media file progresses
111 void lengthChanged( long ); 113 void lengthChanged( long );
112 void displayTypeChanged( MediaPlayerState::DisplayType type ); 114 void displayTypeChanged( MediaPlayerState::DisplayType type );
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
119private: 123private:
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
137}; 142};
138 143
139 144
140#endif // MEDIA_PLAYER_STATE_H 145#endif // MEDIA_PLAYER_STATE_H
141 146
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
@@ -44,49 +44,49 @@
44#include <qregexp.h> 44#include <qregexp.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46 46
47#include "playlistselection.h" 47#include "playlistselection.h"
48#include "playlistwidget.h" 48#include "playlistwidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "inputDialog.h" 50#include "inputDialog.h"
51#include "om3u.h" 51#include "om3u.h"
52#include "playlistfileview.h" 52#include "playlistfileview.h"
53 53
54//only needed for the random play 54//only needed for the random play
55#include <stdlib.h> 55#include <stdlib.h>
56#include <assert.h> 56#include <assert.h>
57 57
58PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 58PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
59 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) 59 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 )
60{ 60{
61 61
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
75 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 75 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
76 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 76 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
77 this, SLOT( addAllMusicToList() ) ); 77 this, SLOT( addAllMusicToList() ) );
78 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 78 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
79 this, SLOT( addAllVideoToList() ) ); 79 this, SLOT( addAllVideoToList() ) );
80 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 80 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
81 this, SLOT( addAllToList() ) ); 81 this, SLOT( addAllToList() ) );
82 pmPlayList->insertSeparator(-1); 82 pmPlayList->insertSeparator(-1);
83// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 83// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
84// this, SLOT( saveList() ) ); 84// this, SLOT( saveList() ) );
85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
86 this, SLOT(writem3u() ) ); 86 this, SLOT(writem3u() ) );
87 pmPlayList->insertSeparator(-1); 87 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 88 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
89 this,SLOT( openFile() ) ); 89 this,SLOT( openFile() ) );
90 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
91 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 91 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
92 audioView, SLOT( scanFiles() ) ); 92 audioView, SLOT( scanFiles() ) );
@@ -130,48 +130,50 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
130 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 130 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
131 this, SLOT( addToSelection( QListViewItem *) ) ); 131 this, SLOT( addToSelection( QListViewItem *) ) );
132 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 132 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
133 this, SLOT( loadList( const DocLnk & ) ) ); 133 this, SLOT( loadList( const DocLnk & ) ) );
134 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 134 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
135 this, SLOT( tabChanged( QWidget* ) ) ); 135 this, SLOT( tabChanged( QWidget* ) ) );
136 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 136 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
137 d->tbPlay, SLOT( setOn( bool ) ) ); 137 d->tbPlay, SLOT( setOn( bool ) ) );
138 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 138 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
139 d->tbLoop, SLOT( setOn( bool ) ) ); 139 d->tbLoop, SLOT( setOn( bool ) ) );
140 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 140 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
141 d->tbShuffle, SLOT( setOn( bool ) ) ); 141 d->tbShuffle, SLOT( setOn( bool ) ) );
142 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 142 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
143 this, SLOT( playIt( QListViewItem *) ) ); 143 this, SLOT( playIt( QListViewItem *) ) );
144 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 144 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
145 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 145 &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
146 146
147 // see which skins are installed 147 // see which skins are installed
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
157PlayListWidget::~PlayListWidget() { 159PlayListWidget::~PlayListWidget() {
158 delete d; 160 delete d;
159} 161}
160 162
161 163
162void PlayListWidget::initializeStates() { 164void PlayListWidget::initializeStates() {
163 d->tbPlay->setOn( mediaPlayerState.isPlaying() ); 165 d->tbPlay->setOn( mediaPlayerState.isPlaying() );
164 d->tbLoop->setOn( mediaPlayerState.isLooping() ); 166 d->tbLoop->setOn( mediaPlayerState.isLooping() );
165 d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); 167 d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
166 d->playListFrame->show(); 168 d->playListFrame->show();
167} 169}
168 170
169void PlayListWidget::writeDefaultPlaylist() { 171void PlayListWidget::writeDefaultPlaylist() {
170 172
171 Config config( "OpiePlayer" ); 173 Config config( "OpiePlayer" );
172 config.setGroup( "PlayList" ); 174 config.setGroup( "PlayList" );
173 QString filename=QPEApplication::documentDir() + "/default.m3u"; 175 QString filename=QPEApplication::documentDir() + "/default.m3u";
174 QString currentString = config.readEntry( "CurrentPlaylist", filename); 176 QString currentString = config.readEntry( "CurrentPlaylist", filename);
175 if( currentString == filename) { 177 if( currentString == filename) {
176 Om3u *m3uList; 178 Om3u *m3uList;
177 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 179 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
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
@@ -100,58 +100,57 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
100 100
101 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 101 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
102 gammaSlider->setRange( -40, 40 ); 102 gammaSlider->setRange( -40, 40 );
103 gammaSlider->setTickmarks( QSlider::Left ); 103 gammaSlider->setTickmarks( QSlider::Left );
104 gammaSlider->setTickInterval( 20 ); 104 gammaSlider->setTickInterval( 20 );
105 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 105 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
106 gammaSlider->setValue( 0 ); 106 gammaSlider->setValue( 0 );
107 gammaSlider->setMinimumHeight( 50 ); 107 gammaSlider->setMinimumHeight( 50 );
108 108
109 gammaLCD = new QLCDNumber( 3, gammaMenu ); 109 gammaLCD = new QLCDNumber( 3, gammaMenu );
110 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 110 gammaLCD-> setFrameShape ( QFrame::NoFrame );
111 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 111 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
112 112
113 gammaMenu->insertItem( gammaSlider ); 113 gammaMenu->insertItem( gammaSlider );
114 gammaMenu->insertItem( gammaLCD ); 114 gammaMenu->insertItem( gammaLCD );
115 115
116 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 116 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
117 117
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 );
140 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 139 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
141 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 140 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
142 141
143 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 142 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
144 143
145 QWidget *aTab; 144 QWidget *aTab;
146 aTab = new QWidget( tabWidget, "aTab" ); 145 aTab = new QWidget( tabWidget, "aTab" );
147 146
148 QGridLayout *Alayout = new QGridLayout( aTab ); 147 QGridLayout *Alayout = new QGridLayout( aTab );
149 Alayout->setSpacing( 2 ); 148 Alayout->setSpacing( 2 );
150 Alayout->setMargin( 2 ); 149 Alayout->setMargin( 2 );
151 // no m3u's here please 150 // no m3u's here please
152 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" ); 151 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" );
153 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 152 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
154 tabWidget->insertTab( aTab, tr( "Audio" ) ); 153 tabWidget->insertTab( aTab, tr( "Audio" ) );
155 154
156 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 155 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
157 156
@@ -183,24 +182,47 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
183 setCentralWidget( vbox5 ); 182 setCentralWidget( vbox5 );
184} 183}
185 184
186 185
187 186
188PlayListWidgetGui::~PlayListWidgetGui() { 187PlayListWidgetGui::~PlayListWidgetGui() {
189} 188}
190 189
191void PlayListWidgetGui::setView( char view ) { 190void PlayListWidgetGui::setView( char view ) {
192 if ( view == 'l' ) 191 if ( view == 'l' )
193 showMaximized(); 192 showMaximized();
194 else 193 else
195 hide(); 194 hide();
196} 195}
197 196
198 197
199void PlayListWidgetGui::setActiveWindow() { 198void PlayListWidgetGui::setActiveWindow() {
200 // qDebug("SETTING active window"); 199 // qDebug("SETTING active window");
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
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
@@ -49,84 +49,103 @@
49 49
50class PlayListWidgetPrivate; 50class PlayListWidgetPrivate;
51class PlayListSelection; 51class PlayListSelection;
52class MediaPlayerState; 52class MediaPlayerState;
53class PlayListFileView; 53class PlayListFileView;
54 54
55class Config; 55class Config;
56class QPEToolBar; 56class QPEToolBar;
57class QListViewItem; 57class QListViewItem;
58class QListView; 58class QListView;
59class QPoint; 59class QPoint;
60class QAction; 60class QAction;
61class QLabel; 61class QLabel;
62 62
63class PlayListWidgetPrivate { 63class PlayListWidgetPrivate {
64public: 64public:
65 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 65 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
66 QFrame *playListFrame; 66 QFrame *playListFrame;
67 PlayListSelection *selectedFiles; 67 PlayListSelection *selectedFiles;
68 bool setDocumentUsed; 68 bool setDocumentUsed;
69}; 69};
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 ) {
76 setTextLabel( name ); 77 setTextLabel( name );
77 setPixmap( Resource::loadPixmap( icon ) ); 78 setPixmap( Resource::loadPixmap( icon ) );
78 setAutoRaise( TRUE ); 79 setAutoRaise( TRUE );
79 setFocusPolicy( QWidget::NoFocus ); 80 setFocusPolicy( QWidget::NoFocus );
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
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
89public: 107public:
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 ) {
92 connect( this, SIGNAL( activated() ), handler, slot ); 110 connect( this, SIGNAL( activated() ), handler, slot );
93 addTo( parent ); 111 addTo( parent );
94 } 112 }
95}; 113};
96 114
97class PlayListWidgetGui : public QMainWindow { 115class PlayListWidgetGui : public QMainWindow {
98 Q_OBJECT 116 Q_OBJECT
99public: 117public:
100 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 ); 118 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 );
101 ~PlayListWidgetGui(); 119 ~PlayListWidgetGui();
102 120
103protected: 121protected:
104 QTabWidget * tabWidget; 122 QTabWidget * tabWidget;
105 PlayListFileView *audioView, *videoView; 123 PlayListFileView *audioView, *videoView;
106 QListView *playlistView; 124 QListView *playlistView;
107 QLabel *libString; 125 QLabel *libString;
108 QPopupMenu *pmView ; 126 QPopupMenu *pmView ;
109 QPopupMenu *gammaMenu; 127 QPopupMenu *gammaMenu;
110 QSlider *gammaSlider; 128 QSlider *gammaSlider;
111 QLCDNumber *gammaLCD; 129 QLCDNumber *gammaLCD;
112 bool fromSetDocument; 130 bool fromSetDocument;
113 bool insanityBool; 131 bool insanityBool;
114 QString setDocFileRef; 132 QString setDocFileRef;
115 // retrieve the current playlist entry (media file link) 133 // retrieve the current playlist entry (media file link)
116 QPushButton *tbDeletePlaylist; 134 QPushButton *tbDeletePlaylist;
117 int selected; 135 int selected;
118 QPopupMenu *pmPlayList; 136 QPopupMenu *pmPlayList;
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
131#endif 150#endif
132 151