Unverified Commit e7db8b94 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6523 from DonLakeFlyer/SettingsNameVersusGroup

Clean up SettingsGroup name and settingsGroup
parents e660d0db 4a399fc0
......@@ -15,7 +15,9 @@
#include <QtQml>
#include <QStandardPaths>
const char* AppSettings::settingsGroup = "App";
const char* AppSettings::name = "App";
const char* AppSettings::settingsGroup = ""; // settings are in root group
const char* AppSettings::offlineEditingFirmwareTypeSettingsName = "OfflineEditingFirmwareType";
const char* AppSettings::offlineEditingVehicleTypeSettingsName = "OfflineEditingVehicleType";
const char* AppSettings::offlineEditingCruiseSpeedSettingsName = "OfflineEditingCruiseSpeed";
......@@ -58,7 +60,7 @@ const char* AppSettings::videoDirectory = "Video";
const char* AppSettings::crashDirectory = "CrashLogs";
AppSettings::AppSettings(QObject* parent)
: SettingsGroup (settingsGroup, QString() /* root settings group */, parent)
: SettingsGroup (name, settingsGroup, parent)
, _offlineEditingFirmwareTypeFact (NULL)
, _offlineEditingVehicleTypeFact (NULL)
, _offlineEditingCruiseSpeedFact (NULL)
......
......@@ -93,6 +93,7 @@ public:
static MAV_AUTOPILOT offlineEditingFirmwareTypeFromFirmwareType(MAV_AUTOPILOT firmwareType);
static MAV_TYPE offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleType);
static const char* name;
static const char* settingsGroup;
static const char* offlineEditingFirmwareTypeSettingsName;
......
......@@ -13,7 +13,8 @@
#include <QQmlEngine>
#include <QtQml>
const char* AutoConnectSettings::_settingsGroup = "LinkManager";
const char* AutoConnectSettings::name = "AutoConnect";
const char* AutoConnectSettings::settingsGroup = "LinkManager";
const char* AutoConnectSettings:: autoConnectUDPSettingsName = "AutoconnectUDP";
const char* AutoConnectSettings:: autoConnectPixhawkSettingsName = "AutoconnectPixhawk";
......@@ -27,10 +28,9 @@ const char* AutoConnectSettings:: udpListenPortName = "Autocon
const char* AutoConnectSettings:: udpTargetHostIPName = "AutoconnectUDPTargetHostIP";
const char* AutoConnectSettings:: udpTargetHostPortName = "AutoconnectUDPTargetHostPort";
const char* AutoConnectSettings::autoConnectSettingsGroupName = "AutoConnect";
AutoConnectSettings::AutoConnectSettings(QObject* parent)
: SettingsGroup (autoConnectSettingsGroupName, _settingsGroup, parent)
: SettingsGroup (name, settingsGroup, parent)
, _autoConnectUDPFact (NULL)
, _autoConnectPixhawkFact (NULL)
, _autoConnectSiKRadioFact (NULL)
......
......@@ -43,7 +43,8 @@ public:
Fact* udpTargetHostIP (void);
Fact* udpTargetHostPort (void);
static const char* autoConnectSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* autoConnectUDPSettingsName;
static const char* autoConnectPixhawkSettingsName;
......@@ -69,8 +70,6 @@ private:
SettingsFact* _udpListenPortFact;
SettingsFact* _udpTargetHostIPFact;
SettingsFact* _udpTargetHostPortFact;
static const char* _settingsGroup;
};
#endif
......@@ -12,12 +12,14 @@
#include <QQmlEngine>
#include <QtQml>
const char* BrandImageSettings::brandImageSettingsGroupName = "BrandImage";
const char* BrandImageSettings::userBrandImageIndoorName = "UserBrandImageIndoor";
const char* BrandImageSettings::userBrandImageOutdoorName = "UserBrandImageOutdoor";
const char* BrandImageSettings::name = "BrandImage";
const char* BrandImageSettings::settingsGroup = ""; // settings are in root group
const char* BrandImageSettings::userBrandImageIndoorName = "UserBrandImageIndoor";
const char* BrandImageSettings::userBrandImageOutdoorName = "UserBrandImageOutdoor";
BrandImageSettings::BrandImageSettings(QObject* parent)
: SettingsGroup(brandImageSettingsGroupName, QString() /* root settings group */, parent)
: SettingsGroup(name, settingsGroup, parent)
, _userBrandImageIndoorFact(NULL)
, _userBrandImageOutdoorFact(NULL)
{
......
......@@ -25,7 +25,8 @@ public:
Fact* userBrandImageIndoor (void);
Fact* userBrandImageOutdoor (void);
static const char* brandImageSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* userBrandImageIndoorName;
static const char* userBrandImageOutdoorName;
......
......@@ -16,13 +16,14 @@
#include <QQmlEngine>
#include <QtQml>
const char* FlightMapSettings::flightMapSettingsGroupName = "FlightMap";
const char* FlightMapSettings::mapProviderSettingsName = "MapProvider";
const char* FlightMapSettings::mapTypeSettingsName = "MapType";
const char* FlightMapSettings::_settingsGroupName = "FlightMap";
const char* FlightMapSettings::name = "FlightMap";
const char* FlightMapSettings::settingsGroup = "FlightMap";
const char* FlightMapSettings::mapProviderSettingsName = "MapProvider";
const char* FlightMapSettings::mapTypeSettingsName = "MapType";
FlightMapSettings::FlightMapSettings(QObject* parent)
: SettingsGroup(flightMapSettingsGroupName, QString(_settingsGroupName) /* root settings group */, parent)
: SettingsGroup(name, settingsGroup, parent)
, _mapProviderFact(NULL)
, _mapTypeFact(NULL)
{
......
......@@ -43,7 +43,9 @@ public:
Fact* mapProvider (void);
Fact* mapType (void);
static const char* flightMapSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* mapProviderSettingsName;
static const char* mapTypeSettingsName;
......@@ -61,8 +63,6 @@ private:
SettingsFact* _mapTypeFact;
QStringList _savedMapTypeStrings;
QVariantList _savedMapTypeValues;
static const char* _settingsGroupName;
};
#endif
......@@ -15,14 +15,16 @@
#include <QtQml>
#include <QStandardPaths>
const char* GuidedSettings::guidedSettingsGroupName = "Guided";
const char* GuidedSettings::name = "Guided";
const char* GuidedSettings::settingsGroup = ""; // settings are in root group
const char* GuidedSettings::fixedWingMinimumAltitudeName = "FixedWingMinimumAltitude";
const char* GuidedSettings::fixedWingMaximumAltitudeName = "FixedWingMaximumAltitude";
const char* GuidedSettings::vehicleMinimumAltitudeName = "VehicleMinimumAltitude";
const char* GuidedSettings::vehicleMaximumAltitudeName = "VehicleMaximumAltitude";
GuidedSettings::GuidedSettings(QObject* parent)
: SettingsGroup(guidedSettingsGroupName, QString() /* root settings group */, parent)
: SettingsGroup(name, settingsGroup, parent)
, _fixedWingMinimumAltitudeFact (NULL)
, _fixedWingMaximumAltitudeFact (NULL)
, _vehicleMinimumAltitudeFact (NULL)
......
......@@ -31,7 +31,8 @@ public:
Fact* vehicleMinimumAltitude (void);
Fact* vehicleMaximumAltitude (void);
static const char* guidedSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* fixedWingMinimumAltitudeName;
static const char* fixedWingMaximumAltitudeName;
......
......@@ -12,12 +12,14 @@
#include <QQmlEngine>
#include <QtQml>
const char* RTKSettings::RTKSettingsGroupName = "RTK";
const char* RTKSettings::name = "RTK";
const char* RTKSettings::settingsGroup = "RTK";
const char* RTKSettings::surveyInAccuracyLimitName = "SurveyInAccuracyLimit";
const char* RTKSettings::surveyInMinObservationDurationName = "SurveyInMinObservationDuration";
RTKSettings::RTKSettings(QObject* parent)
: SettingsGroup(RTKSettingsGroupName, QString(RTKSettingsGroupName), parent)
: SettingsGroup(name, settingsGroup, parent)
, _surveyInAccuracyLimitFact(NULL)
, _surveyInMinObservationDurationFact(NULL)
{
......
......@@ -24,7 +24,8 @@ public:
Fact* surveyInAccuracyLimit (void);
Fact* surveyInMinObservationDuration(void);
static const char* RTKSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* surveyInAccuracyLimitName;
static const char* surveyInMinObservationDurationName;
......
......@@ -12,18 +12,18 @@
#include "QGCApplication.h"
SettingsGroup::SettingsGroup(const QString& name, const QString& settingsGroup, QObject* parent)
: QObject(parent)
, _name(name)
: QObject (parent)
, _name (name)
, _settingsGroup(settingsGroup)
, _visible(qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(name))
, _visible (qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(_name))
{
QString jsonNameFormat(":/json/%1.SettingsGroup.json");
_nameToMetaDataMap = FactMetaData::createMapFromJsonFile(jsonNameFormat.arg(name), this);
_nameToMetaDataMap = FactMetaData::createMapFromJsonFile(jsonNameFormat.arg(_name), this);
}
SettingsFact* SettingsGroup::_createSettingsFact(const QString& name)
SettingsFact* SettingsGroup::_createSettingsFact(const QString& factName)
{
return new SettingsFact(_settingsGroup, _nameToMetaDataMap[name], this);
return new SettingsFact(_settingsGroup, _nameToMetaDataMap[factName], this);
}
......@@ -31,10 +31,10 @@ public:
Q_PROPERTY(bool visible MEMBER _visible CONSTANT)
protected:
SettingsFact* _createSettingsFact(const QString& name);
SettingsFact* _createSettingsFact(const QString& factName);
QString _name;
QString _settingsGroup;
QString _name; ///< Name for group. Used to generate name for loaded json meta data file.
QString _settingsGroup; ///< QSettings group which contains these settings. empty for settings in root
bool _visible;
QMap<QString, FactMetaData*> _nameToMetaDataMap;
......
......@@ -12,14 +12,16 @@
#include <QQmlEngine>
#include <QtQml>
const char* UnitsSettings::unitsSettingsGroupName = "Units";
const char* UnitsSettings::distanceUnitsSettingsName = "DistanceUnits";
const char* UnitsSettings::areaUnitsSettingsName = "AreaUnits";
const char* UnitsSettings::speedUnitsSettingsName = "SpeedUnits";
const char* UnitsSettings::temperatureUnitsSettingsName = "TemperatureUnits";
const char* UnitsSettings::name = "Units";
const char* UnitsSettings::settingsGroup = ""; // settings are in root group
const char* UnitsSettings::distanceUnitsSettingsName = "DistanceUnits";
const char* UnitsSettings::areaUnitsSettingsName = "AreaUnits";
const char* UnitsSettings::speedUnitsSettingsName = "SpeedUnits";
const char* UnitsSettings::temperatureUnitsSettingsName = "TemperatureUnits";
UnitsSettings::UnitsSettings(QObject* parent)
: SettingsGroup(unitsSettingsGroupName, QString() /* root settings group */, parent)
: SettingsGroup(name, settingsGroup, parent)
, _distanceUnitsFact(NULL)
, _areaUnitsFact(NULL)
, _speedUnitsFact(NULL)
......
......@@ -61,7 +61,8 @@ public:
Fact* speedUnits (void);
Fact* temperatureUnits (void);
static const char* unitsSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* distanceUnitsSettingsName;
static const char* areaUnitsSettingsName;
......
......@@ -17,7 +17,8 @@
#include <QCameraInfo>
#endif
const char* VideoSettings::videoSettingsGroupName = "Video";
const char* VideoSettings::name = "Video";
const char* VideoSettings::settingsGroup = ""; // settings are in root group
const char* VideoSettings::videoSourceName = "VideoSource";
const char* VideoSettings::udpPortName = "VideoUDPPort";
......@@ -40,7 +41,7 @@ const char* VideoSettings::videoSourceRTSP = "RTSP Video Stream";
const char* VideoSettings::videoSourceTCP = "TCP-MPEG2 Video Stream";
VideoSettings::VideoSettings(QObject* parent)
: SettingsGroup(videoSettingsGroupName, QString() /* root settings group */, parent)
: SettingsGroup(name, settingsGroup, parent)
, _videoSourceFact(NULL)
, _udpPortFact(NULL)
, _tcpUrlFact(NULL)
......
......@@ -49,7 +49,8 @@ public:
Fact* disableWhenDisarmed (void);
bool streamConfigured (void);
static const char* videoSettingsGroupName;
static const char* name;
static const char* settingsGroup;
static const char* videoSourceName;
static const char* udpPortName;
......
......@@ -67,12 +67,12 @@ public:
virtual QGCOptions* options(void);
/// Allows the core plugin to override the visibility for a settings group
/// @param name - Setting group name
/// @param name - SettingsGroup name
/// @return true: Show settings ui, false: Hide settings ui
virtual bool overrideSettingsGroupVisibility(QString name);
/// Allows the core plugin to override the setting meta data before the setting fact is created.
/// @param settingsGroup - Settings group which contains this value
/// @param settingsGroup - QSettings group which contains this item
/// @param metaData - MetaData for setting fact
/// @return true: Setting should be visible in ui, false: Setting should not be shown in ui
virtual bool adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment