Commit e583798e authored by dogmaphobic's avatar dogmaphobic

Handling multi-platform sizing (fonts and pixels)

parent 209318de
...@@ -364,7 +364,7 @@ Item { ...@@ -364,7 +364,7 @@ Item {
QGCLabel { QGCLabel {
text: "FLIGHT MODES CONFIG" text: "FLIGHT MODES CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Item { height: 20; width: 10 } // spacer Item { height: 20; width: 10 } // spacer
...@@ -894,7 +894,7 @@ Item { ...@@ -894,7 +894,7 @@ Item {
QGCLabel { QGCLabel {
text: "FLIGHT MODES CONFIG" text: "FLIGHT MODES CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
QGCLabel { QGCLabel {
......
...@@ -98,13 +98,13 @@ Rectangle { ...@@ -98,13 +98,13 @@ Rectangle {
QGCLabel { QGCLabel {
text: "POWER CONFIG" text: "POWER CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
QGCLabel { QGCLabel {
text: "Battery" text: "Battery"
color: palette.text color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Rectangle { Rectangle {
...@@ -231,7 +231,7 @@ Rectangle { ...@@ -231,7 +231,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "Propeller Function" text: "Propeller Function"
color: palette.text color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
...@@ -245,7 +245,7 @@ Rectangle { ...@@ -245,7 +245,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "Magnetometer Distortion" text: "Magnetometer Distortion"
color: palette.text color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
...@@ -264,7 +264,7 @@ Rectangle { ...@@ -264,7 +264,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "Advanced Power Settings" text: "Advanced Power Settings"
color: palette.text color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
visible: showAdvanced.checked visible: showAdvanced.checked
} }
Rectangle { Rectangle {
......
...@@ -54,7 +54,7 @@ Rectangle { ...@@ -54,7 +54,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "SAFETY CONFIG" text: "SAFETY CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Item { height: 20; width: 10 } // spacer Item { height: 20; width: 10 } // spacer
...@@ -62,7 +62,7 @@ Rectangle { ...@@ -62,7 +62,7 @@ Rectangle {
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Return Home Triggers //-- Return Home Triggers
QGCLabel { text: "Triggers For Return Home"; color: palette.text; font.pointSize: screenTools.dpiAdjustedPointSize(20); } QGCLabel { text: "Triggers For Return Home"; color: palette.text; font.pointSize: screenTools.fontPointFactor * (20); }
Item { height: 10; width: 10 } // spacer Item { height: 10; width: 10 } // spacer
...@@ -121,7 +121,7 @@ Rectangle { ...@@ -121,7 +121,7 @@ Rectangle {
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Return Home Settings //-- Return Home Settings
QGCLabel { text: "Return Home Settings"; font.pointSize: screenTools.dpiAdjustedPointSize(20); } QGCLabel { text: "Return Home Settings"; font.pointSize: screenTools.fontPointFactor * (20); }
Item { height: 10; width: 10 } // spacer Item { height: 10; width: 10 } // spacer
...@@ -291,7 +291,7 @@ Rectangle { ...@@ -291,7 +291,7 @@ Rectangle {
QGCLabel { QGCLabel {
property Fact fact: Fact { name: "NAV_RCL_OBC" } property Fact fact: Fact { name: "NAV_RCL_OBC" }
width: parent.width width: parent.width
font.pointSize: screenTools.dpiAdjustedPointSize(14); font.pointSize: screenTools.fontPointFactor * (14);
text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply."; text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply.";
visible: fact.value !== 0 visible: fact.value !== 0
wrapMode: Text.Wrap wrapMode: Text.Wrap
...@@ -299,7 +299,7 @@ Rectangle { ...@@ -299,7 +299,7 @@ Rectangle {
QGCLabel { QGCLabel {
property Fact fact: Fact { name: "NAV_DLL_OBC" } property Fact fact: Fact { name: "NAV_DLL_OBC" }
width: parent.width width: parent.width
font.pointSize: screenTools.dpiAdjustedPointSize(14); font.pointSize: screenTools.fontPointFactor * (14);
text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply."; text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply.";
visible: fact.value !== 0 visible: fact.value !== 0
wrapMode: Text.Wrap wrapMode: Text.Wrap
......
...@@ -91,7 +91,7 @@ Rectangle { ...@@ -91,7 +91,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "SENSORS CONFIG" text: "SENSORS CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Item { height: 20; width: 10 } // spacer Item { height: 20; width: 10 } // spacer
......
...@@ -585,7 +585,7 @@ void QGCApplication::_loadCurrentStyle(void) ...@@ -585,7 +585,7 @@ void QGCApplication::_loadCurrentStyle(void)
QRegularExpressionMatch match = regex.match(line); QRegularExpressionMatch match = regex.match(line);
if (match.hasMatch()) { if (match.hasMatch()) {
//qDebug() << "found:" << line << match.captured(1); //qDebug() << "found:" << line << match.captured(1);
adjustedLine = QString("font-size: %1pt;").arg(ScreenTools::dpiAdjustedPointSize_s(match.captured(1).toDouble())); adjustedLine = QString("font-size: %1pt;").arg(ScreenTools::adjustFontPointSize_s(match.captured(1).toDouble()));
//qDebug() << "adjusted:" << adjustedLine; //qDebug() << "adjusted:" << adjustedLine;
} else { } else {
adjustedLine = line; adjustedLine = line;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include <QApplication> #include <QApplication>
#include <QPalette> #include <QPalette>
const qreal QGCPalette::_defaultFontPointSize = 12;
QList<QGCPalette*> QGCPalette::_paletteObjects; QList<QGCPalette*> QGCPalette::_paletteObjects;
QGCPalette::Theme QGCPalette::_theme = QGCPalette::Dark; QGCPalette::Theme QGCPalette::_theme = QGCPalette::Dark;
...@@ -134,7 +132,3 @@ void QGCPalette::_themeChanged(void) ...@@ -134,7 +132,3 @@ void QGCPalette::_themeChanged(void)
emit paletteChanged(); emit paletteChanged();
} }
qreal QGCPalette::dpiAdjustedDefaultFontPointSize(void)
{
return ScreenTools::dpiAdjustedPointSize_s(_defaultFontPointSize);
}
...@@ -83,10 +83,6 @@ class QGCPalette : public QObject ...@@ -83,10 +83,6 @@ class QGCPalette : public QObject
// Text color for TextFields // Text color for TextFields
Q_PROPERTY(QColor textFieldText READ textFieldText NOTIFY paletteChanged) Q_PROPERTY(QColor textFieldText READ textFieldText NOTIFY paletteChanged)
Q_PROPERTY(qreal defaultFontPointSize MEMBER _defaultFontPointSize CONSTANT)
Q_PROPERTY(qreal dpiAdjustedDefaultFontPointSize READ dpiAdjustedDefaultFontPointSize CONSTANT)
public: public:
enum ColorGroup { enum ColorGroup {
Disabled = 0, Disabled = 0,
...@@ -123,9 +119,7 @@ public: ...@@ -123,9 +119,7 @@ public:
static Theme globalTheme(void) { return _theme; } static Theme globalTheme(void) { return _theme; }
static void setGlobalTheme(Theme newTheme); static void setGlobalTheme(Theme newTheme);
qreal dpiAdjustedDefaultFontPointSize(void);
signals: signals:
void paletteChanged(void); void paletteChanged(void);
...@@ -155,8 +149,6 @@ private: ...@@ -155,8 +149,6 @@ private:
static QColor _textField[_cThemes][_cColorGroups]; static QColor _textField[_cThemes][_cColorGroups];
static QColor _textFieldText[_cThemes][_cColorGroups]; static QColor _textFieldText[_cThemes][_cColorGroups];
static const qreal _defaultFontPointSize;
void _themeChanged(void); void _themeChanged(void);
static QList<QGCPalette*> _paletteObjects; ///< List of all active QGCPalette objects static QList<QGCPalette*> _paletteObjects; ///< List of all active QGCPalette objects
......
...@@ -182,7 +182,7 @@ property Fact __propertiesDialogFact: Fact { } ...@@ -182,7 +182,7 @@ property Fact __propertiesDialogFact: Fact { }
QGCLabel { QGCLabel {
text: "Component #: " + componentId.toString() text: "Component #: " + componentId.toString()
font.pointSize: __screenTools.dpiAdjustedPointSize(__qgcPal.defaultFontPointSize + 4); font.pointSize: __screenTools.fontPointFactor * (16);
} }
Item { Item {
...@@ -214,7 +214,7 @@ property Fact __propertiesDialogFact: Fact { } ...@@ -214,7 +214,7 @@ property Fact __propertiesDialogFact: Fact { }
x: __leftMargin x: __leftMargin
text: modelData text: modelData
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.pointSize: __screenTools.dpiAdjustedPointSize(__qgcPal.defaultFontPointSize + 2); font.pointSize: __screenTools.fontPointFactor * (__qgcPal.defaultFontPointSize + 2);
} }
} }
......
...@@ -104,9 +104,9 @@ Button { ...@@ -104,9 +104,9 @@ Button {
Text { Text {
id: text id: text
renderType: Text.NativeRendering antialiasing: true
text: control.text text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: __screenTools.defaultFontPointSize
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
......
...@@ -3,9 +3,11 @@ import QtQuick.Controls 1.2 ...@@ -3,9 +3,11 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
CheckBox { CheckBox {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
style: CheckBoxStyle { style: CheckBoxStyle {
label: Item { label: Item {
...@@ -27,7 +29,8 @@ CheckBox { ...@@ -27,7 +29,8 @@ CheckBox {
Text { Text {
id: text id: text
text: control.text text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize antialiasing: true
font.pointSize: __screenTools.defaultFontPointSize
anchors.centerIn: parent anchors.centerIn: parent
......
...@@ -4,14 +4,15 @@ import QtQuick.Controls.Styles 1.2 ...@@ -4,14 +4,15 @@ import QtQuick.Controls.Styles 1.2
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
ComboBox { ComboBox {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
property bool __showHighlight: pressed | hovered property bool __showHighlight: pressed | hovered
style: ComboBoxStyle { style: ComboBoxStyle {
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: __screenTools.defaultFontPointSize
textColor: __showHighlight ? textColor: __showHighlight ?
control.__qgcPal.buttonHighlightText : control.__qgcPal.buttonHighlightText :
control.__qgcPal.buttonText control.__qgcPal.buttonText
......
...@@ -3,12 +3,15 @@ import QtQuick.Controls 1.2 ...@@ -3,12 +3,15 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Text { Text {
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled } QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
property bool enabled: true property bool enabled: true
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: __screenTools.defaultFontPointSize
color: __qgcPal.text color: __qgcPal.text
antialiasing: true
} }
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QGroundControl.ScreenTools 1.0
// This item can be dragged around within its parent. // This item can be dragged around within its parent.
// Double click issues a signal the parent can use to // Double click issues a signal the parent can use to
...@@ -7,9 +8,10 @@ import QtQuick.Controls 1.2 ...@@ -7,9 +8,10 @@ import QtQuick.Controls 1.2
Item { Item {
id: root id: root
property ScreenTools __screenTools: ScreenTools { }
property bool allowDragging: true property bool allowDragging: true
property real minimumWidth: 60 property real minimumWidth: __screenTools.pixelSizeFactor * (60)
property real minimumHeight: 60 property real minimumHeight: __screenTools.pixelSizeFactor * (60)
property alias tForm: tform property alias tForm: tform
signal resetRequested() signal resetRequested()
transform: Scale { transform: Scale {
......
...@@ -3,9 +3,11 @@ import QtQuick.Controls 1.2 ...@@ -3,9 +3,11 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
RadioButton { RadioButton {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
style: RadioButtonStyle { style: RadioButtonStyle {
label: Item { label: Item {
...@@ -27,7 +29,8 @@ RadioButton { ...@@ -27,7 +29,8 @@ RadioButton {
Text { Text {
id: text id: text
text: control.text text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: __screenTools.defaultFontPointSize
antialiasing: true
anchors.centerIn: parent anchors.centerIn: parent
......
...@@ -3,12 +3,14 @@ import QtQuick.Controls 1.2 ...@@ -3,12 +3,14 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
TextField { TextField {
property bool showUnits: false property bool showUnits: false
property string unitsLabel: "" property string unitsLabel: ""
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
textColor: __qgcPal.textFieldText textColor: __qgcPal.textFieldText
...@@ -17,6 +19,7 @@ TextField { ...@@ -17,6 +19,7 @@ TextField {
text: unitsLabel text: unitsLabel
width: contentWidth + ((parent.__contentHeight/3)*2) width: contentWidth + ((parent.__contentHeight/3)*2)
visible: false visible: false
antialiasing: true
} }
style: TextFieldStyle { style: TextFieldStyle {
...@@ -31,7 +34,6 @@ TextField { ...@@ -31,7 +34,6 @@ TextField {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
border.color: control.activeFocus ? "#47b" : "#999" border.color: control.activeFocus ? "#47b" : "#999"
color: __qgcPal.textField color: __qgcPal.textField
} }
...@@ -49,7 +51,8 @@ TextField { ...@@ -49,7 +51,8 @@ TextField {
width: unitsLabelWidthGenerator.width width: unitsLabelWidthGenerator.width
text: control.unitsLabel text: control.unitsLabel
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: __screenTools.defaultFontPointSize
antialiasing: true
color: control.textColor color: control.textColor
visible: control.showUnits visible: control.showUnits
......
...@@ -54,11 +54,10 @@ QGCButton { ...@@ -54,11 +54,10 @@ QGCButton {
} }
} }
} }
label: Label { label: QGCLabel {
text: button.text text: button.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: showHighlight ? __qgcPal.buttonHighlightText : (button.checked ? __qgcPal.primaryButtonText : __qgcPal.buttonText) color: showHighlight ? __qgcPal.buttonHighlightText : (button.checked ? __qgcPal.primaryButtonText : __qgcPal.buttonText)
} }
} }
......
...@@ -30,43 +30,82 @@ ...@@ -30,43 +30,82 @@
#include <QFont> #include <QFont>
#include <QFontMetrics> #include <QFontMetrics>
bool ScreenTools::_dpiFactorSet = false; const double ScreenTools::_defaultFontPointSize = 12;
double ScreenTools::_dotsPerInch = 96.0;
double ScreenTools::_dpiFactor = 72.0 / 96.0;
ScreenTools::ScreenTools() ScreenTools::ScreenTools()
{ {
connect(MainWindow::instance(), &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas); connect(MainWindow::instance(), &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas);
connect(MainWindow::instance(), &MainWindow::pixelSizeChanged, this, &ScreenTools::_updatePixelSize);
connect(MainWindow::instance(), &MainWindow::fontSizeChanged, this, &ScreenTools::_updateFontSize);
} }
qreal ScreenTools::dpiAdjustedPointSize(qreal pointSize) qreal ScreenTools::adjustFontPointSize(qreal pointSize)
{ {
return dpiAdjustedPointSize_s(pointSize); return adjustFontPointSize_s(pointSize);
} }
qreal ScreenTools::dpiAdjustedPointSize_s(qreal pointSize) qreal ScreenTools::adjustFontPointSize_s(qreal pointSize)
{ {
_setDpiFactor(); return pointSize * MainWindow::fontPointFactor();
return pointSize * _dpiFactor;
} }
void ScreenTools::_setDpiFactor(void) qreal ScreenTools::adjustPixelSize(qreal pixelSize)
{ {
if (!_dpiFactorSet) { return adjustPixelSize_s(pixelSize);
_dpiFactorSet = true; }
// Get screen DPI to manage font sizes on different platforms qreal ScreenTools::adjustPixelSize_s(qreal pixelSize)
QScreen *srn = QGuiApplication::primaryScreen(); {
if(srn && srn->logicalDotsPerInch() > 50.0) { return pixelSize * MainWindow::pixelSizeFactor();
_dotsPerInch = (double)srn->logicalDotsPerInch(); // Font point sizes are based on Mac 72dpi }
_dpiFactor = 72.0 / _dotsPerInch;
} else { void ScreenTools::increasePixelSize()
qWarning() << "System not reporting logical DPI, which is used to compute the appropriate font size. The default being used is 96dpi. If the text within buttons and UI elements are too big or too small, that's the reason."; {
} MainWindow::instance()->setPixelSizeFactor(MainWindow::pixelSizeFactor() + 0.025);
} }
void ScreenTools::decreasePixelSize()
{
MainWindow::instance()->setPixelSizeFactor(MainWindow::pixelSizeFactor() - 0.025);
}
void ScreenTools::increaseFontSize()
{
MainWindow::instance()->setFontSizeFactor(MainWindow::fontPointFactor() + 0.025);
}
void ScreenTools::decreaseFontSize()
{
MainWindow::instance()->setFontSizeFactor(MainWindow::fontPointFactor() - 0.025);
} }
void ScreenTools::_updateCanvas() void ScreenTools::_updateCanvas()
{ {
emit repaintRequestedChanged(); emit repaintRequestedChanged();
} }
void ScreenTools::_updatePixelSize()
{
emit pixelSizeFactorChanged();
}
void ScreenTools::_updateFontSize()
{
emit fontPointFactorChanged();
emit defaultFontPointSizeChanged();
}
double ScreenTools::fontPointFactor()
{
return MainWindow::fontPointFactor();
}
double ScreenTools::pixelSizeFactor()
{
return MainWindow::pixelSizeFactor();
}
double ScreenTools::defaultFontPointSize(void)
{
return _defaultFontPointSize * MainWindow::fontPointFactor();
}
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
@code @code
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
@endcode @endcode
@remark As for the screen density functions, QtQuick provides the \c Screen type (defined in QtQuick.Window)
but as of Qt 5.4 (QtQuick.Window 2.2), this only works if the main window is QtQuick. As QGC is primarily
a Qt application and only some of its UI elements are QLM widgets, this does not work. Hence, these function
defined here.
@sa <a href="http://doc.qt.io/qt-5/qml-qtquick-window-screen.html">Screen QML Type</a>
*/ */
/// This Qml control is used to return screen parameters /// This Qml control is used to return screen parameters
...@@ -50,32 +45,6 @@ class ScreenTools : public QObject ...@@ -50,32 +45,6 @@ class ScreenTools : public QObject
public: public:
ScreenTools(); ScreenTools();
//! Returns the screen density in Dots Per Inch
Q_PROPERTY(double screenDPI READ screenDPI CONSTANT)
//! Returns a factor used to calculate the font point size to use
/*!
When defining fonts in point size, as in:
@code
Text {
text: "Foo Bar"
font.pointSize: 14
}
@endcode
The size is device dependent. If you define this based on a screen set to 72dpi (Mac OS), once
this is displayed on a different screen with a different pixel density, such as 96dpi (Windows),
the text will be displayed in the wrong size.
Use \c dpiFactor to accomodate for these differences. All font point sizes are given in 72dpi
and \c dpiFactor returns a factor to use for adjusting it to the current target screen.
@code
import QGroundControl.ScreenTools 1.0
property ScreenTools screenTools: ScreenTools { }
Text {
text: "Foo Bar"
font.pointSize: 14 * screenTools.dpiFactor
}
@endcode
*/
Q_PROPERTY(double dpiFactor READ dpiFactor CONSTANT)
//! Returns the global mouse X position //! Returns the global mouse X position
Q_PROPERTY(int mouseX READ mouseX) Q_PROPERTY(int mouseX READ mouseX)
//! Returns the global mouse Y position //! Returns the global mouse Y position
...@@ -108,35 +77,55 @@ public: ...@@ -108,35 +77,55 @@ public:
} }
@endcode @endcode
*/ */
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
//! Utility for adjusting font point size. Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
/*! //! Returns the font point size factor
@sa dpiFactor Q_PROPERTY(double fontPointFactor READ fontPointFactor NOTIFY fontPointFactorChanged)
*/ //! Returns the pixel size factor
Q_INVOKABLE qreal dpiAdjustedPointSize(qreal pointSize); Q_PROPERTY(double pixelSizeFactor READ pixelSizeFactor NOTIFY pixelSizeFactorChanged)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(double defaultFontPointSize READ defaultFontPointSize NOTIFY defaultFontPointSizeChanged)
//! Utility for adjusting font point size. Not dynamic (no signals)
Q_INVOKABLE qreal adjustFontPointSize(qreal pointSize);
//! Utility for adjusting pixel size. Not dynamic (no signals)
Q_INVOKABLE qreal adjustPixelSize(qreal pixelSize);
//! Utility for increasing pixel size.
Q_INVOKABLE void increasePixelSize();
//! Utility for decreasing pixel size.
Q_INVOKABLE void decreasePixelSize();
//! Utility for increasing font size.
Q_INVOKABLE void increaseFontSize();
//! Utility for decreasing font size.
Q_INVOKABLE void decreaseFontSize();
/// Static version of adjustFontPointSize of use in C++ code
static qreal adjustFontPointSize_s(qreal pointSize);
/// Static version of adjustPixelSize of use in C++ code
static qreal adjustPixelSize_s(qreal pixelSize);
/// Static version of dpiAdjustedPointSize of use in C++ code
static qreal dpiAdjustedPointSize_s(qreal pointSize);
double screenDPI () { return _dotsPerInch; }
double dpiFactor () { return _dpiFactor; }
int mouseX () { return QCursor::pos().x(); } int mouseX () { return QCursor::pos().x(); }
int mouseY () { return QCursor::pos().y(); } int mouseY () { return QCursor::pos().y(); }
bool repaintRequested () { return true; } bool repaintRequested () { return true; }
double fontPointFactor ();
double pixelSizeFactor ();
double defaultFontPointSize(void);
signals: signals:
void repaintRequestedChanged(); void repaintRequestedChanged();
void pixelSizeFactorChanged();
void fontPointFactorChanged();
void defaultFontPointSizeChanged();
private slots: private slots:
void _updateCanvas(); void _updateCanvas();
void _updatePixelSize();
void _updateFontSize();
private: private:
static void _setDpiFactor(void); static const double _defaultFontPointSize;
static bool _dpiFactorSet;
static double _dotsPerInch;
static double _dpiFactor;
}; };
#endif #endif
...@@ -4,6 +4,7 @@ import QtQuick.Controls.Styles 1.2 ...@@ -4,6 +4,7 @@ import QtQuick.Controls.Styles 1.2
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Button { Button {
checkable: true checkable: true
...@@ -13,6 +14,7 @@ Button { ...@@ -13,6 +14,7 @@ Button {
property bool setupComplete: true property bool setupComplete: true
property bool setupIndicator: true property bool setupIndicator: true
property string imageResource: "subMenuButtonImage.png" property string imageResource: "subMenuButtonImage.png"
property ScreenTools __screenTools: ScreenTools { }
style: ButtonStyle { style: ButtonStyle {
id: buttonStyle id: buttonStyle
...@@ -39,7 +41,8 @@ Button { ...@@ -39,7 +41,8 @@ Button {
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
text: control.text text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: __screenTools.defaultFontPointSize
antialiasing: true
color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
Rectangle { Rectangle {
......
...@@ -71,7 +71,7 @@ Rectangle { ...@@ -71,7 +71,7 @@ Rectangle {
height: parent.height height: parent.height
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
font.pointSize: __screenTools.dpiAdjustedPointSize(25); font.pointSize: __screenTools.fontPointFactor * (25);
font.bold: true font.bold: true
color: "black" color: "black"
...@@ -82,7 +82,7 @@ Rectangle { ...@@ -82,7 +82,7 @@ Rectangle {
height: parent.height height: parent.height
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
font.pointSize: __screenTools.dpiAdjustedPointSize(25); font.pointSize: __screenTools.fontPointFactor * (25);
color: calInProgress ? "yellow" : "white" color: calInProgress ? "yellow" : "white"
text: parent.calText text: parent.calText
......
...@@ -51,7 +51,7 @@ Rectangle { ...@@ -51,7 +51,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "FIRMWARE UPDATE" text: "FIRMWARE UPDATE"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Item { Item {
...@@ -119,7 +119,7 @@ Rectangle { ...@@ -119,7 +119,7 @@ Rectangle {
height: 300 height: 300
readOnly: true readOnly: true
frameVisible: false frameVisible: false
font.pointSize: qgcPal.dpiAdjustedDefaultFontPointSize font.pointSize: screenTools.defaultFontPointSize
text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.") text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.")
......
...@@ -44,7 +44,7 @@ Rectangle { ...@@ -44,7 +44,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "PARAMETER EDITOR" text: "PARAMETER EDITOR"
font.pointSize: screenTools.dpiAdjustedPointSize(20) font.pointSize: screenTools.fontPointFactor * (20)
} }
Item { Item {
......
...@@ -47,7 +47,7 @@ Rectangle { ...@@ -47,7 +47,7 @@ Rectangle {
QGCLabel { QGCLabel {
text: "VEHICLE SUMMARY" text: "VEHICLE SUMMARY"
font.pointSize: screenTools.dpiAdjustedPointSize(20); font.pointSize: screenTools.fontPointFactor * (20);
} }
Item { Item {
...@@ -60,7 +60,7 @@ Rectangle { ...@@ -60,7 +60,7 @@ Rectangle {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: autopilot.setupComplete ? qgcPal.text : "red" color: autopilot.setupComplete ? qgcPal.text : "red"
font.pointSize: autopilot.setupComplete ? qgcPal.dpiAdjustedDefaultFontPointSize : screenTools.dpiAdjustedPointSize(20) font.pointSize: autopilot.setupComplete ? screenTools.defaultFontPointSize : screenTools.fontPointFactor * (20)
text: autopilot.setupComplete ? text: autopilot.setupComplete ?
"Below you will find a summary of the settings for your vehicle. To the left are the setup buttons for deatiled settings for each component." : "Below you will find a summary of the settings for your vehicle. To the left are the setup buttons for deatiled settings for each component." :
"WARNING: One or more of your vehicle's components require setup prior to flight. It will be shown with a red circular indicator below. " + "WARNING: One or more of your vehicle's components require setup prior to flight. It will be shown with a red circular indicator below. " +
......
...@@ -82,6 +82,26 @@ This file is part of the QGROUNDCONTROL project ...@@ -82,6 +82,26 @@ This file is part of the QGROUNDCONTROL project
#include "LogCompressor.h" #include "LogCompressor.h"
// Pixel size, instead of a physical thing is actually a philosophical question when
// it comes to Qt. Fonts are that and some heavy Kabalistic Voodoo added to the mix.
// 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)
double MainWindow::_pixelFactor = 1.0;
double MainWindow::_fontFactor = 1.0;
#elif defined(Q_OS_WIN)
double MainWindow::_pixelFactor = 0.86;
double MainWindow::_fontFactor = 0.63;
#elif defined(__android__)
double MainWindow::_pixelFactor = 2.0;
double MainWindow::_fontFactor = 1.23;
#elif defined(Q_OS_LINUX)
double MainWindow::_pixelFactor = 1.0;
double MainWindow::_fontFactor = 0.85;
#endif
/// The key under which the Main Window settings are saved /// The key under which the Main Window settings are saved
const char* MAIN_SETTINGS_GROUP = "QGC_MAINWINDOW"; const char* MAIN_SETTINGS_GROUP = "QGC_MAINWINDOW";
...@@ -226,6 +246,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) ...@@ -226,6 +246,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
emit initStatusChanged(tr("Restoring last view state"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); emit initStatusChanged(tr("Restoring last view state"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
// Restore the window setup // Restore the window setup
_loadCurrentViewState(); _loadCurrentViewState();
#ifndef __android__
// Restore the window position and size // Restore the window position and size
emit initStatusChanged(tr("Restoring last window size"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); emit initStatusChanged(tr("Restoring last window size"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
if (settings.contains(_getWindowGeometryKey())) if (settings.contains(_getWindowGeometryKey()))
...@@ -265,6 +287,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) ...@@ -265,6 +287,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// And that they will stay checked properly after user input // And that they will stay checked properly after user input
connect(_ui.actionFullscreen, &QAction::triggered, this, &MainWindow::fullScreenActionItemCallback); connect(_ui.actionFullscreen, &QAction::triggered, this, &MainWindow::fullScreenActionItemCallback);
connect(_ui.actionNormal, &QAction::triggered, this, &MainWindow::normalActionItemCallback); connect(_ui.actionNormal, &QAction::triggered, this, &MainWindow::normalActionItemCallback);
#endif
connect(_ui.actionStatusBar, &QAction::triggered, this, &MainWindow::showStatusBarCallback); connect(_ui.actionStatusBar, &QAction::triggered, this, &MainWindow::showStatusBarCallback);
// Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui // Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui
...@@ -295,6 +319,9 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) ...@@ -295,6 +319,9 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
if (!qgcApp()->runningUnitTests()) { if (!qgcApp()->runningUnitTests()) {
_ui.actionStatusBar->setChecked(_showStatusBar); _ui.actionStatusBar->setChecked(_showStatusBar);
showStatusBarCallback(_showStatusBar); showStatusBarCallback(_showStatusBar);
#ifdef __android__
menuBar()->hide();
#endif
show(); show();
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// TODO HACK // TODO HACK
...@@ -733,9 +760,11 @@ void MainWindow::loadSettings() ...@@ -733,9 +760,11 @@ void MainWindow::loadSettings()
// Why the screaming? // Why the screaming?
QSettings settings; QSettings settings;
settings.beginGroup(MAIN_SETTINGS_GROUP); settings.beginGroup(MAIN_SETTINGS_GROUP);
_autoReconnect = settings.value("AUTO_RECONNECT", _autoReconnect).toBool(); _autoReconnect = settings.value("AUTO_RECONNECT", _autoReconnect).toBool();
_lowPowerMode = settings.value("LOW_POWER_MODE", _lowPowerMode).toBool(); _lowPowerMode = settings.value("LOW_POWER_MODE", _lowPowerMode).toBool();
_showStatusBar = settings.value("SHOW_STATUSBAR", _showStatusBar).toBool(); _showStatusBar = settings.value("SHOW_STATUSBAR", _showStatusBar).toBool();
_fontFactor = settings.value("FONT_SIZE_FACTOR", _fontFactor).toDouble();
_pixelFactor = settings.value("PIXEL_SIZE_FACTOR", _pixelFactor).toDouble();
settings.endGroup(); settings.endGroup();
// Select the proper view. Default to the flight view or load the last one used if it's supported. // Select the proper view. Default to the flight view or load the last one used if it's supported.
VIEW_SECTIONS currentViewCandidate = (VIEW_SECTIONS) settings.value("CURRENT_VIEW", _currentView).toInt(); VIEW_SECTIONS currentViewCandidate = (VIEW_SECTIONS) settings.value("CURRENT_VIEW", _currentView).toInt();
...@@ -764,9 +793,11 @@ void MainWindow::storeSettings() ...@@ -764,9 +793,11 @@ void MainWindow::storeSettings()
{ {
QSettings settings; QSettings settings;
settings.beginGroup(MAIN_SETTINGS_GROUP); settings.beginGroup(MAIN_SETTINGS_GROUP);
settings.setValue("AUTO_RECONNECT", _autoReconnect); settings.setValue("AUTO_RECONNECT", _autoReconnect);
settings.setValue("LOW_POWER_MODE", _lowPowerMode); settings.setValue("LOW_POWER_MODE", _lowPowerMode);
settings.setValue("SHOW_STATUSBAR", _showStatusBar); settings.setValue("SHOW_STATUSBAR", _showStatusBar);
settings.setValue("FONT_SIZE_FACTOR", _fontFactor);
settings.setValue("PIXEL_SIZE_FACTOR", _pixelFactor);
settings.endGroup(); settings.endGroup();
settings.setValue(_getWindowGeometryKey(), saveGeometry()); settings.setValue(_getWindowGeometryKey(), saveGeometry());
...@@ -1319,6 +1350,22 @@ void MainWindow::_linkStateChange(LinkInterface*) ...@@ -1319,6 +1350,22 @@ void MainWindow::_linkStateChange(LinkInterface*)
emit repaintCanvas(); emit repaintCanvas();
} }
void MainWindow::setPixelSizeFactor(double size) {
if(size < 0.1) {
size = 0.1;
}
_pixelFactor = size;
emit pixelSizeChanged();
}
void MainWindow::setFontSizeFactor(double size) {
if(size < 0.1) {
size = 0.1;
}
_fontFactor = size;
emit fontSizeChanged();
}
#ifdef QGC_MOUSE_ENABLED_LINUX #ifdef QGC_MOUSE_ENABLED_LINUX
bool MainWindow::x11Event(XEvent *event) bool MainWindow::x11Event(XEvent *event)
{ {
......
...@@ -129,6 +129,15 @@ public: ...@@ -129,6 +129,15 @@ public:
QWidget* getCurrentViewWidget(void) { return _currentViewWidget; } QWidget* getCurrentViewWidget(void) { return _currentViewWidget; }
//! Returns the font point size factor
static double fontPointFactor() { return _fontFactor; }
//! Returns the pixel size factor
static double pixelSizeFactor() { return _pixelFactor; }
//! Sets pixel size factor
void setPixelSizeFactor(double size);
//! Sets font size factor
void setFontSizeFactor(double size);
public slots: public slots:
/** @brief Show the application settings */ /** @brief Show the application settings */
void showSettings(); void showSettings();
...@@ -202,6 +211,10 @@ signals: ...@@ -202,6 +211,10 @@ signals:
void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec);
/** Emitted when any the Canvas elements within QML wudgets need updating */ /** Emitted when any the Canvas elements within QML wudgets need updating */
void repaintCanvas(); void repaintCanvas();
/** Emitted when pixel size factor changes */
void pixelSizeChanged();
/** Emitted when pixel size factor changes */
void fontSizeChanged();
#ifdef QGC_MOUSE_ENABLED_LINUX #ifdef QGC_MOUSE_ENABLED_LINUX
/** @brief Forward X11Event to catch 3DMouse inputs */ /** @brief Forward X11Event to catch 3DMouse inputs */
...@@ -369,6 +382,9 @@ private: ...@@ -369,6 +382,9 @@ private:
QString _getWindowStateKey(); QString _getWindowStateKey();
QString _getWindowGeometryKey(); QString _getWindowGeometryKey();
// UI Dimension Factors
static double _pixelFactor;
static double _fontFactor;
}; };
......
This diff is collapsed.
...@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine> #include <QQmlEngine>
#include <QSettings> #include <QSettings>
#include "MainWindow.h"
#include "QGCFlightDisplay.h" #include "QGCFlightDisplay.h"
#include "UASManager.h" #include "UASManager.h"
...@@ -67,8 +68,10 @@ QGCFlightDisplay::QGCFlightDisplay(QWidget *parent) ...@@ -67,8 +68,10 @@ QGCFlightDisplay::QGCFlightDisplay(QWidget *parent)
if(pl) { if(pl) {
pl->setContentsMargins(0,0,0,0); pl->setContentsMargins(0,0,0,0);
} }
setMinimumWidth(380); #ifndef __android__
setMinimumHeight(360); setMinimumWidth( 380 * MainWindow::pixelSizeFactor());
setMinimumHeight(400 * MainWindow::pixelSizeFactor());
#endif
setContextPropertyObject("flightDisplay", this); setContextPropertyObject("flightDisplay", this);
setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml")); setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml"));
setVisible(true); setVisible(true);
......
...@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine> #include <QQmlEngine>
#include <QSettings> #include <QSettings>
#include "MainWindow.h"
#include "QGCMapDisplay.h" #include "QGCMapDisplay.h"
#include "UASManager.h" #include "UASManager.h"
...@@ -46,8 +47,10 @@ QGCMapDisplay::QGCMapDisplay(QWidget *parent) ...@@ -46,8 +47,10 @@ QGCMapDisplay::QGCMapDisplay(QWidget *parent)
if(pl) { if(pl) {
pl->setContentsMargins(0,0,0,0); pl->setContentsMargins(0,0,0,0);
} }
setMinimumWidth(270); #ifndef __android__
setMinimumHeight(300); setMinimumWidth( 380 * MainWindow::pixelSizeFactor());
setMinimumHeight(400 * MainWindow::pixelSizeFactor());
#endif
setContextPropertyObject("mapEngine", this); setContextPropertyObject("mapEngine", this);
setSource(QUrl::fromUserInput("qrc:/qml/MapDisplay.qml")); setSource(QUrl::fromUserInput("qrc:/qml/MapDisplay.qml"));
setVisible(true); setVisible(true);
......
...@@ -29,12 +29,14 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,12 +29,14 @@ This file is part of the QGROUNDCONTROL project
import QtQuick 2.4 import QtQuick 2.4
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Rectangle { Rectangle {
id: root id: root
property ScreenTools __screenTools: ScreenTools { }
property real altitude: 50 property real altitude: 50
property real _reticleSpacing: 16 property real _reticleSpacing: __screenTools.pixelSizeFactor * (16)
property real _reticleHeight: 2 property real _reticleHeight: __screenTools.pixelSizeFactor * (2)
property real _reticleSlot: _reticleSpacing + _reticleHeight property real _reticleSlot: _reticleSpacing + _reticleHeight
property var _speedArray: [] property var _speedArray: []
property int _currentCenter: 0 property int _currentCenter: 0
...@@ -62,9 +64,8 @@ Rectangle { ...@@ -62,9 +64,8 @@ Rectangle {
} }
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
height: parent.height * 0.65 > 280 ? 280 : parent.height * 0.65
smooth: true smooth: true
radius: 5 radius: __screenTools.pixelSizeFactor * (5)
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 +74,7 @@ Rectangle { ...@@ -73,7 +74,7 @@ Rectangle {
} }
Rectangle { Rectangle {
id: clipRect id: clipRect
height: parent.height - 5 height: parent.height - __screenTools.pixelSizeFactor * (5)
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 +89,12 @@ Rectangle { ...@@ -88,12 +89,12 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
Rectangle { Rectangle {
property int _alt: modelData property int _alt: modelData
width: (_alt % 10 === 0) ? 10 : 15 width: (_alt % 10 === 0) ? __screenTools.pixelSizeFactor * (10) : __screenTools.pixelSizeFactor * (15)
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: 20 x: __screenTools.pixelSizeFactor * (20)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
antialiasing: true antialiasing: true
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -32,10 +32,10 @@ import QGroundControl.Controls 1.0 ...@@ -32,10 +32,10 @@ import QGroundControl.Controls 1.0
QGCMovableItem { QGCMovableItem {
id: root id: root
property real rollAngle : 0 property real rollAngle: 0
property real pitchAngle: 0 property real pitchAngle: 0
property real size: 100
property bool showPitch: true property bool showPitch: true
property real size
width: size width: size
height: size height: size
...@@ -51,11 +51,9 @@ QGCMovableItem { ...@@ -51,11 +51,9 @@ QGCMovableItem {
Image { Image {
id: pointer id: pointer
source: "/qml/attitudePointer.svg" source: "/qml/attitudePointer.svg"
width: root.width
mipmap: true mipmap: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.bottom: parent.bottom anchors.fill: parent
anchors.horizontalCenter: parent.horizontalCenter
} }
//---------------------------------------------------- //----------------------------------------------------
//-- Instrument Dial //-- Instrument Dial
...@@ -63,10 +61,8 @@ QGCMovableItem { ...@@ -63,10 +61,8 @@ QGCMovableItem {
id: instrumentDial id: instrumentDial
source: "/qml/attitudeDial.svg" source: "/qml/attitudeDial.svg"
mipmap: true mipmap: true
width: root.width
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.bottom: parent.bottom anchors.fill: parent
anchors.horizontalCenter: parent.horizontalCenter
transform: Rotation { transform: Rotation {
origin.x: root.width / 2 origin.x: root.width / 2
origin.y: root.height / 2 origin.y: root.height / 2
...@@ -78,7 +74,7 @@ QGCMovableItem { ...@@ -78,7 +74,7 @@ QGCMovableItem {
QGCPitchWidget { QGCPitchWidget {
id: pitchWidget id: pitchWidget
visible: root.showPitch visible: root.showPitch
size: parent.width * 0.65 size: root.size * 0.65
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
pitchAngle: root.pitchAngle pitchAngle: root.pitchAngle
rollAngle: root.rollAngle rollAngle: root.rollAngle
...@@ -91,17 +87,16 @@ QGCMovableItem { ...@@ -91,17 +87,16 @@ QGCMovableItem {
anchors.centerIn: parent anchors.centerIn: parent
source: "/qml/crossHair.svg" source: "/qml/crossHair.svg"
mipmap: true mipmap: true
width: parent.width * 0.75 width: size * 0.75
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
//---------------------------------------------------- //----------------------------------------------------
//-- Instrument Pannel //-- Instrument Pannel
Image { Image {
id: pannel id: pannel
width: parent.width source: "/qml/attitudeInstrument.svg"
source: "/qml/attitudeInstrument.svg" mipmap: true
mipmap: true fillMode: Image.PreserveAspectFit
fillMode: Image.PreserveAspectFit anchors.fill: parent
anchors.centerIn: parent
} }
} }
...@@ -28,30 +28,24 @@ This file is part of the QGROUNDCONTROL project ...@@ -28,30 +28,24 @@ This file is part of the QGROUNDCONTROL project
*/ */
import QtQuick 2.4 import QtQuick 2.4
import QGroundControl.ScreenTools 1.0
Item { Item {
id: root id: root
anchors.centerIn: parent
property ScreenTools __screenTools: ScreenTools { }
property real rollAngle : 0 property real rollAngle : 0
property real pitchAngle: 0 property real pitchAngle: 0
property bool showAttitude: true
anchors.fill: parent
QGCArtificialHorizon {
rollAngle: root.rollAngle
pitchAngle: root.pitchAngle
}
Image { Image {
id: rollDial id: rollDial
visible: root.showAttitude anchors { bottom: root.verticalCenter; horizontalCenter: parent.horizontalCenter}
anchors { bottom: root.verticalCenter; horizontalCenter: parent.horizontalCenter} source: "/qml/rollDialWhite.svg"
source: "/qml/rollDialWhite.svg" mipmap: true
mipmap: true width: parent.width
width: 260 fillMode: Image.PreserveAspectFit
fillMode: Image.PreserveAspectFit
transform: Rotation { transform: Rotation {
origin.x: rollDial.width / 2 origin.x: rollDial.width / 2
origin.y: rollDial.height origin.y: rollDial.height
angle: -rollAngle angle: -rollAngle
} }
...@@ -59,21 +53,19 @@ Item { ...@@ -59,21 +53,19 @@ Item {
Image { Image {
id: pointer id: pointer
visible: root.showAttitude anchors { bottom: root.verticalCenter; horizontalCenter: parent.horizontalCenter}
anchors { bottom: root.verticalCenter; horizontalCenter: parent.horizontalCenter} source: "/qml/rollPointerWhite.svg"
source: "/qml/rollPointerWhite.svg" mipmap: true
mipmap: true width: rollDial.width
width: rollDial.width fillMode: Image.PreserveAspectFit
fillMode: Image.PreserveAspectFit
} }
Image { Image {
id: crossHair id: crossHair
visible: root.showAttitude
anchors.centerIn: parent anchors.centerIn: parent
source: "/qml/crossHair.svg" source: "/qml/crossHair.svg"
mipmap: true mipmap: true
width: 260 width: parent.width
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
} }
...@@ -29,9 +29,11 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,9 +29,11 @@ This file is part of the QGROUNDCONTROL project
import QtQuick 2.4 import QtQuick 2.4
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Item { Item {
id: root id: root
property ScreenTools __screenTools: ScreenTools { }
property real heading : 0 property real heading : 0
Image { Image {
id: compass id: compass
...@@ -57,8 +59,8 @@ Item { ...@@ -57,8 +59,8 @@ Item {
} }
Rectangle { Rectangle {
anchors.centerIn: compass anchors.centerIn: compass
width: 40 width: __screenTools.pixelSizeFactor * (40)
height: 25 height: __screenTools.pixelSizeFactor * (25)
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 {
......
...@@ -32,11 +32,11 @@ import QGroundControl.Controls 1.0 ...@@ -32,11 +32,11 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
QGCMovableItem { QGCMovableItem {
property ScreenTools screenTools: ScreenTools { }
id: root id: root
property ScreenTools screenTools: ScreenTools { }
property real heading: 0 property real heading: 0
property real size: 120 property real size: screenTools.pixelSizeFactor * (120)
property real _fontSize: screenTools.dpiAdjustedPointSize(size * 12 / 120) property real _fontSize: screenTools.fontPointFactor * (12)
width: size width: size
height: size height: size
Rectangle { Rectangle {
...@@ -48,7 +48,7 @@ QGCMovableItem { ...@@ -48,7 +48,7 @@ QGCMovableItem {
id: pointer id: pointer
source: "/qml/compassInstrumentAirplane.svg" source: "/qml/compassInstrumentAirplane.svg"
mipmap: true mipmap: true
width: root.width * 0.75 width: size * 0.75
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.centerIn: parent anchors.centerIn: parent
transform: Rotation { transform: Rotation {
...@@ -61,9 +61,8 @@ QGCMovableItem { ...@@ -61,9 +61,8 @@ QGCMovableItem {
id: compassDial id: compassDial
source: "/qml/compassInstrumentDial.svg" source: "/qml/compassInstrumentDial.svg"
mipmap: true mipmap: true
width: root.width
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.centerIn: parent anchors.fill: parent
} }
Rectangle { Rectangle {
anchors.centerIn: root anchors.centerIn: root
......
...@@ -29,22 +29,24 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,22 +29,24 @@ This file is part of the QGROUNDCONTROL project
import QtQuick 2.1 import QtQuick 2.1
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Rectangle { Rectangle {
id: root id: root
property ScreenTools __screenTools: ScreenTools { }
property real altitude: 0 property real altitude: 0
property real vertZ: 0 property real vertZ: 0
property bool showAltitude: true property bool showAltitude: true
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) ? 50 : 25 height: (showAltitude && showClimbRate) ? __screenTools.pixelSizeFactor * (50) : __screenTools.pixelSizeFactor * (25)
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: 4 spacing: __screenTools.pixelSizeFactor * (4)
QGCLabel { QGCLabel {
text: 'h: ' + altitude.toFixed(0) text: 'h: ' + altitude.toFixed(0)
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -29,22 +29,24 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,22 +29,24 @@ This file is part of the QGROUNDCONTROL project
import QtQuick 2.1 import QtQuick 2.1
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Rectangle { Rectangle {
id: root id: root
property ScreenTools __screenTools: ScreenTools { }
property real airspeed: 0 property real airspeed: 0
property real groundspeed: 0 property real groundspeed: 0
property bool showAirSpeed: true property bool showAirSpeed: true
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) ? 50 : 25 height: (showAirSpeed && showGroundSpeed) ? __screenTools.pixelSizeFactor * (50) : __screenTools.pixelSizeFactor * (25)
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: 4 spacing: __screenTools.pixelSizeFactor * (4)
QGCLabel { QGCLabel {
text: 'GS: ' + groundspeed.toFixed(0) text: 'GS: ' + groundspeed.toFixed(0)
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -33,9 +33,11 @@ import QtLocation 5.3 ...@@ -33,9 +33,11 @@ import QtLocation 5.3
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.FlightControls 1.0 import QGroundControl.FlightControls 1.0
import QGroundControl.ScreenTools 1.0
Rectangle { Rectangle {
id: root id: root
property ScreenTools __screenTools: ScreenTools { }
property real latitude: 37.803784 property real latitude: 37.803784
property real longitude : -122.462276 property real longitude : -122.462276
property real zoomLevel: 18 property real zoomLevel: 18
...@@ -163,7 +165,9 @@ Rectangle { ...@@ -163,7 +165,9 @@ Rectangle {
z: map.z + 20 z: map.z + 20
anchors { anchors {
bottom: parent.bottom; bottom: parent.bottom;
bottomMargin: 15; rightMargin: 20; leftMargin: 20 bottomMargin: __screenTools.pixelSizeFactor * (15)
rightMargin: __screenTools.pixelSizeFactor * (20)
leftMargin: __screenTools.pixelSizeFactor * (20)
left: parent.left left: parent.left
} }
width: parent.width - anchors.rightMargin - anchors.leftMargin width: parent.width - anchors.rightMargin - anchors.leftMargin
...@@ -184,9 +188,9 @@ Rectangle { ...@@ -184,9 +188,9 @@ Rectangle {
opacity: 1 opacity: 1
anchors { anchors {
bottom: zoomSlider.top; bottom: zoomSlider.top;
bottomMargin: 8; bottomMargin: __screenTools.pixelSizeFactor * (8);
left: zoomSlider.left left: zoomSlider.left
leftMargin: 4 leftMargin: __screenTools.pixelSizeFactor * (4)
} }
Image { Image {
id: scaleImageLeft id: scaleImageLeft
...@@ -213,7 +217,7 @@ Rectangle { ...@@ -213,7 +217,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.bottomMargin: 10 anchors.bottomMargin: __screenTools.pixelSizeFactor * (10)
text: "0 m" text: "0 m"
} }
Component.onCompleted: { Component.onCompleted: {
......
...@@ -41,10 +41,10 @@ Rectangle { ...@@ -41,10 +41,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.dpiAdjustedPointSize(size * 11 / 120); property real _fontSize: __screenTools.fontPointFactor * (11);
height: size * 0.9 height: size * 0.9
width: size width: size
radius: 8 radius: screenTools.pixelSizeFactor * (8)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
clip: true clip: true
......
...@@ -40,10 +40,12 @@ ...@@ -40,10 +40,12 @@
import QtQuick 2.1 import QtQuick 2.1
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Item { Item {
id: slider; id: slider;
height: 12 height: 12
property ScreenTools __screenTools: ScreenTools { }
property real value // value is read/write. property real value // value is read/write.
property real minimum: 0 property real minimum: 0
property real maximum: 1 property real maximum: 1
...@@ -51,15 +53,15 @@ Item { ...@@ -51,15 +53,15 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: 6 radius: __screenTools.pixelSizeFactor * (6)
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: 4 anchors.leftMargin: __screenTools.pixelSizeFactor * (4)
radius: 4 radius: __screenTools.pixelSizeFactor * (4)
height: 4 height: __screenTools.pixelSizeFactor * (4)
width: handle.x - x width: handle.x - x
color: "#69bb17" color: "#69bb17"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -68,14 +70,14 @@ Item { ...@@ -68,14 +70,14 @@ Item {
Rectangle { Rectangle {
id: labelRect id: labelRect
width: label.width width: label.width
height: label.height + 4 height: label.height + __screenTools.pixelSizeFactor * (4)
radius: 4 radius: __screenTools.pixelSizeFactor * (4)
smooth: true smooth: true
color: Qt.rgba(1,1,1,0.75); color: Qt.rgba(1,1,1,0.75);
border.width: 1 border.width: __screenTools.pixelSizeFactor * (1)
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: 4 anchors.bottomMargin: __screenTools.pixelSizeFactor * (4)
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{
...@@ -92,7 +94,7 @@ Item { ...@@ -92,7 +94,7 @@ Item {
Rectangle { Rectangle {
id: handle; id: handle;
smooth: true smooth: true
width: 26; width: __screenTools.pixelSizeFactor * (26);
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)
......
...@@ -33,16 +33,15 @@ import QGroundControl.Controls 1.0 ...@@ -33,16 +33,15 @@ import QGroundControl.Controls 1.0
Rectangle { Rectangle {
id: root id: root
property ScreenTools screenTools: ScreenTools { } property ScreenTools __screenTools: ScreenTools { }
property real speed: 0 property real speed: 0
property real _reticleSpacing: 10 property real _reticleSpacing: __screenTools.pixelSizeFactor * (10)
property real _reticleHeight: 2 property real _reticleHeight: __screenTools.pixelSizeFactor * (2)
property real _reticleSlot: _reticleSpacing + _reticleHeight property real _reticleSlot: _reticleSpacing + _reticleHeight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
z:10 z:10
height: parent.height * 0.65 > 280 ? 280 : parent.height * 0.65
smooth: true smooth: true
radius: 5 radius: __screenTools.pixelSizeFactor * (5)
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) }
...@@ -51,7 +50,7 @@ Rectangle { ...@@ -51,7 +50,7 @@ Rectangle {
} }
Rectangle { Rectangle {
id: clipRect id: clipRect
height: parent.height - 5 height: parent.height - __screenTools.pixelSizeFactor * (5)
width: parent.width width: parent.width
clip: true clip: true
color: Qt.rgba(0,0,0,0); color: Qt.rgba(0,0,0,0);
...@@ -65,14 +64,14 @@ Rectangle { ...@@ -65,14 +64,14 @@ Rectangle {
model: 40 model: 40
Rectangle { Rectangle {
property int _speed: -(index - 20) property int _speed: -(index - 20)
width: (_speed % 5 === 0) ? 10 : 15 width: (_speed % 5 === 0) ? __screenTools.pixelSizeFactor * (10) : __screenTools.pixelSizeFactor * (15)
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: -30 anchors.horizontalCenterOffset: __screenTools.pixelSizeFactor * (-30)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
antialiasing: true antialiasing: true
font.weight: Font.DemiBold font.weight: Font.DemiBold
......
...@@ -68,13 +68,7 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -68,13 +68,7 @@ MainToolBar::MainToolBar(QWidget* parent)
{ {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setObjectName("MainToolBar"); setObjectName("MainToolBar");
#ifdef __android__ _updatePixelSize();
setMinimumHeight(120);
setMaximumHeight(120);
#else
setMinimumHeight(40);
setMaximumHeight(40);
#endif
setMinimumWidth(MainWindow::instance()->minimumWidth()); setMinimumWidth(MainWindow::instance()->minimumWidth());
// Get rid of layout default margins // Get rid of layout default margins
QLayout* pl = layout(); QLayout* pl = layout();
...@@ -103,6 +97,7 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -103,6 +97,7 @@ MainToolBar::MainToolBar(QWidget* parent)
connect(LinkManager::instance(), &LinkManager::linkConfigurationChanged, this, &MainToolBar::_updateConfigurations); connect(LinkManager::instance(), &LinkManager::linkConfigurationChanged, this, &MainToolBar::_updateConfigurations);
connect(LinkManager::instance(), &LinkManager::linkConnected, this, &MainToolBar::_linkConnected); connect(LinkManager::instance(), &LinkManager::linkConnected, this, &MainToolBar::_linkConnected);
connect(LinkManager::instance(), &LinkManager::linkDisconnected, this, &MainToolBar::_linkDisconnected); connect(LinkManager::instance(), &LinkManager::linkDisconnected, this, &MainToolBar::_linkDisconnected);
connect(MainWindow::instance(), &MainWindow::pixelSizeChanged, this, &MainToolBar::_updatePixelSize);
// RSSI (didn't like standard connection) // RSSI (didn't like standard connection)
connect(MAVLinkProtocol::instance(), connect(MAVLinkProtocol::instance(),
SIGNAL(radioStatusChanged(LinkInterface*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned)), this, SIGNAL(radioStatusChanged(LinkInterface*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned)), this,
...@@ -698,3 +693,9 @@ void MainToolBar::_setProgressBarValue(float value) ...@@ -698,3 +693,9 @@ void MainToolBar::_setProgressBarValue(float value)
_progressBarValue = value; _progressBarValue = value;
emit progressBarValueChanged(value); emit progressBarValueChanged(value);
} }
void MainToolBar::_updatePixelSize()
{
setMinimumHeight(40 * MainWindow::pixelSizeFactor());
setMaximumHeight(40 * MainWindow::pixelSizeFactor());
}
...@@ -161,6 +161,7 @@ private slots: ...@@ -161,6 +161,7 @@ private slots:
void _setProgressBarValue (float value); void _setProgressBarValue (float value);
void _remoteControlRSSIChanged (uint8_t rssi); void _remoteControlRSSIChanged (uint8_t rssi);
void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise); void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise);
void _updatePixelSize ();
private: private:
void _updateConnection (LinkInterface *disconnectedLink = NULL); void _updateConnection (LinkInterface *disconnectedLink = NULL);
......
...@@ -41,7 +41,7 @@ Rectangle { ...@@ -41,7 +41,7 @@ Rectangle {
id: toolBarHolder id: toolBarHolder
property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true } property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
property ScreenTools screenTools: ScreenTools { } property ScreenTools __screenTools: ScreenTools { }
property int cellSpacerSize: getProportionalDimmension(4) property int cellSpacerSize: getProportionalDimmension(4)
property int cellHeight: getProportionalDimmension(30) property int cellHeight: getProportionalDimmension(30)
...@@ -147,7 +147,7 @@ Rectangle { ...@@ -147,7 +147,7 @@ Rectangle {
spacing: -getProportionalDimmension(12) spacing: -getProportionalDimmension(12)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Connections { Connections {
target: screenTools target: __screenTools
onRepaintRequestedChanged: { onRepaintRequestedChanged: {
setupButton.repaintChevron = true; setupButton.repaintChevron = true;
planButton.repaintChevron = true; planButton.repaintChevron = true;
...@@ -251,7 +251,7 @@ Rectangle { ...@@ -251,7 +251,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: messageText id: messageText
text: (mainToolBar.messageCount > 0) ? mainToolBar.messageCount : '' text: (mainToolBar.messageCount > 0) ? mainToolBar.messageCount : ''
font.pointSize: screenTools.dpiAdjustedPointSize(14); font.pointSize: __screenTools.fontPointFactor * (14);
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
...@@ -337,7 +337,7 @@ Rectangle { ...@@ -337,7 +337,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: satelitteText id: satelitteText
text: mainToolBar.satelliteCount text: mainToolBar.satelliteCount
font.pointSize: screenTools.dpiAdjustedPointSize(14); font.pointSize: __screenTools.fontPointFactor * (14);
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
...@@ -372,7 +372,7 @@ Rectangle { ...@@ -372,7 +372,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.pointSize: screenTools.dpiAdjustedPointSize(12); font.pointSize: __screenTools.fontPointFactor * (12);
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -405,7 +405,7 @@ Rectangle { ...@@ -405,7 +405,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
QGCLabel { QGCLabel {
text: 'R ' text: 'R '
font.pointSize: screenTools.dpiAdjustedPointSize(11); font.pointSize: __screenTools.fontPointFactor * (11);
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -413,7 +413,7 @@ Rectangle { ...@@ -413,7 +413,7 @@ Rectangle {
text: mainToolBar.telemetryRRSSI + 'dB' text: mainToolBar.telemetryRRSSI + 'dB'
width: getProportionalDimmension(30) width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(11); font.pointSize: __screenTools.fontPointFactor * (11);
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -422,7 +422,7 @@ Rectangle { ...@@ -422,7 +422,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
QGCLabel { QGCLabel {
text: 'L ' text: 'L '
font.pointSize: screenTools.dpiAdjustedPointSize(11); font.pointSize: __screenTools.fontPointFactor * (11);
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -430,7 +430,7 @@ Rectangle { ...@@ -430,7 +430,7 @@ Rectangle {
text: mainToolBar.telemetryLRSSI + 'dB' text: mainToolBar.telemetryLRSSI + 'dB'
width: getProportionalDimmension(30) width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(11); font.pointSize: __screenTools.fontPointFactor * (11);
font.weight: Font.DemiBold font.weight: Font.DemiBold
color: colorWhite color: colorWhite
} }
...@@ -462,7 +462,7 @@ Rectangle { ...@@ -462,7 +462,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: batteryText id: batteryText
text: mainToolBar.batteryVoltage.toFixed(1) + 'V'; text: mainToolBar.batteryVoltage.toFixed(1) + 'V';
font.pointSize: screenTools.dpiAdjustedPointSize(12); font.pointSize: __screenTools.fontPointFactor * (12);
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
...@@ -490,7 +490,7 @@ Rectangle { ...@@ -490,7 +490,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: armedStatusText id: armedStatusText
text: (mainToolBar.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED") text: (mainToolBar.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED")
font.pointSize: screenTools.dpiAdjustedPointSize(12); font.pointSize: __screenTools.fontPointFactor * (12);
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.centerIn: parent anchors.centerIn: parent
color: (mainToolBar.systemArmed) ? colorOrangeText : colorGreenText color: (mainToolBar.systemArmed) ? colorOrangeText : colorGreenText
...@@ -509,7 +509,7 @@ Rectangle { ...@@ -509,7 +509,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: stateStatusText id: stateStatusText
text: mainToolBar.currentState text: mainToolBar.currentState
font.pointSize: screenTools.dpiAdjustedPointSize(12); font.pointSize: __screenTools.fontPointFactor * (12);
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.centerIn: parent anchors.centerIn: parent
color: (mainToolBar.currentState === "STANDBY") ? colorGreenText : colorRedText color: (mainToolBar.currentState === "STANDBY") ? colorGreenText : colorRedText
...@@ -530,7 +530,7 @@ Rectangle { ...@@ -530,7 +530,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: modeStatusText id: modeStatusText
text: mainToolBar.currentMode text: mainToolBar.currentMode
font.pointSize: screenTools.dpiAdjustedPointSize(12); font.pointSize: __screenTools.fontPointFactor * (12);
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -551,7 +551,7 @@ Rectangle { ...@@ -551,7 +551,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: connectionStatusText id: connectionStatusText
text: qsTr("CONNECTION LOST") text: qsTr("CONNECTION LOST")
font.pointSize: screenTools.dpiAdjustedPointSize(14); font.pointSize: __screenTools.fontPointFactor * (14);
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