Rev 674 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 674 | Rev 750 | ||
---|---|---|---|
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_Settings() |
31 | void cSettings::read_Settings() |
32 | { |
32 | { |
33 | QSettings Setting("QMK", QA_NAME); |
33 | QSettings Setting("QMK", QA_NAME); |
34 | 34 | ||
35 | Setting.beginGroup("Global"); |
35 | Setting.beginGroup("Global"); |
36 | Settings_ID = Setting.value("Settings ID", Settings_ID).toInt(); |
36 | Settings_ID = Setting.value("Settings ID", Settings_ID).toInt(); |
37 | Setting.endGroup(); |
37 | Setting.endGroup(); |
38 | 38 | ||
39 | Setting.beginGroup("GUI"); |
39 | Setting.beginGroup("GUI"); |
40 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
40 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
41 | GUI.Size = Setting.value("Size", QSize(500, 350)).toSize(); |
41 | GUI.Size = Setting.value("Size", QSize(500, 350)).toSize(); |
42 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
42 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
43 | GUI.Toolbar = Setting.value("Toolbar",true).toBool(); |
43 | GUI.Toolbar = Setting.value("Toolbar",true).toBool(); |
44 | Setting.endGroup(); |
44 | Setting.endGroup(); |
45 | - | ||
46 | Setting.beginGroup("Data"); |
- | |
47 | DATA.Intervall = Setting.value("Intervall", 500).toInt(); |
- | |
48 | Setting.endGroup(); |
- | |
49 | - | ||
50 | Setting.beginGroup("SERVER"); |
- | |
51 | SERVER.Password = Setting.value("Password", QString("")).toString(); |
- | |
52 | SERVER.IP_MAX = Setting.value("IP_MAX", 1).toInt(); |
- | |
53 | SERVER.IP_ID = Setting.value("IP_ID", 0).toInt(); |
- | |
54 | - | ||
55 | for (int z = 0; z < SERVER.IP_MAX; z++) |
- | |
56 | { |
- | |
57 | SERVER.IP[z] = Setting.value("IP_" + QString("%1").arg(z), QString("127.0.0.1:64400")).toString(); |
- | |
58 | } |
- | |
59 | Setting.endGroup(); |
- | |
60 | 45 | ||
61 | Setting.beginGroup("CONFIG"); |
46 | Setting.beginGroup("CONFIG"); |
62 | CONFIG.cb_CenterPos = Setting.value("cb_CenterPos",true).toBool(); |
47 | CONFIG.cb_CenterPos = Setting.value("cb_CenterPos",true).toBool(); |
63 | CONFIG.cb_ShowRoute = Setting.value("cb_ShowRoute",true).toBool(); |
48 | CONFIG.cb_ShowRoute = Setting.value("cb_ShowRoute",true).toBool(); |
64 | CONFIG.cb_ShowWPs = Setting.value("cb_ShowWPs",true).toBool(); |
49 | CONFIG.cb_ShowWPs = Setting.value("cb_ShowWPs",true).toBool(); |
65 | CONFIG.cb_Goto = Setting.value("cb_Goto",true).toBool(); |
50 | CONFIG.cb_Goto = Setting.value("cb_Goto",true).toBool(); |
66 | Setting.endGroup(); |
51 | Setting.endGroup(); |
67 | 52 | ||
68 | Setting.beginGroup("Navi"); |
53 | Setting.beginGroup("Navi"); |
69 | NAVI.StayTime = Setting.value("StayTime", 500).toInt(); |
54 | NAVI.StayTime = Setting.value("StayTime", 500).toInt(); |
70 | NAVI.Latitude = Setting.value("Latitude", 52.5).toDouble(); |
55 | NAVI.Latitude = Setting.value("Latitude", 52.5).toDouble(); |
71 | NAVI.Longitude = Setting.value("Longitude", 13.5).toDouble(); |
56 | NAVI.Longitude = Setting.value("Longitude", 13.5).toDouble(); |
72 | Setting.endGroup(); |
57 | Setting.endGroup(); |
73 | } |
58 | } |
74 | 59 | ||
75 | void cSettings::write_Settings() |
60 | void cSettings::write_Settings() |
76 | { |
61 | { |
77 | QSettings Setting("QMK", QA_NAME); |
62 | QSettings Setting("QMK", QA_NAME); |
78 | 63 | ||
79 | Setting.beginGroup("Global"); |
64 | Setting.beginGroup("Global"); |
80 | Setting.setValue("Settings ID", Settings_ID); |
65 | Setting.setValue("Settings ID", Settings_ID); |
81 | Setting.endGroup(); |
66 | Setting.endGroup(); |
82 | 67 | ||
83 | Setting.beginGroup("GUI"); |
68 | Setting.beginGroup("GUI"); |
84 | Setting.setValue("IsMax", GUI.isMax); |
69 | Setting.setValue("IsMax", GUI.isMax); |
85 | Setting.setValue("Size", GUI.Size); |
70 | Setting.setValue("Size", GUI.Size); |
86 | Setting.setValue("Point", GUI.Point); |
71 | Setting.setValue("Point", GUI.Point); |
87 | Setting.setValue("Toolbar", GUI.Toolbar); |
72 | Setting.setValue("Toolbar", GUI.Toolbar); |
88 | Setting.endGroup(); |
73 | Setting.endGroup(); |
89 | - | ||
90 | Setting.beginGroup("DATA"); |
- | |
91 | Setting.setValue("Intervall", DATA.Intervall); |
- | |
92 | Setting.endGroup(); |
- | |
93 | - | ||
94 | Setting.beginGroup("SERVER"); |
- | |
95 | Setting.setValue("Password", SERVER.Password); |
- | |
96 | Setting.setValue("IP_MAX", SERVER.IP_MAX); |
- | |
97 | Setting.setValue("IP_ID", SERVER.IP_ID); |
- | |
98 | - | ||
99 | for (int z = 0; z < SERVER.IP_MAX; z++) |
- | |
100 | { |
- | |
101 | Setting.setValue("IP_" + QString("%1").arg(z), SERVER.IP[z]); |
- | |
102 | } |
- | |
103 | Setting.endGroup(); |
- | |
104 | 74 | ||
105 | Setting.beginGroup("CONFIG"); |
75 | Setting.beginGroup("CONFIG"); |
106 | Setting.setValue("cb_CenterPos", CONFIG.cb_CenterPos); |
76 | Setting.setValue("cb_CenterPos", CONFIG.cb_CenterPos); |
107 | Setting.setValue("cb_ShowRoute", CONFIG.cb_ShowRoute); |
77 | Setting.setValue("cb_ShowRoute", CONFIG.cb_ShowRoute); |
108 | Setting.setValue("cb_ShowWPs", CONFIG.cb_ShowWPs); |
78 | Setting.setValue("cb_ShowWPs", CONFIG.cb_ShowWPs); |
109 | Setting.setValue("cb_Goto", CONFIG.cb_Goto); |
79 | Setting.setValue("cb_Goto", CONFIG.cb_Goto); |
110 | Setting.endGroup(); |
80 | Setting.endGroup(); |
111 | 81 | ||
112 | Setting.beginGroup("NAVI"); |
82 | Setting.beginGroup("NAVI"); |
113 | Setting.setValue("StayTime", NAVI.StayTime); |
83 | Setting.setValue("StayTime", NAVI.StayTime); |
114 | Setting.setValue("Latitude", NAVI.Latitude); |
84 | Setting.setValue("Latitude", NAVI.Latitude); |
115 | Setting.setValue("Longitude", NAVI.Longitude); |
85 | Setting.setValue("Longitude", NAVI.Longitude); |
116 | Setting.endGroup(); |
86 | Setting.endGroup(); |
117 | 87 | ||
118 | } |
88 | } |
119 | 89 |