Subversion Repositories Projects

Rev

Rev 711 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 711 Rev 750
Line 25... Line 25...
25
// Konstruktor Main-Form
25
// Konstruktor Main-Form
26
dlg_Main::dlg_Main()
26
dlg_Main::dlg_Main()
27
{
27
{
28
    setupUi(this);
28
    setupUi(this);
Line -... Line 29...
-
 
29
 
29
 
30
 
Line 30... Line 31...
30
    o_Settings = new cSettings();
31
    o_Settings = new cSettings();
Line 31... Line 32...
31
 
32
 
Line 32... Line 33...
32
    o_Settings->read_DebugLabels(0);
33
    o_Settings->read_DebugLabels(0);
33
 
34
 
34
    o_Input = new Input();
35
    wg_Connection->set_Client(ID_SCOPE, QA_NAME + " " + QA_VERSION, DataFields);
35
 
36
 
Line 49... Line 50...
49
    if (o_Settings->GUI.isMax)
50
    if (o_Settings->GUI.isMax)
50
    {
51
    {
51
        showMaximized();
52
        showMaximized();
52
    }
53
    }
Line 53... Line -...
53
 
-
 
54
    for(int z = 0; z < o_Settings->SERVER.IP_MAX; z++)
-
 
55
    {
-
 
56
        if (cb_Server->findText(o_Settings->SERVER.IP[z]) == -1)
-
 
57
        {
-
 
58
            cb_Server->addItem(o_Settings->SERVER.IP[z]);
-
 
59
        }
-
 
60
    }
-
 
61
 
-
 
62
    cb_Server->setCurrentIndex(o_Settings->SERVER.IP_ID);
-
 
63
 
54
 
64
    le_Password->setText(o_Settings->SERVER.Password);
-
 
65
 
55
    wg_Connection->set_SelectVisible(false);
Line 66... Line 56...
66
    sb_Intervall->setValue(o_Settings->DATA.Debug_Intervall);
56
    wg_Connection->set_ButtonVisible(false);
Line 67... Line 57...
67
 
57
 
Line 96... Line 86...
96
}
86
}
Line 97... Line 87...
97
 
87
 
