1
1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2008 Ricardo Villalba <rvm@escomposlinux.org>
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
4
4
This program is free software; you can redistribute it and/or modify
5
5
it under the terms of the GNU General Public License as published by
76
78
connect( showAllAct, SIGNAL(triggered()),
77
79
this, SLOT(toggleShowAll()) );
79
82
context_menu = new QMenu(this);
80
83
context_menu->addAction(showAllAct);
81
84
context_menu->addSeparator();
116
119
playlistdock->setFloating(true); // Floating by default
118
121
connect( playlistdock, SIGNAL(closed()), this, SLOT(playlistClosed()) );
119
connect( playlistdock, SIGNAL(docked()), this, SLOT(stretchWindow()) );
120
connect( playlistdock, SIGNAL(undocked()), this, SLOT(shrinkWindow()) );
122
#if USE_DOCK_TOPLEVEL_EVENT
123
connect( playlistdock, SIGNAL(topLevelChanged(bool)),
124
this, SLOT(dockTopLevelChanged(bool)) );
126
connect( playlistdock, SIGNAL(visibilityChanged(bool)),
127
this, SLOT(dockVisibilityChanged(bool)) );
128
#endif // USE_DOCK_TOPLEVEL_EVENT
122
130
ignore_playlist_events = false;
131
#endif // DOCK_PLAYLIST
125
133
retranslateStrings();
361
369
BaseGui::aboutToEnterFullscreen();
363
371
#if DOCK_PLAYLIST
372
playlistdock->setAllowedAreas(Qt::NoDockWidgetArea);
374
int playlist_screen = QApplication::desktop()->screenNumber(playlistdock);
375
int mainwindow_screen = QApplication::desktop()->screenNumber(this);
376
qDebug("BaseGuiPlus::aboutToEnterFullscreen: mainwindow screen: %d, playlist screen: %d", mainwindow_screen, playlist_screen);
364
378
fullscreen_playlist_was_visible = playlistdock->isVisible();
365
379
fullscreen_playlist_was_floating = playlistdock->isFloating();
366
//showPlaylistAct->setEnabled(false);
367
381
ignore_playlist_events = true;
368
playlistdock->setFloating(true);
369
playlistdock->hide();
370
//showPlaylistAct->setChecked(false);
371
//playlist_state = saveState();
383
// Hide the playlist if it's in the same screen as the main window
384
if ((playlist_screen == mainwindow_screen) /* ||
385
(!fullscreen_playlist_was_floating) */ )
387
playlistdock->setFloating(true);
388
playlistdock->hide();
378
396
BaseGui::aboutToExitFullscreen();
380
398
#if DOCK_PLAYLIST
399
playlistdock->setAllowedAreas(Qt::TopDockWidgetArea |
400
Qt::BottomDockWidgetArea
401
#if PLAYLIST_ON_SIDES
402
| Qt::LeftDockWidgetArea |
403
Qt::RightDockWidgetArea
381
407
if (fullscreen_playlist_was_visible) {
382
408
playlistdock->show();
384
410
playlistdock->setFloating( fullscreen_playlist_was_floating );
385
//restoreState( playlist_state );
386
411
ignore_playlist_events = false;
387
//showPlaylistAct->setEnabled(true);
422
446
#if DOCK_PLAYLIST
423
447
void BaseGuiPlus::showPlaylist(bool b) {
448
qDebug("BaseGuiPlus::showPlaylist: %d", b);
449
qDebug("BaseGuiPlus::showPlaylist (before): playlist visible: %d", playlistdock->isVisible());
450
qDebug("BaseGuiPlus::showPlaylist (before): playlist position: %d, %d", playlistdock->pos().x(), playlistdock->pos().y());
451
qDebug("BaseGuiPlus::showPlaylist (before): playlist size: %d x %d", playlistdock->size().width(), playlistdock->size().height());
425
454
playlistdock->hide();
427
456
exitFullscreenIfNeeded();
428
457
playlistdock->show();
459
// Check if playlist is outside of the screen
460
if (playlistdock->isFloating()) {
461
if (!DesktopInfo::isInsideScreen(playlistdock)) {
462
qWarning("BaseGuiPlus::showPlaylist: playlist is outside of the screen");
463
playlistdock->move(0,0);
430
467
//updateWidgets();
469
qDebug("BaseGuiPlus::showPlaylist (after): playlist visible: %d", playlistdock->isVisible());
470
qDebug("BaseGuiPlus::showPlaylist (after): playlist position: %d, %d", playlistdock->pos().x(), playlistdock->pos().y());
471
qDebug("BaseGuiPlus::showPlaylist (after): playlist size: %d x %d", playlistdock->size().width(), playlistdock->size().height());
433
475
void BaseGuiPlus::playlistClosed() {
434
476
showPlaylistAct->setChecked(false);
479
#if !USE_DOCK_TOPLEVEL_EVENT
480
void BaseGuiPlus::dockVisibilityChanged(bool visible) {
481
qDebug("BaseGuiPlus::dockVisibilityChanged: %d", visible);
483
if (!playlistdock->isFloating()) {
484
if (!visible) shrinkWindow(); else stretchWindow();
490
void BaseGuiPlus::dockTopLevelChanged(bool floating) {
491
qDebug("BaseGuiPlus::dockTopLevelChanged: %d", floating);
493
if (floating) shrinkWindow(); else stretchWindow();
437
497
void BaseGuiPlus::stretchWindow() {
438
498
qDebug("BaseGuiPlus::stretchWindow");
439
499
if ((ignore_playlist_events) || (pref->resize_method!=Preferences::Always)) return;
499
559
// Convenience functions intended for other GUI's
500
560
TimeSliderAction * BaseGuiPlus::createTimeSliderAction(QWidget * parent) {
501
561
TimeSliderAction * timeslider_action = new TimeSliderAction( parent );
562
timeslider_action->setObjectName("timeslider_action");
564
#ifdef SEEKBAR_RESOLUTION
565
connect( timeslider_action, SIGNAL( posChanged(int) ),
566
core, SLOT(goToPosition(int)) );
567
connect( core, SIGNAL(positionChanged(int)),
568
timeslider_action, SLOT(setPos(int)) );
502
570
connect( timeslider_action, SIGNAL( posChanged(int) ),
503
571
core, SLOT(goToPos(int)) );
572
connect( core, SIGNAL(posChanged(int)),
573
timeslider_action, SLOT(setPos(int)) );
504
575
connect( timeslider_action, SIGNAL( draggingPos(int) ),
505
576
this, SLOT(displayGotoTime(int)) );
506
connect( core, SIGNAL(posChanged(int)),
507
timeslider_action, SLOT(setPos(int)) );
508
577
#if ENABLE_DELAYED_DRAGGING
509
578
timeslider_action->setDragDelay( pref->time_slider_drag_delay );
520
589
VolumeSliderAction * BaseGuiPlus::createVolumeSliderAction(QWidget * parent) {
521
590
VolumeSliderAction * volumeslider_action = new VolumeSliderAction(parent);
591
volumeslider_action->setObjectName("volumeslider_action");
522
593
connect( volumeslider_action, SIGNAL( valueChanged(int) ),
523
594
core, SLOT( setVolume(int) ) );
524
595
connect( core, SIGNAL(volumeChanged(int)),