summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp7
1 files changed, 0 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index c05096a..b78ce24 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,192 +1,185 @@
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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 <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdatetime.h> 41#include <qdatetime.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qregexp.h> 44#include <qregexp.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46 46
47#include "playlistselection.h" 47#include "playlistselection.h"
48#include "playlistwidget.h" 48#include "playlistwidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "inputDialog.h" 50#include "inputDialog.h"
51#include "om3u.h" 51#include "om3u.h"
52#include "playlistfileview.h" 52#include "playlistfileview.h"
53 53
54//only needed for the random play 54//only needed for the random play
55#include <stdlib.h> 55#include <stdlib.h>
56#include <assert.h> 56#include <assert.h>
57 57
58#include "audiowidget.h"
59#include "videowidget.h"
60
61extern MediaPlayerState *mediaPlayerState;
62// extern AudioWidget *audioUI;
63// extern VideoWidget *videoUI;
64
65PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 58PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
66 : PlayListWidgetGui( mediaPlayerState, parent, name ) { 59 : PlayListWidgetGui( mediaPlayerState, parent, name ) {
67 60
68 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 61 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
69 "opieplayer2/add_to_playlist", 62 "opieplayer2/add_to_playlist",
70 this , SLOT(addSelected() ) ); 63 this , SLOT(addSelected() ) );
71 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 64 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
72 "opieplayer2/remove_from_playlist", 65 "opieplayer2/remove_from_playlist",
73 this , SLOT(removeSelected() ) ); 66 this , SLOT(removeSelected() ) );
74 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 67 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
75 this , SLOT( btnPlay( bool) ), TRUE ); 68 this , SLOT( btnPlay( bool) ), TRUE );
76 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 69 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
77 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 70 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
78 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 71 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
79 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 72 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
80 73
81 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 74 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
82 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 75 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
83 this, SLOT( addAllMusicToList() ) ); 76 this, SLOT( addAllMusicToList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 77 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
85 this, SLOT( addAllVideoToList() ) ); 78 this, SLOT( addAllVideoToList() ) );
86 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 79 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
87 this, SLOT( addAllToList() ) ); 80 this, SLOT( addAllToList() ) );
88 pmPlayList->insertSeparator(-1); 81 pmPlayList->insertSeparator(-1);
89// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 82// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
90// this, SLOT( saveList() ) ); 83// this, SLOT( saveList() ) );
91 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 84 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
92 this, SLOT(writem3u() ) ); 85 this, SLOT(writem3u() ) );
93 pmPlayList->insertSeparator(-1); 86 pmPlayList->insertSeparator(-1);
94 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 87 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
95 this,SLOT( openFile() ) ); 88 this,SLOT( openFile() ) );
96 pmPlayList->insertSeparator(-1); 89 pmPlayList->insertSeparator(-1);
97 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 90 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
98 audioView, SLOT( scanFiles() ) ); 91 audioView, SLOT( scanFiles() ) );
99 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 92 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
100 videoView, SLOT( scanFiles() ) ); 93 videoView, SLOT( scanFiles() ) );
101 94
102 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 95 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
103 &mediaPlayerState, SLOT( toggleFullscreen() ) ); 96 &mediaPlayerState, SLOT( toggleFullscreen() ) );
104 97
105 Config cfg( "OpiePlayer" ); 98 Config cfg( "OpiePlayer" );
106 bool b= cfg.readBoolEntry("FullScreen", 0); 99 bool b= cfg.readBoolEntry("FullScreen", 0);
107 mediaPlayerState.setFullscreen( b ); 100 mediaPlayerState.setFullscreen( b );
108 pmView->setItemChecked( -16, b ); 101 pmView->setItemChecked( -16, b );
109 102
110 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 103 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
111 d->selectedFiles, SLOT(moveSelectedUp() ) ); 104 d->selectedFiles, SLOT(moveSelectedUp() ) );
112 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 105 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
113 d->selectedFiles, SLOT(removeSelected() ) ); 106 d->selectedFiles, SLOT(removeSelected() ) );
114 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 107 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
115 d->selectedFiles, SLOT(moveSelectedDown() ) ); 108 d->selectedFiles, SLOT(moveSelectedDown() ) );
116 // QVBox *stretch2 = new QVBox( vbox1 ); 109 // QVBox *stretch2 = new QVBox( vbox1 );
117 110
118 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 111 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
119 SLOT( deletePlaylist() ) ); 112 SLOT( deletePlaylist() ) );
120 connect( pmView, SIGNAL( activated( int ) ), 113 connect( pmView, SIGNAL( activated( int ) ),
121 this, SLOT( pmViewActivated( int ) ) ); 114 this, SLOT( pmViewActivated( int ) ) );
122 connect( skinsMenu, SIGNAL( activated( int ) ) , 115 connect( skinsMenu, SIGNAL( activated( int ) ) ,
123 this, SLOT( skinsMenuActivated( int ) ) ); 116 this, SLOT( skinsMenuActivated( int ) ) );
124 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 117 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
125 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 118 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
126 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 119 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
127 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 120 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
128 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 121 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
129 this,SLOT( playIt( QListViewItem *) ) ); 122 this,SLOT( playIt( QListViewItem *) ) );
130 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 123 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
131 this, SLOT( addToSelection( QListViewItem *) ) ); 124 this, SLOT( addToSelection( QListViewItem *) ) );
132 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 125 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
133 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 126 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
134 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 127 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
135 this,SLOT( playIt( QListViewItem *) ) ); 128 this,SLOT( playIt( QListViewItem *) ) );
136 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 129 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
137 this, SLOT( addToSelection( QListViewItem *) ) ); 130 this, SLOT( addToSelection( QListViewItem *) ) );
138 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 131 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
139 this, SLOT( loadList( const DocLnk & ) ) ); 132 this, SLOT( loadList( const DocLnk & ) ) );
140 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 133 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
141 this, SLOT( tabChanged( QWidget* ) ) ); 134 this, SLOT( tabChanged( QWidget* ) ) );
142 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 135 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
143 d->tbPlay, SLOT( setOn( bool ) ) ); 136 d->tbPlay, SLOT( setOn( bool ) ) );
144 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 137 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
145 d->tbLoop, SLOT( setOn( bool ) ) ); 138 d->tbLoop, SLOT( setOn( bool ) ) );
146 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 139 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
147 d->tbShuffle, SLOT( setOn( bool ) ) ); 140 d->tbShuffle, SLOT( setOn( bool ) ) );
148 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 141 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
149 this, SLOT( playIt( QListViewItem *) ) ); 142 this, SLOT( playIt( QListViewItem *) ) );
150 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 143 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
151 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 144 &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
152 145
153 // see which skins are installed 146 // see which skins are installed
154 populateSkinsMenu(); 147 populateSkinsMenu();
155 initializeStates(); 148 initializeStates();
156 149
157 cfg.setGroup("PlayList"); 150 cfg.setGroup("PlayList");
158 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 151 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
159 loadList(DocLnk( currentPlaylist ) ); 152 loadList(DocLnk( currentPlaylist ) );
160} 153}
161 154
162 155
163PlayListWidget::~PlayListWidget() { 156PlayListWidget::~PlayListWidget() {
164 delete d; 157 delete d;
165} 158}
166 159
167 160
168void PlayListWidget::initializeStates() { 161void PlayListWidget::initializeStates() {
169 d->tbPlay->setOn( mediaPlayerState.isPlaying() ); 162 d->tbPlay->setOn( mediaPlayerState.isPlaying() );
170 d->tbLoop->setOn( mediaPlayerState.isLooping() ); 163 d->tbLoop->setOn( mediaPlayerState.isLooping() );
171 d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); 164 d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
172 d->playListFrame->show(); 165 d->playListFrame->show();
173} 166}
174 167
175void PlayListWidget::writeDefaultPlaylist() { 168void PlayListWidget::writeDefaultPlaylist() {
176 169
177 Config config( "OpiePlayer" ); 170 Config config( "OpiePlayer" );
178 config.setGroup( "PlayList" ); 171 config.setGroup( "PlayList" );
179 QString filename=QPEApplication::documentDir() + "/default.m3u"; 172 QString filename=QPEApplication::documentDir() + "/default.m3u";
180 QString currentString = config.readEntry( "CurrentPlaylist", filename); 173 QString currentString = config.readEntry( "CurrentPlaylist", filename);
181 if( currentString == filename) { 174 if( currentString == filename) {
182 Om3u *m3uList; 175 Om3u *m3uList;
183 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 176 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
184 if( d->selectedFiles->first() ) { 177 if( d->selectedFiles->first() ) {
185 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 178 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
186 do { 179 do {
187 // qDebug(d->selectedFiles->current()->file()); 180 // qDebug(d->selectedFiles->current()->file());
188 m3uList->add( d->selectedFiles->current()->file() ); 181 m3uList->add( d->selectedFiles->current()->file() );
189 } 182 }
190 while ( d->selectedFiles->next() ); 183 while ( d->selectedFiles->next() );
191 184
192 m3uList->write(); 185 m3uList->write();