Skip to content
Permalink
Browse files

Merge pull request #710 from pka/uidefaults

Updated UI defaults (toolbars and panels) for app and composer
  • Loading branch information
jef-n committed Jul 10, 2013
2 parents 42d57d6 + 3d6e468 commit 510baa3283a9ac701de1a8d4fb8a6e21f188028a
Showing with 149 additions and 81 deletions.
  1. +14 −0 scripts/mkuidefaults.py
  2. +11 −3 src/app/composer/qgscomposer.cpp
  3. +124 −78 src/app/ui_defaults.h
@@ -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 ) ) )

@@ -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 )

0 comments on commit 510baa3

Please sign in to comment.
You can’t perform that action at this time.