Commit 377508a9 authored by DonLakeFlyer's avatar DonLakeFlyer

Core plugin can override Value Widgets default settings

Also added Vehicle.flightTime to default setup
parent 8616ebef
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "ValuesWidgetController.h" #include "ValuesWidgetController.h"
#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include <QSettings> #include <QSettings>
...@@ -19,13 +21,14 @@ const char* ValuesWidgetController::_smallValuesKey = "small"; ...@@ -19,13 +21,14 @@ const char* ValuesWidgetController::_smallValuesKey = "small";
ValuesWidgetController::ValuesWidgetController(void) ValuesWidgetController::ValuesWidgetController(void)
{ {
QSettings settings; QSettings settings;
QStringList largeDefaults;
settings.beginGroup(_groupKey); settings.beginGroup(_groupKey);
largeDefaults << "Vehicle.altitudeRelative" << "Vehicle.groundSpeed"; QStringList largeDefaults, smallDefaults;
qgcApp()->toolbox()->corePlugin()->valuesWidgetDefaultSettings(largeDefaults, smallDefaults);
_largeValues = settings.value(_largeValuesKey, largeDefaults).toStringList(); _largeValues = settings.value(_largeValuesKey, largeDefaults).toStringList();
_smallValues = settings.value(_smallValuesKey, QStringList()).toStringList(); _smallValues = settings.value(_smallValuesKey, smallDefaults).toStringList();
_altitudeProperties << "altitudeRelative" << "altitudeAMSL"; _altitudeProperties << "altitudeRelative" << "altitudeAMSL";
......
...@@ -198,3 +198,9 @@ QString QGCCorePlugin::showAdvancedUIMessage(void) const ...@@ -198,3 +198,9 @@ QString QGCCorePlugin::showAdvancedUIMessage(void) const
"You should do so only if instructed by customer support. " "You should do so only if instructed by customer support. "
"Are you sure you want to enable Advanced Mode?"); "Are you sure you want to enable Advanced Mode?");
} }
void QGCCorePlugin::valuesWidgetDefaultSettings(QStringList& largeValues, QStringList& smallValues)
{
Q_UNUSED(smallValues);
largeValues << "Vehicle.altitudeRelative" << "Vehicle.groundSpeed" << "Vehicle.flightTime";
}
...@@ -48,25 +48,25 @@ public: ...@@ -48,25 +48,25 @@ public:
/// The list of settings under the Settings Menu /// The list of settings under the Settings Menu
/// @return A list of QGCSettings /// @return A list of QGCSettings
virtual QVariantList& settingsPages (); virtual QVariantList& settingsPages(void);
/// The default settings panel to show /// The default settings panel to show
/// @return The settings index /// @return The settings index
virtual int defaultSettings (); virtual int defaultSettings(void);
/// Global options /// Global options
/// @return An instance of QGCOptions /// @return An instance of QGCOptions
virtual QGCOptions* options (); virtual QGCOptions* options(void);
/// Allows the core plugin to override the visibility for a settings group /// Allows the core plugin to override the visibility for a settings group
/// @param name - Setting group name /// @param name - Setting group name
/// @return true: Show settings ui, false: Hide settings ui /// @return true: Show settings ui, false: Hide settings ui
virtual bool overrideSettingsGroupVisibility (QString name); virtual bool overrideSettingsGroupVisibility(QString name);
/// Allows the core plugin to override the setting meta data before the setting fact is created. /// Allows the core plugin to override the setting meta data before the setting fact is created.
/// @param metaData - MetaData for setting fact /// @param metaData - MetaData for setting fact
/// @return true: Setting should be visible in ui, false: Setting should not be shown in ui /// @return true: Setting should be visible in ui, false: Setting should not be shown in ui
virtual bool adjustSettingMetaData (FactMetaData& metaData); virtual bool adjustSettingMetaData(FactMetaData& metaData);
/// Return the resource file which contains the brand image for for Indoor theme. /// Return the resource file which contains the brand image for for Indoor theme.
virtual QString brandImageIndoor(void) const { return QString(); } virtual QString brandImageIndoor(void) const { return QString(); }
...@@ -83,6 +83,9 @@ public: ...@@ -83,6 +83,9 @@ public:
/// Allows a plugin to override the specified color name from the palette /// Allows a plugin to override the specified color name from the palette
virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo); virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo);
/// Allows the plugin the override the default settings for the Values Widget large and small values
virtual void valuesWidgetDefaultSettings(QStringList& largeValues, QStringList& smallValues);
bool showTouchAreas(void) const { return _showTouchAreas; } bool showTouchAreas(void) const { return _showTouchAreas; }
bool showAdvancedUI(void) const { return _showAdvancedUI; } bool showAdvancedUI(void) const { return _showAdvancedUI; }
void setShowTouchAreas(bool show); void setShowTouchAreas(bool show);
......
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