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