Commit 88f084eb authored by Don Gagne's avatar Don Gagne

More moves of settings to new support

parent 1f5b8f6a
......@@ -58,8 +58,8 @@ Rectangle {
// I don't know why this does not work
Connections {
target: QGroundControl
onBaseFontPointSizeChanged: buttonColumn.reflowWidths()
target: QGroundControl.settingsManager.appSettings.appFontPointSize
onValueChanged: buttonColumn.reflowWidths()
}
function reflowWidths() {
......
......@@ -81,7 +81,7 @@ QGCView {
}
function px4JoystickCheck() {
if ( _activeVehicle && !_activeVehicle.supportsManualControl && (QGroundControl.virtualTabletJoystick || _activeVehicle.joystickEnabled)) {
if ( _activeVehicle && !_activeVehicle.supportsManualControl && (QGroundControl.settingsManager.appSettings.virtualJoystick.value || _activeVehicle.joystickEnabled)) {
px4JoystickSupport.open()
}
}
......@@ -99,8 +99,8 @@ QGCView {
}
Connections {
target: QGroundControl
onVirtualTabletJoystickChanged: px4JoystickCheck()
target: QGroundControl.settingsManager.appSettings.virtualJoystick
onValueChanged: px4JoystickCheck()
}
onActiveVehicleJoystickEnabledChanged: px4JoystickCheck()
......@@ -302,14 +302,16 @@ QGCView {
z: _panel.z + 5
width: parent.width - (_flightVideoPipControl.width / 2)
height: Math.min(ScreenTools.availableHeight * 0.25, ScreenTools.defaultFontPixelWidth * 16)
visible: QGroundControl.virtualTabletJoystick
visible: _virtualJoystick.value
anchors.bottom: _flightVideoPipControl.top
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2
anchors.horizontalCenter: flightDisplayViewWidgets.horizontalCenter
source: "qrc:/qml/VirtualJoystick.qml"
active: QGroundControl.virtualTabletJoystick
active: _virtualJoystick.value
property bool useLightColors: root.isBackgroundDark
property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
}
}
}
......@@ -63,7 +63,7 @@ Item {
break;
}
} else {
var useAlternateInstruments = QGroundControl.virtualTabletJoystick || ScreenTools.isTinyScreen
var useAlternateInstruments = QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
if(useAlternateInstruments) {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
instrumentsLoader.state = "topMode"
......@@ -75,10 +75,8 @@ Item {
}
Connections {
target: QGroundControl
onVirtualTabletJoystickChanged: {
_setInstrumentWidget()
}
target: QGroundControl.settingsManager.appSettings.virtualJoystick
onValueChanged: _setInstrumentWidget()
}
Component.onCompleted: {
......
......@@ -21,7 +21,7 @@ Item {
Timer {
interval: 40 // 25Hz, same as real joystick rate
running: QGroundControl.virtualTabletJoystick && _activeVehicle
running: QGroundControl.settingsManager.appSettings.virtualJoystick.value && _activeVehicle
repeat: true
onTriggered: {
if (_activeVehicle) {
......
......@@ -79,6 +79,7 @@
#include "MissionCommandTree.h"
#include "QGCMapPolygon.h"
#include "ParameterManager.h"
#include "SettingsManager.h"
#ifndef NO_SERIAL_LINK
#include "SerialLink.h"
......@@ -115,7 +116,6 @@ const char* QGCApplication::telemetryFileExtension = "tlog";
const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot";
const char* QGCApplication::_settingsVersionKey = "SettingsVersion";
const char* QGCApplication::_styleKey = "StyleIsDark";
const char* QGCApplication::_lastKnownHomePositionLatKey = "LastKnownHomePositionLat";
const char* QGCApplication::_lastKnownHomePositionLonKey = "LastKnownHomePositionLon";
const char* QGCApplication::_lastKnownHomePositionAltKey = "LastKnownHomePositionAlt";
......@@ -166,11 +166,6 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
: QApplication(argc, argv)
#endif
, _runningUnitTests(unitTesting)
#if defined (__mobile__)
, _styleIsDark(false)
#else
, _styleIsDark(true)
#endif
, _fakeMobile(false)
, _settingsUpgraded(false)
#ifdef QT_DEBUG
......@@ -400,8 +395,7 @@ bool QGCApplication::_initForNormalAppBoot(void)
{
QSettings settings;
_styleIsDark = settings.value(_styleKey, _styleIsDark).toBool();
_loadCurrentStyle();
_loadCurrentStyleSheet();
// Exit main application when last window is closed
connect(this, &QGCApplication::lastWindowClosed, this, QGCApplication::quit);
......@@ -527,17 +521,7 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile)
}
#endif
void QGCApplication::setStyle(bool styleIsDark)
{
QSettings settings;
settings.setValue(_styleKey, styleIsDark);
_styleIsDark = styleIsDark;
_loadCurrentStyle();
emit styleChanged(_styleIsDark);
}
void QGCApplication::_loadCurrentStyle()
void QGCApplication::_loadCurrentStyleSheet(void)
{
#ifndef __mobile__
bool success = true;
......@@ -553,7 +537,7 @@ void QGCApplication::_loadCurrentStyle()
success = false;
}
if (success && !_styleIsDark) {
if (success && !_toolbox->settingsManager()->appSettings()->indoorPalette()->rawValue().toBool()) {
// Load the slave light stylesheet.
QFile styleSheet(_lightStyleFile);
if (styleSheet.open(QIODevice::ReadOnly | QIODevice::Text)) {
......@@ -571,8 +555,6 @@ void QGCApplication::_loadCurrentStyle()
setStyle("plastique");
}
#endif
QGCPalette::setGlobalTheme(_styleIsDark ? QGCPalette::Dark : QGCPalette::Light);
}
void QGCApplication::reportMissingParameter(int componentId, const QString& name)
......
......@@ -78,12 +78,6 @@ public:
/// @brief Returns truee if unit test are being run
bool runningUnitTests(void) { return _runningUnitTests; }
/// @return true: dark ui style, false: light ui style
bool styleIsDark(void) { return _styleIsDark; }
/// Set the current UI style
void setStyle(bool styleIsDark);
/// Used to report a missing Parameter. Warning will be displayed to user. Method may be called
/// multiple times.
void reportMissingParameter(int componentId, const QString& name);
......@@ -127,10 +121,6 @@ public slots:
#endif
signals:
/// Signals that the style has changed
/// @param darkStyle true: dark style, false: light style
void styleChanged(bool darkStyle);
/// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot
/// on the MAVLinkProtocol thread;
void checkForLostLogFiles(void);
......@@ -150,14 +140,15 @@ public:
/// unit tests. Although public should only be called by main.
bool _initForUnitTests(void);
void _loadCurrentStyleSheet(void);
static QGCApplication* _app; ///< Our own singleton. Should be reference directly by qgcApp
private slots:
void _missingParamsDisplay(void);
private:
void _loadCurrentStyle ();
QObject* _rootQmlObject ();
QObject* _rootQmlObject(void);
#ifdef __mobile__
QQmlApplicationEngine* _qmlAppEngine;
......@@ -167,7 +158,6 @@ private:
static const char* _darkStyleFile;
static const char* _lightStyleFile;
bool _styleIsDark; ///< true: dark style, false: light style
static const int _missingParamsDelayedDisplayTimerTimeout = 1000; ///< Timeout to wait for next missing fact to come in before display
QTimer _missingParamsDelayedDisplayTimer; ///< Timer use to delay missing fact display
QStringList _missingParams; ///< List of missing facts to be displayed
......@@ -186,7 +176,6 @@ private:
static const char* _settingsVersionKey; ///< Settings key which hold settings version
static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted
static const char* _styleKey; ///< Settings key for UI style
static const char* _lastKnownHomePositionLatKey;
static const char* _lastKnownHomePositionLonKey;
static const char* _lastKnownHomePositionAltKey;
......
......@@ -19,9 +19,6 @@
static const char* kQmlGlobalKeyName = "QGCQml";
const char* QGroundControlQmlGlobal::_virtualTabletJoystickKey = "VirtualTabletJoystick";
const char* QGroundControlQmlGlobal::_baseFontPointSizeKey = "BaseDeviceFontPointSize";
QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
: QGCTool(app)
, _flightMapSettings(NULL)
......@@ -35,13 +32,7 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
, _corePlugin(NULL)
, _firmwarePluginManager(NULL)
, _settingsManager(NULL)
, _virtualTabletJoystick(false)
, _baseFontPointSize(0.0)
{
QSettings settings;
_virtualTabletJoystick = settings.value(_virtualTabletJoystickKey, false).toBool();
_baseFontPointSize = settings.value(_baseFontPointSizeKey, 0.0).toDouble();
// We clear the parent on this object since we run into shutdown problems caused by hybrid qml app. Instead we let it leak on shutdown.
setParent(NULL);
}
......@@ -157,12 +148,6 @@ void QGroundControlQmlGlobal::stopAllMockLinks(void)
#endif
}
void QGroundControlQmlGlobal::setIsDarkStyle(bool dark)
{
qgcApp()->setStyle(dark);
emit isDarkStyleChanged(dark);
}
void QGroundControlQmlGlobal::setIsVersionCheckEnabled(bool enable)
{
qgcApp()->toolbox()->mavlinkProtocol()->enableVersionCheck(enable);
......@@ -175,26 +160,6 @@ void QGroundControlQmlGlobal::setMavlinkSystemID(int id)
emit mavlinkSystemIDChanged(id);
}
void QGroundControlQmlGlobal::setVirtualTabletJoystick(bool enabled)
{
if (_virtualTabletJoystick != enabled) {
QSettings settings;
settings.setValue(_virtualTabletJoystickKey, enabled);
_virtualTabletJoystick = enabled;
emit virtualTabletJoystickChanged(enabled);
}
}
void QGroundControlQmlGlobal::setBaseFontPointSize(qreal size)
{
if (size >= 6.0 && size <= 48.0) {
QSettings settings;
settings.setValue(_baseFontPointSizeKey, size);
_baseFontPointSize = size;
emit baseFontPointSizeChanged(size);
}
}
int QGroundControlQmlGlobal::supportedFirmwareCount()
{
return _firmwarePluginManager->supportedFirmwareTypes().count();
......
......@@ -54,11 +54,6 @@ public:
Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss
Q_PROPERTY(qreal zOrderMapItems READ zOrderMapItems CONSTANT) ///< z order value for map items, for example: mission item indicators
// Various QGC settings exposed to Qml
Q_PROPERTY(bool isDarkStyle READ isDarkStyle WRITE setIsDarkStyle NOTIFY isDarkStyleChanged) // TODO: Should be in ScreenTools?
Q_PROPERTY(bool virtualTabletJoystick READ virtualTabletJoystick WRITE setVirtualTabletJoystick NOTIFY virtualTabletJoystickChanged)
Q_PROPERTY(qreal baseFontPointSize READ baseFontPointSize WRITE setBaseFontPointSize NOTIFY baseFontPointSizeChanged)
//-------------------------------------------------------------------------
// MavLink Protocol
Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged)
......@@ -142,10 +137,6 @@ public:
qreal zOrderWidgets () { return 100; }
qreal zOrderMapItems () { return 50; }
bool isDarkStyle () { return _app->styleIsDark(); }
bool virtualTabletJoystick () { return _virtualTabletJoystick; }
qreal baseFontPointSize () { return _baseFontPointSize; }
bool isVersionCheckEnabled () { return _toolbox->mavlinkProtocol()->versionCheckEnabled(); }
int mavlinkSystemID () { return _toolbox->mavlinkProtocol()->getSystemId(); }
......@@ -153,10 +144,6 @@ public:
int supportedFirmwareCount ();
void setIsDarkStyle (bool dark);
void setVirtualTabletJoystick (bool enabled);
void setBaseFontPointSize (qreal size);
void setIsVersionCheckEnabled (bool enable);
void setMavlinkSystemID (int id);
......@@ -170,9 +157,6 @@ public:
virtual void setToolbox(QGCToolbox* toolbox);
signals:
void isDarkStyleChanged (bool dark);
void virtualTabletJoystickChanged (bool enabled);
void baseFontPointSizeChanged (qreal size);
void isMultiplexingEnabledChanged (bool enabled);
void isVersionCheckEnabledChanged (bool enabled);
void mavlinkSystemIDChanged (int id);
......@@ -192,13 +176,8 @@ private:
FirmwarePluginManager* _firmwarePluginManager;
SettingsManager* _settingsManager;
bool _virtualTabletJoystick;
qreal _baseFontPointSize;
QGeoCoordinate _flightMapPosition;
double _flightMapZoom;
static const char* _virtualTabletJoystickKey;
static const char* _baseFontPointSizeKey;
};
#endif
......@@ -67,10 +67,10 @@ Item {
I've disabled (in release builds) until I figure out why. Changes require a restart for now.
*/
Connections {
target: QGroundControl
onBaseFontPointSizeChanged: {
target: QGroundControl.settingsManager.appSettings.appFontPointSize
onValueChanged: {
if(ScreenToolsController.isDebug)
_setBasePointSize(QGroundControl.baseFontPointSize)
_setBasePointSize(QGroundControl.settingsManager.appSettings.appFontPointSize.value)
}
}
......@@ -108,12 +108,10 @@ Item {
property real fontWidth: contentWidth
property real fontHeight: contentHeight
Component.onCompleted: {
var baseSize = QGroundControl.corePlugin.options.defaultFontPointSize
if(baseSize == 0.0) {
baseSize = QGroundControl.baseFontPointSize;
}
var _appFontPointSizeFact = QGroundControl.settingsManager.appSettings.appFontPointSize
var baseSize = _appFontPointSizeFact.value
//-- If this is the first time (not saved in settings)
if(baseSize < 6 || baseSize > 48) {
if(baseSize < _appFontPointSizeFact.min || baseSize > _appFontPointSizeFact.max) {
//-- Init base size base on the platform
if(ScreenToolsController.isMobile) {
//-- Check iOS really tiny screens (iPhone 4s/5/5s)
......@@ -142,7 +140,7 @@ Item {
else
baseSize = _defaultFont.font.pointSize;
}
QGroundControl.baseFontPointSize = baseSize
_appFontPointSizeFact.value = baseSize
//-- Release build doesn't get signal
if(!ScreenToolsController.isDebug)
_screenTools._setBasePointSize(baseSize);
......
......@@ -8,6 +8,8 @@
****************************************************************************/
#include "AppSettings.h"
#include "QGCPalette.h"
#include "QGCApplication.h"
#include <QQmlEngine>
#include <QtQml>
......@@ -23,6 +25,9 @@ const char* AppSettings::missionAutoLoadDirSettingsName = "Mission
const char* AppSettings::promptFlightTelemetrySaveName = "PromptFLightDataSave";
const char* AppSettings::promptFlightTelemetrySaveNotArmedName = "PromptFLightDataSaveNotArmed";
const char* AppSettings::audioMutedName = "AudioMuted";
const char* AppSettings::virtualJoystickName = "VirtualTabletJoystick";
const char* AppSettings::appFontPointSizeName = "BaseDeviceFontPointSize";
const char* AppSettings::indoorPaletteName = "StyleIsDark";
AppSettings::AppSettings(QObject* parent)
: SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent)
......@@ -33,12 +38,24 @@ AppSettings::AppSettings(QObject* parent)
, _batteryPercentRemainingAnnounceFact(NULL)
, _defaultMissionItemAltitudeFact(NULL)
, _missionAutoLoadDirFact(NULL)
, _promptFlightTelemetrySave(NULL)
, _promptFlightTelemetrySaveNotArmed(NULL)
, _audioMuted(NULL)
, _promptFlightTelemetrySaveFact(NULL)
, _promptFlightTelemetrySaveNotArmedFact(NULL)
, _audioMutedFact(NULL)
, _virtualJoystickFact(NULL)
, _appFontPointSizeFact(NULL)
, _indoorPaletteFact(NULL)
{
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
// Set up correct default for palette setting
QVariant outdoorPalette;
#if defined (__mobile__)
outdoorPalette = 0;
#else
outdoorPalette = 1;
#endif
_nameToMetaDataMap[indoorPaletteName]->setRawDefaultValue(outdoorPalette);
}
Fact* AppSettings::offlineEditingFirmwareType(void)
......@@ -104,27 +121,61 @@ Fact* AppSettings::missionAutoLoadDir(void)
Fact* AppSettings::promptFlightTelemetrySave(void)
{
if (!_promptFlightTelemetrySave) {
_promptFlightTelemetrySave = _createSettingsFact(promptFlightTelemetrySaveName);
if (!_promptFlightTelemetrySaveFact) {
_promptFlightTelemetrySaveFact = _createSettingsFact(promptFlightTelemetrySaveName);
}
return _promptFlightTelemetrySave;
return _promptFlightTelemetrySaveFact;
}
Fact* AppSettings::promptFlightTelemetrySaveNotArmed(void)
{
if (!_promptFlightTelemetrySaveNotArmed) {
_promptFlightTelemetrySaveNotArmed = _createSettingsFact(promptFlightTelemetrySaveNotArmedName);
if (!_promptFlightTelemetrySaveNotArmedFact) {
_promptFlightTelemetrySaveNotArmedFact = _createSettingsFact(promptFlightTelemetrySaveNotArmedName);
}
return _promptFlightTelemetrySaveNotArmed;
return _promptFlightTelemetrySaveNotArmedFact;
}
Fact* AppSettings::audioMuted(void)
{
if (!_audioMuted) {
_audioMuted = _createSettingsFact(audioMutedName);
if (!_audioMutedFact) {
_audioMutedFact = _createSettingsFact(audioMutedName);
}
return _audioMutedFact;
}
Fact* AppSettings::appFontPointSize(void)
{
if (!_appFontPointSizeFact) {
_appFontPointSizeFact = _createSettingsFact(appFontPointSizeName);
}
return _audioMuted;
return _appFontPointSizeFact;
}
Fact* AppSettings::virtualJoystick(void)
{
if (!_virtualJoystickFact) {
_virtualJoystickFact = _createSettingsFact(virtualJoystickName);
}
return _virtualJoystickFact;
}
Fact* AppSettings::indoorPalette(void)
{
if (!_indoorPaletteFact) {
_indoorPaletteFact = _createSettingsFact(indoorPaletteName);
connect(_indoorPaletteFact, &Fact::rawValueChanged, this, &AppSettings::_indoorPaletteChanged);
}
return _indoorPaletteFact;
}
void AppSettings::_indoorPaletteChanged(void)
{
qgcApp()->_loadCurrentStyleSheet();
QGCPalette::setGlobalTheme(_indoorPaletteFact->rawValue().toBool() ? QGCPalette::Dark : QGCPalette::Light);
}
......@@ -29,6 +29,9 @@ public:
Q_PROPERTY(Fact* promptFlightTelemetrySave READ promptFlightTelemetrySave CONSTANT)
Q_PROPERTY(Fact* promptFlightTelemetrySaveNotArmed READ promptFlightTelemetrySaveNotArmed CONSTANT)
Q_PROPERTY(Fact* audioMuted READ audioMuted CONSTANT)
Q_PROPERTY(Fact* virtualJoystick READ virtualJoystick CONSTANT)
Q_PROPERTY(Fact* appFontPointSize READ appFontPointSize CONSTANT)
Q_PROPERTY(Fact* indoorPalette READ indoorPalette CONSTANT)
Fact* offlineEditingFirmwareType (void);
Fact* offlineEditingVehicleType (void);
......@@ -39,7 +42,10 @@ public:
Fact* missionAutoLoadDir (void);
Fact* promptFlightTelemetrySave (void);
Fact* promptFlightTelemetrySaveNotArmed (void);
Fact* audioMuted (void);
Fact* audioMuted (void);
Fact* virtualJoystick (void);
Fact* appFontPointSize (void);
Fact* indoorPalette (void);
static const char* appSettingsGroupName;
......@@ -53,6 +59,12 @@ public:
static const char* promptFlightTelemetrySaveName;
static const char* promptFlightTelemetrySaveNotArmedName;
static const char* audioMutedName;
static const char* virtualJoystickName;
static const char* appFontPointSizeName;
static const char* indoorPaletteName;
private slots:
void _indoorPaletteChanged(void);
private:
SettingsFact* _offlineEditingFirmwareTypeFact;
......@@ -62,9 +74,12 @@ private:
SettingsFact* _batteryPercentRemainingAnnounceFact;
SettingsFact* _defaultMissionItemAltitudeFact;
SettingsFact* _missionAutoLoadDirFact;
SettingsFact* _promptFlightTelemetrySave;
SettingsFact* _promptFlightTelemetrySaveNotArmed;
SettingsFact* _audioMuted;
SettingsFact* _promptFlightTelemetrySaveFact;
SettingsFact* _promptFlightTelemetrySaveNotArmedFact;
SettingsFact* _audioMutedFact;
SettingsFact* _virtualJoystickFact;
SettingsFact* _appFontPointSizeFact;
SettingsFact* _indoorPaletteFact;
};
#endif
......@@ -82,5 +82,30 @@
"longDescription": "If this option is enabled all audio output will be muted.",
"type": "bool",
"defaultValue": false
},
{
"name": "VirtualTabletJoystick",
"shortDescription": "Show virtual joystick",
"longDescription": "If this option is enabled the virtual joystick will be shown on the Fly view.",
"type": "bool",
"defaultValue": false
},
{
"name": "BaseDeviceFontPointSize",
"shortDescription": "QGroundControl font size",
"longDescription": "The point size for the default font used in QGroundControl.",
"type": "uint32",
"units": "pt",
"min": 6,
"max": 48,
"defaultValue": 0
},
{
"name": "StyleIsDark",
"shortDescription": "QGroundControl color scheme",
"longDescription": "The color scheme for the QGroundControl user interface.",
"type": "uint32",
"enumStrings": "Indoor,Outdoor",
"enumValues": "1,0"
}
]
......@@ -233,8 +233,8 @@ Rectangle {
// I don't know why this does not work
Connections {
target: QGroundControl
onBaseFontPointSizeChanged: buttonColumn.reflowWidths()
target: QGroundControl.settingsManager.appSettings.appFontPointSize
onValueChanged: buttonColumn.reflowWidths()
}
function reflowWidths() {
......
#include "ChartPlot.h"
#include "QGCApplication.h"
#include "SettingsManager.h"
const QColor ChartPlot::baseColors[numColors] = {
QColor(242, 255, 128),
......@@ -44,7 +45,7 @@ ChartPlot::ChartPlot(QWidget* parent):
_colors.append(baseColors[i]);
}
// Now that all objects have been initialized, color everything.
styleChanged(qgcApp()->styleIsDark());
styleChanged(qgcApp()->toolbox()->settingsManager()->appSettings()->indoorPalette()->rawValue().toBool());
}
ChartPlot::~ChartPlot()
......
......@@ -40,6 +40,7 @@
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "QGCApplication.h"
#include "SettingsManager.h"
LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent),
sysid(systemid),
......@@ -116,7 +117,7 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent
createLayout();
// And make sure we're listening for future style changes
connect(qgcApp(), &QGCApplication::styleChanged, this, &LinechartWidget::recolor);
connect(qgcApp()->toolbox()->settingsManager()->appSettings()->indoorPalette(), &Fact::rawValueChanged, this, &LinechartWidget::recolor);
updateTimer->setInterval(updateInterval);
connect(updateTimer, &QTimer::timeout, this, &LinechartWidget::refresh);
......@@ -637,7 +638,7 @@ void LinechartWidget::removeCurve(QString curve)
void LinechartWidget::recolor()
{
activePlot->styleChanged(qgcApp()->styleIsDark());
activePlot->styleChanged(qgcApp()->toolbox()->settingsManager()->appSettings()->indoorPalette()->rawValue().toBool());
foreach (const QString &key, colorIcons.keys())
{
QWidget* colorIcon = colorIcons.value(key, 0);
......
......@@ -34,6 +34,7 @@ QGCView {
property Fact _percentRemainingAnnounce: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce
property Fact _autoLoadDir: QGroundControl.settingsManager.appSettings.missionAutoLoadDir
property Fact _appFontPointSize: QGroundControl.settingsManager.appSettings.appFontPointSize
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 15
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30
......@@ -135,11 +136,11 @@ QGCView {
//-----------------------------------------------------------------
//-- Base UI Font Point Size
Row {
visible: QGroundControl.corePlugin.options.defaultFontPointSize < 1.0
visible: _appFontPointSize.visible
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
id: baseFontLabel
text: qsTr("Base UI font size:")
text: qsTr("Font size:")
anchors.verticalCenter: parent.verticalCenter
}
Row {
......@@ -152,32 +153,23 @@ QGCView {
height: baseFontEdit.height
text: "-"
onClicked: {
if(ScreenTools.defaultFontPointSize > 6) {
QGroundControl.baseFontPointSize = QGroundControl.baseFontPointSize - 1
if (_appFontPointSize.value > _appFontPointSize.min) {
_appFontPointSize.value = _appFontPointSize.value - 1
}
}
}
QGCTextField {
id: baseFontEdit
width: _editFieldWidth - (decrementButton.width * 2) - (baseFontRow.spacing * 2)
text: QGroundControl.baseFontPointSize
showUnits: true
unitsLabel: "pt"
maximumLength: 6
validator: DoubleValidator {bottom: 6.0; top: 48.0; decimals: 2;}
onEditingFinished: {
var point = parseFloat(text)
if(point >= 6.0 && point <= 48.0)
QGroundControl.baseFontPointSize = point;
}
FactTextField {
id: baseFontEdit
width: _editFieldWidth - (decrementButton.width * 2) - (baseFontRow.spacing * 2)
fact: QGroundControl.settingsManager.appSettings.appFontPointSize
}
QGCButton {
width: height
height: baseFontEdit.height
text: "+"
onClicked: {
if(ScreenTools.defaultFontPointSize < 49) {
QGroundControl.baseFontPointSize = QGroundControl.baseFontPointSize + 1
if (_appFontPointSize.value < _appFontPointSize.max) {
_appFontPointSize.value = _appFontPointSize.value + 1
}
}
}
......@@ -191,45 +183,47 @@ QGCView {
//-- Palette Styles
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
QGCLabel {
anchors.baseline: paletteCombo.baseline
text: qsTr("UI Style:")
text: qsTr("Color scheme:")
width: _labelWidth
}
QGCComboBox {
id: paletteCombo
width: _editFieldWidth
model: [ qsTr("Indoor"), qsTr("Outdoor") ]
currentIndex: QGroundControl.isDarkStyle ? 0 : 1
onActivated: {
if (index != -1) {
currentIndex = index
QGroundControl.isDarkStyle = index === 0 ? true : false
}
}
FactComboBox {
id: paletteCombo
width: _editFieldWidth
fact: QGroundControl.settingsManager.appSettings.indoorPalette
indexModel: false
}
}
//-----------------------------------------------------------------
//-- Audio preferences
FactCheckBox {
text: qsTr("Mute all audio output")
fact: QGroundControl.settingsManager.appSettings.audioMuted
text: qsTr("Mute all audio output")
fact: _audioMuted
visible: _audioMuted.visible
property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
}
//-----------------------------------------------------------------
//-- Prompt Save Log
FactCheckBox {
id: promptSaveLog
text: qsTr("Prompt to save Flight Data Log after each flight")
fact: QGroundControl.settingsManager.appSettings.promptFlightTelemetrySave
visible: !ScreenTools.isMobile
fact: _promptFlightTelemetrySave
visible: !ScreenTools.isMobile && _promptFlightTelemetrySave.visible
property Fact _promptFlightTelemetrySave: QGroundControl.settingsManager.appSettings.promptFlightTelemetrySave
}
//-----------------------------------------------------------------
//-- Prompt Save even if not armed
FactCheckBox {
text: qsTr("Prompt to save Flight Data Log even if vehicle was not armed")
fact: QGroundControl.settingsManager.appSettings.promptFlightTelemetrySaveNotArmed
visible: !ScreenTools.isMobile
fact: _promptFlightTelemetrySaveNotArmed
visible: !ScreenTools.isMobile && _promptFlightTelemetrySaveNotArmed.visible
enabled: promptSaveLog.checked
property Fact _promptFlightTelemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.promptFlightTelemetrySaveNotArmed
}
//-----------------------------------------------------------------
//-- Clear settings
......@@ -283,11 +277,12 @@ QGCView {
}
//-----------------------------------------------------------------
//-- Virtual joystick settings
QGCCheckBox {
FactCheckBox {
text: qsTr("Virtual Joystick")
checked: QGroundControl.virtualTabletJoystick
onClicked: QGroundControl.virtualTabletJoystick = checked
visible: QGroundControl.corePlugin.options.enableVirtualJoystick
visible: _virtualJoystick.visible
fact: _virtualJoystick
property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
}
//-----------------------------------------------------------------
//-- Default mission item altitude
......
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