X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fmain_interface.cpp;h=89d4f62f6a66e5b3669fcbe60be9559e4b78a416;hb=f4c037efd2d3cde44daa1a58c7042fecc32b2177;hp=7937a8d3a5fc1981d3fdcf1591e37820aea57148;hpb=3d8c142e918c8a5672962e99130102889ad95058;p=vlc diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 7937a8d3a5..89d4f62f6a 100644 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -81,9 +81,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) videoWidget = NULL; playlistWidget = NULL; stackCentralOldWidget= NULL; -#ifndef HAVE_MAEMO sysTray = NULL; -#endif fullscreenControls = NULL; cryptedLabel = NULL; controls = NULL; @@ -112,6 +110,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) #ifdef Q_WS_MAC setAttribute( Qt::WA_MacBrushedMetal ); #endif + setAttribute( Qt::WA_QuitOnClose, false ); /* Is video in embedded in the UI or not */ b_videoEmbedded = var_InheritBool( p_intf, "embedded-video" ); @@ -130,7 +129,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) /* Set the other interface settings */ settings = getSettings(); - settings->beginGroup( "MainWindow" ); #ifdef WIN32 /* Volume keys */ @@ -138,9 +136,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) #endif /* */ - b_plDocked = getSettings()->value( "pl-dock-status", true ).toBool(); + b_plDocked = getSettings()->value( "MainWindow/pl-dock-status", true ).toBool(); - settings->endGroup( ); /************************** * UI and Widgets design @@ -150,7 +147,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) /************ * Menu Bar * ************/ - QVLCMenu::createMenuBar( this, p_intf ); + VLCMenuBar::createMenuBar( this, p_intf ); CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, destroyPopupMenu() ); @@ -242,13 +239,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) /* Final Sizing, restoration and placement of the interface */ - settings->beginGroup( "MainWindow" ); - - if( settings->value( "playlist-visible", false ).toBool() ) + if( settings->value( "MainWindow/playlist-visible", false ).toBool() ) togglePlaylist(); QVLCTools::restoreWidgetPosition( settings, this, QSize(600, 420) ); - settings->endGroup(); b_interfaceFullScreen = isFullScreen(); @@ -288,8 +282,8 @@ MainInterface::~MainInterface() delete fullscreenControls; /* Save states */ - settings->beginGroup( "MainWindow" ); + settings->beginGroup("MainWindow"); settings->setValue( "pl-dock-status", b_plDocked ); /* Save playlist state */ if( playlistWidget ) @@ -302,12 +296,11 @@ MainInterface::~MainInterface() /* Save the stackCentralW sizes */ settings->setValue( "bgSize", stackWidgetsSizes[bgWidget] ); settings->setValue( "playlistSize", stackWidgetsSizes[playlistWidget] ); + settings->endGroup(); /* Save this size */ QVLCTools::saveWidgetPosition(settings, this); - settings->endGroup(); - /* Save undocked playlist size */ if( playlistWidget && !isPlDocked() ) QVLCTools::saveWidgetPosition( p_intf, "Playlist", playlistWidget ); @@ -341,14 +334,13 @@ void MainInterface::recreateToolbars() { bool b_adv = getControlsVisibilityStatus() & CONTROLS_ADVANCED; - settings->beginGroup( "MainWindow" ); delete controls; delete inputC; controls = new ControlsWidget( p_intf, b_adv, this ); inputC = new InputControlsWidget( p_intf, this ); mainLayout->insertWidget( 2, inputC ); - mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3, + mainLayout->insertWidget( settings->value( "MainWindow/ToolbarPos", 0 ).toInt() ? 0: 3, controls ); if( fullscreenControls ) @@ -358,7 +350,6 @@ void MainInterface::recreateToolbars() CONNECT( fullscreenControls, keyPressed( QKeyEvent * ), this, handleKeyPress( QKeyEvent * ) ); } - settings->endGroup(); } void MainInterface::reloadPrefs() @@ -404,14 +395,13 @@ void MainInterface::createMainWidget( QSettings *settings ) } mainLayout->insertWidget( 1, stackCentralW ); - settings->beginGroup( "MainWindow" ); - stackWidgetsSizes[bgWidget] = settings->value( "bgSize", QSize( 600, 0 ) ).toSize(); + stackWidgetsSizes[bgWidget] = settings->value( "MainWindow/bgSize", QSize( 600, 0 ) ).toSize(); /* Resize even if no-auto-resize, because we are at creation */ resizeStack( stackWidgetsSizes[bgWidget].width(), stackWidgetsSizes[bgWidget].height() ); /* Create the CONTROLS Widget */ controls = new ControlsWidget( p_intf, - settings->value( "adv-controls", false ).toBool(), this ); + settings->value( "MainWindow/adv-controls", false ).toBool(), this ); inputC = new InputControlsWidget( p_intf, this ); mainLayout->insertWidget( 2, inputC ); @@ -425,7 +415,6 @@ void MainInterface::createMainWidget( QSettings *settings ) visualSelector->hide(); #endif - settings->endGroup(); /* Enable the popup menu in the MI */ main->setContextMenuPolicy( Qt::CustomContextMenu ); @@ -444,7 +433,6 @@ void MainInterface::createMainWidget( QSettings *settings ) inline void MainInterface::initSystray() { -#ifndef HAVE_MAEMO bool b_systrayAvailable = QSystemTrayIcon::isSystemTrayAvailable(); bool b_systrayWanted = var_InheritBool( p_intf, "qt-system-tray" ); @@ -461,7 +449,6 @@ inline void MainInterface::initSystray() if( b_systrayAvailable && b_systrayWanted ) createSystray(); -#endif } inline void MainInterface::createStatusBar() @@ -584,12 +571,12 @@ inline void MainInterface::showTab( QWidget *widget ) void MainInterface::destroyPopupMenu() { - QVLCMenu::PopupMenu( p_intf, false ); + VLCMenuBar::PopupMenu( p_intf, false ); } void MainInterface::popupMenu( const QPoint & ) { - QVLCMenu::PopupMenu( p_intf, true ); + VLCMenuBar::PopupMenu( p_intf, true ); } void MainInterface::toggleFSC() @@ -665,7 +652,8 @@ void MainInterface::releaseVideoSlot( void ) if( stackCentralW->currentWidget() == videoWidget ) restoreStackOldWidget(); - else if( playlistWidget->artContainer->currentWidget() == videoWidget ) + else if( playlistWidget && + playlistWidget->artContainer->currentWidget() == videoWidget ) { playlistWidget->artContainer->setCurrentIndex( 0 ); stackCentralW->addWidget( videoWidget ); @@ -702,6 +690,14 @@ void MainInterface::setVideoFullScreen( bool fs ) msg_Dbg( p_intf, "Moving video to correct screen"); move( QPoint( screenres.x(), screenres.y() ) ); } + + /* */ + if( playlistWidget != NULL && playlistWidget->artContainer->currentWidget() == videoWidget ) + { + showTab( videoWidget ); + } + + /* */ setMinimalView( true ); setInterfaceFullScreen( true ); } @@ -990,7 +986,6 @@ void MainInterface::showBuffering( float f_cache ) /***************************************************************************** * Systray Icon and Systray Menu *****************************************************************************/ -#ifndef HAVE_MAEMO /** * Create a SystemTray icon and a menu that would go with it. * Connects to a click handler on the icon. @@ -1008,7 +1003,7 @@ void MainInterface::createSystray() systrayMenu = new QMenu( qtr( "VLC media player" ), this ); systrayMenu->setIcon( iconVLC ); - QVLCMenu::updateSystrayMenu( this, p_intf, true ); + VLCMenuBar::updateSystrayMenu( this, p_intf, true ); sysTray->show(); CONNECT( sysTray, activated( QSystemTrayIcon::ActivationReason ), @@ -1068,7 +1063,7 @@ void MainInterface::toggleUpdateSystrayMenu() #endif } if( sysTray ) - QVLCMenu::updateSystrayMenu( this, p_intf ); + VLCMenuBar::updateSystrayMenu( this, p_intf ); } /* First Item of the systray menu */ @@ -1080,14 +1075,14 @@ void MainInterface::showUpdateSystrayMenu() showNormal(); activateWindow(); - QVLCMenu::updateSystrayMenu( this, p_intf ); + VLCMenuBar::updateSystrayMenu( this, p_intf ); } /* First Item of the systray menu */ void MainInterface::hideUpdateSystrayMenu() { hide(); - QVLCMenu::updateSystrayMenu( this, p_intf ); + VLCMenuBar::updateSystrayMenu( this, p_intf ); } /* Click on systray Icon */ @@ -1099,7 +1094,7 @@ void MainInterface::handleSystrayClick( case QSystemTrayIcon::Trigger: case QSystemTrayIcon::DoubleClick: #ifdef Q_WS_MAC - QVLCMenu::updateSystrayMenu( this, p_intf ); + VLCMenuBar::updateSystrayMenu( this, p_intf ); #else toggleUpdateSystrayMenu(); #endif @@ -1134,7 +1129,7 @@ void MainInterface::updateSystrayTooltipName( const QString& name ) } } - QVLCMenu::updateSystrayMenu( this, p_intf ); + VLCMenuBar::updateSystrayMenu( this, p_intf ); } /** @@ -1155,9 +1150,8 @@ void MainInterface::updateSystrayTooltipStatus( int i_status ) sysTray->setToolTip( qtr( "VLC media player" ) ); break; } - QVLCMenu::updateSystrayMenu( this, p_intf ); + VLCMenuBar::updateSystrayMenu( this, p_intf ); } -#endif void MainInterface::changeEvent(QEvent *event) { @@ -1201,7 +1195,7 @@ void MainInterface::dropEvent(QDropEvent *event) void MainInterface::dropEventPlay( QDropEvent *event, bool b_play ) { - if( event->possibleActions() & Qt::CopyAction ) + if( event->possibleActions() & ( Qt::CopyAction | Qt::MoveAction ) ) event->setDropAction( Qt::CopyAction ); else return; @@ -1323,13 +1317,11 @@ void MainInterface::emitBoss() void MainInterface::setBoss() { THEMIM->pause(); -#ifndef HAVE_MAEMO if( sysTray ) { hide(); } else -#endif { showMinimized(); }