98
// Signale mit Slots verbinden
88
// Signale mit Slots verbinden
99
void dlg_Main::init_Connections()
89
void dlg_Main::init_Connections()
100
{
90
{
Line 101... Line -...
101
    connect(sb_Intervall, SIGNAL(valueChanged(int)), this, SLOT(slot_sb_Intervall(int)));
-
 
102
 
91
    connect(ac_Connect, SIGNAL(triggered()), wg_Connection, SLOT(slot_btn_Connect()));
103
    connect(ac_Connect, SIGNAL(triggered()), this, SLOT(slot_ac_Connect()));
92
 
104
    connect(ac_Plotter, SIGNAL(triggered()), this, SLOT(slot_ac_Plotter()));
93
    connect(ac_Plotter, SIGNAL(triggered()), this, SLOT(slot_ac_Plotter()));
Line 105... Line 94...
105
    connect(ac_Debug,   SIGNAL(triggered()), this, SLOT(slot_ac_Debug()));
94
    connect(ac_Debug,   SIGNAL(triggered()), this, SLOT(slot_ac_Debug()));
Line 106... Line -...
106
    connect(ac_Chose,   SIGNAL(triggered()), this, SLOT(slot_ac_Chose()));
-
 
107
 
-
 
108
    connect(ac_ReadLabels, SIGNAL(triggered()), this, SLOT(slot_ac_ReadLabels()));
-
 
109
 
-
 
110
    connect(rb_NC,      SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
95
    connect(ac_Chose,   SIGNAL(triggered()), this, SLOT(slot_ac_Chose()));
Line 111... Line 96...
111
    connect(rb_FC,      SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
96
 
112
    connect(rb_MK3MAG,  SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
97
    connect(ac_ReadLabels, SIGNAL(triggered()), this, SLOT(slot_ac_ReadLabels()));
Line 113... Line 98...
113
 
98
 
114
    connect(Plotter_Scroll, SIGNAL(valueChanged(int)), this, SLOT(slot_Plotter_Scroll(int)));
99
    connect(Plotter_Scroll, SIGNAL(valueChanged(int)), this, SLOT(slot_Plotter_Scroll(int)));
115
 
100
 
-
 
101
    connect(btn_Start, SIGNAL(clicked()), this, SLOT(slot_Plotter_Start()));
-
 
102
    connect(btn_ChoseOK, SIGNAL(clicked()), this, SLOT(slot_btn_ChoseOK()));
-
 
103
 
-
 
104
    // About QMK-Kernel & About-QT Dialog einfügen
-
 
105
    connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About()));
116
    connect(btn_Start, SIGNAL(clicked()), this, SLOT(slot_Plotter_Start()));
106
    menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt()));
Line 117... Line 107...
117
    connect(btn_ChoseOK, SIGNAL(clicked()), this, SLOT(slot_btn_ChoseOK()));
107
 
118
 
108
    connect(wg_Connection, SIGNAL(sig_Status(int)), this, SLOT(slot_ConnectionStatus(int)));
119
    // About QMK-Kernel & About-QT Dialog einfügen
109
    connect(wg_Connection, SIGNAL(sig_MK_Version(s_Hardware)), this, SLOT(slot_MK_Version(s_Hardware)));
Line 196... Line 186...
196
{
186
{
197
    qwt_Plotter->setAxisScale(QwtPlot::xBottom,Position,Position + o_Settings->DATA.Plotter_Count,0);
187
    qwt_Plotter->setAxisScale(QwtPlot::xBottom,Position,Position + o_Settings->DATA.Plotter_Count,0);
198
    qwt_Plotter->replot();
188
    qwt_Plotter->replot();
199
}
189
}
Line 200... Line 190...
200
 
190
 
201
// IP-Input-Daten verarbeiten.
-
 
202
void dlg_Main::parse_IP_Data(QString t_Data)
-
 
203
{
191
///////////
204
    QStringList Data;
-
 
205
    Data = t_Data.split(":");
-
 
206
 
-
 
207
    if (Data.count() > 1)
192
// Slots //
208
    {
-
 
Line 209... Line 193...
209
        int CMD = Data[2].toInt();
193
///////////
210
 
-
 
211
        switch(CMD)
194
 
212
        {
195
// About-Dialog
213
            case 101 :
196
void dlg_Main::slot_ac_About()
214
            {
197
{
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;
-
 
Line 225... Line 198...
225
 
198
    QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT);
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
                }
-
 
239
            }
199
}
240
            break;
200
 
241
            case 505 :
201
void dlg_Main::slot_ConnectionStatus(int li_Status)
-
 
202
{
-
 
203
    if (li_Status)
242
            {
204
    {
243
                if (Data[3] == "OK")
205
        ac_Connect->setChecked(true);
244
                {
206
        ac_Connect->setText(tr("Trennen"));
245
                }
-
 
246
                else
207
    }
247
                {
-
 
248
                    QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok);
208
    else
249
                }
-
 
250
            }
209
    {
251
            break;
210
        ac_Connect->setChecked(false);
Line 252... Line -...
252
        }
-
 
253
    }
211
        ac_Connect->setText(tr("Verbinden"));
254
}
212
    }
255
 
213
}
256
// MK-Eingangsdaten verarbeiten
214
 
Line 257... Line -...
257
void dlg_Main::parse_MK_Data(QString t_Data)
-
 
258
{
-
 
259
    unsigned char OutData[150];
-
 
260
    char *InData = t_Data.toLatin1().data();
-
 
261
 
-
 
262
    if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0)
-
 
