3 #include "pencilsettings.h"
7 QSettings& pencilSettings()
9 static QSettings settings(PENCIL2D, PENCIL2D);
11 if ( !settings.contains(
"InitPencilSetting") )
13 restoreToDefaultSetting();
14 settings.setValue(
"InitPencilSetting",
true);
19 void restoreToDefaultSetting()
21 QSettings s(PENCIL2D, PENCIL2D);
23 s.setValue(
"penWidth", 2.0);
24 s.setValue(
"pencilWidth", 4.0);
25 s.setValue(
"polyLineWidth", 1.5);
26 s.setValue(
"eraserWidth", 10.0);
27 s.setValue(
"brushWidth", 15.0);
28 s.setValue(
"brushFeather", 15.0);
29 s.setValue(
"brushUseFeather",
true);
31 s.setValue(SETTING_AUTO_SAVE_NUMBER, 15);
32 s.setValue(SETTING_TOOL_CURSOR,
true);
35 qDebug(
"restored default tools");
38 void checkExistingShortcuts()
40 QSettings defaultKey(
":resources/kb.ini", QSettings::IniFormat);
42 QSettings curSetting( PENCIL2D, PENCIL2D );
43 foreach (QString pShortcutsKey, defaultKey.allKeys())
45 if ( ! curSetting.contains( pShortcutsKey ) )
47 curSetting.setValue(pShortcutsKey, defaultKey.value(pShortcutsKey));
51 curSetting.beginGroup(SHORTCUTS_GROUP);
52 defaultKey.beginGroup(SHORTCUTS_GROUP);
53 foreach (QString pKey, curSetting.allKeys())
55 if ( !defaultKey.contains(pKey) )
57 curSetting.remove(pKey);
60 defaultKey.endGroup();
61 curSetting.endGroup();
65 void restoreShortcutsToDefault()
67 QSettings defaultKey(
":resources/kb.ini", QSettings::IniFormat);
69 QSettings curSetting( PENCIL2D, PENCIL2D );
70 curSetting.remove(
"shortcuts");
72 foreach (QString pShortcutsKey, defaultKey.allKeys())
74 curSetting.setValue(pShortcutsKey, defaultKey.value(pShortcutsKey));