Rev 674 | 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_Settings() |
||
32 | { |
||
33 | QSettings Setting("QMK", QA_NAME); |
||
34 | |||
35 | Setting.beginGroup("Global"); |
||
36 | Settings_ID = Setting.value("Settings ID", Settings_ID).toInt(); |
||
37 | Setting.endGroup(); |
||
38 | |||
39 | Setting.beginGroup("GUI"); |
||
40 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
||
41 | GUI.Size = Setting.value("Size", QSize(500, 350)).toSize(); |
||
42 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
||
43 | GUI.Toolbar = Setting.value("Toolbar",true).toBool(); |
||
44 | Setting.endGroup(); |
||
45 | |||
46 | Setting.beginGroup("CONFIG"); |
||
47 | CONFIG.cb_CenterPos = Setting.value("cb_CenterPos",true).toBool(); |
||
48 | CONFIG.cb_ShowRoute = Setting.value("cb_ShowRoute",true).toBool(); |
||
49 | CONFIG.cb_ShowWPs = Setting.value("cb_ShowWPs",true).toBool(); |
||
50 | CONFIG.cb_Goto = Setting.value("cb_Goto",true).toBool(); |
||
51 | Setting.endGroup(); |
||
52 | |||
53 | Setting.beginGroup("Navi"); |
||
54 | NAVI.StayTime = Setting.value("StayTime", 500).toInt(); |
||
55 | NAVI.Latitude = Setting.value("Latitude", 52.5).toDouble(); |
||
56 | NAVI.Longitude = Setting.value("Longitude", 13.5).toDouble(); |
||
57 | Setting.endGroup(); |
||
58 | } |
||
59 | |||
60 | void cSettings::write_Settings() |
||
61 | { |
||
62 | QSettings Setting("QMK", QA_NAME); |
||
63 | |||
64 | Setting.beginGroup("Global"); |
||
65 | Setting.setValue("Settings ID", Settings_ID); |
||
66 | Setting.endGroup(); |
||
67 | |||
68 | Setting.beginGroup("GUI"); |
||
69 | Setting.setValue("IsMax", GUI.isMax); |
||
70 | Setting.setValue("Size", GUI.Size); |
||
71 | Setting.setValue("Point", GUI.Point); |
||
72 | Setting.setValue("Toolbar", GUI.Toolbar); |
||
73 | Setting.endGroup(); |
||
74 | |||
75 | Setting.beginGroup("CONFIG"); |
||
76 | Setting.setValue("cb_CenterPos", CONFIG.cb_CenterPos); |
||
77 | Setting.setValue("cb_ShowRoute", CONFIG.cb_ShowRoute); |
||
78 | Setting.setValue("cb_ShowWPs", CONFIG.cb_ShowWPs); |
||
79 | Setting.setValue("cb_Goto", CONFIG.cb_Goto); |
||
80 | Setting.endGroup(); |
||
81 | |||
82 | Setting.beginGroup("NAVI"); |
||
83 | Setting.setValue("StayTime", NAVI.StayTime); |
||
84 | Setting.setValue("Latitude", NAVI.Latitude); |
||
85 | Setting.setValue("Longitude", NAVI.Longitude); |
||
86 | Setting.endGroup(); |
||
87 | |||
88 | } |