diff --git a/qgcresources.qrc b/qgcresources.qrc index bc66e1716d914aae70eb184758fb52839ada7550..cb4c509dbb245250d3bd18ff06a5a576a1f5b870 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -46,6 +46,7 @@ src/AutoPilotPlugins/Common/Images/HelicopterCoaxial.svg src/AutoPilotPlugins/Common/Images/wifi.svg src/QmlControls/arrow-down.png + src/QmlControls/check.png src/VehicleSetup/FirmwareUpgradeIcon.png src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png src/AutoPilotPlugins/PX4/Images/CameraTrigger.svg @@ -160,6 +161,7 @@ src/FirmwarePlugin/APM/APMBrandImage.png src/FirmwarePlugin/APM/APMBrandImageSub.png src/FirmwarePlugin/PX4/PX4BrandImage.png + src/FirmwarePlugin/PX4/PX4BrandImage.png resources/Antenna_RC.svg diff --git a/src/QmlControls/QGCButton.qml b/src/QmlControls/QGCButton.qml index 5238f025a5776612d51e912c4a90ee29b33177e4..55fe10af6573b596b8fba91a6a76857a679613f9 100644 --- a/src/QmlControls/QGCButton.qml +++ b/src/QmlControls/QGCButton.qml @@ -22,7 +22,8 @@ Button { property int __lastGlobalMouseX: 0 property int __lastGlobalMouseY: 0 - property int __padding: Math.round(ScreenTools.defaultFontPixelHeight * 0.5) + property int _horizontalPadding: ScreenTools.defaultFontPixelWidth + property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight / 2) Connections { target: __behavior @@ -50,42 +51,26 @@ Button { style: ButtonStyle { /*! The padding between the background and the label components. */ padding { - top: __padding * 0.5 - left: __padding - right: control.menu !== null ? Math.round(ScreenTools.defaultFontPixelHeight) : __padding - bottom: __padding * 0.5 + top: _verticalPadding + bottom: _verticalPadding + left: _horizontalPadding + right: _horizontalPadding } /*! This defines the background of the button. */ - background: Item { - property bool down: control.pressed || (control.checkable && control.checked) - implicitWidth: Math.round(ScreenTools.defaultFontPixelWidth * 4.5) - implicitHeight: ScreenTools.isMobile ? Math.max(25, Math.round(ScreenTools.defaultFontPixelHeight * 2)) : Math.max(25, Math.round(ScreenTools.defaultFontPixelHeight * 1.2)) - - Rectangle { - anchors.fill: parent - border.width: _showBorder ? 1: 0 - border.color: _qgcPal.buttonText - //radius: 3 - color: _showHighlight ? - control._qgcPal.buttonHighlight : - (primary ? control._qgcPal.primaryButton : control._qgcPal.button) - } - - Image { - id: imageItem - visible: control.menu !== null - source: "/qmlimages/arrow-down.png" - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: __padding - opacity: control.enabled ? 0.6 : 0.5 - } + background: Rectangle { + implicitWidth: ScreenTools.implicitButtonWidth + implicitHeight: ScreenTools.implicitButtonHeight + border.width: _showBorder ? 1: 0 + border.color: _qgcPal.buttonText + color: _showHighlight ? + control._qgcPal.buttonHighlight : + (primary ? control._qgcPal.primaryButton : control._qgcPal.button) } /*! This defines the label of the button. */ label: Item { - implicitWidth: control.menu === null ? row.implicitWidth : row.implicitWidth + ScreenTools.defaultFontPixelWidth + implicitWidth: row.implicitWidth implicitHeight: row.implicitHeight baselineOffset: row.y + text.y + text.baselineOffset @@ -95,20 +80,20 @@ Button { spacing: ScreenTools.defaultFontPixelWidth * 0.25 Image { - source: control.iconSource + source: control.iconSource anchors.verticalCenter: parent.verticalCenter } Text { - id: text - antialiasing: true - text: control.text - font.pointSize: pointSize - font.family: ScreenTools.normalFontFamily + id: text anchors.verticalCenter: parent.verticalCenter - color: _showHighlight ? - control._qgcPal.buttonHighlightText : - (primary ? control._qgcPal.primaryButtonText : control._qgcPal.buttonText) + antialiasing: true + text: control.text + font.pointSize: pointSize + font.family: ScreenTools.normalFontFamily + color: _showHighlight ? + control._qgcPal.buttonHighlightText : + (primary ? control._qgcPal.primaryButtonText : control._qgcPal.buttonText) } } } diff --git a/src/QmlControls/QGCCheckBox.qml b/src/QmlControls/QGCCheckBox.qml index f57d521439e7aedee6728a65a832460c2b2b317f..7cf0c4bc64580dc41024076f1399b6fb9689bb2c 100644 --- a/src/QmlControls/QGCCheckBox.qml +++ b/src/QmlControls/QGCCheckBox.qml @@ -1,30 +1,32 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 -import QGroundControl.Palette 1.0 -import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.ScreenTools 1.0 CheckBox { property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } style: CheckBoxStyle { label: Item { - implicitWidth: text.implicitWidth + 2 + implicitWidth: text.implicitWidth + 2 implicitHeight: text.implicitHeight baselineOffset: text.baselineOffset + Rectangle { - anchors.fill: text - anchors.margins: -1 + anchors.margins: -1 anchors.leftMargin: -3 anchors.rightMargin: -3 - visible: control.activeFocus - height: 6 - radius: 3 - color: "#224f9fef" - border.color: "#47b" - opacity: 0.6 + anchors.fill: text + visible: control.activeFocus + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + opacity: 0.6 } + Text { id: text text: control.text @@ -34,6 +36,54 @@ CheckBox { color: control.__qgcPal.text anchors.verticalCenter: parent.verticalCenter } - } - } + } // label + + indicator: Item { + implicitWidth: ScreenTools.implicitCheckBoxWidth + implicitHeight: implicitWidth + + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: ScreenTools.defaultFontPixelHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + + Image { + source: "/qmlimages/check.png" + opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0 + anchors.centerIn: parent + anchors.verticalCenterOffset: 1 + Behavior on opacity {NumberAnimation {duration: 80}} + } + + Rectangle { + anchors.fill: parent + anchors.margins: Math.round(baserect.radius) + antialiasing: true + gradient: Gradient { + GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0} + GradientStop {color: "#555" ; position: 1} + } + radius: baserect.radius - 1 + anchors.centerIn: parent + anchors.alignWhenCentered: true + border.color: "#222" + Behavior on opacity {NumberAnimation {duration: 80}} + opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0 + } + } // indicator + } // style } diff --git a/src/QmlControls/QGCComboBox.qml b/src/QmlControls/QGCComboBox.qml index 9950708b4bca2c8efbd8cbea510649343ed5bc93..1a7402167bcdb7ac8cbbf33e2a2c4bfe5fe073f5 100644 --- a/src/QmlControls/QGCComboBox.qml +++ b/src/QmlControls/QGCComboBox.qml @@ -18,13 +18,12 @@ ComboBox { control._qgcPal.buttonText background: Item { - implicitWidth: Math.round(ScreenTools.defaultFontPixelWidth * 4.5) - implicitHeight: Math.round(ScreenTools.defaultFontPixelHeight * (ScreenTools.isMobile ? 2 : 1.2)) + implicitWidth: ScreenTools.implicitComboBoxWidth + implicitHeight: ScreenTools.implicitComboBoxHeight Rectangle { anchors.fill: parent color: _showHighlight ? control._qgcPal.buttonHighlight : control._qgcPal.button - //radius: 3 border.width: _showBorder ? 1: 0 border.color: control._qgcPal.buttonText } diff --git a/src/QmlControls/QGCTextField.qml b/src/QmlControls/QGCTextField.qml index 502e428be11c2cdc92659363de48d45a4db65da9..699a82c646310ed90d534f551d74be528ab379b4 100644 --- a/src/QmlControls/QGCTextField.qml +++ b/src/QmlControls/QGCTextField.qml @@ -27,7 +27,7 @@ TextField { textColor: qgcPal.textFieldText - implicitHeight: Math.round(ScreenTools.defaultFontPixelHeight * (ScreenTools.isMobile ? 2 : 1.2)) + implicitHeight: ScreenTools.implicitTextFieldHeight QGCLabel { id: unitsLabelWidthGenerator diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 0eb0c55939472aab244a2da89f8cb78d6619637f..0d2d2a27f1aff60e1feea92e8368c7c85770d166 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -60,6 +60,14 @@ Item { property bool isTinyScreen: (Screen.width / Screen.pixelDensity) < 120 // 120mm property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example + // The implicit heights/widths for our custom control set + property real implicitButtonWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0)) + property real implicitButtonHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6)) + property real implicitCheckBoxWidth: Math.round(defaultFontPixelHeight * (isMobile ? 1.5 : 1.0)) + property real implicitTextFieldHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6)) + property real implicitComboBoxHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6)) + property real implicitComboBoxWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0)) + readonly property string normalFontFamily: "opensans" readonly property string demiboldFontFamily: "opensans-demibold" diff --git a/src/QmlControls/check.png b/src/QmlControls/check.png new file mode 100644 index 0000000000000000000000000000000000000000..ad1df9572e99cebd676eaa8db86a66593b2f5345 Binary files /dev/null and b/src/QmlControls/check.png differ