3#include "ParameterService.h"
5#include <QLoggingCategory>
7Q_DECLARE_LOGGING_CATEGORY(Service)
8CParameterService::CParameterService(QObject *parent) : QObject(parent),
14CParameterService::~CParameterService()
16 qDebug(Service) <<
"CParameterService::~CParameterService";
19int CParameterService::Load(
const QString& szFile)
21 QSettings set(szFile, QSettings::IniFormat);
22 m_nPort = set.value(
"Port", m_nPort).toUInt();
23 m_bEnable = set.value(
"Enable", m_bEnable).toBool();
24 m_szPassword = set.value(
"Password", m_szPassword).toString();
28int CParameterService::Save(
const QString& szFile)
30 QSettings set(szFile, QSettings::IniFormat);
31 set.setValue(
"Port", m_nPort);
32 set.setValue(
"Enable", m_bEnable);
33 set.setValue(
"Password", m_szPassword);
37quint16 CParameterService::getPort()
const
42void CParameterService::setPort(quint16 newPort)
44 if (m_nPort == newPort)
50bool CParameterService::getEnable()
const
55void CParameterService::setEnable(
bool newEnable)
57 if (m_bEnable == newEnable)
59 m_bEnable = newEnable;
63const QString &CParameterService::getPassword()
const
68void CParameterService::setPassword(
const QString &newPassword)
70 if (m_szPassword == newPassword)
72 m_szPassword = newPassword;
73 emit PasswordChanged();