From a241a1b23006decba3eed2125182a93e8de75e6d Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Mon, 30 Jan 2017 20:33:26 -0500 Subject: [PATCH] Allow plugin to define default font size, toolbar height and option to display/hide plan view selector. --- src/MissionEditor/MissionEditor.qml | 3 ++- src/QmlControls/ScreenTools.qml | 8 ++++++-- src/api/QGCOptions.h | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index e71b23026..f2eee50d5 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -554,6 +554,7 @@ QGCView { anchors.leftMargin: parent.width - _rightPanelWidth anchors.left: parent.left spacing: _horizontalMargin + visible: QGroundControl.corePlugin.options.enablePlanViewSelector readonly property real _buttonRadius: ScreenTools.defaultFontPixelHeight * 0.75 @@ -615,7 +616,7 @@ QGCView { Item { id: missionItemEditor anchors.topMargin: _margin - anchors.top: planElementSelectorRow.bottom + anchors.top: planElementSelectorRow.visible ? planElementSelectorRow.bottom : planElementSelectorRow.top anchors.bottom: parent.bottom anchors.right: parent.right width: _rightPanelWidth diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 84bb0a099..964559273 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -47,7 +47,7 @@ Item { property real largeFontPointSize: 10 property real availableHeight: 0 - property real toolbarHeight: defaultFontPixelHeight * 3 + property real toolbarHeight: 0 readonly property real smallFontPointRatio: 0.75 readonly property real mediumFontPointRatio: 1.25 @@ -93,6 +93,7 @@ Item { smallFontPointSize = defaultFontPointSize * _screenTools.smallFontPointRatio mediumFontPointSize = defaultFontPointSize * _screenTools.mediumFontPointRatio largeFontPointSize = defaultFontPointSize * _screenTools.largeFontPointRatio + toolbarHeight = defaultFontPixelHeight * 3 * QGroundControl.corePlugin.options.toolbarHeightMultiplier } Text { @@ -107,7 +108,10 @@ Item { property real fontWidth: contentWidth property real fontHeight: contentHeight Component.onCompleted: { - var baseSize = QGroundControl.baseFontPointSize; + var baseSize = QGroundControl.corePlugin.options.defaultFontPointSize + if(baseSize == 0.0) { + baseSize = QGroundControl.baseFontPointSize; + } //-- If this is the first time (not saved in settings) if(baseSize < 6 || baseSize > 48) { //-- Init base size base on the platform diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index e1e913512..1845d3abb 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -29,6 +29,9 @@ public: Q_PROPERTY(bool definesVideo READ definesVideo CONSTANT) Q_PROPERTY(uint16_t videoUDPPort READ videoUDPPort CONSTANT) Q_PROPERTY(QString videoRSTPUrl READ videoRSTPUrl CONSTANT) + Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT) + Q_PROPERTY(double defaultFontPointSize READ defaultFontPointSize CONSTANT) + Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT) //! Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)? /*! @@ -65,4 +68,19 @@ public: @return RTSP url to use. Return "" to disable RTSP. */ virtual QString videoRSTPUrl () { return QString(); } + //! Main ToolBar Multiplier. + /*! + @return Factor to use when computing toolbar height + */ + virtual double toolbarHeightMultiplier () { return 1.0; } + //! Application wide default font point size + /*! + @return Font size or 0.0 to use computed size. + */ + virtual double defaultFontPointSize () { return 0.0; } + //! Enable Plan View Selector (Mission, Fence or Rally) + /*! + @return True or false + */ + virtual bool enablePlanViewSelector () { return true; } }; -- 2.22.0