author | llornkcor <llornkcor> | 2003-04-20 02:36:08 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-04-20 02:36:08 (UTC) |
commit | f4b192f79649abb3318c2c404da31f067f4ca467 (patch) (unidiff) | |
tree | e42225f67544daace708051585fb944c4ca6561d | |
parent | 845c8a880a2ff701f21c2845674e97a2493499f4 (diff) | |
download | opie-f4b192f79649abb3318c2c404da31f067f4ca467.zip opie-f4b192f79649abb3318c2c404da31f067f4ca467.tar.gz opie-f4b192f79649abb3318c2c404da31f067f4ca467.tar.bz2 |
fix sizing
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index bffda38..795feaf 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -134,279 +134,278 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
134 | : QMainWindow( parent, name, fl ) { | 134 | : QMainWindow( parent, name, fl ) { |
135 | 135 | ||
136 | d = new PlayListWidgetPrivate; | 136 | d = new PlayListWidgetPrivate; |
137 | d->setDocumentUsed = FALSE; | 137 | d->setDocumentUsed = FALSE; |
138 | d->current = NULL; | 138 | d->current = NULL; |
139 | fromSetDocument = FALSE; | 139 | fromSetDocument = FALSE; |
140 | insanityBool=FALSE; | 140 | insanityBool=FALSE; |
141 | audioScan = FALSE; | 141 | audioScan = FALSE; |
142 | videoScan = FALSE; | 142 | videoScan = FALSE; |
143 | // menuTimer = new QTimer( this ,"menu timer"), | 143 | // menuTimer = new QTimer( this ,"menu timer"), |
144 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 144 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
145 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); | 145 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); |
146 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 146 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
147 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | 147 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); |
148 | 148 | ||
149 | setBackgroundMode( PaletteButton ); | 149 | setBackgroundMode( PaletteButton ); |
150 | 150 | ||
151 | setCaption( tr("OpiePlayer") ); | 151 | setCaption( tr("OpiePlayer") ); |
152 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 152 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); |
153 | 153 | ||
154 | setToolBarsMovable( FALSE ); | 154 | setToolBarsMovable( FALSE ); |
155 | 155 | ||
156 | // Create Toolbar | 156 | // Create Toolbar |
157 | QPEToolBar *toolbar = new QPEToolBar( this ); | 157 | QPEToolBar *toolbar = new QPEToolBar( this ); |
158 | toolbar->setHorizontalStretchable( TRUE ); | 158 | toolbar->setHorizontalStretchable( TRUE ); |
159 | 159 | ||
160 | // Create Menubar | 160 | // Create Menubar |
161 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 161 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
162 | menu->setMargin( 0 ); | 162 | menu->setMargin( 0 ); |
163 | 163 | ||
164 | QPEToolBar *bar = new QPEToolBar( this ); | 164 | QPEToolBar *bar = new QPEToolBar( this ); |
165 | bar->setLabel( tr( "Play Operations" ) ); | 165 | bar->setLabel( tr( "Play Operations" ) ); |
166 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 166 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
167 | // this , SLOT( addSelected()) ); | 167 | // this , SLOT( addSelected()) ); |
168 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 168 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
169 | tbDeletePlaylist->setFlat(TRUE); | 169 | tbDeletePlaylist->setFlat(TRUE); |
170 | 170 | ||
171 | tbDeletePlaylist->setFixedSize(20,20); | 171 | tbDeletePlaylist->setFixedSize(20,20); |
172 | 172 | ||
173 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 173 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
174 | this , SLOT(addSelected()) ); | 174 | this , SLOT(addSelected()) ); |
175 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 175 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
176 | this , SLOT(removeSelected()) ); | 176 | this , SLOT(removeSelected()) ); |
177 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 177 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
178 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 178 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
179 | this , SLOT( btnPlay(bool) ), TRUE ); | 179 | this , SLOT( btnPlay(bool) ), TRUE ); |
180 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 180 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
181 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 181 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
182 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 182 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
183 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 183 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
184 | tbDeletePlaylist->hide(); | 184 | tbDeletePlaylist->hide(); |
185 | 185 | ||
186 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 186 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
187 | menu->insertItem( tr( "File" ), pmPlayList ); | 187 | menu->insertItem( tr( "File" ), pmPlayList ); |
188 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 188 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
189 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 189 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
190 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 190 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
191 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 191 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
192 | pmPlayList->insertSeparator(-1); | 192 | pmPlayList->insertSeparator(-1); |
193 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 193 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
194 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 194 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
195 | pmPlayList->insertSeparator(-1); | 195 | pmPlayList->insertSeparator(-1); |
196 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 196 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
197 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 197 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
198 | 198 | ||
199 | QPopupMenu *pmView = new QPopupMenu( this ); | 199 | QPopupMenu *pmView = new QPopupMenu( this ); |
200 | menu->insertItem( tr( "View" ), pmView ); | 200 | menu->insertItem( tr( "View" ), pmView ); |
201 | 201 | ||
202 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 202 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
203 | fullScreenButton->addTo(pmView); | 203 | fullScreenButton->addTo(pmView); |
204 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 204 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
205 | scaleButton->addTo(pmView); | 205 | scaleButton->addTo(pmView); |
206 | 206 | ||
207 | 207 | ||
208 | skinsMenu = new QPopupMenu( this ); | 208 | skinsMenu = new QPopupMenu( this ); |
209 | menu->insertItem( tr( "Skins" ), skinsMenu ); | 209 | menu->insertItem( tr( "Skins" ), skinsMenu ); |
210 | skinsMenu->isCheckable(); | 210 | skinsMenu->isCheckable(); |
211 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 211 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
212 | this, SLOT( skinsMenuActivated( int ) ) ); | 212 | this, SLOT( skinsMenuActivated( int ) ) ); |
213 | populateSkinsMenu(); | 213 | populateSkinsMenu(); |
214 | 214 | ||
215 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 215 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
216 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 216 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
217 | 217 | ||
218 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 218 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
219 | 219 | ||
220 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 220 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
221 | // tabWidget->setTabShape(QTabWidget::Triangular); | 221 | // tabWidget->setTabShape(QTabWidget::Triangular); |
222 | 222 | ||
223 | QWidget *pTab; | 223 | QWidget *pTab; |
224 | pTab = new QWidget( tabWidget, "pTab" ); | 224 | pTab = new QWidget( tabWidget, "pTab" ); |
225 | // playlistView = new QListView( pTab, "playlistview" ); | 225 | // playlistView = new QListView( pTab, "playlistview" ); |
226 | // playlistView->setMinimumSize(236,260); | 226 | // playlistView->setMinimumSize(236,260); |
227 | tabWidget->insertTab( pTab,"Playlist"); | 227 | tabWidget->insertTab( pTab,"Playlist"); |
228 | 228 | ||
229 | 229 | ||
230 | // Add the playlist area | 230 | // Add the playlist area |
231 | 231 | ||
232 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 232 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
233 | d->playListFrame = vbox3; | 233 | d->playListFrame = vbox3; |
234 | 234 | ||
235 | QGridLayout *layoutF = new QGridLayout( pTab ); | 235 | QGridLayout *layoutF = new QGridLayout( pTab ); |
236 | layoutF->setSpacing( 2); | 236 | layoutF->setSpacing( 2); |
237 | layoutF->setMargin( 2); | 237 | layoutF->setMargin( 2); |
238 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); | 238 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); |
239 | // d->playListFrame ->setMinimumSize(235,260); | ||
240 | 239 | ||
241 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 240 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
242 | 241 | ||
243 | d->selectedFiles = new PlayListSelection( hbox2); | 242 | d->selectedFiles = new PlayListSelection( hbox2); |
244 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 243 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
245 | 244 | ||
246 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 245 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
247 | 246 | ||
248 | 247 | ||
249 | 248 | ||
250 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 249 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
251 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 250 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
252 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 251 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
253 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 252 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
254 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 253 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
255 | 254 | ||
256 | QWidget *aTab; | 255 | QWidget *aTab; |
257 | aTab = new QWidget( tabWidget, "aTab" ); | 256 | aTab = new QWidget( tabWidget, "aTab" ); |
258 | audioView = new QListView( aTab, "Audioview" ); | 257 | audioView = new QListView( aTab, "Audioview" ); |
259 | 258 | ||
260 | QGridLayout *layoutA = new QGridLayout( aTab ); | 259 | QGridLayout *layoutA = new QGridLayout( aTab ); |
261 | layoutA->setSpacing( 2); | 260 | layoutA->setSpacing( 2); |
262 | layoutA->setMargin( 2); | 261 | layoutA->setMargin( 2); |
263 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 262 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
264 | 263 | ||
265 | audioView->addColumn( tr("Title"),140); | 264 | audioView->addColumn( tr("Title"),-1); |
266 | audioView->addColumn(tr("Size"), -1); | 265 | audioView->addColumn(tr("Size"), -1); |
267 | audioView->addColumn(tr("Media"),-1); | 266 | audioView->addColumn(tr("Media"),-1); |
268 | audioView->addColumn( tr( "Path" ), 0 ); | 267 | audioView->addColumn( tr( "Path" ), -1 ); |
269 | 268 | ||
270 | audioView->setColumnAlignment(1, Qt::AlignRight); | 269 | audioView->setColumnAlignment(1, Qt::AlignRight); |
271 | audioView->setColumnAlignment(2, Qt::AlignRight); | 270 | audioView->setColumnAlignment(2, Qt::AlignRight); |
272 | audioView->setAllColumnsShowFocus(TRUE); | 271 | audioView->setAllColumnsShowFocus(TRUE); |
273 | 272 | ||
274 | audioView->setMultiSelection( TRUE ); | 273 | audioView->setMultiSelection( TRUE ); |
275 | audioView->setSelectionMode( QListView::Extended); | 274 | audioView->setSelectionMode( QListView::Extended); |
276 | audioView->setSorting( 3, TRUE ); | 275 | audioView->setSorting( 3, TRUE ); |
277 | 276 | ||
278 | tabWidget->insertTab(aTab,tr("Audio")); | 277 | tabWidget->insertTab(aTab,tr("Audio")); |
279 | 278 | ||
280 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 279 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
281 | 280 | ||
282 | // audioView | 281 | // audioView |
283 | // populateAudioView(); | 282 | // populateAudioView(); |
284 | // videowidget | 283 | // videowidget |
285 | 284 | ||
286 | QWidget *vTab; | 285 | QWidget *vTab; |
287 | vTab = new QWidget( tabWidget, "vTab" ); | 286 | vTab = new QWidget( tabWidget, "vTab" ); |
288 | videoView = new QListView( vTab, "Videoview" ); | 287 | videoView = new QListView( vTab, "Videoview" ); |
289 | 288 | ||
290 | QGridLayout *layoutV = new QGridLayout( vTab ); | 289 | QGridLayout *layoutV = new QGridLayout( vTab ); |
291 | layoutV->setSpacing( 2); | 290 | layoutV->setSpacing( 2); |
292 | layoutV->setMargin( 2); | 291 | layoutV->setMargin( 2); |
293 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 292 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
294 | 293 | ||
295 | videoView->addColumn(tr("Title"),140); | 294 | videoView->addColumn(tr("Title"),-1); |
296 | videoView->addColumn(tr("Size"),-1); | 295 | videoView->addColumn(tr("Size"),-1); |
297 | videoView->addColumn(tr("Media"),-1); | 296 | videoView->addColumn(tr("Media"),-1); |
298 | videoView->addColumn(tr( "Path" ), 0 ); | 297 | videoView->addColumn(tr( "Path" ), -1 ); |
299 | videoView->setColumnAlignment(1, Qt::AlignRight); | 298 | videoView->setColumnAlignment(1, Qt::AlignRight); |
300 | videoView->setColumnAlignment(2, Qt::AlignRight); | 299 | videoView->setColumnAlignment(2, Qt::AlignRight); |
301 | videoView->setAllColumnsShowFocus(TRUE); | 300 | videoView->setAllColumnsShowFocus(TRUE); |
302 | videoView->setMultiSelection( TRUE ); | 301 | videoView->setMultiSelection( TRUE ); |
303 | videoView->setSelectionMode( QListView::Extended); | 302 | videoView->setSelectionMode( QListView::Extended); |
304 | 303 | ||
305 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 304 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
306 | 305 | ||
307 | tabWidget->insertTab( vTab,tr("Video")); | 306 | tabWidget->insertTab( vTab,tr("Video")); |
308 | 307 | ||
309 | QWidget *LTab; | 308 | QWidget *LTab; |
310 | LTab = new QWidget( tabWidget, "LTab" ); | 309 | LTab = new QWidget( tabWidget, "LTab" ); |
311 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 310 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
312 | 311 | ||
313 | QGridLayout *layoutL = new QGridLayout( LTab ); | 312 | QGridLayout *layoutL = new QGridLayout( LTab ); |
314 | layoutL->setSpacing( 2); | 313 | layoutL->setSpacing( 2); |
315 | layoutL->setMargin( 2); | 314 | layoutL->setMargin( 2); |
316 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 315 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
317 | // playLists->setMinimumSize(233,260); | 316 | // playLists->setMinimumSize(233,260); |
318 | 317 | ||
319 | tabWidget->insertTab(LTab,tr("Lists")); | 318 | tabWidget->insertTab(LTab,tr("Lists")); |
320 | 319 | ||
321 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 320 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
322 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 321 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
323 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 322 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
324 | 323 | ||
325 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 324 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
326 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 325 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
327 | 326 | ||
328 | 327 | ||
329 | ///audioView | 328 | ///audioView |
330 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 329 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
331 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 330 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
332 | 331 | ||
333 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 332 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
334 | this,SLOT( playIt( QListViewItem *)) ); | 333 | this,SLOT( playIt( QListViewItem *)) ); |
335 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 334 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
336 | 335 | ||
337 | 336 | ||
338 | //videoView | 337 | //videoView |
339 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 338 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
340 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 339 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
341 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 340 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
342 | this,SLOT( playIt( QListViewItem *)) ); | 341 | this,SLOT( playIt( QListViewItem *)) ); |
343 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 342 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
344 | 343 | ||
345 | //playlists | 344 | //playlists |
346 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 345 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
347 | 346 | ||
348 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 347 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
349 | 348 | ||
350 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 349 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
351 | 350 | ||
352 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 351 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
353 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 352 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
354 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 353 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
355 | 354 | ||
356 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 355 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
357 | 356 | ||
358 | setCentralWidget( vbox5 ); | 357 | setCentralWidget( vbox5 ); |
359 | 358 | ||
360 | Config cfg( "OpiePlayer" ); | 359 | Config cfg( "OpiePlayer" ); |
361 | readConfig( cfg ); | 360 | readConfig( cfg ); |
362 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 361 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
363 | loadList(DocLnk( currentPlaylist)); | 362 | loadList(DocLnk( currentPlaylist)); |
364 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); | 363 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); |
365 | 364 | ||
366 | initializeStates(); | 365 | initializeStates(); |
367 | } | 366 | } |
368 | 367 | ||
369 | 368 | ||
370 | PlayListWidget::~PlayListWidget() { | 369 | PlayListWidget::~PlayListWidget() { |
371 | Config cfg( "OpiePlayer" ); | 370 | Config cfg( "OpiePlayer" ); |
372 | writeConfig( cfg ); | 371 | writeConfig( cfg ); |
373 | 372 | ||
374 | if ( d->current ) | 373 | if ( d->current ) |
375 | delete d->current; | 374 | delete d->current; |
376 | delete d; | 375 | delete d; |
377 | } | 376 | } |
378 | 377 | ||
379 | 378 | ||
380 | void PlayListWidget::initializeStates() { | 379 | void PlayListWidget::initializeStates() { |
381 | 380 | ||
382 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 381 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
383 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 382 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
384 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 383 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
385 | setPlaylist( true); | 384 | setPlaylist( true); |
386 | } | 385 | } |
387 | 386 | ||
388 | 387 | ||
389 | void PlayListWidget::readConfig( Config& cfg ) { | 388 | void PlayListWidget::readConfig( Config& cfg ) { |
390 | cfg.setGroup("PlayList"); | 389 | cfg.setGroup("PlayList"); |
391 | QString currentString = cfg.readEntry("current", "" ); | 390 | QString currentString = cfg.readEntry("current", "" ); |
392 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 391 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
393 | for ( int i = 0; i < noOfFiles; i++ ) { | 392 | for ( int i = 0; i < noOfFiles; i++ ) { |
394 | QString entryName; | 393 | QString entryName; |
395 | entryName.sprintf( "File%i", i + 1 ); | 394 | entryName.sprintf( "File%i", i + 1 ); |
396 | QString linkFile = cfg.readEntry( entryName ); | 395 | QString linkFile = cfg.readEntry( entryName ); |
397 | DocLnk lnk( linkFile ); | 396 | DocLnk lnk( linkFile ); |
398 | if ( lnk.isValid() ) { | 397 | if ( lnk.isValid() ) { |
399 | d->selectedFiles->addToSelection( lnk ); | 398 | d->selectedFiles->addToSelection( lnk ); |
400 | } | 399 | } |
401 | } | 400 | } |
402 | d->selectedFiles->setSelectedItem( currentString); | 401 | d->selectedFiles->setSelectedItem( currentString); |
403 | } | 402 | } |
404 | 403 | ||
405 | 404 | ||
406 | void PlayListWidget::writeConfig( Config& cfg ) const { | 405 | void PlayListWidget::writeConfig( Config& cfg ) const { |
407 | 406 | ||
408 | d->selectedFiles->writeCurrent( cfg); | 407 | d->selectedFiles->writeCurrent( cfg); |
409 | cfg.setGroup("PlayList"); | 408 | cfg.setGroup("PlayList"); |
410 | int noOfFiles = 0; | 409 | int noOfFiles = 0; |
411 | d->selectedFiles->first(); | 410 | d->selectedFiles->first(); |
412 | do { | 411 | do { |