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