263
    {
-
 
264
        switch(InData[2])
-
 
265
        {
-
 
266
            case 'A' : // 0.76e - Debug-Labels
-
 
267
                {
-
 
268
                    o_Input->stop_Resend(DATA_READ_LABEL);
215
void dlg_Main::slot_MK_Version(s_Hardware ls_Version)
269
                    int Position = OutData[0];
-
 
270
                    if (Position < 32)
-
 
271
                    {
-
 
272
                        o_Settings->DebugData.Label[Position] = HandlerMK::Data2QString(OutData,1,17).trimmed();
-
 
273
                        if (o_Settings->DebugData.Label[Position] == "")
-
 
Line 274... Line -...
274
                        {
-
 
275
                            o_Settings->DebugData.Label[Position] = "Debug-" + QString("%1").arg(Position);
-
 
276
                        }
216
{
277
                        lb_Debug[Position]->setText("" + o_Settings->DebugData.Label[Position]);
217
    gs_Version = ls_Version;
278
                        cb_Debug[Position]->setText("" + o_Settings->DebugData.Label[Position]);
-
 
279
 
218
    setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + ls_Version.Hardware + " " + ls_Version.Version);
280
                        Position ++;
219
 
-
 
220
    o_Settings->read_DebugLabels(gs_Version.ID);
-
 
221
 
281
 
222
    if (o_Settings->DebugData.Version != gs_Version.Version)
282
                        if ((Position < 32) && (get_Analoglabels == true))
223
    {
283
                        {
224
        qDebug(QString("Debug-Labels unterschiedlich. Neue anforden. " + o_Settings->DebugData.Version + " <> " + gs_Version.Version).toLatin1().data());
-
 
225
        usleep(50000);
-
 
226
 
-
 
227
        slot_ac_ReadLabels();
284
                            c_Data[0] = Position;
228
    }
285
                            o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL);
229
    else
-
 
230
    {
286
                        }
231
        for(int z = 0; z < MAX_DebugData; z++)
287
                    }
-
 
288
                    if (Position == 32)
232
        {
289
                    {
233
            lb_Debug[z]->setText(o_Settings->DebugData.Label[z]);
290
                        o_Settings->DebugData.Version = VersionInfo.Version;
-
 
Line 291... Line 234...
291
                        o_Settings->write_DebugLabels(VersionInfo.ID);
234
            cb_Debug[z]->setText(o_Settings->DebugData.Label[z]);
292
                        config_Plotter();
235
            cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]);
-
 
236
        }
-
 
237
        config_Plotter();
293
                        get_Analoglabels = false;
238
    }
294
                    }
239
}
295
                }
240
 
296
            break;
241
void dlg_Main::slot_MK_Debug(s_MK_Debug ls_Debug)
297
 
242
{
298
            case 'D' : // 0.75a - Debug-Daten
243
    gs_Debug = ls_Debug;
299
                {
244
 
300
                    for (int z = 0; z < MAX_DebugData; z++)
245
    for (int z = 0; z < MAX_DebugData; z++)
301
                    {
246
    {
302
                        Debug_Data[z] = HandlerMK::Data2Int(OutData, (z * 2) + 2);
247
        Debug_Data[z] = ls_Debug.Analog[z];
303
                        if (ac_Debug->isChecked())
248
        if (ac_Debug->isChecked())
304
                        {
249
        {
305
                            le_Debug[z]->setText(QString("%1").arg(Debug_Data[z]));
250
           le_Debug[z]->setText(QString("%1").arg(Debug_Data[z]));
306
                        }
-
 
307
                    }
-
 
308
                    if (btn_Start->isChecked())
-
 
309
                    {
-
 
310
                        update_Plotter();
-
 
311
                    }
-
 
312
                }
-
 
Line 313... Line 251...
313
            break;
251
        }
314
 
252
    }
315
            case 'V' : // 0.75a - Versions-Info
-
 
316
                {
-
 
317
                    o_Input->stop_Resend(DATA_VERSION);
253
    if (btn_Start->isChecked())
318
                    VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a');
254
    {
319
                    setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + VersionInfo.Hardware + " " + VersionInfo.Version);
255
       update_Plotter();
320
 
-
 
321
                    if (VersionInfo.ID == ADDRESS_FC)
256
    }
322
                    {
257
}
323
                        rb_FC->setChecked(true);
258
 
324
                    }
259
void dlg_Main::slot_MK_DebugLabels(s_MK_DebugLabels MK_DebugLabels)
-
 
