Commit 734452c8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - fix some saving and reading size bugs. Patch by Andre Weber

parent 2279878d
......@@ -293,7 +293,15 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
move( settings->value( "pos", QPoint( 0, 0 ) ).toPoint() );
resize( settings->value( "size", QSize( 350, 60 ) ).toSize() );
QSize newSize = settings->value( "size", QSize( 350, 60 ) ).toSize();
if( newSize.isValid() )
{
resize( newSize );
}
else
{
msg_Warn( p_intf, "Invalid size in constructor" );
}
int tgPlay = settings->value( "playlist-visible", 0 ).toInt();
settings->endGroup();
......@@ -738,8 +746,11 @@ void MainInterface::togglePlaylist()
settings->endGroup();
settings->beginGroup( "playlist" );
dockPL->move( settings->value( "pos", QPoint( 0,0 ) ).toPoint() );
dockPL->resize( settings->value( "size", QSize( 400, 300 ) ).toSize() );
QSize newSize = settings->value( "size", QSize( 400, 300 ) ).toSize();
if( newSize.isValid() )
dockPL->resize( newSize );
settings->endGroup();
dockPL->show();
playlistVisible = true;
}
......
......@@ -58,7 +58,10 @@ protected:
{
QSettings settings( "vlc", "vlc-qt-interface" );
settings.beginGroup( name );
resize( settings.value( "size", defSize ).toSize() );
/* never trust any saved size ;-) */
QSize newSize = settings.value( "size", defSize ).toSize();
if( newSize.isValid() )
resize( newSize );
move( settings.value( "pos", defPos ).toPoint() );
settings.endGroup();
}
......@@ -66,7 +69,10 @@ protected:
{
QSettings settings( "vlc", "vlc-qt-interface" );
settings.beginGroup( name );
settings.setValue ("size", size() );
/* only save valid sizes ... */
QSize currentsize = size();
if( currentsize.isValid() )
settings.setValue ("size", currentsize );
settings.setValue( "pos", pos() );
settings.endGroup();
}
......@@ -156,18 +162,27 @@ protected:
move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
settings.endGroup();
}
void readSettings( QString name )
{
QSettings settings( "vlc", "vlc-qt-interface" );
settings.beginGroup( name );
mainSize = settings.value( "size", QSize( 0,0 ) ).toSize();
if( !mainSize.isValid() )
{
mainSize = QSize(0,0);
}
settings.endGroup();
}
void writeSettings( QString name )
{
QSettings settings( "vlc", "vlc-qt-interface" );
settings.beginGroup( name );
settings.setValue ("size", size() );
/* only save valid sizes ... */
QSize currentsize = size();
if( currentsize.isValid() )
settings.setValue ("size", currentsize );
settings.setValue( "pos", pos() );
settings.endGroup();
}
......
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