Commit 65559b35 authored by Ilkka Ollakka's avatar Ilkka Ollakka

Qt4: limit beginGroup()/endGroup() usage

It should fix #2082 and also that vlc didn't restore playlist viewmode
properly, as settings where in MainWindow-group when those widgets are
created.
parent 0d0d4544
...@@ -128,7 +128,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -128,7 +128,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Set the other interface settings */ /* Set the other interface settings */
settings = getSettings(); settings = getSettings();
settings->beginGroup( "MainWindow" );
#ifdef WIN32 #ifdef WIN32
/* Volume keys */ /* Volume keys */
...@@ -136,9 +135,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -136,9 +135,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
#endif #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 * UI and Widgets design
...@@ -240,13 +238,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -240,13 +238,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Final Sizing, restoration and placement of the interface */ /* Final Sizing, restoration and placement of the interface */
settings->beginGroup( "MainWindow" ); if( settings->value( "MainWindow/playlist-visible", false ).toBool() )
if( settings->value( "playlist-visible", false ).toBool() )
togglePlaylist(); togglePlaylist();
QVLCTools::restoreWidgetPosition( settings, this, QSize(600, 420) ); QVLCTools::restoreWidgetPosition( settings, this, QSize(600, 420) );
settings->endGroup();
b_interfaceFullScreen = isFullScreen(); b_interfaceFullScreen = isFullScreen();
...@@ -286,8 +281,8 @@ MainInterface::~MainInterface() ...@@ -286,8 +281,8 @@ MainInterface::~MainInterface()
delete fullscreenControls; delete fullscreenControls;
/* Save states */ /* Save states */
settings->beginGroup( "MainWindow" );
settings->beginGroup("MainWindow");
settings->setValue( "pl-dock-status", b_plDocked ); settings->setValue( "pl-dock-status", b_plDocked );
/* Save playlist state */ /* Save playlist state */
if( playlistWidget ) if( playlistWidget )
...@@ -300,12 +295,11 @@ MainInterface::~MainInterface() ...@@ -300,12 +295,11 @@ MainInterface::~MainInterface()
/* Save the stackCentralW sizes */ /* Save the stackCentralW sizes */
settings->setValue( "bgSize", stackWidgetsSizes[bgWidget] ); settings->setValue( "bgSize", stackWidgetsSizes[bgWidget] );
settings->setValue( "playlistSize", stackWidgetsSizes[playlistWidget] ); settings->setValue( "playlistSize", stackWidgetsSizes[playlistWidget] );
settings->endGroup();
/* Save this size */ /* Save this size */
QVLCTools::saveWidgetPosition(settings, this); QVLCTools::saveWidgetPosition(settings, this);
settings->endGroup();
/* Save undocked playlist size */ /* Save undocked playlist size */
if( playlistWidget && !isPlDocked() ) if( playlistWidget && !isPlDocked() )
QVLCTools::saveWidgetPosition( p_intf, "Playlist", playlistWidget ); QVLCTools::saveWidgetPosition( p_intf, "Playlist", playlistWidget );
...@@ -339,14 +333,13 @@ void MainInterface::recreateToolbars() ...@@ -339,14 +333,13 @@ void MainInterface::recreateToolbars()
{ {
bool b_adv = getControlsVisibilityStatus() & CONTROLS_ADVANCED; bool b_adv = getControlsVisibilityStatus() & CONTROLS_ADVANCED;
settings->beginGroup( "MainWindow" );
delete controls; delete controls;
delete inputC; delete inputC;
controls = new ControlsWidget( p_intf, b_adv, this ); controls = new ControlsWidget( p_intf, b_adv, this );
inputC = new InputControlsWidget( p_intf, this ); inputC = new InputControlsWidget( p_intf, this );
mainLayout->insertWidget( 2, inputC ); mainLayout->insertWidget( 2, inputC );
mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3, mainLayout->insertWidget( settings->value( "MainWindow/ToolbarPos", 0 ).toInt() ? 0: 3,
controls ); controls );
if( fullscreenControls ) if( fullscreenControls )
...@@ -356,7 +349,6 @@ void MainInterface::recreateToolbars() ...@@ -356,7 +349,6 @@ void MainInterface::recreateToolbars()
CONNECT( fullscreenControls, keyPressed( QKeyEvent * ), CONNECT( fullscreenControls, keyPressed( QKeyEvent * ),
this, handleKeyPress( QKeyEvent * ) ); this, handleKeyPress( QKeyEvent * ) );
} }
settings->endGroup();
} }
void MainInterface::reloadPrefs() void MainInterface::reloadPrefs()
...@@ -402,14 +394,13 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -402,14 +394,13 @@ void MainInterface::createMainWidget( QSettings *settings )
} }
mainLayout->insertWidget( 1, stackCentralW ); mainLayout->insertWidget( 1, stackCentralW );
settings->beginGroup( "MainWindow" ); stackWidgetsSizes[bgWidget] = settings->value( "MainWindow/bgSize", QSize( 600, 0 ) ).toSize();
stackWidgetsSizes[bgWidget] = settings->value( "bgSize", QSize( 600, 0 ) ).toSize();
/* Resize even if no-auto-resize, because we are at creation */ /* Resize even if no-auto-resize, because we are at creation */
resizeStack( stackWidgetsSizes[bgWidget].width(), stackWidgetsSizes[bgWidget].height() ); resizeStack( stackWidgetsSizes[bgWidget].width(), stackWidgetsSizes[bgWidget].height() );
/* Create the CONTROLS Widget */ /* Create the CONTROLS Widget */
controls = new ControlsWidget( p_intf, 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 ); inputC = new InputControlsWidget( p_intf, this );
mainLayout->insertWidget( 2, inputC ); mainLayout->insertWidget( 2, inputC );
...@@ -423,7 +414,6 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -423,7 +414,6 @@ void MainInterface::createMainWidget( QSettings *settings )
visualSelector->hide(); visualSelector->hide();
#endif #endif
settings->endGroup();
/* Enable the popup menu in the MI */ /* Enable the popup menu in the MI */
main->setContextMenuPolicy( Qt::CustomContextMenu ); main->setContextMenuPolicy( Qt::CustomContextMenu );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment