Rev 750 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
674 | KeyOz | 1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Manuel Schrape * |
||
3 | * manuel.schrape@gmx.de * |
||
4 | * * |
||
5 | * This program is free software; you can redistribute it and/or modify * |
||
6 | * it under the terms of the GNU General Public License as published by * |
||
7 | * the Free Software Foundation; either version 2 of the License. * |
||
8 | * * |
||
9 | * This program is distributed in the hope that it will be useful, * |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
12 | * GNU General Public License for more details. * |
||
13 | * * |
||
14 | * You should have received a copy of the GNU General Public License * |
||
15 | * along with this program; if not, write to the * |
||
16 | * Free Software Foundation, Inc., * |
||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
18 | ***************************************************************************/ |
||
19 | #include <QSettings> |
||
20 | #include <QDir> |
||
21 | |||
22 | #include "cSettings.h" |
||
23 | |||
24 | cSettings::cSettings() |
||
25 | { |
||
26 | Settings_ID = 1; |
||
27 | |||
28 | read_Settings(); |
||
29 | } |
||
30 | |||
31 | void cSettings::read_DebugLabels(int ID) |
||
32 | { |
||
33 | QBitArray Def_View; |
||
34 | Def_View.fill(true,MAX_DebugData); |
||
35 | |||
36 | QString Hardware = HardwareType[ID]; |
||
37 | |||
38 | QSettings Setting("QMK", "Debug-Labels"); |
||
39 | |||
40 | Setting.beginGroup("Debug-Labels-" + Hardware); |
||
41 | |||
42 | DebugData.Version = Setting.value(("Version"), "0").toString(); |
||
43 | for (int a=0; a<MAX_DebugData; a++) |
||
44 | { |
||
45 | DebugData.Label[a] = Setting.value(("Label_" + QString("%1").arg(a)), "-" + DEF_DebugNames[a]).toString(); |
||
46 | } |
||
47 | DebugData.Show_Plotter = Setting.value("Show_Plotter", QBitArray(Def_View)).value<QBitArray>(); |
||
48 | |||
49 | Setting.endGroup(); |
||
50 | } |
||
51 | |||
52 | void cSettings::write_DebugLabels(int ID) |
||
53 | { |
||
54 | QString Hardware = HardwareType[ID]; |
||
55 | |||
56 | QSettings Setting("QMK", "Debug-Labels"); |
||
57 | |||
58 | Setting.beginGroup("Debug-Labels-" + Hardware); |
||
59 | |||
60 | Setting.setValue("Version", DebugData.Version); |
||
61 | for (int a=0; a<MAX_DebugData; a++) |
||
62 | { |
||
63 | Setting.setValue("Label_" + QString("%1").arg(a), DebugData.Label[a]); |
||
64 | } |
||
65 | Setting.setValue("Show_Plotter", QBitArray(DebugData.Show_Plotter)); |
||
66 | |||
67 | Setting.endGroup(); |
||
68 | } |
||
69 | |||
70 | void cSettings::read_Settings() |
||
71 | { |
||
72 | QSettings Setting("QMK", QA_NAME); |
||
73 | |||
74 | Setting.beginGroup("Global"); |
||
75 | Settings_ID = Setting.value("Settings ID", Settings_ID).toInt(); |
||
76 | Setting.endGroup(); |
||
77 | |||
78 | Setting.beginGroup("DATA"); |
||
750 | KeyOz | 79 | // DATA.Debug_Intervall = Setting.value("Debug-Intervall", 500).toInt(); |
674 | KeyOz | 80 | DATA.Plotter_Count = Setting.value("Plotter-Count", 100).toInt(); |
81 | Setting.endGroup(); |
||
82 | |||
83 | Setting.beginGroup("GUI"); |
||
84 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
||
85 | GUI.Size = Setting.value("Size", QSize(700, 300)).toSize(); |
||
86 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
||
87 | Setting.endGroup(); |
||
88 | } |
||
89 | |||
90 | void cSettings::write_Settings() |
||
91 | { |
||
92 | QSettings Setting("QMK", QA_NAME); |
||
93 | |||
94 | Setting.beginGroup("Global"); |
||
95 | Setting.setValue("Settings ID", Settings_ID); |
||
96 | Setting.endGroup(); |
||
97 | |||
98 | Setting.beginGroup("DATA"); |
||
99 | Setting.setValue("Plotter-Count", DATA.Plotter_Count); |
||
750 | KeyOz | 100 | // Setting.setValue("Debug-Intervall", DATA.Debug_Intervall); |
674 | KeyOz | 101 | Setting.endGroup(); |
102 | |||
103 | Setting.beginGroup("GUI"); |
||
104 | Setting.setValue("IsMax", GUI.isMax); |
||
105 | Setting.setValue("Size", GUI.Size); |
||
106 | Setting.setValue("Point", GUI.Point); |
||
107 | Setting.endGroup(); |
||
108 | } |
||
109 | |||
110 |