# HG changeset patch # User Teemu Piippo # Date 1521899915 -7200 # Node ID 299d90af2fc3f8df8ee803b0e582297e18678b29 # Parent 5530161fcd479b57747572708ce19a7227d69c83 improved formatting of generated configuration code diff -r 5530161fcd47 -r 299d90af2fc3 tools/configcollector.py --- a/tools/configcollector.py Sat Mar 24 15:54:41 2018 +0200 +++ b/tools/configcollector.py Sat Mar 24 15:58:35 2018 +0200 @@ -158,12 +158,12 @@ device.write( 'const QMap& config::defaults()\n' '{\n' - '\tstatic const QMap defaults {' + '\tstatic const QMap defaults {\n' ) for declaration in self.declarations.values(): - device.write('\t{{"{name}", QVariant::fromValue<{type}>({default})}},\n'.format(**declaration)) - device.write('};\n' - 'return defaults;\n' + device.write('\t\t{{"{name}", QVariant::fromValue<{type}>({default})}},\n'.format(**declaration)) + device.write('\t};\n' + '\treturn defaults;\n' '}\n' '\n') device.write('bool config::exists(const QString& name)\n') @@ -186,7 +186,7 @@ for declaration in self.declarations.values(): device.write('void config::{writegate}({typereference} value)\n'.format(**declaration)) device.write('{\n') - device.write('\tif(value != {default})\n'.format(**declaration)) + device.write('\tif (value != {default})\n'.format(**declaration)) device.write('\t\t::settingsObject().setValue("{name}", QVariant::fromValue<{type}>(value));\n'.format(**declaration)) device.write('\telse\n') device.write('\t\t::settingsObject().remove("{name}");\n'.format(**declaration))