Commit 82aa63fa authored by Don Gagne's avatar Don Gagne

Merge pull request #1659 from DonLakeFlyer/Fonts

[NOT FOR STABLE] Major font rework
parents 2b6e0c04 9c94295b
...@@ -267,7 +267,7 @@ HEADERS += \ ...@@ -267,7 +267,7 @@ HEADERS += \
src/QGCTemporaryFile.h \ src/QGCTemporaryFile.h \
src/QmlControls/MavManager.h \ src/QmlControls/MavManager.h \
src/QmlControls/ParameterEditorController.h \ src/QmlControls/ParameterEditorController.h \
src/QmlControls/ScreenTools.h \ src/QmlControls/ScreenToolsController.h \
src/uas/QGCMAVLinkUASFactory.h \ src/uas/QGCMAVLinkUASFactory.h \
src/uas/FileManager.h \ src/uas/FileManager.h \
src/uas/UAS.h \ src/uas/UAS.h \
...@@ -398,7 +398,7 @@ SOURCES += \ ...@@ -398,7 +398,7 @@ SOURCES += \
src/QGCTemporaryFile.cc \ src/QGCTemporaryFile.cc \
src/QmlControls/MavManager.cc \ src/QmlControls/MavManager.cc \
src/QmlControls/ParameterEditorController.cc \ src/QmlControls/ParameterEditorController.cc \
src/QmlControls/ScreenTools.cc \ src/QmlControls/ScreenToolsController.cc \
src/uas/QGCMAVLinkUASFactory.cc \ src/uas/QGCMAVLinkUASFactory.cc \
src/uas/FileManager.cc \ src/uas/FileManager.cc \
src/uas/UAS.cc \ src/uas/UAS.cc \
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file> <file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file> <file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/qmldir</file> <file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file> <file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file> <file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file> <file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file> <file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file> <file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="ScreenToolsFontQuery.qml">src/QmlControls/ScreenToolsFontQuery.qml</file>
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file> <file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file> <file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file> <file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
......
...@@ -972,8 +972,8 @@ Item { ...@@ -972,8 +972,8 @@ Item {
spacing: 20 spacing: 20
QGCLabel { QGCLabel {
text: "FLIGHT MODES CONFIG" text: "FLIGHT MODES CONFIG"
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.largeFontPixelSize
} }
QGCLabel { QGCLabel {
......
...@@ -179,7 +179,7 @@ QGCView { ...@@ -179,7 +179,7 @@ QGCView {
antialiasing: true antialiasing: true
Connections { Connections {
target: ScreenTools target: ScreenTools
onRepaintRequestedChanged: { onRepaintRequested: {
arrows.requestPaint(); arrows.requestPaint();
} }
} }
...@@ -269,7 +269,7 @@ QGCView { ...@@ -269,7 +269,7 @@ QGCView {
width: (parent.width / 2) - 5 width: (parent.width / 2) - 5
QGCLabel { QGCLabel {
text: "Propeller Function" text: "Propeller Function"
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.mediumFontPixelSize
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
...@@ -282,7 +282,7 @@ QGCView { ...@@ -282,7 +282,7 @@ QGCView {
width: (parent.width / 2) - 5 width: (parent.width / 2) - 5
QGCLabel { QGCLabel {
text: "Magnetometer Distortion" text: "Magnetometer Distortion"
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.mediumFontPixelSize
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
...@@ -300,9 +300,9 @@ QGCView { ...@@ -300,9 +300,9 @@ QGCView {
text: "Show Advanced Settings" text: "Show Advanced Settings"
} }
QGCLabel { QGCLabel {
text: "Advanced Power Settings" text: "Advanced Power Settings"
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.mediumFontPixelSize
visible: showAdvanced.checked visible: showAdvanced.checked
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
......
...@@ -405,16 +405,16 @@ QGCView { ...@@ -405,16 +405,16 @@ QGCView {
color: qgcPal.windowShade color: qgcPal.windowShade
QGCLabel { QGCLabel {
id: orientationCalAreaHelpText id: orientationCalAreaHelpText
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: ScreenTools.font22; font.pixelSize: ScreenTools.mediumFontPixelSize
anchors.top: orientationCalArea.top anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left anchors.left: orientationCalArea.left
anchors.topMargin: 15 anchors.topMargin: 15
anchors.leftMargin: 15 anchors.leftMargin: 15
anchors.rightMargin: 15 anchors.rightMargin: 15
anchors.bottomMargin: 15 anchors.bottomMargin: 15
} }
Flow { Flow {
......
...@@ -69,13 +69,13 @@ ...@@ -69,13 +69,13 @@
#include "SensorsComponentController.h" #include "SensorsComponentController.h"
#include "PowerComponentController.h" #include "PowerComponentController.h"
#include "RadioComponentController.h" #include "RadioComponentController.h"
#include "ScreenToolsController.h"
#ifndef __mobile__ #ifndef __mobile__
#include "FirmwareUpgradeController.h" #include "FirmwareUpgradeController.h"
#endif #endif
#include "AutoPilotPlugin.h" #include "AutoPilotPlugin.h"
#include "VehicleComponent.h" #include "VehicleComponent.h"
#include "ScreenTools.h"
#include "MavManager.h" #include "MavManager.h"
#ifdef QGC_RTLAB_ENABLED #ifdef QGC_RTLAB_ENABLED
...@@ -104,10 +104,10 @@ const char* QGCApplication::_lightStyleFile = ":/res/styles/style-light.css"; ...@@ -104,10 +104,10 @@ const char* QGCApplication::_lightStyleFile = ":/res/styles/style-light.css";
* This is called by the QtQuick engine for creating the singleton * This is called by the QtQuick engine for creating the singleton
**/ **/
static QObject* screenToolsSingletonFactory(QQmlEngine*, QJSEngine*) static QObject* screenToolsControllerSingletonFactory(QQmlEngine*, QJSEngine*)
{ {
ScreenTools* screenTools = new ScreenTools; ScreenToolsController* screenToolsController = new ScreenToolsController;
return screenTools; return screenToolsController;
} }
/** /**
...@@ -261,6 +261,33 @@ void QGCApplication::_initCommon(void) ...@@ -261,6 +261,33 @@ void QGCApplication::_initCommon(void)
{ {
QSettings settings; QSettings settings;
// Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterUncreatableType<AutoPilotPlugin>("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Can only reference, cannot create");
qmlRegisterUncreatableType<VehicleComponent>("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Can only reference, cannot create");
qmlRegisterType<ViewWidgetController>("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<ParameterEditorController>("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<CustomCommandWidgetController>("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FlightModesComponentController>("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController>("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
qmlRegisterType<SensorsComponentController>("QGroundControl.Controllers", 1, 0, "SensorsComponentController");
qmlRegisterType<PowerComponentController>("QGroundControl.Controllers", 1, 0, "PowerComponentController");
qmlRegisterType<RadioComponentController>("QGroundControl.Controllers", 1, 0, "RadioComponentController");
qmlRegisterType<ScreenToolsController>("QGroundControl.Controllers", 1, 0, "ScreenToolsController");
#ifndef __mobile__
qmlRegisterType<FirmwareUpgradeController>("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
#endif
//-- Create QML Singleton Interfaces
qmlRegisterSingletonType<ScreenToolsController>("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);
qmlRegisterSingletonType<MavManager>("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory);
//-- Register Waypoint Interface
qmlRegisterInterface<Waypoint>("Waypoint");
// Show user an upgrade message if the settings version has been bumped up // Show user an upgrade message if the settings version has been bumped up
bool settingsUpgraded = false; bool settingsUpgraded = false;
if (settings.contains(_settingsVersionKey)) { if (settings.contains(_settingsVersionKey)) {
...@@ -314,42 +341,6 @@ void QGCApplication::_initCommon(void) ...@@ -314,42 +341,6 @@ void QGCApplication::_initCommon(void)
} }
qDebug() << "Saved files location" << savedFilesLocation; qDebug() << "Saved files location" << savedFilesLocation;
settings.setValue(_savedFilesLocationKey, savedFilesLocation); settings.setValue(_savedFilesLocationKey, savedFilesLocation);
// Load application font
QFontDatabase fontDatabase = QFontDatabase();
const QString fontFileName = ":/res/fonts/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app
//const QString fontFamilyName = "Bitstream Vera Sans";
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toStdString().c_str());
fontDatabase.addApplicationFont(fontFileName);
// Avoid Using setFont(). In the Qt docu you can read the following:
// "Warning: Do not use this function in conjunction with Qt Style Sheets."
// setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterUncreatableType<AutoPilotPlugin>("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Can only reference, cannot create");
qmlRegisterUncreatableType<VehicleComponent>("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Can only reference, cannot create");
qmlRegisterType<ViewWidgetController>("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<ParameterEditorController>("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<CustomCommandWidgetController>("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FlightModesComponentController>("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController>("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
qmlRegisterType<SensorsComponentController>("QGroundControl.Controllers", 1, 0, "SensorsComponentController");
qmlRegisterType<PowerComponentController>("QGroundControl.Controllers", 1, 0, "PowerComponentController");
qmlRegisterType<RadioComponentController>("QGroundControl.Controllers", 1, 0, "RadioComponentController");
#ifndef __mobile__
qmlRegisterType<FirmwareUpgradeController>("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
#endif
//-- Create QML Singleton Interfaces
qmlRegisterSingletonType<ScreenTools>("QGroundControl.ScreenTools", 1, 0, "ScreenTools", screenToolsSingletonFactory);
qmlRegisterSingletonType<MavManager>("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory);
//-- Register Waypoint Interface
qmlRegisterInterface<Waypoint>("Waypoint");
} }
bool QGCApplication::_initForNormalAppBoot(void) bool QGCApplication::_initForNormalAppBoot(void)
...@@ -656,10 +647,12 @@ void QGCApplication::_loadCurrentStyle(void) ...@@ -656,10 +647,12 @@ void QGCApplication::_loadCurrentStyle(void)
} }
// Now that we have the styles loaded we need to adjust the font sizes. // Now that we have the styles loaded we need to adjust the font sizes.
QString fSmall = QString("%1px;").arg(ScreenTools::font10_s()); QString fSmall = QString("%1px;").arg(ScreenToolsController::smallFontPixelSize_s());
QString fNormal = QString("%1px;").arg(ScreenTools::defaultFontPizelSize_s()); QString fNormal = QString("%1px;").arg(ScreenToolsController::defaultFontPixelSize_s());
QString fLarge = QString("%1px;").arg(ScreenTools::largeFontPixelSize_s()); QString fLarge = QString("%1px;").arg(ScreenToolsController::largeFontPixelSize_s());
qDebug() << fSmall << fNormal << fLarge;
styles.replace("FONT_SMALL", fSmall); styles.replace("FONT_SMALL", fSmall);
styles.replace("FONT_NORMAL", fNormal); styles.replace("FONT_NORMAL", fNormal);
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
#include "QGCPalette.h" #include "QGCPalette.h"
#include "ScreenTools.h"
#include <QApplication> #include <QApplication>
#include <QPalette> #include <QPalette>
......
...@@ -63,10 +63,10 @@ QGCView { ...@@ -63,10 +63,10 @@ QGCView {
x: __leftMargin x: __leftMargin
QGCLabel { QGCLabel {
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9)) height: defaultTextHeight + (ScreenTools.defaultFontPizelSize * 0.5)
text: group text: group
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.pixelSize: ScreenTools.font16; font.pixelSize: ScreenTools.mediumFontPixelSize
} }
Rectangle { Rectangle {
...@@ -84,7 +84,7 @@ QGCView { ...@@ -84,7 +84,7 @@ QGCView {
Item { Item {
x: __leftMargin x: __leftMargin
width: parent.width width: parent.width
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9)) height: defaultTextHeight + (ScreenTools.defaultFontPixelSize * 0.5)
QGCLabel { QGCLabel {
id: nameLabel id: nameLabel
...@@ -142,7 +142,7 @@ QGCView { ...@@ -142,7 +142,7 @@ QGCView {
height: firstButton.height height: firstButton.height
QGCLabel { QGCLabel {
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.largeFontPixelSize
visible: fullMode visible: fullMode
text: "PARAMETER EDITOR" text: "PARAMETER EDITOR"
} }
...@@ -199,10 +199,10 @@ QGCView { ...@@ -199,10 +199,10 @@ QGCView {
readonly property int componentId: parseInt(modelData) readonly property int componentId: parseInt(modelData)
QGCLabel { QGCLabel {
height: contentHeight + (ScreenTools.pixelSizeFactor * (9)) height: contentHeight + (ScreenTools.defaultFontPixelHeight * 0.5)
text: "Component #: " + componentId.toString() text: "Component #: " + componentId.toString()
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.pixelSize: ScreenTools.font16; font.pixelSize: ScreenTools.mediumFontPixelSize
} }
Repeater { Repeater {
...@@ -224,7 +224,7 @@ QGCView { ...@@ -224,7 +224,7 @@ QGCView {
Item { Item {
width: 1 width: 1
height: ScreenTools.pixelSizeFactor * (3) height: ScreenTools.defaultFontPixelSize * 0.25
} }
} // Column - Group } // Column - Group
} // Repeater - Groups } // Repeater - Groups
......
...@@ -26,12 +26,12 @@ Button { ...@@ -26,12 +26,12 @@ Button {
Connections { Connections {
target: __behavior target: __behavior
onMouseXChanged: { onMouseXChanged: {
__lastGlobalMouseX = ScreenTools.mouseX __lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY __lastGlobalMouseY = ScreenTools.mouseY()
} }
onMouseYChanged: { onMouseYChanged: {
__lastGlobalMouseX = ScreenTools.mouseX __lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY __lastGlobalMouseY = ScreenTools.mouseY()
} }
onEntered: { __forceHoverOff; false; hoverTimer.start() } onEntered: { __forceHoverOff; false; hoverTimer.start() }
onExited: { __forceHoverOff; false; hoverTimer.stop() } onExited: { __forceHoverOff; false; hoverTimer.stop() }
...@@ -43,7 +43,7 @@ Button { ...@@ -43,7 +43,7 @@ Button {
repeat: true repeat: true
onTriggered: { onTriggered: {
if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) { if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) {
__forceHoverOff = true __forceHoverOff = true
} else { } else {
__forceHoverOff = false __forceHoverOff = false
...@@ -104,7 +104,7 @@ Button { ...@@ -104,7 +104,7 @@ Button {
id: text id: text
antialiasing: true antialiasing: true
text: control.text text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
......
...@@ -29,7 +29,7 @@ CheckBox { ...@@ -29,7 +29,7 @@ CheckBox {
id: text id: text
text: control.text text: control.text
antialiasing: true antialiasing: true
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
anchors.centerIn: parent anchors.centerIn: parent
......
...@@ -11,7 +11,7 @@ ComboBox { ...@@ -11,7 +11,7 @@ ComboBox {
property bool __showHighlight: pressed | hovered property bool __showHighlight: pressed | hovered
style: ComboBoxStyle { style: ComboBoxStyle {
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
textColor: __showHighlight ? textColor: __showHighlight ?
control.__qgcPal.buttonHighlightText : control.__qgcPal.buttonHighlightText :
control.__qgcPal.buttonText control.__qgcPal.buttonText
......
...@@ -10,7 +10,7 @@ Text { ...@@ -10,7 +10,7 @@ Text {
property bool enabled: true property bool enabled: true
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
color: __qgcPal.text color: __qgcPal.text
antialiasing: true antialiasing: true
} }
...@@ -9,8 +9,8 @@ import QGroundControl.ScreenTools 1.0 ...@@ -9,8 +9,8 @@ import QGroundControl.ScreenTools 1.0
Item { Item {
id: root id: root
property bool allowDragging: true property bool allowDragging: true
property real minimumWidth: ScreenTools.pixelSizeFactor * (60) property real minimumWidth: ScreenTools.defaultFontPixelSize * (5)
property real minimumHeight: ScreenTools.pixelSizeFactor * (60) property real minimumHeight: ScreenTools.defaultFontPixelSize * (5)
property alias tForm: tform property alias tForm: tform
signal resetRequested() signal resetRequested()
transform: Scale { transform: Scale {
......
...@@ -28,7 +28,7 @@ RadioButton { ...@@ -28,7 +28,7 @@ RadioButton {
Text { Text {
id: text id: text
text: control.text text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true antialiasing: true
anchors.centerIn: parent anchors.centerIn: parent
......
...@@ -50,7 +50,7 @@ TextField { ...@@ -50,7 +50,7 @@ TextField {
width: unitsLabelWidthGenerator.width width: unitsLabelWidthGenerator.width
text: control.unitsLabel text: control.unitsLabel
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true antialiasing: true
color: control.textColor color: control.textColor
......
Module QGroundControl.ScreenTools
singleton ScreenTools 1.0 ScreenTools.qml
pragma Singleton
import QtQuick 2.2
import QtQuick.Controls 1.2
import QGroundControl.ScreenToolsController 1.0
Item {
signal repaintRequested
readonly property real defaultFontPixelSize: _textMeasure.contentHeight * 0.8
readonly property real defaultFontPixelHeight: defaultFontPixelSize
readonly property real defaultFontPixelWidth: _textMeasure.contentWidth
readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio
readonly property real mediumFontPixelSize: defaultFontPixelSize * ScreenToolsController.mediumFontPixelSizeRatio
readonly property real largeFontPixelSize: defaultFontPixelSize * ScreenToolsController.largeFontPixelSizeRatio
property bool isAndroid: ScreenToolsController.isAndroid
property bool isiOS: ScreenToolsController.isiOS
property bool isMobile: ScreenToolsController.isMobile
function mouseX() {
return ScreenToolsController.mouseX()
}
function mouseY() {
return ScreenToolsController.mouseY()
}
Text {
id: _textMeasure
text: "X"
}
Connections {
target: ScreenToolsController
onRepaintRequested: repaintRequested()
}
}
...@@ -24,69 +24,36 @@ ...@@ -24,69 +24,36 @@
/// @file /// @file
/// @author Gus Grubba <mavlink@grubba.com> /// @author Gus Grubba <mavlink@grubba.com>
#include "ScreenTools.h" #include "ScreenToolsController.h"
#include "MainWindow.h" #include "MainWindow.h"
// Pixel size, instead of a physical thing is actually a philosophical question when int ScreenToolsController::_qmlDefaultFontPixelSize = -1;
// it comes to Qt.
// The values below came from actually measuring the elements on the screen on these
// devices. I have yet to find a constant from Qt so these things can be properly
// computed at runtime.
#if defined(Q_OS_OSX) const double ScreenToolsController::_smallFontPixelSizeRatio = 0.75;
double ScreenTools::_pixelFactor = 1.0; const double ScreenToolsController::_mediumFontPixelSizeRatio = 1.22;
#elif defined(__ios__) const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66;
double ScreenTools::_pixelFactor = 0.75;
#elif defined(Q_OS_WIN)
double ScreenTools::_pixelFactor = 0.86;
#elif defined(__android__)
double ScreenTools::_pixelFactor = 2.5;
#elif defined(Q_OS_LINUX)
double ScreenTools::_pixelFactor = 1.0;
#endif
#if defined(__android__) ScreenToolsController::ScreenToolsController()
#define FONT_FACTOR 2
#else
#define FONT_FACTOR 1
#endif
int ScreenTools::_font8 = 8 * FONT_FACTOR;
int ScreenTools::_font9 = 9 * FONT_FACTOR;
int ScreenTools::_font10 = 10 * FONT_FACTOR;
int ScreenTools::_font11 = 11 * FONT_FACTOR;
int ScreenTools::_font12 = 12 * FONT_FACTOR;
int ScreenTools::_font13 = 13 * FONT_FACTOR;
int ScreenTools::_font14 = 14 * FONT_FACTOR;
int ScreenTools::_font15 = 15 * FONT_FACTOR;
int ScreenTools::_font16 = 16 * FONT_FACTOR;
int ScreenTools::_font17 = 17 * FONT_FACTOR;
int ScreenTools::_font18 = 18 * FONT_FACTOR;
int ScreenTools::_font19 = 19 * FONT_FACTOR;
int ScreenTools::_font20 = 20 * FONT_FACTOR;
int ScreenTools::_font21 = 21 * FONT_FACTOR;
int ScreenTools::_font22 = 22 * FONT_FACTOR;
ScreenTools::ScreenTools()
{ {
MainWindow* mainWindow = MainWindow::instance(); MainWindow* mainWindow = MainWindow::instance();
// Unit tests can run Qml without MainWindow // Unit tests can run Qml without MainWindow
if (mainWindow) { if (mainWindow) {
connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas); connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenToolsController::_updateCanvas);
} }
} }
qreal ScreenTools::adjustPixelSize(qreal pixelSize) void ScreenToolsController::_updateCanvas()
{
return adjustPixelSize_s(pixelSize);
}
qreal ScreenTools::adjustPixelSize_s(qreal pixelSize)
{ {
return pixelSize * _pixelFactor; emit repaintRequested();
} }
void ScreenTools::_updateCanvas() double ScreenToolsController::getQmlDefaultFontPixelSize(void)
{ {
emit repaintRequestedChanged(); if (_qmlDefaultFontPixelSize == -1) {
QGCQmlWidgetHolder qmlWidgetHolder;
qmlWidgetHolder.setSource(QUrl::fromUserInput("qrc:/qml/ScreenToolsFontQuery.qml"));
}
return _qmlDefaultFontPixelSize;
} }
...@@ -24,35 +24,33 @@ ...@@ -24,35 +24,33 @@
/// @file /// @file
/// @author Gus Grubba <mavlink@grubba.com> /// @author Gus Grubba <mavlink@grubba.com>
#ifndef SCREENTOOLS_H #ifndef ScreenToolsController_H
#define SCREENTOOLS_H #define ScreenToolsController_H
#include <QObject> #include "QGCApplication.h"
#include <QQuickItem>
#include <QCursor> #include <QCursor>
/*! /*!
@brief Screen helper tools for QML widgets @brief Screen helper tools for QML widgets
To use its functions, you need to import the module with the following line: To use its functions, you need to import the module with the following line:
@code @code
import QGroundControl.ScreenTools 1.0
@endcode @endcode
*/ */
/// This Qml control is used to return screen parameters /// This Qml control is used to return screen parameters
class ScreenTools : public QObject class ScreenToolsController : public QQuickItem
{ {
Q_OBJECT Q_OBJECT
public: public:
ScreenTools(); ScreenToolsController();
Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT) Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT)
Q_PROPERTY(bool isiOS READ isiOS CONSTANT) Q_PROPERTY(bool isiOS READ isiOS CONSTANT)
Q_PROPERTY(bool isMobile READ isMobile CONSTANT) Q_PROPERTY(bool isMobile READ isMobile CONSTANT)
//! Returns the global mouse X position
Q_PROPERTY(int mouseX READ mouseX)
//! Returns the global mouse Y position
Q_PROPERTY(int mouseY READ mouseY)
//! Used to trigger a \c Canvas element repaint. //! Used to trigger a \c Canvas element repaint.
/*! /*!
There is a bug as of Qt 5.4 where a Canvas element defined within a QQuickWidget does not receive There is a bug as of Qt 5.4 where a Canvas element defined within a QQuickWidget does not receive
...@@ -60,14 +58,14 @@ public: ...@@ -60,14 +58,14 @@ public:
repainted. repainted.
If you use a \c Canvas element inside some QML widget, you can use this code to handle repaint: If you use a \c Canvas element inside some QML widget, you can use this code to handle repaint:
@code @code
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenToolsController 1.0
... ...
Canvas { Canvas {
id: myCanvas id: myCanvas
height: 40 height: 40
width: 40 width: 40
Connections { Connections {
target: ScreenTools target: ScreenToolsController
onRepaintRequestedChanged: { onRepaintRequestedChanged: {
myCanvas.requestPaint(); myCanvas.requestPaint();
} }
...@@ -80,87 +78,23 @@ public: ...@@ -80,87 +78,23 @@ public:
@endcode @endcode
*/ */
//! Font sizes // Returns current mouse position
Q_PROPERTY(int font22 READ font22 CONSTANT) Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
Q_PROPERTY(int font21 READ font21 CONSTANT) Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
Q_PROPERTY(int font20 READ font20 CONSTANT)
Q_PROPERTY(int font19 READ font19 CONSTANT) // Used to calculate font sizes based on default font size
Q_PROPERTY(int font18 READ font18 CONSTANT) Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT)
Q_PROPERTY(int font17 READ font17 CONSTANT) Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT)
Q_PROPERTY(int font16 READ font16 CONSTANT) Q_PROPERTY(double largeFontPixelSizeRatio MEMBER _largeFontPixelSizeRatio CONSTANT)
Q_PROPERTY(int font15 READ font15 CONSTANT)
Q_PROPERTY(int font14 READ font14 CONSTANT)
Q_PROPERTY(int font13 READ font13 CONSTANT)
Q_PROPERTY(int font12 READ font12 CONSTANT)
Q_PROPERTY(int font11 READ font11 CONSTANT)
Q_PROPERTY(int font10 READ font10 CONSTANT)
Q_PROPERTY(int font9 READ font9 CONSTANT)
Q_PROPERTY(int font8 READ font8 CONSTANT)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(int defaultFontPizelSize READ defaultFontPizelSize CONSTANT)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(int mediumFontPixelSize READ mediumFontPixelSize CONSTANT)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(int largeFontPixelSize READ largeFontPixelSize CONSTANT)
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
//! Returns the pixel size factor
Q_PROPERTY(double pixelSizeFactor READ pixelSizeFactor CONSTANT)
//! Utility for adjusting pixel size. Not dynamic (no signals) Q_PROPERTY(double qmlDefaultFontPixelSize MEMBER _qmlDefaultFontPixelSize)
Q_INVOKABLE qreal adjustPixelSize(qreal pixelSize);
static double getQmlDefaultFontPixelSize(void);
/// Static version of adjustPixelSize of use in C++ code
static qreal adjustPixelSize_s(qreal pixelSize); static int defaultFontPixelSize_s() { return (int)getQmlDefaultFontPixelSize(); }
static int smallFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _smallFontPixelSizeRatio); }
int mouseX () { return QCursor::pos().x(); } static int mediumFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _mediumFontPixelSizeRatio); }
int mouseY () { return QCursor::pos().y(); } static int largeFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _largeFontPixelSizeRatio); }
bool repaintRequested () { return true; }
double pixelSizeFactor () { return _pixelFactor; }
int font22 () { return _font22; }
int font21 () { return _font21; }
int font20 () { return _font20; }
int font19 () { return _font19; }
int font18 () { return _font18; }
int font17 () { return _font17; }
int font16 () { return _font16; }
int font15 () { return _font15; }
int font14 () { return _font14; }
int font13 () { return _font13; }
int font12 () { return _font12; }
int font11 () { return _font11; }
int font10 () { return _font10; }
int font9 () { return _font9; }
int font8 () { return _font8; }
int defaultFontPizelSize () { return _font12; }
int mediumFontPixelSize () { return _font16; }
int largeFontPixelSize () { return _font20; }
/// Static version for use in C++ code
static int font22_s () { return _font22; }
static int font21_s () { return _font21; }
static int font20_s () { return _font20; }
static int font19_s () { return _font19; }
static int font18_s () { return _font18; }
static int font17_s () { return _font17; }
static int font16_s () { return _font16; }
static int font15_s () { return _font15; }
static int font14_s () { return _font14; }
static int font13_s () { return _font13; }
static int font12_s () { return _font12; }
static int font11_s () { return _font11; }
static int font10_s () { return _font10; }
static int font9_s () { return _font9; }
static int font8_s () { return _font8; }
static int defaultFontPizelSize_s () { return _font12; }
static int mediumFontPixelSize_s () { return _font16; }
static int largeFontPixelSize_s () { return _font20; }
static double pixelSizeFactor_s () { return _pixelFactor; }
#if defined (__android__) #if defined (__android__)
bool isAndroid () { return true; } bool isAndroid () { return true; }
...@@ -177,30 +111,17 @@ public: ...@@ -177,30 +111,17 @@ public:
#endif #endif
signals: signals:
void repaintRequestedChanged(); void repaintRequested(void);
private slots: private slots:
void _updateCanvas(); void _updateCanvas();
private: private:
// Font Sizes static const double _smallFontPixelSizeRatio;
static int _font8; static const double _mediumFontPixelSizeRatio;
static int _font9; static const double _largeFontPixelSizeRatio;
static int _font10;
static int _font11; static int _qmlDefaultFontPixelSize;
static int _font12;
static int _font13;
static int _font14;
static int _font15;
static int _font16;
static int _font17;
static int _font18;
static int _font19;
static int _font20;
static int _font21;
static int _font22;
// UI Dimension Factors
static double _pixelFactor;
}; };
#endif #endif
import QtQuick 2.2
import QtQuick.Controls 1.2
import QGroundControl.ScreenTools 1.0
import QGroundControl.ScreenToolsController 1.0
Item {
Component.onCompleted: ScreenToolsController.qmlDefaultFontPixelSize = ScreenTools.defaultFontPixelSize
}
...@@ -40,7 +40,7 @@ Button { ...@@ -40,7 +40,7 @@ Button {
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
text: control.text text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true antialiasing: true
color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
......
...@@ -70,7 +70,7 @@ Rectangle { ...@@ -70,7 +70,7 @@ Rectangle {
height: parent.height height: parent.height
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
font.pixelSize: ScreenTools.font22; font.pixelSize: ScreenTools.mediumFontPixelSize
font.bold: true font.bold: true
color: "black" color: "black"
text: parent.calText text: parent.calText
...@@ -80,7 +80,7 @@ Rectangle { ...@@ -80,7 +80,7 @@ Rectangle {
height: parent.height height: parent.height
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
font.pixelSize: ScreenTools.font22; font.pixelSize: ScreenTools.mediumFontPixelSize
color: calInProgress ? "yellow" : "white" color: calInProgress ? "yellow" : "white"
text: parent.calText text: parent.calText
} }
......
...@@ -74,7 +74,7 @@ QGCView { ...@@ -74,7 +74,7 @@ QGCView {
QGCLabel { QGCLabel {
text: "FIRMWARE UPDATE" text: "FIRMWARE UPDATE"
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.largeFontPixelSize
} }
Item { Item {
...@@ -177,7 +177,7 @@ QGCView { ...@@ -177,7 +177,7 @@ QGCView {
height: 300 height: 300
readOnly: true readOnly: true
frameVisible: false frameVisible: false
font.pixelSize: ScreenTools.defaultFontPizelSize font.pixelSize: ScreenTools.defaultFontPixelSize
text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.") text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.")
......
...@@ -45,8 +45,8 @@ Rectangle { ...@@ -45,8 +45,8 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
QGCLabel { QGCLabel {
text: "VEHICLE SUMMARY" text: "VEHICLE SUMMARY"
font.pixelSize: ScreenTools.font20; font.pixelSize: ScreenTools.largeFontPixelSize
} }
Item { Item {
...@@ -59,7 +59,7 @@ Rectangle { ...@@ -59,7 +59,7 @@ Rectangle {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: setupComplete ? qgcPal.text : "red" color: setupComplete ? qgcPal.text : "red"
font.pixelSize: setupComplete ? ScreenTools.defaultFontPizelSize : ScreenTools.font20 font.pixelSize: setupComplete ? ScreenTools.defaultFontPixelSize : ScreenTools.mediumFontPixelSize
text: setupComplete ? text: setupComplete ?
"Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component." : "Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component." :
"WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left." "WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left."
......
...@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine> #include <QQmlEngine>
#include <QSettings> #include <QSettings>
#include "ScreenTools.h" #include "ScreenToolsController.h"
#include "FlightDisplay.h" #include "FlightDisplay.h"
#include "UASManager.h" #include "UASManager.h"
...@@ -48,8 +48,8 @@ FlightDisplay::FlightDisplay(QWidget *parent) ...@@ -48,8 +48,8 @@ FlightDisplay::FlightDisplay(QWidget *parent)
pl->setContentsMargins(0,0,0,0); pl->setContentsMargins(0,0,0,0);
} }
#ifndef __android__ #ifndef __android__
setMinimumWidth( 380 * ScreenTools::pixelSizeFactor_s()); setMinimumWidth( 31 * ScreenToolsController::defaultFontPixelSize_s());
setMinimumHeight(400 * ScreenTools::pixelSizeFactor_s()); setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s());
#endif #endif
setContextPropertyObject("flightDisplay", this); setContextPropertyObject("flightDisplay", this);
setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml")); setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml"));
......
...@@ -118,17 +118,17 @@ Item { ...@@ -118,17 +118,17 @@ Item {
} }
contentItem: Rectangle { contentItem: Rectangle {
color: __qgcPal.window color: __qgcPal.window
implicitWidth: ScreenTools.pixelSizeFactor * (360) implicitWidth: ScreenTools.defaultFontPixelSize * (30)
implicitHeight: ScreenTools.pixelSizeFactor * (300) implicitHeight: ScreenTools.defaultFontPixelSize * (30)
Column { Column {
id: dialogColumn id: dialogColumn
anchors.centerIn: parent anchors.centerIn: parent
spacing: ScreenTools.adjustPixelSize(10) spacing: ScreenTools.defaultFontPixelSize
width: parent.width width: parent.width
Grid { Grid {
columns: 2 columns: 2
spacing: ScreenTools.pixelSizeFactor * (8) spacing: ScreenTools.defaultFontPixelSize * (0.66)
rowSpacing: ScreenTools.pixelSizeFactor * (10) rowSpacing: ScreenTools.defaultFontPixelSize * (0.83)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
QGCCheckBox { QGCCheckBox {
text: "Map Background" text: "Map Background"
...@@ -432,25 +432,25 @@ Item { ...@@ -432,25 +432,25 @@ Item {
QGCHudMessage { QGCHudMessage {
id: hudMessage id: hudMessage
y: ScreenTools.pixelSizeFactor * (5) y: ScreenTools.defaultFontPizelSize * (0.42)
width: (parent.width - 520 > 200) ? parent.width - 520 : 200 width: (parent.width - 520 > 200) ? parent.width - 520 : 200
height: ScreenTools.pixelSizeFactor * (30) height: ScreenTools.defaultFontPizelSize * (2.5)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
z: mapBackground.z + 1 z: mapBackground.z + 1
} }
QGCCompassInstrument { QGCCompassInstrument {
id: compassInstrument id: compassInstrument
y: ScreenTools.pixelSizeFactor * (5) y: ScreenTools.defaultFontPixelSize * (0.42)
x: ScreenTools.pixelSizeFactor * (85) x: ScreenTools.defaultFontPixelSize * (7.1)
size: ScreenTools.pixelSizeFactor * (160) size: ScreenTools.defaultFontPixelSize * (13.3)
heading: isNaN(MavManager.heading) ? 0 : MavManager.heading heading: isNaN(MavManager.heading) ? 0 : MavManager.heading
visible: mapBackground.visible && showCompass visible: mapBackground.visible && showCompass
z: mapBackground.z + 2 z: mapBackground.z + 2
onResetRequested: { onResetRequested: {
y = ScreenTools.pixelSizeFactor * (5) y = ScreenTools.defaultFontPixelSize * (0.42)
x = ScreenTools.pixelSizeFactor * (85) x = ScreenTools.defaultFontPixelSize * (7.1)
size = ScreenTools.pixelSizeFactor * (160) size = ScreenTools.defaultFontPixelSize * (13.3)
tForm.xScale = 1 tForm.xScale = 1
tForm.yScale = 1 tForm.yScale = 1
} }
...@@ -458,20 +458,20 @@ Item { ...@@ -458,20 +458,20 @@ Item {
QGCAttitudeInstrument { QGCAttitudeInstrument {
id: attitudeInstrument id: attitudeInstrument
y: ScreenTools.pixelSizeFactor * (5) y: ScreenTools.defaultFontPixelSize * (0.42)
size: ScreenTools.pixelSizeFactor * (160) size: ScreenTools.defaultFontPixelSize * (13.3)
rollAngle: roll rollAngle: roll
pitchAngle: pitch pitchAngle: pitch
showPitch: showPitchIndicator showPitch: showPitchIndicator
visible: mapBackground.visible && showAttitudeIndicator visible: mapBackground.visible && showAttitudeIndicator
anchors.right: root.right anchors.right: root.right
anchors.rightMargin: ScreenTools.pixelSizeFactor * (85) anchors.rightMargin: ScreenTools.defaultFontPixelSize * (7.1)
z: mapBackground.z + 2 z: mapBackground.z + 2
onResetRequested: { onResetRequested: {
y = ScreenTools.pixelSizeFactor * (5) y = ScreenTools.defaultFontPixelSize * (0.42)
anchors.right = root.right anchors.right = root.right
anchors.rightMargin = ScreenTools.pixelSizeFactor * (85) anchors.rightMargin = ScreenTools.defaultFontPixelSize * (7.1)
size = ScreenTools.pixelSizeFactor * (160) size = ScreenTools.defaultFontPixelSize * (13.3)
tForm.xScale = 1 tForm.xScale = 1
tForm.yScale = 1 tForm.yScale = 1
} }
...@@ -490,8 +490,8 @@ Item { ...@@ -490,8 +490,8 @@ Item {
rollAngle: roll rollAngle: roll
pitchAngle: pitch pitchAngle: pitch
visible: !mapBackground.visible && showAttitudeIndicator visible: !mapBackground.visible && showAttitudeIndicator
width: ScreenTools.pixelSizeFactor * (260) width: ScreenTools.defaultFontPixelSize * (21.7)
height: ScreenTools.pixelSizeFactor * (260) height: ScreenTools.defaultFontPixelSize * (21.7)
z: 20 z: 20
} }
...@@ -502,15 +502,15 @@ Item { ...@@ -502,15 +502,15 @@ Item {
pitchAngle: pitch pitchAngle: pitch
rollAngle: roll rollAngle: roll
color: Qt.rgba(0,0,0,0) color: Qt.rgba(0,0,0,0)
size: ScreenTools.pixelSizeFactor * (120) size: ScreenTools.defaultFontPixelSize * (10)
z: 30 z: 30
} }
QGCAltitudeWidget { QGCAltitudeWidget {
id: altitudeWidget id: altitudeWidget
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.pixelSizeFactor * (60) width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.pixelSizeFactor * (280) ? ScreenTools.pixelSizeFactor * (280) : parent.height * 0.65 height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
altitude: MavManager.altitudeWGS84 altitude: MavManager.altitudeWGS84
z: 30 z: 30
} }
...@@ -518,8 +518,8 @@ Item { ...@@ -518,8 +518,8 @@ Item {
QGCSpeedWidget { QGCSpeedWidget {
id: speedWidget id: speedWidget
anchors.left: parent.left anchors.left: parent.left
width: ScreenTools.pixelSizeFactor * (60) width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.pixelSizeFactor * (280) ? ScreenTools.pixelSizeFactor * (280) : parent.height * 0.65 height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: MavManager.groundSpeed speed: MavManager.groundSpeed
z: 40 z: 40
} }
...@@ -527,7 +527,7 @@ Item { ...@@ -527,7 +527,7 @@ Item {
QGCCurrentSpeed { QGCCurrentSpeed {
id: currentSpeed id: currentSpeed
anchors.left: parent.left anchors.left: parent.left
width: ScreenTools.pixelSizeFactor * (75) width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: MavManager.airSpeed airspeed: MavManager.airSpeed
groundspeed: MavManager.groundSpeed groundspeed: MavManager.groundSpeed
showAirSpeed: true showAirSpeed: true
...@@ -539,7 +539,7 @@ Item { ...@@ -539,7 +539,7 @@ Item {
QGCCurrentAltitude { QGCCurrentAltitude {
id: currentAltitude id: currentAltitude
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.pixelSizeFactor * (75) width: ScreenTools.defaultFontPixelSize * (6.25)
altitude: MavManager.altitudeWGS84 altitude: MavManager.altitudeWGS84
vertZ: MavManager.climbRate vertZ: MavManager.climbRate
showAltitude: true showAltitude: true
...@@ -551,9 +551,9 @@ Item { ...@@ -551,9 +551,9 @@ Item {
QGCCompass { QGCCompass {
id: compassIndicator id: compassIndicator
y: root.height * 0.7 y: root.height * 0.7
x: root.width * 0.5 - ScreenTools.pixelSizeFactor * (60) x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5)
width: ScreenTools.pixelSizeFactor * (120) width: ScreenTools.defaultFontPixelSize * (10)
height: ScreenTools.pixelSizeFactor * (120) height: ScreenTools.defaultFontPixelSize * (10)
heading: isNaN(MavManager.heading) ? 0 : MavManager.heading heading: isNaN(MavManager.heading) ? 0 : MavManager.heading
visible: !mapBackground.visible && showCompass visible: !mapBackground.visible && showCompass
z: 70 z: 70
......
...@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine> #include <QQmlEngine>
#include <QSettings> #include <QSettings>
#include "ScreenTools.h" #include "ScreenToolsController.h"
#include "QGCMapDisplay.h" #include "QGCMapDisplay.h"
#include "UASManager.h" #include "UASManager.h"
...@@ -48,8 +48,8 @@ QGCMapDisplay::QGCMapDisplay(QWidget *parent) ...@@ -48,8 +48,8 @@ QGCMapDisplay::QGCMapDisplay(QWidget *parent)
pl->setContentsMargins(0,0,0,0); pl->setContentsMargins(0,0,0,0);
} }
#ifndef __android__ #ifndef __android__
setMinimumWidth( 380 * ScreenTools::pixelSizeFactor_s()); setMinimumWidth( 32 * ScreenToolsController::defaultFontPixelSize_s());
setMinimumHeight(400 * ScreenTools::pixelSizeFactor_s()); setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s());
#endif #endif
setContextPropertyObject("mapEngine", this); setContextPropertyObject("mapEngine", this);
setSource(QUrl::fromUserInput("qrc:/qml/MapDisplay.qml")); setSource(QUrl::fromUserInput("qrc:/qml/MapDisplay.qml"));
......
...@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0 ...@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0
Rectangle { Rectangle {
id: root id: root
property real altitude: 50 property real altitude: 50
property real _reticleSpacing: ScreenTools.pixelSizeFactor * (16) property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (1.33)
property real _reticleHeight: ScreenTools.pixelSizeFactor * (2) property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166)
property real _reticleSlot: _reticleSpacing + _reticleHeight property real _reticleSlot: _reticleSpacing + _reticleHeight
property var _speedArray: [] property var _speedArray: []
property int _currentCenter: 0 property int _currentCenter: 0
...@@ -64,7 +64,7 @@ Rectangle { ...@@ -64,7 +64,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
smooth: true smooth: true
radius: ScreenTools.pixelSizeFactor * (5) radius: ScreenTools.defaultFontPixelSize * (0.42)
border.color: Qt.rgba(1,1,1,0.25) border.color: Qt.rgba(1,1,1,0.25)
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) } GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) }
...@@ -73,7 +73,7 @@ Rectangle { ...@@ -73,7 +73,7 @@ Rectangle {
} }
Rectangle { Rectangle {
id: clipRect id: clipRect
height: parent.height - ScreenTools.pixelSizeFactor * (5) height: parent.height - ScreenTools.defaultFontPixelSize * (0.42)
width: parent.width width: parent.width
clip: true clip: true
color: Qt.rgba(0,0,0,0); color: Qt.rgba(0,0,0,0);
...@@ -88,12 +88,12 @@ Rectangle { ...@@ -88,12 +88,12 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
Rectangle { Rectangle {
property int _alt: modelData property int _alt: modelData
width: (_alt % 10 === 0) ? ScreenTools.pixelSizeFactor * (10) : ScreenTools.pixelSizeFactor * (15) width: (_alt % 10 === 0) ? ScreenTools.defaultFontPixelSize * (0.83) : ScreenTools.defaultFontPixelSize * (1.25)
height: _reticleHeight height: _reticleHeight
color: Qt.rgba(1,1,1,0.35) color: Qt.rgba(1,1,1,0.35)
QGCLabel { QGCLabel {
visible: (_alt % 10 === 0) visible: (_alt % 10 === 0)
x: ScreenTools.pixelSizeFactor * (20) x: ScreenTools.defaultFontPixelSize * (1.66)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
antialiasing: true antialiasing: true
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -58,8 +58,8 @@ Item { ...@@ -58,8 +58,8 @@ Item {
} }
Rectangle { Rectangle {
anchors.centerIn: compass anchors.centerIn: compass
width: ScreenTools.pixelSizeFactor * (40) width: ScreenTools.defaultFontPixelSize * (3.33)
height: ScreenTools.pixelSizeFactor * (25) height: ScreenTools.defaultFontPixelSize * (2.08)
border.color: Qt.rgba(1,1,1,0.15) border.color: Qt.rgba(1,1,1,0.15)
color: Qt.rgba(0,0,0,0.25) color: Qt.rgba(0,0,0,0.25)
QGCLabel { QGCLabel {
......
...@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0 ...@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0
QGCMovableItem { QGCMovableItem {
id: root id: root
property real heading: 0 property real heading: 0
property real size: ScreenTools.pixelSizeFactor * (120) property real size: ScreenTools.defaultFontPixelSize * (10)
property int _fontSize: ScreenTools.font12 property int _fontSize: ScreenTools.defaultFontPixelSize
width: size width: size
height: size height: size
Rectangle { Rectangle {
......
...@@ -39,13 +39,13 @@ Rectangle { ...@@ -39,13 +39,13 @@ Rectangle {
property bool showClimbRate: true property bool showClimbRate: true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: parent.width width: parent.width
height: (showAltitude && showClimbRate) ? ScreenTools.pixelSizeFactor * (50) : ScreenTools.pixelSizeFactor * (25) height: (showAltitude && showClimbRate) ? ScreenTools.defaultFontPixelSize * (4.16) : ScreenTools.defaultFontPixelSize * (2.08)
color: "black" color: "black"
border.color: Qt.rgba(1,1,1,0.25) border.color: Qt.rgba(1,1,1,0.25)
opacity: 1.0 opacity: 1.0
Column{ Column{
anchors.centerIn: parent anchors.centerIn: parent
spacing: ScreenTools.pixelSizeFactor * (4) spacing: ScreenTools.defaultFontPixelSize * (0.33)
QGCLabel { QGCLabel {
text: 'h: ' + altitude.toFixed(0) text: 'h: ' + altitude.toFixed(0)
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -39,13 +39,13 @@ Rectangle { ...@@ -39,13 +39,13 @@ Rectangle {
property bool showGroundSpeed: true property bool showGroundSpeed: true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: parent.width width: parent.width
height: (showAirSpeed && showGroundSpeed) ? ScreenTools.pixelSizeFactor * (50) : ScreenTools.pixelSizeFactor * (25) height: (showAirSpeed && showGroundSpeed) ? ScreenTools.defaultFontPixelSize * (4.16) : ScreenTools.defaultFontPixelSize * (2.08)
color: "black" color: "black"
border.color: Qt.rgba(1,1,1,0.25) border.color: Qt.rgba(1,1,1,0.25)
opacity: 1.0 opacity: 1.0
Column{ Column{
anchors.centerIn: parent anchors.centerIn: parent
spacing: ScreenTools.pixelSizeFactor * (4) spacing: ScreenTools.defaultFontPixelSize * (0.33)
QGCLabel { QGCLabel {
text: 'GS: ' + groundspeed.toFixed(0) text: 'GS: ' + groundspeed.toFixed(0)
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -307,9 +307,9 @@ Item { ...@@ -307,9 +307,9 @@ Item {
z: 1000 z: 1000
anchors { anchors {
bottom: parent.bottom; bottom: parent.bottom;
bottomMargin: ScreenTools.pixelSizeFactor * (15) bottomMargin: ScreenTools.defaultFontPixelSize * (1.25)
rightMargin: ScreenTools.pixelSizeFactor * (20) rightMargin: ScreenTools.defaultFontPixelSize * (1.66)
leftMargin: ScreenTools.pixelSizeFactor * (20) leftMargin: ScreenTools.defaultFontPixelSize * (1.66)
left: parent.left left: parent.left
} }
width: parent.width - anchors.rightMargin - anchors.leftMargin width: parent.width - anchors.rightMargin - anchors.leftMargin
...@@ -330,9 +330,9 @@ Item { ...@@ -330,9 +330,9 @@ Item {
opacity: 1 opacity: 1
anchors { anchors {
bottom: zoomSlider.top; bottom: zoomSlider.top;
bottomMargin: ScreenTools.pixelSizeFactor * (8); bottomMargin: ScreenTools.defaultFontPixelSize * (0.66);
left: zoomSlider.left left: zoomSlider.left
leftMargin: ScreenTools.pixelSizeFactor * (4) leftMargin: ScreenTools.defaultFontPixelSize * (0.33)
} }
Image { Image {
id: scaleImageLeft id: scaleImageLeft
...@@ -359,7 +359,7 @@ Item { ...@@ -359,7 +359,7 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.bottomMargin: ScreenTools.pixelSizeFactor * (10) anchors.bottomMargin: ScreenTools.defaultFontPixelSize * (0.83)
text: "0 m" text: "0 m"
} }
Component.onCompleted: { Component.onCompleted: {
......
...@@ -23,12 +23,12 @@ Button { ...@@ -23,12 +23,12 @@ Button {
Connections { Connections {
target: __behavior target: __behavior
onMouseXChanged: { onMouseXChanged: {
__lastGlobalMouseX = ScreenTools.mouseX __lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY __lastGlobalMouseY = ScreenTools.mouseY()
} }
onMouseYChanged: { onMouseYChanged: {
__lastGlobalMouseX = ScreenTools.mouseX __lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY __lastGlobalMouseY = ScreenTools.mouseY()
} }
onEntered: { __forceHoverOff; false; hoverTimer.start() } onEntered: { __forceHoverOff; false; hoverTimer.start() }
onExited: { __forceHoverOff; false; hoverTimer.stop() } onExited: { __forceHoverOff; false; hoverTimer.stop() }
...@@ -39,7 +39,7 @@ Button { ...@@ -39,7 +39,7 @@ Button {
interval: 250 interval: 250
repeat: true repeat: true
onTriggered: { onTriggered: {
if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) { if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) {
__forceHoverOff = true __forceHoverOff = true
} else { } else {
__forceHoverOff = false __forceHoverOff = false
......
...@@ -40,10 +40,10 @@ Rectangle { ...@@ -40,10 +40,10 @@ Rectangle {
property real _reticleSlot: _reticleSpacing + _reticleHeight property real _reticleSlot: _reticleSpacing + _reticleHeight
property real _longDash: size * 0.40 property real _longDash: size * 0.40
property real _shortDash: size * 0.25 property real _shortDash: size * 0.25
property real _fontSize: ScreenTools.font11 property real _fontSize: ScreenTools.defaultFontPixelSize
height: size * 0.9 height: size * 0.9
width: size width: size
radius: ScreenTools.pixelSizeFactor * (8) 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
......
...@@ -52,15 +52,15 @@ Item { ...@@ -52,15 +52,15 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: ScreenTools.pixelSizeFactor * (6) radius: ScreenTools.defaultFontPixelSize * (0.5)
color: Qt.rgba(0,0,0,0.65); color: Qt.rgba(0,0,0,0.65);
} }
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: ScreenTools.pixelSizeFactor * (4) anchors.leftMargin: ScreenTools.defaultFontPixelSize * (0.33)
radius: ScreenTools.pixelSizeFactor * (4) radius: ScreenTools.defaultFontPixelSize * (0.33)
height: ScreenTools.pixelSizeFactor * (4) height: ScreenTools.defaultFontPixelSize * (0.33)
width: handle.x - x width: handle.x - x
color: "#69bb17" color: "#69bb17"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -69,14 +69,14 @@ Item { ...@@ -69,14 +69,14 @@ Item {
Rectangle { Rectangle {
id: labelRect id: labelRect
width: label.width width: label.width
height: label.height + ScreenTools.pixelSizeFactor * (4) height: label.height + ScreenTools.defaultFontPixelSize * (0.33)
radius: ScreenTools.pixelSizeFactor * (4) radius: ScreenTools.defaultFontPixelSize * (0.33)
smooth: true smooth: true
color: Qt.rgba(1,1,1,0.75); color: Qt.rgba(1,1,1,0.75);
border.width: ScreenTools.pixelSizeFactor * (1) border.width: ScreenTools.defaultFontPixelSize * (0.083)
border.color: Qt.rgba(0,0,0,0.45); border.color: Qt.rgba(0,0,0,0.45);
anchors.bottom: handle.top anchors.bottom: handle.top
anchors.bottomMargin: ScreenTools.pixelSizeFactor * (4) anchors.bottomMargin: ScreenTools.defaultFontPixelSize * (0.33)
visible: mouseRegion.pressed visible: mouseRegion.pressed
x: Math.max(Math.min(handle.x + (handle.width - width ) / 2, slider.width - width), 0) x: Math.max(Math.min(handle.x + (handle.width - width ) / 2, slider.width - width), 0)
QGCLabel{ QGCLabel{
...@@ -93,7 +93,7 @@ Item { ...@@ -93,7 +93,7 @@ Item {
Rectangle { Rectangle {
id: handle; id: handle;
smooth: true smooth: true
width: ScreenTools.pixelSizeFactor * (26); width: ScreenTools.defaultFontPixelSize * (2.16);
y: (slider.height - height) / 2; y: (slider.height - height) / 2;
x: (slider.value - slider.minimum) * slider.length / (slider.maximum - slider.minimum) x: (slider.value - slider.minimum) * slider.length / (slider.maximum - slider.minimum)
......
...@@ -34,13 +34,13 @@ import QGroundControl.Controls 1.0 ...@@ -34,13 +34,13 @@ import QGroundControl.Controls 1.0
Rectangle { Rectangle {
id: root id: root
property real speed: 0 property real speed: 0
property real _reticleSpacing: ScreenTools.pixelSizeFactor * (10) property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (0.83)
property real _reticleHeight: ScreenTools.pixelSizeFactor * (2) property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166)
property real _reticleSlot: _reticleSpacing + _reticleHeight property real _reticleSlot: _reticleSpacing + _reticleHeight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
z:10 z:10
smooth: true smooth: true
radius: ScreenTools.pixelSizeFactor * (5) radius: ScreenTools.defaultFontPixelSize * (0.42)
border.color: Qt.rgba(1,1,1,0.25) border.color: Qt.rgba(1,1,1,0.25)
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) } GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) }
...@@ -49,7 +49,7 @@ Rectangle { ...@@ -49,7 +49,7 @@ Rectangle {
} }
Rectangle { Rectangle {
id: clipRect id: clipRect
height: parent.height - ScreenTools.pixelSizeFactor * (5) height: parent.height - ScreenTools.defaultFontPixelSize * (0.42)
width: parent.width width: parent.width
clip: true clip: true
color: Qt.rgba(0,0,0,0); color: Qt.rgba(0,0,0,0);
...@@ -63,14 +63,14 @@ Rectangle { ...@@ -63,14 +63,14 @@ Rectangle {
model: 40 model: 40
Rectangle { Rectangle {
property int _speed: -(index - 20) property int _speed: -(index - 20)
width: (_speed % 5 === 0) ? ScreenTools.pixelSizeFactor * (10) : ScreenTools.pixelSizeFactor * (15) width: (_speed % 5 === 0) ? ScreenTools.defaultFontPixelSize * (0.83) : ScreenTools.defaultFontPixelSize * (1.25)
anchors.right: parent.right anchors.right: parent.right
height: _reticleHeight height: _reticleHeight
color: Qt.rgba(1,1,1,0.35) color: Qt.rgba(1,1,1,0.35)
QGCLabel { QGCLabel {
visible: (_speed % 5 === 0) visible: (_speed % 5 === 0)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenterOffset: ScreenTools.pixelSizeFactor * (-30) anchors.horizontalCenterOffset: ScreenTools.defaultFontPixelSize * (-2.5)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
antialiasing: true antialiasing: true
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine> #include <QQmlEngine>
#include "MainToolBar.h" #include "MainToolBar.h"
#include "ScreenTools.h" #include "ScreenToolsController.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "UASMessageView.h" #include "UASMessageView.h"
#include "UASMessageHandler.h" #include "UASMessageHandler.h"
...@@ -64,8 +64,8 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -64,8 +64,8 @@ MainToolBar::MainToolBar(QWidget* parent)
if(pl) { if(pl) {
pl->setContentsMargins(0,0,0,0); pl->setContentsMargins(0,0,0,0);
} }
setMinimumHeight(40 * ScreenTools::pixelSizeFactor_s()); setMinimumHeight(ScreenToolsController::defaultFontPixelSize_s() * 3);
setMaximumHeight(40 * ScreenTools::pixelSizeFactor_s()); setMaximumHeight(ScreenToolsController::defaultFontPixelSize_s() * 3);
// Tool Bar Preferences // Tool Bar Preferences
QSettings settings; QSettings settings;
settings.beginGroup(TOOL_BAR_SETTINGS_GROUP); settings.beginGroup(TOOL_BAR_SETTINGS_GROUP);
......
...@@ -197,7 +197,7 @@ Rectangle { ...@@ -197,7 +197,7 @@ Rectangle {
visible: !ScreenTools.isMobile visible: !ScreenTools.isMobile
Connections { Connections {
target: ScreenTools target: ScreenTools
onRepaintRequestedChanged: { onRepaintRequested: {
setupButton.repaintChevron = true; setupButton.repaintChevron = true;
planButton.repaintChevron = true; planButton.repaintChevron = true;
flyButton.repaintChevron = true; flyButton.repaintChevron = true;
...@@ -338,7 +338,7 @@ Rectangle { ...@@ -338,7 +338,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: messageText id: messageText
text: (MavManager.messageCount > 0) ? MavManager.messageCount : '' text: (MavManager.messageCount > 0) ? MavManager.messageCount : ''
font.pixelSize: ScreenTools.font14 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
...@@ -424,7 +424,7 @@ Rectangle { ...@@ -424,7 +424,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: satelitteText id: satelitteText
text: MavManager.satelliteCount >= 0 ? MavManager.satelliteCount : 'NA' text: MavManager.satelliteCount >= 0 ? MavManager.satelliteCount : 'NA'
font.pixelSize: MavManager.satelliteCount >= 0 ? ScreenTools.font14 : ScreenTools.font10 font.pixelSize: MavManager.satelliteCount >= 0 ? ScreenTools.defaultFontPixelSize : ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
...@@ -459,7 +459,7 @@ Rectangle { ...@@ -459,7 +459,7 @@ Rectangle {
anchors.rightMargin: getProportionalDimmension(6) anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font12 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -492,7 +492,7 @@ Rectangle { ...@@ -492,7 +492,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
QGCLabel { QGCLabel {
text: 'R ' text: 'R '
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -500,7 +500,7 @@ Rectangle { ...@@ -500,7 +500,7 @@ Rectangle {
text: mainToolBar.telemetryRRSSI + 'dB' text: mainToolBar.telemetryRRSSI + 'dB'
width: getProportionalDimmension(30) width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -509,7 +509,7 @@ Rectangle { ...@@ -509,7 +509,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
QGCLabel { QGCLabel {
text: 'L ' text: 'L '
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -517,7 +517,7 @@ Rectangle { ...@@ -517,7 +517,7 @@ Rectangle {
text: mainToolBar.telemetryLRSSI + 'dB' text: mainToolBar.telemetryLRSSI + 'dB'
width: getProportionalDimmension(30) width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -548,7 +548,7 @@ Rectangle { ...@@ -548,7 +548,7 @@ Rectangle {
QGCLabel { QGCLabel {
visible: batteryStatus.visible && MavManager.batteryConsumed < 0.0 visible: batteryStatus.visible && MavManager.batteryConsumed < 0.0
text: MavManager.batteryVoltage.toFixed(1) + 'V'; text: MavManager.batteryVoltage.toFixed(1) + 'V';
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6) anchors.rightMargin: getProportionalDimmension(6)
...@@ -566,7 +566,7 @@ Rectangle { ...@@ -566,7 +566,7 @@ Rectangle {
text: MavManager.batteryVoltage.toFixed(1) + 'V'; text: MavManager.batteryVoltage.toFixed(1) + 'V';
width: getProportionalDimmension(30) width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -574,7 +574,7 @@ Rectangle { ...@@ -574,7 +574,7 @@ Rectangle {
text: MavManager.batteryConsumed.toFixed(0) + 'mA'; text: MavManager.batteryConsumed.toFixed(0) + 'mA';
width: getProportionalDimmension(30) width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -599,7 +599,7 @@ Rectangle { ...@@ -599,7 +599,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: armedStatusText id: armedStatusText
text: (MavManager.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED") text: (MavManager.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED")
font.pixelSize: ScreenTools.font12 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.centerIn: parent anchors.centerIn: parent
color: (MavManager.systemArmed) ? colorOrangeText : colorGreenText color: (MavManager.systemArmed) ? colorOrangeText : colorGreenText
...@@ -618,7 +618,7 @@ Rectangle { ...@@ -618,7 +618,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: stateStatusText id: stateStatusText
text: MavManager.currentState text: MavManager.currentState
font.pixelSize: ScreenTools.font12 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.centerIn: parent anchors.centerIn: parent
color: (MavManager.currentState === "STANDBY") ? colorGreenText : colorRedText color: (MavManager.currentState === "STANDBY") ? colorGreenText : colorRedText
...@@ -639,7 +639,7 @@ Rectangle { ...@@ -639,7 +639,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: modeStatusText id: modeStatusText
text: MavManager.currentMode text: MavManager.currentMode
font.pixelSize: ScreenTools.font12 font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -660,7 +660,7 @@ Rectangle { ...@@ -660,7 +660,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: connectionStatusText id: connectionStatusText
text: qsTr("CONNECTION LOST") text: qsTr("CONNECTION LOST")
font.pixelSize: ScreenTools.font14 font.pixelSize: ScreenTools.defaultFontPixelSize
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
......
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