summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer3/mwindow.cpp38
-rw-r--r--noncore/multimedia/opieplayer3/playlist.cpp2
2 files changed, 25 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp
index 0898c7b..982d732 100644
--- a/noncore/multimedia/opieplayer3/mwindow.cpp
+++ b/noncore/multimedia/opieplayer3/mwindow.cpp
@@ -1,141 +1,141 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4 Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9 .>+-= 9 .>+-=
10 _;:, .> :=|. This program is free software; you can 10 _;:, .> :=|. This program is free software; you can
11.> <`_, > . <= redistribute it and/or modify it under 11.> <`_, > . <= redistribute it and/or modify it under
12:`=1 )Y*s>-.-- : the terms of the GNU General Public 12:`=1 )Y*s>-.-- : the terms of the GNU General Public
13.="- .-=="i, .._ License as published by the Free Software 13.="- .-=="i, .._ License as published by the Free Software
14 - . .-<_> .<> Foundation; either version 2 of the License, 14 - . .-<_> .<> Foundation; either version 2 of the License,
15 ._= =} : or (at your option) any later version. 15 ._= =} : or (at your option) any later version.
16 .%`+i> _;_. 16 .%`+i> _;_.
17 .i_,=:_. -<s. This program is distributed in the hope that 17 .i_,=:_. -<s. This program is distributed in the hope that
18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
19 : .. .:, . . . without even the implied warranty of 19 : .. .:, . . . without even the implied warranty of
20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.= = ; Library General Public License for more 22..}^=.= = ; Library General Public License for more
23++= -. .` .: details. 23++= -. .` .: details.
24 : = ...= . :.=- 24 : = ...= . :.=-
25 -. .:....=;==+<; You should have received a copy of the GNU 25 -. .:....=;==+<; You should have received a copy of the GNU
26 -_. . . )=. = Library General Public License along with 26 -_. . . )=. = Library General Public License along with
27 -- :-=` this library; see the file COPYING.LIB. 27 -- :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include "mwindow.h" 34#include "mwindow.h"
35#include "playlist.h" 35#include "playlist.h"
36#include "audiowidget.h" 36#include "audiowidget.h"
37#include "videowidget.h" 37#include "videowidget.h"
38#include "../opieplayer2/lib.h" 38#include "../opieplayer2/lib.h"
39 39
40#include <opie2/oapplicationfactory.h> 40#include <opie2/oapplicationfactory.h>
41#include <opie2/owidgetstack.h> 41#include <opie2/owidgetstack.h>
42#include <opie2/ofileselector.h> 42#include <opie2/ofileselector.h>
43#include <opie2/odebug.h> 43#include <opie2/odebug.h>
44#include <opie2/oresource.h>
44 45
45#include <qpe/resource.h>
46#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
47 47
48#include <qfileinfo.h> 48#include <qfileinfo.h>
49#include <qfile.h> 49#include <qfile.h>
50#include <qtoolbar.h> 50#include <qtoolbar.h>
51#include <qpopupmenu.h> 51#include <qpopupmenu.h>
52#include <qmenubar.h> 52#include <qmenubar.h>
53#include <qtimer.h> 53#include <qtimer.h>
54#include <qslider.h> 54#include <qslider.h>
55#include <qlayout.h> 55#include <qlayout.h>
56 56
57OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 57OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
58 58
59using namespace Opie::Ui; 59using namespace Opie::Ui;
60 60
61PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) 61PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f)
62 : QMainWindow(w,name,f) 62 : QMainWindow(w,name,f)
63{ 63{
64 checkLib(); 64 checkLib();
65 setCaption(appTitle()); 65 setCaption(appTitle());
66 66
67 m_MainBox = new QWidget(this); 67 m_MainBox = new QWidget(this);
68 68
69 QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); 69 QVBoxLayout*m_l = new QVBoxLayout(m_MainBox);
70 70
71 m_stack = new OWidgetStack(m_MainBox); 71 m_stack = new OWidgetStack(m_MainBox);
72 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); 72 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen);
73 m_l->addWidget(m_stack); 73 m_l->addWidget(m_stack);
74 m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox); 74 m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox);
75 m_l->addWidget(m_PosSlider); 75 m_l->addWidget(m_PosSlider);
76 m_PosSlider->setEnabled(false); 76 m_PosSlider->setEnabled(false);
77 77
78 m_playList = new PlaylistView(m_stack,"playlist"); 78 m_playList = new PlaylistView(m_stack,"playlist");
79 m_stack->addWidget(m_playList,stack_list); 79 m_stack->addWidget(m_playList,stack_list);
80 connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); 80 connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int)));
81 m_sfl = new OFileSelector("video/*;audio/*",m_stack); 81 m_sfl = new OFileSelector("video/*;audio/*",m_stack);
82 m_stack->addWidget(m_sfl,stack_file); 82 m_stack->addWidget(m_sfl,stack_file);
83 connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); 83 connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &)));
84 m_AudioPlayer = new AudioWidget(m_stack); 84 m_AudioPlayer = new AudioWidget(m_stack);
85 m_stack->addWidget(m_AudioPlayer,stack_audio); 85 m_stack->addWidget(m_AudioPlayer,stack_audio);
86 connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); 86 connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int)));
87 m_VideoPlayer = new VideoWidget(m_stack); 87 m_VideoPlayer = new VideoWidget(m_stack);
88 m_stack->addWidget(m_VideoPlayer,stack_video); 88 m_stack->addWidget(m_VideoPlayer,stack_video);
89 connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); 89 connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int)));
90 connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); 90 connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked()));
91 91
92 connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); 92 connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int)));
93 connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); 93 connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int)));
94 connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); 94 connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
95 connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); 95 connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
96 m_pressed = false; 96 m_pressed = false;
97 m_uppos=0; 97 m_uppos=0;
98 98
99 m_stack->raiseWidget(stack_list); 99 m_stack->raiseWidget(stack_list);
100 m_LastItem = 0; 100 m_LastItem = 0;
101 setupActions(); 101 setupActions();
102 setupToolBar(); 102 setupToolBar();
103 setupMenu(); 103 setupMenu();
104 104
105 setCentralWidget(m_MainBox ); 105 setCentralWidget(m_MainBox );
106} 106}
107 107
108void PMainWindow::slotListChanged(int count) 108void PMainWindow::slotListChanged(int count)
109{ 109{
110 playersGroup->setEnabled(count>0); 110 playersGroup->setEnabled(count>0);
111 if (!m_playList->isVisible()) { 111 if (!m_playList->isVisible()) {
112 return; 112 return;
113 } 113 }
114 a_removeFiles->setEnabled(count>0); 114 a_removeFiles->setEnabled(count>0);
115} 115}
116 116
117void PMainWindow::mediaWindowraised() 117void PMainWindow::mediaWindowraised()
118{ 118{
119 playlistOnly->setEnabled(false); 119 playlistOnly->setEnabled(false);
120 a_appendFiles->setEnabled(true); 120 a_appendFiles->setEnabled(true);
121 a_loadPlaylist->setEnabled(true); 121 a_loadPlaylist->setEnabled(true);
122 a_showPlaylist->setEnabled(true); 122 a_showPlaylist->setEnabled(true);
123 a_ShowMedia->setEnabled(false); 123 a_ShowMedia->setEnabled(false);
124} 124}
125 125
126void PMainWindow::checkLib() 126void PMainWindow::checkLib()
127{ 127{
128 if (m_PlayLib == 0) { 128 if (m_PlayLib == 0) {
129 m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread); 129 m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread);
130 qApp->processEvents(); 130 qApp->processEvents();
131// m_PlayLib->ensureInitialized(); 131// m_PlayLib->ensureInitialized();
132 connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped())); 132 connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped()));
133 } 133 }
134} 134}
135 135
136PMainWindow::~PMainWindow() 136PMainWindow::~PMainWindow()
137{ 137{
138 if (m_PlayLib) { 138 if (m_PlayLib) {
139 m_PlayLib->stop(); 139 m_PlayLib->stop();
140 delete m_PlayLib; 140 delete m_PlayLib;
141 } 141 }
@@ -236,242 +236,254 @@ void PMainWindow::hideVideo()
236 //m_VideoPlayer->showNormal(); 236 //m_VideoPlayer->showNormal();
237 m_VideoPlayer->hide(); 237 m_VideoPlayer->hide();
238 } 238 }
239} 239}
240 240
241void PMainWindow::slotPlayCurrent() 241void PMainWindow::slotPlayCurrent()
242{ 242{
243 if (!m_LastItem) { 243 if (!m_LastItem) {
244 if (m_PlayLib) m_PlayLib->stop(); 244 if (m_PlayLib) m_PlayLib->stop();
245 m_PosSlider->setEnabled(false); 245 m_PosSlider->setEnabled(false);
246 a_playAction->setOn(false); 246 a_playAction->setOn(false);
247 hideVideo(); 247 hideVideo();
248 slotShowList(); 248 slotShowList();
249 setCaption(appTitle()); 249 setCaption(appTitle());
250 return; 250 return;
251 } 251 }
252 m_CurrentPos = 0; 252 m_CurrentPos = 0;
253 m_playList->setCurrentItem(m_LastItem); 253 m_playList->setCurrentItem(m_LastItem);
254 m_uppos = 0; 254 m_uppos = 0;
255 m_PosSlider->setValue(0); 255 m_PosSlider->setValue(0);
256 int result = 0; 256 int result = 0;
257 if (!m_LastItem->isVideo()) { 257 if (!m_LastItem->isVideo()) {
258 hideVideo(); 258 hideVideo();
259 m_playing = true; 259 m_playing = true;
260 m_stack->raiseWidget(stack_audio); 260 m_stack->raiseWidget(stack_audio);
261 result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); 261 result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib);
262 } else { 262 } else {
263 m_playing = true; 263 m_playing = true;
264 setupVideo(a_ShowFull->isOn()); 264 setupVideo(a_ShowFull->isOn());
265 result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); 265 result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib);
266 } 266 }
267 if (result<0) { 267 if (result<0) {
268 // fehler 268 // fehler
269 return; 269 return;
270 } 270 }
271 mediaWindowraised(); 271 mediaWindowraised();
272 setCaption(appTitle()+" - "+m_LastItem->Lnk().name()); 272 setCaption(appTitle()+" - "+m_LastItem->Lnk().name());
273 odebug << "Range: " << result << oendl; 273 odebug << "Range: " << result << oendl;
274 m_PosSlider->setEnabled(true); 274 m_PosSlider->setEnabled(true);
275 m_PosSlider->setRange(0,m_PlayLib->length()); 275 m_PosSlider->setRange(0,m_PlayLib->length());
276 m_PosSlider->setValue(m_PlayLib->currentTime()); 276 m_PosSlider->setValue(m_PlayLib->currentTime());
277 QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); 277 QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
278} 278}
279 279
280void PMainWindow::slotPlayNext() 280void PMainWindow::slotPlayNext()
281{ 281{
282 PlaylistItem*item = m_playList->nextItem(m_LastItem); 282 PlaylistItem*item = m_playList->nextItem(m_LastItem);
283 if (!item) return; 283 if (!item) return;
284 m_LastItem = item; 284 m_LastItem = item;
285 slotPlayCurrent(); 285 slotPlayCurrent();
286} 286}
287 287
288void PMainWindow::slotGoNext() 288void PMainWindow::slotGoNext()
289{ 289{
290 m_LastItem = m_playList->nextItem(m_LastItem); 290 m_LastItem = m_playList->nextItem(m_LastItem);
291 slotPlayCurrent(); 291 slotPlayCurrent();
292} 292}
293 293
294void PMainWindow::slotPlayPrevious() 294void PMainWindow::slotPlayPrevious()
295{ 295{
296 PlaylistItem*item = m_playList->prevItem(m_LastItem); 296 PlaylistItem*item = m_playList->prevItem(m_LastItem);
297 if (!item) return; 297 if (!item) return;
298 m_LastItem = item; 298 m_LastItem = item;
299 slotPlayCurrent(); 299 slotPlayCurrent();
300} 300}
301 301
302void PMainWindow::slotStopped() 302void PMainWindow::slotStopped()
303{ 303{
304 if (!m_playing) return; 304 if (!m_playing) return;
305 odebug << "Slot stopped" << oendl; 305 odebug << "Slot stopped" << oendl;
306 m_playing = false; 306 m_playing = false;
307 slotGoNext(); 307 slotGoNext();
308} 308}
309 309
310void PMainWindow::slotCheckPos() 310void PMainWindow::slotCheckPos()
311{ 311{
312 if (!m_playing) return; 312 if (!m_playing) return;
313 if (!m_pressed) { 313 if (!m_pressed) {
314 m_uppos = m_PlayLib->currentTime(); 314 m_uppos = m_PlayLib->currentTime();
315 emit sigPos(m_uppos); 315 emit sigPos(m_uppos);
316 m_PosSlider->setValue(m_PlayLib->currentTime()); 316 m_PosSlider->setValue(m_PlayLib->currentTime());
317 } 317 }
318 qApp->processEvents(100); 318 qApp->processEvents(100);
319 QTimer::singleShot( 900, this, SLOT( slotCheckPos() ) ); 319 QTimer::singleShot( 900, this, SLOT( slotCheckPos() ) );
320} 320}
321 321
322void PMainWindow::slotRemoveFiles() 322void PMainWindow::slotRemoveFiles()
323{ 323{
324 if (m_playing||!m_playList->isVisible()) return; 324 if (m_playing||!m_playList->isVisible()) return;
325 PlaylistItem* Item = m_playList->currentItem(); 325 PlaylistItem* Item = m_playList->currentItem();
326 slotShowList(); 326 slotShowList();
327 m_playList->removeFromList(Item); 327 m_playList->removeFromList(Item);
328} 328}
329 329
330void PMainWindow::setupActions() 330void PMainWindow::setupActions()
331{ 331{
332 a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); 332 a_appendFiles = new QAction(tr("Append file(s)"),Opie::Core::OResource::loadPixmap( "opieplayer2/add_to_playlist",
333 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false );
333 connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); 334 connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles()));
334 a_addDir = new QAction(tr("Add directory"),Resource::loadIconSet("folder_open"),0,0,this,0,false); 335 a_addDir = new QAction(tr("Add directory"),Opie::Core::OResource::loadPixmap("folder_open",
336 Opie::Core::OResource::SmallIcon),0,0,this,0,false);
335 connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); 337 connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir()));
336 a_loadPlaylist = new QAction(tr("Append playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false); 338 a_loadPlaylist = new QAction(tr("Append playlist"),Opie::Core::OResource::loadPixmap("opieplayer2/add_to_playlist",
339 Opie::Core::OResource::SmallIcon),0,0,this,0,false);
337 connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); 340 connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u()));
338 a_savePlaylist = new QAction(tr("Save playlist"),Resource::loadIconSet("save"),0,0,this,0,false); 341 a_savePlaylist = new QAction(tr("Save playlist"),Opie::Core::OResource::loadPixmap("save",
342 Opie::Core::OResource::SmallIcon),0,0,this,0,false);
339 connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); 343 connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u()));
340 344
341 playlistOnly = new QActionGroup(this,"playlistgroup",false); 345 playlistOnly = new QActionGroup(this,"playlistgroup",false);
342 playlistOnly->insert(a_appendFiles); 346 playlistOnly->insert(a_appendFiles);
343 playlistOnly->insert(a_addDir); 347 playlistOnly->insert(a_addDir);
344 playlistOnly->insert(a_loadPlaylist); 348 playlistOnly->insert(a_loadPlaylist);
345 playlistOnly->insert(a_savePlaylist); 349 playlistOnly->insert(a_savePlaylist);
346 350
347 a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false ); 351 a_showPlaylist = new QAction(tr("Show playlist"),Opie::Core::OResource::loadPixmap( "txt",
352 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false );
348 connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); 353 connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList()));
349 a_ShowMedia = new QAction(tr("Show media window"),Resource::loadIconSet("opieplayer2/musicfile"), 0, 0, this, 0, false ); 354 a_ShowMedia = new QAction(tr("Show media window"),Opie::Core::OResource::loadPixmap("opieplayer2/musicfile",
355 Opie::Core::OResource::SmallIcon), 0, 0, this, 0, false );
350 connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow())); 356 connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow()));
351 357
352 a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false ); 358 a_removeFiles = new QAction(tr("Remove file"),Opie::Core::OResource::loadPixmap( "opieplayer2/remove_from_playlist",
359 Opie::Core::OResource::SmallIcon), 0, 0, this, 0, false );
353 connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); 360 connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles()));
354 361
355 playersGroup = new QActionGroup(this,"playgroup",false); 362 playersGroup = new QActionGroup(this,"playgroup",false);
356 363
357 a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, true); 364 a_playAction = new QAction(tr("Play list"),Opie::Core::OResource::loadPixmap( "opieplayer2/play",
365 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true);
358 a_playAction->setOn(false); 366 a_playAction->setOn(false);
359 connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool))); 367 connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool)));
360 368
361 a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false ); 369 a_playNext = new QAction(tr("Play next in list"),Opie::Core::OResource::loadPixmap( "fastforward",
370 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false );
362 connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); 371 connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext()));
363 a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false ); 372 a_playPrevious = new QAction(tr("Play previous in list"),Opie::Core::OResource::loadPixmap( "fastback",
373 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false );
364 connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); 374 connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious()));
365 a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); 375 a_ShowFull = new QAction(tr("Show videos fullscreen"),Opie::Core::OResource::loadPixmap( "fullscreen",
376 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true );
366 connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); 377 connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool)));
367 378
368 playersGroup->insert(a_playPrevious); 379 playersGroup->insert(a_playPrevious);
369 playersGroup->insert(a_playAction); 380 playersGroup->insert(a_playAction);
370 playersGroup->insert(a_playNext); 381 playersGroup->insert(a_playNext);
371 382
372 383
373 /* initial states of actions */ 384 /* initial states of actions */
374 a_showPlaylist->setEnabled(false); 385 a_showPlaylist->setEnabled(false);
375 a_removeFiles->setEnabled(false); 386 a_removeFiles->setEnabled(false);
376 a_ShowMedia->setEnabled(false); 387 a_ShowMedia->setEnabled(false);
377 playersGroup->setEnabled(false); 388 playersGroup->setEnabled(false);
378 389
379 settingsGroup = new QActionGroup(this,"configgroup",false); 390 settingsGroup = new QActionGroup(this,"configgroup",false);
380 391
381 a_Scaleup = new QAction(tr("Scale videos larger"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); 392 a_Scaleup = new QAction(tr("Scale videos larger"),Opie::Core::OResource::loadPixmap( "fullscreen",
393 Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true );
382 connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool))); 394 connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool)));
383 settingsGroup->insert(a_Scaleup); 395 settingsGroup->insert(a_Scaleup);
384} 396}
385 397
386void PMainWindow::setupToolBar() 398void PMainWindow::setupToolBar()
387{ 399{
388 setToolBarsMovable( false ); 400 setToolBarsMovable( false );
389 m_toolBar = new QToolBar( this ); 401 m_toolBar = new QToolBar( this );
390 //m_menuBar = new QMenuBar(m_toolBar); 402 //m_menuBar = new QMenuBar(m_toolBar);
391 m_menuBar=menuBar(); 403 m_menuBar=menuBar();
392 addToolBar(m_toolBar); 404 addToolBar(m_toolBar);
393 m_toolBar->setHorizontalStretchable( true ); 405 m_toolBar->setHorizontalStretchable( true );
394 a_appendFiles->addTo(m_toolBar); 406 a_appendFiles->addTo(m_toolBar);
395 a_removeFiles->addTo(m_toolBar); 407 a_removeFiles->addTo(m_toolBar);
396 a_showPlaylist->addTo(m_toolBar); 408 a_showPlaylist->addTo(m_toolBar);
397 a_ShowMedia->addTo(m_toolBar); 409 a_ShowMedia->addTo(m_toolBar);
398 a_ShowFull->addTo(m_toolBar); 410 a_ShowFull->addTo(m_toolBar);
399 playersGroup->addTo(m_toolBar); 411 playersGroup->addTo(m_toolBar);
400} 412}
401 413
402void PMainWindow::setupVideo(bool full) 414void PMainWindow::setupVideo(bool full)
403{ 415{
404 if (full) { 416 if (full) {
405 m_VideoPlayer->setBackgroundColor(black); 417 m_VideoPlayer->setBackgroundColor(black);
406 m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); 418 m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0));
407 m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); 419 m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height());
408 m_VideoPlayer->showFullScreen(); 420 m_VideoPlayer->showFullScreen();
409 connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); 421 connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked()));
410 } else { 422 } else {
411 m_VideoPlayer->hide(); 423 m_VideoPlayer->hide();
412 m_VideoPlayer->disconnect(this); 424 m_VideoPlayer->disconnect(this);
413 m_stack->addWidget(m_VideoPlayer,stack_video); 425 m_stack->addWidget(m_VideoPlayer,stack_video);
414 m_stack->raiseWidget(stack_video); 426 m_stack->raiseWidget(stack_video);
415 } 427 }
416 mediaWindowraised(); 428 mediaWindowraised();
417 m_VideoPlayer->fullScreen(full); 429 m_VideoPlayer->fullScreen(full);
418} 430}
419 431
420void PMainWindow::slotVideoclicked() 432void PMainWindow::slotVideoclicked()
421{ 433{
422 odebug << "PMainWindow::slotVideoclicked()" << oendl; 434 odebug << "PMainWindow::slotVideoclicked()" << oendl;
423 if (a_ShowFull->isOn()) { 435 if (a_ShowFull->isOn()) {
424 a_ShowFull->setOn(false); 436 a_ShowFull->setOn(false);
425 slotToggleFull(false); 437 slotToggleFull(false);
426 } 438 }
427} 439}
428 440
429void PMainWindow::slotToggleFull(bool how) 441void PMainWindow::slotToggleFull(bool how)
430{ 442{
431 if (m_PlayLib && m_VideoPlayer->isVisible() && m_PlayLib->isShowingVideo()) { 443 if (m_PlayLib && m_VideoPlayer->isVisible() && m_PlayLib->isShowingVideo()) {
432 m_PlayLib->pause(true); 444 m_PlayLib->pause(true);
433 setupVideo(how); 445 setupVideo(how);
434 m_PlayLib->pause(false); 446 m_PlayLib->pause(false);
435 } 447 }
436} 448}
437 449
438void PMainWindow::setupMenu() 450void PMainWindow::setupMenu()
439{ 451{
440 fileMenu = new QPopupMenu( m_menuBar ); 452 fileMenu = new QPopupMenu( m_menuBar );
441 m_menuBar->insertItem( tr( "Playlist" ), fileMenu ); 453 m_menuBar->insertItem( tr( "Playlist" ), fileMenu );
442 a_appendFiles->addTo(fileMenu); 454 a_appendFiles->addTo(fileMenu);
443 a_removeFiles->addTo(fileMenu); 455 a_removeFiles->addTo(fileMenu);
444 a_addDir->addTo(fileMenu); 456 a_addDir->addTo(fileMenu);
445 fileMenu->insertSeparator(); 457 fileMenu->insertSeparator();
446 a_loadPlaylist->addTo(fileMenu); 458 a_loadPlaylist->addTo(fileMenu);
447 a_savePlaylist->addTo(fileMenu); 459 a_savePlaylist->addTo(fileMenu);
448 460
449 dispMenu = new QPopupMenu( m_menuBar ); 461 dispMenu = new QPopupMenu( m_menuBar );
450 m_menuBar->insertItem( tr( "Show" ), dispMenu ); 462 m_menuBar->insertItem( tr( "Show" ), dispMenu );
451 a_showPlaylist->addTo(dispMenu); 463 a_showPlaylist->addTo(dispMenu);
452 a_ShowMedia->addTo(dispMenu); 464 a_ShowMedia->addTo(dispMenu);
453 a_ShowFull->addTo(dispMenu); 465 a_ShowFull->addTo(dispMenu);
454 playMenu = new QPopupMenu(m_menuBar); 466 playMenu = new QPopupMenu(m_menuBar);
455 m_menuBar->insertItem(tr("Playing"),playMenu); 467 m_menuBar->insertItem(tr("Playing"),playMenu);
456 playersGroup->addTo(playMenu); 468 playersGroup->addTo(playMenu);
457 configMenu = new QPopupMenu(m_menuBar); 469 configMenu = new QPopupMenu(m_menuBar);
458 m_menuBar->insertItem(tr("Config"),configMenu); 470 m_menuBar->insertItem(tr("Config"),configMenu);
459 settingsGroup->addTo(configMenu); 471 settingsGroup->addTo(configMenu);
460} 472}
461 473
462void PMainWindow::slotNewPos(int pos) 474void PMainWindow::slotNewPos(int pos)
463{ 475{
464 if (!m_PlayLib) return; 476 if (!m_PlayLib) return;
465 if (m_uppos==pos) return; 477 if (m_uppos==pos) return;
466 m_PlayLib->seekTo(pos); 478 m_PlayLib->seekTo(pos);
467} 479}
468 480
469void PMainWindow::sliderPressed() 481void PMainWindow::sliderPressed()
470{ 482{
471 m_pressed = true; 483 m_pressed = true;
472} 484}
473 485
474void PMainWindow::sliderReleased() 486void PMainWindow::sliderReleased()
475{ 487{
476 m_pressed = false; 488 m_pressed = false;
477} 489}
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp
index fe2dde3..eebb068 100644
--- a/noncore/multimedia/opieplayer3/playlist.cpp
+++ b/noncore/multimedia/opieplayer3/playlist.cpp
@@ -1,138 +1,136 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4 Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9 .>+-= 9 .>+-=
10 _;:, .> :=|. This program is free software; you can 10 _;:, .> :=|. This program is free software; you can
11.> <`_, > . <= redistribute it and/or modify it under 11.> <`_, > . <= redistribute it and/or modify it under
12:`=1 )Y*s>-.-- : the terms of the GNU General Public 12:`=1 )Y*s>-.-- : the terms of the GNU General Public
13.="- .-=="i, .._ License as published by the Free Software 13.="- .-=="i, .._ License as published by the Free Software
14 - . .-<_> .<> Foundation; either version 2 of the License, 14 - . .-<_> .<> Foundation; either version 2 of the License,
15 ._= =} : or (at your option) any later version. 15 ._= =} : or (at your option) any later version.
16 .%`+i> _;_. 16 .%`+i> _;_.
17 .i_,=:_. -<s. This program is distributed in the hope that 17 .i_,=:_. -<s. This program is distributed in the hope that
18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
19 : .. .:, . . . without even the implied warranty of 19 : .. .:, . . . without even the implied warranty of
20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.= = ; Library General Public License for more 22..}^=.= = ; Library General Public License for more
23++= -. .` .: details. 23++= -. .` .: details.
24 : = ...= . :.=- 24 : = ...= . :.=-
25 -. .:....=;==+<; You should have received a copy of the GNU 25 -. .:....=;==+<; You should have received a copy of the GNU
26 -_. . . )=. = Library General Public License along with 26 -_. . . )=. = Library General Public License along with
27 -- :-=` this library; see the file COPYING.LIB. 27 -- :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33#include "playlist.h" 33#include "playlist.h"
34#include "../opieplayer2/lib.h" 34#include "../opieplayer2/lib.h"
35#include "../opieplayer2/om3u.h" 35#include "../opieplayer2/om3u.h"
36 36
37#include <opie2/odebug.h> 37#include <opie2/odebug.h>
38#include <opie2/oresource.h> 38#include <opie2/oresource.h>
39#include <opie2/ofiledialog.h> 39#include <opie2/ofiledialog.h>
40 40
41#include <qpe/resource.h>
42
43#include <qfileinfo.h> 41#include <qfileinfo.h>
44#include <qmessagebox.h> 42#include <qmessagebox.h>
45#include <qdir.h> 43#include <qdir.h>
46 44
47//#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.pls;*.m3u;*.mp4;*.m4a" 45//#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.pls;*.m3u;*.mp4;*.m4a"
48#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.mp4;*.m4a" 46#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.mp4;*.m4a"
49 47
50PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent) 48PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent)
51 :QListViewItem(parent),m_Content(aLink),m_video(false) 49 :QListViewItem(parent),m_Content(aLink),m_video(false)
52{ 50{
53} 51}
54 52
55PlaylistItem::PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after) 53PlaylistItem::PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after)
56 :QListViewItem(parent,after),m_Content(aLink),m_video(false) 54 :QListViewItem(parent,after),m_Content(aLink),m_video(false)
57{ 55{
58} 56}
59 57
60void PlaylistItem::Video(bool y) 58void PlaylistItem::Video(bool y)
61{ 59{
62 m_video=y; 60 m_video=y;
63 if (m_video) { 61 if (m_video) {
64 setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/videofile")); 62 setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/videofile"));
65 } else { 63 } else {
66 setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/musicfile")); 64 setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/musicfile"));
67 } 65 }
68} 66}
69 67
70PlaylistItem::~PlaylistItem() 68PlaylistItem::~PlaylistItem()
71{ 69{
72} 70}
73 71
74/* PlaylistView Methods */ 72/* PlaylistView Methods */
75PlaylistView::PlaylistView(QWidget *parent, const char *name) 73PlaylistView::PlaylistView(QWidget *parent, const char *name)
76 : QListView(parent,name) 74 : QListView(parent,name)
77{ 75{
78// columnLabels << tr("FullName"); 76// columnLabels << tr("FullName");
79 columnLabels << tr(""); // icon 77 columnLabels << tr(""); // icon
80 columnLabels << tr("File"); 78 columnLabels << tr("File");
81 columnLabels << tr("Playtime"); 79 columnLabels << tr("Playtime");
82 columnLabels << tr("Artist"); 80 columnLabels << tr("Artist");
83 columnLabels << tr("Album"); 81 columnLabels << tr("Album");
84 columnLabels << tr("Title"); 82 columnLabels << tr("Title");
85 columnLabels << tr("Type"); 83 columnLabels << tr("Type");
86 columnLabels << tr("Size"); 84 columnLabels << tr("Size");
87 for (QStringList::Iterator it = columnLabels.begin(); it != columnLabels.end(); ++it) { 85 for (QStringList::Iterator it = columnLabels.begin(); it != columnLabels.end(); ++it) {
88 addColumn(*it); 86 addColumn(*it);
89 } 87 }
90 m_Infolib=0; 88 m_Infolib=0;
91 setAllColumnsShowFocus(true); 89 setAllColumnsShowFocus(true);
92 setSelectionMode(Single); 90 setSelectionMode(Single);
93 setSorting(-1); 91 setSorting(-1);
94 m_lastItem = 0; 92 m_lastItem = 0;
95 m_lastDir = QDir::homeDirPath(); 93 m_lastDir = QDir::homeDirPath();
96} 94}
97 95
98PlaylistView::~PlaylistView() 96PlaylistView::~PlaylistView()
99{ 97{
100 if (m_Infolib) delete m_Infolib; 98 if (m_Infolib) delete m_Infolib;
101} 99}
102 100
103void PlaylistView::checkLib() 101void PlaylistView::checkLib()
104{ 102{
105 if (!m_Infolib) { 103 if (!m_Infolib) {
106 m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); 104 m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately);
107 connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop())); 105 connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop()));
108 m_Infolib->ensureInitialized(); 106 m_Infolib->ensureInitialized();
109 } 107 }
110} 108}
111 109
112void PlaylistView::slotDummyStop() 110void PlaylistView::slotDummyStop()
113{ 111{
114 odebug << "void PlaylistView::slotDummyStop()" << oendl; 112 odebug << "void PlaylistView::slotDummyStop()" << oendl;
115} 113}
116 114
117void PlaylistView::slotAddFile(const DocLnk&aLink) 115void PlaylistView::slotAddFile(const DocLnk&aLink)
118{ 116{
119 QFileInfo f(aLink.file()); 117 QFileInfo f(aLink.file());
120 if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") { 118 if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") {
121 readPlayList(aLink.file()); 119 readPlayList(aLink.file());
122 } else { 120 } else {
123 addFile(aLink.file(),aLink.name()); 121 addFile(aLink.file(),aLink.name());
124 } 122 }
125 emit contentChanged(childCount()); 123 emit contentChanged(childCount());
126} 124}
127 125
128void PlaylistView::addFile(const QString&aFile,const QString&aName) 126void PlaylistView::addFile(const QString&aFile,const QString&aName)
129{ 127{
130 QFileInfo fileInfo(aFile); 128 QFileInfo fileInfo(aFile);
131 if (!fileInfo.exists()) return; 129 if (!fileInfo.exists()) return;
132 checkLib(); 130 checkLib();
133 QString name = aName; 131 QString name = aName;
134 if (name.isEmpty()) { 132 if (name.isEmpty()) {
135 name = fileInfo.fileName(); 133 name = fileInfo.fileName();
136 } 134 }
137 int i = m_Infolib->setfile(aFile.utf8().data()); 135 int i = m_Infolib->setfile(aFile.utf8().data());
138 /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */ 136 /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */