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