Rev 674 | Rev 750 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 674 | Rev 711 | ||
---|---|---|---|
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("SERVER"); |
39 | Setting.beginGroup("SERVER"); |
40 | SERVER.TCP_PORT = Setting.value("TCP-PORT", DEV_IP_PORT).toInt(); |
40 | SERVER.TCP_PORT = Setting.value("TCP-PORT", DEV_IP_PORT).toInt(); |
41 | SERVER.UDP_PORT = Setting.value("UDP-PORT", DEV_IP_PORT).toInt(); |
41 | SERVER.UDP_PORT = Setting.value("UDP-PORT", DEV_IP_PORT).toInt(); |
42 | SERVER.Password = Setting.value("Password", QString("")).toString(); |
42 | SERVER.Password = Setting.value("Password", QString("")).toString(); |
43 | Setting.endGroup(); |
43 | Setting.endGroup(); |
44 | 44 | ||
45 | Setting.beginGroup("CLIENT"); |
45 | Setting.beginGroup("CLIENT"); |
46 | CLIENT.TTY_MAX = Setting.value("TTY_MAX", 1).toInt(); |
46 | CLIENT.TTY_MAX = Setting.value("TTY_MAX", 1).toInt(); |
47 | CLIENT.TTY_ID = Setting.value("TTY_ID", 0).toInt(); |
47 | CLIENT.TTY_ID = Setting.value("TTY_ID", 0).toInt(); |
48 | 48 | ||
49 | for (int z = 0; z < CLIENT.TTY_MAX; z++) |
49 | for (int z = 0; z < CLIENT.TTY_MAX; z++) |
50 | { |
50 | { |
51 | CLIENT.TTY_DEVICES[z] = Setting.value("TTY_DEVICE_" + QString("%1").arg(z), QString("/dev/ttyS3")).toString(); |
51 | CLIENT.TTY_DEVICES[z] = Setting.value("TTY_DEVICE_" + QString("%1").arg(z), QString("/dev/ttyS3")).toString(); |
52 | } |
52 | } |
- | 53 | CLIENT.TCP_MAX = Setting.value("TCP_MAX", 1).toInt(); |
|
- | 54 | CLIENT.TCP_ID = Setting.value("TCP_ID", 0).toInt(); |
|
- | 55 | CLIENT.TCP_Password = Setting.value("Password", QString("")).toString(); |
|
- | 56 | ||
- | 57 | for (int z = 0; z < CLIENT.TCP_MAX; z++) |
|
- | 58 | { |
|
- | 59 | CLIENT.TCP_SERVER[z] = Setting.value("TCP_SERVER_" + QString("%1").arg(z), QString("127.0.0.1:64400")).toString(); |
|
- | 60 | } |
|
53 | Setting.endGroup(); |
61 | Setting.endGroup(); |
54 | 62 | ||
55 | Setting.beginGroup("GUI"); |
63 | Setting.beginGroup("GUI"); |
56 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
64 | GUI.isMax = Setting.value("IsMax",false).toBool(); |
57 | GUI.Size = Setting.value("Size", QSize(500, 350)).toSize(); |
65 | GUI.Size = Setting.value("Size", QSize(500, 350)).toSize(); |
58 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
66 | GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint(); |
59 | Setting.endGroup(); |
67 | Setting.endGroup(); |
60 | } |
68 | } |
61 | 69 | ||
62 | void cSettings::write_Settings() |
70 | void cSettings::write_Settings() |
63 | { |
71 | { |
64 | QSettings Setting("QMK", QA_NAME); |
72 | QSettings Setting("QMK", QA_NAME); |
65 | 73 | ||
66 | Setting.beginGroup("Global"); |
74 | Setting.beginGroup("Global"); |
67 | Setting.setValue("Settings ID", Settings_ID); |
75 | Setting.setValue("Settings ID", Settings_ID); |
68 | Setting.endGroup(); |
76 | Setting.endGroup(); |
69 | 77 | ||
70 | Setting.beginGroup("SERVER"); |
78 | Setting.beginGroup("SERVER"); |
71 | Setting.setValue("TCP-PORT", SERVER.TCP_PORT); |
79 | Setting.setValue("TCP-PORT", SERVER.TCP_PORT); |
72 | Setting.setValue("UDP-PORT", SERVER.UDP_PORT); |
80 | Setting.setValue("UDP-PORT", SERVER.UDP_PORT); |
73 | Setting.setValue("Password", SERVER.Password); |
81 | Setting.setValue("Password", SERVER.Password); |
74 | Setting.endGroup(); |
82 | Setting.endGroup(); |
75 | 83 | ||
76 | Setting.beginGroup("CLIENT"); |
84 | Setting.beginGroup("CLIENT"); |
77 | Setting.setValue("TTY_MAX", CLIENT.TTY_MAX); |
85 | Setting.setValue("TTY_MAX", CLIENT.TTY_MAX); |
78 | Setting.setValue("TTY_ID", CLIENT.TTY_ID); |
86 | Setting.setValue("TTY_ID", CLIENT.TTY_ID); |
- | 87 | Setting.setValue("Password", CLIENT.TCP_Password); |
|
79 | 88 | ||
80 | for (int z = 0; z < CLIENT.TTY_MAX; z++) |
89 | for (int z = 0; z < CLIENT.TTY_MAX; z++) |
81 | { |
90 | { |
82 | Setting.setValue("TTY_DEVICE_" + QString("%1").arg(z), CLIENT.TTY_DEVICES[z]); |
91 | Setting.setValue("TTY_DEVICE_" + QString("%1").arg(z), CLIENT.TTY_DEVICES[z]); |
83 | } |
92 | } |
- | 93 | ||
- | 94 | Setting.setValue("TCP_MAX", CLIENT.TCP_MAX); |
|
- | 95 | Setting.setValue("TCP_ID", CLIENT.TCP_ID); |
|
- | 96 | ||
- | 97 | for (int z = 0; z < CLIENT.TCP_MAX; z++) |
|
- | 98 | { |
|
- | 99 | Setting.setValue("TCP_SERVER_" + QString("%1").arg(z), CLIENT.TCP_SERVER[z]); |
|
- | 100 | } |
|
84 | Setting.endGroup(); |
101 | Setting.endGroup(); |
85 | 102 | ||
86 | Setting.beginGroup("GUI"); |
103 | Setting.beginGroup("GUI"); |
87 | Setting.setValue("IsMax", GUI.isMax); |
104 | Setting.setValue("IsMax", GUI.isMax); |
88 | Setting.setValue("Size", GUI.Size); |
105 | Setting.setValue("Size", GUI.Size); |
89 | Setting.setValue("Point", GUI.Point); |
106 | Setting.setValue("Point", GUI.Point); |
90 | Setting.endGroup(); |
107 | Setting.endGroup(); |
91 | 108 | ||
92 | } |
109 | } |
93 | 110 |