Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 357 |
1 files changed, 54 insertions, 303 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 269aed8..0423e7a 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
@@ -18,9 +18,8 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/fileselector.h> | 23 | #include <qpe/fileselector.h> |
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
25 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
26 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
@@ -37,8 +36,4 @@ | |||
37 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
38 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | ||
40 | #include <qlistview.h> | ||
41 | #include <qpoint.h> | ||
42 | //#include <qtimer.h> | ||
43 | 38 | ||
44 | #include "playlistselection.h" | 39 | #include "playlistselection.h" |
@@ -48,16 +43,16 @@ | |||
48 | #include <stdlib.h> | 43 | #include <stdlib.h> |
49 | 44 | ||
50 | #define BUTTONS_ON_TOOLBAR | ||
51 | #define SIDE_BUTTONS | ||
52 | #define CAN_SAVE_LOAD_PLAYLISTS | ||
53 | 45 | ||
54 | extern MediaPlayerState *mediaPlayerState; | 46 | extern MediaPlayerState *mediaPlayerState; |
55 | 47 | ||
56 | // class myFileSelector { | ||
57 | 48 | ||
58 | // }; | ||
59 | class PlayListWidgetPrivate { | 49 | class PlayListWidgetPrivate { |
60 | public: | 50 | public: |
61 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 51 | QToolButton *tbPlay; |
52 | QToolButton *tbFull; | ||
53 | QToolButton *tbLoop; | ||
54 | QToolButton *tbScale; | ||
55 | QToolButton *tbShuffle; | ||
56 | |||
62 | QFrame *playListFrame; | 57 | QFrame *playListFrame; |
63 | FileSelector *files; | 58 | FileSelector *files; |
@@ -99,10 +94,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
99 | d->setDocumentUsed = FALSE; | 94 | d->setDocumentUsed = FALSE; |
100 | d->current = NULL; | 95 | d->current = NULL; |
101 | // menuTimer = new QTimer( this ,"menu timer"), | ||
102 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | ||
103 | 96 | ||
104 | setBackgroundMode( PaletteButton ); | 97 | setBackgroundMode( PaletteButton ); |
105 | 98 | ||
106 | setCaption( tr("OpiePlayer") ); | 99 | setCaption( tr("MediaPlayer") ); |
107 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 100 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
108 | 101 | ||
@@ -119,62 +112,33 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
119 | QPEToolBar *bar = new QPEToolBar( this ); | 112 | QPEToolBar *bar = new QPEToolBar( this ); |
120 | bar->setLabel( tr( "Play Operations" ) ); | 113 | bar->setLabel( tr( "Play Operations" ) ); |
121 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", | 114 | #ifdef BUTTONS_ON_TOOLBAR |
122 | this , SLOT(addSelected()) ); | 115 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); |
123 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", | 116 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
124 | this , SLOT(removeSelected()) ); | 117 | #endif |
125 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", | 118 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
126 | mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | 119 | d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE ); |
127 | 120 | d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE ); | |
128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", | ||
129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", | ||
131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | ||
132 | |||
133 | // d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE ); | ||
134 | // d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE ); | ||
135 | 121 | ||
136 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 122 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
137 | menu->insertItem( tr( "File" ), pmPlayList ); | 123 | menu->insertItem( tr( "PlayList" ), pmPlayList ); |
124 | new MenuItem( pmPlayList, tr( "Toggle PlayList" ), mediaPlayerState, SLOT( togglePlaylist() ) ); | ||
138 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 125 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
139 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 126 | new MenuItem( pmPlayList, tr( "Add all music files" ), this, SLOT( addAllMusicToList() ) ); |
140 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 127 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
141 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 128 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
129 | #ifdef CAN_SAVE_LOAD_PLAYLISTS | ||
142 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 130 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
143 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 131 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
144 | 132 | #endif | |
145 | QPopupMenu *pmView = new QPopupMenu( this ); | ||
146 | menu->insertItem( tr( "View" ), pmView ); | ||
147 | |||
148 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | ||
149 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | ||
150 | fullScreenButton->addTo(pmView); | ||
151 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | ||
152 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | ||
153 | scaleButton->addTo(pmView); | ||
154 | 133 | ||
155 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 134 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
156 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | ||
157 | // vbox4->setMargin(4); | ||
158 | // libString = new QLabel( tr(" Media Library"), vbox4 ); | ||
159 | // libString->setBackgroundMode( QButton::PaletteButton ); | ||
160 | // libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | ||
161 | |||
162 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | ||
163 | |||
164 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | ||
165 | tabWidget->setTabShape(QTabWidget::Triangular); | ||
166 | |||
167 | |||
168 | QWidget *pTab; | ||
169 | pTab = new QWidget( tabWidget, "pTab" ); | ||
170 | playlistView = new QListView( pTab, "Videoview" ); | ||
171 | playlistView->setMinimumSize(236,260); | ||
172 | tabWidget->insertTab( pTab,"Playlist"); | ||
173 | 135 | ||
174 | // Add the playlist area | 136 | // Add the playlist area |
175 | 137 | QVBox *vbox3 = new QVBox( vbox5 ); vbox3->setBackgroundMode( PaletteButton ); | |
176 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | ||
177 | d->playListFrame = vbox3; | 138 | d->playListFrame = vbox3; |
178 | d->playListFrame ->setMinimumSize(235,260); | 139 | |
140 | QLabel *plString = new QLabel( tr(" PlayList"), vbox3 ); | ||
141 | plString->setBackgroundMode( QButton::PaletteButton ); | ||
142 | plString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | ||
179 | 143 | ||
180 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 144 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
@@ -182,101 +146,41 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
182 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 146 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
183 | 147 | ||
148 | #ifndef BUTTONS_ON_TOOLBAR | ||
149 | d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | ||
184 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 150 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
151 | #endif | ||
185 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 152 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
186 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 153 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
187 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 154 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
188 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 155 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
189 | 156 | #ifndef BUTTONS_ON_TOOLBAR | |
190 | QWidget *aTab; | 157 | d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
191 | aTab = new QWidget( tabWidget, "aTab" ); | 158 | #endif |
192 | audioView = new QListView( aTab, "Audioview" ); | ||
193 | audioView->setMinimumSize(233,260); | ||
194 | audioView->addColumn( "Title",150); | ||
195 | audioView->addColumn("Size", 45); | ||
196 | audioView->addColumn("Media",35); | ||
197 | audioView->setColumnAlignment(1, Qt::AlignRight); | ||
198 | audioView->setColumnAlignment(2, Qt::AlignRight); | ||
199 | tabWidget->insertTab(aTab,"Audio"); | ||
200 | // audioView | ||
201 | Global::findDocuments(&files, "audio/*"); | ||
202 | QListIterator<DocLnk> dit( files.children() ); | ||
203 | QString storage; | ||
204 | for ( ; dit.current(); ++dit ) { | ||
205 | QListViewItem * newItem; | ||
206 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
207 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
208 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
209 | else storage="RAM"; | ||
210 | if ( QFile( dit.current()->file()).exists() ) { | ||
211 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | ||
212 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | ||
213 | } | ||
214 | } | ||
215 | // videowidget | ||
216 | |||
217 | QWidget *vTab; | ||
218 | vTab = new QWidget( tabWidget, "vTab" ); | ||
219 | videoView = new QListView( vTab, "Videoview" ); | ||
220 | videoView->setMinimumSize(233,260); | ||
221 | |||
222 | videoView->addColumn("Title",150); | ||
223 | videoView->addColumn("Size",45); | ||
224 | videoView->addColumn("Media",35); | ||
225 | videoView->setColumnAlignment(1, Qt::AlignRight); | ||
226 | videoView->setColumnAlignment(2, Qt::AlignRight); | ||
227 | |||
228 | tabWidget->insertTab( vTab,"Video"); | ||
229 | |||
230 | Global::findDocuments(&vFiles, "video/*"); | ||
231 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
232 | for ( ; Vdit.current(); ++Vdit ) { | ||
233 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
234 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
235 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
236 | else storage="RAM"; | ||
237 | QListViewItem * newItem; | ||
238 | if ( QFile( Vdit.current()->file()).exists() ) { | ||
239 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | ||
240 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | ||
241 | } | ||
242 | } | ||
243 | |||
244 | |||
245 | // d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | ||
246 | // d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
247 | 159 | ||
248 | // add the library area | 160 | // add the library area |
161 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | ||
249 | 162 | ||
250 | // d->files->setBackgroundMode( PaletteButton ); | 163 | QLabel *libString = new QLabel( tr(" Media Library"), vbox4 ); |
251 | // QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | 164 | libString->setBackgroundMode( QButton::PaletteButton ); |
252 | 165 | libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | |
253 | // #ifdef SIDE_BUTTONS | ||
254 | // QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch | ||
255 | // #endif | ||
256 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | ||
257 | |||
258 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
259 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
260 | 166 | ||
261 | connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 167 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
262 | connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 168 | d->files = new FileSelector( "video/*;audio/*", hbox6, "Find Media Files", FALSE, FALSE ); |
169 | d->files->setBackgroundMode( PaletteButton ); | ||
170 | QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | ||
263 | 171 | ||
264 | connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | 172 | #ifdef SIDE_BUTTONS |
265 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | 173 | new ToolButton( vbox7, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", d->selectedFiles, SLOT(addSelected()) ); |
266 | connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | 174 | new ToolButton( vbox7, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", d->selectedFiles, SLOT(removeSelected()) ); |
267 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | 175 | QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch |
176 | #endif | ||
268 | 177 | ||
269 | connect( playlistView, SIGNAL( pressed( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 178 | connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); |
270 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | ||
271 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
272 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
273 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 179 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
274 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 180 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
275 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 181 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
276 | 182 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbFull, SLOT( setOn( bool ) ) ); | |
277 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); | 183 | connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), d->tbScale, SLOT( setOn( bool ) ) ); |
278 | // connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); | 184 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbScale, SLOT( setEnabled( bool ) ) ); |
279 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) ); | ||
280 | |||
281 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 185 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
282 | 186 | ||
@@ -301,12 +205,11 @@ PlayListWidget::~PlayListWidget() { | |||
301 | 205 | ||
302 | void PlayListWidget::initializeStates() { | 206 | void PlayListWidget::initializeStates() { |
303 | |||
304 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 207 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
305 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 208 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
306 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 209 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
307 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 210 | d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
308 | // d->tbScale->setOn( mediaPlayerState->scaled() ); | 211 | d->tbScale->setOn( mediaPlayerState->scaled() ); |
309 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 212 | d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
310 | // setPlaylist( mediaPlayerState->playlist() ); | 213 | setPlaylist( mediaPlayerState->playlist() ); |
311 | } | 214 | } |
312 | 215 | ||
@@ -373,14 +276,4 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
373 | 276 | ||
374 | 277 | ||
375 | void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) { | ||
376 | qDebug("add"); | ||
377 | // d->selectedFiles->addToSelection( lnk ); | ||
378 | // } | ||
379 | // else | ||
380 | // mediaPlayerState->setPlaying( TRUE ); | ||
381 | // | ||
382 | } | ||
383 | |||
384 | |||
385 | void PlayListWidget::clearList() { | 278 | void PlayListWidget::clearList() { |
386 | while ( first() ) | 279 | while ( first() ) |
@@ -555,144 +448,2 @@ void PlayListWidget::setView( char view ) { | |||
555 | } | 448 | } |
556 | 449 | ||
557 | void PlayListWidget::addSelected() { | ||
558 | // QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); | ||
559 | int tabPage=tabWidget->currentPageIndex(); | ||
560 | switch (tabPage) { | ||
561 | case 0: //playlist | ||
562 | break; | ||
563 | case 1: { //audio | ||
564 | addToSelection( audioView->selectedItem() ); | ||
565 | } | ||
566 | break; | ||
567 | case 2: { // video | ||
568 | addToSelection( videoView->selectedItem() ); | ||
569 | } | ||
570 | break; | ||
571 | }; | ||
572 | } | ||
573 | |||
574 | void PlayListWidget::removeSelected() { | ||
575 | d->selectedFiles->removeSelected( ); | ||
576 | } | ||
577 | |||
578 | |||
579 | void PlayListWidget::playIt( QListViewItem *it) { | ||
580 | d->setDocumentUsed = FALSE; | ||
581 | |||
582 | if(it) { | ||
583 | qDebug("playit"); | ||
584 | int tabPage=tabWidget->currentPageIndex(); | ||
585 | switch (tabPage) { | ||
586 | case 1: { | ||
587 | DocLnkSet files; | ||
588 | QListIterator<DocLnk> dit( files.children() ); | ||
589 | for ( ; dit.current(); ++dit ) { | ||
590 | if( dit.current()->name() == it->text(0)) { | ||
591 | setDocument( dit.current()->name()); | ||
592 | } | ||
593 | } | ||
594 | } | ||
595 | break; | ||
596 | case 2: { | ||
597 | DocLnkSet vFiles; | ||
598 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
599 | for ( ; dit.current(); ++dit ) { | ||
600 | qDebug(dit.current()->name()); | ||
601 | if( dit.current()->name() == it->text(0)) { | ||
602 | qDebug(it->text(0)); | ||
603 | setDocument( dit.current()->name()); | ||
604 | } | ||
605 | } | ||
606 | } | ||
607 | break; | ||
608 | }; | ||
609 | } | ||
610 | } | ||
611 | |||
612 | void PlayListWidget::addToSelection( QListViewItem *it) { | ||
613 | d->setDocumentUsed = FALSE; | ||
614 | |||
615 | if(it) { | ||
616 | qDebug("add to selection"); | ||
617 | int tabPage=tabWidget->currentPageIndex(); | ||
618 | switch (tabPage) { | ||
619 | case 1: { | ||
620 | QListIterator<DocLnk> dit( files.children() ); | ||
621 | for ( ; dit.current(); ++dit ) { | ||
622 | if( dit.current()->name() == it->text(0)) { | ||
623 | d->selectedFiles->addToSelection( **dit ); | ||
624 | } | ||
625 | } | ||
626 | } | ||
627 | break; | ||
628 | case 2: { | ||
629 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
630 | for ( ; dit.current(); ++dit ) { | ||
631 | qDebug(dit.current()->name()); | ||
632 | if( dit.current()->name() == it->text(0)) { | ||
633 | d->selectedFiles->addToSelection( **dit ); | ||
634 | } | ||
635 | } | ||
636 | } | ||
637 | break; | ||
638 | case 0: | ||
639 | break; | ||
640 | }; | ||
641 | tabWidget->setCurrentPage(0); | ||
642 | // mediaPlayerState->setPlaying( TRUE ); | ||
643 | } | ||
644 | } | ||
645 | |||
646 | void PlayListWidget::tabChanged(QWidget *widg) { | ||
647 | |||
648 | int tabPage=tabWidget->currentPageIndex(); | ||
649 | switch (tabPage) { | ||
650 | case 0: | ||
651 | { | ||
652 | d->tbRemoveFromList->setEnabled(TRUE); | ||
653 | d->tbAddToList->setEnabled(FALSE); | ||
654 | } | ||
655 | break; | ||
656 | case 1: | ||
657 | { | ||
658 | d->tbRemoveFromList->setEnabled(FALSE); | ||
659 | d->tbAddToList->setEnabled(TRUE); | ||
660 | } | ||
661 | break; | ||
662 | case 2: | ||
663 | { | ||
664 | d->tbRemoveFromList->setEnabled(FALSE); | ||
665 | d->tbAddToList->setEnabled(TRUE); | ||
666 | } | ||
667 | break; | ||
668 | }; | ||
669 | } | ||
670 | |||
671 | // void PlayListWidget::cancelMenuTimer() { | ||
672 | // if( menuTimer->isActive() ) | ||
673 | // menuTimer->stop(); | ||
674 | // } | ||
675 | |||
676 | // void PlayListWidget::showFileMenu() { | ||
677 | |||
678 | // } | ||
679 | |||
680 | // void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | ||
681 | // { | ||
682 | // // QListView::contentsMousePressEvent( e ); | ||
683 | // menuTimer->start( 750, TRUE ); | ||
684 | // } | ||
685 | |||
686 | |||
687 | // void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | ||
688 | // { | ||
689 | // // QListView::contentsMouseReleaseEvent( e ); | ||
690 | // menuTimer->stop(); | ||
691 | // } | ||
692 | // // void PlayListWidget::setFullScreen() { | ||
693 | // mediaPlayerState->toggleFullscreen( ); | ||
694 | // } | ||
695 | |||
696 | // void PlayListWidget::setScaled() { | ||
697 | // mediaPlayerState->toggleScaled(); | ||
698 | // } | ||