Rev 674 | Rev 750 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 674 | Rev 711 | ||
---|---|---|---|
1 | /*************************************************************************** |
1 | /*************************************************************************** |
2 | * Copyright (C) 2009 by Manuel Schrape * |
2 | * Copyright (C) 2009 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 | 19 | ||
20 | #include <QMessageBox> |
20 | #include <QMessageBox> |
- | 21 | #include <QCryptographicHash> |
|
21 | 22 | ||
22 | #include "dlg_Main.h" |
23 | #include "dlg_Main.h" |
23 | 24 | ||
24 | // Konstruktor Main-Form |
25 | // Konstruktor Main-Form |
25 | dlg_Main::dlg_Main() |
26 | dlg_Main::dlg_Main() |
26 | { |
27 | { |
27 | setupUi(this); |
28 | setupUi(this); |
28 | 29 | ||
29 | o_Settings = new cSettings(); |
30 | o_Settings = new cSettings(); |
30 | 31 | ||
31 | o_Settings->read_DebugLabels(0); |
32 | o_Settings->read_DebugLabels(0); |
32 | 33 | ||
33 | o_Input = new Input(); |
34 | o_Input = new Input(); |
34 | 35 | ||
35 | init_GUI(); |
36 | init_GUI(); |
36 | init_Connections(); |
37 | init_Connections(); |
37 | init_Plotter(); |
38 | init_Plotter(); |
38 | } |
39 | } |
39 | 40 | ||
40 | // Grafische Oberfläche initialisieren |
41 | // Grafische Oberfläche initialisieren |
41 | void dlg_Main::init_GUI() |
42 | void dlg_Main::init_GUI() |
42 | { |
43 | { |
43 | setWindowTitle(QA_NAME + " " + QA_VERSION); |
44 | setWindowTitle(QA_NAME + " " + QA_VERSION); |
44 | 45 | ||
45 | resize(o_Settings->GUI.Size); |
46 | resize(o_Settings->GUI.Size); |
46 | move(o_Settings->GUI.Point); |
47 | move(o_Settings->GUI.Point); |
47 | 48 | ||
48 | if (o_Settings->GUI.isMax) |
49 | if (o_Settings->GUI.isMax) |
49 | { |
50 | { |
50 | showMaximized(); |
51 | showMaximized(); |
51 | } |
52 | } |
52 | 53 | ||
53 | for(int z = 0; z < o_Settings->SERVER.IP_MAX; z++) |
54 | for(int z = 0; z < o_Settings->SERVER.IP_MAX; z++) |
54 | { |
55 | { |
55 | if (cb_Server->findText(o_Settings->SERVER.IP[z]) == -1) |
56 | if (cb_Server->findText(o_Settings->SERVER.IP[z]) == -1) |
56 | { |
57 | { |
57 | cb_Server->addItem(o_Settings->SERVER.IP[z]); |
58 | cb_Server->addItem(o_Settings->SERVER.IP[z]); |
58 | } |
59 | } |
59 | } |
60 | } |
60 | 61 | ||
61 | cb_Server->setCurrentIndex(o_Settings->SERVER.IP_ID); |
62 | cb_Server->setCurrentIndex(o_Settings->SERVER.IP_ID); |
62 | 63 | ||
63 | le_Password->setText(o_Settings->SERVER.Password); |
64 | le_Password->setText(o_Settings->SERVER.Password); |
64 | 65 | ||
65 | sb_Intervall->setValue(o_Settings->DATA.Debug_Intervall); |
66 | sb_Intervall->setValue(o_Settings->DATA.Debug_Intervall); |
66 | 67 | ||
67 | btn_Start->setCheckable(true); |
68 | btn_Start->setCheckable(true); |
68 | 69 | ||
69 | ac_Plotter->setChecked(true); |
70 | ac_Plotter->setChecked(true); |
70 | 71 | ||
71 | Font_1.setFamily(QString::fromUtf8("Adobe Courier")); |
72 | Font_1.setFamily(QString::fromUtf8("Adobe Courier")); |
72 | Font_1.setBold(true); |
73 | Font_1.setBold(true); |
73 | Font_1.setWeight(75); |
74 | Font_1.setWeight(75); |
74 | 75 | ||
75 | for(int z = 0; z < MAX_DebugData; z++) |
76 | for(int z = 0; z < MAX_DebugData; z++) |
76 | { |
77 | { |
77 | 78 | ||
78 | lb_Debug[z] = new QLabel(wg_Debug); |
79 | lb_Debug[z] = new QLabel(wg_Debug); |
79 | le_Debug[z] = new QLineEdit(wg_Debug); |
80 | le_Debug[z] = new QLineEdit(wg_Debug); |
80 | cb_Debug[z] = new QCheckBox(wg_Config); |
81 | cb_Debug[z] = new QCheckBox(wg_Config); |
81 | le_Debug[z]->setFont(Font_1); |
82 | le_Debug[z]->setFont(Font_1); |
82 | le_Debug[z]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
83 | le_Debug[z]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
83 | le_Debug[z]->setReadOnly(true); |
84 | le_Debug[z]->setReadOnly(true); |
84 | 85 | ||
85 | wg_Grid->addWidget(lb_Debug[z], (z % 8), z / 8 * 2, 0); |
86 | wg_Grid->addWidget(lb_Debug[z], (z % 8), z / 8 * 2, 0); |
86 | wg_Grid->addWidget(le_Debug[z], (z % 8), z / 8 * 2 + 1 , 0); |
87 | wg_Grid->addWidget(le_Debug[z], (z % 8), z / 8 * 2 + 1 , 0); |
87 | 88 | ||
88 | wg_Grid_2->addWidget(cb_Debug[z], (z % 8), z / 8, 0); |
89 | wg_Grid_2->addWidget(cb_Debug[z], (z % 8), z / 8, 0); |
89 | 90 | ||
90 | lb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
91 | lb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
91 | cb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
92 | cb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
92 | 93 | ||
93 | cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]); |
94 | cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]); |
94 | } |
95 | } |
95 | } |
96 | } |
96 | 97 | ||
97 | // Signale mit Slots verbinden |
98 | // Signale mit Slots verbinden |
98 | void dlg_Main::init_Connections() |
99 | void dlg_Main::init_Connections() |
99 | { |
100 | { |
100 | connect(sb_Intervall, SIGNAL(valueChanged(int)), this, SLOT(slot_sb_Intervall(int))); |
101 | connect(sb_Intervall, SIGNAL(valueChanged(int)), this, SLOT(slot_sb_Intervall(int))); |
101 | 102 | ||
102 | connect(ac_Connect, SIGNAL(triggered()), this, SLOT(slot_ac_Connect())); |
103 | connect(ac_Connect, SIGNAL(triggered()), this, SLOT(slot_ac_Connect())); |
103 | connect(ac_Plotter, SIGNAL(triggered()), this, SLOT(slot_ac_Plotter())); |
104 | connect(ac_Plotter, SIGNAL(triggered()), this, SLOT(slot_ac_Plotter())); |
104 | connect(ac_Debug, SIGNAL(triggered()), this, SLOT(slot_ac_Debug())); |
105 | connect(ac_Debug, SIGNAL(triggered()), this, SLOT(slot_ac_Debug())); |
105 | connect(ac_Chose, SIGNAL(triggered()), this, SLOT(slot_ac_Chose())); |
106 | connect(ac_Chose, SIGNAL(triggered()), this, SLOT(slot_ac_Chose())); |
106 | 107 | ||
107 | connect(ac_ReadLabels, SIGNAL(triggered()), this, SLOT(slot_ac_ReadLabels())); |
108 | connect(ac_ReadLabels, SIGNAL(triggered()), this, SLOT(slot_ac_ReadLabels())); |
108 | 109 | ||
109 | connect(rb_NC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
110 | connect(rb_NC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
110 | connect(rb_FC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
111 | connect(rb_FC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
111 | connect(rb_MK3MAG, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
112 | connect(rb_MK3MAG, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
112 | 113 | ||
113 | connect(Plotter_Scroll, SIGNAL(valueChanged(int)), this, SLOT(slot_Plotter_Scroll(int))); |
114 | connect(Plotter_Scroll, SIGNAL(valueChanged(int)), this, SLOT(slot_Plotter_Scroll(int))); |
114 | 115 | ||
115 | connect(btn_Start, SIGNAL(clicked()), this, SLOT(slot_Plotter_Start())); |
116 | connect(btn_Start, SIGNAL(clicked()), this, SLOT(slot_Plotter_Start())); |
116 | connect(btn_ChoseOK, SIGNAL(clicked()), this, SLOT(slot_btn_ChoseOK())); |
117 | connect(btn_ChoseOK, SIGNAL(clicked()), this, SLOT(slot_btn_ChoseOK())); |
117 | 118 | ||
118 | // About QMK-Kernel & About-QT Dialog einfĂĽgen |
119 | // About QMK-Kernel & About-QT Dialog einfĂĽgen |
119 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
120 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
120 | menu_Help->addAction(trUtf8("Ăśber &Qt"), qApp, SLOT(aboutQt())); |
121 | menu_Help->addAction(trUtf8("Ăśber &Qt"), qApp, SLOT(aboutQt())); |
121 | } |
122 | } |
122 | 123 | ||
123 | void dlg_Main::init_Plotter() |
124 | void dlg_Main::init_Plotter() |
124 | { |
125 | { |
125 | NextPlot = 0; |
126 | NextPlot = 0; |
126 | 127 | ||
127 | qwt_Plotter->setCanvasBackground(QColor(QRgb(0x00000000))); |
128 | qwt_Plotter->setCanvasBackground(QColor(QRgb(0x00000000))); |
128 | 129 | ||
129 | qwt_Plotter->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
130 | qwt_Plotter->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
130 | 131 | ||
131 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
132 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
132 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
133 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
133 | 134 | ||
134 | Grid->attach(qwt_Plotter); |
135 | Grid->attach(qwt_Plotter); |
135 | 136 | ||
136 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,0,o_Settings->DATA.Plotter_Count,0); |
137 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,0,o_Settings->DATA.Plotter_Count,0); |
137 | 138 | ||
138 | for (int a = 0; a < MAX_DebugData; a++) |
139 | for (int a = 0; a < MAX_DebugData; a++) |
139 | { |
140 | { |
140 | Plot[a] = new QwtPlotCurve(o_Settings->DebugData.Label[a]); |
141 | Plot[a] = new QwtPlotCurve(o_Settings->DebugData.Label[a]); |
141 | Plot[a]->setPen(QPen(QColor(DEF_DebugColors[a]))); |
142 | Plot[a]->setPen(QPen(QColor(DEF_DebugColors[a]))); |
142 | Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
143 | Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
143 | 144 | ||
144 | if (o_Settings->DebugData.Show_Plotter[a]) |
145 | if (o_Settings->DebugData.Show_Plotter[a]) |
145 | Plot[a]->attach(qwt_Plotter); |
146 | Plot[a]->attach(qwt_Plotter); |
146 | } |
147 | } |
147 | qwt_Plotter->replot(); |
148 | qwt_Plotter->replot(); |
148 | } |
149 | } |
149 | 150 | ||
150 | void dlg_Main::update_Plotter() |
151 | void dlg_Main::update_Plotter() |
151 | { |
152 | { |
152 | pl_ID[NextPlot] = NextPlot; |
153 | pl_ID[NextPlot] = NextPlot; |
153 | 154 | ||
154 | for (int a = 0; a < MAX_DebugData; a++) |
155 | for (int a = 0; a < MAX_DebugData; a++) |
155 | { |
156 | { |
156 | pl_Data[a][NextPlot] = Debug_Data[a]; |
157 | pl_Data[a][NextPlot] = Debug_Data[a]; |
157 | Plot[a]->setData(pl_ID,pl_Data[a],NextPlot); |
158 | Plot[a]->setData(pl_ID,pl_Data[a],NextPlot); |
158 | } |
159 | } |
159 | 160 | ||
160 | NextPlot++; |
161 | NextPlot++; |
161 | 162 | ||
162 | if ((NextPlot > o_Settings->DATA.Plotter_Count)) |
163 | if ((NextPlot > o_Settings->DATA.Plotter_Count)) |
163 | { |
164 | { |
164 | Plotter_Scroll->setMaximum(NextPlot - o_Settings->DATA.Plotter_Count); |
165 | Plotter_Scroll->setMaximum(NextPlot - o_Settings->DATA.Plotter_Count); |
165 | } |
166 | } |
166 | 167 | ||
167 | if ((Plotter_Scroll->value() == NextPlot - (o_Settings->DATA.Plotter_Count + 1))) |
168 | if ((Plotter_Scroll->value() == NextPlot - (o_Settings->DATA.Plotter_Count + 1))) |
168 | { |
169 | { |
169 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,NextPlot - o_Settings->DATA.Plotter_Count,NextPlot,0); |
170 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,NextPlot - o_Settings->DATA.Plotter_Count,NextPlot,0); |
170 | Plotter_Scroll->setValue(NextPlot - o_Settings->DATA.Plotter_Count); |
171 | Plotter_Scroll->setValue(NextPlot - o_Settings->DATA.Plotter_Count); |
171 | } |
172 | } |
172 | 173 | ||
173 | qwt_Plotter->replot(); |
174 | qwt_Plotter->replot(); |
174 | } |
175 | } |
175 | 176 | ||
176 | void dlg_Main::config_Plotter() |
177 | void dlg_Main::config_Plotter() |
177 | { |
178 | { |
178 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,0,o_Settings->DATA.Plotter_Count,0); |
179 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,0,o_Settings->DATA.Plotter_Count,0); |
179 | 180 | ||
180 | for (int a = 0; a < MAX_DebugData; a++) |
181 | for (int a = 0; a < MAX_DebugData; a++) |
181 | { |
182 | { |
182 | Plot[a]->detach(); |
183 | Plot[a]->detach(); |
183 | Plot[a]->setPen(QPen(QColor(DEF_DebugColors[a]))); |
184 | Plot[a]->setPen(QPen(QColor(DEF_DebugColors[a]))); |
184 | 185 | ||
185 | if (o_Settings->DebugData.Show_Plotter[a]) |
186 | if (o_Settings->DebugData.Show_Plotter[a]) |
186 | { |
187 | { |
187 | Plot[a]->setTitle(o_Settings->DebugData.Label[a]); |
188 | Plot[a]->setTitle(o_Settings->DebugData.Label[a]); |
188 | Plot[a]->attach(qwt_Plotter); |
189 | Plot[a]->attach(qwt_Plotter); |
189 | } |
190 | } |
190 | } |
191 | } |
191 | qwt_Plotter->replot(); |
192 | qwt_Plotter->replot(); |
192 | } |
193 | } |
193 | 194 | ||
194 | void dlg_Main::slot_Plotter_Scroll(int Position) |
195 | void dlg_Main::slot_Plotter_Scroll(int Position) |
195 | { |
196 | { |
196 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,Position,Position + o_Settings->DATA.Plotter_Count,0); |
197 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,Position,Position + o_Settings->DATA.Plotter_Count,0); |
197 | qwt_Plotter->replot(); |
198 | qwt_Plotter->replot(); |
198 | } |
199 | } |
- | 200 | ||
199 | 201 | // IP-Input-Daten verarbeiten. |
|
200 | void dlg_Main::parse_IP_Data(QString t_Data) |
202 | void dlg_Main::parse_IP_Data(QString t_Data) |
201 | { |
203 | { |
202 | QStringList Data; |
204 | QStringList Data; |
203 | Data = t_Data.split(":"); |
205 | Data = t_Data.split(":"); |
204 | 206 | ||
205 | if (Data.count() > 1) |
207 | if (Data.count() > 1) |
206 | { |
208 | { |
207 | int CMD = Data[2].toInt(); |
209 | int CMD = Data[2].toInt(); |
208 | 210 | ||
209 | switch(CMD) |
211 | switch(CMD) |
210 | { |
212 | { |
211 | case 501 : |
213 | case 101 : |
212 | { |
214 | { |
213 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 105, le_Password->text())); |
215 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION)); |
- | 216 | } |
|
- | 217 | case 502 : |
|
- | 218 | { |
|
- | 219 | switch (Data[3].toInt()) |
|
- | 220 | { |
|
- | 221 | case 105 : |
|
- | 222 | { |
|
- | 223 | QString s_MD5PW; |
|
- | 224 | QByteArray a_MD5PW; |
|
- | 225 | ||
- | 226 | a_MD5PW = QCryptographicHash::hash(le_Password->text().toAscii(),QCryptographicHash::Md5); |
|
- | 227 | ||
- | 228 | s_MD5PW = QString(a_MD5PW.toHex().data()); |
|
- | 229 | ||
- | 230 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 105, s_MD5PW)); |
|
- | 231 | } |
|
- | 232 | break; |
|
- | 233 | case 106 : |
|
- | 234 | { |
|
- | 235 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 106, DataFields)); |
|
- | 236 | } |
|
- | 237 | break; |
|
- | 238 | } |
|
214 | } |
239 | } |
215 | break; |
240 | break; |
216 | case 505 : |
241 | case 505 : |
217 | { |
242 | { |
218 | if (Data[3] == "OK") |
243 | if (Data[3] == "OK") |
219 | { |
244 | { |
220 | } |
245 | } |
221 | else |
246 | else |
222 | { |
247 | { |
223 | QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok); |
248 | QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok); |
224 | } |
249 | } |
225 | } |
250 | } |
226 | break; |
251 | break; |
227 | } |
252 | } |
228 | } |
253 | } |
229 | } |
254 | } |
230 | 255 | ||
231 | // Eingangsdaten verarbeiten |
256 | // MK-Eingangsdaten verarbeiten |
232 | void dlg_Main::parse_MK_Data(QString t_Data) |
257 | void dlg_Main::parse_MK_Data(QString t_Data) |
233 | { |
258 | { |
234 | unsigned char OutData[150]; |
259 | unsigned char OutData[150]; |
235 | char *InData = t_Data.toLatin1().data(); |
260 | char *InData = t_Data.toLatin1().data(); |
236 | 261 | ||
237 | if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0) |
262 | if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0) |
238 | { |
263 | { |
239 | switch(InData[2]) |
264 | switch(InData[2]) |
240 | { |
265 | { |
241 | case 'A' : // 0.76e - Debug-Labels |
266 | case 'A' : // 0.76e - Debug-Labels |
242 | { |
267 | { |
243 | o_Input->stop_Resend(DATA_READ_LABEL); |
268 | o_Input->stop_Resend(DATA_READ_LABEL); |
244 | int Position = OutData[0]; |
269 | int Position = OutData[0]; |
245 | if (Position < 32) |
270 | if (Position < 32) |
246 | { |
271 | { |
247 | o_Settings->DebugData.Label[Position] = HandlerMK::Data2QString(OutData,1,17).trimmed(); |
272 | o_Settings->DebugData.Label[Position] = HandlerMK::Data2QString(OutData,1,17).trimmed(); |
248 | if (o_Settings->DebugData.Label[Position] == "") |
273 | if (o_Settings->DebugData.Label[Position] == "") |
249 | { |
274 | { |
250 | o_Settings->DebugData.Label[Position] = "Debug-" + QString("%1").arg(Position); |
275 | o_Settings->DebugData.Label[Position] = "Debug-" + QString("%1").arg(Position); |
251 | } |
276 | } |
252 | lb_Debug[Position]->setText("" + o_Settings->DebugData.Label[Position]); |
277 | lb_Debug[Position]->setText("" + o_Settings->DebugData.Label[Position]); |
253 | cb_Debug[Position]->setText("" + o_Settings->DebugData.Label[Position]); |
278 | cb_Debug[Position]->setText("" + o_Settings->DebugData.Label[Position]); |
254 | 279 | ||
255 | Position ++; |
280 | Position ++; |
256 | 281 | ||
257 | if ((Position < 32) && (get_Analoglabels == true)) |
282 | if ((Position < 32) && (get_Analoglabels == true)) |
258 | { |
283 | { |
259 | c_Data[0] = Position; |
284 | c_Data[0] = Position; |
260 | o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL); |
285 | o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL); |
261 | } |
286 | } |
262 | } |
287 | } |
263 | if (Position == 32) |
288 | if (Position == 32) |
264 | { |
289 | { |
265 | o_Settings->DebugData.Version = VersionInfo.Version; |
290 | o_Settings->DebugData.Version = VersionInfo.Version; |
266 | o_Settings->write_DebugLabels(VersionInfo.ID); |
291 | o_Settings->write_DebugLabels(VersionInfo.ID); |
267 | config_Plotter(); |
292 | config_Plotter(); |
268 | get_Analoglabels = false; |
293 | get_Analoglabels = false; |
269 | } |
294 | } |
270 | } |
295 | } |
271 | break; |
296 | break; |
272 | 297 | ||
273 | case 'D' : // 0.75a - Debug-Daten |
298 | case 'D' : // 0.75a - Debug-Daten |
274 | { |
299 | { |
275 | for (int z = 0; z < MAX_DebugData; z++) |
300 | for (int z = 0; z < MAX_DebugData; z++) |
276 | { |
301 | { |
277 | Debug_Data[z] = HandlerMK::Data2Int(OutData, (z * 2) + 2); |
302 | Debug_Data[z] = HandlerMK::Data2Int(OutData, (z * 2) + 2); |
278 | if (ac_Debug->isChecked()) |
303 | if (ac_Debug->isChecked()) |
279 | { |
304 | { |
280 | le_Debug[z]->setText(QString("%1").arg(Debug_Data[z])); |
305 | le_Debug[z]->setText(QString("%1").arg(Debug_Data[z])); |
281 | } |
306 | } |
282 | } |
307 | } |
283 | if (btn_Start->isChecked()) |
308 | if (btn_Start->isChecked()) |
284 | { |
309 | { |
285 | update_Plotter(); |
310 | update_Plotter(); |
286 | } |
311 | } |
287 | } |
312 | } |
288 | break; |
313 | break; |
289 | 314 | ||
290 | case 'V' : // 0.75a - Versions-Info |
315 | case 'V' : // 0.75a - Versions-Info |
291 | { |
316 | { |
292 | o_Input->stop_Resend(DATA_VERSION); |
317 | o_Input->stop_Resend(DATA_VERSION); |
293 | VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a'); |
318 | VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a'); |
294 | setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + VersionInfo.Hardware + " " + VersionInfo.Version); |
319 | setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + VersionInfo.Hardware + " " + VersionInfo.Version); |
295 | 320 | ||
296 | if (VersionInfo.ID == ADDRESS_FC) |
321 | if (VersionInfo.ID == ADDRESS_FC) |
297 | { |
322 | { |
298 | rb_FC->setChecked(true); |
323 | rb_FC->setChecked(true); |
299 | } |
324 | } |
300 | if (VersionInfo.ID == ADDRESS_NC) |
325 | if (VersionInfo.ID == ADDRESS_NC) |
301 | { |
326 | { |
302 | rb_NC->setChecked(true); |
327 | rb_NC->setChecked(true); |
303 | } |
328 | } |
304 | if (VersionInfo.ID == ADDRESS_MK3MAG) |
329 | if (VersionInfo.ID == ADDRESS_MK3MAG) |
305 | { |
330 | { |
306 | rb_MK3MAG->setChecked(true); |
331 | rb_MK3MAG->setChecked(true); |
307 | } |
332 | } |
308 | 333 | ||
309 | o_Settings->read_DebugLabels(VersionInfo.ID); |
334 | o_Settings->read_DebugLabels(VersionInfo.ID); |
310 | 335 | ||
311 | if (o_Settings->DebugData.Version != VersionInfo.Version) |
336 | if (o_Settings->DebugData.Version != VersionInfo.Version) |
312 | { |
337 | { |
313 | // qDebug(QString("Debug-Labels unterschiedlich. Neue anforden. " + o_Settings->DebugData.Version + " <> " + VersionInfo.Version).toLatin1().data()); |
338 | // qDebug(QString("Debug-Labels unterschiedlich. Neue anforden. " + o_Settings->DebugData.Version + " <> " + VersionInfo.Version).toLatin1().data()); |
314 | 339 | ||
315 | usleep(50000); |
340 | usleep(50000); |
316 | 341 | ||
317 | slot_ac_ReadLabels(); |
342 | slot_ac_ReadLabels(); |
318 | // o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
343 | // o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
319 | } |
344 | } |
320 | else |
345 | else |
321 | { |
346 | { |
322 | for(int z = 0; z < MAX_DebugData; z++) |
347 | for(int z = 0; z < MAX_DebugData; z++) |
323 | { |
348 | { |
324 | lb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
349 | lb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
325 | cb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
350 | cb_Debug[z]->setText(o_Settings->DebugData.Label[z]); |
326 | cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]); |
351 | cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]); |
327 | } |
352 | } |
328 | config_Plotter(); |
353 | config_Plotter(); |
329 | } |
354 | } |
330 | c_Data[0] = sb_Intervall->value() / 10; |
355 | c_Data[0] = sb_Intervall->value() / 10; |
331 | o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
356 | o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
332 | } |
357 | } |
333 | break; |
358 | break; |
334 | } |
359 | } |
335 | } |
360 | } |
336 | } |
361 | } |
337 | 362 | ||
338 | /////////// |
363 | /////////// |
339 | // Slots // |
364 | // Slots // |
340 | /////////// |
365 | /////////// |
341 | void dlg_Main::slot_Plotter_Start() |
366 | void dlg_Main::slot_Plotter_Start() |
342 | { |
367 | { |
343 | if (btn_Start->isChecked()) |
368 | if (btn_Start->isChecked()) |
344 | { |
369 | { |
345 | btn_Start->setText(tr("Plotter stoppen")); |
370 | btn_Start->setText(tr("Plotter stoppen")); |
346 | } |
371 | } |
347 | else |
372 | else |
348 | { |
373 | { |
349 | btn_Start->setText(tr("Plotter starten")); |
374 | btn_Start->setText(tr("Plotter starten")); |
350 | } |
375 | } |
351 | } |
376 | } |
352 | 377 | ||
353 | void dlg_Main::slot_btn_ChoseOK() |
378 | void dlg_Main::slot_btn_ChoseOK() |
354 | { |
379 | { |
355 | for(int z = 0; z < MAX_DebugData; z++) |
380 | for(int z = 0; z < MAX_DebugData; z++) |
356 | { |
381 | { |
357 | o_Settings->DebugData.Show_Plotter[z] = cb_Debug[z]->isChecked(); |
382 | o_Settings->DebugData.Show_Plotter[z] = cb_Debug[z]->isChecked(); |
358 | } |
383 | } |
359 | config_Plotter(); |
384 | config_Plotter(); |
360 | o_Settings->write_DebugLabels(VersionInfo.ID); |
385 | o_Settings->write_DebugLabels(VersionInfo.ID); |
361 | } |
386 | } |
362 | 387 | ||
363 | void dlg_Main::slot_ac_Chose() |
388 | void dlg_Main::slot_ac_Chose() |
364 | { |
389 | { |
365 | 390 | ||
366 | for(int z = 0; z < MAX_DebugData; z++) |
391 | for(int z = 0; z < MAX_DebugData; z++) |
367 | { |
392 | { |
368 | cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]); |
393 | cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]); |
369 | } |
394 | } |
370 | 395 | ||
371 | ac_Chose->setChecked(true); |
396 | ac_Chose->setChecked(true); |
372 | ac_Debug->setChecked(false); |
397 | ac_Debug->setChecked(false); |
373 | ac_Plotter->setChecked(false); |
398 | ac_Plotter->setChecked(false); |
374 | wg_Pages->setCurrentIndex(2); |
399 | wg_Pages->setCurrentIndex(2); |
375 | } |
400 | } |
376 | 401 | ||
377 | void dlg_Main::slot_ac_Debug() |
402 | void dlg_Main::slot_ac_Debug() |
378 | { |
403 | { |
379 | ac_Debug->setChecked(true); |
404 | ac_Debug->setChecked(true); |
380 | ac_Chose->setChecked(false); |
405 | ac_Chose->setChecked(false); |
381 | ac_Plotter->setChecked(false); |
406 | ac_Plotter->setChecked(false); |
382 | wg_Pages->setCurrentIndex(1); |
407 | wg_Pages->setCurrentIndex(1); |
383 | } |
408 | } |
384 | 409 | ||
385 | void dlg_Main::slot_ac_Plotter() |
410 | void dlg_Main::slot_ac_Plotter() |
386 | { |
411 | { |
387 | ac_Plotter->setChecked(true); |
412 | ac_Plotter->setChecked(true); |
388 | ac_Debug->setChecked(false); |
413 | ac_Debug->setChecked(false); |
389 | ac_Chose->setChecked(false); |
414 | ac_Chose->setChecked(false); |
390 | wg_Pages->setCurrentIndex(0); |
415 | wg_Pages->setCurrentIndex(0); |
391 | } |
416 | } |
392 | 417 | ||
393 | void dlg_Main::slot_ac_ReadLabels() |
418 | void dlg_Main::slot_ac_ReadLabels() |
394 | { |
419 | { |
395 | get_Analoglabels = true; |
420 | get_Analoglabels = true; |
396 | c_Data[0] = 0; |
421 | c_Data[0] = 0; |
397 | o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL); |
422 | o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL); |
398 | } |
423 | } |
399 | 424 | ||
400 | // About-Dialog |
425 | // About-Dialog |
401 | void dlg_Main::slot_ac_About() |
426 | void dlg_Main::slot_ac_About() |
402 | { |
427 | { |
403 | QMessageBox::about(this, trUtf8(("Ăśber ")) + QA_NAME, QA_ABOUT); |
428 | QMessageBox::about(this, trUtf8(("Ăśber ")) + QA_NAME, QA_ABOUT); |
404 | } |
429 | } |
405 | 430 | ||
406 | // Datenintervall geändert. |
431 | // Datenintervall geändert. |
407 | void dlg_Main::slot_sb_Intervall(int t_Intervall) |
432 | void dlg_Main::slot_sb_Intervall(int t_Intervall) |
408 | { |
433 | { |
409 | if (t_Intervall == 0) |
434 | if (t_Intervall == 0) |
410 | { |
435 | { |
411 | c_Data[0] = 0; |
436 | c_Data[0] = 0; |
412 | } |
437 | } |
413 | else |
438 | else |
414 | { |
439 | { |
415 | c_Data[0] = t_Intervall / 10; |
440 | c_Data[0] = t_Intervall / 10; |
416 | } |
441 | } |
417 | o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
442 | o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
418 | } |
443 | } |
419 | 444 | ||
420 | // Hardware auswählen. |
445 | // Hardware auswählen. |
421 | void dlg_Main::slot_rb_Hardware() |
446 | void dlg_Main::slot_rb_Hardware() |
422 | { |
447 | { |
423 | if ((rb_NC->isChecked() == false) && (VersionInfo.ID != ADDRESS_NC)) |
448 | if ((rb_NC->isChecked() == false) && (VersionInfo.ID != ADDRESS_NC)) |
424 | { |
449 | { |
425 | o_Input->send_Data(HandlerMK::get_SelectNC()); |
450 | o_Input->send_Data(HandlerMK::get_SelectNC()); |
426 | } |
451 | } |
427 | 452 | ||
428 | if (rb_FC->isChecked()) |
453 | if (rb_FC->isChecked()) |
429 | { |
454 | { |
430 | o_Input->send_Data(HandlerMK::get_SelectFC()); |
455 | o_Input->send_Data(HandlerMK::get_SelectFC()); |
431 | } |
456 | } |
432 | else |
457 | else |
433 | if (rb_MK3MAG->isChecked()) |
458 | if (rb_MK3MAG->isChecked()) |
434 | { |
459 | { |
435 | o_Input->send_Data(HandlerMK::get_SelectMK3MAG()); |
460 | o_Input->send_Data(HandlerMK::get_SelectMK3MAG()); |
436 | } |
461 | } |
437 | else |
462 | else |
438 | if (rb_NC->isChecked()) |
463 | if (rb_NC->isChecked()) |
439 | { |
464 | { |
440 | o_Input->send_Data(HandlerMK::get_SelectNC()); |
465 | o_Input->send_Data(HandlerMK::get_SelectNC()); |
441 | } |
466 | } |
442 | 467 | ||
443 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
468 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
444 | } |
469 | } |
445 | 470 | ||
446 | // Verbindung zum Server aufbauen |
471 | // Verbindung zum Server aufbauen |
447 | void dlg_Main::slot_ac_Connect() |
472 | void dlg_Main::slot_ac_Connect() |
448 | { |
473 | { |
449 | if (!o_Input->IsOpen()) |
474 | if (!o_Input->IsOpen()) |
450 | { |
475 | { |
451 | if (cb_Server->findText(cb_Server->currentText()) == -1) |
476 | if (cb_Server->findText(cb_Server->currentText()) == -1) |
452 | { |
477 | { |
453 | cb_Server->addItem(cb_Server->currentText()); |
478 | cb_Server->addItem(cb_Server->currentText()); |
454 | cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText())); |
479 | cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText())); |
455 | } |
480 | } |
456 | 481 | ||
457 | cb_Server->setEnabled(false); |
482 | cb_Server->setEnabled(false); |
458 | le_Password->setEnabled(false); |
483 | le_Password->setEnabled(false); |
- | 484 | ||
459 | 485 | // Connect ĂĽber Device |
|
460 | if (cb_Server->currentText().startsWith('/')) |
486 | if (cb_Server->currentText().startsWith('/')) |
461 | { |
487 | { |
462 | o_Input = new Input_TTY(); |
488 | o_Input = new Input_TTY(); |
463 | o_Input->Init(); |
489 | o_Input->Init(); |
464 | 490 | ||
465 | set_Input s_Input; |
491 | set_Input s_Input; |
466 | s_Input.Main = cb_Server->currentText(); |
492 | s_Input.Main = cb_Server->currentText(); |
467 | 493 | ||
468 | if (o_Input->Open(s_Input) == true) |
494 | if (o_Input->Open(s_Input) == true) |
469 | { |
495 | { |
470 | ac_Connect->setText(tr("Trennen")); |
496 | ac_Connect->setText(tr("Trennen")); |
471 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
497 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
472 | 498 | ||
473 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
499 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
474 | } |
500 | } |
475 | else |
501 | else |
476 | { |
502 | { |
477 | cb_Server->setEnabled(true); |
503 | cb_Server->setEnabled(true); |
478 | le_Password->setEnabled(true); |
504 | le_Password->setEnabled(true); |
479 | } |
505 | } |
480 | 506 | ||
481 | } |
507 | } |
482 | else |
508 | else // Connect ĂĽber TCPIP |
483 | { |
509 | { |
484 | o_Input = new Input_TCP(); |
510 | o_Input = new Input_TCP(); |
485 | o_Input->Init(); |
511 | o_Input->Init(); |
486 | 512 | ||
487 | set_Input s_Input; |
513 | set_Input s_Input; |
488 | 514 | ||
489 | QStringList Server = cb_Server->currentText().split(":"); |
515 | QStringList Server = cb_Server->currentText().split(":"); |
490 | 516 | ||
491 | s_Input.Main = Server[0]; |
517 | s_Input.Main = Server[0]; |
492 | s_Input.Sub = Server[1]; |
518 | s_Input.Sub = Server[1]; |
493 | 519 | ||
494 | if (o_Input->Open(s_Input) == true) |
520 | if (o_Input->Open(s_Input) == true) |
495 | { |
521 | { |
496 | connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int))); |
522 | connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int))); |
497 | connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected())); |
523 | connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected())); |
498 | } |
524 | } |
499 | } |
525 | } |
500 | } |
526 | } |
501 | else |
527 | else |
502 | { |
528 | { |
503 | cb_Server->setEnabled(true); |
529 | cb_Server->setEnabled(true); |
504 | le_Password->setEnabled(true); |
530 | le_Password->setEnabled(true); |
505 | 531 | ||
506 | ac_Connect->setText(tr("Verbinden")); |
532 | ac_Connect->setText(tr("Verbinden")); |
507 | o_Input->Close(); |
533 | o_Input->Close(); |
508 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
534 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
509 | if (o_Input->Mode() == TCP) |
535 | if (o_Input->Mode() == TCP) |
510 | { |
536 | { |
511 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
537 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
512 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
538 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
513 | } |
539 | } |
514 | } |
540 | } |
515 | } |
541 | } |
516 | 542 | ||
517 | // Neue Daten empfangen. |
543 | // Neue Daten empfangen. |
518 | void dlg_Main::slot_Input_Data(QString t_Data) |
544 | void dlg_Main::slot_Input_Data(QString t_Data) |
519 | { |
545 | { |
520 | if ((t_Data[0] == '#')) |
546 | if ((t_Data[0] == '#')) |
521 | { |
547 | { |
522 | if ((HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length() - 1)) || ((o_Input->Mode() == TTY) && (HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length())))) |
548 | if ((HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length() - 1)) || ((o_Input->Mode() == TTY) && (HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length())))) |
523 | { |
549 | { |
524 | parse_MK_Data(t_Data); |
550 | parse_MK_Data(t_Data); |
525 | } |
551 | } |
526 | else |
552 | else |
527 | { |
553 | { |
528 | // qDebug(QString("CRC-Error - " + t_Data).toLatin1().data()); |
554 | qDebug(QString("CRC-Error - " + t_Data).toLatin1().data()); |
529 | } |
555 | } |
530 | } |
556 | } |
531 | else if (o_Input->Mode() == TCP) |
557 | else if ((o_Input->Mode() == TCP) && (t_Data[0] == '$')) |
532 | { |
558 | { |
533 | parse_IP_Data(t_Data); |
559 | parse_IP_Data(t_Data); |
534 | } |
560 | } |
535 | } |
561 | } |
536 | 562 | ||
537 | void dlg_Main::slot_Input_Disconnected(int Error) |
563 | void dlg_Main::slot_Input_Disconnected(int Error) |
538 | { |
564 | { |
539 | cb_Server->setEnabled(true); |
565 | cb_Server->setEnabled(true); |
540 | le_Password->setEnabled(true); |
566 | le_Password->setEnabled(true); |
541 | - | ||
542 | // qDebug("Close"); |
567 | |
543 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
- | |
544 | if (o_Input->Mode() == TCP) |
- | |
545 | { |
568 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
546 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
569 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
547 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
570 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
548 | } |
571 | |
549 | ac_Connect->setChecked(false); |
572 | ac_Connect->setChecked(false); |
550 | ac_Connect->setText(tr("Verbinden")); |
573 | ac_Connect->setText(tr("Verbinden")); |
551 | 574 | ||
552 | switch (Error) |
575 | switch (Error) |
553 | { |
576 | { |
554 | case REMOTECLOSED : |
577 | case REMOTECLOSED : |
555 | { |
578 | { |
556 | // lb_Status->setText(tr("Verbindung vom Server beendet.")); |
579 | // lb_Status->setText(tr("Verbindung vom Server beendet.")); |
557 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok); |
580 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok); |
558 | } |
581 | } |
559 | break; |
582 | break; |
560 | case REFUSED : |
583 | case REFUSED : |
561 | { |
584 | { |
562 | // lb_Status->setText(tr("Server nicht gefunden.")); |
585 | // lb_Status->setText(tr("Server nicht gefunden.")); |
563 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok); |
586 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok); |
564 | } |
587 | } |
565 | break; |
588 | break; |
566 | case 3 : |
589 | case 3 : |
567 | { |
590 | { |
568 | // lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch.")); |
591 | // lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch.")); |
569 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok); |
592 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok); |
570 | } |
593 | } |
571 | break; |
594 | break; |
572 | default : |
595 | default : |
573 | { |
596 | { |
574 | // lb_Status->setText(tr("Getrennt vom QMK-Datenserver.")); |
597 | // lb_Status->setText(tr("Getrennt vom QMK-Datenserver.")); |
575 | } |
598 | } |
576 | break; |
599 | break; |
577 | } |
600 | } |
578 | 601 | ||
579 | } |
602 | } |
580 | 603 | ||
581 | void dlg_Main::slot_Input_Connected() |
604 | void dlg_Main::slot_Input_Connected() |
582 | { |
605 | { |
583 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
606 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
584 | 607 | ||
585 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION)); |
608 | // o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION)); |
586 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
609 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
587 | ac_Connect->setText(tr("Trennen")); |
610 | ac_Connect->setText(tr("Trennen")); |
588 | } |
611 | } |
589 | 612 | ||
590 | // Programm Ende |
613 | // Programm Ende |
591 | dlg_Main::~dlg_Main() |
614 | dlg_Main::~dlg_Main() |
592 | { |
615 | { |
593 | o_Settings->GUI.isMax = isMaximized(); |
616 | o_Settings->GUI.isMax = isMaximized(); |
594 | o_Settings->GUI.Size = size(); |
617 | o_Settings->GUI.Size = size(); |
595 | o_Settings->GUI.Point = pos(); |
618 | o_Settings->GUI.Point = pos(); |
596 | 619 | ||
597 | o_Settings->DATA.Debug_Intervall = sb_Intervall->value(); |
620 | o_Settings->DATA.Debug_Intervall = sb_Intervall->value(); |
598 | 621 | ||
599 | o_Settings->SERVER.Password = le_Password->text(); |
622 | o_Settings->SERVER.Password = le_Password->text(); |
600 | o_Settings->SERVER.IP_MAX = cb_Server->count(); |
623 | o_Settings->SERVER.IP_MAX = cb_Server->count(); |
601 | o_Settings->SERVER.IP_ID = cb_Server->currentIndex(); |
624 | o_Settings->SERVER.IP_ID = cb_Server->currentIndex(); |
602 | 625 | ||
603 | for (int z = 0; z < cb_Server->count(); z++) |
626 | for (int z = 0; z < cb_Server->count(); z++) |
604 | { |
627 | { |
605 | if (z < 10) |
628 | if (z < 10) |
606 | { |
629 | { |
607 | o_Settings->SERVER.IP[z] = cb_Server->itemText(z); |
630 | o_Settings->SERVER.IP[z] = cb_Server->itemText(z); |
608 | } |
631 | } |
609 | } |
632 | } |
610 | 633 | ||
611 | o_Settings->write_Settings(); |
634 | o_Settings->write_Settings(); |
612 | 635 | ||
613 | // qDebug("Ende."); |
636 | // qDebug("Ende."); |
614 | } |
637 | } |
615 | 638 |