author | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
commit | 0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff) | |
tree | 503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /core/multimedia/opieplayer/playlistwidget.cpp | |
parent | a0981652d61776d70f25980f035748b21339e946 (diff) | |
download | opie-0d59c780513da78033f4d9040475dee9db0256d4.zip opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2 |
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you
can check the diff (but it had compiled and run here)
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index a359843..efb5df3 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -74,163 +74,163 @@ 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); |
@@ -251,128 +251,128 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
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; |
262 | vTab = new QWidget( tabWidget, "vTab" ); | 262 | vTab = new QWidget( tabWidget, "vTab" ); |
263 | videoView = new QListView( vTab, "Videoview" ); | 263 | videoView = new QListView( vTab, "Videoview" ); |
264 | 264 | ||
265 | QGridLayout *layoutV = new QGridLayout( vTab ); | 265 | QGridLayout *layoutV = new QGridLayout( vTab ); |
266 | layoutV->setSpacing( 2); | 266 | layoutV->setSpacing( 2); |
267 | layoutV->setMargin( 2); | 267 | layoutV->setMargin( 2); |
268 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 268 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
269 | 269 | ||
270 | videoView->addColumn(tr("Title"),-1); | 270 | videoView->addColumn(tr("Title"),-1); |
271 | videoView->addColumn(tr("Size"),-1); | 271 | videoView->addColumn(tr("Size"),-1); |
272 | videoView->addColumn(tr("Media"),-1); | 272 | videoView->addColumn(tr("Media"),-1); |
273 | videoView->addColumn(tr( "Path" ), -1 ); | 273 | videoView->addColumn(tr( "Path" ), -1 ); |
274 | videoView->setColumnAlignment(1, Qt::AlignRight); | 274 | videoView->setColumnAlignment(1, Qt::AlignRight); |
275 | videoView->setColumnAlignment(2, Qt::AlignRight); | 275 | videoView->setColumnAlignment(2, Qt::AlignRight); |
276 | videoView->setAllColumnsShowFocus(TRUE); | 276 | videoView->setAllColumnsShowFocus(TRUE); |
277 | videoView->setMultiSelection( TRUE ); | 277 | videoView->setMultiSelection( TRUE ); |
278 | videoView->setSelectionMode( QListView::Extended); | 278 | videoView->setSelectionMode( QListView::Extended); |
279 | 279 | ||
280 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 280 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
281 | 281 | ||
282 | tabWidget->insertTab( vTab,tr("Video")); | 282 | tabWidget->insertTab( vTab,tr("Video")); |
283 | 283 | ||
284 | QWidget *LTab; | 284 | QWidget *LTab; |
285 | LTab = new QWidget( tabWidget, "LTab" ); | 285 | LTab = new QWidget( tabWidget, "LTab" ); |
286 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); | 286 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); |
287 | 287 | ||
288 | QGridLayout *layoutL = new QGridLayout( LTab ); | 288 | QGridLayout *layoutL = new QGridLayout( LTab ); |
289 | layoutL->setSpacing( 2); | 289 | layoutL->setSpacing( 2); |
290 | layoutL->setMargin( 2); | 290 | layoutL->setMargin( 2); |
291 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 291 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
292 | 292 | ||
293 | tabWidget->insertTab(LTab,tr("Lists")); | 293 | tabWidget->insertTab(LTab,tr("Lists")); |
294 | 294 | ||
295 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 295 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
296 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 296 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
297 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 297 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
298 | 298 | ||
299 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 299 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
300 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 300 | this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int)) ); |
301 | 301 | ||
302 | 302 | ||
303 | ///audioView | 303 | ///audioView |
304 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 304 | connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
305 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 305 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) ); |
306 | 306 | ||
307 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 307 | connect( audioView, SIGNAL( returnPressed(QListViewItem*)), |
308 | this,SLOT( playIt( QListViewItem *)) ); | 308 | this,SLOT( playIt(QListViewItem*)) ); |
309 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 309 | connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) ); |
310 | 310 | ||
311 | 311 | ||
312 | //videoView | 312 | //videoView |
313 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 313 | connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
314 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 314 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) ); |
315 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 315 | connect( videoView, SIGNAL( returnPressed(QListViewItem*)), |
316 | this,SLOT( playIt( QListViewItem *)) ); | 316 | this,SLOT( playIt(QListViewItem*)) ); |
317 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 317 | connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) ); |
318 | 318 | ||
319 | //playlists | 319 | //playlists |
320 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 320 | connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( loadList(const DocLnk&) ) ); |
321 | 321 | ||
322 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 322 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
323 | 323 | ||
324 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 324 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), d->tbPlay, SLOT( setOn(bool) ) ); |
325 | 325 | ||
326 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 326 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), d->tbLoop, SLOT( setOn(bool) ) ); |
327 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 327 | connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), d->tbShuffle, SLOT( setOn(bool) ) ); |
328 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 328 | connect( mediaPlayerState, SIGNAL( playlistToggled(bool) ), this, SLOT( setPlaylist(bool) ) ); |
329 | 329 | ||
330 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 330 | connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( playIt(QListViewItem*) ) ); |
331 | 331 | ||
332 | setCentralWidget( vbox5 ); | 332 | setCentralWidget( vbox5 ); |
333 | 333 | ||
334 | Config cfg( "OpiePlayer" ); | 334 | Config cfg( "OpiePlayer" ); |
335 | readConfig( cfg ); | 335 | readConfig( cfg ); |
336 | 336 | ||
337 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); | 337 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); |
338 | loadList(DocLnk( currentPlayList)); | 338 | loadList(DocLnk( currentPlayList)); |
339 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); | 339 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); |
340 | 340 | ||
341 | initializeStates(); | 341 | initializeStates(); |
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | PlayListWidget::~PlayListWidget() { | 345 | PlayListWidget::~PlayListWidget() { |
346 | Config cfg( "OpiePlayer" ); | 346 | Config cfg( "OpiePlayer" ); |
347 | writeConfig( cfg ); | 347 | writeConfig( cfg ); |
348 | 348 | ||
349 | if ( d->current ) | 349 | if ( d->current ) |
350 | delete d->current; | 350 | delete d->current; |
351 | if(d) delete d; | 351 | if(d) delete d; |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | void PlayListWidget::initializeStates() { | 355 | void PlayListWidget::initializeStates() { |
356 | 356 | ||
357 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 357 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
358 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 358 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
359 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 359 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
360 | setPlaylist( true); | 360 | setPlaylist( true); |
361 | } | 361 | } |
362 | 362 | ||
363 | 363 | ||
364 | void PlayListWidget::readConfig( Config& cfg ) { | 364 | void PlayListWidget::readConfig( Config& cfg ) { |
365 | cfg.setGroup("PlayList"); | 365 | cfg.setGroup("PlayList"); |
366 | QString currentString = cfg.readEntry("current", "" ); | 366 | QString currentString = cfg.readEntry("current", "" ); |
367 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 367 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
368 | for ( int i = 0; i < noOfFiles; i++ ) { | 368 | for ( int i = 0; i < noOfFiles; i++ ) { |
369 | QString entryName; | 369 | QString entryName; |
370 | entryName.sprintf( "File%i", i + 1 ); | 370 | entryName.sprintf( "File%i", i + 1 ); |
371 | QString linkFile = cfg.readEntry( entryName ); | 371 | QString linkFile = cfg.readEntry( entryName ); |
372 | DocLnk lnk( linkFile ); | 372 | DocLnk lnk( linkFile ); |
373 | if ( lnk.isValid() ) { | 373 | if ( lnk.isValid() ) { |
374 | d->selectedFiles->addToSelection( lnk ); | 374 | d->selectedFiles->addToSelection( lnk ); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | d->selectedFiles->setSelectedItem( currentString); | 377 | d->selectedFiles->setSelectedItem( currentString); |
378 | } | 378 | } |
@@ -895,97 +895,97 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi | |||
895 | case 1: | 895 | case 1: |
896 | 896 | ||
897 | break; | 897 | break; |
898 | case 2:{ | 898 | case 2:{ |
899 | QPopupMenu m; | 899 | QPopupMenu m; |
900 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 900 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
901 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 901 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
902 | // m.insertSeparator(); | 902 | // m.insertSeparator(); |
903 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 903 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
904 | m.exec( QCursor::pos() ); | 904 | m.exec( QCursor::pos() ); |
905 | } | 905 | } |
906 | break; | 906 | break; |
907 | }; | 907 | }; |
908 | 908 | ||
909 | } | 909 | } |
910 | 910 | ||
911 | void PlayListWidget::listDelete() { | 911 | void PlayListWidget::listDelete() { |
912 | Config cfg( "OpiePlayer" ); | 912 | Config cfg( "OpiePlayer" ); |
913 | cfg.setGroup("PlayList"); | 913 | cfg.setGroup("PlayList"); |
914 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 914 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
915 | QString file; | 915 | QString file; |
916 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 916 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
917 | switch ( tabWidget->currentPageIndex()) { | 917 | switch ( tabWidget->currentPageIndex()) { |
918 | case 0: | 918 | case 0: |
919 | break; | 919 | break; |
920 | case 1: | 920 | case 1: |
921 | { | 921 | { |
922 | file = audioView->currentItem()->text(0); | 922 | file = audioView->currentItem()->text(0); |
923 | QListIterator<DocLnk> Pdit( files.children() ); | 923 | QListIterator<DocLnk> Pdit( files.children() ); |
924 | for ( ; Pdit.current(); ++Pdit ) { | 924 | for ( ; Pdit.current(); ++Pdit ) { |
925 | if( Pdit.current()->name() == file) { | 925 | if( Pdit.current()->name() == file) { |
926 | LnkProperties prop( Pdit.current() ); | 926 | LnkProperties prop( Pdit.current() ); |
927 | QPEApplication::execDialog( &prop ); | 927 | QPEApplication::execDialog( &prop ); |
928 | } | 928 | } |
929 | } | 929 | } |
930 | populateAudioView(); | 930 | populateAudioView(); |
931 | } | 931 | } |
932 | break; | 932 | break; |
933 | case 2: | 933 | case 2: |
934 | { | 934 | { |
935 | // file = videoView->selectedItem()->text(0); | 935 | // file = videoView->selectedItem()->text(0); |
936 | // for ( int i = 0; i < noOfFiles; i++ ) { | 936 | // for ( int i = 0; i < noOfFiles; i++ ) { |
937 | // QString entryName; | 937 | // QString entryName; |
938 | // entryName.sprintf( "File%i", i + 1 ); | 938 | // entryName.sprintf( "File%i", i + 1 ); |
939 | // QString linkFile = cfg.readEntry( entryName ); | 939 | // QString linkFile = cfg.readEntry( entryName ); |
940 | // AppLnk lnk( AppLnk(linkFile)); | 940 | // AppLnk lnk( AppLnk(linkFile)); |
941 | // if( lnk.name() == file ) { | 941 | // if( lnk.name() == file ) { |
942 | // LnkProperties prop( &lnk); | 942 | // LnkProperties prop( &lnk); |
943 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 943 | // // connect(&prop, SIGNAL(select(const AppLnk*)), this, SLOT(externalSelected(const AppLnk*))); |
944 | // prop.showMaximized(); | 944 | // prop.showMaximized(); |
945 | // prop.exec(); | 945 | // prop.exec(); |
946 | // } | 946 | // } |
947 | // } | 947 | // } |
948 | } | 948 | } |
949 | break; | 949 | break; |
950 | }; | 950 | }; |
951 | } | 951 | } |
952 | 952 | ||
953 | void PlayListWidget::scanForAudio() { | 953 | void PlayListWidget::scanForAudio() { |
954 | // qDebug("scan for audio"); | 954 | // qDebug("scan for audio"); |
955 | files.detachChildren(); | 955 | files.detachChildren(); |
956 | QListIterator<DocLnk> sdit( files.children() ); | 956 | QListIterator<DocLnk> sdit( files.children() ); |
957 | for ( ; sdit.current(); ++sdit ) { | 957 | for ( ; sdit.current(); ++sdit ) { |
958 | delete sdit.current(); | 958 | delete sdit.current(); |
959 | } | 959 | } |
960 | Global::findDocuments( &files, audioMimes); | 960 | Global::findDocuments( &files, audioMimes); |
961 | audioScan = true; | 961 | audioScan = true; |
962 | } | 962 | } |
963 | void PlayListWidget::scanForVideo() { | 963 | void PlayListWidget::scanForVideo() { |
964 | // qDebug("scan for video"); | 964 | // qDebug("scan for video"); |
965 | vFiles.detachChildren(); | 965 | vFiles.detachChildren(); |
966 | QListIterator<DocLnk> sdit( vFiles.children() ); | 966 | QListIterator<DocLnk> sdit( vFiles.children() ); |
967 | for ( ; sdit.current(); ++sdit ) { | 967 | for ( ; sdit.current(); ++sdit ) { |
968 | delete sdit.current(); | 968 | delete sdit.current(); |
969 | } | 969 | } |
970 | Global::findDocuments(&vFiles, "video/*"); | 970 | Global::findDocuments(&vFiles, "video/*"); |
971 | videoScan = true; | 971 | videoScan = true; |
972 | } | 972 | } |
973 | 973 | ||
974 | void PlayListWidget::populateAudioView() { | 974 | void PlayListWidget::populateAudioView() { |
975 | 975 | ||
976 | audioView->clear(); | 976 | audioView->clear(); |
977 | StorageInfo storageInfo; | 977 | StorageInfo storageInfo; |
978 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 978 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
979 | if(!audioScan) scanForAudio(); | 979 | if(!audioScan) scanForAudio(); |
980 | 980 | ||
981 | QListIterator<DocLnk> dit( files.children() ); | 981 | QListIterator<DocLnk> dit( files.children() ); |
982 | QListIterator<FileSystem> it ( fs ); | 982 | QListIterator<FileSystem> it ( fs ); |
983 | 983 | ||
984 | QString storage; | 984 | QString storage; |
985 | for ( ; dit.current(); ++dit ) { | 985 | for ( ; dit.current(); ++dit ) { |
986 | for( ; it.current(); ++it ){ | 986 | for( ; it.current(); ++it ){ |
987 | const QString name = (*it)->name(); | 987 | const QString name = (*it)->name(); |
988 | const QString path = (*it)->path(); | 988 | const QString path = (*it)->path(); |
989 | if(dit.current()->file().find(path) != -1 ) storage=name; | 989 | if(dit.current()->file().find(path) != -1 ) storage=name; |
990 | } | 990 | } |
991 | 991 | ||