260
{
-
 
261
    if (MK_DebugLabels.Position < 32)
Line 325... Line -...
325
                    if (VersionInfo.ID == ADDRESS_NC)
-
 
326
                    {
-
 
327
                        rb_NC->setChecked(true);
-
 
328
                    }
-
 
329
                    if (VersionInfo.ID == ADDRESS_MK3MAG)
-
 
330
                    {
-
 
331
                        rb_MK3MAG->setChecked(true);
-
 
332
                    }
-
 
333
 
-
 
334
                    o_Settings->read_DebugLabels(VersionInfo.ID);
-
 
335
 
262
    {
336
                    if (o_Settings->DebugData.Version != VersionInfo.Version)
263
        o_Settings->DebugData.Label[MK_DebugLabels.Position] = MK_DebugLabels.Text;
337
                    {
264
        if (o_Settings->DebugData.Label[MK_DebugLabels.Position] == "")
338
//                        qDebug(QString("Debug-Labels unterschiedlich. Neue anforden. " + o_Settings->DebugData.Version + " <> " + VersionInfo.Version).toLatin1().data());
265
        {
339
 
-
 
340
                        usleep(50000);
266
            o_Settings->DebugData.Label[MK_DebugLabels.Position] = "Debug-" + QString("%1").arg(MK_DebugLabels.Position);
341
 
-
 
342
                        slot_ac_ReadLabels();
-
 
343
//                        o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data());
-
 
344
                    }
267
        }
345
                    else
268
        lb_Debug[MK_DebugLabels.Position]->setText("" + o_Settings->DebugData.Label[MK_DebugLabels.Position]);
346
                    {
-
 
347
                        for(int z = 0; z < MAX_DebugData; z++)
-
 
348
                        {
-
 
349
                            lb_Debug[z]->setText(o_Settings->DebugData.Label[z]);
-
 
350
                            cb_Debug[z]->setText(o_Settings->DebugData.Label[z]);
-
 
351
                            cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]);
-
 
352
                        }
269
        cb_Debug[MK_DebugLabels.Position]->setText("" + o_Settings->DebugData.Label[MK_DebugLabels.Position]);
Line 353... Line -...
353
                        config_Plotter();
-
 
354
                    }
-
 
355
                    c_Data[0] = sb_Intervall->value() / 10;
-
 
356
                    o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data());
270
 
357
                }
271
    }
358
            break;
272
    if (MK_DebugLabels.Position == 31)
359
        }
273
    {
360
    }
274
        o_Settings->DebugData.Version = gs_Version.Version;
Line 380... Line 294...
380
    for(int z = 0; z < MAX_DebugData; z++)
294
    for(int z = 0; z < MAX_DebugData; z++)
381
    {
295
    {
382
        o_Settings->DebugData.Show_Plotter[z] = cb_Debug[z]->isChecked();
296
        o_Settings->DebugData.Show_Plotter[z] = cb_Debug[z]->isChecked();
383
    }
297
    }
384
    config_Plotter();
298
    config_Plotter();
385
    o_Settings->write_DebugLabels(VersionInfo.ID);
299
    o_Settings->write_DebugLabels(gs_Version.ID);
386
}
300
}
Line 387... Line 301...
387
 
301
 
388
void dlg_Main::slot_ac_Chose()
302
void dlg_Main::slot_ac_Chose()
389
{
-
 
390
 
303
{
391
    for(int z = 0; z < MAX_DebugData; z++)
304
    for(int z = 0; z < MAX_DebugData; z++)
392
    {
305
    {
393
        cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]);
306
        cb_Debug[z]->setChecked(o_Settings->DebugData.Show_Plotter[z]);
Line 415... Line 328...
415
    wg_Pages->setCurrentIndex(0);
328
    wg_Pages->setCurrentIndex(0);
416
}
329
}
Line 417... Line 330...
417
 
330
 
418
void dlg_Main::slot_ac_ReadLabels()
331
void dlg_Main::slot_ac_ReadLabels()
419
{
-
 
420
    get_Analoglabels = true;
332
{
421
    c_Data[0] = 0;
333
    c_Data[0] = 0;
422
    o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL);
-
 
423
}
-
 
424
 
-
 
425
// About-Dialog
-
 
426
void dlg_Main::slot_ac_About()
-
 
427
{
-
 
428
    QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT);
