author | llornkcor <llornkcor> | 2004-03-16 11:04:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-03-16 11:04:20 (UTC) |
commit | 523022a20006312ac8573628b556d749dab3ec78 (patch) (unidiff) | |
tree | b407795a5e7e166bb6f28ede675d191802c80846 | |
parent | 2785830c856cb224b16e9a09cace2fbe3d76b466 (diff) | |
download | opie-523022a20006312ac8573628b556d749dab3ec78.zip opie-523022a20006312ac8573628b556d749dab3ec78.tar.gz opie-523022a20006312ac8573628b556d749dab3ec78.tar.bz2 |
fix ogg
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index efb5df3..3609f5d 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,261 +1,261 @@ | |||
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 | 22 | ||
23 | #include <qtoolbar.h> | 23 | #include <qtoolbar.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/lnkproperties.h> | 25 | #include <qpe/lnkproperties.h> |
26 | 26 | ||
27 | #include <qaction.h> | 27 | #include <qaction.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | 30 | ||
31 | //#include <qtimer.h> | 31 | //#include <qtimer.h> |
32 | 32 | ||
33 | #include "playlistselection.h" | 33 | #include "playlistselection.h" |
34 | #include "playlistwidget.h" | 34 | #include "playlistwidget.h" |
35 | #include "mediaplayerstate.h" | 35 | #include "mediaplayerstate.h" |
36 | 36 | ||
37 | #include "inputDialog.h" | 37 | #include "inputDialog.h" |
38 | 38 | ||
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | #include "audiowidget.h" | 40 | #include "audiowidget.h" |
41 | #include "videowidget.h" | 41 | #include "videowidget.h" |
42 | 42 | ||
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | #include <sys/file.h> | 44 | #include <sys/file.h> |
45 | #include <sys/ioctl.h> | 45 | #include <sys/ioctl.h> |
46 | #include <sys/soundcard.h> | 46 | #include <sys/soundcard.h> |
47 | 47 | ||
48 | // for setBacklight() | 48 | // for setBacklight() |
49 | #include <linux/fb.h> | 49 | #include <linux/fb.h> |
50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
51 | #include <sys/stat.h> | 51 | #include <sys/stat.h> |
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | 53 | ||
54 | #define BUTTONS_ON_TOOLBAR | 54 | #define BUTTONS_ON_TOOLBAR |
55 | #define SIDE_BUTTONS | 55 | #define SIDE_BUTTONS |
56 | #define CAN_SAVE_LOAD_PLAYLISTS | 56 | #define CAN_SAVE_LOAD_PLAYLISTS |
57 | 57 | ||
58 | extern AudioWidget *audioUI; | 58 | extern AudioWidget *audioUI; |
59 | extern VideoWidget *videoUI; | 59 | extern VideoWidget *videoUI; |
60 | extern MediaPlayerState *mediaPlayerState; | 60 | extern MediaPlayerState *mediaPlayerState; |
61 | 61 | ||
62 | static inline QString fullBaseName ( const QFileInfo &fi ) | 62 | static inline QString fullBaseName ( const QFileInfo &fi ) |
63 | { | 63 | { |
64 | QString str = fi. fileName ( ); | 64 | QString str = fi. fileName ( ); |
65 | return str. left ( str. findRev ( '.' )); | 65 | return str. left ( str. findRev ( '.' )); |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod"; | 69 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod"; |
70 | // class myFileSelector { | 70 | // class myFileSelector { |
71 | 71 | ||
72 | // }; | 72 | // }; |
73 | class PlayListWidgetPrivate { | 73 | class PlayListWidgetPrivate { |
74 | public: | 74 | public: |
75 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 75 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
76 | QFrame *playListFrame; | 76 | QFrame *playListFrame; |
77 | FileSelector *files; | 77 | FileSelector *files; |
78 | PlayListSelection *selectedFiles; | 78 | PlayListSelection *selectedFiles; |
79 | bool setDocumentUsed; | 79 | bool setDocumentUsed; |
80 | DocLnk *current; | 80 | DocLnk *current; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | 83 | ||
84 | class ToolButton : public QToolButton { | 84 | class ToolButton : public QToolButton { |
85 | public: | 85 | public: |
86 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 86 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
87 | : QToolButton( parent, name ) { | 87 | : QToolButton( parent, name ) { |
88 | setTextLabel( name ); | 88 | setTextLabel( name ); |
89 | setPixmap( Resource::loadPixmap( icon ) ); | 89 | setPixmap( Resource::loadPixmap( icon ) ); |
90 | setAutoRaise( TRUE ); | 90 | setAutoRaise( TRUE ); |
91 | setFocusPolicy( QWidget::NoFocus ); | 91 | setFocusPolicy( QWidget::NoFocus ); |
92 | setToggleButton( t ); | 92 | setToggleButton( t ); |
93 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 93 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
94 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 94 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
95 | } | 95 | } |
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
99 | class MenuItem : public QAction { | 99 | class MenuItem : public QAction { |
100 | public: | 100 | public: |
101 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 101 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
102 | : QAction( text, QString::null, 0, 0 ) { | 102 | : QAction( text, QString::null, 0, 0 ) { |
103 | connect( this, SIGNAL( activated() ), handler, slot ); | 103 | connect( this, SIGNAL( activated() ), handler, slot ); |
104 | addTo( parent ); | 104 | addTo( parent ); |
105 | } | 105 | } |
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 109 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
110 | : QMainWindow( parent, name, fl ) { | 110 | : QMainWindow( parent, name, fl ) { |
111 | 111 | ||
112 | d = new PlayListWidgetPrivate; | 112 | d = new PlayListWidgetPrivate; |
113 | d->setDocumentUsed = FALSE; | 113 | d->setDocumentUsed = FALSE; |
114 | d->current = NULL; | 114 | d->current = NULL; |
115 | fromSetDocument = FALSE; | 115 | fromSetDocument = FALSE; |
116 | insanityBool=FALSE; | 116 | insanityBool=FALSE; |
117 | audioScan = FALSE; | 117 | audioScan = FALSE; |
118 | videoScan = FALSE; | 118 | videoScan = FALSE; |
119 | // menuTimer = new QTimer( this ,"menu timer"), | 119 | // menuTimer = new QTimer( this ,"menu timer"), |
120 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 120 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
121 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); | 121 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); |
122 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 122 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
123 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); | 123 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); |
124 | 124 | ||
125 | setBackgroundMode( PaletteButton ); | 125 | setBackgroundMode( PaletteButton ); |
126 | 126 | ||
127 | setCaption( tr("OpiePlayer") ); | 127 | setCaption( tr("OpiePlayer") ); |
128 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 128 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); |
129 | 129 | ||
130 | setToolBarsMovable( FALSE ); | 130 | setToolBarsMovable( FALSE ); |
131 | 131 | ||
132 | // Create Toolbar | 132 | // Create Toolbar |
133 | QToolBar *toolbar = new QToolBar( this ); | 133 | QToolBar *toolbar = new QToolBar( this ); |
134 | toolbar->setHorizontalStretchable( TRUE ); | 134 | toolbar->setHorizontalStretchable( TRUE ); |
135 | 135 | ||
136 | // Create Menubar | 136 | // Create Menubar |
137 | QMenuBar *menu = new QMenuBar( toolbar ); | 137 | QMenuBar *menu = new QMenuBar( toolbar ); |
138 | menu->setMargin( 0 ); | 138 | menu->setMargin( 0 ); |
139 | 139 | ||
140 | QToolBar *bar = new QToolBar( this ); | 140 | QToolBar *bar = new QToolBar( this ); |
141 | bar->setLabel( tr( "Play Operations" ) ); | 141 | bar->setLabel( tr( "Play Operations" ) ); |
142 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 142 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
143 | // this , SLOT( addSelected()) ); | 143 | // this , SLOT( addSelected()) ); |
144 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 144 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
145 | tbDeletePlaylist->setFlat(TRUE); | 145 | tbDeletePlaylist->setFlat(TRUE); |
146 | 146 | ||
147 | tbDeletePlaylist->setFixedSize(20,20); | 147 | tbDeletePlaylist->setFixedSize(20,20); |
148 | 148 | ||
149 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 149 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
150 | this , SLOT(addSelected()) ); | 150 | this , SLOT(addSelected()) ); |
151 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 151 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
152 | this , SLOT(removeSelected()) ); | 152 | this , SLOT(removeSelected()) ); |
153 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); | 153 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); |
154 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 154 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
155 | this , SLOT( btnPlay(bool) ), TRUE ); | 155 | this , SLOT( btnPlay(bool) ), TRUE ); |
156 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 156 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
157 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 157 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
158 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 158 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
159 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 159 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
160 | tbDeletePlaylist->hide(); | 160 | tbDeletePlaylist->hide(); |
161 | 161 | ||
162 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 162 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
163 | menu->insertItem( tr( "File" ), pmPlayList ); | 163 | menu->insertItem( tr( "File" ), pmPlayList ); |
164 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 164 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
165 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 165 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
166 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 166 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
167 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 167 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
168 | pmPlayList->insertSeparator(-1); | 168 | pmPlayList->insertSeparator(-1); |
169 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 169 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
170 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 170 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
171 | pmPlayList->insertSeparator(-1); | 171 | pmPlayList->insertSeparator(-1); |
172 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 172 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
173 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 173 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
174 | 174 | ||
175 | QPopupMenu *pmView = new QPopupMenu( this ); | 175 | QPopupMenu *pmView = new QPopupMenu( this ); |
176 | menu->insertItem( tr( "View" ), pmView ); | 176 | menu->insertItem( tr( "View" ), pmView ); |
177 | 177 | ||
178 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 178 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
179 | fullScreenButton->addTo(pmView); | 179 | fullScreenButton->addTo(pmView); |
180 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 180 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
181 | scaleButton->addTo(pmView); | 181 | scaleButton->addTo(pmView); |
182 | 182 | ||
183 | 183 | ||
184 | skinsMenu = new QPopupMenu( this ); | 184 | skinsMenu = new QPopupMenu( this ); |
185 | menu->insertItem( tr( "Skins" ), skinsMenu ); | 185 | menu->insertItem( tr( "Skins" ), skinsMenu ); |
186 | skinsMenu->isCheckable(); | 186 | skinsMenu->isCheckable(); |
187 | connect( skinsMenu, SIGNAL( activated(int) ) , | 187 | connect( skinsMenu, SIGNAL( activated(int) ) , |
188 | this, SLOT( skinsMenuActivated(int) ) ); | 188 | this, SLOT( skinsMenuActivated(int) ) ); |
189 | populateSkinsMenu(); | 189 | populateSkinsMenu(); |
190 | 190 | ||
191 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 191 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
192 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 192 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
193 | 193 | ||
194 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 194 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
195 | 195 | ||
196 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 196 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
197 | // tabWidget->setTabShape(QTabWidget::Triangular); | 197 | // tabWidget->setTabShape(QTabWidget::Triangular); |
198 | 198 | ||
199 | QWidget *pTab; | 199 | QWidget *pTab; |
200 | pTab = new QWidget( tabWidget, "pTab" ); | 200 | pTab = new QWidget( tabWidget, "pTab" ); |
201 | // playlistView = new QListView( pTab, "playlistview" ); | 201 | // playlistView = new QListView( pTab, "playlistview" ); |
202 | // playlistView->setMinimumSize(236,260); | 202 | // playlistView->setMinimumSize(236,260); |
203 | tabWidget->insertTab( pTab,"Playlist"); | 203 | tabWidget->insertTab( pTab,"Playlist"); |
204 | 204 | ||
205 | 205 | ||
206 | // Add the playlist area | 206 | // Add the playlist area |
207 | 207 | ||
208 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 208 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
209 | d->playListFrame = vbox3; | 209 | d->playListFrame = vbox3; |
210 | 210 | ||
211 | QGridLayout *layoutF = new QGridLayout( pTab ); | 211 | QGridLayout *layoutF = new QGridLayout( pTab ); |
212 | layoutF->setSpacing( 2); | 212 | layoutF->setSpacing( 2); |
213 | layoutF->setMargin( 2); | 213 | layoutF->setMargin( 2); |
214 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); | 214 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); |
215 | 215 | ||
216 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 216 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
217 | 217 | ||
218 | d->selectedFiles = new PlayListSelection( hbox2); | 218 | d->selectedFiles = new PlayListSelection( hbox2); |
219 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 219 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
220 | 220 | ||
221 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 221 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
222 | 222 | ||
223 | 223 | ||
224 | 224 | ||
225 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 225 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
226 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 226 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
227 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 227 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
228 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 228 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
229 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 229 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
230 | 230 | ||
231 | QWidget *aTab; | 231 | QWidget *aTab; |
232 | aTab = new QWidget( tabWidget, "aTab" ); | 232 | aTab = new QWidget( tabWidget, "aTab" ); |
233 | audioView = new QListView( aTab, "Audioview" ); | 233 | audioView = new QListView( aTab, "Audioview" ); |
234 | 234 | ||
235 | QGridLayout *layoutA = new QGridLayout( aTab ); | 235 | QGridLayout *layoutA = new QGridLayout( aTab ); |
236 | layoutA->setSpacing( 2); | 236 | layoutA->setSpacing( 2); |
237 | layoutA->setMargin( 2); | 237 | layoutA->setMargin( 2); |
238 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 238 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
239 | 239 | ||
240 | audioView->addColumn( tr("Title"),-1); | 240 | audioView->addColumn( tr("Title"),-1); |
241 | audioView->addColumn(tr("Size"), -1); | 241 | audioView->addColumn(tr("Size"), -1); |
242 | audioView->addColumn(tr("Media"),-1); | 242 | audioView->addColumn(tr("Media"),-1); |
243 | audioView->addColumn( tr( "Path" ), -1 ); | 243 | audioView->addColumn( tr( "Path" ), -1 ); |
244 | 244 | ||
245 | audioView->setColumnAlignment(1, Qt::AlignRight); | 245 | audioView->setColumnAlignment(1, Qt::AlignRight); |
246 | audioView->setColumnAlignment(2, Qt::AlignRight); | 246 | audioView->setColumnAlignment(2, Qt::AlignRight); |
247 | audioView->setAllColumnsShowFocus(TRUE); | 247 | audioView->setAllColumnsShowFocus(TRUE); |
248 | 248 | ||
249 | audioView->setMultiSelection( TRUE ); | 249 | audioView->setMultiSelection( TRUE ); |
250 | audioView->setSelectionMode( QListView::Extended); | 250 | audioView->setSelectionMode( QListView::Extended); |
251 | audioView->setSorting( 3, TRUE ); | 251 | audioView->setSorting( 3, TRUE ); |
252 | 252 | ||
253 | tabWidget->insertTab(aTab,tr("Audio")); | 253 | tabWidget->insertTab(aTab,tr("Audio")); |
254 | 254 | ||
255 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 255 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
256 | 256 | ||
257 | // audioView | 257 | // audioView |
258 | // populateAudioView(); | 258 | // populateAudioView(); |
259 | // videowidget | 259 | // videowidget |
260 | 260 | ||
261 | QWidget *vTab; | 261 | QWidget *vTab; |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 1a5e474..4460833 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -476,385 +476,385 @@ void PlayListWidget::playIt( QListViewItem *it) { | |||
476 | mediaPlayerState->setPlaying(TRUE); | 476 | mediaPlayerState->setPlaying(TRUE); |
477 | d->selectedFiles->unSelect(); | 477 | d->selectedFiles->unSelect(); |
478 | } | 478 | } |
479 | 479 | ||
480 | 480 | ||
481 | void PlayListWidget::addToSelection( QListViewItem *it) { | 481 | void PlayListWidget::addToSelection( QListViewItem *it) { |
482 | d->setDocumentUsed = FALSE; | 482 | d->setDocumentUsed = FALSE; |
483 | 483 | ||
484 | if(it) { | 484 | if(it) { |
485 | if ( currentTab() == CurrentPlayList ) | 485 | if ( currentTab() == CurrentPlayList ) |
486 | return; | 486 | return; |
487 | DocLnk lnk; | 487 | DocLnk lnk; |
488 | QString filename; | 488 | QString filename; |
489 | 489 | ||
490 | filename=it->text(3); | 490 | filename=it->text(3); |
491 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 491 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
492 | lnk.setFile( filename ); //sets file name | 492 | lnk.setFile( filename ); //sets file name |
493 | d->selectedFiles->addToSelection( lnk); | 493 | d->selectedFiles->addToSelection( lnk); |
494 | 494 | ||
495 | writeCurrentM3u(); | 495 | writeCurrentM3u(); |
496 | // tabWidget->setCurrentPage(0); | 496 | // tabWidget->setCurrentPage(0); |
497 | 497 | ||
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
501 | 501 | ||
502 | void PlayListWidget::tabChanged(QWidget *) { | 502 | void PlayListWidget::tabChanged(QWidget *) { |
503 | 503 | ||
504 | d->tbPlay->setEnabled( true ); | 504 | d->tbPlay->setEnabled( true ); |
505 | 505 | ||
506 | disconnect( audioView, SIGNAL( itemsSelected(bool) ), | 506 | disconnect( audioView, SIGNAL( itemsSelected(bool) ), |
507 | d->tbPlay, SLOT( setEnabled(bool) ) ); | 507 | d->tbPlay, SLOT( setEnabled(bool) ) ); |
508 | disconnect( videoView, SIGNAL( itemsSelected(bool) ), | 508 | disconnect( videoView, SIGNAL( itemsSelected(bool) ), |
509 | d->tbPlay, SLOT( setEnabled(bool) ) ); | 509 | d->tbPlay, SLOT( setEnabled(bool) ) ); |
510 | 510 | ||
511 | currentFileListView = 0; | 511 | currentFileListView = 0; |
512 | 512 | ||
513 | switch ( currentTab() ) { | 513 | switch ( currentTab() ) { |
514 | case CurrentPlayList: | 514 | case CurrentPlayList: |
515 | { | 515 | { |
516 | if( !tbDeletePlaylist->isHidden() ) { | 516 | if( !tbDeletePlaylist->isHidden() ) { |
517 | tbDeletePlaylist->hide(); | 517 | tbDeletePlaylist->hide(); |
518 | } | 518 | } |
519 | d->tbRemoveFromList->setEnabled(TRUE); | 519 | d->tbRemoveFromList->setEnabled(TRUE); |
520 | d->tbAddToList->setEnabled(FALSE); | 520 | d->tbAddToList->setEnabled(FALSE); |
521 | 521 | ||
522 | d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); | 522 | d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); |
523 | } | 523 | } |
524 | break; | 524 | break; |
525 | case AudioFiles: | 525 | case AudioFiles: |
526 | { | 526 | { |
527 | audioView->populateView(); | 527 | audioView->populateView(); |
528 | 528 | ||
529 | if( !tbDeletePlaylist->isHidden() ) { | 529 | if( !tbDeletePlaylist->isHidden() ) { |
530 | tbDeletePlaylist->hide(); | 530 | tbDeletePlaylist->hide(); |
531 | } | 531 | } |
532 | d->tbRemoveFromList->setEnabled(FALSE); | 532 | d->tbRemoveFromList->setEnabled(FALSE); |
533 | d->tbAddToList->setEnabled(TRUE); | 533 | d->tbAddToList->setEnabled(TRUE); |
534 | 534 | ||
535 | connect( audioView, SIGNAL( itemsSelected(bool) ), | 535 | connect( audioView, SIGNAL( itemsSelected(bool) ), |
536 | d->tbPlay, SLOT( setEnabled(bool) ) ); | 536 | d->tbPlay, SLOT( setEnabled(bool) ) ); |
537 | 537 | ||
538 | d->tbPlay->setEnabled( audioView->hasSelection() ); | 538 | d->tbPlay->setEnabled( audioView->hasSelection() ); |
539 | 539 | ||
540 | currentFileListView = audioView; | 540 | currentFileListView = audioView; |
541 | } | 541 | } |
542 | break; | 542 | break; |
543 | case VideoFiles: | 543 | case VideoFiles: |
544 | { | 544 | { |
545 | videoView->populateView(); | 545 | videoView->populateView(); |
546 | if( !tbDeletePlaylist->isHidden() ) { | 546 | if( !tbDeletePlaylist->isHidden() ) { |
547 | tbDeletePlaylist->hide(); | 547 | tbDeletePlaylist->hide(); |
548 | } | 548 | } |
549 | d->tbRemoveFromList->setEnabled(FALSE); | 549 | d->tbRemoveFromList->setEnabled(FALSE); |
550 | d->tbAddToList->setEnabled(TRUE); | 550 | d->tbAddToList->setEnabled(TRUE); |
551 | 551 | ||
552 | connect( videoView, SIGNAL( itemsSelected(bool) ), | 552 | connect( videoView, SIGNAL( itemsSelected(bool) ), |
553 | d->tbPlay, SLOT( setEnabled(bool) ) ); | 553 | d->tbPlay, SLOT( setEnabled(bool) ) ); |
554 | 554 | ||
555 | d->tbPlay->setEnabled( videoView->hasSelection() ); | 555 | d->tbPlay->setEnabled( videoView->hasSelection() ); |
556 | 556 | ||
557 | currentFileListView = videoView; | 557 | currentFileListView = videoView; |
558 | } | 558 | } |
559 | break; | 559 | break; |
560 | case PlayLists: | 560 | case PlayLists: |
561 | { | 561 | { |
562 | if( tbDeletePlaylist->isHidden() ) { | 562 | if( tbDeletePlaylist->isHidden() ) { |
563 | tbDeletePlaylist->show(); | 563 | tbDeletePlaylist->show(); |
564 | } | 564 | } |
565 | playLists->reread(); | 565 | playLists->reread(); |
566 | d->tbAddToList->setEnabled(FALSE); | 566 | d->tbAddToList->setEnabled(FALSE); |
567 | 567 | ||
568 | d->tbPlay->setEnabled( false ); | 568 | d->tbPlay->setEnabled( false ); |
569 | } | 569 | } |
570 | break; | 570 | break; |
571 | }; | 571 | }; |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | void PlayListWidget::btnPlay(bool b) { | 575 | void PlayListWidget::btnPlay(bool b) { |
576 | // mediaPlayerState->setPlaying(false); | 576 | // mediaPlayerState->setPlaying(false); |
577 | mediaPlayerState->setPlaying(b); | 577 | mediaPlayerState->setPlaying(b); |
578 | insanityBool=FALSE; | 578 | insanityBool=FALSE; |
579 | } | 579 | } |
580 | 580 | ||
581 | void PlayListWidget::deletePlaylist() { | 581 | void PlayListWidget::deletePlaylist() { |
582 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 582 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
583 | (tr("You really want to delete\nthis playlist?")), | 583 | (tr("You really want to delete\nthis playlist?")), |
584 | (tr("Yes")), (tr("No")), 0 )){ | 584 | (tr("Yes")), (tr("No")), 0 )){ |
585 | case 0: // Yes clicked, | 585 | case 0: // Yes clicked, |
586 | QFile().remove(playLists->selectedDocument().file()); | 586 | QFile().remove(playLists->selectedDocument().file()); |
587 | QFile().remove(playLists->selectedDocument().linkFile()); | 587 | QFile().remove(playLists->selectedDocument().linkFile()); |
588 | playLists->reread(); | 588 | playLists->reread(); |
589 | break; | 589 | break; |
590 | case 1: // Cancel | 590 | case 1: // Cancel |
591 | break; | 591 | break; |
592 | }; | 592 | }; |
593 | } | 593 | } |
594 | 594 | ||
595 | 595 | ||
596 | void PlayListWidget::playSelected() { | 596 | void PlayListWidget::playSelected() { |
597 | btnPlay( TRUE); | 597 | btnPlay( TRUE); |
598 | } | 598 | } |
599 | 599 | ||
600 | bool PlayListWidget::inFileListMode() const | 600 | bool PlayListWidget::inFileListMode() const |
601 | { | 601 | { |
602 | TabType tab = currentTab(); | 602 | TabType tab = currentTab(); |
603 | return tab == AudioFiles || tab == VideoFiles; | 603 | return tab == AudioFiles || tab == VideoFiles; |
604 | } | 604 | } |
605 | 605 | ||
606 | void PlayListWidget::openURL() { | 606 | void PlayListWidget::openURL() { |
607 | // http://66.28.164.33:2080 | 607 | // http://66.28.164.33:2080 |
608 | // http://somafm.com/star0242.m3u | 608 | // http://somafm.com/star0242.m3u |
609 | QString filename, name; | 609 | QString filename, name; |
610 | InputDialog *fileDlg; | 610 | InputDialog *fileDlg; |
611 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); | 611 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); |
612 | fileDlg->exec(); | 612 | fileDlg->exec(); |
613 | if( fileDlg->result() == 1 ) { | 613 | if( fileDlg->result() == 1 ) { |
614 | filename = fileDlg->text(); | 614 | filename = fileDlg->text(); |
615 | qDebug( "Selected filename is " + filename ); | 615 | qDebug( "Selected filename is " + filename ); |
616 | // Om3u *m3uList; | 616 | // Om3u *m3uList; |
617 | DocLnk lnk; | 617 | DocLnk lnk; |
618 | Config cfg( "OpiePlayer" ); | 618 | Config cfg( "OpiePlayer" ); |
619 | cfg.setGroup("PlayList"); | 619 | cfg.setGroup("PlayList"); |
620 | 620 | ||
621 | if(filename.left(4) == "http") { | 621 | if(filename.left(4) == "http") { |
622 | QString m3uFile, m3uFilePath; | 622 | QString m3uFile, m3uFilePath; |
623 | if(filename.find(":",8,TRUE) != -1) { //found a port | 623 | if(filename.find(":",8,TRUE) != -1) { //found a port |
624 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 624 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
625 | m3uFile = m3uFile.right( 7); | 625 | m3uFile = m3uFile.right( 7); |
626 | } else if(filename.left(4) == "http"){ | 626 | } else if(filename.left(4) == "http"){ |
627 | m3uFile=filename; | 627 | m3uFile=filename; |
628 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 628 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
629 | } else{ | 629 | } else{ |
630 | m3uFile=filename; | 630 | m3uFile=filename; |
631 | } | 631 | } |
632 | 632 | ||
633 | lnk.setName( filename ); //sets name | 633 | lnk.setName( filename ); //sets name |
634 | lnk.setFile( filename ); //sets file name | 634 | lnk.setFile( filename ); //sets file name |
635 | 635 | ||
636 | // lnk.setIcon("opieplayer2/musicfile"); | 636 | // lnk.setIcon("opieplayer2/musicfile"); |
637 | 637 | ||
638 | d->selectedFiles->addToSelection( lnk ); | 638 | d->selectedFiles->addToSelection( lnk ); |
639 | writeCurrentM3u(); | 639 | writeCurrentM3u(); |
640 | d->selectedFiles->setSelectedItem( lnk.name()); | 640 | d->selectedFiles->setSelectedItem( lnk.name()); |
641 | } | 641 | } |
642 | else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { | 642 | else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { |
643 | readListFromFile( filename ); | 643 | readListFromFile( filename ); |
644 | } else { | 644 | } else { |
645 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 645 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
646 | lnk.setFile( filename ); //sets file name | 646 | lnk.setFile( filename ); //sets file name |
647 | d->selectedFiles->addToSelection( lnk); | 647 | d->selectedFiles->addToSelection( lnk); |
648 | writeCurrentM3u(); | 648 | writeCurrentM3u(); |
649 | d->selectedFiles->setSelectedItem( lnk.name()); | 649 | d->selectedFiles->setSelectedItem( lnk.name()); |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
653 | 653 | ||
654 | delete fileDlg; | 654 | delete fileDlg; |
655 | } | 655 | } |
656 | 656 | ||
657 | 657 | ||
658 | void PlayListWidget::openFile() { | 658 | void PlayListWidget::openFile() { |
659 | 659 | ||
660 | QString filename, name; | 660 | QString filename, name; |
661 | 661 | ||
662 | Config cfg( "OpiePlayer" ); | 662 | Config cfg( "OpiePlayer" ); |
663 | cfg.setGroup("Dialog"); | 663 | cfg.setGroup("Dialog"); |
664 | MimeTypes types; | 664 | MimeTypes types; |
665 | QStringList audio, video, all; | 665 | QStringList audio, video, all; |
666 | audio << "audio/*"; | 666 | audio << "audio/*"; |
667 | audio << "playlist/plain"; | 667 | audio << "playlist/plain"; |
668 | audio << "application/ogg"; | 668 | audio << "audio/x-ogg"; |
669 | audio << "audio/x-mpegurl"; | 669 | audio << "audio/x-mpegurl"; |
670 | 670 | ||
671 | video << "video/*"; | 671 | video << "video/*"; |
672 | video << "playlist/plain"; | 672 | video << "playlist/plain"; |
673 | 673 | ||
674 | all += audio; | 674 | all += audio; |
675 | all += video; | 675 | all += video; |
676 | types.insert("All Media Files", all ); | 676 | types.insert("All Media Files", all ); |
677 | types.insert("Audio", audio ); | 677 | types.insert("Audio", audio ); |
678 | types.insert("Video", video ); | 678 | types.insert("Video", video ); |
679 | 679 | ||
680 | QString str = OFileDialog::getOpenFileName( 1, | 680 | QString str = OFileDialog::getOpenFileName( 1, |
681 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | 681 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", |
682 | types, 0 ); | 682 | types, 0 ); |
683 | 683 | ||
684 | if(str.left(2) == "//") { | 684 | if(str.left(2) == "//") { |
685 | str=str.right(str.length()-1); | 685 | str=str.right(str.length()-1); |
686 | } | 686 | } |
687 | cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); | 687 | cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); |
688 | 688 | ||
689 | if( !str.isEmpty() ) { | 689 | if( !str.isEmpty() ) { |
690 | 690 | ||
691 | qDebug( "Selected filename is " + str ); | 691 | qDebug( "Selected filename is " + str ); |
692 | filename = str; | 692 | filename = str; |
693 | DocLnk lnk; | 693 | DocLnk lnk; |
694 | 694 | ||
695 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { | 695 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { |
696 | readListFromFile( filename ); | 696 | readListFromFile( filename ); |
697 | } else { | 697 | } else { |
698 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 698 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
699 | lnk.setFile( filename ); //sets file name | 699 | lnk.setFile( filename ); //sets file name |
700 | d->selectedFiles->addToSelection( lnk ); | 700 | d->selectedFiles->addToSelection( lnk ); |
701 | writeCurrentM3u(); | 701 | writeCurrentM3u(); |
702 | d->selectedFiles->setSelectedItem( lnk.name() ); | 702 | d->selectedFiles->setSelectedItem( lnk.name() ); |
703 | } | 703 | } |
704 | } | 704 | } |
705 | } | 705 | } |
706 | 706 | ||
707 | 707 | ||
708 | void PlayListWidget::readListFromFile( const QString &filename ) { | 708 | void PlayListWidget::readListFromFile( const QString &filename ) { |
709 | qDebug( "read list filename " + filename ); | 709 | qDebug( "read list filename " + filename ); |
710 | QFileInfo fi(filename); | 710 | QFileInfo fi(filename); |
711 | Om3u *m3uList; | 711 | Om3u *m3uList; |
712 | QString s, name; | 712 | QString s, name; |
713 | m3uList = new Om3u( filename, IO_ReadOnly ); | 713 | m3uList = new Om3u( filename, IO_ReadOnly ); |
714 | if(fi.extension(false).find("m3u",0,false) != -1 ) | 714 | if(fi.extension(false).find("m3u",0,false) != -1 ) |
715 | m3uList->readM3u(); | 715 | m3uList->readM3u(); |
716 | else if(fi.extension(false).find("pls",0,false) != -1 ) | 716 | else if(fi.extension(false).find("pls",0,false) != -1 ) |
717 | m3uList->readPls(); | 717 | m3uList->readPls(); |
718 | 718 | ||
719 | DocLnk lnk; | 719 | DocLnk lnk; |
720 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 720 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
721 | s = *it; | 721 | s = *it; |
722 | // qDebug(s); | 722 | // qDebug(s); |
723 | if(s.left(4)=="http") { | 723 | if(s.left(4)=="http") { |
724 | lnk.setName( s ); //sets file name | 724 | lnk.setName( s ); //sets file name |
725 | lnk.setIcon("opieplayer2/musicfile"); | 725 | lnk.setIcon("opieplayer2/musicfile"); |
726 | lnk.setFile( s ); //sets file name | 726 | lnk.setFile( s ); //sets file name |
727 | 727 | ||
728 | } else { //is file | 728 | } else { //is file |
729 | lnk.setName( QFileInfo(s).baseName()); | 729 | lnk.setName( QFileInfo(s).baseName()); |
730 | if(s.left(1) != "/") { | 730 | if(s.left(1) != "/") { |
731 | 731 | ||
732 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 732 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
733 | } else { | 733 | } else { |
734 | lnk.setFile( s); | 734 | lnk.setFile( s); |
735 | } | 735 | } |
736 | } | 736 | } |
737 | d->selectedFiles->addToSelection( lnk ); | 737 | d->selectedFiles->addToSelection( lnk ); |
738 | } | 738 | } |
739 | Config config( "OpiePlayer" ); | 739 | Config config( "OpiePlayer" ); |
740 | config.setGroup( "PlayList" ); | 740 | config.setGroup( "PlayList" ); |
741 | 741 | ||
742 | config.writeEntry("CurrentPlaylist",filename); | 742 | config.writeEntry("CurrentPlaylist",filename); |
743 | config.write(); | 743 | config.write(); |
744 | currentPlayList=filename; | 744 | currentPlayList=filename; |
745 | 745 | ||
746 | m3uList->close(); | 746 | m3uList->close(); |
747 | delete m3uList; | 747 | delete m3uList; |
748 | 748 | ||
749 | d->selectedFiles->setSelectedItem( s); | 749 | d->selectedFiles->setSelectedItem( s); |
750 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 750 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
751 | 751 | ||
752 | } | 752 | } |
753 | 753 | ||
754 | // writes current playlist to current m3u file */ | 754 | // writes current playlist to current m3u file */ |
755 | void PlayListWidget::writeCurrentM3u() { | 755 | void PlayListWidget::writeCurrentM3u() { |
756 | qDebug("writing to current m3u"); | 756 | qDebug("writing to current m3u"); |
757 | Config cfg( "OpiePlayer" ); | 757 | Config cfg( "OpiePlayer" ); |
758 | cfg.setGroup("PlayList"); | 758 | cfg.setGroup("PlayList"); |
759 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 759 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
760 | 760 | ||
761 | Om3u *m3uList; | 761 | Om3u *m3uList; |
762 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 762 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
763 | if( d->selectedFiles->first()) { | 763 | if( d->selectedFiles->first()) { |
764 | 764 | ||
765 | do { | 765 | do { |
766 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 766 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
767 | m3uList->add( d->selectedFiles->current()->file() ); | 767 | m3uList->add( d->selectedFiles->current()->file() ); |
768 | } | 768 | } |
769 | while ( d->selectedFiles->next() ); | 769 | while ( d->selectedFiles->next() ); |
770 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 770 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
771 | m3uList->write(); | 771 | m3uList->write(); |
772 | m3uList->close(); | 772 | m3uList->close(); |
773 | } | 773 | } |
774 | delete m3uList; | 774 | delete m3uList; |
775 | 775 | ||
776 | } | 776 | } |
777 | 777 | ||
778 | /* | 778 | /* |
779 | writes current playlist to m3u file */ | 779 | writes current playlist to m3u file */ |
780 | void PlayListWidget::writem3u() { | 780 | void PlayListWidget::writem3u() { |
781 | //InputDilog *fileDlg; | 781 | //InputDilog *fileDlg; |
782 | //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 782 | //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
783 | //fileDlg->exec(); | 783 | //fileDlg->exec(); |
784 | 784 | ||
785 | Config cfg( "OpiePlayer" ); | 785 | Config cfg( "OpiePlayer" ); |
786 | cfg.setGroup("Dialog"); | 786 | cfg.setGroup("Dialog"); |
787 | MimeTypes types; | 787 | MimeTypes types; |
788 | QStringList audio, video, all; | 788 | QStringList audio, video, all; |
789 | audio << "audio/*"; | 789 | audio << "audio/*"; |
790 | audio << "playlist/plain"; | 790 | audio << "playlist/plain"; |
791 | audio << "audio/x-mpegurl"; | 791 | audio << "audio/x-mpegurl"; |
792 | 792 | ||
793 | video << "video/*"; | 793 | video << "video/*"; |
794 | video << "playlist/plain"; | 794 | video << "playlist/plain"; |
795 | 795 | ||
796 | all += audio; | 796 | all += audio; |
797 | all += video; | 797 | all += video; |
798 | types.insert("All Media Files", all ); | 798 | types.insert("All Media Files", all ); |
799 | types.insert("Audio", audio ); | 799 | types.insert("Audio", audio ); |
800 | types.insert("Video", video ); | 800 | types.insert("Video", video ); |
801 | 801 | ||
802 | QString str = OFileDialog::getOpenFileName( 1, | 802 | QString str = OFileDialog::getOpenFileName( 1, |
803 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | 803 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", |
804 | types, 0 ); | 804 | types, 0 ); |
805 | if(str.left(2) == "//") str=str.right(str.length()-1); | 805 | if(str.left(2) == "//") str=str.right(str.length()-1); |
806 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); | 806 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); |
807 | 807 | ||
808 | 808 | ||
809 | QString name, filename, list; | 809 | QString name, filename, list; |
810 | Om3u *m3uList; | 810 | Om3u *m3uList; |
811 | 811 | ||
812 | if( !str.isEmpty() ) { | 812 | if( !str.isEmpty() ) { |
813 | name = str; | 813 | name = str; |
814 | // name = fileDlg->text(); | 814 | // name = fileDlg->text(); |
815 | // qDebug( filename ); | 815 | // qDebug( filename ); |
816 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 816 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
817 | filename = name; | 817 | filename = name; |
818 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 818 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
819 | } | 819 | } |
820 | else //otherwise dump it somewhere noticable | 820 | else //otherwise dump it somewhere noticable |
821 | filename = QPEApplication::documentDir() + "/" + name; | 821 | filename = QPEApplication::documentDir() + "/" + name; |
822 | 822 | ||
823 | if( filename.right( 3 ) != "m3u" ) //needs filename extension | 823 | if( filename.right( 3 ) != "m3u" ) //needs filename extension |
824 | filename += ".m3u"; | 824 | filename += ".m3u"; |
825 | 825 | ||
826 | if( d->selectedFiles->first()) { //ramble through playlist view | 826 | if( d->selectedFiles->first()) { //ramble through playlist view |
827 | m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); | 827 | m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); |
828 | 828 | ||
829 | do { | 829 | do { |
830 | m3uList->add( d->selectedFiles->current()->file()); | 830 | m3uList->add( d->selectedFiles->current()->file()); |
831 | } | 831 | } |
832 | while ( d->selectedFiles->next() ); | 832 | while ( d->selectedFiles->next() ); |
833 | // qDebug( list ); | 833 | // qDebug( list ); |
834 | m3uList->write(); | 834 | m3uList->write(); |
835 | m3uList->close(); | 835 | m3uList->close(); |
836 | delete m3uList; | 836 | delete m3uList; |
837 | 837 | ||
838 | //delete fileDlg; | 838 | //delete fileDlg; |
839 | 839 | ||
840 | DocLnk lnk; | 840 | DocLnk lnk; |
841 | lnk.setFile( filename); | 841 | lnk.setFile( filename); |
842 | lnk.setIcon("opieplayer2/playlist2"); | 842 | lnk.setIcon("opieplayer2/playlist2"); |
843 | lnk.setName( name); //sets file name | 843 | lnk.setName( name); //sets file name |
844 | 844 | ||
845 | // qDebug(filename); | 845 | // qDebug(filename); |
846 | Config config( "OpiePlayer" ); | 846 | Config config( "OpiePlayer" ); |
847 | config.setGroup( "PlayList" ); | 847 | config.setGroup( "PlayList" ); |
848 | 848 | ||
849 | config.writeEntry("CurrentPlaylist",filename); | 849 | config.writeEntry("CurrentPlaylist",filename); |
850 | currentPlayList=filename; | 850 | currentPlayList=filename; |
851 | 851 | ||
852 | if(!lnk.writeLink()) { | 852 | if(!lnk.writeLink()) { |
853 | qDebug("Writing doclink did not work"); | 853 | qDebug("Writing doclink did not work"); |
854 | } | 854 | } |
855 | 855 | ||
856 | setCaption(tr("OpiePlayer: ") + name); | 856 | setCaption(tr("OpiePlayer: ") + name); |
857 | } | 857 | } |
858 | } | 858 | } |
859 | } | 859 | } |
860 | 860 | ||