From f5f8c0b0b8399f33b884f24741f4ca98499f96cd Mon Sep 17 00:00:00 2001 From: dogmaphobic Date: Sun, 5 Jun 2016 21:30:53 -0400 Subject: [PATCH] Tweaks for small screens on iOS. --- src/FlightDisplay/FlightDisplayViewWidgets.qml | 2 +- src/FlightMap/FlightMap.qml | 2 +- src/QmlControls/QGroundControlQmlGlobal.cc | 2 +- src/QmlControls/ScreenTools.qml | 16 +++++++++++----- src/QmlControls/ScreenToolsController.cc | 15 +++++++++++++++ src/QmlControls/ScreenToolsController.h | 3 +++ 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index fe0af44f1..1315b17fb 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -38,7 +38,7 @@ Item { function getGadgetWidth() { if(ScreenTools.isMobile) { - return mainWindow.width * 0.15 + return ScreenTools.isTinyScreen ? mainWindow.width * 0.2 : mainWindow.width * 0.15 } var w = mainWindow.width * 0.15 return Math.min(w, 200) diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index 8d3987e3f..274efe22e 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -157,7 +157,7 @@ Map { */ Item { id: scale - visible: _map.showScale && scaleText.text !== "0 m" + visible: !ScreenTools.isTinyScreen && _map.showScale && scaleText.text !== "0 m" z: _map.z + 20 width: scaleImageLeft.width + scaleImage.width + scaleImageRight.width anchors { diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc index 3d2688eac..3a48c0adc 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.cc +++ b/src/QmlControls/QGroundControlQmlGlobal.cc @@ -25,7 +25,7 @@ SettingsFact* QGroundControlQmlGlobal::_speedUnitsFact = FactMetaData* QGroundControlQmlGlobal::_speedUnitsMetaData = NULL; const char* QGroundControlQmlGlobal::_virtualTabletJoystickKey = "VirtualTabletJoystick"; -const char* QGroundControlQmlGlobal::_baseFontPointSizeKey = "BaseFontPointSize"; +const char* QGroundControlQmlGlobal::_baseFontPointSizeKey = "BaseDeviceFontPointSize"; QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app) : QGCTool(app) diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 138c5a063..41a76e6d5 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -83,13 +83,19 @@ Item { if(baseSize < 6 || baseSize > 48) { //-- Init base size base on the platform if(ScreenToolsController.isMobile) { - // Small Devices - if((Screen.width / Screen.pixelDensity) < 120) - baseSize = 11; - // iOS + //-- Check iOS really tiny screens (iPhone 4s/5/5s) + if(ScreenToolsController.isiOS && Screen.width < 570) + baseSize = 9; + //-- iPhone 6/6s) + else if(ScreenToolsController.isiOS && Screen.width < 670) + baseSize = 10; + // Larger iOS (6/6s Plus or iPad) else if(ScreenToolsController.isiOS) baseSize = 13; - // Android + // Small Android Devices + else if((Screen.width / Screen.pixelDensity) < 120) + baseSize = 11; + // Other Android else baseSize = 14; } else { diff --git a/src/QmlControls/ScreenToolsController.cc b/src/QmlControls/ScreenToolsController.cc index b72da1300..9d0034cb8 100644 --- a/src/QmlControls/ScreenToolsController.cc +++ b/src/QmlControls/ScreenToolsController.cc @@ -13,8 +13,23 @@ #include "ScreenToolsController.h" #include +#if defined(__ios__) +#include +#endif ScreenToolsController::ScreenToolsController() { } + +QString +ScreenToolsController::iOSDevice() +{ +#if defined(__ios__) + struct utsname systemInfo; + uname(&systemInfo); + return QString(systemInfo.machine); +#else + return QString(); +#endif +} diff --git a/src/QmlControls/ScreenToolsController.h b/src/QmlControls/ScreenToolsController.h index 9043e6ac2..47d7dcb01 100644 --- a/src/QmlControls/ScreenToolsController.h +++ b/src/QmlControls/ScreenToolsController.h @@ -36,6 +36,7 @@ public: Q_PROPERTY(bool isDebug READ isDebug CONSTANT) Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT) Q_PROPERTY(bool isLinux READ isLinux CONSTANT) + Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT) // Returns current mouse position Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); } @@ -81,6 +82,8 @@ public: bool testHighDPI () { return false; } #endif + QString iOSDevice (); + }; #endif -- 2.22.0