Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
158 | 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 <QCoreApplication> |
||
20 | #include <QSettings> |
||
21 | #include <QDir> |
||
22 | |||
23 | #include "cSettings.h" |
||
24 | |||
25 | cSettings::cSettings() |
||
26 | { |
||
27 | } |
||
28 | |||
29 | void cSettings::read_Settings() |
||
30 | { |
||
31 | QBitArray Def_TabViews; |
||
32 | Def_TabViews.fill(true, 6); |
||
33 | |||
34 | QDir Dir; |
||
35 | |||
36 | QString HomeDir = (QString(Dir.homePath() + "/")); |
||
37 | |||
38 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
||
39 | |||
40 | Setting.beginGroup("Port"); |
||
41 | TTY.Port = Setting.value("TTY", QString("/dev/ttyUSB0")).toString(); |
||
42 | Setting.endGroup(); |
||
43 | |||
44 | Setting.beginGroup("GUI"); |
||
45 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
||
46 | GUI.Size = Setting.value("Size", QSize(700, 300)).toSize(); |
||
47 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
||
48 | GUI.TabViews = Setting.value("TabViews", QBitArray(Def_TabViews)).value<QBitArray>(); |
||
49 | |||
50 | Setting.endGroup(); |
||
51 | |||
52 | Setting.beginGroup("Dirs"); |
||
53 | DIR.Logging = Setting.value("LogDir", HomeDir).toString(); |
||
54 | DIR.Parameter = Setting.value("ParDir", HomeDir).toString(); |
||
55 | Setting.endGroup(); |
||
56 | } |
||
57 | |||
58 | void cSettings::write_Settings() |
||
59 | { |
||
60 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
||
61 | |||
62 | Setting.beginGroup("Port"); |
||
63 | // Setting.setValue("TTY", le_Port->text()); |
||
64 | Setting.endGroup(); |
||
65 | |||
66 | Setting.beginGroup("Dirs"); |
||
67 | Setting.setValue("LogDir", DIR.Logging); |
||
68 | Setting.setValue("ParDir", DIR.Parameter); |
||
69 | Setting.endGroup(); |
||
70 | |||
71 | Setting.beginGroup("GUI"); |
||
72 | // Setting.setValue("IsMax", isMaximized()); |
||
73 | // Setting.setValue("Size", size()); |
||
74 | // Setting.setValue("Point", pos()); |
||
75 | Setting.endGroup(); |
||
76 | } |
||
77 | |||
78 | void cSettings::read_Settings_FC() |
||
79 | { |
||
80 | QDir Dir; |
||
81 | |||
82 | QString HomeDir = (QString(Dir.homePath() + "/")); |
||
83 | |||
84 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
||
85 | |||
86 | Setting.beginGroup("AnalogWerte-FC"); |
||
87 | for (int a = 0; a < MaxAnalog; a++) |
||
88 | { |
||
89 | Analog[a].Name = Setting.value(("Analog_" + QString("%1").arg(a)), Def_AnalogNames[a]).toString(); |
||
90 | Analog[a].Plot = Setting.value(("Analog_" + QString("%1").arg(a) + "_Plot"), Def_Plot_Show[a]).toBool(); |
||
91 | Analog[a].Color = Setting.value(("Analog_" + QString("%1").arg(a) + "_Color"), QColor(Def_Colors[a])).value<QColor>(); |
||
92 | Analog[a].Log = Setting.value(("Analog_" + QString("%1").arg(a) + "_Log"), Def_Log[a]).toBool(); |
||
93 | } |
||
94 | Setting.endGroup(); |
||
95 | } |
||
96 | |||
97 | void cSettings::write_Settings_FC() |
||
98 | { |
||
99 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
||
100 | |||
101 | Setting.beginGroup("AnalogWerte-FC"); |
||
102 | for (int a=0; a<MaxAnalog; a++) |
||
103 | { |
||
104 | Setting.setValue("Analog_" + QString("%1").arg(a), Analog[a].Name); |
||
105 | Setting.setValue("Analog_" + QString("%1").arg(a) + "_Plot", Analog[a].Plot); |
||
106 | Setting.setValue("Analog_" + QString("%1").arg(a) + "_Log", Analog[a].Log); |
||
107 | Setting.setValue("Analog_" + QString("%1").arg(a) + "_Color", QColor(Analog[a].Color)); |
||
108 | } |
||
109 | Setting.endGroup(); |
||
110 | } |
||
111 | |||
112 | |||
113 | cSettings::~cSettings() |
||
114 | { |
||
115 | } |
||
116 | |||
117 |