author | llornkcor <llornkcor> | 2002-08-20 11:58:03 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-20 11:58:03 (UTC) |
commit | dfd3bcb3dd20cc72487c527d135e076a0ff78b25 (patch) (unidiff) | |
tree | 0e26510735ca9c2b65e39e03ab56c77372de8d6a | |
parent | b00ba7b9cdf02a4512f70694e2262ce6e3ebcb98 (diff) | |
download | opie-dfd3bcb3dd20cc72487c527d135e076a0ff78b25.zip opie-dfd3bcb3dd20cc72487c527d135e076a0ff78b25.tar.gz opie-dfd3bcb3dd20cc72487c527d135e076a0ff78b25.tar.bz2 |
move configwrite to a better place not in deconstructor
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 6a48b82..0526c2a 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -272,28 +272,30 @@ void MediaPlayer::blank( bool b ) { | |||
272 | 272 | ||
273 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 273 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
274 | switch ( e->key() ) { | 274 | switch ( e->key() ) { |
275 | ////////////////////////////// Zaurus keys | 275 | ////////////////////////////// Zaurus keys |
276 | case Key_Home: | 276 | case Key_Home: |
277 | break; | 277 | break; |
278 | case Key_F9: //activity | 278 | case Key_F9: //activity |
279 | break; | 279 | break; |
280 | case Key_F10: //contacts | 280 | case Key_F10: //contacts |
281 | break; | 281 | break; |
282 | case Key_F11: //menu | 282 | case Key_F11: //menu |
283 | break; | 283 | break; |
284 | case Key_F12: //home | 284 | case Key_F12: //home |
285 | qDebug("Blank here"); | 285 | qDebug("Blank here"); |
286 | // mediaPlayerState->toggleBlank(); | 286 | // mediaPlayerState->toggleBlank(); |
287 | break; | 287 | break; |
288 | case Key_F13: //mail | 288 | case Key_F13: //mail |
289 | qDebug("Blank here"); | 289 | qDebug("Blank here"); |
290 | // mediaPlayerState->toggleBlank(); | 290 | // mediaPlayerState->toggleBlank(); |
291 | break; | 291 | break; |
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | void MediaPlayer::cleanUp() {// this happens on closing | 295 | void MediaPlayer::cleanUp() {// this happens on closing |
296 | Config cfg( "OpiePlayer" ); | ||
297 | playList->writeConfig( cfg ); | ||
296 | 298 | ||
297 | // QPEApplication::grabKeyboard(); | 299 | // QPEApplication::grabKeyboard(); |
298 | // QPEApplication::ungrabKeyboard(); | 300 | // QPEApplication::ungrabKeyboard(); |
299 | } | 301 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 404e1fe..bc9b166 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -286,51 +286,48 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
286 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 286 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
287 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 287 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
288 | this,SLOT( playIt( QListViewItem *)) ); | 288 | this,SLOT( playIt( QListViewItem *)) ); |
289 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 289 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
290 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 290 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
291 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 291 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
292 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 292 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
293 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 293 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
294 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 294 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
295 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 295 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
296 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 296 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
297 | 297 | ||
298 | setCentralWidget( vbox5 ); | 298 | setCentralWidget( vbox5 ); |
299 | 299 | ||
300 | readConfig( cfg ); | 300 | readConfig( cfg ); |
301 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 301 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
302 | loadList(DocLnk( currentPlaylist)); | 302 | loadList(DocLnk( currentPlaylist)); |
303 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); | 303 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); |
304 | 304 | ||
305 | initializeStates(); | 305 | initializeStates(); |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | PlayListWidget::~PlayListWidget() { | 309 | PlayListWidget::~PlayListWidget() { |
310 | Config cfg( "OpiePlayer" ); | ||
311 | writeConfig( cfg ); | ||
312 | |||
313 | if ( d->current ) { | 310 | if ( d->current ) { |
314 | delete d->current; | 311 | delete d->current; |
315 | } | 312 | } |
316 | delete d; | 313 | delete d; |
317 | } | 314 | } |
318 | 315 | ||
319 | 316 | ||
320 | void PlayListWidget::initializeStates() { | 317 | void PlayListWidget::initializeStates() { |
321 | 318 | ||
322 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 319 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
323 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 320 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
324 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 321 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
325 | setPlaylist( true); | 322 | setPlaylist( true); |
326 | } | 323 | } |
327 | 324 | ||
328 | 325 | ||
329 | void PlayListWidget::readConfig( Config& cfg ) { | 326 | void PlayListWidget::readConfig( Config& cfg ) { |
330 | cfg.setGroup("PlayList"); | 327 | cfg.setGroup("PlayList"); |
331 | QString currentString = cfg.readEntry("current", "" ); | 328 | QString currentString = cfg.readEntry("current", "" ); |
332 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 329 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
333 | for ( int i = 0; i < noOfFiles; i++ ) { | 330 | for ( int i = 0; i < noOfFiles; i++ ) { |
334 | QString entryName; | 331 | QString entryName; |
335 | entryName.sprintf( "File%i", i + 1 ); | 332 | entryName.sprintf( "File%i", i + 1 ); |
336 | QString linkFile = cfg.readEntry( entryName ); | 333 | QString linkFile = cfg.readEntry( entryName ); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 8076707..8710a99 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -27,65 +27,65 @@ public: | |||
27 | ~PlayListWidget(); | 27 | ~PlayListWidget(); |
28 | QTabWidget * tabWidget; | 28 | QTabWidget * tabWidget; |
29 | // MenuItem *fullScreenButton, *scaleButton; | 29 | // MenuItem *fullScreenButton, *scaleButton; |
30 | // QAction *fullScreenButton, *scaleButton; | 30 | // QAction *fullScreenButton, *scaleButton; |
31 | DocLnkSet files; | 31 | DocLnkSet files; |
32 | DocLnkSet vFiles; | 32 | DocLnkSet vFiles; |
33 | QListView *audioView, *videoView, *playlistView; | 33 | QListView *audioView, *videoView, *playlistView; |
34 | QLabel *libString; | 34 | QLabel *libString; |
35 | QPopupMenu *pmView ; | 35 | QPopupMenu *pmView ; |
36 | bool fromSetDocument; | 36 | bool fromSetDocument; |
37 | bool insanityBool; | 37 | bool insanityBool; |
38 | QString setDocFileRef; | 38 | QString setDocFileRef; |
39 | // retrieve the current playlist entry (media file link) | 39 | // retrieve the current playlist entry (media file link) |
40 | const DocLnk *current(); | 40 | const DocLnk *current(); |
41 | void useSelectedDocument(); | 41 | void useSelectedDocument(); |
42 | /* QTimer * menuTimer; */ | 42 | /* QTimer * menuTimer; */ |
43 | FileSelector* playLists; | 43 | FileSelector* playLists; |
44 | QPushButton *tbDeletePlaylist; | 44 | QPushButton *tbDeletePlaylist; |
45 | int selected; | 45 | int selected; |
46 | public slots: | 46 | public slots: |
47 | bool first(); | 47 | bool first(); |
48 | bool last(); | 48 | bool last(); |
49 | bool next(); | 49 | bool next(); |
50 | bool prev(); | 50 | bool prev(); |
51 | void writeConfig( Config& cfg ) const; | ||
51 | /* void setFullScreen(); */ | 52 | /* void setFullScreen(); */ |
52 | /* void setScaled(); */ | 53 | /* void setScaled(); */ |
53 | protected: | 54 | protected: |
54 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 55 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
55 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 56 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
56 | void keyReleaseEvent( QKeyEvent *e); | 57 | void keyReleaseEvent( QKeyEvent *e); |
57 | void keyPressEvent( QKeyEvent *e); | 58 | void keyPressEvent( QKeyEvent *e); |
58 | private: | 59 | private: |
59 | int defaultSkinIndex; | 60 | int defaultSkinIndex; |
60 | QPopupMenu *skinsMenu; | 61 | QPopupMenu *skinsMenu; |
61 | bool audioScan, videoScan; | 62 | bool audioScan, videoScan; |
62 | void readm3u(const QString &); | 63 | void readm3u(const QString &); |
63 | void readPls(const QString &); | 64 | void readPls(const QString &); |
64 | 65 | ||
65 | void initializeStates(); | 66 | void initializeStates(); |
66 | void readConfig( Config& cfg ); | 67 | void readConfig( Config& cfg ); |
67 | void writeConfig( Config& cfg ) const; | ||
68 | PlayListWidgetPrivate *d; // Private implementation data | 68 | PlayListWidgetPrivate *d; // Private implementation data |
69 | void populateAudioView(); | 69 | void populateAudioView(); |
70 | void populateVideoView(); | 70 | void populateVideoView(); |
71 | private slots: | 71 | private slots: |
72 | void populateSkinsMenu(); | 72 | void populateSkinsMenu(); |
73 | void skinsMenuActivated(int); | 73 | void skinsMenuActivated(int); |
74 | void pmViewActivated(int); | 74 | void pmViewActivated(int); |
75 | void writem3u(); | 75 | void writem3u(); |
76 | void scanForAudio(); | 76 | void scanForAudio(); |
77 | void scanForVideo(); | 77 | void scanForVideo(); |
78 | void openFile(); | 78 | void openFile(); |
79 | void setDocument( const QString& fileref ); | 79 | void setDocument( const QString& fileref ); |
80 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 80 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
81 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 81 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
82 | void setActiveWindow(); // need to handle this to show the right view | 82 | void setActiveWindow(); // need to handle this to show the right view |
83 | void setPlaylist( bool ); // Show/Hide the playlist | 83 | void setPlaylist( bool ); // Show/Hide the playlist |
84 | void setView( char ); | 84 | void setView( char ); |
85 | void clearList(); | 85 | void clearList(); |
86 | void addAllToList(); | 86 | void addAllToList(); |
87 | void addAllMusicToList(); | 87 | void addAllMusicToList(); |
88 | void addAllVideoToList(); | 88 | void addAllVideoToList(); |
89 | void saveList(); // Save the playlist | 89 | void saveList(); // Save the playlist |
90 | void loadList( const DocLnk &); // Load a playlist | 90 | void loadList( const DocLnk &); // Load a playlist |
91 | void playIt( QListViewItem *); | 91 | void playIt( QListViewItem *); |