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 @@
#include "ValuesWidgetController.h"
#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include <QSettings>
......@@ -19,13 +21,14 @@ const char* ValuesWidgetController::_smallValuesKey = "small";
ValuesWidgetController::ValuesWidgetController(void)
{
QSettings settings;
QStringList largeDefaults;
settings.beginGroup(_groupKey);
largeDefaults << "Vehicle.altitudeRelative" << "Vehicle.groundSpeed";
QStringList largeDefaults, smallDefaults;
qgcApp()->toolbox()->corePlugin()->valuesWidgetDefaultSettings(largeDefaults, smallDefaults);
_largeValues = settings.value(_largeValuesKey, largeDefaults).toStringList();
_smallValues = settings.value(_smallValuesKey, QStringList()).toStringList();
_smallValues = settings.value(_smallValuesKey, smallDefaults).toStringList();
_altitudeProperties << "altitudeRelative" << "altitudeAMSL";
......
......@@ -198,3 +198,9 @@ QString QGCCorePlugin::showAdvancedUIMessage(void) const
"You should do so only if instructed by customer support. "
"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:
/// The list of settings under the Settings Menu
/// @return A list of QGCSettings
virtual QVariantList& settingsPages ();
virtual QVariantList& settingsPages(void);
/// The default settings panel to show
/// @return The settings index
virtual int defaultSettings ();
virtual int defaultSettings(void);
/// Global options
/// @return An instance of QGCOptions
virtual QGCOptions* options ();
virtual QGCOptions* options(void);
/// Allows the core plugin to override the visibility for a settings group
/// @param name - Setting group name
/// @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.
/// @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 (FactMetaData& metaData);
virtual bool adjustSettingMetaData(FactMetaData& metaData);
/// Return the resource file which contains the brand image for for Indoor theme.
virtual QString brandImageIndoor(void) const { return QString(); }
......@@ -83,6 +83,9 @@ public:
/// Allows a plugin to override the specified color name from the palette
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 showAdvancedUI(void) const { return _showAdvancedUI; }
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