-
 
429
}
-
 
430
 
-
 
431
// Datenintervall geändert.
-
 
432
void dlg_Main::slot_sb_Intervall(int t_Intervall)
-
 
433
{
-
 
434
    if (t_Intervall == 0)
-
 
435
    {
-
 
436
        c_Data[0] = 0;
-
 
437
    }
-
 
438
    else
-
 
439
    {
-
 
440
        c_Data[0] = t_Intervall / 10;
-
 
441
    }
-
 
442
    o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data());
-
 
443
}
-
 
444
 
-
 
445
// Hardware auswählen.
-
 
446
void dlg_Main::slot_rb_Hardware()
-
 
447
{
-
 
448
    if ((rb_NC->isChecked() == false) && (VersionInfo.ID != ADDRESS_NC))
-
 
449
    {
-
 
450
        o_Input->send_Data(HandlerMK::get_SelectNC());
-
 
451
    }
-
 
452
 
-
 
453
    if (rb_FC->isChecked())
-
 
454
    {
-
 
455
        o_Input->send_Data(HandlerMK::get_SelectFC());
-
 
456
    }
-
 
457
    else
-
 
458
    if (rb_MK3MAG->isChecked())
-
 
459
    {
-
 
460
        o_Input->send_Data(HandlerMK::get_SelectMK3MAG());
-
 
461
    }
-
 
462
    else
-
 
463
    if (rb_NC->isChecked())
-
 
464
    {
-
 
465
        o_Input->send_Data(HandlerMK::get_SelectNC());
-
 
466
    }
-
 
467
 
-
 
468
    o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION);
-
 
469
}
-
 
470
 
-
 
471
// Verbindung zum Server aufbauen
-
 
472
void dlg_Main::slot_ac_Connect()
-
 
473
{
-
 
474
    if (!o_Input->IsOpen())
-
 
475
    {
-
 
476
        if (cb_Server->findText(cb_Server->currentText()) == -1)
-
 
477
        {
-
 
478
            cb_Server->addItem(cb_Server->currentText());
-
 
479
            cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText()));
-
 
480
        }
-
 
481
 
-
 
482
        cb_Server->setEnabled(false);
-
 
483
        le_Password->setEnabled(false);
-
 
484
 
-
 
485
        // Connect über Device
-
 
486
        if (cb_Server->currentText().startsWith('/'))
-
 
487
        {
-
 
488
            o_Input = new Input_TTY();
-
 
489
            o_Input->Init();
-
 
490
 
-
 
491
            set_Input s_Input;
-
 
492
            s_Input.Main = cb_Server->currentText();
-
 
493
 
-
 
494
            if (o_Input->Open(s_Input) == true)
-
 
495
            {
-
 
496
                ac_Connect->setText(tr("Trennen"));
-
 
497
                connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString)));
-
 
498
 
-
 
499
                o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION);
-
 
500
            }
-
 
501
            else
-
 
502
            {
-
 
503
                cb_Server->setEnabled(true);
-
 
504
                le_Password->setEnabled(true);
-
 
505
            }
-
 
506
 
-
 
507
        }
-
 
508
        else // Connect über TCPIP
-
 
509
        {
-
 
510
            o_Input = new Input_TCP();
-
 
511
            o_Input->Init();
-
 
512
 
-
 
513
            set_Input s_Input;
-
 
514
 
-
 
515
            QStringList Server = cb_Server->currentText().split(":");
-
 
516
 
-
 
517
            s_Input.Main = Server[0];
-
 
518
            s_Input.Sub  = Server[1];
-
 
519
 
-
 
520
            if (o_Input->Open(s_Input) == true)
-
 
521
            {
-
 
522
                connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int)));
-
 
523
                connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected()));
-
 
524
            }
-
 
525
        }
-
 
526
    }
-
 
527
    else
-
 
528
    {
-
 
529
        cb_Server->setEnabled(true);
-
 
530
        le_Password->setEnabled(true);
-
 
531
 
-
 
532
        ac_Connect->setText(tr("Verbinden"));
-
 
533
        o_Input->Close();
-
 
534
        disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0);
-
 
