17#include "pencilsettings.h"
27 static QSettings settings(PENCIL2D, PENCIL2D);
29 if ( !settings.contains(
"InitPencilSetting") )
31 restoreToDefaultSetting();
32 settings.setValue(
"InitPencilSetting",
true);
37void restoreToDefaultSetting()
41 s.setValue(
"penWidth", 2.0);
42 s.setValue(
"pencilWidth", 4.0);
43 s.setValue(
"polyLineWidth", 1.5);
44 s.setValue(
"eraserWidth", 10.0);
45 s.setValue(
"brushWidth", 15.0);
46 s.setValue(
"brushFeather", 15.0);
47 s.setValue(
"brushUseFeather",
true);
49 s.setValue(SETTING_AUTO_SAVE_NUMBER, 15);
50 s.setValue(SETTING_TOOL_CURSOR,
true);
53 qDebug(
"restored default tools");
56void checkExistingShortcuts()
60 QSettings curSetting( PENCIL2D, PENCIL2D );
61 foreach (
QString pShortcutsKey, defaultKey.allKeys())
63 if ( ! curSetting.contains( pShortcutsKey ) )
65 curSetting.setValue(pShortcutsKey, defaultKey.value(pShortcutsKey));
69 curSetting.beginGroup(SHORTCUTS_GROUP);
70 defaultKey.beginGroup(SHORTCUTS_GROUP);
71 foreach (
QString pKey, curSetting.allKeys())
73 if ( !defaultKey.contains(pKey) )
75 curSetting.remove(pKey);
78 defaultKey.endGroup();
79 curSetting.endGroup();
83void restoreShortcutsToDefault()
87 QSettings curSetting( PENCIL2D, PENCIL2D );
88 curSetting.remove(
"shortcuts");
90 foreach (
QString pShortcutsKey, defaultKey.allKeys())
92 curSetting.setValue(pShortcutsKey, defaultKey.value(pShortcutsKey));