Commit e5c9c3b1 authored by Jakob Leben's avatar Jakob Leben

Qt: settings

MainInterface:
  Use same settings context when creating and deleting playlistWidget
  Make beginGroup() / endGroup() pairs explicit.
StandardPLPanel:
  Use same settings context whenever creating treeView
parent d4297619
...@@ -119,10 +119,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -119,10 +119,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
getSettings()->beginGroup("Playlist"); getSettings()->beginGroup("Playlist");
int i_viewMode = getSettings()->value( "view-mode", TREE_VIEW ).toInt(); int i_viewMode = getSettings()->value( "view-mode", TREE_VIEW ).toInt();
showView( i_viewMode );
getSettings()->endGroup(); getSettings()->endGroup();
showView( i_viewMode );
DCONNECT( THEMIM, leafBecameParent( input_item_t *), DCONNECT( THEMIM, leafBecameParent( input_item_t *),
this, browseInto( input_item_t * ) ); this, browseInto( input_item_t * ) );
...@@ -311,6 +312,8 @@ void StandardPLPanel::createTreeView() ...@@ -311,6 +312,8 @@ void StandardPLPanel::createTreeView()
/* setModel after setSortingEnabled(true), or the model will sort immediately! */ /* setModel after setSortingEnabled(true), or the model will sort immediately! */
treeView->setModel( model ); treeView->setModel( model );
getSettings()->beginGroup("Playlist");
if( getSettings()->contains( "headerStateV2" ) ) if( getSettings()->contains( "headerStateV2" ) )
{ {
treeView->header()->restoreState( treeView->header()->restoreState(
...@@ -326,6 +329,8 @@ void StandardPLPanel::createTreeView() ...@@ -326,6 +329,8 @@ void StandardPLPanel::createTreeView()
} }
} }
getSettings()->endGroup();
/* Connections for the TreeView */ /* Connections for the TreeView */
CONNECT( treeView, activated( const QModelIndex& ), CONNECT( treeView, activated( const QModelIndex& ),
this, activate( const QModelIndex& ) ); this, activate( const QModelIndex& ) );
......
...@@ -131,7 +131,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -131,7 +131,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
**/ **/
mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize(); mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize();
mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize(); mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize();
settings->endGroup( );
/************** /**************
* Status Bar * * Status Bar *
...@@ -308,8 +308,6 @@ MainInterface::~MainInterface() ...@@ -308,8 +308,6 @@ MainInterface::~MainInterface()
{ {
settings->setValue( "playlist-visible", playlistWidget->isVisible() ); // FIXME settings->setValue( "playlist-visible", playlistWidget->isVisible() ); // FIXME
} }
delete playlistWidget;
} }
settings->setValue( "adv-controls", settings->setValue( "adv-controls",
...@@ -324,6 +322,7 @@ MainInterface::~MainInterface() ...@@ -324,6 +322,7 @@ MainInterface::~MainInterface()
QVLCTools::saveWidgetPosition(settings, this); QVLCTools::saveWidgetPosition(settings, this);
settings->endGroup(); settings->endGroup();
delete playlistWidget;
delete statusBar(); delete statusBar();
/* Unregister callbacks */ /* Unregister callbacks */
...@@ -376,6 +375,8 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -376,6 +375,8 @@ void MainInterface::createMainWidget( QSettings *settings )
} }
mainLayout->insertWidget( 1, stackCentralW ); mainLayout->insertWidget( 1, stackCentralW );
settings->beginGroup( "MainWindow" );
/* 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( "adv-controls", false ).toBool(), this );
...@@ -392,7 +393,7 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -392,7 +393,7 @@ void MainInterface::createMainWidget( QSettings *settings )
visualSelector->hide(); visualSelector->hide();
#endif #endif
getSettings()->endGroup(); 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