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
|
/**************************************************************************
* Copyright (C) 2000-2019 by Johan Maes *
* on4qz@telenet.be *
* http://users.telenet.be/on4qz *
* *
* This program 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 2 of the License, or *
* (at your option) any later version. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "operatorconfig.h"
#include "ui_operatorconfig.h"
QString myCallsign;
QString myQth;
QString myLocator;
QString myLastname;
QString myFirstname;
QString lastReceivedCall;
bool onlineStatusEnabled;
QString onlineStatusText;
operatorConfig::operatorConfig(QWidget *parent) : baseConfig(parent), ui(new Ui::operatorConfig)
{
ui->setupUi(this);
QRegExp rx("^\\w*$");
QValidator *validator = new QRegExpValidator(rx, this);
ui->onlineStatusText->setValidator(validator);
}
operatorConfig::~operatorConfig()
{
delete ui;
}
void operatorConfig::readSettings()
{
QSettings qSettings;
qSettings.beginGroup("PERSONAL");
myCallsign=qSettings.value("callsign",QString("NOCALL")).toString();
myQth=qSettings.value("qth",QString("NOWHERE")).toString();
myLastname=qSettings.value("lastname",QString("NONAME")).toString();
myFirstname=qSettings.value("firstname",QString("NOFIRSTNAME")).toString();
myLocator=qSettings.value("locator",QString("NOLOCATOR")).toString();
onlineStatusEnabled=qSettings.value("onlinestatusenabled",true).toBool();
onlineStatusText=qSettings.value("onlinestatustext",QString("")).toString();
qSettings.endGroup();
setParams();
}
void operatorConfig::writeSettings()
{
QSettings qSettings;
getParams();
qSettings.beginGroup("PERSONAL");
qSettings.setValue("callsign",myCallsign);
qSettings.setValue("qth",myQth);
qSettings.setValue("locator",myLocator);
qSettings.setValue("lastname",myLastname);
qSettings.setValue("firstname",myFirstname);
qSettings.setValue("onlinestatusenabled",onlineStatusEnabled);
qSettings.setValue("onlinestatustext",onlineStatusText);
qSettings.endGroup();
}
void operatorConfig::getParams()
{
QString myCallsignCopy=myCallsign;
QString myQthCopy=myQth;
QString myLocatorCopy= myLocator;
QString myLastnameCopy=myLastname;
QString myFirstnameCopy=myFirstname;
QString onlineStatusTextCopy=onlineStatusText;
bool onlineStatusEnabledCopy=onlineStatusEnabled;
getValue(myCallsign,ui->callsignLineEdit);
getValue(myLastname,ui->lastnameLineEdit);
getValue(myFirstname,ui->firstnameLineEdit);
getValue(myQth,ui->qthLineEdit);
getValue(myLocator,ui->locatorLineEdit);
getValue(onlineStatusText,ui->onlineStatusText);
getValue(onlineStatusEnabled,ui->onlineStatusCheckbox);
changed=false;
if( myCallsignCopy!=myCallsign
|| myQthCopy!=myQth
|| myLocatorCopy!= myLocator
|| myLastnameCopy!=myLastname
|| myFirstnameCopy!=myFirstname
|| onlineStatusEnabledCopy!=onlineStatusEnabled
|| onlineStatusTextCopy!=onlineStatusText)
changed=true;
}
void operatorConfig::setParams()
{
setValue(myCallsign,ui->callsignLineEdit);
setValue(myLastname,ui->lastnameLineEdit);
setValue(myFirstname,ui->firstnameLineEdit);
setValue(myQth,ui->qthLineEdit);
setValue(myLocator,ui->locatorLineEdit);
setValue(onlineStatusEnabled,ui->onlineStatusCheckbox);
setValue(onlineStatusText,ui->onlineStatusText);
}
|