From 9266b1b2a605f6a377ca57894b27e2c384927c04 Mon Sep 17 00:00:00 2001 From: dogmaphobic Date: Mon, 2 May 2016 01:02:08 -0400 Subject: [PATCH] Lots of UI tweaks. --- .../Common/ESP8266Component.qml | 20 ++++++++--------- src/AutoPilotPlugins/Common/Images/APMode.svg | 21 +++++++++--------- .../Common/Images/StationMode.svg | 22 ++++++++++--------- src/AutoPilotPlugins/PX4/CameraComponent.qml | 4 ++-- .../PX4/CameraComponentSummary.qml | 2 +- .../PX4/PX4AutoPilotPlugin.cc | 9 +++++--- src/QmlControls/ParameterEditorDialog.qml | 4 ++++ src/QmlControls/ScreenTools.qml | 6 ++--- src/QmlControls/ScreenToolsController.cc | 2 +- src/QmlControls/SubMenuButton.qml | 2 +- src/VehicleSetup/SetupView.qml | 1 + src/VehicleSetup/VehicleSummary.qml | 11 +++++----- src/ui/MainWindowInner.qml | 4 ++++ 13 files changed, 61 insertions(+), 47 deletions(-) diff --git a/src/AutoPilotPlugins/Common/ESP8266Component.qml b/src/AutoPilotPlugins/Common/ESP8266Component.qml index 29521cdae..ec6775c40 100644 --- a/src/AutoPilotPlugins/Common/ESP8266Component.qml +++ b/src/AutoPilotPlugins/Common/ESP8266Component.qml @@ -41,10 +41,10 @@ QGCView { QGCPalette { id: palette; colorGroupEnabled: panel.enabled } property real _margins: ScreenTools.defaultFontPixelHeight - property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 18 - property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 18 - property real _labelWidth: ScreenTools.defaultFontPixelWidth * 10 - property real _statusWidth: ScreenTools.defaultFontPixelWidth * 5 + property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 22 + property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 20 + property real _labelWidth: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelWidth * 10 : ScreenTools.defaultFontPixelWidth * 12 + property real _statusWidth: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelWidth * 7 : ScreenTools.defaultFontPixelWidth * 8 readonly property string dialogTitle: qsTr("controller WiFi Bridge") property int stStatus: XMLHttpRequest.UNSENT @@ -139,19 +139,17 @@ QGCView { height: settingsRow.height + _margins * 2 Row { id: settingsRow - spacing: _margins + spacing: _margins * 4 anchors.centerIn: parent - Item { width: _margins * 0.5; height: 1; } QGCColoredImage { color: palette.text - height: ScreenTools.defaultFontPixelWidth * 10 width: ScreenTools.defaultFontPixelWidth * 12 + height: width * 1.45 mipmap: true fillMode: Image.PreserveAspectFit source: wifiMode ? (wifiMode.value === 0 ? "/qmlimages/APMode.svg" : "/qmlimages/StationMode.svg") : "/qmlimages/APMode.svg" anchors.verticalCenter: parent.verticalCenter } - Item { width: _margins * 0.5; height: 1; } Column { spacing: _margins * 0.5 anchors.verticalCenter: parent.verticalCenter @@ -458,7 +456,7 @@ QGCView { anchors.horizontalCenter: parent.horizontalCenter QGCButton { text: qsTr("Restore Defaults") - width: ScreenTools.defaultFontPixelWidth * 16 + width: _editFieldWidth onClicked: { controller.restoreDefaults() } @@ -466,7 +464,7 @@ QGCView { QGCButton { text: qsTr("Restart WiFi Bridge") enabled: !controller.busy - width: ScreenTools.defaultFontPixelWidth * 16 + width: _editFieldWidth onClicked: { rebootDialog.visible = true } @@ -488,7 +486,7 @@ QGCView { } QGCButton { text: qsTr("Reset Counters") - width: ScreenTools.defaultFontPixelWidth * 16 + width: _editFieldWidth onClicked: { stResetCounters = true; updateStatus() diff --git a/src/AutoPilotPlugins/Common/Images/APMode.svg b/src/AutoPilotPlugins/Common/Images/APMode.svg index 4de7b3ecb..959e6eb67 100644 --- a/src/AutoPilotPlugins/Common/Images/APMode.svg +++ b/src/AutoPilotPlugins/Common/Images/APMode.svg @@ -66,14 +66,15 @@ c0.453-3.364,4.404-5.613,8.845-5.613C34.276,13.527,38.228,15.777,38.681,19.141z"/> - + diff --git a/src/AutoPilotPlugins/Common/Images/StationMode.svg b/src/AutoPilotPlugins/Common/Images/StationMode.svg index 1322d7edc..9c10616fc 100644 --- a/src/AutoPilotPlugins/Common/Images/StationMode.svg +++ b/src/AutoPilotPlugins/Common/Images/StationMode.svg @@ -66,14 +66,16 @@ c0.453-3.364,4.404-5.613,8.845-5.613C34.276,13.527,38.228,15.777,38.681,19.141z"/> - + diff --git a/src/AutoPilotPlugins/PX4/CameraComponent.qml b/src/AutoPilotPlugins/PX4/CameraComponent.qml index 63c507505..45a25ddad 100644 --- a/src/AutoPilotPlugins/PX4/CameraComponent.qml +++ b/src/AutoPilotPlugins/PX4/CameraComponent.qml @@ -45,8 +45,8 @@ QGCView { QGCPalette { id: palette; colorGroupEnabled: enabled } property real _margins: ScreenTools.defaultFontPixelHeight - property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 22 - property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 18 + property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 20 + property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 20 property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE") property Fact _camTriggerPol: controller.getParameterFact(-1, "TRIG_POLARITY", false) // Don't bitch about missing as these only exist if trigger mode is enabled diff --git a/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml b/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml index 79aa77724..5064e9af4 100644 --- a/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml @@ -25,7 +25,7 @@ FactPanel { anchors.margins: 8 VehicleSummaryRow { - labelText: qsTr("Camera trigger mode:") + labelText: qsTr("Trigger mode:") valueText: _camTriggerMode ? _camTriggerMode.enumStringValue : "" } diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index ee5fad3d5..1bc95fbc8 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -126,9 +126,12 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) _tuningComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); - _cameraComponent = new CameraComponent(_vehicle, this); - _cameraComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent)); + //-- Is there support for cameras? + if(factExists(FactSystem::ParameterProvider, _vehicle->id(), "TRIG_MODE")) { + _cameraComponent = new CameraComponent(_vehicle, this); + _cameraComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent)); + } //-- Is there an ESP8266 Connected? if(factExists(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) { diff --git a/src/QmlControls/ParameterEditorDialog.qml b/src/QmlControls/ParameterEditorDialog.qml index 48d0a0831..4931f0e95 100644 --- a/src/QmlControls/ParameterEditorDialog.qml +++ b/src/QmlControls/ParameterEditorDialog.qml @@ -42,6 +42,8 @@ QGCViewDialog { property bool validate: false property string validateValue + property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 20 + ParameterEditorController { id: controller; factPanel: parent } QGCPalette { id: qgcPal; colorGroupEnabled: true } @@ -124,6 +126,7 @@ QGCViewDialog { QGCButton { anchors.baseline: valueField.baseline visible: fact.defaultValueAvailable + width: _editFieldWidth text: qsTr("Reset to default") onClicked: { @@ -244,6 +247,7 @@ QGCViewDialog { QGCButton { text: qsTr("Set RC to Param...") + width: _editFieldWidth visible: _advanced.checked && !validate && showRCToParam onClicked: controller.setRCToParam(fact.name) } diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 74f5481e1..4053ab462 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -13,10 +13,10 @@ Item { readonly property real defaultFontPixelSize: _textMeasure.fontHeight * ScreenToolsController.defaultFontPixelSizeRatio readonly property real defaultFontPixelHeight: defaultFontPixelSize - readonly property real defaultFontPixelWidth: _textMeasure.fontWidth - readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio + readonly property real defaultFontPixelWidth: _textMeasure.fontWidth * ScreenToolsController.defaultFontPixelSizeRatio + readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio readonly property real smallFontPixelHeight: smallFontPixelSize - readonly property real smallFontPixelWidth: defaultFontPixelWidth * ScreenToolsController.smallFontPixelSizeRatio + readonly property real smallFontPixelWidth: defaultFontPixelWidth * ScreenToolsController.smallFontPixelSizeRatio // To proportionally scale fonts diff --git a/src/QmlControls/ScreenToolsController.cc b/src/QmlControls/ScreenToolsController.cc index c226cd6f8..945482fd1 100644 --- a/src/QmlControls/ScreenToolsController.cc +++ b/src/QmlControls/ScreenToolsController.cc @@ -25,6 +25,7 @@ /// @author Gus Grubba #include "ScreenToolsController.h" +#include #ifdef Q_OS_WIN const double ScreenToolsController::_defaultFontPixelSizeRatio = 1.0; @@ -42,5 +43,4 @@ const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66; ScreenToolsController::ScreenToolsController() { - } diff --git a/src/QmlControls/SubMenuButton.qml b/src/QmlControls/SubMenuButton.qml index 4d4538b13..aad36aba1 100644 --- a/src/QmlControls/SubMenuButton.qml +++ b/src/QmlControls/SubMenuButton.qml @@ -14,7 +14,7 @@ Button { text: "Button" ///< Pass in your own button text checkable: true - implicitHeight: ScreenTools.defaultFontPixelHeight * 2.5 + implicitHeight: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight * 2.5 style: ButtonStyle { id: buttonStyle diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 35c85d91e..843ff3b97 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -225,6 +225,7 @@ Rectangle { anchors.bottom: parent.bottom contentHeight: buttonColumn.height flickableDirection: Flickable.VerticalFlick + clip: true Column { id: buttonColumn diff --git a/src/VehicleSetup/VehicleSummary.qml b/src/VehicleSetup/VehicleSummary.qml index 977370f63..34a0ee86e 100644 --- a/src/VehicleSetup/VehicleSummary.qml +++ b/src/VehicleSetup/VehicleSummary.qml @@ -37,7 +37,7 @@ Rectangle { anchors.fill: parent color: qgcPal.window - property real _minSummaryW: ScreenTools.defaultFontPixelWidth * 30 + property real _minSummaryW: ScreenTools.defaultFontPixelWidth * 40 property real _summaryBoxWidth: _minSummaryW property real _summaryBoxSpace: ScreenTools.defaultFontPixelWidth @@ -93,6 +93,7 @@ Rectangle { wrapMode: Text.WordWrap color: setupComplete ? qgcPal.text : qgcPal.warningText font.weight: Font.DemiBold + horizontalAlignment: Text.AlignHCenter text: setupComplete ? qsTr("Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component.") : qsTr("WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left.") @@ -112,7 +113,7 @@ Rectangle { width: _summaryBoxWidth height: ScreenTools.defaultFontPixelHeight * 13 color: qgcPal.window - visible: modelData.summaryQmlSource.toString() != "" + visible: modelData.summaryQmlSource.toString() !== "" readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 2 @@ -121,14 +122,14 @@ Rectangle { id: titleBar width: parent.width height: titleHeight - text: capitalizeWords(modelData.name) + text: capitalizeWords(modelData.name) // Setup indicator Rectangle { - anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 3 + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - width: ScreenTools.defaultFontPixelWidth + width: ScreenTools.defaultFontPixelWidth * 1.5 height: width radius: width / 2 color: modelData.setupComplete ? "#00d932" : "red" diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index ff27c97a2..acb231797 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -354,6 +354,8 @@ Item { color: Qt.rgba(0,0,0,0.8) visible: false radius: ScreenTools.defaultFontPixelHeight * 0.5 + border.color: qgcPal.text + border.width: 2 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: tbHeight + ScreenTools.defaultFontPixelHeight @@ -420,6 +422,8 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: ScreenTools.defaultFontPixelHeight + border.color: qgcPal.text + border.width: 2 MouseArea { // This MouseArea prevents the Map below it from getting Mouse events. Without this -- 2.22.0