Commit 9c94295b authored by Don Gagne's avatar Don Gagne

Major font rework

Everything is now based off of default font pixel size
parent 890ea6ab
......@@ -267,7 +267,7 @@ HEADERS += \
src/QGCTemporaryFile.h \
src/QmlControls/MavManager.h \
src/QmlControls/ParameterEditorController.h \
src/QmlControls/ScreenTools.h \
src/QmlControls/ScreenToolsController.h \
src/uas/QGCMAVLinkUASFactory.h \
src/uas/FileManager.h \
src/uas/UAS.h \
......@@ -398,7 +398,7 @@ SOURCES += \
src/QGCTemporaryFile.cc \
src/QmlControls/MavManager.cc \
src/QmlControls/ParameterEditorController.cc \
src/QmlControls/ScreenTools.cc \
src/QmlControls/ScreenToolsController.cc \
src/uas/QGCMAVLinkUASFactory.cc \
src/uas/FileManager.cc \
src/uas/UAS.cc \
......
......@@ -15,7 +15,7 @@
<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/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/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
......@@ -26,6 +26,10 @@
<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/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/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
......
......@@ -972,8 +972,8 @@ Item {
spacing: 20
QGCLabel {
text: "FLIGHT MODES CONFIG"
font.pixelSize: ScreenTools.font20;
text: "FLIGHT MODES CONFIG"
font.pixelSize: ScreenTools.largeFontPixelSize
}
QGCLabel {
......
......@@ -179,7 +179,7 @@ QGCView {
antialiasing: true
Connections {
target: ScreenTools
onRepaintRequestedChanged: {
onRepaintRequested: {
arrows.requestPaint();
}
}
......@@ -269,7 +269,7 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Propeller Function"
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
width: parent.width
......@@ -282,7 +282,7 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Magnetometer Distortion"
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
width: parent.width
......@@ -300,9 +300,9 @@ QGCView {
text: "Show Advanced Settings"
}
QGCLabel {
text: "Advanced Power Settings"
font.pixelSize: ScreenTools.font20;
visible: showAdvanced.checked
text: "Advanced Power Settings"
font.pixelSize: ScreenTools.mediumFontPixelSize
visible: showAdvanced.checked
}
Rectangle {
width: parent.width
......
......@@ -405,16 +405,16 @@ QGCView {
color: qgcPal.windowShade
QGCLabel {
id: orientationCalAreaHelpText
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: ScreenTools.font22;
anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left
anchors.topMargin: 15
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.bottomMargin: 15
id: orientationCalAreaHelpText
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: ScreenTools.mediumFontPixelSize
anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left
anchors.topMargin: 15
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.bottomMargin: 15
}
Flow {
......
......@@ -69,13 +69,13 @@
#include "SensorsComponentController.h"
#include "PowerComponentController.h"
#include "RadioComponentController.h"
#include "ScreenToolsController.h"
#ifndef __mobile__
#include "FirmwareUpgradeController.h"
#endif
#include "AutoPilotPlugin.h"
#include "VehicleComponent.h"
#include "ScreenTools.h"
#include "MavManager.h"
#ifdef QGC_RTLAB_ENABLED
......@@ -104,10 +104,10 @@ const char* QGCApplication::_lightStyleFile = ":/res/styles/style-light.css";
* 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;
return screenTools;
ScreenToolsController* screenToolsController = new ScreenToolsController;
return screenToolsController;
}
/**
......@@ -261,6 +261,33 @@ void QGCApplication::_initCommon(void)
{
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
bool settingsUpgraded = false;
if (settings.contains(_settingsVersionKey)) {
......@@ -314,42 +341,6 @@ void QGCApplication::_initCommon(void)
}
qDebug() << "Saved files location" << 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)
......@@ -656,10 +647,12 @@ void QGCApplication::_loadCurrentStyle(void)
}
// Now that we have the styles loaded we need to adjust the font sizes.
QString fSmall = QString("%1px;").arg(ScreenTools::font10_s());
QString fNormal = QString("%1px;").arg(ScreenTools::defaultFontPizelSize_s());
QString fLarge = QString("%1px;").arg(ScreenTools::largeFontPixelSize_s());
QString fSmall = QString("%1px;").arg(ScreenToolsController::smallFontPixelSize_s());
QString fNormal = QString("%1px;").arg(ScreenToolsController::defaultFontPixelSize_s());
QString fLarge = QString("%1px;").arg(ScreenToolsController::largeFontPixelSize_s());
qDebug() << fSmall << fNormal << fLarge;
styles.replace("FONT_SMALL", fSmall);
styles.replace("FONT_NORMAL", fNormal);
......
......@@ -25,7 +25,6 @@
/// @author Don Gagne <don@thegagnes.com>
#include "QGCPalette.h"
#include "ScreenTools.h"
#include <QApplication>
#include <QPalette>
......
......@@ -63,10 +63,10 @@ QGCView {
x: __leftMargin
QGCLabel {
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
height: defaultTextHeight + (ScreenTools.defaultFontPizelSize * 0.5)
text: group
verticalAlignment: Text.AlignVCenter
font.pixelSize: ScreenTools.font16;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
......@@ -84,7 +84,7 @@ QGCView {
Item {
x: __leftMargin
width: parent.width
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
height: defaultTextHeight + (ScreenTools.defaultFontPixelSize * 0.5)
QGCLabel {
id: nameLabel
......@@ -142,7 +142,7 @@ QGCView {
height: firstButton.height
QGCLabel {
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.largeFontPixelSize
visible: fullMode
text: "PARAMETER EDITOR"
}
......@@ -199,10 +199,10 @@ QGCView {
readonly property int componentId: parseInt(modelData)
QGCLabel {
height: contentHeight + (ScreenTools.pixelSizeFactor * (9))
height: contentHeight + (ScreenTools.defaultFontPixelHeight * 0.5)
text: "Component #: " + componentId.toString()
verticalAlignment: Text.AlignVCenter
font.pixelSize: ScreenTools.font16;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Repeater {
......@@ -224,7 +224,7 @@ QGCView {
Item {
width: 1
height: ScreenTools.pixelSizeFactor * (3)
height: ScreenTools.defaultFontPixelSize * 0.25
}
} // Column - Group
} // Repeater - Groups
......
......@@ -26,12 +26,12 @@ Button {
Connections {
target: __behavior
onMouseXChanged: {
__lastGlobalMouseX = ScreenTools.mouseX
__lastGlobalMouseY = ScreenTools.mouseY
__lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY()
}
onMouseYChanged: {
__lastGlobalMouseX = ScreenTools.mouseX
__lastGlobalMouseY = ScreenTools.mouseY
__lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY()
}
onEntered: { __forceHoverOff; false; hoverTimer.start() }
onExited: { __forceHoverOff; false; hoverTimer.stop() }
......@@ -43,7 +43,7 @@ Button {
repeat: true
onTriggered: {
if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) {
if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) {
__forceHoverOff = true
} else {
__forceHoverOff = false
......@@ -104,7 +104,7 @@ Button {
id: text
antialiasing: true
text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
anchors.verticalCenter: parent.verticalCenter
......
......@@ -29,7 +29,7 @@ CheckBox {
id: text
text: control.text
antialiasing: true
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
anchors.centerIn: parent
......
......@@ -11,7 +11,7 @@ ComboBox {
property bool __showHighlight: pressed | hovered
style: ComboBoxStyle {
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
textColor: __showHighlight ?
control.__qgcPal.buttonHighlightText :
control.__qgcPal.buttonText
......
......@@ -10,7 +10,7 @@ Text {
property bool enabled: true
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
color: __qgcPal.text
antialiasing: true
}
......@@ -9,8 +9,8 @@ import QGroundControl.ScreenTools 1.0
Item {
id: root
property bool allowDragging: true
property real minimumWidth: ScreenTools.pixelSizeFactor * (60)
property real minimumHeight: ScreenTools.pixelSizeFactor * (60)
property real minimumWidth: ScreenTools.defaultFontPixelSize * (5)
property real minimumHeight: ScreenTools.defaultFontPixelSize * (5)
property alias tForm: tform
signal resetRequested()
transform: Scale {
......
......@@ -28,7 +28,7 @@ RadioButton {
Text {
id: text
text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true
anchors.centerIn: parent
......
......@@ -50,7 +50,7 @@ TextField {
width: unitsLabelWidthGenerator.width
text: control.unitsLabel
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true
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 @@
/// @file
/// @author Gus Grubba <mavlink@grubba.com>
#include "ScreenTools.h"
#include "ScreenToolsController.h"
#include "MainWindow.h"
// Pixel size, instead of a physical thing is actually a philosophical question when
// 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.
int ScreenToolsController::_qmlDefaultFontPixelSize = -1;
#if defined(Q_OS_OSX)
double ScreenTools::_pixelFactor = 1.0;
#elif defined(__ios__)
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
const double ScreenToolsController::_smallFontPixelSizeRatio = 0.75;
const double ScreenToolsController::_mediumFontPixelSizeRatio = 1.22;
const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66;
#if defined(__android__)
#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()
ScreenToolsController::ScreenToolsController()
{
MainWindow* mainWindow = MainWindow::instance();
// Unit tests can run Qml without MainWindow
if (mainWindow) {
connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas);
connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenToolsController::_updateCanvas);
}
}
qreal ScreenTools::adjustPixelSize(qreal pixelSize)
{
return adjustPixelSize_s(pixelSize);
}
qreal ScreenTools::adjustPixelSize_s(qreal pixelSize)
void ScreenToolsController::_updateCanvas()
{
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 @@
/// @file
/// @author Gus Grubba <mavlink@grubba.com>
#ifndef SCREENTOOLS_H
#define SCREENTOOLS_H
#ifndef ScreenToolsController_H
#define ScreenToolsController_H
#include <QObject>
#include "QGCApplication.h"
#include <QQuickItem>
#include <QCursor>
/*!
@brief Screen helper tools for QML widgets
To use its functions, you need to import the module with the following line:
@code
import QGroundControl.ScreenTools 1.0
@endcode
*/
/// This Qml control is used to return screen parameters
class ScreenTools : public QObject
class ScreenToolsController : public QQuickItem
{
Q_OBJECT
public:
ScreenTools();
ScreenToolsController();
Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT)
Q_PROPERTY(bool isiOS READ isiOS 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.
/*!
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:
repainted.
If you use a \c Canvas element inside some QML widget, you can use this code to handle repaint:
@code
import QGroundControl.ScreenTools 1.0
import QGroundControl.ScreenToolsController 1.0
...
Canvas {
id: myCanvas
height: 40
width: 40
Connections {
target: ScreenTools
target: ScreenToolsController
onRepaintRequestedChanged: {
myCanvas.requestPaint();
}
......@@ -80,87 +78,23 @@ public:
@endcode
*/
//! Font sizes
Q_PROPERTY(int font22 READ font22 CONSTANT)
Q_PROPERTY(int font21 READ font21 CONSTANT)
Q_PROPERTY(int font20 READ font20 CONSTANT)
Q_PROPERTY(int font19 READ font19 CONSTANT)
Q_PROPERTY(int font18 READ font18 CONSTANT)
Q_PROPERTY(int font17 READ font17 CONSTANT)
Q_PROPERTY(int font16 READ font16 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)
// Returns current mouse position
Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
// Used to calculate font sizes based on default font size
Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT)
Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT)
Q_PROPERTY(double largeFontPixelSizeRatio MEMBER _largeFontPixelSizeRatio CONSTANT)
//! Utility for adjusting pixel size. Not dynamic (no signals)
Q_INVOKABLE qreal adjustPixelSize(qreal pixelSize);
/// Static version of adjustPixelSize of use in C++ code
static qreal adjustPixelSize_s(qreal pixelSize);
int mouseX () { return QCursor::pos().x(); }
int mouseY () { return QCursor::pos().y(); }
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; }
Q_PROPERTY(double qmlDefaultFontPixelSize MEMBER _qmlDefaultFontPixelSize)
static double getQmlDefaultFontPixelSize(void);
static int defaultFontPixelSize_s() { return (int)getQmlDefaultFontPixelSize(); }
static int smallFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _smallFontPixelSizeRatio); }
static int mediumFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _mediumFontPixelSizeRatio); }
static int largeFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _largeFontPixelSizeRatio); }
#if defined (__android__)
bool isAndroid () { return true; }
......@@ -177,30 +111,17 @@ public:
#endif
signals:
void repaintRequestedChanged();
void repaintRequested(void);
private slots:
void _updateCanvas();
private:
// Font Sizes
static int _font8;
static int _font9;
static int _font10;
static int _font11;
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;
static const double _smallFontPixelSizeRatio;
static const double _mediumFontPixelSizeRatio;
static const double _largeFontPixelSizeRatio;
static int _qmlDefaultFontPixelSize;
};
#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 {
horizontalAlignment: TextEdit.AlignHCenter
text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true
color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
......
......@@ -70,7 +70,7 @@ Rectangle {
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
font.pixelSize: ScreenTools.font22;
font.pixelSize: ScreenTools.mediumFontPixelSize
font.bold: true
color: "black"
text: parent.calText
......@@ -80,7 +80,7 @@ Rectangle {
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
font.pixelSize: ScreenTools.font22;
font.pixelSize: ScreenTools.mediumFontPixelSize
color: calInProgress ? "yellow" : "white"
text: parent.calText
}
......
......@@ -74,7 +74,7 @@ QGCView {
QGCLabel {
text: "FIRMWARE UPDATE"
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.largeFontPixelSize
}
Item {
......@@ -177,7 +177,7 @@ QGCView {
height: 300
readOnly: true
frameVisible: false
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.")
......
......@@ -45,8 +45,8 @@ Rectangle {
anchors.fill: parent
QGCLabel {
text: "VEHICLE SUMMARY"
font.pixelSize: ScreenTools.font20;
text: "VEHICLE SUMMARY"
font.pixelSize: ScreenTools.largeFontPixelSize
}
Item {
......@@ -59,7 +59,7 @@ Rectangle {
width: parent.width
wrapMode: Text.WordWrap
color: setupComplete ? qgcPal.text : "red"
font.pixelSize: setupComplete ? ScreenTools.defaultFontPizelSize : ScreenTools.font20
font.pixelSize: setupComplete ? ScreenTools.defaultFontPixelSize : ScreenTools.mediumFontPixelSize
text: setupComplete ?
"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."
......
......@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine>
#include <QSettings>
#include "ScreenTools.h"
#include "ScreenToolsController.h"
#include "FlightDisplay.h"
#include "UASManager.h"
......@@ -48,8 +48,8 @@ FlightDisplay::FlightDisplay(QWidget *parent)
pl->setContentsMargins(0,0,0,0);
}
#ifndef __android__
setMinimumWidth( 380 * ScreenTools::pixelSizeFactor_s());
setMinimumHeight(400 * ScreenTools::pixelSizeFactor_s());
setMinimumWidth( 31 * ScreenToolsController::defaultFontPixelSize_s());
setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s());
#endif
setContextPropertyObject("flightDisplay", this);
setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml"));
......
......@@ -118,17 +118,17 @@ Item {
}
contentItem: Rectangle {
color: __qgcPal.window
implicitWidth: ScreenTools.pixelSizeFactor * (360)
implicitHeight: ScreenTools.pixelSizeFactor * (300)
implicitWidth: ScreenTools.defaultFontPixelSize * (30)
implicitHeight: ScreenTools.defaultFontPixelSize * (30)
Column {
id: dialogColumn
anchors.centerIn: parent
spacing: ScreenTools.adjustPixelSize(10)
spacing: ScreenTools.defaultFontPixelSize
width: parent.width
Grid {
columns: 2
spacing: ScreenTools.pixelSizeFactor * (8)
rowSpacing: ScreenTools.pixelSizeFactor * (10)
spacing: ScreenTools.defaultFontPixelSize * (0.66)
rowSpacing: ScreenTools.defaultFontPixelSize * (0.83)
anchors.horizontalCenter: parent.horizontalCenter
QGCCheckBox {
text: "Map Background"
......@@ -432,25 +432,25 @@ Item {
QGCHudMessage {
id: hudMessage
y: ScreenTools.pixelSizeFactor * (5)
y: ScreenTools.defaultFontPizelSize * (0.42)
width: (parent.width - 520 > 200) ? parent.width - 520 : 200
height: ScreenTools.pixelSizeFactor * (30)
height: ScreenTools.defaultFontPizelSize * (2.5)
anchors.horizontalCenter: parent.horizontalCenter
z: mapBackground.z + 1
}
QGCCompassInstrument {
id: compassInstrument
y: ScreenTools.pixelSizeFactor * (5)
x: ScreenTools.pixelSizeFactor * (85)
size: ScreenTools.pixelSizeFactor * (160)
y: ScreenTools.defaultFontPixelSize * (0.42)
x: ScreenTools.defaultFontPixelSize * (7.1)
size: ScreenTools.defaultFontPixelSize * (13.3)
heading: isNaN(MavManager.heading) ? 0 : MavManager.heading
visible: mapBackground.visible && showCompass
z: mapBackground.z + 2
onResetRequested: {
y = ScreenTools.pixelSizeFactor * (5)
x = ScreenTools.pixelSizeFactor * (85)
size = ScreenTools.pixelSizeFactor * (160)
y = ScreenTools.defaultFontPixelSize * (0.42)
x = ScreenTools.defaultFontPixelSize * (7.1)
size = ScreenTools.defaultFontPixelSize * (13.3)
tForm.xScale = 1
tForm.yScale = 1
}
......@@ -458,20 +458,20 @@ Item {
QGCAttitudeInstrument {
id: attitudeInstrument
y: ScreenTools.pixelSizeFactor * (5)
size: ScreenTools.pixelSizeFactor * (160)
y: ScreenTools.defaultFontPixelSize * (0.42)
size: ScreenTools.defaultFontPixelSize * (13.3)
rollAngle: roll
pitchAngle: pitch
showPitch: showPitchIndicator
visible: mapBackground.visible && showAttitudeIndicator
anchors.right: root.right
anchors.rightMargin: ScreenTools.pixelSizeFactor * (85)
anchors.rightMargin: ScreenTools.defaultFontPixelSize * (7.1)
z: mapBackground.z + 2
onResetRequested: {
y = ScreenTools.pixelSizeFactor * (5)
y = ScreenTools.defaultFontPixelSize * (0.42)
anchors.right = root.right
anchors.rightMargin = ScreenTools.pixelSizeFactor * (85)
size = ScreenTools.pixelSizeFactor * (160)
anchors.rightMargin = ScreenTools.defaultFontPixelSize * (7.1)
size = ScreenTools.defaultFontPixelSize * (13.3)
tForm.xScale = 1
tForm.yScale = 1
}
......@@ -490,8 +490,8 @@ Item {
rollAngle: roll
pitchAngle: pitch
visible: !mapBackground.visible && showAttitudeIndicator
width: ScreenTools.pixelSizeFactor * (260)
height: ScreenTools.pixelSizeFactor * (260)
width: ScreenTools.defaultFontPixelSize * (21.7)
height: ScreenTools.defaultFontPixelSize * (21.7)
z: 20
}
......@@ -502,15 +502,15 @@ Item {
pitchAngle: pitch
rollAngle: roll
color: Qt.rgba(0,0,0,0)
size: ScreenTools.pixelSizeFactor * (120)
size: ScreenTools.defaultFontPixelSize * (10)
z: 30
}
QGCAltitudeWidget {
id: altitudeWidget
anchors.right: parent.right
width: ScreenTools.pixelSizeFactor * (60)
height: parent.height * 0.65 > ScreenTools.pixelSizeFactor * (280) ? ScreenTools.pixelSizeFactor * (280) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
altitude: MavManager.altitudeWGS84
z: 30
}
......@@ -518,8 +518,8 @@ Item {
QGCSpeedWidget {
id: speedWidget
anchors.left: parent.left
width: ScreenTools.pixelSizeFactor * (60)
height: parent.height * 0.65 > ScreenTools.pixelSizeFactor * (280) ? ScreenTools.pixelSizeFactor * (280) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: MavManager.groundSpeed
z: 40
}
......@@ -527,7 +527,7 @@ Item {
QGCCurrentSpeed {
id: currentSpeed
anchors.left: parent.left
width: ScreenTools.pixelSizeFactor * (75)
width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: MavManager.airSpeed
groundspeed: MavManager.groundSpeed
showAirSpeed: true
......@@ -539,7 +539,7 @@ Item {
QGCCurrentAltitude {
id: currentAltitude
anchors.right: parent.right
width: ScreenTools.pixelSizeFactor * (75)
width: ScreenTools.defaultFontPixelSize * (6.25)
altitude: MavManager.altitudeWGS84
vertZ: MavManager.climbRate
showAltitude: true
......@@ -551,9 +551,9 @@ Item {
QGCCompass {
id: compassIndicator
y: root.height * 0.7
x: root.width * 0.5 - ScreenTools.pixelSizeFactor * (60)
width: ScreenTools.pixelSizeFactor * (120)
height: ScreenTools.pixelSizeFactor * (120)
x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5)
width: ScreenTools.defaultFontPixelSize * (10)
height: ScreenTools.defaultFontPixelSize * (10)
heading: isNaN(MavManager.heading) ? 0 : MavManager.heading
visible: !mapBackground.visible && showCompass
z: 70
......
......@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine>
#include <QSettings>
#include "ScreenTools.h"
#include "ScreenToolsController.h"
#include "QGCMapDisplay.h"
#include "UASManager.h"
......@@ -48,8 +48,8 @@ QGCMapDisplay::QGCMapDisplay(QWidget *parent)
pl->setContentsMargins(0,0,0,0);
}
#ifndef __android__
setMinimumWidth( 380 * ScreenTools::pixelSizeFactor_s());
setMinimumHeight(400 * ScreenTools::pixelSizeFactor_s());
setMinimumWidth( 32 * ScreenToolsController::defaultFontPixelSize_s());
setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s());
#endif
setContextPropertyObject("mapEngine", this);
setSource(QUrl::fromUserInput("qrc:/qml/MapDisplay.qml"));
......
......@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0
Rectangle {
id: root
property real altitude: 50
property real _reticleSpacing: ScreenTools.pixelSizeFactor * (16)
property real _reticleHeight: ScreenTools.pixelSizeFactor * (2)
property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (1.33)
property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166)
property real _reticleSlot: _reticleSpacing + _reticleHeight
property var _speedArray: []
property int _currentCenter: 0
......@@ -64,7 +64,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
smooth: true
radius: ScreenTools.pixelSizeFactor * (5)
radius: ScreenTools.defaultFontPixelSize * (0.42)
border.color: Qt.rgba(1,1,1,0.25)
gradient: Gradient {
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) }
......@@ -73,7 +73,7 @@ Rectangle {
}
Rectangle {
id: clipRect
height: parent.height - ScreenTools.pixelSizeFactor * (5)
height: parent.height - ScreenTools.defaultFontPixelSize * (0.42)
width: parent.width
clip: true
color: Qt.rgba(0,0,0,0);
......@@ -88,12 +88,12 @@ Rectangle {
anchors.left: parent.left
Rectangle {
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
color: Qt.rgba(1,1,1,0.35)
QGCLabel {
visible: (_alt % 10 === 0)
x: ScreenTools.pixelSizeFactor * (20)
x: ScreenTools.defaultFontPixelSize * (1.66)
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
font.weight: Font.DemiBold
......
......@@ -58,8 +58,8 @@ Item {
}
Rectangle {
anchors.centerIn: compass
width: ScreenTools.pixelSizeFactor * (40)
height: ScreenTools.pixelSizeFactor * (25)
width: ScreenTools.defaultFontPixelSize * (3.33)
height: ScreenTools.defaultFontPixelSize * (2.08)
border.color: Qt.rgba(1,1,1,0.15)
color: Qt.rgba(0,0,0,0.25)
QGCLabel {
......
......@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0
QGCMovableItem {
id: root
property real heading: 0
property real size: ScreenTools.pixelSizeFactor * (120)
property int _fontSize: ScreenTools.font12
property real size: ScreenTools.defaultFontPixelSize * (10)
property int _fontSize: ScreenTools.defaultFontPixelSize
width: size
height: size
Rectangle {
......
......@@ -39,13 +39,13 @@ Rectangle {
property bool showClimbRate: true
anchors.verticalCenter: parent.verticalCenter
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"
border.color: Qt.rgba(1,1,1,0.25)
opacity: 1.0
Column{
anchors.centerIn: parent
spacing: ScreenTools.pixelSizeFactor * (4)
spacing: ScreenTools.defaultFontPixelSize * (0.33)
QGCLabel {
text: 'h: ' + altitude.toFixed(0)
font.weight: Font.DemiBold
......
......@@ -39,13 +39,13 @@ Rectangle {
property bool showGroundSpeed: true
anchors.verticalCenter: parent.verticalCenter
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"
border.color: Qt.rgba(1,1,1,0.25)
opacity: 1.0
Column{
anchors.centerIn: parent
spacing: ScreenTools.pixelSizeFactor * (4)
spacing: ScreenTools.defaultFontPixelSize * (0.33)
QGCLabel {
text: 'GS: ' + groundspeed.toFixed(0)
font.weight: Font.DemiBold
......
......@@ -307,9 +307,9 @@ Item {
z: 1000
anchors {
bottom: parent.bottom;
bottomMargin: ScreenTools.pixelSizeFactor * (15)
rightMargin: ScreenTools.pixelSizeFactor * (20)
leftMargin: ScreenTools.pixelSizeFactor * (20)
bottomMargin: ScreenTools.defaultFontPixelSize * (1.25)
rightMargin: ScreenTools.defaultFontPixelSize * (1.66)
leftMargin: ScreenTools.defaultFontPixelSize * (1.66)
left: parent.left
}
width: parent.width - anchors.rightMargin - anchors.leftMargin
......@@ -330,9 +330,9 @@ Item {
opacity: 1
anchors {
bottom: zoomSlider.top;
bottomMargin: ScreenTools.pixelSizeFactor * (8);
bottomMargin: ScreenTools.defaultFontPixelSize * (0.66);
left: zoomSlider.left
leftMargin: ScreenTools.pixelSizeFactor * (4)
leftMargin: ScreenTools.defaultFontPixelSize * (0.33)
}
Image {
id: scaleImageLeft
......@@ -359,7 +359,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.bottomMargin: ScreenTools.pixelSizeFactor * (10)
anchors.bottomMargin: ScreenTools.defaultFontPixelSize * (0.83)
text: "0 m"
}
Component.onCompleted: {
......
......@@ -23,12 +23,12 @@ Button {
Connections {
target: __behavior
onMouseXChanged: {
__lastGlobalMouseX = ScreenTools.mouseX
__lastGlobalMouseY = ScreenTools.mouseY
__lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY()
}
onMouseYChanged: {
__lastGlobalMouseX = ScreenTools.mouseX
__lastGlobalMouseY = ScreenTools.mouseY
__lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY()
}
onEntered: { __forceHoverOff; false; hoverTimer.start() }
onExited: { __forceHoverOff; false; hoverTimer.stop() }
......@@ -39,7 +39,7 @@ Button {
interval: 250
repeat: true
onTriggered: {
if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) {
if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) {
__forceHoverOff = true
} else {
__forceHoverOff = false
......
......@@ -40,10 +40,10 @@ Rectangle {
property real _reticleSlot: _reticleSpacing + _reticleHeight
property real _longDash: size * 0.40
property real _shortDash: size * 0.25
property real _fontSize: ScreenTools.font11
property real _fontSize: ScreenTools.defaultFontPixelSize
height: size * 0.9
width: size
radius: ScreenTools.pixelSizeFactor * (8)
radius: ScreenTools.defaultFontPixelSize * (0.66)
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
clip: true
......
......@@ -52,15 +52,15 @@ Item {
Rectangle {
anchors.fill: parent
radius: ScreenTools.pixelSizeFactor * (6)
radius: ScreenTools.defaultFontPixelSize * (0.5)
color: Qt.rgba(0,0,0,0.65);
}
Rectangle {
anchors.left: parent.left
anchors.leftMargin: ScreenTools.pixelSizeFactor * (4)
radius: ScreenTools.pixelSizeFactor * (4)
height: ScreenTools.pixelSizeFactor * (4)
anchors.leftMargin: ScreenTools.defaultFontPixelSize * (0.33)
radius: ScreenTools.defaultFontPixelSize * (0.33)
height: ScreenTools.defaultFontPixelSize * (0.33)
width: handle.x - x
color: "#69bb17"
anchors.verticalCenter: parent.verticalCenter
......@@ -69,14 +69,14 @@ Item {
Rectangle {
id: labelRect
width: label.width
height: label.height + ScreenTools.pixelSizeFactor * (4)
radius: ScreenTools.pixelSizeFactor * (4)
height: label.height + ScreenTools.defaultFontPixelSize * (0.33)
radius: ScreenTools.defaultFontPixelSize * (0.33)
smooth: true
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);
anchors.bottom: handle.top
anchors.bottomMargin: ScreenTools.pixelSizeFactor * (4)
anchors.bottomMargin: ScreenTools.defaultFontPixelSize * (0.33)
visible: mouseRegion.pressed
x: Math.max(Math.min(handle.x + (handle.width - width ) / 2, slider.width - width), 0)
QGCLabel{
......@@ -93,7 +93,7 @@ Item {
Rectangle {
id: handle;
smooth: true
width: ScreenTools.pixelSizeFactor * (26);
width: ScreenTools.defaultFontPixelSize * (2.16);
y: (slider.height - height) / 2;
x: (slider.value - slider.minimum) * slider.length / (slider.maximum - slider.minimum)
......
......@@ -34,13 +34,13 @@ import QGroundControl.Controls 1.0
Rectangle {
id: root
property real speed: 0
property real _reticleSpacing: ScreenTools.pixelSizeFactor * (10)
property real _reticleHeight: ScreenTools.pixelSizeFactor * (2)
property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (0.83)
property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166)
property real _reticleSlot: _reticleSpacing + _reticleHeight
anchors.verticalCenter: parent.verticalCenter
z:10
smooth: true
radius: ScreenTools.pixelSizeFactor * (5)
radius: ScreenTools.defaultFontPixelSize * (0.42)
border.color: Qt.rgba(1,1,1,0.25)
gradient: Gradient {
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) }
......@@ -49,7 +49,7 @@ Rectangle {
}
Rectangle {
id: clipRect
height: parent.height - ScreenTools.pixelSizeFactor * (5)
height: parent.height - ScreenTools.defaultFontPixelSize * (0.42)
width: parent.width
clip: true
color: Qt.rgba(0,0,0,0);
......@@ -63,14 +63,14 @@ Rectangle {
model: 40
Rectangle {
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
height: _reticleHeight
color: Qt.rgba(1,1,1,0.35)
QGCLabel {
visible: (_speed % 5 === 0)
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenterOffset: ScreenTools.pixelSizeFactor * (-30)
anchors.horizontalCenterOffset: ScreenTools.defaultFontPixelSize * (-2.5)
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
font.weight: Font.DemiBold
......
......@@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine>
#include "MainToolBar.h"
#include "ScreenTools.h"
#include "ScreenToolsController.h"
#include "MainWindow.h"
#include "UASMessageView.h"
#include "UASMessageHandler.h"
......@@ -64,8 +64,8 @@ MainToolBar::MainToolBar(QWidget* parent)
if(pl) {
pl->setContentsMargins(0,0,0,0);
}
setMinimumHeight(40 * ScreenTools::pixelSizeFactor_s());
setMaximumHeight(40 * ScreenTools::pixelSizeFactor_s());
setMinimumHeight(ScreenToolsController::defaultFontPixelSize_s() * 3);
setMaximumHeight(ScreenToolsController::defaultFontPixelSize_s() * 3);
// Tool Bar Preferences
QSettings settings;
settings.beginGroup(TOOL_BAR_SETTINGS_GROUP);
......
......@@ -197,7 +197,7 @@ Rectangle {
visible: !ScreenTools.isMobile
Connections {
target: ScreenTools
onRepaintRequestedChanged: {
onRepaintRequested: {
setupButton.repaintChevron = true;
planButton.repaintChevron = true;
flyButton.repaintChevron = true;
......@@ -338,7 +338,7 @@ Rectangle {
QGCLabel {
id: messageText
text: (MavManager.messageCount > 0) ? MavManager.messageCount : ''
font.pixelSize: ScreenTools.font14
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
......@@ -424,7 +424,7 @@ Rectangle {
QGCLabel {
id: satelitteText
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
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
......@@ -459,7 +459,7 @@ Rectangle {
anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font12
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -492,7 +492,7 @@ Rectangle {
anchors.right: parent.right
QGCLabel {
text: 'R '
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -500,7 +500,7 @@ Rectangle {
text: mainToolBar.telemetryRRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -509,7 +509,7 @@ Rectangle {
anchors.right: parent.right
QGCLabel {
text: 'L '
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -517,7 +517,7 @@ Rectangle {
text: mainToolBar.telemetryLRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -548,7 +548,7 @@ Rectangle {
QGCLabel {
visible: batteryStatus.visible && MavManager.batteryConsumed < 0.0
text: MavManager.batteryVoltage.toFixed(1) + 'V';
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
......@@ -566,7 +566,7 @@ Rectangle {
text: MavManager.batteryVoltage.toFixed(1) + 'V';
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -574,7 +574,7 @@ Rectangle {
text: MavManager.batteryConsumed.toFixed(0) + 'mA';
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.font11
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -599,7 +599,7 @@ Rectangle {
QGCLabel {
id: armedStatusText
text: (MavManager.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED")
font.pixelSize: ScreenTools.font12
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.centerIn: parent
color: (MavManager.systemArmed) ? colorOrangeText : colorGreenText
......@@ -618,7 +618,7 @@ Rectangle {
QGCLabel {
id: stateStatusText
text: MavManager.currentState
font.pixelSize: ScreenTools.font12
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.centerIn: parent
color: (MavManager.currentState === "STANDBY") ? colorGreenText : colorRedText
......@@ -639,7 +639,7 @@ Rectangle {
QGCLabel {
id: modeStatusText
text: MavManager.currentMode
font.pixelSize: ScreenTools.font12
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
......@@ -660,7 +660,7 @@ Rectangle {
QGCLabel {
id: connectionStatusText
text: qsTr("CONNECTION LOST")
font.pixelSize: ScreenTools.font14
font.pixelSize: ScreenTools.defaultFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
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