Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index b43d9f7..65458e7 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1,24 +1,25 @@ | |||
1 | 1 | ||
2 | #define QTOPIA_INTERNAL_FSLP | 2 | #define QTOPIA_INTERNAL_FSLP |
3 | #include <qpe/qcopenvelope_qws.h> | 3 | #include <qpe/qcopenvelope_qws.h> |
4 | 4 | ||
5 | #include <qpe/qpemenubar.h> | 5 | #include <qpe/qpemenubar.h> |
6 | #include <qpe/qpetoolbar.h> | 6 | #include <qpe/qpetoolbar.h> |
7 | #include <qpe/fileselector.h> | 7 | #include <qpe/fileselector.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/lnkproperties.h> | 9 | #include <qpe/lnkproperties.h> |
10 | #include <qpe/storage.h> | 10 | #include <qpe/storage.h> |
11 | 11 | ||
12 | #include <qpe/applnk.h> | 12 | #include <qpe/applnk.h> |
13 | #include <qpopupmenu.h> | ||
13 | #include <qpe/config.h> | 14 | #include <qpe/config.h> |
14 | #include <qpe/global.h> | 15 | #include <qpe/global.h> |
15 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
16 | #include <qaction.h> | 17 | #include <qaction.h> |
17 | #include <qcursor.h> | 18 | #include <qcursor.h> |
18 | #include <qimage.h> | 19 | #include <qimage.h> |
19 | #include <qfile.h> | 20 | #include <qfile.h> |
20 | #include <qdir.h> | 21 | #include <qdir.h> |
21 | #include <qlayout.h> | 22 | #include <qlayout.h> |
22 | #include <qlabel.h> | 23 | #include <qlabel.h> |
23 | #include <qlist.h> | 24 | #include <qlist.h> |
24 | #include <qlistbox.h> | 25 | #include <qlistbox.h> |
@@ -149,31 +150,37 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
149 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 150 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
150 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 151 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
151 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 152 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
152 | pmPlayList->insertSeparator(-1); | 153 | pmPlayList->insertSeparator(-1); |
153 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
154 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); | 155 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); |
155 | pmPlayList->insertSeparator(-1); | 156 | pmPlayList->insertSeparator(-1); |
156 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 157 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
157 | pmPlayList->insertSeparator(-1); | 158 | pmPlayList->insertSeparator(-1); |
158 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 159 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
159 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 160 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
160 | 161 | ||
161 | QPopupMenu *pmView = new QPopupMenu( this ); | 162 | |
163 | pmView = new QPopupMenu( this ); | ||
162 | menu->insertItem( tr( "View" ), pmView ); | 164 | menu->insertItem( tr( "View" ), pmView ); |
165 | pmView->isCheckable(); | ||
166 | |||
167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), this, SLOT( toggleFull() ) ); | ||
168 | |||
169 | Config cfg( "OpiePlayer" ); | ||
170 | bool b= cfg.readBoolEntry("FullScreen", 0); | ||
171 | mediaPlayerState->setFullscreen( b ); | ||
172 | pmView->setItemChecked( -16, b ); | ||
163 | 173 | ||
164 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 174 | pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), this, SLOT(toggleScaled() ) ); |
165 | fullScreenButton->addTo(pmView); | ||
166 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | ||
167 | //scaleButton->addTo(pmView); | ||
168 | 175 | ||
169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 176 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 177 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
171 | 178 | ||
172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 179 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
173 | 180 | ||
174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 181 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
175 | // tabWidget->setTabShape(QTabWidget::Triangular); | 182 | // tabWidget->setTabShape(QTabWidget::Triangular); |
176 | 183 | ||
177 | QWidget *pTab; | 184 | QWidget *pTab; |
178 | pTab = new QWidget( tabWidget, "pTab" ); | 185 | pTab = new QWidget( tabWidget, "pTab" ); |
179 | tabWidget->insertTab( pTab,"Playlist"); | 186 | tabWidget->insertTab( pTab,"Playlist"); |
@@ -233,49 +240,51 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
233 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 240 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
234 | 241 | ||
235 | tabWidget->insertTab( vTab,tr("Video")); | 242 | tabWidget->insertTab( vTab,tr("Video")); |
236 | 243 | ||
237 | //playlists list | 244 | //playlists list |
238 | QWidget *LTab; | 245 | QWidget *LTab; |
239 | LTab = new QWidget( tabWidget, "LTab" ); | 246 | LTab = new QWidget( tabWidget, "LTab" ); |
240 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 247 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
241 | playLists->setMinimumSize(233,260); | 248 | playLists->setMinimumSize(233,260); |
242 | tabWidget->insertTab(LTab,tr("Lists")); | 249 | tabWidget->insertTab(LTab,tr("Lists")); |
243 | 250 | ||
244 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 251 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
245 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 252 | |
246 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 253 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); |
254 | |||
255 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); | ||
256 | |||
247 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 257 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
248 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 258 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
249 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 259 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
250 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 260 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
251 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 261 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
252 | this,SLOT( playIt( QListViewItem *)) ); | 262 | this,SLOT( playIt( QListViewItem *)) ); |
253 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 263 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
254 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 264 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
255 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 265 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
256 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 266 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
257 | this,SLOT( playIt( QListViewItem *)) ); | 267 | this,SLOT( playIt( QListViewItem *)) ); |
258 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 268 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
259 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 269 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
260 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 270 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
261 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 271 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
262 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 272 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
263 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 273 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
264 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 274 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
265 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 275 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
266 | 276 | ||
267 | setCentralWidget( vbox5 ); | 277 | setCentralWidget( vbox5 ); |
268 | 278 | ||
269 | Config cfg( "OpiePlayer" ); | ||
270 | readConfig( cfg ); | 279 | readConfig( cfg ); |
271 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 280 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
272 | loadList(DocLnk( currentPlaylist)); | 281 | loadList(DocLnk( currentPlaylist)); |
273 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); | 282 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); |
274 | 283 | ||
275 | initializeStates(); | 284 | initializeStates(); |
276 | } | 285 | } |
277 | 286 | ||
278 | 287 | ||
279 | PlayListWidget::~PlayListWidget() { | 288 | PlayListWidget::~PlayListWidget() { |
280 | Config cfg( "OpiePlayer" ); | 289 | Config cfg( "OpiePlayer" ); |
281 | writeConfig( cfg ); | 290 | writeConfig( cfg ); |
@@ -1200,12 +1209,28 @@ void PlayListWidget::readPls(const QString &filename) { | |||
1200 | lnk.setFile( s); | 1209 | lnk.setFile( s); |
1201 | } | 1210 | } |
1202 | lnk.setType("audio/x-mpegurl"); | 1211 | lnk.setType("audio/x-mpegurl"); |
1203 | 1212 | ||
1204 | qDebug("DocLnk add "+name); | 1213 | qDebug("DocLnk add "+name); |
1205 | d->selectedFiles->addToSelection( lnk); | 1214 | d->selectedFiles->addToSelection( lnk); |
1206 | } | 1215 | } |
1207 | } | 1216 | } |
1208 | i++; | 1217 | i++; |
1209 | } | 1218 | } |
1210 | } | 1219 | } |
1211 | 1220 | ||
1221 | void PlayListWidget::pmViewActivated(int index) { | ||
1222 | qDebug("%d", index); | ||
1223 | switch(index) { | ||
1224 | case -16: | ||
1225 | { | ||
1226 | |||
1227 | mediaPlayerState->toggleFullscreen(); | ||
1228 | bool b=mediaPlayerState->fullscreen(); | ||
1229 | pmView->setItemChecked( index,b); | ||
1230 | Config cfg( "OpiePlayer" ); | ||
1231 | cfg.writeEntry("FullScreen", b); | ||
1232 | |||
1233 | } | ||
1234 | break; | ||
1235 | }; | ||
1236 | } | ||