Commit ec1e8c2f authored by Gus Grubba's avatar Gus Grubba

Merge pull request #2151 from dogmaphobic/randomFixes

Scaling UI Elements
parents 683a913e 7ceb6c1a
...@@ -80,7 +80,7 @@ Item { ...@@ -80,7 +80,7 @@ Item {
property var _flightVideo: null property var _flightVideo: null
property var _savedZoomLevel: 0 property var _savedZoomLevel: 0
property real _pipSize: ScreenTools.isAndroid ? ScreenTools.defaultFontPixelSize * (8) : ScreenTools.defaultFontPixelSize * (9) property real _pipSize: mainWindow.width * 0.2
FlightDisplayViewController { id: _controller } FlightDisplayViewController { id: _controller }
...@@ -132,16 +132,13 @@ Item { ...@@ -132,16 +132,13 @@ Item {
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: _pipSize width: _pipSize
width: _pipSize * (16/9) height: _pipSize * (9/16)
color: "#000010" color: "#000010"
border.width: 4
radius: 4
border.color: _isBackgroundDark ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75) border.color: _isBackgroundDark ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
Loader { Loader {
id: pipLoader id: pipLoader
anchors.fill: parent anchors.fill: parent
anchors.margins: 2
onLoaded: { onLoaded: {
if(_mainIsMap) { if(_mainIsMap) {
_flightVideo = item _flightVideo = item
......
...@@ -35,8 +35,6 @@ import QGroundControl.Palette 1.0 ...@@ -35,8 +35,6 @@ import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0 import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0 import QGroundControl.FlightMap 1.0
/// This component is used to delay load the items which are direct children of the
/// FlightDisplayViewControl.
Item { Item {
readonly property string _InstrumentVisibleKey: "IsInstrumentPanelVisible" readonly property string _InstrumentVisibleKey: "IsInstrumentPanelVisible"
...@@ -84,7 +82,7 @@ Item { ...@@ -84,7 +82,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: _isInstrumentVisible visible: _isInstrumentVisible
size: ScreenTools.defaultFontPixelSize * (9) size: mainWindow.width * 0.15
active: _activeVehicle != null active: _activeVehicle != null
heading: _heading heading: _heading
rollAngle: _roll rollAngle: _roll
...@@ -124,7 +122,7 @@ Item { ...@@ -124,7 +122,7 @@ Item {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
_isInstrumentVisible = true _isInstrumentVisible = true
QGroundControl.saveBoolGlobalSetting(_InstrumentVisibleKey, false) QGroundControl.saveBoolGlobalSetting(_InstrumentVisibleKey, true)
} }
} }
} }
...@@ -213,7 +211,7 @@ Item { ...@@ -213,7 +211,7 @@ Item {
//-- Zoom Map In //-- Zoom Map In
RoundButton { RoundButton {
id: mapZoomPlus id: mapZoomPlus
visible: _mainIsMap visible: _mainIsMap && !ScreenTools.isTinyScreen
buttonImage: "/qmlimages/ZoomPlus.svg" buttonImage: "/qmlimages/ZoomPlus.svg"
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
...@@ -227,7 +225,7 @@ Item { ...@@ -227,7 +225,7 @@ Item {
//-- Zoom Map Out //-- Zoom Map Out
RoundButton { RoundButton {
id: mapZoomMinus id: mapZoomMinus
visible: _mainIsMap visible: _mainIsMap && !ScreenTools.isTinyScreen
buttonImage: "/qmlimages/ZoomMinus.svg" buttonImage: "/qmlimages/ZoomMinus.svg"
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
......
...@@ -90,7 +90,7 @@ Item { ...@@ -90,7 +90,7 @@ Item {
QGCPitchIndicator { QGCPitchIndicator {
id: pitchWidget id: pitchWidget
visible: root.showPitch visible: root.showPitch
size: root.size * 0.65 size: root.size * 0.5
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
pitchAngle: _pitchAngle pitchAngle: _pitchAngle
rollAngle: _rollAngle rollAngle: _rollAngle
......
...@@ -38,9 +38,11 @@ Item { ...@@ -38,9 +38,11 @@ Item {
property bool active: false ///< true: actively connected to data provider, false: show inactive control property bool active: false ///< true: actively connected to data provider, false: show inactive control
property real heading: 0 property real heading: 0
property real size: ScreenTools.defaultFontPixelSize * (10) property real size: _defaultSize
property int _fontSize: ScreenTools.defaultFontPixelSize * 0.8 property real _defaultSize: ScreenTools.defaultFontPixelSize * (10)
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property int _fontSize: ScreenTools.defaultFontPixelSize * _sizeRatio
width: size width: size
height: size height: size
......
...@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project
/** /**
* @file * @file
* @brief QGC Compass Widget * @brief QGC Fly View Widgets
* @author Gus Grubba <mavlink@grubba.com> * @author Gus Grubba <mavlink@grubba.com>
*/ */
...@@ -44,19 +44,23 @@ Item { ...@@ -44,19 +44,23 @@ Item {
property real altitude: 0 property real altitude: 0
property real groundSpeed: 0 property real groundSpeed: 0
property real airSpeed: 0 property real airSpeed: 0
property real size: ScreenTools.defaultFontPixelSize * (10) property real size: _defaultSize
property bool isSatellite: false property bool isSatellite: false
property bool active: false property bool active: false
property bool _isVisible: true property real _defaultSize: ScreenTools.defaultFontPixelSize * (9)
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property real _bigFontSize: ScreenTools.defaultFontPixelSize * 2.5 * _sizeRatio
property real _normalFontSize:ScreenTools.defaultFontPixelSize * 1.5 * _sizeRatio
property real _labelFontSize: ScreenTools.defaultFontPixelSize * 0.75 * _sizeRatio
//-- Instrument Panel //-- Instrument Panel
Rectangle { Rectangle {
id: instrumentPanel id: instrumentPanel
height: instruments.height + ScreenTools.defaultFontPixelSize height: instruments.height + (size * 0.05)
width: root.size width: root.size
radius: root.size / 2 radius: root.size / 2
visible: _isVisible
color: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75) color: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -68,7 +72,7 @@ Item { ...@@ -68,7 +72,7 @@ Item {
//-- Attitude Indicator //-- Attitude Indicator
QGCAttitudeWidget { QGCAttitudeWidget {
id: attitude id: attitude
size: parent.width * 0.9 size: parent.width * 0.95
active: root.active active: root.active
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
...@@ -80,16 +84,16 @@ Item { ...@@ -80,16 +84,16 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
QGCLabel { QGCLabel {
text: "Altitude" text: "Altitude (m)"
font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 font.pixelSize: _labelFontSize
width: parent.width width: parent.width
height: ScreenTools.defaultFontPixelHeight * 0.5 height: _labelFontSize
color: isSatellite ? "black" : "white" color: isSatellite ? "black" : "white"
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
} }
QGCLabel { QGCLabel {
text: altitude < 10000 ? altitude.toFixed(1) : altitude.toFixed(0) text: altitude < 10000 ? altitude.toFixed(1) : altitude.toFixed(0)
font.pixelSize: ScreenTools.defaultFontPixelSize * 2.5 font.pixelSize: _bigFontSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
width: parent.width width: parent.width
color: isSatellite ? "black" : "white" color: isSatellite ? "black" : "white"
...@@ -101,25 +105,25 @@ Item { ...@@ -101,25 +105,25 @@ Item {
width: parent.width * 0.9 width: parent.width * 0.9
color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: airSpeed <= 0 visible: airSpeed <= 0 && !ScreenTools.isTinyScreen
} }
QGCLabel { QGCLabel {
text: "Ground Speed" text: "Ground Speed (km/h)"
font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 font.pixelSize: _labelFontSize
width: parent.width width: parent.width
height: ScreenTools.defaultFontPixelHeight * 0.75 height: _labelFontSize
color: isSatellite ? "black" : "white" color: isSatellite ? "black" : "white"
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
visible: airSpeed <= 0 visible: airSpeed <= 0 && !ScreenTools.isTinyScreen
} }
QGCLabel { QGCLabel {
text: groundSpeed.toFixed(1) text: (groundSpeed * 3.6).toFixed(1)
font.pixelSize: ScreenTools.defaultFontPixelSize * 1.25 font.pixelSize: _normalFontSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
width: parent.width width: parent.width
color: isSatellite ? "black" : "white" color: isSatellite ? "black" : "white"
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
visible: airSpeed <= 0 visible: airSpeed <= 0 && !ScreenTools.isTinyScreen
} }
//-- Air Speed //-- Air Speed
Rectangle { Rectangle {
...@@ -127,24 +131,24 @@ Item { ...@@ -127,24 +131,24 @@ Item {
width: parent.width * 0.9 width: parent.width * 0.9
color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: airSpeed > 0 visible: airSpeed > 0 && !ScreenTools.isTinyScreen
} }
QGCLabel { QGCLabel {
text: "Air Speed" text: "Air Speed (km/h)"
font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 font.pixelSize: _labelFontSize
width: parent.width width: parent.width
height: ScreenTools.defaultFontPixelHeight * 0.75 height: _labelFontSize
color: isSatellite ? "black" : "white" color: isSatellite ? "black" : "white"
visible: airSpeed > 0 visible: airSpeed > 0 && !ScreenTools.isTinyScreen
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
} }
QGCLabel { QGCLabel {
text: airSpeed.toFixed(1) text: (airSpeed * 3.6).toFixed(1)
font.pixelSize: ScreenTools.defaultFontPixelSize * 1.25 font.pixelSize: _normalFontSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
width: parent.width width: parent.width
color: isSatellite ? "black" : "white" color: isSatellite ? "black" : "white"
visible: airSpeed > 0 visible: airSpeed > 0 && !ScreenTools.isTinyScreen
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
} }
//-- Compass //-- Compass
...@@ -156,7 +160,7 @@ Item { ...@@ -156,7 +160,7 @@ Item {
} }
QGCCompassWidget { QGCCompassWidget {
id: compass id: compass
size: parent.width * 0.9 size: parent.width * 0.95
active: root.active active: root.active
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
......
...@@ -44,9 +44,8 @@ Rectangle { ...@@ -44,9 +44,8 @@ Rectangle {
property real _defaultSize: ScreenTools.isAndroid ? 300 : 100 property real _defaultSize: ScreenTools.isAndroid ? 300 : 100
height: size * 0.9 height: size
width: size width: size
radius: ScreenTools.defaultFontPixelSize * (0.66)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
clip: true clip: true
......
...@@ -10,7 +10,7 @@ Item { ...@@ -10,7 +10,7 @@ Item {
signal clicked() signal clicked()
property alias buttonImage: button.source property alias buttonImage: button.source
property real radius: (ScreenTools.defaultFontPixelHeight * 3) / 2 property real radius: ScreenTools.defaultFontPixelHeight * 1.5
property int dropDirection: dropDown property int dropDirection: dropDown
property alias dropDownComponent: dropDownLoader.sourceComponent property alias dropDownComponent: dropDownLoader.sourceComponent
property real viewportMargins: 0 property real viewportMargins: 0
...@@ -159,7 +159,7 @@ Item { ...@@ -159,7 +159,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: width / 2 radius: width / 2
border.width: 2 border.width: ScreenTools.defaultFontPixelHeight * 0.0625
border.color: "white" border.color: "white"
color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton
......
...@@ -10,7 +10,7 @@ Item { ...@@ -10,7 +10,7 @@ Item {
signal clicked() signal clicked()
property alias buttonImage: button.source property alias buttonImage: button.source
property real radius: (ScreenTools.defaultFontPixelHeight * 3) / 2 property real radius: ScreenTools.defaultFontPixelHeight * 1.5
width: radius * 2 width: radius * 2
height: radius * 2 height: radius * 2
...@@ -29,7 +29,7 @@ Item { ...@@ -29,7 +29,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: width / 2 radius: width / 2
border.width: 2 border.width: ScreenTools.defaultFontPixelHeight * 0.0625
border.color: "white" border.color: "white"
color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton
......
pragma Singleton pragma Singleton
import QtQuick 2.2 import QtQuick 2.4
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Window 2.2
import QGroundControl.ScreenToolsController 1.0 import QGroundControl.ScreenToolsController 1.0
...@@ -22,6 +23,7 @@ Item { ...@@ -22,6 +23,7 @@ Item {
property bool isiOS: ScreenToolsController.isiOS property bool isiOS: ScreenToolsController.isiOS
property bool isMobile: ScreenToolsController.isMobile property bool isMobile: ScreenToolsController.isMobile
property bool isDebug: ScreenToolsController.isDebug property bool isDebug: ScreenToolsController.isDebug
property bool isTinyScreen: (Screen.width / Screen.pixelDensity) < 120 // 120mm
function mouseX() { function mouseX() {
return ScreenToolsController.mouseX() return ScreenToolsController.mouseX()
...@@ -35,7 +37,7 @@ Item { ...@@ -35,7 +37,7 @@ Item {
id: _textMeasure id: _textMeasure
text: "X" text: "X"
property real fontWidth: contentWidth * (ScreenToolsController.testHighDPI ? 2 : 1) property real fontWidth: contentWidth * (ScreenToolsController.testHighDPI ? 2 : 1)
property real fontHeight: contentHeight * (ScreenToolsController.testHighDPI ? 2 : 1) property real fontHeight: contentHeight * (ScreenToolsController.testHighDPI ? 2 : 1)
} }
......
...@@ -32,7 +32,7 @@ import QGroundControl.ScreenTools 1.0 ...@@ -32,7 +32,7 @@ import QGroundControl.ScreenTools 1.0
/// Qml for MainWindow /// Qml for MainWindow
Item { Item {
id: _root id: mainWindow
property var _toolbar: toolbarLoader.item property var _toolbar: toolbarLoader.item
...@@ -121,7 +121,7 @@ Item { ...@@ -121,7 +121,7 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: false visible: false
property var tabletPosition: _root.tabletPosition property var tabletPosition: mainWindow.tabletPosition
} }
Loader { Loader {
...@@ -132,6 +132,6 @@ Item { ...@@ -132,6 +132,6 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: false visible: false
property var tabletPosition: _root.tabletPosition property var tabletPosition: mainWindow.tabletPosition
} }
} }
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