-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 5ce53b8..5fb605b 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,537 +1,538 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #define QTOPIA_INTERNAL_FSLP | 21 | #define QTOPIA_INTERNAL_FSLP |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | 23 | ||
24 | #include <qmenubar.h> | 24 | #include <qmenubar.h> |
25 | #include <qtoolbar.h> | 25 | #include <qtoolbar.h> |
26 | #include <qpe/qpemenubar.h> | ||
26 | #include <qpe/fileselector.h> | 27 | #include <qpe/fileselector.h> |
27 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/lnkproperties.h> | 29 | #include <qpe/lnkproperties.h> |
29 | #include <qpe/storage.h> | 30 | #include <qpe/storage.h> |
30 | 31 | ||
31 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
32 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
33 | #include <qpe/global.h> | 34 | #include <qpe/global.h> |
34 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
35 | #include <qaction.h> | 36 | #include <qaction.h> |
36 | #include <qcursor.h> | 37 | #include <qcursor.h> |
37 | #include <qimage.h> | 38 | #include <qimage.h> |
38 | #include <qfile.h> | 39 | #include <qfile.h> |
39 | #include <qdir.h> | 40 | #include <qdir.h> |
40 | #include <qlayout.h> | 41 | #include <qlayout.h> |
41 | #include <qlabel.h> | 42 | #include <qlabel.h> |
42 | #include <qlist.h> | 43 | #include <qlist.h> |
43 | #include <qlistbox.h> | 44 | #include <qlistbox.h> |
44 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
45 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
46 | #include <qtoolbutton.h> | 47 | #include <qtoolbutton.h> |
47 | #include <qtabwidget.h> | 48 | #include <qtabwidget.h> |
48 | #include <qlistview.h> | 49 | #include <qlistview.h> |
49 | #include <qpoint.h> | 50 | #include <qpoint.h> |
50 | #include <qlineedit.h> | 51 | #include <qlineedit.h> |
51 | #include <qpushbutton.h> | 52 | #include <qpushbutton.h> |
52 | #include <qregexp.h> | 53 | #include <qregexp.h> |
53 | #include <qtextstream.h> | 54 | #include <qtextstream.h> |
54 | 55 | ||
55 | //#include <qtimer.h> | 56 | //#include <qtimer.h> |
56 | 57 | ||
57 | #include "playlistselection.h" | 58 | #include "playlistselection.h" |
58 | #include "playlistwidget.h" | 59 | #include "playlistwidget.h" |
59 | #include "mediaplayerstate.h" | 60 | #include "mediaplayerstate.h" |
60 | 61 | ||
61 | #include "inputDialog.h" | 62 | #include "inputDialog.h" |
62 | 63 | ||
63 | #include <stdlib.h> | 64 | #include <stdlib.h> |
64 | #include "audiowidget.h" | 65 | #include "audiowidget.h" |
65 | #include "videowidget.h" | 66 | #include "videowidget.h" |
66 | 67 | ||
67 | #include <unistd.h> | 68 | #include <unistd.h> |
68 | #include <sys/file.h> | 69 | #include <sys/file.h> |
69 | #include <sys/ioctl.h> | 70 | #include <sys/ioctl.h> |
70 | #include <sys/soundcard.h> | 71 | #include <sys/soundcard.h> |
71 | 72 | ||
72 | // for setBacklight() | 73 | // for setBacklight() |
73 | #include <linux/fb.h> | 74 | #include <linux/fb.h> |
74 | #include <sys/types.h> | 75 | #include <sys/types.h> |
75 | #include <sys/stat.h> | 76 | #include <sys/stat.h> |
76 | #include <stdlib.h> | 77 | #include <stdlib.h> |
77 | 78 | ||
78 | #define BUTTONS_ON_TOOLBAR | 79 | #define BUTTONS_ON_TOOLBAR |
79 | #define SIDE_BUTTONS | 80 | #define SIDE_BUTTONS |
80 | #define CAN_SAVE_LOAD_PLAYLISTS | 81 | #define CAN_SAVE_LOAD_PLAYLISTS |
81 | 82 | ||
82 | extern AudioWidget *audioUI; | 83 | extern AudioWidget *audioUI; |
83 | extern VideoWidget *videoUI; | 84 | extern VideoWidget *videoUI; |
84 | extern MediaPlayerState *mediaPlayerState; | 85 | extern MediaPlayerState *mediaPlayerState; |
85 | 86 | ||
86 | static inline QString fullBaseName ( const QFileInfo &fi ) | 87 | static inline QString fullBaseName ( const QFileInfo &fi ) |
87 | { | 88 | { |
88 | QString str = fi. fileName ( ); | 89 | QString str = fi. fileName ( ); |
89 | return str. left ( str. findRev ( '.' )); | 90 | return str. left ( str. findRev ( '.' )); |
90 | } | 91 | } |
91 | 92 | ||
92 | 93 | ||
93 | QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod"; | 94 | QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod"; |
94 | // class myFileSelector { | 95 | // class myFileSelector { |
95 | 96 | ||
96 | // }; | 97 | // }; |
97 | class PlayListWidgetPrivate { | 98 | class PlayListWidgetPrivate { |
98 | public: | 99 | public: |
99 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 100 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
100 | QFrame *playListFrame; | 101 | QFrame *playListFrame; |
101 | FileSelector *files; | 102 | FileSelector *files; |
102 | PlayListSelection *selectedFiles; | 103 | PlayListSelection *selectedFiles; |
103 | bool setDocumentUsed; | 104 | bool setDocumentUsed; |
104 | DocLnk *current; | 105 | DocLnk *current; |
105 | }; | 106 | }; |
106 | 107 | ||
107 | 108 | ||
108 | class ToolButton : public QToolButton { | 109 | class ToolButton : public QToolButton { |
109 | public: | 110 | public: |
110 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 111 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
111 | : QToolButton( parent, name ) { | 112 | : QToolButton( parent, name ) { |
112 | setTextLabel( name ); | 113 | setTextLabel( name ); |
113 | setPixmap( Resource::loadPixmap( icon ) ); | 114 | setPixmap( Resource::loadPixmap( icon ) ); |
114 | setAutoRaise( TRUE ); | 115 | setAutoRaise( TRUE ); |
115 | setFocusPolicy( QWidget::NoFocus ); | 116 | setFocusPolicy( QWidget::NoFocus ); |
116 | setToggleButton( t ); | 117 | setToggleButton( t ); |
117 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 118 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
118 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 119 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
119 | } | 120 | } |
120 | }; | 121 | }; |
121 | 122 | ||
122 | 123 | ||
123 | class MenuItem : public QAction { | 124 | class MenuItem : public QAction { |
124 | public: | 125 | public: |
125 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 126 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
126 | : QAction( text, QString::null, 0, 0 ) { | 127 | : QAction( text, QString::null, 0, 0 ) { |
127 | connect( this, SIGNAL( activated() ), handler, slot ); | 128 | connect( this, SIGNAL( activated() ), handler, slot ); |
128 | addTo( parent ); | 129 | addTo( parent ); |
129 | } | 130 | } |
130 | }; | 131 | }; |
131 | 132 | ||
132 | 133 | ||
133 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 134 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
134 | : QMainWindow( parent, name, fl ) { | 135 | : QMainWindow( parent, name, fl ) { |
135 | 136 | ||
136 | d = new PlayListWidgetPrivate; | 137 | d = new PlayListWidgetPrivate; |
137 | d->setDocumentUsed = FALSE; | 138 | d->setDocumentUsed = FALSE; |
138 | d->current = NULL; | 139 | d->current = NULL; |
139 | fromSetDocument = FALSE; | 140 | fromSetDocument = FALSE; |
140 | insanityBool=FALSE; | 141 | insanityBool=FALSE; |
141 | audioScan = FALSE; | 142 | audioScan = FALSE; |
142 | videoScan = FALSE; | 143 | videoScan = FALSE; |
143 | // menuTimer = new QTimer( this ,"menu timer"), | 144 | // menuTimer = new QTimer( this ,"menu timer"), |
144 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 145 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
145 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); | 146 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); |
146 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 147 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
147 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | 148 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); |
148 | 149 | ||
149 | setBackgroundMode( PaletteButton ); | 150 | setBackgroundMode( PaletteButton ); |
150 | 151 | ||
151 | setCaption( tr("OpiePlayer") ); | 152 | setCaption( tr("OpiePlayer") ); |
152 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 153 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); |
153 | 154 | ||
154 | setToolBarsMovable( FALSE ); | 155 | setToolBarsMovable( FALSE ); |
155 | 156 | ||
156 | // Create Toolbar | 157 | // Create Toolbar |
157 | QToolBar *toolbar = new QToolBar( this ); | 158 | QToolBar *toolbar = new QToolBar( this ); |
158 | toolbar->setHorizontalStretchable( TRUE ); | 159 | toolbar->setHorizontalStretchable( TRUE ); |
159 | 160 | ||
160 | // Create Menubar | 161 | // Create Menubar |
161 | QMenuBar *menu = new QMenuBar( toolbar ); | 162 | QMenuBar *menu = new QMenuBar( toolbar ); |
162 | menu->setMargin( 0 ); | 163 | menu->setMargin( 0 ); |
163 | 164 | ||
164 | QToolBar *bar = new QToolBar( this ); | 165 | QToolBar *bar = new QToolBar( this ); |
165 | bar->setLabel( tr( "Play Operations" ) ); | 166 | bar->setLabel( tr( "Play Operations" ) ); |
166 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 167 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
167 | // this , SLOT( addSelected()) ); | 168 | // this , SLOT( addSelected()) ); |
168 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 169 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
169 | tbDeletePlaylist->setFlat(TRUE); | 170 | tbDeletePlaylist->setFlat(TRUE); |
170 | 171 | ||
171 | tbDeletePlaylist->setFixedSize(20,20); | 172 | tbDeletePlaylist->setFixedSize(20,20); |
172 | 173 | ||
173 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 174 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
174 | this , SLOT(addSelected()) ); | 175 | this , SLOT(addSelected()) ); |
175 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 176 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
176 | this , SLOT(removeSelected()) ); | 177 | this , SLOT(removeSelected()) ); |
177 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 178 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
178 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 179 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
179 | this , SLOT( btnPlay(bool) ), TRUE ); | 180 | this , SLOT( btnPlay(bool) ), TRUE ); |
180 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 181 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
181 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 182 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
182 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 183 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
183 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 184 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
184 | tbDeletePlaylist->hide(); | 185 | tbDeletePlaylist->hide(); |
185 | 186 | ||
186 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 187 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
187 | menu->insertItem( tr( "File" ), pmPlayList ); | 188 | menu->insertItem( tr( "File" ), pmPlayList ); |
188 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 189 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
189 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 190 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
190 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 191 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
191 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 192 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
192 | pmPlayList->insertSeparator(-1); | 193 | pmPlayList->insertSeparator(-1); |
193 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 194 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
194 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 195 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
195 | pmPlayList->insertSeparator(-1); | 196 | pmPlayList->insertSeparator(-1); |
196 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 197 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
197 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 198 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
198 | 199 | ||
199 | QPopupMenu *pmView = new QPopupMenu( this ); | 200 | QPopupMenu *pmView = new QPopupMenu( this ); |
200 | menu->insertItem( tr( "View" ), pmView ); | 201 | menu->insertItem( tr( "View" ), pmView ); |
201 | 202 | ||
202 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 203 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
203 | fullScreenButton->addTo(pmView); | 204 | fullScreenButton->addTo(pmView); |
204 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 205 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
205 | scaleButton->addTo(pmView); | 206 | scaleButton->addTo(pmView); |
206 | 207 | ||
207 | 208 | ||
208 | skinsMenu = new QPopupMenu( this ); | 209 | skinsMenu = new QPopupMenu( this ); |
209 | menu->insertItem( tr( "Skins" ), skinsMenu ); | 210 | menu->insertItem( tr( "Skins" ), skinsMenu ); |
210 | skinsMenu->isCheckable(); | 211 | skinsMenu->isCheckable(); |
211 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 212 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
212 | this, SLOT( skinsMenuActivated( int ) ) ); | 213 | this, SLOT( skinsMenuActivated( int ) ) ); |
213 | populateSkinsMenu(); | 214 | populateSkinsMenu(); |
214 | 215 | ||
215 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 216 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
216 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 217 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
217 | 218 | ||
218 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 219 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
219 | 220 | ||
220 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 221 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
221 | // tabWidget->setTabShape(QTabWidget::Triangular); | 222 | // tabWidget->setTabShape(QTabWidget::Triangular); |
222 | 223 | ||
223 | QWidget *pTab; | 224 | QWidget *pTab; |
224 | pTab = new QWidget( tabWidget, "pTab" ); | 225 | pTab = new QWidget( tabWidget, "pTab" ); |
225 | // playlistView = new QListView( pTab, "playlistview" ); | 226 | // playlistView = new QListView( pTab, "playlistview" ); |
226 | // playlistView->setMinimumSize(236,260); | 227 | // playlistView->setMinimumSize(236,260); |
227 | tabWidget->insertTab( pTab,"Playlist"); | 228 | tabWidget->insertTab( pTab,"Playlist"); |
228 | 229 | ||
229 | 230 | ||
230 | // Add the playlist area | 231 | // Add the playlist area |
231 | 232 | ||
232 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 233 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
233 | d->playListFrame = vbox3; | 234 | d->playListFrame = vbox3; |
234 | 235 | ||
235 | QGridLayout *layoutF = new QGridLayout( pTab ); | 236 | QGridLayout *layoutF = new QGridLayout( pTab ); |
236 | layoutF->setSpacing( 2); | 237 | layoutF->setSpacing( 2); |
237 | layoutF->setMargin( 2); | 238 | layoutF->setMargin( 2); |
238 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); | 239 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); |
239 | 240 | ||
240 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 241 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
241 | 242 | ||
242 | d->selectedFiles = new PlayListSelection( hbox2); | 243 | d->selectedFiles = new PlayListSelection( hbox2); |
243 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 244 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
244 | 245 | ||
245 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 246 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
246 | 247 | ||
247 | 248 | ||
248 | 249 | ||
249 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 250 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
250 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 251 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
251 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 252 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
252 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 253 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
253 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 254 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
254 | 255 | ||
255 | QWidget *aTab; | 256 | QWidget *aTab; |
256 | aTab = new QWidget( tabWidget, "aTab" ); | 257 | aTab = new QWidget( tabWidget, "aTab" ); |
257 | audioView = new QListView( aTab, "Audioview" ); | 258 | audioView = new QListView( aTab, "Audioview" ); |
258 | 259 | ||
259 | QGridLayout *layoutA = new QGridLayout( aTab ); | 260 | QGridLayout *layoutA = new QGridLayout( aTab ); |
260 | layoutA->setSpacing( 2); | 261 | layoutA->setSpacing( 2); |
261 | layoutA->setMargin( 2); | 262 | layoutA->setMargin( 2); |
262 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 263 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
263 | 264 | ||
264 | audioView->addColumn( tr("Title"),-1); | 265 | audioView->addColumn( tr("Title"),-1); |
265 | audioView->addColumn(tr("Size"), -1); | 266 | audioView->addColumn(tr("Size"), -1); |
266 | audioView->addColumn(tr("Media"),-1); | 267 | audioView->addColumn(tr("Media"),-1); |
267 | audioView->addColumn( tr( "Path" ), -1 ); | 268 | audioView->addColumn( tr( "Path" ), -1 ); |
268 | 269 | ||
269 | audioView->setColumnAlignment(1, Qt::AlignRight); | 270 | audioView->setColumnAlignment(1, Qt::AlignRight); |
270 | audioView->setColumnAlignment(2, Qt::AlignRight); | 271 | audioView->setColumnAlignment(2, Qt::AlignRight); |
271 | audioView->setAllColumnsShowFocus(TRUE); | 272 | audioView->setAllColumnsShowFocus(TRUE); |
272 | 273 | ||
273 | audioView->setMultiSelection( TRUE ); | 274 | audioView->setMultiSelection( TRUE ); |
274 | audioView->setSelectionMode( QListView::Extended); | 275 | audioView->setSelectionMode( QListView::Extended); |
275 | audioView->setSorting( 3, TRUE ); | 276 | audioView->setSorting( 3, TRUE ); |
276 | 277 | ||
277 | tabWidget->insertTab(aTab,tr("Audio")); | 278 | tabWidget->insertTab(aTab,tr("Audio")); |
278 | 279 | ||
279 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 280 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
280 | 281 | ||
281 | // audioView | 282 | // audioView |
282 | // populateAudioView(); | 283 | // populateAudioView(); |
283 | // videowidget | 284 | // videowidget |
284 | 285 | ||
285 | QWidget *vTab; | 286 | QWidget *vTab; |
286 | vTab = new QWidget( tabWidget, "vTab" ); | 287 | vTab = new QWidget( tabWidget, "vTab" ); |
287 | videoView = new QListView( vTab, "Videoview" ); | 288 | videoView = new QListView( vTab, "Videoview" ); |
288 | 289 | ||
289 | QGridLayout *layoutV = new QGridLayout( vTab ); | 290 | QGridLayout *layoutV = new QGridLayout( vTab ); |
290 | layoutV->setSpacing( 2); | 291 | layoutV->setSpacing( 2); |
291 | layoutV->setMargin( 2); | 292 | layoutV->setMargin( 2); |
292 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 293 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
293 | 294 | ||
294 | videoView->addColumn(tr("Title"),-1); | 295 | videoView->addColumn(tr("Title"),-1); |
295 | videoView->addColumn(tr("Size"),-1); | 296 | videoView->addColumn(tr("Size"),-1); |
296 | videoView->addColumn(tr("Media"),-1); | 297 | videoView->addColumn(tr("Media"),-1); |
297 | videoView->addColumn(tr( "Path" ), -1 ); | 298 | videoView->addColumn(tr( "Path" ), -1 ); |
298 | videoView->setColumnAlignment(1, Qt::AlignRight); | 299 | videoView->setColumnAlignment(1, Qt::AlignRight); |
299 | videoView->setColumnAlignment(2, Qt::AlignRight); | 300 | videoView->setColumnAlignment(2, Qt::AlignRight); |
300 | videoView->setAllColumnsShowFocus(TRUE); | 301 | videoView->setAllColumnsShowFocus(TRUE); |
301 | videoView->setMultiSelection( TRUE ); | 302 | videoView->setMultiSelection( TRUE ); |
302 | videoView->setSelectionMode( QListView::Extended); | 303 | videoView->setSelectionMode( QListView::Extended); |
303 | 304 | ||
304 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 305 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
305 | 306 | ||
306 | tabWidget->insertTab( vTab,tr("Video")); | 307 | tabWidget->insertTab( vTab,tr("Video")); |
307 | 308 | ||
308 | QWidget *LTab; | 309 | QWidget *LTab; |
309 | LTab = new QWidget( tabWidget, "LTab" ); | 310 | LTab = new QWidget( tabWidget, "LTab" ); |
310 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); | 311 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); |
311 | 312 | ||
312 | QGridLayout *layoutL = new QGridLayout( LTab ); | 313 | QGridLayout *layoutL = new QGridLayout( LTab ); |
313 | layoutL->setSpacing( 2); | 314 | layoutL->setSpacing( 2); |
314 | layoutL->setMargin( 2); | 315 | layoutL->setMargin( 2); |
315 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 316 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
316 | 317 | ||
317 | tabWidget->insertTab(LTab,tr("Lists")); | 318 | tabWidget->insertTab(LTab,tr("Lists")); |
318 | 319 | ||
319 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 320 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
320 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 321 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
321 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 322 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
322 | 323 | ||
323 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 324 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
324 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 325 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
325 | 326 | ||
326 | 327 | ||
327 | ///audioView | 328 | ///audioView |
328 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 329 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
329 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 330 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
330 | 331 | ||
331 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 332 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
332 | this,SLOT( playIt( QListViewItem *)) ); | 333 | this,SLOT( playIt( QListViewItem *)) ); |
333 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 334 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
334 | 335 | ||
335 | 336 | ||
336 | //videoView | 337 | //videoView |
337 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 338 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
338 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 339 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
339 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 340 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
340 | this,SLOT( playIt( QListViewItem *)) ); | 341 | this,SLOT( playIt( QListViewItem *)) ); |
341 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 342 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
342 | 343 | ||
343 | //playlists | 344 | //playlists |
344 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 345 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
345 | 346 | ||
346 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 347 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
347 | 348 | ||
348 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 349 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
349 | 350 | ||
350 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 351 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
351 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 352 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
352 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 353 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
353 | 354 | ||
354 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 355 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
355 | 356 | ||
356 | setCentralWidget( vbox5 ); | 357 | setCentralWidget( vbox5 ); |
357 | 358 | ||
358 | Config cfg( "OpiePlayer" ); | 359 | Config cfg( "OpiePlayer" ); |
359 | readConfig( cfg ); | 360 | readConfig( cfg ); |
360 | 361 | ||
361 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); | 362 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); |
362 | loadList(DocLnk( currentPlayList)); | 363 | loadList(DocLnk( currentPlayList)); |
363 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); | 364 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); |
364 | 365 | ||
365 | initializeStates(); | 366 | initializeStates(); |
366 | } | 367 | } |
367 | 368 | ||
368 | 369 | ||
369 | PlayListWidget::~PlayListWidget() { | 370 | PlayListWidget::~PlayListWidget() { |
370 | Config cfg( "OpiePlayer" ); | 371 | Config cfg( "OpiePlayer" ); |
371 | writeConfig( cfg ); | 372 | writeConfig( cfg ); |
372 | 373 | ||
373 | if ( d->current ) | 374 | if ( d->current ) |
374 | delete d->current; | 375 | delete d->current; |
375 | if(d) delete d; | 376 | if(d) delete d; |
376 | } | 377 | } |
377 | 378 | ||
378 | 379 | ||
379 | void PlayListWidget::initializeStates() { | 380 | void PlayListWidget::initializeStates() { |
380 | 381 | ||
381 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 382 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
382 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 383 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
383 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 384 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
384 | setPlaylist( true); | 385 | setPlaylist( true); |
385 | } | 386 | } |
386 | 387 | ||
387 | 388 | ||
388 | void PlayListWidget::readConfig( Config& cfg ) { | 389 | void PlayListWidget::readConfig( Config& cfg ) { |
389 | cfg.setGroup("PlayList"); | 390 | cfg.setGroup("PlayList"); |
390 | QString currentString = cfg.readEntry("current", "" ); | 391 | QString currentString = cfg.readEntry("current", "" ); |
391 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 392 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
392 | for ( int i = 0; i < noOfFiles; i++ ) { | 393 | for ( int i = 0; i < noOfFiles; i++ ) { |
393 | QString entryName; | 394 | QString entryName; |
394 | entryName.sprintf( "File%i", i + 1 ); | 395 | entryName.sprintf( "File%i", i + 1 ); |
395 | QString linkFile = cfg.readEntry( entryName ); | 396 | QString linkFile = cfg.readEntry( entryName ); |
396 | DocLnk lnk( linkFile ); | 397 | DocLnk lnk( linkFile ); |
397 | if ( lnk.isValid() ) { | 398 | if ( lnk.isValid() ) { |
398 | d->selectedFiles->addToSelection( lnk ); | 399 | d->selectedFiles->addToSelection( lnk ); |
399 | } | 400 | } |
400 | } | 401 | } |
401 | d->selectedFiles->setSelectedItem( currentString); | 402 | d->selectedFiles->setSelectedItem( currentString); |
402 | } | 403 | } |
403 | 404 | ||
404 | 405 | ||
405 | void PlayListWidget::writeConfig( Config& cfg ) const { | 406 | void PlayListWidget::writeConfig( Config& cfg ) const { |
406 | 407 | ||
407 | d->selectedFiles->writeCurrent( cfg); | 408 | d->selectedFiles->writeCurrent( cfg); |
408 | cfg.setGroup("PlayList"); | 409 | cfg.setGroup("PlayList"); |
409 | int noOfFiles = 0; | 410 | int noOfFiles = 0; |
410 | d->selectedFiles->first(); | 411 | d->selectedFiles->first(); |
411 | do { | 412 | do { |
412 | const DocLnk *lnk = d->selectedFiles->current(); | 413 | const DocLnk *lnk = d->selectedFiles->current(); |
413 | if ( lnk ) { | 414 | if ( lnk ) { |
414 | QString entryName; | 415 | QString entryName; |
415 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 416 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
416 | // qDebug(entryName); | 417 | // qDebug(entryName); |
417 | cfg.writeEntry( entryName, lnk->linkFile() ); | 418 | cfg.writeEntry( entryName, lnk->linkFile() ); |
418 | // if this link does exist, add it so we have the file | 419 | // if this link does exist, add it so we have the file |
419 | // next time... | 420 | // next time... |
420 | if ( !QFile::exists( lnk->linkFile() ) ) { | 421 | if ( !QFile::exists( lnk->linkFile() ) ) { |
421 | // the way writing lnks doesn't really check for out | 422 | // the way writing lnks doesn't really check for out |
422 | // of disk space, but check it anyway. | 423 | // of disk space, but check it anyway. |
423 | // if ( !lnk->writeLink() ) { | 424 | // if ( !lnk->writeLink() ) { |
424 | // QMessageBox::critical( 0, tr("Out of space"), | 425 | // QMessageBox::critical( 0, tr("Out of space"), |
425 | // tr( "There was a problem saving " | 426 | // tr( "There was a problem saving " |
426 | // "the playlist.\n" | 427 | // "the playlist.\n" |
427 | // "Your playlist " | 428 | // "Your playlist " |
428 | // "may be missing some entries\n" | 429 | // "may be missing some entries\n" |
429 | // "the next time you start it." ) | 430 | // "the next time you start it." ) |
430 | // ); | 431 | // ); |
431 | // } | 432 | // } |
432 | 433 | ||
433 | } | 434 | } |
434 | noOfFiles++; | 435 | noOfFiles++; |
435 | } | 436 | } |
436 | } | 437 | } |
437 | while ( d->selectedFiles->next() ); | 438 | while ( d->selectedFiles->next() ); |
438 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 439 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
439 | } | 440 | } |
440 | 441 | ||
441 | 442 | ||
442 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 443 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
443 | d->setDocumentUsed = false; | 444 | d->setDocumentUsed = false; |
444 | if ( mediaPlayerState->playlist() ) { | 445 | if ( mediaPlayerState->playlist() ) { |
445 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | 446 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) |
446 | d->selectedFiles->addToSelection( lnk ); | 447 | d->selectedFiles->addToSelection( lnk ); |
447 | } | 448 | } |
448 | else | 449 | else |
449 | mediaPlayerState->setPlaying( true); | 450 | mediaPlayerState->setPlaying( true); |
450 | 451 | ||
451 | } | 452 | } |
452 | 453 | ||
453 | 454 | ||
454 | void PlayListWidget::clearList() { | 455 | void PlayListWidget::clearList() { |
455 | while ( first() ) | 456 | while ( first() ) |
456 | d->selectedFiles->removeSelected(); | 457 | d->selectedFiles->removeSelected(); |
457 | Config cfg( "OpiePlayer" ); | 458 | Config cfg( "OpiePlayer" ); |
458 | cfg.setGroup("PlayList"); | 459 | cfg.setGroup("PlayList"); |
459 | cfg.writeEntry("CurrentPlaylist",""); | 460 | cfg.writeEntry("CurrentPlaylist",""); |
460 | currentPlayList=""; | 461 | currentPlayList=""; |
461 | 462 | ||
462 | } | 463 | } |
463 | 464 | ||
464 | 465 | ||
465 | void PlayListWidget::addAllToList() { | 466 | void PlayListWidget::addAllToList() { |
466 | DocLnkSet filesAll; | 467 | DocLnkSet filesAll; |
467 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 468 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
468 | QListIterator<DocLnk> Adit( filesAll.children() ); | 469 | QListIterator<DocLnk> Adit( filesAll.children() ); |
469 | for ( ; Adit.current(); ++Adit ) | 470 | for ( ; Adit.current(); ++Adit ) |
470 | if(QFileInfo(Adit.current()->file()).exists()) | 471 | if(QFileInfo(Adit.current()->file()).exists()) |
471 | d->selectedFiles->addToSelection( **Adit ); | 472 | d->selectedFiles->addToSelection( **Adit ); |
472 | tabWidget->setCurrentPage(0); | 473 | tabWidget->setCurrentPage(0); |
473 | 474 | ||
474 | writeCurrentM3u(); | 475 | writeCurrentM3u(); |
475 | d->selectedFiles->first(); | 476 | d->selectedFiles->first(); |
476 | } | 477 | } |
477 | 478 | ||
478 | 479 | ||
479 | void PlayListWidget::addAllMusicToList() { | 480 | void PlayListWidget::addAllMusicToList() { |
480 | QListIterator<DocLnk> dit( files.children() ); | 481 | QListIterator<DocLnk> dit( files.children() ); |
481 | for ( ; dit.current(); ++dit ) | 482 | for ( ; dit.current(); ++dit ) |
482 | if(QFileInfo(dit.current()->file()).exists()) | 483 | if(QFileInfo(dit.current()->file()).exists()) |
483 | d->selectedFiles->addToSelection( **dit ); | 484 | d->selectedFiles->addToSelection( **dit ); |
484 | tabWidget->setCurrentPage(0); | 485 | tabWidget->setCurrentPage(0); |
485 | 486 | ||
486 | writeCurrentM3u(); | 487 | writeCurrentM3u(); |
487 | d->selectedFiles->first(); | 488 | d->selectedFiles->first(); |
488 | } | 489 | } |
489 | 490 | ||
490 | 491 | ||
491 | void PlayListWidget::addAllVideoToList() { | 492 | void PlayListWidget::addAllVideoToList() { |
492 | QListIterator<DocLnk> dit( vFiles.children() ); | 493 | QListIterator<DocLnk> dit( vFiles.children() ); |
493 | for ( ; dit.current(); ++dit ) | 494 | for ( ; dit.current(); ++dit ) |
494 | if(QFileInfo( dit.current()->file()).exists()) | 495 | if(QFileInfo( dit.current()->file()).exists()) |
495 | d->selectedFiles->addToSelection( **dit ); | 496 | d->selectedFiles->addToSelection( **dit ); |
496 | tabWidget->setCurrentPage(0); | 497 | tabWidget->setCurrentPage(0); |
497 | 498 | ||
498 | writeCurrentM3u(); | 499 | writeCurrentM3u(); |
499 | d->selectedFiles->first(); | 500 | d->selectedFiles->first(); |
500 | } | 501 | } |
501 | 502 | ||
502 | 503 | ||
503 | void PlayListWidget::setDocument(const QString& fileref) { | 504 | void PlayListWidget::setDocument(const QString& fileref) { |
504 | fromSetDocument = true; | 505 | fromSetDocument = true; |
505 | d->setDocumentUsed = TRUE; | 506 | d->setDocumentUsed = TRUE; |
506 | setDocumentEx(fileref); | 507 | setDocumentEx(fileref); |
507 | } | 508 | } |
508 | 509 | ||
509 | void PlayListWidget::setDocumentEx(const QString& fileref) { | 510 | void PlayListWidget::setDocumentEx(const QString& fileref) { |
510 | qDebug("opieplayer receive "+fileref); | 511 | qDebug("opieplayer receive "+fileref); |
511 | clearList(); | 512 | clearList(); |
512 | DocLnk lnk; | 513 | DocLnk lnk; |
513 | QFileInfo fileInfo(fileref); | 514 | QFileInfo fileInfo(fileref); |
514 | if ( !fileInfo.exists() ) { | 515 | if ( !fileInfo.exists() ) { |
515 | QMessageBox::critical( 0, tr( "Invalid File" ), | 516 | QMessageBox::critical( 0, tr( "Invalid File" ), |
516 | tr( "There was a problem in getting the file." ) ); | 517 | tr( "There was a problem in getting the file." ) ); |
517 | return; | 518 | return; |
518 | } | 519 | } |
519 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); | 520 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); |
520 | QString extension = fileInfo.extension(false); | 521 | QString extension = fileInfo.extension(false); |
521 | if( extension.find( "m3u", 0, false) != -1) { //is m3u | 522 | if( extension.find( "m3u", 0, false) != -1) { //is m3u |
522 | readm3u( fileref); | 523 | readm3u( fileref); |
523 | } | 524 | } |
524 | else if( extension.find( "pls", 0, false) != -1 ) { //is pls | 525 | else if( extension.find( "pls", 0, false) != -1 ) { //is pls |
525 | readPls( fileref); | 526 | readPls( fileref); |
526 | } | 527 | } |
527 | else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist | 528 | else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist |
528 | clearList(); | 529 | clearList(); |
529 | lnk.setName( fileInfo.baseName() ); //sets name | 530 | lnk.setName( fileInfo.baseName() ); //sets name |
530 | lnk.setFile( fileref ); //sets file name | 531 | lnk.setFile( fileref ); //sets file name |
531 | lnk.setIcon("Sound"); | 532 | lnk.setIcon("Sound"); |
532 | //addToSelection( lnk ); | 533 | //addToSelection( lnk ); |
533 | 534 | ||
534 | loadList( lnk); | 535 | loadList( lnk); |
535 | d->selectedFiles->first(); | 536 | d->selectedFiles->first(); |
536 | } else { | 537 | } else { |
537 | if( fileref.find(".desktop",0,TRUE) != -1) { | 538 | if( fileref.find(".desktop",0,TRUE) != -1) { |