Commit e583798e authored by dogmaphobic's avatar dogmaphobic

Handling multi-platform sizing (fonts and pixels)

parent 209318de
......@@ -364,7 +364,7 @@ Item {
QGCLabel {
text: "FLIGHT MODES CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Item { height: 20; width: 10 } // spacer
......@@ -894,7 +894,7 @@ Item {
QGCLabel {
text: "FLIGHT MODES CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
QGCLabel {
......
......@@ -98,13 +98,13 @@ Rectangle {
QGCLabel {
text: "POWER CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
QGCLabel {
text: "Battery"
color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Rectangle {
......@@ -231,7 +231,7 @@ Rectangle {
QGCLabel {
text: "Propeller Function"
color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Rectangle {
width: parent.width
......@@ -245,7 +245,7 @@ Rectangle {
QGCLabel {
text: "Magnetometer Distortion"
color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Rectangle {
width: parent.width
......@@ -264,7 +264,7 @@ Rectangle {
QGCLabel {
text: "Advanced Power Settings"
color: palette.text
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
visible: showAdvanced.checked
}
Rectangle {
......
......@@ -54,7 +54,7 @@ Rectangle {
QGCLabel {
text: "SAFETY CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Item { height: 20; width: 10 } // spacer
......@@ -62,7 +62,7 @@ Rectangle {
//-----------------------------------------------------------------
//-- 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
......@@ -121,7 +121,7 @@ Rectangle {
//-----------------------------------------------------------------
//-- 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
......@@ -291,7 +291,7 @@ Rectangle {
QGCLabel {
property Fact fact: Fact { name: "NAV_RCL_OBC" }
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.";
visible: fact.value !== 0
wrapMode: Text.Wrap
......@@ -299,7 +299,7 @@ Rectangle {
QGCLabel {
property Fact fact: Fact { name: "NAV_DLL_OBC" }
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.";
visible: fact.value !== 0
wrapMode: Text.Wrap
......
......@@ -91,7 +91,7 @@ Rectangle {
QGCLabel {
text: "SENSORS CONFIG"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Item { height: 20; width: 10 } // spacer
......
......@@ -585,7 +585,7 @@ void QGCApplication::_loadCurrentStyle(void)
QRegularExpressionMatch match = regex.match(line);
if (match.hasMatch()) {
//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;
} else {
adjustedLine = line;
......
......@@ -30,8 +30,6 @@
#include <QApplication>
#include <QPalette>
const qreal QGCPalette::_defaultFontPointSize = 12;
QList<QGCPalette*> QGCPalette::_paletteObjects;
QGCPalette::Theme QGCPalette::_theme = QGCPalette::Dark;
......@@ -134,7 +132,3 @@ void QGCPalette::_themeChanged(void)
emit paletteChanged();
}
qreal QGCPalette::dpiAdjustedDefaultFontPointSize(void)
{
return ScreenTools::dpiAdjustedPointSize_s(_defaultFontPointSize);
}
......@@ -83,10 +83,6 @@ class QGCPalette : public QObject
// Text color for TextFields
Q_PROPERTY(QColor textFieldText READ textFieldText NOTIFY paletteChanged)
Q_PROPERTY(qreal defaultFontPointSize MEMBER _defaultFontPointSize CONSTANT)
Q_PROPERTY(qreal dpiAdjustedDefaultFontPointSize READ dpiAdjustedDefaultFontPointSize CONSTANT)
public:
enum ColorGroup {
Disabled = 0,
......@@ -123,9 +119,7 @@ public:
static Theme globalTheme(void) { return _theme; }
static void setGlobalTheme(Theme newTheme);
qreal dpiAdjustedDefaultFontPointSize(void);
signals:
void paletteChanged(void);
......@@ -155,8 +149,6 @@ private:
static QColor _textField[_cThemes][_cColorGroups];
static QColor _textFieldText[_cThemes][_cColorGroups];
static const qreal _defaultFontPointSize;
void _themeChanged(void);
static QList<QGCPalette*> _paletteObjects; ///< List of all active QGCPalette objects
......
......@@ -182,7 +182,7 @@ property Fact __propertiesDialogFact: Fact { }
QGCLabel {
text: "Component #: " + componentId.toString()
font.pointSize: __screenTools.dpiAdjustedPointSize(__qgcPal.defaultFontPointSize + 4);
font.pointSize: __screenTools.fontPointFactor * (16);
}
Item {
......@@ -214,7 +214,7 @@ property Fact __propertiesDialogFact: Fact { }
x: __leftMargin
text: modelData
verticalAlignment: Text.AlignVCenter
font.pointSize: __screenTools.dpiAdjustedPointSize(__qgcPal.defaultFontPointSize + 2);
font.pointSize: __screenTools.fontPointFactor * (__qgcPal.defaultFontPointSize + 2);
}
}
......
......@@ -104,9 +104,9 @@ Button {
Text {
id: text
renderType: Text.NativeRendering
antialiasing: true
text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: __screenTools.defaultFontPointSize
anchors.verticalCenter: parent.verticalCenter
......
......@@ -3,9 +3,11 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
CheckBox {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
style: CheckBoxStyle {
label: Item {
......@@ -27,7 +29,8 @@ CheckBox {
Text {
id: text
text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
antialiasing: true
font.pointSize: __screenTools.defaultFontPointSize
anchors.centerIn: parent
......
......@@ -4,14 +4,15 @@ import QtQuick.Controls.Styles 1.2
import QtQuick.Controls.Private 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
ComboBox {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
property bool __showHighlight: pressed | hovered
style: ComboBoxStyle {
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: __screenTools.defaultFontPointSize
textColor: __showHighlight ?
control.__qgcPal.buttonHighlightText :
control.__qgcPal.buttonText
......
......@@ -3,12 +3,15 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Text {
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
property bool enabled: true
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: __screenTools.defaultFontPointSize
color: __qgcPal.text
antialiasing: true
}
import QtQuick 2.2
import QtQuick.Controls 1.2
import QGroundControl.ScreenTools 1.0
// This item can be dragged around within its parent.
// Double click issues a signal the parent can use to
......@@ -7,9 +8,10 @@ import QtQuick.Controls 1.2
Item {
id: root
property ScreenTools __screenTools: ScreenTools { }
property bool allowDragging: true
property real minimumWidth: 60
property real minimumHeight: 60
property real minimumWidth: __screenTools.pixelSizeFactor * (60)
property real minimumHeight: __screenTools.pixelSizeFactor * (60)
property alias tForm: tform
signal resetRequested()
transform: Scale {
......
......@@ -3,9 +3,11 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
RadioButton {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
style: RadioButtonStyle {
label: Item {
......@@ -27,7 +29,8 @@ RadioButton {
Text {
id: text
text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: __screenTools.defaultFontPointSize
antialiasing: true
anchors.centerIn: parent
......
......@@ -3,12 +3,14 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
TextField {
property bool showUnits: false
property string unitsLabel: ""
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
textColor: __qgcPal.textFieldText
......@@ -17,6 +19,7 @@ TextField {
text: unitsLabel
width: contentWidth + ((parent.__contentHeight/3)*2)
visible: false
antialiasing: true
}
style: TextFieldStyle {
......@@ -31,7 +34,6 @@ TextField {
Rectangle {
anchors.fill: parent
border.color: control.activeFocus ? "#47b" : "#999"
color: __qgcPal.textField
}
......@@ -49,7 +51,8 @@ TextField {
width: unitsLabelWidthGenerator.width
text: control.unitsLabel
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: __screenTools.defaultFontPointSize
antialiasing: true
color: control.textColor
visible: control.showUnits
......
......@@ -54,11 +54,10 @@ QGCButton {
}
}
}
label: Label {
label: QGCLabel {
text: button.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
verticalAlignment: Text.AlignVCenter
color: showHighlight ? __qgcPal.buttonHighlightText : (button.checked ? __qgcPal.primaryButtonText : __qgcPal.buttonText)
}
}
......
......@@ -30,43 +30,82 @@
#include <QFont>
#include <QFontMetrics>
bool ScreenTools::_dpiFactorSet = false;
double ScreenTools::_dotsPerInch = 96.0;
double ScreenTools::_dpiFactor = 72.0 / 96.0;
const double ScreenTools::_defaultFontPointSize = 12;
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 * _dpiFactor;
return pointSize * MainWindow::fontPointFactor();
}
void ScreenTools::_setDpiFactor(void)
qreal ScreenTools::adjustPixelSize(qreal pixelSize)
{
if (!_dpiFactorSet) {
_dpiFactorSet = true;
// Get screen DPI to manage font sizes on different platforms
QScreen *srn = QGuiApplication::primaryScreen();
if(srn && srn->logicalDotsPerInch() > 50.0) {
_dotsPerInch = (double)srn->logicalDotsPerInch(); // Font point sizes are based on Mac 72dpi
_dpiFactor = 72.0 / _dotsPerInch;
} else {
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.";
}
}
return adjustPixelSize_s(pixelSize);
}
qreal ScreenTools::adjustPixelSize_s(qreal pixelSize)
{
return pixelSize * MainWindow::pixelSizeFactor();
}
void ScreenTools::increasePixelSize()
{
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()
{
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 @@
@code
import QGroundControl.ScreenTools 1.0
@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
......@@ -50,32 +45,6 @@ class ScreenTools : public QObject
public:
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
Q_PROPERTY(int mouseX READ mouseX)
//! Returns the global mouse Y position
......@@ -108,35 +77,55 @@ public:
}
@endcode
*/
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
//! Utility for adjusting font point size.
/*!
@sa dpiFactor
*/
Q_INVOKABLE qreal dpiAdjustedPointSize(qreal pointSize);
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
//! Returns the font point size factor
Q_PROPERTY(double fontPointFactor READ fontPointFactor NOTIFY fontPointFactorChanged)
//! Returns the pixel size factor
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 mouseY () { return QCursor::pos().y(); }
bool repaintRequested () { return true; }
double fontPointFactor ();
double pixelSizeFactor ();
double defaultFontPointSize(void);
signals:
void repaintRequestedChanged();
void pixelSizeFactorChanged();
void fontPointFactorChanged();
void defaultFontPointSizeChanged();
private slots:
void _updateCanvas();
void _updatePixelSize();
void _updateFontSize();
private:
static void _setDpiFactor(void);
static bool _dpiFactorSet;
static double _dotsPerInch;
static double _dpiFactor;
static const double _defaultFontPointSize;
};
#endif
......@@ -4,6 +4,7 @@ import QtQuick.Controls.Styles 1.2
import QtGraphicalEffects 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Button {
checkable: true
......@@ -13,6 +14,7 @@ Button {
property bool setupComplete: true
property bool setupIndicator: true
property string imageResource: "subMenuButtonImage.png"
property ScreenTools __screenTools: ScreenTools { }
style: ButtonStyle {
id: buttonStyle
......@@ -39,7 +41,8 @@ Button {
horizontalAlignment: TextEdit.AlignHCenter
text: control.text
font.pointSize: __qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: __screenTools.defaultFontPointSize
antialiasing: true
color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
Rectangle {
......
......@@ -71,7 +71,7 @@ Rectangle {
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
font.pointSize: __screenTools.dpiAdjustedPointSize(25);
font.pointSize: __screenTools.fontPointFactor * (25);
font.bold: true
color: "black"
......@@ -82,7 +82,7 @@ Rectangle {
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
font.pointSize: __screenTools.dpiAdjustedPointSize(25);
font.pointSize: __screenTools.fontPointFactor * (25);
color: calInProgress ? "yellow" : "white"
text: parent.calText
......
......@@ -51,7 +51,7 @@ Rectangle {
QGCLabel {
text: "FIRMWARE UPDATE"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Item {
......@@ -119,7 +119,7 @@ Rectangle {
height: 300
readOnly: true
frameVisible: false
font.pointSize: qgcPal.dpiAdjustedDefaultFontPointSize
font.pointSize: screenTools.defaultFontPointSize
text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.")
......
......@@ -44,7 +44,7 @@ Rectangle {
QGCLabel {
text: "PARAMETER EDITOR"
font.pointSize: screenTools.dpiAdjustedPointSize(20)
font.pointSize: screenTools.fontPointFactor * (20)
}
Item {
......
......@@ -47,7 +47,7 @@ Rectangle {
QGCLabel {
text: "VEHICLE SUMMARY"
font.pointSize: screenTools.dpiAdjustedPointSize(20);
font.pointSize: screenTools.fontPointFactor * (20);
}
Item {
......@@ -60,7 +60,7 @@ Rectangle {
width: parent.width
wrapMode: Text.WordWrap
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 ?
"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. " +
......
......@@ -82,6 +82,26 @@ This file is part of the QGROUNDCONTROL project
#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
const char* MAIN_SETTINGS_GROUP = "QGC_MAINWINDOW";
......@@ -226,6 +246,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
emit initStatusChanged(tr("Restoring last view state"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
// Restore the window setup
_loadCurrentViewState();
#ifndef __android__
// Restore the window position and size
emit initStatusChanged(tr("Restoring last window size"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
if (settings.contains(_getWindowGeometryKey()))
......@@ -265,6 +287,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// And that they will stay checked properly after user input
connect(_ui.actionFullscreen, &QAction::triggered, this, &MainWindow::fullScreenActionItemCallback);
connect(_ui.actionNormal, &QAction::triggered, this, &MainWindow::normalActionItemCallback);
#endif
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
......@@ -295,6 +319,9 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
if (!qgcApp()->runningUnitTests()) {
_ui.actionStatusBar->setChecked(_showStatusBar);
showStatusBarCallback(_showStatusBar);