-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
4978 lines (3867 loc) · 185 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "mainwindow.h"
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonDocument>
#include <QFileDialog>
#include <QDesktopWidget>
#include "ui_mainwindow.h"
#include "matildaclient.h"
#include "moji_defy.h"
#include "peredavatordbgclient.h"
#include "energydialog.h"
#include "wait4answerdialog.h"
#include "insertmeterdialog.h"
#include "directaccesmatildaservice.h"
#include "selectdevbymacaddrdialog.h"
#include "scanipdialog.h"
#include "settloader.h"
#include "langdialog.h"
#include "showmesshelper.h"
#include "ucmetereventcodes.h"
#include "helpform.h"
#include "src/matilda/classmanagerhelper.h"
MainWindow::MainWindow(const QFont &font4log, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
createLanguageMenu();
modelDevOptions = new QStandardItemModel(this);
lDevInfo = new LastDevInfo(this);
modelAddMeter = new QStandardItemModel(0,7, this);
modelProfile4DB = new QStandardItemModel(0,1,this);
modelProfile4Hash = new QStandardItemModel(0,1,this);
modelTarif4DB = new QStandardItemModel(0,1,this);
modelPhVal4DB = new QStandardItemModel(0,1,this);
modelDbData = new QStandardItemModel(0,7, this);
modelTimeZone = new QStandardItemModel(this);
modelDbDataEv = new QStandardItemModel(this);
modelEvent4DB = new QStandardItemModel(0,1,this);
modelPollStat = new QStandardItemModel(0,8, this);
modelSvahaList = new QStandardItemModel(0,3, this);
modelDayProfile4mac = new QStandardItemModel(0,2, this);
modelPeredavatorHost = new QStandardItemModel(0,3, this);
modelDayProfile4peredavator = new QStandardItemModel(0,2, this);
modelForward = new QStandardItemModel(0,2,this);
proxy_modelDevOptions = new MySortFilterProxyModel(this);
proxy_modelAddMeter = new MySortFilterProxyModel(this);
proxy_modelPhVal4DB = new MySortFilterProxyModel(this);
proxy_modelDbData = new MySortFilterProxyModel(this);
proxy_modelTimeZone = new MySortFilterProxyModel(this);
proxy_modelDbDataEv = new MySortFilterProxyModel(this);
proxy_modelPollStat = new MySortFilterProxyModel(this);
proxy_modelForward = new MySortFilterProxyModel(this);
proxy_modelForward->setSourceModel(modelForward);
proxy_modelForward->setDynamicSortFilter(true);
connect(ui->leRouteFilter, SIGNAL(textChanged(QString)), proxy_modelForward, SLOT(setNewFileterStr(QString)) );
proxy_modelForward->setFilterMode(getFilterList(0,2));
ui->tvForward->setModel(proxy_modelForward);
ui->tvForward->setContextMenuPolicy(Qt::CustomContextMenu);
// proxy_modelDevOptions->setSourceModel(modelDevOptions);
proxy_modelDevOptions->setDynamicSortFilter(true);
connect(ui->leFilterDevOperation, SIGNAL(textChanged(QString)), proxy_modelDevOptions, SLOT(setNewFileterStr(QString)) );
// filterMode.append(0);
proxy_modelDevOptions->setFilterMode(getFilterList(0,2));
// ui->trDevOperation->setModel(proxy_modelDevOptions);
proxy_modelAddMeter->setSourceModel(modelAddMeter);
proxy_modelAddMeter->setDynamicSortFilter(true);
ui->tvAddMeterTable->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->leAddMeterFilter, SIGNAL(textChanged(QString)), proxy_modelAddMeter, SLOT(setNewFileterStr(QString)) );
proxy_modelAddMeter->setFilterMode(getFilterList(1,3));
ui->tvAddMeterTable->setModel(proxy_modelAddMeter);
proxy_modelDbData->setSourceModel(modelDbData);
proxy_modelDbData->setDynamicSortFilter(true);
ui->tvMeterDataPollData->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->leMeterDataFIlter, SIGNAL(textChanged(QString)), proxy_modelDbData, SLOT(setNewFileterStr(QString)) );
proxy_modelDbData->setFilterMode(getFilterList(1,3));
ui->tvMeterDataPollData->setModel(proxy_modelDbData);
proxy_modelTimeZone->setSourceModel(modelTimeZone);
proxy_modelTimeZone->setDynamicSortFilter(true);
ui->tvTz->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->leFltrTz, SIGNAL(textChanged(QString)), proxy_modelTimeZone, SLOT(setNewFileterStr(QString)) );
proxy_modelTimeZone->setFilterMode(getFilterList(0,4));
ui->tvTz->setModel(proxy_modelTimeZone);
proxy_modelDbDataEv->setSourceModel(modelDbDataEv);
proxy_modelDbDataEv->setDynamicSortFilter(true);
ui->tvMeterDataPollData->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->leMeterDataFIlter_2, SIGNAL(textChanged(QString)), proxy_modelDbDataEv, SLOT(setNewFileterStr(QString)) );
proxy_modelDbDataEv->setFilterMode(getFilterList(1,3));
ui->tvMeterDataPollData_2->setModel(proxy_modelDbDataEv);
proxy_modelPhVal4DB->setSourceModel(modelPhVal4DB);
proxy_modelPhVal4DB->setDynamicSortFilter(true);
ui->lvMeterDataPhVal->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->leAddMeterPhysicalVal, SIGNAL(textChanged(QString)), proxy_modelPhVal4DB, SLOT(setNewFileterStr(QString)) );
proxy_modelPhVal4DB->setFilterMode(getFilterList(0,1));
ui->lvMeterDataPhVal->setModel(proxy_modelPhVal4DB);
proxy_modelPollStat->setSourceModel(modelPollStat);
proxy_modelPollStat->setDynamicSortFilter(true);
ui->tvPollStatistic->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->lePollStatistic, SIGNAL(textChanged(QString)), proxy_modelPollStat, SLOT(setNewFileterStr(QString)) );
proxy_modelPollStat->setFilterMode(getFilterList(0,2));
ui->tvPollStatistic->setModel(proxy_modelPollStat);
ui->lvMeterDataProfile->setModel(modelProfile4DB);
// ui->lvDeleteTable->setModel(modelProfile4DB);
ui->lvMeterDataTariff->setModel(modelTarif4DB);
ui->lvMeterDataProfile_2->setModel(modelEvent4DB);
ui->lvMeterDataProfile_3->setModel(modelProfile4Hash);
ui->tvSvahaService->setModel(modelSvahaList);
ui->tvSvahaService_2->setModel(modelPeredavatorHost);
ui->tvDayProfiles4svaha->setModel(modelDayProfile4mac);
ui->tvDayProfiles4svaha_2->setModel(modelDayProfile4peredavator);
ui->stackedWidget->setCurrentIndex(0);
ui->label_4->hide();
QFont font;
defFontSize = font.pointSize();
allowDate2utc = false;
dateInUtc = false;
ui->pteAppLog->setFont(font4log);
ui->pteAboutObjectMemo->setFont(font4log);
ui->pteErrorLog->setFont(font4log);
ui->pteIfconfig->setFont(font4log);
ui->pteZbyrLog->setFont(font4log);
ui->pteSerialLog_2->setFont(font4log);
ui->plainTextEdit->setFont(font4log);
ui->cbEnblTblBuff->setChecked(false);
ui->cbEnblTblBuff->hide();
ui->cbEnblTableBuffML->setChecked(false);
ui->cbEnblTableBuffML->hide();
ui->pbReadHashSumm->hide();
createAddSmartLightingWidgets();
// QTimer::singleShot(2000, this, SLOT(initializeMatilda()) );
loadMainSett();
}
//##########################################################################################
MainWindow::~MainWindow()
{
emit kickThrd();
delete ui;
}
void MainWindow::loadMainSett()
{
QRect rect = SettLoader::loadSett(SETT_MAIN_GEOMETRY).toRect();
if(!rect.isNull()){
qint32 desktopW = qApp->desktop()->width();
qint32 desktopH = qApp->desktop()->height();
if(rect.x()< 10)
rect.setX(10);
if(rect.y()<30)
rect.setY(31);
if(rect.x()>(desktopW) || rect.y()>(desktopH)) {
int lastW = rect.width();
int lastH = rect.height();
rect.setX(10);
rect.setY(31);
rect.setWidth(lastW);
rect.setHeight(lastH);
}
setGeometry(rect);
}
if(SettLoader::loadSett(SETT_MAIN_LANG_SELECTED).toBool()){
loadLanguage(SettLoader::loadSett(SETT_MAIN_CURRLANG).toString());
QTimer::singleShot(500, this, SLOT(initializeMatilda()) );
}else{
LangDialog *d = new LangDialog(ui->cbLang, this);
connect(d, SIGNAL(onLangSelected(QString)), this, SLOT(onLangSelected(QString)) );
if(d->exec() == QDialog::Rejected)
QTimer::singleShot(500, this, SLOT(initializeMatilda()) );
d->deleteLater();
}
}
//##########################################################################################
void MainWindow::initializeMatilda()
{
if(true){
QStringList l = SettLoader::realPageName();
QList<int> listIntWrite = SettLoader::getPageCanWrite();
QList<int> listInt = SettLoader::getPageCanRead();
if(l.size() != listIntWrite.size() || l.size() != listInt.size()){
qDebug() << "size error " << l.size() << listInt.size() << listIntWrite.size();
return;
}
QSize s = QSize(ui->trDevOperation->width(), ui->pbAddForward->height() * 1.2);
QHash<QString, QString> hashRealName2localName = SettLoader::hashRealName2localName();
QStringList listPath2icon = SettLoader::listPath2icon();
for(int i = 0, iMax = l.size(); i < iMax; i++){
QList<QStandardItem*> li;
QStandardItem *item = new QStandardItem( hashRealName2localName.value(l.at(i), l.at(i)) );//l.at(i) );
item->setData(listIntWrite.at(i));
item->setData(listInt.at(i), Qt::UserRole + 2);
item->setSizeHint(s);
if(!listPath2icon.at(i).isEmpty())
item->setIcon(QIcon(listPath2icon.at(i)));
li.append(item);
QStandardItem *item2 = new QStandardItem("");
item2->setData( l.at(i) ); //hashLocalName2realName.value( l.at(i)) );
li.append(item2);
QStandardItem *item3 = new QStandardItem("");
// item3->setData(l.at(i));
li.append(item3);
modelDevOptions->appendRow(li);
}
}
loadSettPageOptions();
QDateTime dateTime = QDateTime::currentDateTime();
Wait4AnswerDialog *dialog = new Wait4AnswerDialog(ui->pbLogOut->height(), this);
connect(this, SIGNAL(showWaitMess(int)), dialog, SLOT(showAnimation(int)) );
connect(this, SIGNAL(hideWaitMess()), dialog, SLOT(hideAnimation()) );
connect(this, SIGNAL(uploadProgress(int,QString)), dialog, SLOT(uploadProgress(int,QString)) );
connect(dialog, SIGNAL(noAnswerFromDev()), SLOT(noAnswerFromDev()) );
matildaclient *client = new matildaclient;
// connect(this, SIGNAL(conn2thisDev(int,QString,QString,QString,quint16,int,bool,bool)), client, SLOT(conn2thisDev(int,QString,QString,QString,quint16,int,bool,bool)) );
connect(this, SIGNAL(conn2thisDev(int,QString,QString,QString,QString,quint16,int,bool,bool,bool,QString,bool,bool)), client, SLOT(conn2thisDev(int,QString,QString,QString,QString,quint16,int,bool,bool,bool,QString,bool,bool)) );
connect(this, SIGNAL(data2matilda(quint16,QJsonObject)), client, SLOT(data2matilda(quint16,QJsonObject)) );
connect(this, SIGNAL(closeConnection()), client, SLOT(closeConnection()) );
connect(this, SIGNAL(setEmptyHsh(bool)) , client, SLOT(setEmptyHsh(bool)) );
connect(client, SIGNAL(onErrorWrite()), dialog,SLOT(hideAnimation()), Qt::DirectConnection );
// connect(client, SIGNAL(onConnectedStateChanged(bool)),dialog, SLOT(hideAnimation()), Qt::DirectConnection );
// connect(client, SIGNAL(data2gui(quint16,QVariant)), dialog, SLOT(hideAnimation()) , Qt::DirectConnection);
connect(client, SIGNAL(hideAnimation()), dialog, SLOT(hideAnimation()) , Qt::DirectConnection);
connect(client, SIGNAL(authrizeAccess(int)),dialog, SLOT(hideAnimation()) , Qt::DirectConnection);
connect(client, SIGNAL(showMessage(QString)),dialog, SLOT(hideAnimation()), Qt::DirectConnection );
connect(client, SIGNAL(uploadProgress(int,QString)), dialog, SLOT(uploadProgress(int,QString)), Qt::DirectConnection );
connect(client, SIGNAL(startWait4AnswerTimer(int)), dialog, SLOT(resetCounter()), Qt::DirectConnection );
connect(client, SIGNAL(onYouCanSelectDevice(QStringList)), this, SLOT(onYouCanSelectDevice(QStringList)) );
connect(client, SIGNAL(dataFromCoordinator(QByteArray)), this, SIGNAL(dataFromCoordinator(QByteArray)) );
connect(this, SIGNAL(data2coordiantor(QByteArray)), client, SLOT(data2coordiantor(QByteArray)) );
connect(this, SIGNAL(onDaServerStateS(bool)), client, SLOT(onDaOpened(bool)) );
connect(dialog, SIGNAL(noAnswerFromDev()), client, SLOT(stopAllNow()), Qt::DirectConnection );
connect(dialog, SIGNAL(stopNow()), client, SLOT(stopAllNow()) );
connect(dialog, SIGNAL(rejected()), client, SLOT(stopAllNow()), Qt::DirectConnection );
connect(client, SIGNAL(onConnectedStateChanged(bool) ), SLOT(onConnectedStateChanged(bool)) );
connect(client, SIGNAL(data2gui(quint16,QJsonObject) ), SLOT(data2gui(quint16,QJsonObject)) );
connect(client, SIGNAL(onErrorWrite() ), SLOT(onErrorWrite()) );
connect(client, SIGNAL(showMessage(QString) ), SLOT(showMessage(QString)) );
connect(client, SIGNAL(authrizeAccess(int) ), SLOT(authrizeAccess(int)) );
connect(client, SIGNAL(devTypeChanged(int,int,QString) ), SLOT(devTypeChanged(int,int,QString)) );
connect(client, SIGNAL(changeCounters(qint64,qint64,bool)), SLOT(changeCounters(qint64,qint64,bool)) );
connect(client, SIGNAL(setActiveProtocolVersion(int) ), SLOT(setActiveProtocolVersion(int)) );
connect(client, SIGNAL(infoAboutObj(QString) ), ui->pteAboutConnObj, SLOT(appendHtml(QString)) );
connect(client, SIGNAL(add2pteLog(QString) ), ui->plainTextEdit, SLOT(appendPlainText(QString)) );
ui->pbLogIn->setEnabled(true);
byteSend = 0;
byteReceiv = 0;
byteSendNotComprssd = 0;
byteReceivNotComprssd = 0;
QThread *thread = new QThread(this);
connect(this, SIGNAL(kickThrd()), thread, SLOT(quit()) );
client->moveToThread(thread);
thread->start();
QLabel *lblPxmp;
QLabel *lblTxt;
lblPxmp = new QLabel(this);
lblPxmp->setMaximumHeight(ui->statusBar->height() * 0.9);
lblPxmp->setMaximumWidth(lblPxmp->height());
lblPxmp->setScaledContents(true);
lblPxmp->setPixmap(QPixmap(":/katynko/deviceisnotused.png"));
lblTxt = new QLabel(this);
lblTxt->setMaximumHeight(ui->statusBar->height() * 0.9);
QLabel *connStat = new QLabel(this);
connStat->setMaximumHeight(ui->statusBar->height() * 0.9);
connStat->setToolTip(tr("Last R/W: last operation read/wrie to socket<br>"
"Total R/W: total received/sended bytes<br>"
"R/W (NC): uncompressed data (shows how much occupied uncompressed data)"));
connect(this,SIGNAL(setSttsNewPixmap(QPixmap)), lblPxmp, SLOT(setPixmap(QPixmap)) );
connect(this, SIGNAL(setSttsNewTxt(QString)), lblTxt, SLOT(setText(QString)) );
connect(this, SIGNAL(setNewConnStat(QString)), connStat, SLOT(setText(QString)) );
lastConnDevInfo = tr("Not connected.");
ui->statusBar->addPermanentWidget(lblPxmp);
ui->statusBar->addPermanentWidget(lblTxt, 11);
ui->statusBar->addPermanentWidget(connStat, 11);
emit setSttsNewPixmap(QPixmap(":/katynko/deviceisnotused.png"));
emit setSttsNewTxt(lastConnDevInfo);
ui->cbHashSumm->addItems(QString("Md4,Md5,Sha1,Sha224,Sha256,Sha384,Sha512,Sha3_224,Sha3_256,Sha3_384,Sha3_512").split(","));
ui->cbHashSumm->setCurrentIndex(1);
ui->cbHashSumm_2->addItems(QString("Md4,Md5,Sha1,Sha224,Sha256,Sha384,Sha512,Sha3_224,Sha3_256,Sha3_384,Sha3_512").split(","));
ui->cbHashSumm_2->setCurrentIndex(1);
// PeredavatorDbgClient *dbgClient = new PeredavatorDbgClient;
// connect(this, SIGNAL(conn2thisDevDbg(QString,quint16,int)), dbgClient, SLOT(conn2thisDev(QString,quint16,int)) );
// connect(this, SIGNAL(closeConnectionDbg()), dbgClient, SLOT(closeConnection()) );
// connect(this, SIGNAL(conn2thisDev(QString,QString,QString,QString,quint16,int,bool)), dbgClient, SLOT(stopAllNow()), Qt::DirectConnection );
// connect(this, SIGNAL(conn2thisDev(QString,QString,QString,QString,quint16,int,bool)), dbgClient, SLOT(closeConnection()) );
// connect(ui->pbStopStream, SIGNAL(clicked(bool)), dbgClient, SLOT(stopAllNow()), Qt::DirectConnection );
// connect(dbgClient, SIGNAL(appendPlainText(QString)), ui->pteSerialLog, SLOT(appendPlainText(QString)) );
// connect(dbgClient, SIGNAL(showMessage(QString)), this, SLOT(showMessage(QString)) );
// connect(dbgClient, SIGNAL(onConnectedStateChanged(bool)), this, SLOT(onConnectedStateChangedDbg(bool)) );
// connect(dbgClient, SIGNAL(onCantConnect(bool)), ui->pbStartStream, SLOT(setEnabled(bool)) );
// connect(dbgClient, SIGNAL(changeCounters(qint64,qint64,bool)), SLOT(changeCounters(qint64,qint64,bool)) );
// QThread *thread2 = new QThread(this);
// dbgClient->moveToThread(thread2);
// thread2->start();
QFont font;
#ifdef Q_OS_WIN
font.fromString("Consolas,9,-1,5,50,0,0,0,0,0" );
#else
font.fromString( "Liberation Mono,9,-1,5,50,0,0,0,0,0" );
#endif
// ui->pteSerialLog->setFont(font);
ui->pteAboutObjectMemo->setFont(font);
ui->pteIfconfig->setFont(font);
ui->pteState->setFont(font);
ui->pteAppLog->setFont(font);
ui->pteMeterPlg->setFont(font);
ui->pteMatildaTime->setFont(font);
QSettings settings("kts-intek", "matilda");
settings.beginGroup("meter");
QVariantMap mpv = settings.value("mpv").toMap();
settings.endGroup();
if(mpv.isEmpty()){
QStringList list = QString("A+;A+,R+;A+,R+,R-;A+,A-,R+,R-;A+,A-").split(";");
while(!list.isEmpty()){
QString s = list.takeFirst();
mpv.insert(s, s);
}
}
QList<QString> listK = mpv.keys();
// qSort(listK);
ui->cbAddMeterPhysicalVal->clear();
for(int i = 0, iMax = listK.size(); i < iMax; i++){
ui->cbAddMeterPhysicalVal->addItem(listK.at(i), mpv.value(listK.at(i)));
ui->cbAddMeterPhysicalVal->setItemData(i, mpv.value(listK.at(i)) , Qt::ToolTipRole );
}
modelAddMeter->setHorizontalHeaderLabels(tr("Model,Serial Number,NI,Memo,Password,On/Off,Physical values").split(","));
QStringList list;
list.append(tr("Now"));
list.append(tr("Day"));
list.append(tr("Month"));
list.append(tr("Power"));
list.append(tr("Voltage"));
QList<int> listData;
listData.append(POLL_CODE_READ_CURRENT);
listData.append(POLL_CODE_READ_END_DAY);
listData.append(POLL_CODE_READ_END_MONTH);
listData.append(POLL_CODE_READ_POWER);
listData.append(POLL_CODE_READ_VOLTAGE);
QStringList listKeys;
listKeys.append(QString("A+,A-,R+,R-"));
listKeys.append(QString("A+,A-,R+,R-"));
listKeys.append(QString("A+,A-,R+,R-"));
listKeys.append(QString("A+,A-,R+,R-"));
listKeys.append(QString("UA,UB,UC,IA,IB,IC,PA,PB,PC,QA,QB,QC,cos_fA,cos_fB,cos_fC,F,THD"));
QStringList listKeys2;
QString str = tr("Active import,Active export,Reactive import,Reactive export");
for(int i = 0; i < 4; i++)
listKeys2.append(str);
str.clear();
QStringList list2 = tr("Voltage,Current,Active Power,Reactive Power,cos φ").split(',');
QStringList list3 = tr("A,B,C").split(',');
for(int i = 0, iMax = list2.size(); i < iMax; i++){
for(int j = 0; j < 3; j++)
str.append(tr("Phs %1 %2,").arg(list3.at(j)).arg(list2.at(i)));
}
str.append(tr("Frequency,THD"));
listKeys2.append(str);
// QList<QStandardItem*> listItem;
ui->cbSttstOfExchngCode->addItem(tr("All"));
for(int i = 0, iMax = list.size(); i < iMax; i++){
ui->cbSttstOfExchngCode->addItem(QString::number(listData.at(i)));
QStandardItem *item = new QStandardItem(list.at(i));
item->setData(listData.at(i), Qt::UserRole + 1);
item->setData(listKeys.at(i), Qt::UserRole + 2);
item->setData(listKeys2.at(i), Qt::UserRole + 3);
modelProfile4DB->appendRow(item);
}
for(int i = 0, iMax = list.size(); i < iMax; i++){
QStandardItem *item = new QStandardItem(list.at(i));
item->setData(listData.at(i), Qt::UserRole + 1);
item->setData(listKeys.at(i), Qt::UserRole + 2);
item->setData(listKeys2.at(i), Qt::UserRole + 3);
modelProfile4Hash->appendRow(item);
}
ui->lvMeterDataProfile_3->setCurrentIndex(modelProfile4Hash->index(0,0));
ui->cbSttstOfExchngCode->addItem(QString::number(POLL_CODE_METER_STATUS) );
connect(ui->lvMeterDataProfile, SIGNAL(activated(QModelIndex)), this, SLOT(onLvMeterDataProfile_activated(QModelIndex)) );
ui->lvMeterDataProfile->setCurrentIndex(modelProfile4DB->index(0,0));
onLvMeterDataProfile_activated(ui->lvMeterDataProfile->currentIndex());
list.clear();
list.append(tr("Summ"));
list.append(tr("Tariff 1"));
list.append(tr("T"));
list.append(tr("Power"));
for(int i = 0; i < 5; i++){
QStandardItem *item = new QStandardItem( (i == 0) ? tr("Summ") : tr("Tariff %1").arg(i));
item->setCheckable(true);
item->setCheckState( (i < 4) ? Qt::Checked : Qt::Unchecked);
modelTarif4DB->appendRow(item);
}
QTimer *niCheckTmr = new QTimer;
niCheckTmr->setSingleShot(true);
niCheckTmr->setInterval(100);
connect(ui->leMeterDataOnlyThisNI, SIGNAL(textChanged(QString)), niCheckTmr, SLOT(start()) );
connect(niCheckTmr, SIGNAL(timeout()), this, SLOT(onCheckDbNIfieldIsCorrect()) );
ui->dteMeterDataFrom->setDateTime(QDateTime::fromString("15/01/2013 16:01","dd/MM/yyyy hh:mm"));
ui->dteMeterDataTo->setDateTime(QDateTime::fromString("15/01/2013 16:30","dd/MM/yyyy hh:mm"));
QList<QByteArray> lz = QTimeZone::availableTimeZoneIds();
dateTime = QDateTime::currentDateTime();
modelTimeZone->setHorizontalHeaderLabels(tr("Area,Region,UTC offset,Country,Has DST,Comment").split(','));
while(!lz.isEmpty()){
QList<QStandardItem*> listItem;
QString z = lz.first();
dateTime.setTimeZone( QTimeZone(lz.takeFirst()));
QStandardItem *item = new QStandardItem(dateTime.timeZoneAbbreviation());
item->setCheckable(true);
listItem.append(item);
listItem.append(new QStandardItem(z));
listItem.append(new QStandardItem(emailUtcOffset(dateTime.offsetFromUtc())));
listItem.append(new QStandardItem(QLocale::countryToString(dateTime.timeZone().country())));
listItem.append(new QStandardItem( dateTime.timeZone().hasDaylightTime() ? tr("Yes") : tr("No") ));
listItem.append(new QStandardItem(dateTime.timeZone().comment()));
modelTimeZone->appendRow(listItem);
}
ui->tvTz->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->tvTz->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
ui->tvAddMeterTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
ui->tvAddMeterTable->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
ui->tvMeterDataPollData->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
ui->tvMeterDataPollData->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
QTimer *validTmr = new QTimer(this);
validTmr->setSingleShot(true);
validTmr->setInterval(700);
connect(ui->cbAddMeterModel, SIGNAL(currentIndexChanged(int)), validTmr, SLOT(start()) );
connect(validTmr, SIGNAL(timeout()), this, SLOT(checkLineAddMeterNIandPasswd()) );
DirectAccesMatildaService *daService = new DirectAccesMatildaService;
connect(this, SIGNAL(startDaServer(qint8,quint16)), daService, SLOT(startServerNow(qint8,quint16)) );
connect(this, SIGNAL(stopDaServer()), daService, SLOT(stopServerNow()) );
connect(daService, SIGNAL(showMessage(QString)), this, SLOT(showMessSmpl(QString)) );
connect(daService, SIGNAL(onStateChanged(bool)), this, SLOT(onDaServiceState(bool)) );
connect(daService, SIGNAL(onStateChanged(QString)), ui->lblDaState, SLOT(setText(QString)) );
connect(this, SIGNAL(dataFromCoordinator(QByteArray)), daService, SIGNAL(dataFromCoordinator(QByteArray)) );
connect(daService, SIGNAL(data2coordiantor(QByteArray)), this, SIGNAL(data2coordiantor(QByteArray)) );
connect(daService, SIGNAL(onStateChanged(bool)), this, SIGNAL(onDaServerStateS(bool)) );
connect(daService, SIGNAL(onDasStarted(QString)), ui->pteDasIpList, SLOT(appendPlainText(QString)) );
connect(daService, SIGNAL(onDasStopped()), ui->pteDasIpList, SLOT(clear()) );
QThread *daThrd = new QThread(this);
daService->moveToThread(daThrd);
connect(this, SIGNAL(kickThrd()) , daThrd, SLOT(quit()) );
daThrd->start();
ui->cbGsmPortSpeed->clear();
ui->cbZigBeePortSpeed->clear();
list = QString("1200,2400,4800,9600,19200,38400,57600,115200").split(",");//for ZigBee
for(int i = 0, iMax = list.size(); i < iMax; i++){
ui->cbZigBeePortSpeed->addItem(list.at(i), QString(list.at(i)).remove(" "));
}
list = QString("9600,57 600,115 200,230 400,460 800,750 000,921 600,3 000 000").split(",");//for GSM Sierra Wrllss
for(int i = 0, iMax = list.size(); i < iMax; i++){
ui->cbGsmPortSpeed->addItem(list.at(i), QString(list.at(i)).remove(" "));
}
ui->cbGsmPortSpeed->setCurrentIndex(-1);
ui->cbZigBeePortSpeed->setCurrentIndex(-1);
joingStts = 0;
QVariantHash connHashG = SettLoader::loadSett(SETT_LOLO_TOTO).toHash();
ui->leLogin->setText(connHashG.value("login", "admin").toString());
ui->lePasswd->setText(connHashG.value("pas").toString());
ui->cbZlib->setChecked(connHashG.value("zlib", true).toBool());
ui->cbxAllowV2->setChecked(connHashG.value("v2", true).toBool());
QVariantHash h = connHashG.value("direct").toHash();
ui->leIp->setText(h.value("ip", "80.78.51.216").toString());
ui->sbPort->setValue(h.value("p", 9090).toInt());
ui->leObjectName->setText(h.value("obj", "test").toString());
ui->sbTimeOut->setValue(h.value("to", 15).toInt());
h = connHashG.value("mac").toHash();
ui->leIp_2->setText(h.value("ip", "kts-m2m.ddns.net").toString());
ui->sbPort_2->setValue(h.value("p", 65000).toInt());
ui->leObjectName_2->setText(h.value("obj", "matilda1").toString());
ui->sbTimeOut_2->setValue(h.value("to", 15).toInt());
ui->leObjectMac->setText(h.value("mac").toString());
ui->rbUseMac->setChecked(h.value("rbMax").toBool());
ui->rbUseObjID->setChecked(!ui->rbUseMac->isChecked());
HelpForm *helpWidget = new HelpForm(this);
ui->stackedWidget->addWidget(helpWidget);
QString s = tr("<html><head/><body><p>Matilda Configuration Dev</p>"
"<p>Version %1</p><p>%2 KTS Intek Ltd, %3</p>"
"<p><a href=\"http://kts-intek.com.ua\">"
"<span style=\" text-decoration: underline; color:#2980b9;\">"
"http://kts-intek.com.ua</span></a></p></body></html>").arg("0.0.10").arg(QString::fromUtf8("©")).arg("2020") ;
ui->lblAbout->setText(s );
}
//##########################################################################################
void MainWindow::onConnectedStateChanged(bool isConnected)
{
ui->pbLogOut->setEnabled(isConnected);
ui->actionDevice->setEnabled(ui->pbLogOut->isEnabled());
if(!isConnected){
emit closeConnectionDbg();
emit stopDaServer();
}
emit setSttsNewPixmap(isConnected ? QPixmap(":/katynko/deviceisready.png") : QPixmap(":/katynko/deviceisdisconnected.png"));
emit setSttsNewTxt(lastConnDevInfo);
qDebug() << "isConnected " << isConnected;
}
//##########################################################################################
void MainWindow::onConnectedStateChangedDbg(bool isConnected)
{
// ui->pbStartStream->setEnabled(!isConnected);
// ui->pbStopStream->setEnabled(isConnected);
Q_UNUSED(isConnected);
}
//##########################################################################################
void MainWindow::data2gui(quint16 command, QJsonObject jobj)
{
/*
QList<int> listInt;
listInt <<
#define COMMAND_READ_ABOUT_PLG 24
#define COMMAND_READ_DATE_SETT 25
#define COMMAND_READ_GPRS_SETT 26
#define COMMAND_READ_STATE 27
#define COMMAND_READ_IFCONFIG 28
#define COMMAND_READ_APP_LOG 29
#define COMMAND_READ_POLL_SCHEDULE 30
#define COMMAND_READ_DATABASE 32
#define COMMAND_READ_DATABASE_GET_TABLES 33
#define COMMAND_READ_DATABASE_GET_VAL 34
COMMAND_READ_METER_LOGS_GET_TABLES;+
#define COMMAND_READ_METER_LOGS 35
#define COMMAND_READ_METER_LOGS_GET_TABLES 36
#define COMMAND_READ_METER_LOGS_GET_VAL 37
#define COMMAND_READ_METER_LIST_FRAMED 38
#define COMMAND_READ_DATABASE_TABLES_PARSING 39
#define COMMAND_READ_ZBR_LOG 40
#define COMMAND_READ_ABOUT_OBJECT 41
#define COMMAND_READ_POLL_SETT 42
#define COMMAND_READ_POLL_STATISTIC 43
#define COMMAND_READ_TABLE_HASH_SUMM 44
#define COMMAND_READ_DATABASE_GET_VAL_EXT 45
#define COMMAND_READ_METER_LOGS_GET_VAL_EXT 46
#define COMMAND_READ_IP_FILTER_SETT 47
*/
switch (command) {
case COMMAND_AUTHORIZE:{
ui->cbAddMeterModel->clear();
QVariantList l = jobj.value("b").toArray().toVariantList();
QVariantHash h;
for(int i = 0, iMax = l.size(); i < iMax; i++){
QStringList list = l.at(i).toString().split("\t");
if(list.size() != 2)
continue;
h.insert(list.first(), list.last());
qDebug() << list;
}
QList<QString> lKeys = h.keys();
qSort(lKeys);
lKeys.prepend("Auto");
for(int i = 0, iMax = lKeys.size(); i < iMax; i++){
ui->cbAddMeterModel->addItem(lKeys.at(i), h.value(lKeys.at(i), "^(.){32}$").toString());
}
ui->cbAddMeterModel->setCurrentIndex(0);
break; }
case COMMAND_READ_ABOUT_PLG:{
QList<QString> l = jobj.keys();
qSort(l);
ui->pteMeterPlg->clear();
ui->pteMeterPlg->appendPlainText(tr("# Plugin\tCreate Date and Time\t\tInfo\t\tMeter models\t\tRegExp"));
for(int i = 0, iMax = l.size(); i < iMax; i++){
QStringList sl = varList2strList(jobj.value(l.at(i)).toArray().toVariantList());
ui->pteMeterPlg->appendPlainText( QString("%1. %2\t%3")
.arg(i + 1)
.arg(l.at(i))
.arg(sl.join("\t")));
}
break; }
case COMMAND_READ_DATE_SETT:{
QDateTime dateTime = QDateTime::currentDateTime();
ui->dtLocal->setDateTime(dateTime);
ui->dtLocalUTC->setDateTime(dateTime.toUTC());
QTimeZone tz = QDateTime::currentDateTime().timeZone();
ui->lblLocalTZ->setText(tr("%1, UTC offset %2, DST is %3")
.arg(tz.offsetData(ui->dtLocal->dateTime()).abbreviation)
.arg(emailUtcOffset(tz.offsetFromUtc(ui->dtLocal->dateTime())))
.arg( tz.isDaylightTime(ui->dtLocal->dateTime()) ? tr("On") : tr("Off"))
);
QDateTime devTime = dateTimeFromStr(jobj.value("dt").toString());
if(devTime.isValid()){
ui->lblLocalTZ->setText(tr("%1, Time difference: %2 s")
.arg(ui->lblLocalTZ->text())
.arg(dateTime.secsTo(devTime)));
}
dateTime.setTimeZone( QTimeZone(jobj.value("tz").toString().toLocal8Bit()));
ui->pteMatildaTime->appendPlainText( jobj.value("timedatectl").toString().isEmpty() ? tr("No data") : jobj.value("timedatectl").toString());
if(jobj.contains("tz") && jobj.contains("uo") )
ui->lblDeviceTz->setText(tr("Device time zone: %1 (%2, %3)")
.arg(jobj.value("tz").toString())
.arg(dateTime.timeZoneAbbreviation())
.arg(emailUtcOffset(jobj.value("uo").toInt()))
);
else
ui->lblDeviceTz->setText(tr("Device time zone: n/a"));
QString tzStr = jobj.value("tz").toString();
for(int i = 0, iMax = modelTimeZone->rowCount(); i < iMax; i++){
modelTimeZone->item(i,0)->setCheckState(Qt::Unchecked);
if(!tzStr.isEmpty() && modelTimeZone->item(i,1)->text() == tzStr){
modelTimeZone->item(i,0)->setCheckState(Qt::Checked);
ui->leFltrTz->setText(tzStr);
tzStr.clear();
}
}
// ui->pbChTz->setEnabled(true);
// ui->pbEnDisNtpSync->setEnabled(jobj.contains("ntp-dead"));
// ui->pbDisableNtp->setEnabled(jobj.contains("ntp-dead"));
ui->pbWriteLocalTime->setEnabled(jobj.value("ntp-dead").toInt() != 0);
ui->pteNtpList->appendPlainText(jobj.value("ntp-line").toString().split(" ", QString::SkipEmptyParts).join("\n"));
ui->pteNtpList->setReadOnly(!jobj.value("ntp-dead").toInt() != 0);
break;}
case COMMAND_READ_GPRS_SETT:{
ui->leGPRS_Apn->setText(jobj.value("apn").toString());
ui->leGPRS_Apn_2->setText(jobj.value("userName").toString());
ui->leGPRS_Apn_3->setText(jobj.value("password").toString());
ui->leGPRS_Numbr->setText(jobj.value("nmbr").toString());
if(lDevInfo->matildaDev.protocolVersion >= MATILDA_PROTOCOL_VERSION_V2)
ui->cbxGsmPrefMode->setCurrentIndex(jobj.value("prfrd").toInt() - 1);
QString portName = jobj.value("portName").toString();
QStringList listPorts = varList2strList(jobj.value("portNameL").toArray().toVariantList());
ui->cbGsmPortName->clear();
if(!portName.isEmpty()){
if(listPorts.contains(portName)){
listPorts.removeOne(portName);
ui->cbGsmPortName->addItem(tr("<b>%1<b>").arg(portName), portName);
}else{
ui->cbGsmPortName->addItem(tr("<b>%1<b> (Not found!)").arg(portName), portName);
}
}
for(int i = 0, iMax = listPorts.size(); i < iMax; i++){
ui->cbGsmPortName->addItem(listPorts.at(i), listPorts.at(i));
}
if(!portName.isEmpty() || !listPorts.isEmpty())
ui->cbGsmPortName->setCurrentIndex(0);
ui->cbGsmPortSpeed->setCurrentIndex( ui->cbGsmPortSpeed->findData(jobj.value("baudRate").toVariant()));
break;}
case COMMAND_READ_STATE:{
QList<QString> l = jobj.keys();
qSort(l);
ui->pteState->clear();
QStringList listVal;
int maxKeyLen = 5;
// ui->pteMeterPlg->appendPlainText(tr("# Plugin\tCreate Date and Time\tInfo"));
for(int i = 0, iMax = l.size(); i < iMax; i++){
listVal.append(jobj.value(l.at(i)).toString() );
if(l.at(i).length() > maxKeyLen)
maxKeyLen = l.at(i).length();
}
QString spaceStr("");
spaceStr = QString("").leftJustified(maxKeyLen, ' ');
for(int i = 0, iMax = l.size(); i < iMax; i++){
QStringList list = listVal.at(i).split("\n");
ui->pteState->appendPlainText(l.at(i).leftJustified(maxKeyLen, ' ') + "\t" + list.first() );
for(int j = 1, jMax = list.size(); j < jMax; j++)
ui->pteState->appendPlainText( spaceStr + "\t" + list.at(j) );
}
break;}
case COMMAND_READ_SYSTEM_SETTINGS:{
ui->pteSysInfo->clear();
ui->pteSysInfo->appendPlainText(jobj.value("s").toString());
break;}
// case COMMAND_READ_TASK_INFO:{
// ui->pteRunningProc->clear();
// ui->pteRunningProc->appendPlainText(dataVar.toByteArray());
// break;}
case COMMAND_READ_IFCONFIG:{
ui->pteIfconfig->clear();
ui->pteIfconfig->appendPlainText(jobj.value("s").toString());
break;}
case COMMAND_READ_APP_LOG:{
ui->pteAppLog->clear();
ui->pteAppLog->appendPlainText(jobj.value("s").toString());
break;}
case COMMAND_READ_SERIAL_LOG:{
ui->pteSerialLog_2->clear();;
ui->pteSerialLog_2->appendPlainText(jobj.value("s").toString());
break;}
case COMMAND_READ_PLUGIN_LOG_ERROR:{
ui->pteErrorLog->clear();
ui->pteErrorLog->appendPlainText(jobj.value("s").toString());
break; }
case COMMAND_READ_PLUGIN_LOG_WARN:{
ui->pteWarningLog->clear();
ui->pteWarningLog->appendPlainText(jobj.value("s").toString());
break; }
case COMMAND_READ_DA_SERVICE_SETT:{
switch(jobj.value("m").toInt(0)){
case 1: ui->rbDasAlwaysOn->setChecked(true);break;
case 2: ui->rbDasAlwaysOnMgc->setChecked(true);break;
case 3: ui->rbDasAlwaysOff->setChecked(true);break;
}
ui->cbDasAlwaysInHex->setChecked(jobj.value("msh").toBool(false));
QString str = QString( QByteArray::fromBase64( jobj.value("ms").toString().toLocal8Bit())) ;//h.value("ms").toByteArray();
qDebug() << str << jobj.value("ms");
ui->leDasAlwaysOnMS->setText( str);
break;}
case COMMAND_READ_PEREDAVATOR_AC_SETT:{
ui->cbEnablePAC->setChecked(jobj.value("e").toBool());
modelPeredavatorHost->clear();
modelPeredavatorHost->setHorizontalHeaderLabels(tr("Remote host;Day Profile Name;Status").split(";"));
QVariantList list = jobj.value("sl").toArray().toVariantList();
for(int i = 0, iMax = list.size() ; i < iMax; i++){
QStringList lStr = list.at(i).toString().split("\t");
if(lStr.size() != 3)
continue;
QList<QStandardItem*> l;
for(int j = 0; j < 3; j++)
l.append(new QStandardItem(lStr.at(j)));
modelPeredavatorHost->appendRow(l);
}
modelDayProfile4peredavator->clear();
ui->cbAcProfile_2->clear();
modelDayProfile4peredavator->setHorizontalHeaderLabels(tr("Name;Schedule").split(";"));
list = jobj.value("sdp").toArray().toVariantList();
for(int i = 0, iMax = list.size() ; i < iMax; i++){
QStringList lStr = list.at(i).toString().split("\t");
if(lStr.size() != 2)
continue;
QList<QStandardItem*> l;
for(int j = 0; j < 2; j++)
l.append(new QStandardItem(lStr.at(j)));
modelDayProfile4peredavator->appendRow(l);
ui->cbAcProfile_2->addItem(lStr.at(0));
}
break;}
case COMMAND_READ_MATILDA_AC_SETT:{
ui->cbEnableMAC->setChecked(jobj.value("e").toBool());
modelSvahaList->clear();
modelSvahaList->setHorizontalHeaderLabels(tr("Remote host;Day Profile Name;Status").split(";"));
QVariantList list = jobj.value("sl").toArray().toVariantList();
for(int i = 0, iMax = list.size() ; i < iMax; i++){
QStringList lStr = list.at(i).toString().split("\t");
if(lStr.size() != 3)
continue;
QList<QStandardItem*> l;
for(int j = 0; j < 3; j++)
l.append(new QStandardItem(lStr.at(j)));
modelSvahaList->appendRow(l);
}
modelDayProfile4mac->clear();
ui->cbAcProfile->clear();
modelDayProfile4mac->setHorizontalHeaderLabels(tr("Name;Schedule").split(";"));
list = jobj.value("sdp").toArray().toVariantList();
for(int i = 0, iMax = list.size() ; i < iMax; i++){
QStringList lStr = list.at(i).toString().split("\t");
if(lStr.size() != 2)
continue;
QList<QStandardItem*> l;
for(int j = 0; j < 2; j++)
l.append(new QStandardItem(lStr.at(j)));
modelDayProfile4mac->appendRow(l);
ui->cbAcProfile->addItem(lStr.first());
}
break;}