Skip to content

Commit 3d6e468

Browse files
committed
Updated UI defaults (toolbars and panels) for app and composer
1 parent 6f82a89 commit 3d6e468

File tree

3 files changed

+149
-81
lines changed

3 files changed

+149
-81
lines changed

scripts/mkuidefaults.py

+14
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ def chunks(l, n):
2323

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

26+
for chunk in chunks(ba,16):
27+
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
28+
29+
ba = s.value("/Composer/geometry").toByteArray()
30+
31+
f.write( "};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n" )
32+
33+
for chunk in chunks(ba,16):
34+
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
35+
36+
f.write( "};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n" )
37+
38+
ba = s.value("/ComposerUI/state").toByteArray()
39+
2640
for chunk in chunks(ba,16):
2741
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
2842

src/app/composer/qgscomposer.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -1756,14 +1756,22 @@ void QgsComposer::saveWindowState()
17561756
settings.setValue( "/ComposerUI/state", saveState() );
17571757
}
17581758

1759+
#include "ui_defaults.h"
1760+
17591761
void QgsComposer::restoreWindowState()
17601762
{
1763+
// restore the toolbar and dock widgets postions using Qt4 settings API
17611764
QSettings settings;
1762-
if ( ! restoreState( settings.value( "/ComposerUI/state" ).toByteArray() ) )
1765+
1766+
if ( !restoreState( settings.value( "/ComposerUI/state", QByteArray::fromRawData(( char * )defaultComposerUIstate, sizeof defaultComposerUIstate ) ).toByteArray() ) )
1767+
{
1768+
QgsDebugMsg( "restore of composer UI state failed" );
1769+
}
1770+
// restore window geometry
1771+
if ( !restoreGeometry( settings.value( "/Composer/geometry", QByteArray::fromRawData(( char * )defaultComposerUIgeometry, sizeof defaultComposerUIgeometry ) ).toByteArray() ) )
17631772
{
1764-
QgsDebugMsg( "RESTORE STATE FAILED!!" );
1773+
QgsDebugMsg( "restore of composer UI geometry failed" );
17651774
}
1766-
restoreGeometry( settings.value( "/Composer/geometry" ).toByteArray() );
17671775
}
17681776

17691777
void QgsComposer::writeXML( QDomDocument& doc )

0 commit comments

Comments
 (0)