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

Merge pull request #7149 from mavlink/FontReboot

Fix startup crash on initial font change signalling qgc reboot required
parents 6c8477f8 00ea831b
...@@ -27,6 +27,7 @@ Fact::Fact(QObject* parent) ...@@ -27,6 +27,7 @@ Fact::Fact(QObject* parent)
, _sendValueChangedSignals (true) , _sendValueChangedSignals (true)
, _deferredValueChangeSignal(false) , _deferredValueChangeSignal(false)
, _valueSliderModel (nullptr) , _valueSliderModel (nullptr)
, _ignoreQGCRebootRequired (false)
{ {
FactMetaData* metaData = new FactMetaData(_type, this); FactMetaData* metaData = new FactMetaData(_type, this);
setMetaData(metaData); setMetaData(metaData);
...@@ -44,6 +45,7 @@ Fact::Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObjec ...@@ -44,6 +45,7 @@ Fact::Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObjec
, _sendValueChangedSignals (true) , _sendValueChangedSignals (true)
, _deferredValueChangeSignal(false) , _deferredValueChangeSignal(false)
, _valueSliderModel (nullptr) , _valueSliderModel (nullptr)
, _ignoreQGCRebootRequired (false)
{ {
FactMetaData* metaData = new FactMetaData(_type, this); FactMetaData* metaData = new FactMetaData(_type, this);
setMetaData(metaData); setMetaData(metaData);
...@@ -61,6 +63,7 @@ Fact::Fact(const QString& settingsGroup, FactMetaData* metaData, QObject* parent ...@@ -61,6 +63,7 @@ Fact::Fact(const QString& settingsGroup, FactMetaData* metaData, QObject* parent
, _sendValueChangedSignals (true) , _sendValueChangedSignals (true)
, _deferredValueChangeSignal(false) , _deferredValueChangeSignal(false)
, _valueSliderModel (nullptr) , _valueSliderModel (nullptr)
, _ignoreQGCRebootRequired (false)
{ {
qgcApp()->toolbox()->corePlugin()->adjustSettingMetaData(settingsGroup, *metaData); qgcApp()->toolbox()->corePlugin()->adjustSettingMetaData(settingsGroup, *metaData);
setMetaData(metaData, true /* setDefaultFromMetaData */); setMetaData(metaData, true /* setDefaultFromMetaData */);
...@@ -90,7 +93,8 @@ const Fact& Fact::operator=(const Fact& other) ...@@ -90,7 +93,8 @@ const Fact& Fact::operator=(const Fact& other)
_type = other._type; _type = other._type;
_sendValueChangedSignals = other._sendValueChangedSignals; _sendValueChangedSignals = other._sendValueChangedSignals;
_deferredValueChangeSignal = other._deferredValueChangeSignal; _deferredValueChangeSignal = other._deferredValueChangeSignal;
_valueSliderModel = nullptr; _valueSliderModel = nullptr;
_ignoreQGCRebootRequired = other._ignoreQGCRebootRequired;
if (_metaData && other._metaData) { if (_metaData && other._metaData) {
*_metaData = *other._metaData; *_metaData = *other._metaData;
} else { } else {
...@@ -615,7 +619,9 @@ bool Fact::vehicleRebootRequired(void) const ...@@ -615,7 +619,9 @@ bool Fact::vehicleRebootRequired(void) const
bool Fact::qgcRebootRequired(void) const bool Fact::qgcRebootRequired(void) const
{ {
if (_metaData) { if (_ignoreQGCRebootRequired) {
return false;
} else if (_metaData) {
return _metaData->qgcRebootRequired(); return _metaData->qgcRebootRequired();
} else { } else {
qWarning() << kMissingMetadata << name(); qWarning() << kMissingMetadata << name();
...@@ -743,3 +749,8 @@ void Fact::_checkForRebootMessaging(void) ...@@ -743,3 +749,8 @@ void Fact::_checkForRebootMessaging(void)
} }
} }
} }
void Fact::_setIgnoreQGCRebootRequired(bool ignore)
{
_ignoreQGCRebootRequired = ignore;
}
...@@ -129,6 +129,10 @@ public: ...@@ -129,6 +129,10 @@ public:
bool writeOnly (void) const; bool writeOnly (void) const;
bool volatileValue (void) const; bool volatileValue (void) const;
// Internal hack to allow changes to fact which do not signal reboot. Currently used by font point size
// code in ScreenTools.qml to set initial sizing at first boot.
Q_INVOKABLE void _setIgnoreQGCRebootRequired(bool ignore);
Q_INVOKABLE FactValueSliderListModel* valueSliderModel(void); Q_INVOKABLE FactValueSliderListModel* valueSliderModel(void);
/// Returns the values as a string with full 18 digit precision if float/double. /// Returns the values as a string with full 18 digit precision if float/double.
...@@ -208,6 +212,7 @@ protected: ...@@ -208,6 +212,7 @@ protected:
bool _sendValueChangedSignals; bool _sendValueChangedSignals;
bool _deferredValueChangeSignal; bool _deferredValueChangeSignal;
FactValueSliderListModel* _valueSliderModel; FactValueSliderListModel* _valueSliderModel;
bool _ignoreQGCRebootRequired;
}; };
#endif #endif
...@@ -181,7 +181,9 @@ Item { ...@@ -181,7 +181,9 @@ Item {
} else { } else {
baseSize = _defaultFont.font.pointSize; baseSize = _defaultFont.font.pointSize;
} }
_appFontPointSizeFact._setIgnoreQGCRebootRequired(true)
_appFontPointSizeFact.value = baseSize _appFontPointSizeFact.value = baseSize
_appFontPointSizeFact._setIgnoreQGCRebootRequired(false)
//-- Release build doesn't get signal //-- Release build doesn't get signal
if(!ScreenToolsController.isDebug) if(!ScreenToolsController.isDebug)
_screenTools._setBasePointSize(baseSize); _screenTools._setBasePointSize(baseSize);
......
...@@ -504,7 +504,7 @@ void MainWindow::_storeVisibleWidgetsSettings(void) ...@@ -504,7 +504,7 @@ void MainWindow::_storeVisibleWidgetsSettings(void)
QObject* MainWindow::rootQmlObject(void) QObject* MainWindow::rootQmlObject(void)
{ {
return _mainQmlWidgetHolder->getRootObject(); return _mainQmlWidgetHolder ? _mainQmlWidgetHolder->getRootObject() : nullptr;
} }
void MainWindow::_showAdvancedUIChanged(bool advanced) void MainWindow::_showAdvancedUIChanged(bool advanced)
......
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