File: setuppageuserdata.cpp

package info (click to toggle)
klog 2.4.2-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 12,228 kB
  • sloc: cpp: 51,678; makefile: 15
file content (751 lines) | stat: -rw-r--r-- 24,065 bytes parent folder | download
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
/***************************************************************************
                          userdatapage.cpp  -  description
                             -------------------
    begin                : sept 2011
    copyright            : (C) 2011 by Jaime Robles
    email                : jaime@robles.es
 ***************************************************************************/

/*****************************************************************************
 * This file is part of KLog.                                             *
 *                                                                           *
 *    Foobar is free software: you can redistribute it and/or modify         *
 *    it under the terms of the GNU General Public License as published by   *
 *    the Free Software Foundation, either version 3 of the License, or      *
 *    (at your option) any later version.                                    *
 *                                                                           *
 *    KLog is distributed in the hope that it will be useful,             *
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *    GNU General Public License for more details.                           *
 *                                                                           *
 *    You should have received a copy of the GNU General Public License      *
 *    along with KLog.  If not, see <https://www.gnu.org/licenses/>.       *
 *                                                                           *
 *****************************************************************************/

#include "setuppageuserdata.h"
#include "../callsign.h"


SetupPageUserDataPage::SetupPageUserDataPage(DataProxy_SQLite *dp, World *injectedWorld, QWidget *parent) : QWidget(parent){
  //qDebug() << Q_FUNC_INFO << " - Start";
   slotQRZRunning = false;
   locator = new Locator();
   util = new Utilities(Q_FUNC_INFO);
   dataProxy = dp;
   //world = new World(dataProxy, Q_FUNC_INFO);
   world = injectedWorld;
   mainCallOK = false;
   tabWidget = new QTabWidget;
   QWidget *personalTab = new QWidget;
   QWidget *stationTab = new QWidget;

   tabWidget->addTab(personalTab, tr("&Personal data"));
   tabWidget->addTab(stationTab, tr("Station &data"));

   maincallsignLineEdit = new QLineEdit;
   operatorsLineEdit = new QLineEdit;
   nameLineEdit = new QLineEdit;
   cqzLineEdit = new QLineEdit;
   ituzLineEdit = new QLineEdit;
   myLocatorLineEdit = new QLineEdit;

   defaultPalette = new QPalette;
   wrongPalette = new QPalette;
   wrongPalette->setColor(QPalette::Text, Qt::red);


   //Personal Tab
   nameLineEdit = new QLineEdit;
   address1LineEdit = new QLineEdit;
   address2LineEdit = new QLineEdit;
   address3LineEdit = new QLineEdit;
   address4LineEdit = new QLineEdit;
   cityLineEdit = new QLineEdit;
   zipLineEdit = new QLineEdit;
   provinceLineEdit = new QLineEdit;
   countryLineEdit = new QLineEdit;

   nameLineEdit->setToolTip(tr("Enter your name."));
   address1LineEdit->setToolTip(tr("Enter your address - 1st line."));
   address2LineEdit->setToolTip(tr("Enter your address - 2nd line."));
   address3LineEdit->setToolTip(tr("Enter your address - 3rd line."));
   address4LineEdit->setToolTip(tr("Enter your address - 4th line."));
   cityLineEdit->setToolTip(tr("Enter your city."));
   zipLineEdit->setToolTip(tr("Enter your zip code."));
   provinceLineEdit->setToolTip(tr("Enter your province or state."));
   countryLineEdit->setToolTip(tr("Enter your country."));

   QLabel *nameLabel = new QLabel(tr("&Name"));
   QLabel *addressLabel = new QLabel(tr("&Address"));
   QLabel *cityLabel = new QLabel(tr("Cit&y"));
   QLabel *zipLabel = new QLabel(tr("&Zip Code"));
   QLabel *provLabel = new QLabel(tr("Pro&v/State"));
   QLabel *countryLabel = new QLabel(tr("Countr&y"));

   nameLabel->setBuddy(nameLineEdit);
   addressLabel->setBuddy(address1LineEdit);
   cityLabel->setBuddy(cityLineEdit);
   zipLabel->setBuddy(zipLineEdit);
   provLabel->setBuddy(provinceLineEdit);
   countryLabel->setBuddy(countryLineEdit);


   //void	addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
   // 0 1 2 3
   QGridLayout *personalLayout = new QGridLayout();

   personalLayout->addWidget(nameLabel, 0, 0);
   personalLayout->addWidget(nameLineEdit, 1, 0);
   personalLayout->addWidget(addressLabel, 2, 0);
   personalLayout->addWidget(address1LineEdit, 3, 0, 1, 2);
   personalLayout->addWidget(address2LineEdit, 4, 0, 1, 2);
   personalLayout->addWidget(address3LineEdit, 5, 0, 1, 2);
   personalLayout->addWidget(address4LineEdit, 6, 0, 1, 2);

   personalLayout->addWidget(cityLabel, 2, 2);
   personalLayout->addWidget(cityLineEdit, 3, 2, 1, 1);
   personalLayout->addWidget(zipLabel, 2, 5);
   personalLayout->addWidget(zipLineEdit, 3, 5, 1, 1);

   personalLayout->addWidget(provLabel, 4, 2);
   personalLayout->addWidget(provinceLineEdit, 5, 2, 1, 1);
   personalLayout->addWidget(countryLabel, 4, 5);
   personalLayout->addWidget(countryLineEdit, 5, 5, 1, 1);

   personalTab->setLayout(personalLayout);

   // Station Tab
   rig1LineEdit = new QLineEdit;
   rig2LineEdit = new QLineEdit;
   rig3LineEdit = new QLineEdit;
   ant1LineEdit = new QLineEdit;
   ant2LineEdit = new QLineEdit;
   ant3LineEdit = new QLineEdit;

   myPowerSpinBox = new QDoubleSpinBox;
   myPowerSpinBox->setDecimals(2);
   myPowerSpinBox->setMaximum(9999);

   rig1LineEdit->setToolTip(tr("Enter your information for rig") + " #1.");
   rig2LineEdit->setToolTip(tr("Enter your information for rig") + " #2.");
   rig3LineEdit->setToolTip(tr("Enter your information for rig") + " #3.");
   ant1LineEdit->setToolTip(tr("Enter your information for antenna") + " #1.");
   ant2LineEdit->setToolTip(tr("Enter your information for antenna") + " #2.");
   ant3LineEdit->setToolTip(tr("Enter your information for antenna") + " #3.");
   myPowerSpinBox->setToolTip(tr("Enter your power information."));

   QLabel *rig1Label = new QLabel(tr("&Rig 1"));
   QLabel *rig2Label = new QLabel(tr("R&ig 2"));
   QLabel *rig3Label = new QLabel(tr("Ri&g 3"));
   QLabel *antenna1Label = new QLabel(tr("Antenna &1"));
   QLabel *antenna2Label = new QLabel(tr("Antenna &2"));
   QLabel *antenna3Label = new QLabel(tr("Antenna &3"));
   QLabel *powerLabel = new QLabel(tr("Po&wer"));

   rig1Label->setBuddy(rig1LineEdit);
   rig2Label->setBuddy(rig2LineEdit);
   rig3Label->setBuddy(rig3LineEdit);
   antenna1Label->setBuddy(ant1LineEdit);
   antenna2Label->setBuddy(ant2LineEdit);
   antenna3Label->setBuddy(ant3LineEdit);
   powerLabel->setBuddy(myPowerSpinBox);

   //void	addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
   // 0 1 2 3
   QGridLayout *stationLayout = new QGridLayout();
   stationLayout->addWidget(rig1Label, 0, 0);
   stationLayout->addWidget(rig1LineEdit, 1, 0, 1, 1);
   stationLayout->addWidget(rig2Label, 2, 0);
   stationLayout->addWidget(rig2LineEdit, 3, 0, 1, 1);
   stationLayout->addWidget(rig3Label, 4, 0);
   stationLayout->addWidget(rig3LineEdit, 5, 0, 1, 1);

   stationLayout->addWidget(antenna1Label, 0, 2);
   stationLayout->addWidget(ant1LineEdit, 1, 2, 1, 1);
   stationLayout->addWidget(antenna2Label, 2, 2);
   stationLayout->addWidget(ant2LineEdit, 3, 2, 1, 1);
   stationLayout->addWidget(antenna3Label, 4, 2);
   stationLayout->addWidget(ant3LineEdit, 5, 2, 1, 1);

   stationLayout->addWidget(powerLabel, 0, 4);
   stationLayout->addWidget(myPowerSpinBox, 1, 4);

    stationTab->setLayout(stationLayout);

    //TODO:Defining ALL the tooltips
    maincallsignLineEdit->setToolTip(tr("Enter the station callsign that will be used for logging."));
    operatorsLineEdit->setToolTip(tr("Enter the operators (comma separated if more than one)."));
    myLocatorLineEdit->setToolTip(tr("Enter the locator of your station. Alternatively, KLog can use an approximate locator based on your callsign."));

    QLabel *qrzLabel = new QLabel(tr("&Callsign"));
    QLabel *operatorsLabel = new QLabel (tr("&Operators"));
    QLabel *cqzLabel = new QLabel(tr("&CQ Zone"));
    QLabel *ituzLabel = new QLabel(tr("&ITU Zone"));
    myLocatorLabel = new QLabel(tr("&Locator"));

    qrzLabel->setBuddy(maincallsignLineEdit);
    operatorsLabel->setBuddy(operatorsLineEdit);
    cqzLabel->setBuddy(cqzLineEdit);
    ituzLabel->setBuddy(ituzLineEdit);
    myLocatorLabel->setBuddy(myLocatorLineEdit);

    cqzLineEdit->setInputMask("09");
    ituzLineEdit->setInputMask("09");
    cqzLineEdit->setText("00");
    ituzLineEdit->setText("00");

    QGridLayout *userdataLayout = new QGridLayout;
    userdataLayout->addWidget(qrzLabel, 0, 0);
    userdataLayout->addWidget(maincallsignLineEdit, 1, 0);
    userdataLayout->addWidget(operatorsLabel, 0, 1);
    userdataLayout->addWidget(operatorsLineEdit, 1, 1, 1, -1);
    userdataLayout->addWidget(myLocatorLabel, 3, 0);
    userdataLayout->addWidget(myLocatorLineEdit, 4, 0);
    userdataLayout->addWidget(cqzLabel, 3, 1);
    userdataLayout->addWidget(cqzLineEdit, 4, 1);
    userdataLayout->addWidget(ituzLabel, 3, 2);
    userdataLayout->addWidget(ituzLineEdit, 4, 2);


    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(userdataLayout);
    mainLayout->addWidget(tabWidget);
    //mainLayout->addStretch(1);

    connect(maincallsignLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQRZTextChanged() ) );
    connect(maincallsignLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(operatorsLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(nameLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(cqzLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(ituzLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(myLocatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );

    connect(address1LineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(address2LineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(address3LineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(address4LineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(cityLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(zipLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(provinceLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(countryLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );

    connect(myLocatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotMyLocatorTextChanged() ) );
    connect(operatorsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotOperatorsChanged() ) );

    setLayout(mainLayout);
    maincallsignLineEdit->setFocus();

    //qDebug() << Q_FUNC_INFO << " - END";
}


SetupPageUserDataPage::~SetupPageUserDataPage()
{
    //qDebug() << Q_FUNC_INFO << " - Start";
    delete(locator);
    delete(util);
    //delete(world);
    delete(defaultPalette);
    delete(wrongPalette);
   //delete(dataProxy);
}

void SetupPageUserDataPage::setPrefixes()
{
    //util->setLongPrefixes(dataProxy->getLongPrefixes());
    //util->setSpecialCalls(dataProxy->getSpecialCallsigns());
    //world->readWorld ();
}

QString SetupPageUserDataPage::getMainCallsign()
{
    Callsign callsign (maincallsignLineEdit->text());
    if (callsign.isValid())
    {
        return maincallsignLineEdit->text().toUpper();
    }
    else
    {
        return QString();
    }
}

void SetupPageUserDataPage::slotEnterKeyPressed()
{
    emit enterKey();
}

void SetupPageUserDataPage::slotQRZTextChanged()
{
   //qDebug() << Q_FUNC_INFO << " - Start";
    if (slotQRZRunning)
    {
       //qDebug() << Q_FUNC_INFO << " - END-1";
        return;
    }
    slotQRZRunning = true;
   //qDebug() << Q_FUNC_INFO << " - " << maincallsignLineEdit->text() << " / Length: " << QString::number((maincallsignLineEdit->text()).size());

    int i = maincallsignLineEdit->cursorPosition();

    QString _a = util->getClearSQLi (maincallsignLineEdit->text());
    if (i<1)
    {
        slotQRZRunning = false;
        //qDebug() << Q_FUNC_INFO << " - END-2";
        return;
    }

    if ((_a.at(i-1)).isSpace())
    {
        maincallsignLineEdit->setText(_a.remove(i-1, 1));
    }

    maincallsignLineEdit->setText(((maincallsignLineEdit->text())).simplified());
    maincallsignLineEdit->setText((maincallsignLineEdit->text()).toUpper());

    cqzLineEdit->setText(QString::number(world->getQRZCqz(maincallsignLineEdit->text())));
    ituzLineEdit->setText(QString::number(world->getQRZItuz(maincallsignLineEdit->text())));
    myLocatorLineEdit->setText(world->getQRZLocator(maincallsignLineEdit->text()));

    maincallsignLineEdit->setCursorPosition(i);

    emit mainCallsignSignal(maincallsignLineEdit->text());


    /*
     if (!locator->isValidLocator(myLocatorLineEdit->text()) )
    {
        myLocatorLineEdit->setText(world->getQRZLocator(maincallsignLineEdit->text()));
    }
    */
    //qDebug() << Q_FUNC_INFO << " - END-3";
    slotQRZRunning = false;
}

int SetupPageUserDataPage::getCQz()
{
    return (cqzLineEdit->text()).toInt();
}

int SetupPageUserDataPage::getITUz()
{
    return (ituzLineEdit->text()).toInt();
}

bool SetupPageUserDataPage::setMainCallsign(const QString &_qrz)
{
   //qDebug() << Q_FUNC_INFO << ": " << _qrz;
    Callsign callsign(_qrz);
    if (!callsign.isValid())
        return false;
    maincallsignLineEdit->setText((_qrz).toUpper());
    return true;
}

bool SetupPageUserDataPage::setCQz(const int _cqz)
{
    cqzLineEdit->setText(QString::number(_cqz));
    return true;
}

bool SetupPageUserDataPage::setITUz(const int _ituz)
{
    ituzLineEdit->setText(QString::number(_ituz));
    return true;
}

void SetupPageUserDataPage::slotMyLocatorTextChanged()
{
    //qDebug() << Q_FUNC_INFO << " - Start";

    myLocatorLineEdit->setText(((util->getClearSQLi(myLocatorLineEdit->text()))).simplified());
    myLocatorLineEdit->setText((myLocatorLineEdit->text()).toUpper());

    if ( ((myLocatorLineEdit->text()).length())   >3   )
    {
        if (!(locator->isValidLocator(myLocatorLineEdit->text()) ))
        {
            myLocatorLabel->setText(tr("&Locator (not valid)"));
        }
        else
        {
            myLocatorLabel->setText(tr("&Locator"));
        }
    }
}

QString SetupPageUserDataPage::getStationLocator()
{
    if (!(locator->isValidLocator(myLocatorLineEdit->text()) ))
    {
        return "";
    }
    else
    {
        return (myLocatorLineEdit->text()).toUpper();
    }
}

bool SetupPageUserDataPage::setStationLocator(const QString &_loc)
{
    if (!(locator->isValidLocator(_loc) ))
    {
        return false;
    }
    else
    {
        myLocatorLineEdit->setText((_loc).toUpper());
        return true;
    }
}

QString SetupPageUserDataPage::getName()
{
    return nameLineEdit->text();
}


QStringList SetupPageUserDataPage::getAddress()
{
    QStringList a;
    a.clear();
    a << address1LineEdit->text() << address2LineEdit->text() << address3LineEdit->text() << address4LineEdit->text();
    return a;
}

QString SetupPageUserDataPage::getAddress1()
{
    return address1LineEdit->text();
}

QString SetupPageUserDataPage::getAddress2()
{
    return address2LineEdit->text();
}

QString SetupPageUserDataPage::getAddress3()
{
    return address3LineEdit->text();
}

QString SetupPageUserDataPage::getAddress4()
{
    return address4LineEdit->text();
}

QString SetupPageUserDataPage::getRig1()
{
    return rig1LineEdit->text();
}

QString SetupPageUserDataPage::getRig2()
{
    return rig2LineEdit->text();
}

QString SetupPageUserDataPage::getRig3()
{
    return rig3LineEdit->text();
}

QString SetupPageUserDataPage::getAntenna1()
{
    return ant1LineEdit->text();
}

QString SetupPageUserDataPage::getAntenna2()
{
    return ant2LineEdit->text();
}

QString SetupPageUserDataPage::getAntenna3()
{
    return ant3LineEdit->text();
}

QString SetupPageUserDataPage::getCity()
{
    return cityLineEdit->text();
}

QString SetupPageUserDataPage::getZipCode()
{
    return zipLineEdit->text();
}
QString SetupPageUserDataPage::getProvince()
{
    return provinceLineEdit->text();
}

QString SetupPageUserDataPage::getCountry()
{
    return countryLineEdit->text();
}

bool SetupPageUserDataPage::setName (const QString &_aux)
{
    nameLineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAddress (const QStringList _aux)
{
    address1LineEdit->setText(_aux.at(0));
    address2LineEdit->setText(_aux.at(1));
    address3LineEdit->setText(_aux.at(2));
    address4LineEdit->setText(_aux.at(3));
    return true;
}

bool SetupPageUserDataPage::setAddress1 (const QString &_aux)
{
    address1LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAddress2 (const QString &_aux)
{
    address2LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAddress3 (const QString &_aux)
{
    address3LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAddress4 (const QString &_aux)
{
    address4LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setCity (const QString &_aux)
{
    cityLineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setZipCode(const QString &_aux)
{
    zipLineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setProvince (const QString &_aux)
{
    provinceLineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setCountry (const QString &_aux)
{
    countryLineEdit->setText(_aux);
    return true;
}

QStringList SetupPageUserDataPage::getRigs()
{
    QStringList a;
    a.clear();
    a << rig1LineEdit->text() << rig2LineEdit->text() << rig3LineEdit->text();
    return a;
}

QStringList SetupPageUserDataPage::getAntennas()
{
    QStringList a;
    a.clear();
    a << ant1LineEdit->text() << ant2LineEdit->text() << ant3LineEdit->text();
    return a;
}

double SetupPageUserDataPage::getPower()
{
    return myPowerSpinBox->value();
}


bool SetupPageUserDataPage::setPower(const float _aux)
{
    myPowerSpinBox->setValue(_aux);
    return true;
}

bool SetupPageUserDataPage::setRig1 (const QString &_aux)
{
    rig1LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setRig2 (const QString &_aux)
{
    rig2LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setRig3 (const QString &_aux)
{
    rig3LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAntenna1 (const QString &_aux)
{
    ant1LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAntenna2 (const QString &_aux)
{
    ant2LineEdit->setText(_aux);
    return true;
}

bool SetupPageUserDataPage::setAntenna3 (const QString &_aux)
{
    ant3LineEdit->setText(_aux);
    return true;
}

void SetupPageUserDataPage::slotOperatorsChanged()
{
    //qDebug() << Q_FUNC_INFO << " - Start";
    //QString _operators = operatorsLineEdit->text();


    if (operatorsLineEdit->text().length() < 1)
        return;
    int i = operatorsLineEdit->cursorPosition();

    QString _a = operatorsLineEdit->text();

    if ((_a.at(i-1)).isSpace())
    {
        operatorsLineEdit->setText(_a.remove(i-1, 1));
    }

    operatorsLineEdit->setText(util->getClearSQLi (_a).simplified().toUpper());
    _a = operatorsLineEdit->text();

    if (checkOperatorsLineQString(_a))
    {
        //qDebug() << Q_FUNC_INFO << "  VALID FORMAT";
        operatorsLineEdit->setPalette(*defaultPalette);
        emit operatorsSignal(operatorsLineEdit->text());
    }
    else
    {
        operatorsLineEdit->setPalette(*wrongPalette);
            //qDebug() << Q_FUNC_INFO << "  NOT VALID FORMAT";
    }

       //qDebug() << Q_FUNC_INFO << " -05";
    operatorsLineEdit->setCursorPosition(i);
       //qDebug() << Q_FUNC_INFO << " -END";
}

QString SetupPageUserDataPage::getOperators()
{
    if (checkOperatorsLineQString(operatorsLineEdit->text()))
    {
        return operatorsLineEdit->text();
    }
    else
    {
        return QString();
    }
}

bool SetupPageUserDataPage::setOperators(const QString &_aux)
{
    if (checkOperatorsLineQString(_aux))
    {
        operatorsLineEdit->setText(_aux);
        return true;
    }
    return false;
}

bool  SetupPageUserDataPage::checkOperatorsLineQString(const QString &_auxLine)
{
    QStringList _aux = _auxLine.split(',');
    bool auxBool = false;
    for (int ii = 0; ii < _aux.size(); ++ii)
    {
        Callsign callsign(_aux.at(ii));
        if (callsign.isValid())
            auxBool = true;
    }
    return auxBool;
}

void SetupPageUserDataPage::setStationFocus()
{
    //qDebug() << Q_FUNC_INFO << " - Start";
    maincallsignLineEdit->setFocus();
}

void SetupPageUserDataPage::saveSettings()
{
    //qDebug() << Q_FUNC_INFO << " - Start";
    QSettings settings(util->getCfgFile (), QSettings::IniFormat);
    settings.beginGroup ("UserData");
    settings.setValue ("Callsign", getMainCallsign());
    settings.setValue ("Operators", getOperators());
    settings.setValue ("CQz", getCQz ());
    settings.setValue ("ITUz", getITUz());
    settings.setValue ("StationLocator", getStationLocator());
    settings.setValue ("Name", getName());
    settings.setValue ("Address1", getAddress1());
    settings.setValue ("Address2", getAddress2());
    settings.setValue ("Address3", getAddress3());
    settings.setValue ("Address4", getAddress4());
    settings.setValue ("City", getCity());
    settings.setValue ("ZipCode", getZipCode());
    settings.setValue ("ProvinceState", getProvince());
    settings.setValue ("Country", getCountry());
    settings.setValue ("Rig1", getRig1());
    settings.setValue ("Rig2", getRig2());
    settings.setValue ("Rig3", getRig3());
    settings.setValue ("Antenna1", getAntenna1());
    settings.setValue ("Antenna2", getAntenna2());
    settings.setValue ("Antenna3",getAntenna3());
    settings.setValue ("Power", getPower ());
    settings.endGroup ();
    //qDebug() << Q_FUNC_INFO << " - END";
}

void SetupPageUserDataPage::loadSettings()
{
    //qDebug() << Q_FUNC_INFO << " - Start";

    QSettings settings(util->getCfgFile (), QSettings::IniFormat);
    settings.beginGroup ("UserData");
    setMainCallsign(settings.value ("Callsign").toString ());
    setOperators (settings.value ("Operators").toString ());
    setStationLocator (settings.value ("StationLocator").toString ());
    cqzLineEdit->setText (settings.value ("CQz").toString ());
    ituzLineEdit->setText (settings.value ("ITUz").toString ());
    nameLineEdit->setText (settings.value ("Name").toString ());
    address1LineEdit->setText(settings.value ("Address1").toString ());
    address2LineEdit->setText(settings.value ("Address2").toString ());
    address3LineEdit->setText(settings.value ("Address3").toString ());
    address4LineEdit->setText(settings.value ("Address4").toString ());
    cityLineEdit->setText (settings.value ("City").toString ());
    zipLineEdit->setText (settings.value ("ZipCode").toString ());
    provinceLineEdit->setText(settings.value ("ProvinceState").toString ());
    countryLineEdit->setText (settings.value ("Country").toString ());
    rig1LineEdit->setText (settings.value ("Rig1").toString ());
    rig2LineEdit->setText (settings.value ("Rig2").toString ());
    rig3LineEdit->setText (settings.value ("Rig3").toString ());
    ant1LineEdit->setText (settings.value ("Antenna1").toString ());
    ant2LineEdit->setText (settings.value ("Antenna2").toString ());
    ant3LineEdit->setText (settings.value ("Antenna3").toString ());
    myPowerSpinBox->setValue(settings.value ("Power").toDouble ());
    settings.endGroup ();
}