author | llornkcor <llornkcor> | 2002-02-25 05:10:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 05:10:32 (UTC) |
commit | 1bebd27631a6c9d1ab967cbb32dd4e796b3b0402 (patch) (unidiff) | |
tree | 8ce49800cba26f6f2c33de74a71d4efe0338843f /core/multimedia/opieplayer/playlistwidget.cpp | |
parent | d948361c1b475fab4660b28fbf5ec21fd34d923f (diff) | |
download | opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.zip opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.tar.gz opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.tar.bz2 |
fixed 2
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 300 |
1 files changed, 250 insertions, 50 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 0423e7a..202f351 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,7 +1,7 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of 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 |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
@@ -21,6 +21,8 @@ | |||
21 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
23 | #include <qpe/fileselector.h> | 23 | #include <qpe/fileselector.h> |
24 | #include <qpe/qpeapplication.h> | ||
25 | |||
24 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
25 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
26 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
@@ -35,6 +37,10 @@ | |||
35 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
36 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
37 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
40 | #include <qtabwidget.h> | ||
41 | #include <qlistview.h> | ||
42 | #include <qpoint.h> | ||
43 | //#include <qtimer.h> | ||
38 | 44 | ||
39 | #include "playlistselection.h" | 45 | #include "playlistselection.h" |
40 | #include "playlistwidget.h" | 46 | #include "playlistwidget.h" |
@@ -42,18 +48,18 @@ | |||
42 | 48 | ||
43 | #include <stdlib.h> | 49 | #include <stdlib.h> |
44 | 50 | ||
51 | #define BUTTONS_ON_TOOLBAR | ||
52 | #define SIDE_BUTTONS | ||
53 | #define CAN_SAVE_LOAD_PLAYLISTS | ||
45 | 54 | ||
46 | extern MediaPlayerState *mediaPlayerState; | 55 | extern MediaPlayerState *mediaPlayerState; |
47 | 56 | ||
57 | // class myFileSelector { | ||
48 | 58 | ||
59 | // }; | ||
49 | class PlayListWidgetPrivate { | 60 | class PlayListWidgetPrivate { |
50 | public: | 61 | public: |
51 | QToolButton *tbPlay; | 62 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
52 | QToolButton *tbFull; | ||
53 | QToolButton *tbLoop; | ||
54 | QToolButton *tbScale; | ||
55 | QToolButton *tbShuffle; | ||
56 | |||
57 | QFrame *playListFrame; | 63 | QFrame *playListFrame; |
58 | FileSelector *files; | 64 | FileSelector *files; |
59 | PlayListSelection *selectedFiles; | 65 | PlayListSelection *selectedFiles; |
@@ -93,10 +99,12 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
93 | d = new PlayListWidgetPrivate; | 99 | d = new PlayListWidgetPrivate; |
94 | d->setDocumentUsed = FALSE; | 100 | d->setDocumentUsed = FALSE; |
95 | d->current = NULL; | 101 | d->current = NULL; |
102 | // menuTimer = new QTimer( this ,"menu timer"), | ||
103 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | ||
96 | 104 | ||
97 | setBackgroundMode( PaletteButton ); | 105 | setBackgroundMode( PaletteButton ); |
98 | 106 | ||
99 | setCaption( tr("MediaPlayer") ); | 107 | setCaption( tr("OpiePlayer") ); |
100 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 108 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
101 | 109 | ||
102 | setToolBarsMovable( FALSE ); | 110 | setToolBarsMovable( FALSE ); |
@@ -111,79 +119,146 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
111 | 119 | ||
112 | QPEToolBar *bar = new QPEToolBar( this ); | 120 | QPEToolBar *bar = new QPEToolBar( this ); |
113 | bar->setLabel( tr( "Play Operations" ) ); | 121 | bar->setLabel( tr( "Play Operations" ) ); |
114 | #ifdef BUTTONS_ON_TOOLBAR | 122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),"mpegplayer/add_to_playlist",this , SLOT(addSelected()) ); |
123 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", this , SLOT(removeSelected()) ); | ||
115 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | 124 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); |
116 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 125 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
117 | #endif | ||
118 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 126 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
119 | d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE ); | ||
120 | d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE ); | ||
121 | 127 | ||
122 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 128 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
123 | menu->insertItem( tr( "PlayList" ), pmPlayList ); | 129 | menu->insertItem( tr( "File" ), pmPlayList ); |
124 | new MenuItem( pmPlayList, tr( "Toggle PlayList" ), mediaPlayerState, SLOT( togglePlaylist() ) ); | ||
125 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 130 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
126 | new MenuItem( pmPlayList, tr( "Add all music files" ), this, SLOT( addAllMusicToList() ) ); | 131 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
127 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 132 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
128 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 133 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
129 | #ifdef CAN_SAVE_LOAD_PLAYLISTS | ||
130 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 134 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
131 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 135 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
132 | #endif | 136 | |
137 | QPopupMenu *pmView = new QPopupMenu( this ); | ||
138 | menu->insertItem( tr( "View" ), pmView ); | ||
139 | |||
140 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | ||
141 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | ||
142 | fullScreenButton->addTo(pmView); | ||
143 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | ||
144 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | ||
145 | scaleButton->addTo(pmView); | ||
133 | 146 | ||
134 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 147 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
148 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | ||
149 | |||
150 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | ||
151 | |||
152 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | ||
153 | tabWidget->setTabShape(QTabWidget::Triangular); | ||
154 | |||
155 | QWidget *pTab; | ||
156 | pTab = new QWidget( tabWidget, "pTab" ); | ||
157 | playlistView = new QListView( pTab, "Videoview" ); | ||
158 | playlistView->setMinimumSize(236,260); | ||
159 | tabWidget->insertTab( pTab,"Playlist"); | ||
135 | 160 | ||
136 | // Add the playlist area | 161 | // Add the playlist area |
137 | QVBox *vbox3 = new QVBox( vbox5 ); vbox3->setBackgroundMode( PaletteButton ); | ||
138 | d->playListFrame = vbox3; | ||
139 | 162 | ||
140 | QLabel *plString = new QLabel( tr(" PlayList"), vbox3 ); | 163 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
141 | plString->setBackgroundMode( QButton::PaletteButton ); | 164 | d->playListFrame = vbox3; |
142 | plString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | 165 | d->playListFrame ->setMinimumSize(235,260); |
143 | 166 | ||
144 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 167 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
168 | |||
145 | d->selectedFiles = new PlayListSelection( hbox2 ); | 169 | d->selectedFiles = new PlayListSelection( hbox2 ); |
146 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 170 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
147 | 171 | ||
148 | #ifndef BUTTONS_ON_TOOLBAR | ||
149 | d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | ||
150 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 172 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
151 | #endif | ||
152 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 173 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
153 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 174 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
154 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 175 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
155 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 176 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
156 | #ifndef BUTTONS_ON_TOOLBAR | ||
157 | d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
158 | #endif | ||
159 | 177 | ||
178 | QWidget *aTab; | ||
179 | aTab = new QWidget( tabWidget, "aTab" ); | ||
180 | audioView = new QListView( aTab, "Audioview" ); | ||
181 | audioView->setMinimumSize(233,260); | ||
182 | audioView->addColumn( "Title",150); | ||
183 | audioView->addColumn("Size", 45); | ||
184 | audioView->addColumn("Media",35); | ||
185 | audioView->setColumnAlignment(1, Qt::AlignRight); | ||
186 | audioView->setColumnAlignment(2, Qt::AlignRight); | ||
187 | tabWidget->insertTab(aTab,"Audio"); | ||
188 | // audioView | ||
189 | Global::findDocuments(&files, "audio/*"); | ||
190 | QListIterator<DocLnk> dit( files.children() ); | ||
191 | QString storage; | ||
192 | for ( ; dit.current(); ++dit ) { | ||
193 | QListViewItem * newItem; | ||
194 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
195 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
196 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
197 | else storage="RAM"; | ||
198 | if ( QFile( dit.current()->file()).exists() ) { | ||
199 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | ||
200 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | ||
201 | } | ||
202 | } | ||
203 | // videowidget | ||
204 | |||
205 | QWidget *vTab; | ||
206 | vTab = new QWidget( tabWidget, "vTab" ); | ||
207 | videoView = new QListView( vTab, "Videoview" ); | ||
208 | videoView->setMinimumSize(233,260); | ||
209 | |||
210 | videoView->addColumn("Title",150); | ||
211 | videoView->addColumn("Size",45); | ||
212 | videoView->addColumn("Media",35); | ||
213 | videoView->setColumnAlignment(1, Qt::AlignRight); | ||
214 | videoView->setColumnAlignment(2, Qt::AlignRight); | ||
215 | |||
216 | tabWidget->insertTab( vTab,"Video"); | ||
217 | |||
218 | Global::findDocuments(&vFiles, "video/*"); | ||
219 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
220 | for ( ; Vdit.current(); ++Vdit ) { | ||
221 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
222 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
223 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
224 | else storage="RAM"; | ||
225 | QListViewItem * newItem; | ||
226 | if ( QFile( Vdit.current()->file()).exists() ) { | ||
227 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | ||
228 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | ||
229 | } | ||
230 | } | ||
160 | // add the library area | 231 | // add the library area |
161 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 232 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
162 | 233 | ||
163 | QLabel *libString = new QLabel( tr(" Media Library"), vbox4 ); | 234 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
164 | libString->setBackgroundMode( QButton::PaletteButton ); | 235 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
165 | libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | ||
166 | 236 | ||
167 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 237 | connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
168 | d->files = new FileSelector( "video/*;audio/*", hbox6, "Find Media Files", FALSE, FALSE ); | 238 | connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
169 | d->files->setBackgroundMode( PaletteButton ); | 239 | |
170 | QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | 240 | connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), |
241 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
242 | connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | ||
243 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
171 | 244 | ||
172 | #ifdef SIDE_BUTTONS | ||
173 | new ToolButton( vbox7, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", d->selectedFiles, SLOT(addSelected()) ); | ||
174 | new ToolButton( vbox7, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", d->selectedFiles, SLOT(removeSelected()) ); | ||
175 | QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch | ||
176 | #endif | ||
177 | 245 | ||
178 | connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 246 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
247 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
248 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
179 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 249 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
180 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 250 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
181 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 251 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
182 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbFull, SLOT( setOn( bool ) ) ); | 252 | |
183 | connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), d->tbScale, SLOT( setOn( bool ) ) ); | 253 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); |
184 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbScale, SLOT( setEnabled( bool ) ) ); | 254 | // connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); |
255 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) ); | ||
256 | |||
185 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 257 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
186 | 258 | ||
259 | connect( d->selectedFiles, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
260 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
261 | |||
187 | setCentralWidget( vbox5 ); | 262 | setCentralWidget( vbox5 ); |
188 | 263 | ||
189 | Config cfg( "MediaPlayer" ); | 264 | Config cfg( "MediaPlayer" ); |
@@ -204,13 +279,14 @@ PlayListWidget::~PlayListWidget() { | |||
204 | 279 | ||
205 | 280 | ||
206 | void PlayListWidget::initializeStates() { | 281 | void PlayListWidget::initializeStates() { |
282 | |||
207 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 283 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
208 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 284 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
209 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 285 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
210 | d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 286 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
211 | d->tbScale->setOn( mediaPlayerState->scaled() ); | 287 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
212 | d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 288 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
213 | setPlaylist( mediaPlayerState->playlist() ); | 289 | // setPlaylist( mediaPlayerState->playlist() ); |
214 | } | 290 | } |
215 | 291 | ||
216 | 292 | ||
@@ -275,6 +351,16 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
275 | } | 351 | } |
276 | 352 | ||
277 | 353 | ||
354 | void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) { | ||
355 | qDebug("add"); | ||
356 | // d->selectedFiles->addToSelection( lnk ); | ||
357 | // } | ||
358 | // else | ||
359 | // mediaPlayerState->setPlaying( TRUE ); | ||
360 | // | ||
361 | } | ||
362 | |||
363 | |||
278 | void PlayListWidget::clearList() { | 364 | void PlayListWidget::clearList() { |
279 | while ( first() ) | 365 | while ( first() ) |
280 | d->selectedFiles->removeSelected(); | 366 | d->selectedFiles->removeSelected(); |
@@ -447,3 +533,117 @@ void PlayListWidget::setView( char view ) { | |||
447 | hide(); | 533 | hide(); |
448 | } | 534 | } |
449 | 535 | ||
536 | void PlayListWidget::addSelected() { | ||
537 | // QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); | ||
538 | int tabPage=tabWidget->currentPageIndex(); | ||
539 | switch (tabPage) { | ||
540 | case 0: //playlist | ||
541 | break; | ||
542 | case 1: { //audio | ||
543 | addToSelection( audioView->selectedItem() ); | ||
544 | } | ||
545 | break; | ||
546 | case 2: { // video | ||
547 | addToSelection( videoView->selectedItem() ); | ||
548 | } | ||
549 | break; | ||
550 | }; | ||
551 | } | ||
552 | |||
553 | void PlayListWidget::removeSelected() { | ||
554 | d->selectedFiles->removeSelected( ); | ||
555 | } | ||
556 | |||
557 | |||
558 | void PlayListWidget::playIt( QListViewItem *it) { | ||
559 | // d->setDocumentUsed = FALSE; | ||
560 | mediaPlayerState->setPlaying(true); | ||
561 | } | ||
562 | |||
563 | void PlayListWidget::addToSelection( QListViewItem *it) { | ||
564 | d->setDocumentUsed = FALSE; | ||
565 | |||
566 | if(it) { | ||
567 | qDebug("add to selection"); | ||
568 | int tabPage=tabWidget->currentPageIndex(); | ||
569 | switch (tabPage) { | ||
570 | case 1: { | ||
571 | QListIterator<DocLnk> dit( files.children() ); | ||
572 | for ( ; dit.current(); ++dit ) { | ||
573 | if( dit.current()->name() == it->text(0)) { | ||
574 | d->selectedFiles->addToSelection( **dit ); | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | break; | ||
579 | case 2: { | ||
580 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
581 | for ( ; dit.current(); ++dit ) { | ||
582 | qDebug(dit.current()->name()); | ||
583 | if( dit.current()->name() == it->text(0)) { | ||
584 | d->selectedFiles->addToSelection( **dit ); | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | break; | ||
589 | case 0: | ||
590 | break; | ||
591 | }; | ||
592 | tabWidget->setCurrentPage(0); | ||
593 | // mediaPlayerState->setPlaying( TRUE ); | ||
594 | } | ||
595 | } | ||
596 | |||
597 | void PlayListWidget::tabChanged(QWidget *widg) { | ||
598 | |||
599 | int tabPage=tabWidget->currentPageIndex(); | ||
600 | switch (tabPage) { | ||
601 | case 0: | ||
602 | { | ||
603 | d->tbRemoveFromList->setEnabled(TRUE); | ||
604 | d->tbAddToList->setEnabled(FALSE); | ||
605 | } | ||
606 | break; | ||
607 | case 1: | ||
608 | { | ||
609 | d->tbRemoveFromList->setEnabled(FALSE); | ||
610 | d->tbAddToList->setEnabled(TRUE); | ||
611 | } | ||
612 | break; | ||
613 | case 2: | ||
614 | { | ||
615 | d->tbRemoveFromList->setEnabled(FALSE); | ||
616 | d->tbAddToList->setEnabled(TRUE); | ||
617 | } | ||
618 | break; | ||
619 | }; | ||
620 | } | ||
621 | |||
622 | // void PlayListWidget::cancelMenuTimer() { | ||
623 | // if( menuTimer->isActive() ) | ||
624 | // menuTimer->stop(); | ||
625 | // } | ||
626 | |||
627 | // void PlayListWidget::showFileMenu() { | ||
628 | |||
629 | // } | ||
630 | |||
631 | // void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | ||
632 | // { | ||
633 | // // QListView::contentsMousePressEvent( e ); | ||
634 | // menuTimer->start( 750, TRUE ); | ||
635 | // } | ||
636 | |||
637 | |||
638 | // void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | ||
639 | // { | ||
640 | // // QListView::contentsMouseReleaseEvent( e ); | ||
641 | // menuTimer->stop(); | ||
642 | // } | ||
643 | // // void PlayListWidget::setFullScreen() { | ||
644 | // mediaPlayerState->toggleFullscreen( ); | ||
645 | // } | ||
646 | |||
647 | // void PlayListWidget::setScaled() { | ||
648 | // mediaPlayerState->toggleScaled(); | ||
649 | // } | ||