diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index def0440d0bc4fef86500ef9161746a4191fa5301..41746308ebcaaec15d5471a653191164089ce474 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -85,6 +85,7 @@
src/QmlControls/QGCMapLabel.qml
src/QmlControls/QGCMobileFileOpenDialog.qml
src/QmlControls/QGCMobileFileSaveDialog.qml
+ src/QmlControls/QGCMouseArea.qml
src/QmlControls/QGCMovableItem.qml
src/QmlControls/QGCPipable.qml
src/QmlControls/QGCRadioButton.qml
diff --git a/src/FlightMap/MapItems/MissionItemIndicatorDrag.qml b/src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
index d9b3d5e2b535bc1c59f0373a9f30e76b0c47c825..c41ca75ef954ca6cff9c8884895a1a680ded2542 100644
--- a/src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
+++ b/src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
@@ -17,30 +17,31 @@ import QGroundControl.Controls 1.0
/// Use the drag a MissionItemIndicator
Rectangle {
id: itemDragger
- x: itemIndicator.x - _expandMargin
- y: itemIndicator.y - _expandMargin
- width: itemIndicator.width + (_expandMargin * 2)
- height: itemIndicator.height + (_expandMargin * 2)
+ x: itemIndicator.x - _touchMarginHorizontal
+ y: itemIndicator.y - _touchMarginVertical
+ width: itemIndicator.width + (_touchMarginHorizontal * 2)
+ height: itemIndicator.height + (_touchMarginVertical * 2)
color: "transparent"
z: QGroundControl.zOrderMapItems + 1 // Above item icons
- // These are handy for debugging so left in for now
- //border.width: 1
- //border.color: "white"
-
// Properties which must be specific by consumer
property var itemIndicator ///< The mission item indicator to drag around
property var itemCoordinate ///< Coordinate we are updating during drag
property bool _preventCoordinateBindingLoop: false
- property real _expandMargin: ScreenTools.isMobile ? ScreenTools.defaultFontPixelWidth : 0
+
+ property bool _mobile: true//ScreenTools.isMobile
+ property real _touchWidth: Math.max(itemIndicator.width, ScreenTools.minTouchPixels)
+ property real _touchHeight: Math.max(itemIndicator.height, ScreenTools.minTouchPixels)
+ property real _touchMarginHorizontal: _mobile ? (_touchWidth - itemIndicator.width) / 2 : 0
+ property real _touchMarginVertical: _mobile ? (_touchHeight - itemIndicator.height) / 2 : 0
onXChanged: liveDrag()
onYChanged: liveDrag()
function liveDrag() {
if (!itemDragger._preventCoordinateBindingLoop && Drag.active) {
- var point = Qt.point(itemDragger.x + _expandMargin + itemIndicator.anchorPoint.x, itemDragger.y + _expandMargin + itemIndicator.anchorPoint.y)
+ var point = Qt.point(itemDragger.x + _touchMarginHorizontal + itemIndicator.anchorPoint.x, itemDragger.y + _touchMarginVertical + itemIndicator.anchorPoint.y)
var coordinate = map.toCoordinate(point)
itemDragger._preventCoordinateBindingLoop = true
coordinate.altitude = itemCoordinate.altitude
@@ -51,13 +52,14 @@ Rectangle {
Drag.active: itemDrag.drag.active
- MouseArea {
- id: itemDrag
- anchors.fill: parent
- drag.target: parent
- drag.minimumX: 0
- drag.minimumY: 0
- drag.maximumX: itemDragger.parent.width - parent.width
- drag.maximumY: itemDragger.parent.height - parent.height
+ QGCMouseArea {
+ id: itemDrag
+ anchors.fill: parent
+ drag.target: parent
+ drag.minimumX: 0
+ drag.minimumY: 0
+ drag.maximumX: itemDragger.parent.width - parent.width
+ drag.maximumY: itemDragger.parent.height - parent.height
+ preventStealing: true
}
}
diff --git a/src/MissionEditor/MissionItemEditor.qml b/src/MissionEditor/MissionItemEditor.qml
index 2b9942d201b40c3e1006020a89b80e3ed6a51a3a..e1813762fef63d153d5e3f6bb08637c3108a7a80 100644
--- a/src/MissionEditor/MissionItemEditor.qml
+++ b/src/MissionEditor/MissionItemEditor.qml
@@ -68,15 +68,21 @@ Rectangle {
}
- MouseArea {
+ QGCMouseArea {
// The MouseArea for the hamburger is larger than the hamburger image itself in order to provide a larger
// touch area on mobile
- anchors.top: parent.top
- anchors.bottom: editorLoader.top
- anchors.leftMargin: -hamburger.anchors.rightMargin
- anchors.left: hamburger.left
- anchors.right: parent.right
- onClicked: hamburgerMenu.popup()
+ anchors.leftMargin: -_touchMarginHorizontal
+ anchors.rightMargin: -_touchMarginHorizontal
+ anchors.topMargin: -_touchMarginVertical
+ anchors.bottomMargin: -_touchMarginVertical
+ anchors.fill: hamburger
+ visible: hamburger.visible
+ onClicked: hamburgerMenu.popup()
+
+ property real _touchWidth: Math.max(hamburger.width, ScreenTools.minTouchPixels)
+ property real _touchHeight: Math.max(hamburger.height, ScreenTools.minTouchPixels)
+ property real _touchMarginHorizontal: ScreenTools.isMobile ? (_touchWidth - hamburger.width) / 2 : 0
+ property real _touchMarginVertical: ScreenTools.isMobile ? (_touchHeight - hamburger.height) / 2 : 0
Menu {
id: hamburgerMenu
diff --git a/src/QmlControls/QGCMouseArea.qml b/src/QmlControls/QGCMouseArea.qml
new file mode 100644
index 0000000000000000000000000000000000000000..aba03c37430eb82295b70527d077bb63d782b755
--- /dev/null
+++ b/src/QmlControls/QGCMouseArea.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.3
+
+import QGroundControl 1.0
+
+MouseArea {
+ Rectangle {
+ anchors.fill: parent
+ border.color: "red"
+ border.width: QGroundControl.showTouchAreas ? 1 : 0
+ color: "transparent"
+ }
+}
diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir
index 8426dc4e0b4ce5c6b67c5aad80632778b42838d2..dd491b5f439c46ea30f69a73230ea211a8bffccd 100644
--- a/src/QmlControls/QGroundControl.Controls.qmldir
+++ b/src/QmlControls/QGroundControl.Controls.qmldir
@@ -37,6 +37,7 @@ QGCListView 1.0 QGCListView.qml
QGCMapLabel 1.0 QGCMapLabel.qml
QGCMobileFileOpenDialog 1.0 QGCMobileFileOpenDialog.qml
QGCMobileFileSaveDialog 1.0 QGCMobileFileSaveDialog.qml
+QGCMouseArea 1.0 QGCMouseArea.qml
QGCMovableItem 1.0 QGCMovableItem.qml
QGCPipable 1.0 QGCPipable.qml
QGCRadioButton 1.0 QGCRadioButton.qml
diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc
index af893774ea8496833310aeb7d2c8f17394ad3c1e..59a4579c3fbb18ba04db6c6e1399377b16299510 100644
--- a/src/QmlControls/QGroundControlQmlGlobal.cc
+++ b/src/QmlControls/QGroundControlQmlGlobal.cc
@@ -32,6 +32,8 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
, _corePlugin(NULL)
, _firmwarePluginManager(NULL)
, _settingsManager(NULL)
+ , _showTouchAreas(false)
+ , _showAdvancedUI(false)
{
// We clear the parent on this object since we run into shutdown problems caused by hybrid qml app. Instead we let it leak on shutdown.
setParent(NULL);
diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h
index 047e3f86e94e6e61b3ce4b8dd6d39ba35b69ef8c..24c0aa58c31322c4be861645373825bb66686749 100644
--- a/src/QmlControls/QGroundControlQmlGlobal.h
+++ b/src/QmlControls/QGroundControlQmlGlobal.h
@@ -73,6 +73,9 @@ public:
Q_PROPERTY(QString qgcVersion READ qgcVersion CONSTANT)
+ Q_PROPERTY(bool showTouchAreas MEMBER _showTouchAreas NOTIFY showTouchAreasChanged)
+ Q_PROPERTY(bool showAdvancedUI MEMBER _showAdvancedUI NOTIFY showAdvancedUIChanged)
+
Q_INVOKABLE void saveGlobalSetting (const QString& key, const QString& value);
Q_INVOKABLE QString loadGlobalSetting (const QString& key, const QString& defaultValue);
Q_INVOKABLE void saveBoolGlobalSetting (const QString& key, bool value);
@@ -153,6 +156,9 @@ public:
QString qgcVersion(void) const { return qgcApp()->applicationVersion(); }
+ bool showTouchAreas(void) const { return _showTouchAreas; } ///< Show visible extents of touch areas
+ bool showAdvancedUI(void) const { return _showAdvancedUI; } ///< Show hidden advanced UI
+
// Overrides from QGCTool
virtual void setToolbox(QGCToolbox* toolbox);
@@ -162,6 +168,8 @@ signals:
void mavlinkSystemIDChanged (int id);
void flightMapPositionChanged (QGeoCoordinate flightMapPosition);
void flightMapZoomChanged (double flightMapZoom);
+ void showTouchAreasChanged (bool showTouchAreas);
+ void showAdvancedUIChanged (bool showAdvancedUI);
private:
FlightMapSettings* _flightMapSettings;
@@ -178,6 +186,9 @@ private:
QGeoCoordinate _flightMapPosition;
double _flightMapZoom;
+
+ bool _showTouchAreas;
+ bool _showAdvancedUI;
};
#endif
diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml
index 84fa4b7c20046d7fb3cc229dcc5b7c6c7f7b51fc..c2085e45b756592b3340c9a27bc34e34bb767663 100644
--- a/src/QmlControls/ScreenTools.qml
+++ b/src/QmlControls/ScreenTools.qml
@@ -60,6 +60,9 @@ Item {
property bool isTinyScreen: (Screen.width / Screen.pixelDensity) < 120 // 120mm
property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example
+ readonly property real minTouchMillimeters: 10 ///< Minimum touch size in millimeters
+ property real minTouchPixels: 0 ///< Minimum touch size in pixels
+
// The implicit heights/widths for our custom control set
property real implicitButtonWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0))
property real implicitButtonHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6))
@@ -101,7 +104,8 @@ Item {
smallFontPointSize = defaultFontPointSize * _screenTools.smallFontPointRatio
mediumFontPointSize = defaultFontPointSize * _screenTools.mediumFontPointRatio
largeFontPointSize = defaultFontPointSize * _screenTools.largeFontPointRatio
- toolbarHeight = defaultFontPixelHeight * 3 * QGroundControl.corePlugin.options.toolbarHeightMultiplier
+ minTouchPixels = Math.round(minTouchMillimeters * Screen.pixelDensity)
+ toolbarHeight = isMobile ? minTouchPixels : defaultFontPixelHeight * 3
}
Text {
diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml
index 296dfc4a047584f26870b098349840a57cab7b84..6edd257900ab3830b922f2e65618388855ae19c6 100644
--- a/src/QmlControls/ToolStrip.qml
+++ b/src/QmlControls/ToolStrip.qml
@@ -16,7 +16,7 @@ import QGroundControl.Palette 1.0
Rectangle {
id: _root
color: qgcPal.window
- width: ScreenTools.defaultFontPixelWidth * 6
+ width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 6
height: buttonStripColumn.height + (buttonStripColumn.anchors.margins * 2)
radius: _radius
@@ -172,10 +172,10 @@ Rectangle {
}
- MouseArea {
+ QGCMouseArea {
// Size of mouse area is expanded to make touch easier
- anchors.leftMargin: buttonStripColumn.margins
- anchors.rightMargin: buttonStripColumn.margins
+ anchors.leftMargin: -buttonStripColumn.anchors.margins
+ anchors.rightMargin: -buttonStripColumn.anchors.margins
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml
index 1ee5aa2e4621630e9b84d0e5e6232a2ad83393d8..610cb6e45da0394124119fc0ff8810be4f841f25 100644
--- a/src/ui/toolbar/MainToolBar.qml
+++ b/src/ui/toolbar/MainToolBar.qml
@@ -67,6 +67,28 @@ Rectangle {
flyButton.checked = true
}
+ // Easter egg mechanism
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ console.log("easter egg click", ++_clickCount)
+ eggTimer.restart()
+ if (_clickCount == 5) {
+ QGroundControl.showAdvancedUI = true
+ } else if (_clickCount == 7) {
+ QGroundControl.showTouchAreas = true
+ }
+ }
+
+ property int _clickCount: 0
+
+ Timer {
+ id: eggTimer
+ interval: 1000
+ onTriggered: parent._clickCount = 0
+ }
+ }
+
/// Bottom single pixel divider
Rectangle {
anchors.left: parent.left