-rw-r--r-- | core/multimedia/opieplayer/main.cpp | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 64 |
2 files changed, 45 insertions, 21 deletions
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp index 4f43ff6..18cd7a6 100644 --- a/core/multimedia/opieplayer/main.cpp +++ b/core/multimedia/opieplayer/main.cpp | |||
@@ -1,56 +1,56 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the 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 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include "mediaplayerstate.h" | 21 | #include "mediaplayerstate.h" |
22 | #include "playlistwidget.h" | 22 | #include "playlistwidget.h" |
23 | #include "audiowidget.h" | 23 | #include "audiowidget.h" |
24 | #include "videowidget.h" | 24 | #include "videowidget.h" |
25 | #include "loopcontrol.h" | 25 | #include "loopcontrol.h" |
26 | #include "mediaplayer.h" | 26 | #include "mediaplayer.h" |
27 | 27 | ||
28 | MediaPlayerState *mediaPlayerState; | 28 | MediaPlayerState *mediaPlayerState; |
29 | PlayListWidget *playList; | 29 | PlayListWidget *playList; |
30 | AudioWidget *audioUI; | 30 | AudioWidget *audioUI; |
31 | VideoWidget *videoUI; | 31 | VideoWidget *videoUI; |
32 | LoopControl *loopControl; | 32 | LoopControl *loopControl; |
33 | 33 | ||
34 | 34 | ||
35 | int main(int argc, char **argv) { | 35 | int main(int argc, char **argv) { |
36 | QPEApplication a(argc,argv); | 36 | QPEApplication a(argc,argv); |
37 | 37 | ||
38 | MediaPlayerState st( 0, "mediaPlayerState" ); | 38 | MediaPlayerState st( 0, "mediaPlayerState" ); |
39 | mediaPlayerState = &st; | 39 | mediaPlayerState = &st; |
40 | PlayListWidget pl( 0, "playList" ); | 40 | PlayListWidget pl( 0, "playList" ); |
41 | playList = &pl; | 41 | playList = &pl; |
42 | AudioWidget aw( 0, "audioUI" ); | 42 | AudioWidget aw( 0, "audioUI" ); |
43 | audioUI = &aw; | 43 | audioUI = &aw; |
44 | VideoWidget vw( 0, "videoUI" ); | 44 | VideoWidget vw( 0, "videoUI" ); |
45 | videoUI = &vw; | 45 | videoUI = &vw; |
46 | LoopControl lc( 0, "loopControl" ); | 46 | LoopControl lc( 0, "loopControl" ); |
47 | loopControl = &lc; | 47 | loopControl = &lc; |
48 | MediaPlayer mp( 0, "mediaPlayer" ); | 48 | MediaPlayer mp( 0, "mediaPlayer" ); |
49 | 49 | ||
50 | pl.setCaption( MediaPlayer::tr("OpiePlayer") ); | 50 | // pl.setCaption( MediaPlayer::tr("OpiePlayer") ); |
51 | a.showMainDocumentWidget(&pl); | 51 | a.showMainDocumentWidget(&pl); |
52 | 52 | ||
53 | return a.exec(); | 53 | return a.exec(); |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index cb58888..9969526 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,757 +1,781 @@ | |||
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 | |||
22 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
23 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
24 | #include <qpe/fileselector.h> | 23 | #include <qpe/fileselector.h> |
25 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
26 | 25 | ||
27 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
28 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
29 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
30 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
31 | #include <qaction.h> | 30 | #include <qaction.h> |
32 | #include <qimage.h> | 31 | #include <qimage.h> |
33 | #include <qfile.h> | 32 | #include <qfile.h> |
34 | #include <qdir.h> | 33 | #include <qdir.h> |
35 | #include <qlayout.h> | 34 | #include <qlayout.h> |
36 | #include <qlabel.h> | 35 | #include <qlabel.h> |
37 | #include <qlist.h> | 36 | #include <qlist.h> |
38 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
39 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
40 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
41 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
42 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
43 | #include <qlistview.h> | 42 | #include <qlistview.h> |
44 | #include <qpoint.h> | 43 | #include <qpoint.h> |
45 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
46 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
47 | 46 | ||
48 | //#include <qtimer.h> | 47 | //#include <qtimer.h> |
49 | 48 | ||
50 | #include "playlistselection.h" | 49 | #include "playlistselection.h" |
51 | #include "playlistwidget.h" | 50 | #include "playlistwidget.h" |
52 | #include "mediaplayerstate.h" | 51 | #include "mediaplayerstate.h" |
53 | 52 | ||
54 | #include "inputDialog.h" | 53 | #include "inputDialog.h" |
55 | 54 | ||
56 | #include <stdlib.h> | 55 | #include <stdlib.h> |
57 | 56 | ||
58 | #define BUTTONS_ON_TOOLBAR | 57 | #define BUTTONS_ON_TOOLBAR |
59 | #define SIDE_BUTTONS | 58 | #define SIDE_BUTTONS |
60 | #define CAN_SAVE_LOAD_PLAYLISTS | 59 | #define CAN_SAVE_LOAD_PLAYLISTS |
61 | 60 | ||
62 | extern MediaPlayerState *mediaPlayerState; | 61 | extern MediaPlayerState *mediaPlayerState; |
63 | 62 | ||
64 | // class myFileSelector { | 63 | // class myFileSelector { |
65 | 64 | ||
66 | // }; | 65 | // }; |
67 | class PlayListWidgetPrivate { | 66 | class PlayListWidgetPrivate { |
68 | public: | 67 | public: |
69 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
70 | QFrame *playListFrame; | 69 | QFrame *playListFrame; |
71 | FileSelector *files; | 70 | FileSelector *files; |
72 | PlayListSelection *selectedFiles; | 71 | PlayListSelection *selectedFiles; |
73 | bool setDocumentUsed; | 72 | bool setDocumentUsed; |
74 | DocLnk *current; | 73 | DocLnk *current; |
75 | }; | 74 | }; |
76 | 75 | ||
77 | 76 | ||
78 | class ToolButton : public QToolButton { | 77 | class ToolButton : public QToolButton { |
79 | public: | 78 | public: |
80 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 79 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
81 | : QToolButton( parent, name ) { | 80 | : QToolButton( parent, name ) { |
82 | setTextLabel( name ); | 81 | setTextLabel( name ); |
83 | setPixmap( Resource::loadPixmap( icon ) ); | 82 | setPixmap( Resource::loadPixmap( icon ) ); |
84 | setAutoRaise( TRUE ); | 83 | setAutoRaise( TRUE ); |
85 | setFocusPolicy( QWidget::NoFocus ); | 84 | setFocusPolicy( QWidget::NoFocus ); |
86 | setToggleButton( t ); | 85 | setToggleButton( t ); |
87 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
88 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 87 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
89 | } | 88 | } |
90 | }; | 89 | }; |
91 | 90 | ||
92 | 91 | ||
93 | class MenuItem : public QAction { | 92 | class MenuItem : public QAction { |
94 | public: | 93 | public: |
95 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
96 | : QAction( text, QString::null, 0, 0 ) { | 95 | : QAction( text, QString::null, 0, 0 ) { |
97 | connect( this, SIGNAL( activated() ), handler, slot ); | 96 | connect( this, SIGNAL( activated() ), handler, slot ); |
98 | addTo( parent ); | 97 | addTo( parent ); |
99 | } | 98 | } |
100 | }; | 99 | }; |
101 | 100 | ||
102 | 101 | ||
103 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
104 | : QMainWindow( parent, name, fl ) { | 103 | : QMainWindow( parent, name, fl ) { |
105 | 104 | ||
106 | d = new PlayListWidgetPrivate; | 105 | d = new PlayListWidgetPrivate; |
107 | d->setDocumentUsed = FALSE; | 106 | d->setDocumentUsed = FALSE; |
108 | d->current = NULL; | 107 | d->current = NULL; |
109 | // menuTimer = new QTimer( this ,"menu timer"), | 108 | // menuTimer = new QTimer( this ,"menu timer"), |
110 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 109 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
111 | 110 | ||
112 | setBackgroundMode( PaletteButton ); | 111 | setBackgroundMode( PaletteButton ); |
113 | 112 | ||
114 | setCaption( tr("OpiePlayer") ); | 113 | setCaption( tr("OpiePlayer") ); |
115 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 114 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
116 | 115 | ||
117 | setToolBarsMovable( FALSE ); | 116 | setToolBarsMovable( FALSE ); |
118 | 117 | ||
119 | // Create Toolbar | 118 | // Create Toolbar |
120 | QPEToolBar *toolbar = new QPEToolBar( this ); | 119 | QPEToolBar *toolbar = new QPEToolBar( this ); |
121 | toolbar->setHorizontalStretchable( TRUE ); | 120 | toolbar->setHorizontalStretchable( TRUE ); |
122 | 121 | ||
123 | // Create Menubar | 122 | // Create Menubar |
124 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 123 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
125 | menu->setMargin( 0 ); | 124 | menu->setMargin( 0 ); |
126 | 125 | ||
127 | QPEToolBar *bar = new QPEToolBar( this ); | 126 | QPEToolBar *bar = new QPEToolBar( this ); |
128 | bar->setLabel( tr( "Play Operations" ) ); | 127 | bar->setLabel( tr( "Play Operations" ) ); |
129 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", | 128 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", |
130 | // this , SLOT( addSelected()) ); | 129 | // this , SLOT( addSelected()) ); |
131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 130 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
132 | tbDeletePlaylist->setFlat(TRUE); | 131 | tbDeletePlaylist->setFlat(TRUE); |
133 | tbDeletePlaylist->setFixedSize(20,20); | 132 | tbDeletePlaylist->setFixedSize(20,20); |
134 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 133 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
135 | 134 | ||
136 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", | 135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", |
137 | this , SLOT(addSelected()) ); | 136 | this , SLOT(addSelected()) ); |
138 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", | 137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", |
139 | this , SLOT(removeSelected()) ); | 138 | this , SLOT(removeSelected()) ); |
140 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 139 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
141 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", | 140 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", |
142 | this , SLOT( btnPlay(bool) ), TRUE ); | 141 | this , SLOT( btnPlay(bool) ), TRUE ); |
143 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", | 142 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", |
144 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 143 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
145 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", | 144 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", |
146 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 145 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
147 | tbDeletePlaylist->hide(); | 146 | tbDeletePlaylist->hide(); |
148 | 147 | ||
149 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 148 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
150 | menu->insertItem( tr( "File" ), pmPlayList ); | 149 | menu->insertItem( tr( "File" ), pmPlayList ); |
151 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 150 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
152 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 151 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
153 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 152 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
154 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 153 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
155 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
156 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 155 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
157 | 156 | ||
158 | QPopupMenu *pmView = new QPopupMenu( this ); | 157 | QPopupMenu *pmView = new QPopupMenu( this ); |
159 | menu->insertItem( tr( "View" ), pmView ); | 158 | menu->insertItem( tr( "View" ), pmView ); |
160 | 159 | ||
161 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 160 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
162 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 161 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
163 | fullScreenButton->addTo(pmView); | 162 | fullScreenButton->addTo(pmView); |
164 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | 163 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); |
165 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 164 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
166 | scaleButton->addTo(pmView); | 165 | scaleButton->addTo(pmView); |
167 | 166 | ||
168 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 167 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
169 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 168 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
170 | 169 | ||
171 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 170 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
172 | 171 | ||
173 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 172 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
174 | tabWidget->setTabShape(QTabWidget::Triangular); | 173 | tabWidget->setTabShape(QTabWidget::Triangular); |
175 | 174 | ||
176 | QWidget *pTab; | 175 | QWidget *pTab; |
177 | pTab = new QWidget( tabWidget, "pTab" ); | 176 | pTab = new QWidget( tabWidget, "pTab" ); |
178 | playlistView = new QListView( pTab, "Videoview" ); | 177 | playlistView = new QListView( pTab, "Videoview" ); |
179 | playlistView->setMinimumSize(236,260); | 178 | playlistView->setMinimumSize(236,260); |
180 | tabWidget->insertTab( pTab,"Playlist"); | 179 | tabWidget->insertTab( pTab,"Playlist"); |
181 | 180 | ||
182 | // Add the playlist area | 181 | // Add the playlist area |
183 | 182 | ||
184 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 183 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
185 | d->playListFrame = vbox3; | 184 | d->playListFrame = vbox3; |
186 | d->playListFrame ->setMinimumSize(235,260); | 185 | d->playListFrame ->setMinimumSize(235,260); |
187 | 186 | ||
188 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 187 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
189 | 188 | ||
190 | d->selectedFiles = new PlayListSelection( hbox2); | 189 | d->selectedFiles = new PlayListSelection( hbox2); |
191 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 190 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
192 | 191 | ||
193 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 192 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
194 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 193 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
195 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 194 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
196 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 195 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
197 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 196 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
198 | 197 | ||
199 | QWidget *aTab; | 198 | QWidget *aTab; |
200 | aTab = new QWidget( tabWidget, "aTab" ); | 199 | aTab = new QWidget( tabWidget, "aTab" ); |
201 | audioView = new QListView( aTab, "Audioview" ); | 200 | audioView = new QListView( aTab, "Audioview" ); |
202 | audioView->setMinimumSize(233,260); | 201 | audioView->setMinimumSize(233,260); |
203 | audioView->addColumn( "Title",150); | 202 | audioView->addColumn( "Title",150); |
204 | audioView->addColumn("Size", 45); | 203 | audioView->addColumn("Size", 45); |
205 | audioView->addColumn("Media",35); | 204 | audioView->addColumn("Media",35); |
206 | audioView->setColumnAlignment(1, Qt::AlignRight); | 205 | audioView->setColumnAlignment(1, Qt::AlignRight); |
207 | audioView->setColumnAlignment(2, Qt::AlignRight); | 206 | audioView->setColumnAlignment(2, Qt::AlignRight); |
208 | tabWidget->insertTab(aTab,"Audio"); | 207 | tabWidget->insertTab(aTab,"Audio"); |
209 | // audioView | 208 | // audioView |
210 | Global::findDocuments(&files, "audio/*"); | 209 | Global::findDocuments(&files, "audio/*"); |
211 | QListIterator<DocLnk> dit( files.children() ); | 210 | QListIterator<DocLnk> dit( files.children() ); |
212 | QString storage; | 211 | QString storage; |
213 | for ( ; dit.current(); ++dit ) { | 212 | for ( ; dit.current(); ++dit ) { |
214 | QListViewItem * newItem; | 213 | QListViewItem * newItem; |
215 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 214 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
216 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | 215 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; |
217 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 216 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
218 | else storage="RAM"; | 217 | else storage="RAM"; |
219 | if ( QFile( dit.current()->file()).exists() ) { | 218 | if ( QFile( dit.current()->file()).exists() ) { |
220 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 219 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
221 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 220 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); |
222 | } | 221 | } |
223 | } | 222 | } |
224 | // videowidget | 223 | // videowidget |
225 | 224 | ||
226 | QWidget *vTab; | 225 | QWidget *vTab; |
227 | vTab = new QWidget( tabWidget, "vTab" ); | 226 | vTab = new QWidget( tabWidget, "vTab" ); |
228 | videoView = new QListView( vTab, "Videoview" ); | 227 | videoView = new QListView( vTab, "Videoview" ); |
229 | videoView->setMinimumSize(233,260); | 228 | videoView->setMinimumSize(233,260); |
230 | 229 | ||
231 | videoView->addColumn("Title",150); | 230 | videoView->addColumn("Title",150); |
232 | videoView->addColumn("Size",45); | 231 | videoView->addColumn("Size",45); |
233 | videoView->addColumn("Media",35); | 232 | videoView->addColumn("Media",35); |
234 | videoView->setColumnAlignment(1, Qt::AlignRight); | 233 | videoView->setColumnAlignment(1, Qt::AlignRight); |
235 | videoView->setColumnAlignment(2, Qt::AlignRight); | 234 | videoView->setColumnAlignment(2, Qt::AlignRight); |
236 | 235 | ||
237 | tabWidget->insertTab( vTab,"Video"); | 236 | tabWidget->insertTab( vTab,"Video"); |
238 | 237 | ||
239 | Global::findDocuments(&vFiles, "video/*"); | 238 | Global::findDocuments(&vFiles, "video/*"); |
240 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 239 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
241 | for ( ; Vdit.current(); ++Vdit ) { | 240 | for ( ; Vdit.current(); ++Vdit ) { |
242 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 241 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
243 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | 242 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; |
244 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 243 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
245 | else storage="RAM"; | 244 | else storage="RAM"; |
246 | QListViewItem * newItem; | 245 | QListViewItem * newItem; |
247 | if ( QFile( Vdit.current()->file()).exists() ) { | 246 | if ( QFile( Vdit.current()->file()).exists() ) { |
248 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 247 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
249 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 248 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
250 | } | 249 | } |
251 | } | 250 | } |
252 | 251 | ||
253 | //playlists list | 252 | //playlists list |
254 | QWidget *LTab; | 253 | QWidget *LTab; |
255 | LTab = new QWidget( tabWidget, "LTab" ); | 254 | LTab = new QWidget( tabWidget, "LTab" ); |
256 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 255 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
257 | playLists->setMinimumSize(233,260);; | 256 | playLists->setMinimumSize(233,260);; |
258 | tabWidget->insertTab(LTab,"Lists"); | 257 | tabWidget->insertTab(LTab,"Lists"); |
258 | |||
259 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 259 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
260 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 260 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
261 | 261 | ||
262 | 262 | ||
263 | // add the library area | 263 | // add the library area |
264 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 264 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
265 | 265 | ||
266 | 266 | ||
267 | connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 267 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
268 | this, SLOT( fauxPlay( QListViewItem *) ) ); | 268 | // this, SLOT( fauxPlay( QListViewItem *) ) ); |
269 | connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 269 | // connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
270 | this, SLOT( fauxPlay( QListViewItem *)) ); | 270 | // this, SLOT( fauxPlay( QListViewItem *)) ); |
271 | 271 | ||
272 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 272 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
273 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 273 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
274 | 274 | ||
275 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 275 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
276 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 276 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
277 | 277 | ||
278 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 278 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
279 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 279 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
280 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 280 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
281 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 281 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
282 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 282 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
283 | 283 | ||
284 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 284 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
285 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 285 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); |
286 | 286 | ||
287 | setCentralWidget( vbox5 ); | 287 | setCentralWidget( vbox5 ); |
288 | 288 | ||
289 | Config cfg( "MediaPlayer" ); | 289 | Config cfg( "MediaPlayer" ); |
290 | readConfig( cfg ); | 290 | readConfig( cfg ); |
291 | 291 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | |
292 | // qDebug("currentList is "+currentPlaylist); | ||
293 | loadList(DocLnk( currentPlaylist)); | ||
294 | setCaption("OpiePlayer: "+ currentPlaylist ); | ||
295 | |||
292 | initializeStates(); | 296 | initializeStates(); |
293 | } | 297 | } |
294 | 298 | ||
295 | 299 | ||
296 | PlayListWidget::~PlayListWidget() { | 300 | PlayListWidget::~PlayListWidget() { |
297 | Config cfg( "MediaPlayer" ); | 301 | Config cfg( "MediaPlayer" ); |
298 | writeConfig( cfg ); | 302 | writeConfig( cfg ); |
303 | |||
299 | 304 | ||
300 | if ( d->current ) | 305 | if ( d->current ) |
301 | delete d->current; | 306 | delete d->current; |
302 | delete d; | 307 | delete d; |
303 | } | 308 | } |
304 | 309 | ||
305 | 310 | ||
306 | void PlayListWidget::initializeStates() { | 311 | void PlayListWidget::initializeStates() { |
307 | 312 | ||
308 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 313 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
309 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 314 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
310 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 315 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
311 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 316 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
312 | // d->tbScale->setOn( mediaPlayerState->scaled() ); | 317 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
313 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 318 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
314 | // setPlaylist( mediaPlayerState->playlist() ); | 319 | // setPlaylist( mediaPlayerState->playlist() ); |
315 | setPlaylist( true); | 320 | setPlaylist( true); |
316 | d->selectedFiles->first(); | 321 | d->selectedFiles->first(); |
317 | |||
318 | } | 322 | } |
319 | 323 | ||
320 | 324 | ||
321 | void PlayListWidget::readConfig( Config& cfg ) { | 325 | void PlayListWidget::readConfig( Config& cfg ) { |
322 | cfg.setGroup("PlayList"); | 326 | cfg.setGroup("PlayList"); |
323 | 327 | ||
324 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 328 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
325 | 329 | ||
326 | for ( int i = 0; i < noOfFiles; i++ ) { | 330 | for ( int i = 0; i < noOfFiles; i++ ) { |
327 | QString entryName; | 331 | QString entryName; |
328 | entryName.sprintf( "File%i", i + 1 ); | 332 | entryName.sprintf( "File%i", i + 1 ); |
329 | QString linkFile = cfg.readEntry( entryName ); | 333 | QString linkFile = cfg.readEntry( entryName ); |
330 | DocLnk lnk( linkFile ); | 334 | DocLnk lnk( linkFile ); |
331 | if ( lnk.isValid() ) | 335 | if ( lnk.isValid() ) |
332 | d->selectedFiles->addToSelection( lnk ); | 336 | d->selectedFiles->addToSelection( lnk ); |
333 | } | 337 | } |
334 | } | 338 | } |
335 | 339 | ||
336 | 340 | ||
337 | void PlayListWidget::writeConfig( Config& cfg ) const { | 341 | void PlayListWidget::writeConfig( Config& cfg ) const { |
338 | cfg.setGroup("PlayList"); | 342 | cfg.setGroup("PlayList"); |
339 | 343 | ||
340 | int noOfFiles = 0; | 344 | int noOfFiles = 0; |
341 | 345 | ||
342 | d->selectedFiles->first(); | 346 | d->selectedFiles->first(); |
343 | do { | 347 | do { |
344 | const DocLnk *lnk = d->selectedFiles->current(); | 348 | const DocLnk *lnk = d->selectedFiles->current(); |
345 | if ( lnk ) { | 349 | if ( lnk ) { |
346 | QString entryName; | 350 | QString entryName; |
347 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 351 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
348 | cfg.writeEntry( entryName, lnk->linkFile() ); | 352 | cfg.writeEntry( entryName, lnk->linkFile() ); |
349 | // if this link does exist, add it so we have the file | 353 | // if this link does exist, add it so we have the file |
350 | // next time... | 354 | // next time... |
351 | if ( !QFile::exists( lnk->linkFile() ) ) { | 355 | if ( !QFile::exists( lnk->linkFile() ) ) { |
352 | // the way writing lnks doesn't really check for out | 356 | // the way writing lnks doesn't really check for out |
353 | // of disk space, but check it anyway. | 357 | // of disk space, but check it anyway. |
354 | if ( !lnk->writeLink() ) { | 358 | if ( !lnk->writeLink() ) { |
355 | QMessageBox::critical( 0, tr("Out of space"), | 359 | QMessageBox::critical( 0, tr("Out of space"), |
356 | tr( "There was a problem saving " | 360 | tr( "There was a problem saving " |
357 | "the playlist.\n" | 361 | "the playlist.\n" |
358 | "Your playlist " | 362 | "Your playlist " |
359 | "may be missing some entries\n" | 363 | "may be missing some entries\n" |
360 | "the next time you start it." ) | 364 | "the next time you start it." ) |
361 | ); | 365 | ); |
362 | } | 366 | } |
363 | } | 367 | } |
364 | noOfFiles++; | 368 | noOfFiles++; |
365 | } | 369 | } |
366 | } while ( d->selectedFiles->next() ); | 370 | } while ( d->selectedFiles->next() ); |
367 | 371 | ||
368 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 372 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
369 | 373 | ||
370 | 374 | ||
371 | } | 375 | } |
372 | 376 | ||
373 | 377 | ||
374 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 378 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
375 | qDebug("add"); | 379 | // qDebug("add"); |
376 | d->setDocumentUsed = FALSE; | 380 | d->setDocumentUsed = FALSE; |
377 | if ( mediaPlayerState->playlist() ) | 381 | if ( mediaPlayerState->playlist() ) |
378 | d->selectedFiles->addToSelection( lnk ); | 382 | d->selectedFiles->addToSelection( lnk ); |
379 | else | 383 | else |
380 | mediaPlayerState->setPlaying( TRUE ); | 384 | mediaPlayerState->setPlaying( TRUE ); |
381 | } | 385 | } |
382 | 386 | ||
383 | 387 | ||
384 | void PlayListWidget::clearList() { | 388 | void PlayListWidget::clearList() { |
385 | while ( first() ) | 389 | while ( first() ) |
386 | d->selectedFiles->removeSelected(); | 390 | d->selectedFiles->removeSelected(); |
387 | } | 391 | } |
388 | 392 | ||
389 | 393 | ||
390 | void PlayListWidget::addAllToList() { | 394 | void PlayListWidget::addAllToList() { |
391 | DocLnkSet files; | 395 | DocLnkSet files; |
392 | Global::findDocuments(&files, "video/*;audio/*"); | 396 | Global::findDocuments(&files, "video/*;audio/*"); |
393 | QListIterator<DocLnk> dit( files.children() ); | 397 | QListIterator<DocLnk> dit( files.children() ); |
394 | for ( ; dit.current(); ++dit ) | 398 | for ( ; dit.current(); ++dit ) |
395 | d->selectedFiles->addToSelection( **dit ); | 399 | d->selectedFiles->addToSelection( **dit ); |
396 | } | 400 | } |
397 | 401 | ||
398 | 402 | ||
399 | void PlayListWidget::addAllMusicToList() { | 403 | void PlayListWidget::addAllMusicToList() { |
400 | DocLnkSet files; | 404 | DocLnkSet files; |
401 | Global::findDocuments(&files, "audio/*"); | 405 | Global::findDocuments(&files, "audio/*"); |
402 | QListIterator<DocLnk> dit( files.children() ); | 406 | QListIterator<DocLnk> dit( files.children() ); |
403 | for ( ; dit.current(); ++dit ) | 407 | for ( ; dit.current(); ++dit ) |
404 | d->selectedFiles->addToSelection( **dit ); | 408 | d->selectedFiles->addToSelection( **dit ); |
405 | } | 409 | } |
406 | 410 | ||
407 | 411 | ||
408 | void PlayListWidget::addAllVideoToList() { | 412 | void PlayListWidget::addAllVideoToList() { |
409 | DocLnkSet files; | 413 | DocLnkSet files; |
410 | Global::findDocuments(&files, "video/*"); | 414 | Global::findDocuments(&files, "video/*"); |
411 | QListIterator<DocLnk> dit( files.children() ); | 415 | QListIterator<DocLnk> dit( files.children() ); |
412 | for ( ; dit.current(); ++dit ) | 416 | for ( ; dit.current(); ++dit ) |
413 | d->selectedFiles->addToSelection( **dit ); | 417 | d->selectedFiles->addToSelection( **dit ); |
414 | } | 418 | } |
415 | 419 | ||
416 | 420 | ||
417 | void PlayListWidget::setDocument(const QString& fileref) { | 421 | void PlayListWidget::setDocument(const QString& fileref) { |
418 | if ( fileref.isNull() ) { | 422 | if ( fileref.isNull() ) { |
419 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 423 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
420 | return; | 424 | return; |
421 | } | 425 | } |
426 | // qDebug("setDocument"); | ||
422 | if(fileref.find("playlist",0,TRUE) == -1) { | 427 | if(fileref.find("playlist",0,TRUE) == -1) { |
423 | addToSelection( DocLnk( fileref ) ); | 428 | addToSelection( DocLnk( fileref ) ); |
424 | d->setDocumentUsed = TRUE; | 429 | d->setDocumentUsed = TRUE; |
425 | qApp->processEvents(); | 430 | qApp->processEvents(); |
426 | mediaPlayerState->setPlaying( FALSE ); | 431 | mediaPlayerState->setPlaying( FALSE ); |
427 | qApp->processEvents(); | 432 | qApp->processEvents(); |
428 | mediaPlayerState->setPlaying( TRUE ); | 433 | mediaPlayerState->setPlaying( TRUE ); |
429 | d->selectedFiles->removeSelected( ); | 434 | d->selectedFiles->removeSelected( ); |
430 | } else { | 435 | } else { |
431 | loadList(DocLnk(fileref)); | 436 | loadList(DocLnk(fileref)); |
432 | d->selectedFiles->first(); | 437 | d->selectedFiles->first(); |
433 | // mediaPlayerState->setPlaying( TRUE ); | 438 | // mediaPlayerState->setPlaying( TRUE ); |
434 | // mediaPlayerState->setPlaying( FALSE ); | 439 | // mediaPlayerState->setPlaying( FALSE ); |
435 | 440 | ||
436 | } | 441 | } |
437 | } | 442 | } |
438 | 443 | ||
439 | 444 | ||
440 | void PlayListWidget::setActiveWindow() { | 445 | void PlayListWidget::setActiveWindow() { |
441 | // When we get raised we need to ensure that it switches views | 446 | // When we get raised we need to ensure that it switches views |
442 | char origView = mediaPlayerState->view(); | 447 | char origView = mediaPlayerState->view(); |
443 | mediaPlayerState->setView( 'l' ); // invalidate | 448 | mediaPlayerState->setView( 'l' ); // invalidate |
444 | mediaPlayerState->setView( origView ); // now switch back | 449 | mediaPlayerState->setView( origView ); // now switch back |
445 | } | 450 | } |
446 | 451 | ||
447 | 452 | ||
448 | void PlayListWidget::useSelectedDocument() { | 453 | void PlayListWidget::useSelectedDocument() { |
449 | d->setDocumentUsed = FALSE; | 454 | d->setDocumentUsed = FALSE; |
450 | } | 455 | } |
451 | 456 | ||
452 | 457 | ||
453 | const DocLnk *PlayListWidget::current() { | 458 | const DocLnk *PlayListWidget::current() { |
454 | 459 | ||
455 | // qDebug("in Playlist widget ::current"); | 460 | // qDebug("in Playlist widget ::current"); |
456 | if ( mediaPlayerState->playlist() ) { | 461 | if ( mediaPlayerState->playlist() ) { |
457 | return d->selectedFiles->current(); | 462 | return d->selectedFiles->current(); |
458 | } | 463 | } |
459 | else if ( d->setDocumentUsed && d->current ) { | 464 | else if ( d->setDocumentUsed && d->current ) { |
460 | return d->current; | 465 | return d->current; |
461 | } else { | 466 | } else { |
462 | return d->files->selected(); | 467 | return d->files->selected(); |
463 | } | 468 | } |
464 | } | 469 | } |
465 | 470 | ||
466 | 471 | ||
467 | bool PlayListWidget::prev() { | 472 | bool PlayListWidget::prev() { |
468 | if ( mediaPlayerState->playlist() ) { | 473 | if ( mediaPlayerState->playlist() ) { |
469 | if ( mediaPlayerState->shuffled() ) { | 474 | if ( mediaPlayerState->shuffled() ) { |
470 | const DocLnk *cur = current(); | 475 | const DocLnk *cur = current(); |
471 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 476 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
472 | for ( int i = 0; i < j; i++ ) { | 477 | for ( int i = 0; i < j; i++ ) { |
473 | if ( !d->selectedFiles->next() ) | 478 | if ( !d->selectedFiles->next() ) |
474 | d->selectedFiles->first(); | 479 | d->selectedFiles->first(); |
475 | } | 480 | } |
476 | if ( cur == current() ) | 481 | if ( cur == current() ) |
477 | if ( !d->selectedFiles->next() ) | 482 | if ( !d->selectedFiles->next() ) |
478 | d->selectedFiles->first(); | 483 | d->selectedFiles->first(); |
479 | return TRUE; | 484 | return TRUE; |
480 | } else { | 485 | } else { |
481 | if ( !d->selectedFiles->prev() ) { | 486 | if ( !d->selectedFiles->prev() ) { |
482 | if ( mediaPlayerState->looping() ) { | 487 | if ( mediaPlayerState->looping() ) { |
483 | return d->selectedFiles->last(); | 488 | return d->selectedFiles->last(); |
484 | } else { | 489 | } else { |
485 | return FALSE; | 490 | return FALSE; |
486 | } | 491 | } |
487 | } | 492 | } |
488 | return TRUE; | 493 | return TRUE; |
489 | } | 494 | } |
490 | } else { | 495 | } else { |
491 | return mediaPlayerState->looping(); | 496 | return mediaPlayerState->looping(); |
492 | } | 497 | } |
493 | } | 498 | } |
494 | 499 | ||
495 | 500 | ||
496 | bool PlayListWidget::next() { | 501 | bool PlayListWidget::next() { |
497 | if ( mediaPlayerState->playlist() ) { | 502 | if ( mediaPlayerState->playlist() ) { |
498 | if ( mediaPlayerState->shuffled() ) { | 503 | if ( mediaPlayerState->shuffled() ) { |
499 | return prev(); | 504 | return prev(); |
500 | } else { | 505 | } else { |
501 | if ( !d->selectedFiles->next() ) { | 506 | if ( !d->selectedFiles->next() ) { |
502 | if ( mediaPlayerState->looping() ) { | 507 | if ( mediaPlayerState->looping() ) { |
503 | return d->selectedFiles->first(); | 508 | return d->selectedFiles->first(); |
504 | } else { | 509 | } else { |
505 | return FALSE; | 510 | return FALSE; |
506 | } | 511 | } |
507 | } | 512 | } |
508 | return TRUE; | 513 | return TRUE; |
509 | } | 514 | } |
510 | } else { | 515 | } else { |
511 | return mediaPlayerState->looping(); | 516 | return mediaPlayerState->looping(); |
512 | } | 517 | } |
513 | } | 518 | } |
514 | 519 | ||
515 | 520 | ||
516 | bool PlayListWidget::first() { | 521 | bool PlayListWidget::first() { |
517 | if ( mediaPlayerState->playlist() ) | 522 | if ( mediaPlayerState->playlist() ) |
518 | return d->selectedFiles->first(); | 523 | return d->selectedFiles->first(); |
519 | else | 524 | else |
520 | return mediaPlayerState->looping(); | 525 | return mediaPlayerState->looping(); |
521 | } | 526 | } |
522 | 527 | ||
523 | 528 | ||
524 | bool PlayListWidget::last() { | 529 | bool PlayListWidget::last() { |
525 | if ( mediaPlayerState->playlist() ) | 530 | if ( mediaPlayerState->playlist() ) |
526 | return d->selectedFiles->last(); | 531 | return d->selectedFiles->last(); |
527 | else | 532 | else |
528 | return mediaPlayerState->looping(); | 533 | return mediaPlayerState->looping(); |
529 | } | 534 | } |
530 | 535 | ||
531 | 536 | ||
532 | void PlayListWidget::saveList() { | 537 | void PlayListWidget::saveList() { |
533 | 538 | ||
534 | QString filename; | 539 | QString filename; |
535 | InputDialog *fileDlg; | 540 | InputDialog *fileDlg; |
536 | fileDlg=new InputDialog(this,"Save Playlist",TRUE, 0); | 541 | fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); |
537 | fileDlg->exec(); | 542 | fileDlg->exec(); |
538 | if( fileDlg->result() == 1 ) { | 543 | if( fileDlg->result() == 1 ) { |
544 | if ( d->current ) | ||
545 | delete d->current; | ||
539 | filename = fileDlg->LineEdit1->text();//+".playlist"; | 546 | filename = fileDlg->LineEdit1->text();//+".playlist"; |
540 | qDebug("saving playlist "+filename+".playlist"); | 547 | // qDebug("saving playlist "+filename+".playlist"); |
541 | Config cfg( filename +".playlist"); | 548 | Config cfg( filename +".playlist"); |
542 | writeConfig( cfg ); | 549 | writeConfig( cfg ); |
550 | if( playLists->selected()->name() == filename) { | ||
551 | // qDebug("same name so delete lnk"); | ||
552 | QFile().remove(playLists->selected()->file()); | ||
553 | QFile().remove(playLists->selected()->linkFile()); | ||
554 | playLists->reread(); | ||
555 | } | ||
556 | |||
543 | DocLnk lnk; | 557 | DocLnk lnk; |
544 | // lnk.setComment( ""); | 558 | // lnk.setComment( ""); |
545 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 559 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
546 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 560 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
547 | lnk.setIcon("mpegplayer/playlist2"); | 561 | lnk.setIcon("mpegplayer/playlist2"); |
548 | lnk.setName( filename); //sets file name | 562 | lnk.setName( filename); //sets file name |
549 | if(!lnk.writeLink()) | 563 | if(!lnk.writeLink()) |
550 | qDebug("Writing doclink did not work"); | 564 | qDebug("Writing doclink did not work"); |
551 | } | 565 | } |
552 | 566 | Config config( "MediaPlayer" ); | |
567 | config.writeEntry("CurrentPlaylist",filename); | ||
568 | setCaption("OpiePlayer: "+filename); | ||
569 | d->selectedFiles->first(); | ||
553 | if(fileDlg) | 570 | if(fileDlg) |
554 | delete fileDlg; | 571 | delete fileDlg; |
555 | 572 | ||
556 | } | 573 | } |
557 | 574 | ||
558 | 575 | ||
559 | void PlayListWidget::loadList( const DocLnk & lnk) { | 576 | void PlayListWidget::loadList( const DocLnk & lnk) { |
560 | qDebug("load list "+ lnk.name()+".playlist"); | 577 | QString name= lnk.name(); |
561 | clearList(); | 578 | // qDebug("currentList is "+name); |
562 | Config cfg( lnk.name()+".playlist"); | 579 | if( name.length()>1) { |
563 | readConfig(cfg); | 580 | setCaption("OpiePlayer: "+name); |
564 | tabWidget->setCurrentPage(0); | 581 | // qDebug("load list "+ name+".playlist"); |
565 | setCaption("OpiePlayer: "+lnk.name()); | 582 | clearList(); |
583 | Config cfg( name+".playlist"); | ||
584 | readConfig(cfg); | ||
585 | tabWidget->setCurrentPage(0); | ||
586 | Config config( "MediaPlayer" ); | ||
587 | config.writeEntry("CurrentPlaylist", name); | ||
588 | d->selectedFiles->first(); | ||
589 | } | ||
566 | } | 590 | } |
567 | 591 | ||
568 | 592 | ||
569 | void PlayListWidget::setPlaylist( bool shown ) { | 593 | void PlayListWidget::setPlaylist( bool shown ) { |
570 | if ( shown ) | 594 | if ( shown ) |
571 | d->playListFrame->show(); | 595 | d->playListFrame->show(); |
572 | else | 596 | else |
573 | d->playListFrame->hide(); | 597 | d->playListFrame->hide(); |
574 | } | 598 | } |
575 | 599 | ||
576 | 600 | ||
577 | void PlayListWidget::setView( char view ) { | 601 | void PlayListWidget::setView( char view ) { |
578 | if ( view == 'l' ) | 602 | if ( view == 'l' ) |
579 | showMaximized(); | 603 | showMaximized(); |
580 | else | 604 | else |
581 | hide(); | 605 | hide(); |
582 | } | 606 | } |
583 | 607 | ||
584 | void PlayListWidget::addSelected() { | 608 | void PlayListWidget::addSelected() { |
585 | 609 | ||
586 | switch (tabWidget->currentPageIndex()) { | 610 | switch (tabWidget->currentPageIndex()) { |
587 | case 0: //playlist | 611 | case 0: //playlist |
588 | break; | 612 | break; |
589 | case 1: { //audio | 613 | case 1: { //audio |
590 | addToSelection( audioView->selectedItem() ); | 614 | addToSelection( audioView->selectedItem() ); |
591 | } | 615 | } |
592 | break; | 616 | break; |
593 | case 2: { // video | 617 | case 2: { // video |
594 | addToSelection( videoView->selectedItem() ); | 618 | addToSelection( videoView->selectedItem() ); |
595 | } | 619 | } |
596 | break; | 620 | break; |
597 | }; | 621 | }; |
598 | } | 622 | } |
599 | 623 | ||
600 | void PlayListWidget::removeSelected() { | 624 | void PlayListWidget::removeSelected() { |
601 | d->selectedFiles->removeSelected( ); | 625 | d->selectedFiles->removeSelected( ); |
602 | } | 626 | } |
603 | 627 | ||
604 | 628 | ||
605 | void PlayListWidget::playIt( QListViewItem *it) { | 629 | void PlayListWidget::playIt( QListViewItem *it) { |
606 | // d->setDocumentUsed = FALSE; | 630 | // d->setDocumentUsed = FALSE; |
607 | mediaPlayerState->setPlaying(TRUE); | 631 | mediaPlayerState->setPlaying(TRUE); |
608 | } | 632 | } |
609 | 633 | ||
610 | void PlayListWidget::addToSelection( QListViewItem *it) { | 634 | void PlayListWidget::addToSelection( QListViewItem *it) { |
611 | d->setDocumentUsed = FALSE; | 635 | d->setDocumentUsed = FALSE; |
612 | 636 | ||
613 | if(it) { | 637 | if(it) { |
614 | // qDebug("add to selection"); | 638 | // qDebug("add to selection"); |
615 | switch (tabWidget->currentPageIndex()) { | 639 | switch (tabWidget->currentPageIndex()) { |
616 | case 1: { | 640 | case 1: { |
617 | // qDebug("case 1"); | 641 | // qDebug("case 1"); |
618 | QListIterator<DocLnk> dit( files.children() ); | 642 | QListIterator<DocLnk> dit( files.children() ); |
619 | for ( ; dit.current(); ++dit ) { | 643 | for ( ; dit.current(); ++dit ) { |
620 | // qDebug(dit.current()->name()); | 644 | // qDebug(dit.current()->name()); |
621 | if( dit.current()->name() == it->text(0)) { | 645 | if( dit.current()->name() == it->text(0)) { |
622 | d->selectedFiles->addToSelection( **dit ); | 646 | d->selectedFiles->addToSelection( **dit ); |
623 | } | 647 | } |
624 | } | 648 | } |
625 | } | 649 | } |
626 | break; | 650 | break; |
627 | case 2: { | 651 | case 2: { |
628 | // qDebug("case 2"); | 652 | // qDebug("case 2"); |
629 | QListIterator<DocLnk> dit( vFiles.children() ); | 653 | QListIterator<DocLnk> dit( vFiles.children() ); |
630 | for ( ; dit.current(); ++dit ) { | 654 | for ( ; dit.current(); ++dit ) { |
631 | // qDebug(dit.current()->name()); | 655 | // qDebug(dit.current()->name()); |
632 | if( dit.current()->name() == it->text(0)) { | 656 | if( dit.current()->name() == it->text(0)) { |
633 | d->selectedFiles->addToSelection( **dit ); | 657 | d->selectedFiles->addToSelection( **dit ); |
634 | } | 658 | } |
635 | } | 659 | } |
636 | } | 660 | } |
637 | break; | 661 | break; |
638 | case 0: | 662 | case 0: |
639 | break; | 663 | break; |
640 | }; | 664 | }; |
641 | tabWidget->setCurrentPage(0); | 665 | tabWidget->setCurrentPage(0); |
642 | // mediaPlayerState->setPlaying( TRUE ); | 666 | // mediaPlayerState->setPlaying( TRUE ); |
643 | } | 667 | } |
644 | } | 668 | } |
645 | 669 | ||
646 | void PlayListWidget::tabChanged(QWidget *widg) { | 670 | void PlayListWidget::tabChanged(QWidget *widg) { |
647 | 671 | ||
648 | switch ( tabWidget->currentPageIndex()) { | 672 | switch ( tabWidget->currentPageIndex()) { |
649 | case 0: | 673 | case 0: |
650 | { | 674 | { |
651 | if( !tbDeletePlaylist->isHidden()) | 675 | if( !tbDeletePlaylist->isHidden()) |
652 | tbDeletePlaylist->hide(); | 676 | tbDeletePlaylist->hide(); |
653 | d->tbRemoveFromList->setEnabled(TRUE); | 677 | d->tbRemoveFromList->setEnabled(TRUE); |
654 | d->tbAddToList->setEnabled(FALSE); | 678 | d->tbAddToList->setEnabled(FALSE); |
655 | } | 679 | } |
656 | break; | 680 | break; |
657 | case 1: | 681 | case 1: |
658 | { | 682 | { |
659 | if( !tbDeletePlaylist->isHidden()) | 683 | if( !tbDeletePlaylist->isHidden()) |
660 | tbDeletePlaylist->hide(); | 684 | tbDeletePlaylist->hide(); |
661 | d->tbRemoveFromList->setEnabled(FALSE); | 685 | d->tbRemoveFromList->setEnabled(FALSE); |
662 | d->tbAddToList->setEnabled(TRUE); | 686 | d->tbAddToList->setEnabled(TRUE); |
663 | } | 687 | } |
664 | break; | 688 | break; |
665 | case 2: | 689 | case 2: |
666 | { | 690 | { |
667 | if( !tbDeletePlaylist->isHidden()) | 691 | if( !tbDeletePlaylist->isHidden()) |
668 | tbDeletePlaylist->hide(); | 692 | tbDeletePlaylist->hide(); |
669 | d->tbRemoveFromList->setEnabled(FALSE); | 693 | d->tbRemoveFromList->setEnabled(FALSE); |
670 | d->tbAddToList->setEnabled(TRUE); | 694 | d->tbAddToList->setEnabled(TRUE); |
671 | } | 695 | } |
672 | break; | 696 | break; |
673 | case 3: | 697 | case 3: |
674 | { | 698 | { |
675 | if( tbDeletePlaylist->isHidden()) | 699 | if( tbDeletePlaylist->isHidden()) |
676 | tbDeletePlaylist->show(); | 700 | tbDeletePlaylist->show(); |
677 | playLists->reread(); | 701 | playLists->reread(); |
678 | } | 702 | } |
679 | break; | 703 | break; |
680 | }; | 704 | }; |
681 | } | 705 | } |
682 | 706 | ||
683 | /* | 707 | /* |
684 | list is right clicked*/ | 708 | list is right clicked*/ |
685 | void PlayListWidget::fauxPlay(QListViewItem *it) { | 709 | void PlayListWidget::fauxPlay(QListViewItem *it) { |
686 | 710 | ||
687 | switch (tabWidget->currentPageIndex()) { | 711 | switch (tabWidget->currentPageIndex()) { |
688 | case 0: //playlist | 712 | case 0: //playlist |
689 | break; | 713 | break; |
690 | case 1: { //audio | 714 | case 1: { //audio |
691 | QListIterator<DocLnk> dit( files.children() ); | 715 | QListIterator<DocLnk> dit( files.children() ); |
692 | for ( ; dit.current(); ++dit ) { | 716 | for ( ; dit.current(); ++dit ) { |
693 | // qDebug(dit.current()->name()); | 717 | // qDebug(dit.current()->name()); |
694 | if( dit.current()->name() == it->text(0)) { | 718 | if( dit.current()->name() == it->text(0)) { |
695 | d->selectedFiles->addToSelection( **dit ); | 719 | d->selectedFiles->addToSelection( **dit ); |
696 | } | 720 | } |
697 | } | 721 | } |
698 | } | 722 | } |
699 | break; | 723 | break; |
700 | case 2: { // video | 724 | case 2: { // video |
701 | QListIterator<DocLnk> dit( vFiles.children() ); | 725 | QListIterator<DocLnk> dit( vFiles.children() ); |
702 | for ( ; dit.current(); ++dit ) { | 726 | for ( ; dit.current(); ++dit ) { |
703 | // qDebug(dit.current()->name()); | 727 | // qDebug(dit.current()->name()); |
704 | if( dit.current()->name() == it->text(0)) { | 728 | if( dit.current()->name() == it->text(0)) { |
705 | d->selectedFiles->addToSelection( **dit ); | 729 | d->selectedFiles->addToSelection( **dit ); |
706 | } | 730 | } |
707 | } | 731 | } |
708 | } | 732 | } |
709 | break; | 733 | break; |
710 | }; | 734 | }; |
711 | mediaPlayerState->setPlaying( TRUE ); | 735 | mediaPlayerState->setPlaying( TRUE ); |
712 | // tabWidget->setCurrentPage(0); | 736 | // tabWidget->setCurrentPage(0); |
713 | d->selectedFiles->removeSelected(); | 737 | d->selectedFiles->removeSelected(); |
714 | } | 738 | } |
715 | 739 | ||
716 | /* | 740 | /* |
717 | play button is pressed*/ | 741 | play button is pressed*/ |
718 | void PlayListWidget::btnPlay(bool b) { // this is fugly | 742 | void PlayListWidget::btnPlay(bool b) { // this is fugly |
719 | switch ( tabWidget->currentPageIndex()) { | 743 | switch ( tabWidget->currentPageIndex()) { |
720 | case 0: | 744 | case 0: |
721 | { | 745 | { |
722 | mediaPlayerState->setPlaying(b); | 746 | mediaPlayerState->setPlaying(b); |
723 | } | 747 | } |
724 | break; | 748 | break; |
725 | case 1: | 749 | case 1: |
726 | { | 750 | { |
727 | addToSelection( audioView->selectedItem() ); | 751 | addToSelection( audioView->selectedItem() ); |
728 | mediaPlayerState->setPlaying(b); | 752 | mediaPlayerState->setPlaying(b); |
729 | qApp->processEvents(); | 753 | qApp->processEvents(); |
730 | d->selectedFiles->removeSelected( ); | 754 | d->selectedFiles->removeSelected( ); |
731 | tabWidget->setCurrentPage(1); | 755 | tabWidget->setCurrentPage(1); |
732 | } | 756 | } |
733 | break; | 757 | break; |
734 | case 2: | 758 | case 2: |
735 | { | 759 | { |
736 | addToSelection( videoView->selectedItem() ); | 760 | addToSelection( videoView->selectedItem() ); |
737 | mediaPlayerState->setPlaying(b); | 761 | mediaPlayerState->setPlaying(b); |
738 | qApp->processEvents(); | 762 | qApp->processEvents(); |
739 | d->selectedFiles->removeSelected( ); | 763 | d->selectedFiles->removeSelected( ); |
740 | tabWidget->setCurrentPage(2); | 764 | tabWidget->setCurrentPage(2); |
741 | } | 765 | } |
742 | break; | 766 | break; |
743 | }; | 767 | }; |
744 | 768 | ||
745 | } | 769 | } |
746 | 770 | ||
747 | void PlayListWidget::deletePlaylist() { | 771 | void PlayListWidget::deletePlaylist() { |
748 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 772 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
749 | (tr("You really want to delete\nthis playlist?")), | 773 | (tr("You really want to delete\nthis playlist?")), |
750 | (tr("Yes")), (tr("No")), 0 )){ | 774 | (tr("Yes")), (tr("No")), 0 )){ |
751 | case 0: // Yes clicked, | 775 | case 0: // Yes clicked, |
752 | QFile().remove(playLists->selected()->file()); | 776 | QFile().remove(playLists->selected()->file()); |
753 | QFile().remove(playLists->selected()->linkFile()); | 777 | QFile().remove(playLists->selected()->linkFile()); |
754 | playLists->reread(); | 778 | playLists->reread(); |
755 | break; | 779 | break; |
756 | case 1: // Cancel | 780 | case 1: // Cancel |
757 | break; | 781 | break; |