535
        if (o_Input->Mode() == TCP)
-
 
536
        {
-
 
537
            disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0);
-
 
538
            disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0);
-
 
539
        }
-
 
540
    }
-
 
541
}
-
 
542
 
-
 
543
// Neue Daten empfangen.
-
 
544
void dlg_Main::slot_Input_Data(QString t_Data)
-
 
545
{
-
 
546
    if ((t_Data[0] == '#'))
-
 
547
    {
-
 
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()))))
-
 
549
        {
-
 
550
            parse_MK_Data(t_Data);
-
 
551
        }
-
 
552
        else
-
 
553
        {
-
 
554
            qDebug(QString("CRC-Error - " + t_Data).toLatin1().data());
-
 
555
        }
-
 
556
    }
-
 
557
    else if ((o_Input->Mode() == TCP) && (t_Data[0] == '$'))
-
 
558
    {
-
 
559
        parse_IP_Data(t_Data);
-
 
560
    }
-
 
561
}
-
 
562
 
-
 
563
void dlg_Main::slot_Input_Disconnected(int Error)
-
 
564
{
-
 
565
    cb_Server->setEnabled(true);
-
 
566
    le_Password->setEnabled(true);
-
 
567
 
-
 
568
    disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0);
-
 
569
    disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0);
-
 
570
    disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0);
-
 
571
 
-
 
572
    ac_Connect->setChecked(false);
-
 
573
    ac_Connect->setText(tr("Verbinden"));
-
 
574
 
-
 
575
    switch (Error)
-
 
576
    {
-
 
577
        case REMOTECLOSED :
-
 
578
        {
-
 
579
//            lb_Status->setText(tr("Verbindung vom Server beendet."));
-
 
580
            QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok);
-
 
581
        }
-
 
582
        break;
-
 
583
        case REFUSED :
-
 
584
        {
-
 
585
//            lb_Status->setText(tr("Server nicht gefunden."));
-
 
586
            QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok);
-
 
587
        }
-
 
588
        break;
-
 
589
        case 3 :
-
 
590
        {
-
 
591
//            lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch."));
-
 
592
            QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok);
-
 
593
        }
-
 
594
        break;
-
 
595
        default :
-
 
596
        {
-
 
597
//            lb_Status->setText(tr("Getrennt vom QMK-Datenserver."));
-
 
598
        }
-
 
599
        break;
-
 
600
    }
-
 
601
 
-
 
602
}
-
 
603
 
-
 
604
void dlg_Main::slot_Input_Connected()
-
 
605
{
-
 
606
    connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString)));
-
 
607
 
-
 
608
//    o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION));
-
 
609
    o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION);
-
 
610
    ac_Connect->setText(tr("Trennen"));
334
    wg_Connection->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL);
Line 611... Line 335...
611
}
335
}
612
 
336
 
613
// Programm Ende
337
// Programm Ende
614
dlg_Main::~dlg_Main()
338
dlg_Main::~dlg_Main()
615
{
339
{
616
    o_Settings->GUI.isMax       = isMaximized();
340
    o_Settings->GUI.isMax       = isMaximized();
Line 617... Line -...
617
    o_Settings->GUI.Size        = size();
-
 
618
    o_Settings->GUI.Point       = pos();
-
 
619
 
-
 
620
    o_Settings->DATA.Debug_Intervall = sb_Intervall->value();
-
 
621
 
-
 
622
    o_Settings->SERVER.Password = le_Password->text();
-
 
623
    o_Settings->SERVER.IP_MAX  = cb_Server->count();
-
 
624
    o_Settings->SERVER.IP_ID   = cb_Server->currentIndex();
-
 
625
 
-
 
626
    for (int z = 0; z < cb_Server->count(); z++)
-
 
627
    {
-
 
628
        if (z < 10)
-
 
629
        {
-
 
630
            o_Settings->SERVER.IP[z] = cb_Server->itemText(z);
-
 
631
        }
341
    o_Settings->GUI.Size        = size();
632
    }
-
 
633
 
-
 
634
    o_Settings->write_Settings();
342
    o_Settings->GUI.Point       = pos();