mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
refs #198, updated network settings so they can read/write JSON and be used with persistent settings
This commit is contained in:
@@ -3,10 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_SETTINGS_SERVER_H
|
||||
#define BLACKMISC_SETTINGS_SERVER_H
|
||||
|
||||
@@ -14,7 +10,7 @@
|
||||
#include "valueobject.h"
|
||||
#include "statusmessagelist.h"
|
||||
#include "settingutilities.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -45,6 +41,20 @@ namespace BlackMisc
|
||||
return value;
|
||||
}
|
||||
|
||||
//! \brief Path
|
||||
static const QString &ValueBookingServiceUrl()
|
||||
{
|
||||
static const QString value("bookingserviceurl");
|
||||
return value;
|
||||
}
|
||||
|
||||
//! \brief Path
|
||||
static const QString &ValueDBusServerAddress()
|
||||
{
|
||||
static const QString value("dbuserveraddress");
|
||||
return value;
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::toQVariant()
|
||||
virtual QVariant toQVariant() const override
|
||||
{
|
||||
@@ -58,6 +68,10 @@ namespace BlackMisc
|
||||
BlackMisc::Network::CServer getCurrentTrafficNetworkServer() const { return m_trafficNetworkServerCurrent; }
|
||||
|
||||
//! \brief URL of booking service
|
||||
QString getBookingServiceUrl() const { return m_bookingServiceUrl; }
|
||||
|
||||
//! \brief Address for DBus Server
|
||||
QString getDBusServerAddress() const { return m_dbusServerAddress; }
|
||||
|
||||
//! \brief Selected traffic network server
|
||||
bool setCurrentNetworkServer(const BlackMisc::Network::CServer ¤tServer);
|
||||
@@ -77,8 +91,21 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::getValueHash
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::fromJson
|
||||
virtual void fromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \brief init with meaningful default values
|
||||
void initDefaultValues();
|
||||
|
||||
//! \brief Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! \copydoc TupleConverter<>::jsonMembers()
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
protected:
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
@@ -99,13 +126,18 @@ namespace BlackMisc
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CSettingsNetwork)
|
||||
BlackMisc::Network::CServerList m_trafficNetworkServers;
|
||||
BlackMisc::Network::CServer m_trafficNetworkServerCurrent;
|
||||
QString m_bookingServiceUrl;
|
||||
QString m_dbusServerAddress;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Settings::CSettingsNetwork)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Settings::CSettingsNetwork, (o.m_trafficNetworkServers, o.m_trafficNetworkServerCurrent, o.m_bookingServiceUrl, o.m_dbusServerAddress))
|
||||
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user