Skip to content

Commit

Permalink
Updated UI defaults (toolbars and panels) for app and composer
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Jul 10, 2013
1 parent 6f82a89 commit 3d6e468
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 81 deletions.
14 changes: 14 additions & 0 deletions scripts/mkuidefaults.py
Expand Up @@ -23,6 +23,20 @@ def chunks(l, n):

ba = s.value("/UI/state").toByteArray()

for chunk in chunks(ba,16):
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )

ba = s.value("/Composer/geometry").toByteArray()

f.write( "};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n" )

for chunk in chunks(ba,16):
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )

f.write( "};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n" )

ba = s.value("/ComposerUI/state").toByteArray()

for chunk in chunks(ba,16):
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )

Expand Down
14 changes: 11 additions & 3 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -1756,14 +1756,22 @@ void QgsComposer::saveWindowState()
settings.setValue( "/ComposerUI/state", saveState() );
}

#include "ui_defaults.h"

void QgsComposer::restoreWindowState()
{
// restore the toolbar and dock widgets postions using Qt4 settings API
QSettings settings;
if ( ! restoreState( settings.value( "/ComposerUI/state" ).toByteArray() ) )

if ( !restoreState( settings.value( "/ComposerUI/state", QByteArray::fromRawData(( char * )defaultComposerUIstate, sizeof defaultComposerUIstate ) ).toByteArray() ) )
{
QgsDebugMsg( "restore of composer UI state failed" );
}
// restore window geometry
if ( !restoreGeometry( settings.value( "/Composer/geometry", QByteArray::fromRawData(( char * )defaultComposerUIgeometry, sizeof defaultComposerUIgeometry ) ).toByteArray() ) )
{
QgsDebugMsg( "RESTORE STATE FAILED!!" );
QgsDebugMsg( "restore of composer UI geometry failed" );
}
restoreGeometry( settings.value( "/Composer/geometry" ).toByteArray() );
}

void QgsComposer::writeXML( QDomDocument& doc )
Expand Down

0 comments on commit 3d6e468

Please sign in to comment.