Commit 684a9fe9 authored by Don Gagne's avatar Don Gagne

Default to new Compass Ring style

parent 6190d361
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
<file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file> <file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightMap/CenterMapDropButton.qml">src/FlightMap/Widgets/CenterMapDropButton.qml</file> <file alias="QGroundControl/FlightMap/CenterMapDropButton.qml">src/FlightMap/Widgets/CenterMapDropButton.qml</file>
<file alias="QGroundControl/FlightMap/CenterMapDropPanel.qml">src/FlightMap/Widgets/CenterMapDropPanel.qml</file> <file alias="QGroundControl/FlightMap/CenterMapDropPanel.qml">src/FlightMap/Widgets/CenterMapDropPanel.qml</file>
<file alias="QGroundControl/FlightMap/CompassRing.qml">src/FlightMap/Widgets/CompassRing.qml</file>
<file alias="QGroundControl/FlightMap/MapFitFunctions.qml">src/FlightMap/Widgets/MapFitFunctions.qml</file> <file alias="QGroundControl/FlightMap/MapFitFunctions.qml">src/FlightMap/Widgets/MapFitFunctions.qml</file>
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file> <file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
<file alias="QGroundControl/FlightMap/InstrumentSwipeView.qml">src/FlightMap/Widgets/InstrumentSwipeView.qml</file> <file alias="QGroundControl/FlightMap/InstrumentSwipeView.qml">src/FlightMap/Widgets/InstrumentSwipeView.qml</file>
......
...@@ -69,7 +69,7 @@ Item { ...@@ -69,7 +69,7 @@ Item {
instrumentsLoader.state = "topMode" instrumentsLoader.state = "topMode"
} else { } else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml" instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
instrumentsLoader.state = "centerMode" instrumentsLoader.state = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode"
} }
} }
} }
...@@ -79,6 +79,11 @@ Item { ...@@ -79,6 +79,11 @@ Item {
onValueChanged: _setInstrumentWidget() onValueChanged: _setInstrumentWidget()
} }
Connections {
target: QGroundControl.settingsManager.appSettings.showLargeCompass
onValueChanged: _setInstrumentWidget()
}
Component.onCompleted: { Component.onCompleted: {
_setInstrumentWidget() _setInstrumentWidget()
} }
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.7
import QtGraphicalEffects 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Item {
property real size: _defaultSize
property var vehicle: null
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (10)
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property int _fontSize: ScreenTools.defaultFontPointSize * _sizeRatio
property real _heading: vehicle ? vehicle.heading.rawValue : 0
width: size
height: size
Rectangle {
id: borderRect
anchors.fill: parent
radius: width / 2
color: "black"
}
Item {
id: instrument
anchors.fill: parent
visible: false
Image {
id: pointer
source: "/qmlimages/attitudePointer.svg"
mipmap: true
fillMode: Image.PreserveAspectFit
anchors.leftMargin: _pointerMargin
anchors.rightMargin: _pointerMargin
anchors.topMargin: _pointerMargin
anchors.bottomMargin: _pointerMargin
anchors.fill: parent
sourceSize.height: parent.height
transform: Rotation {
origin.x: pointer.width / 2
origin.y: pointer.height / 2
angle: _heading
}
readonly property real _pointerMargin: -10
}
Image {
source: "/qmlimages/compassInstrumentDial.svg"
mipmap: true
fillMode: Image.PreserveAspectFit
anchors.fill: parent
sourceSize.height: parent.height
}
}
Rectangle {
id: mask
anchors.fill: instrument
radius: width / 2
color: "black"
visible: false
}
OpacityMask {
anchors.fill: instrument
source: instrument
maskSource: mask
}
}
...@@ -14,11 +14,12 @@ ...@@ -14,11 +14,12 @@
* @author Gus Grubba <mavlink@grubba.com> * @author Gus Grubba <mavlink@grubba.com>
*/ */
import QtQuick 2.7 import QtQuick 2.7
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Item { Item {
id: root id: root
...@@ -26,6 +27,7 @@ Item { ...@@ -26,6 +27,7 @@ Item {
property bool showPitch: true property bool showPitch: true
property var vehicle: null property var vehicle: null
property real size property real size
property bool showHeading: false
property real _rollAngle: vehicle ? vehicle.roll.rawValue : 0 property real _rollAngle: vehicle ? vehicle.roll.rawValue : 0
property real _pitchAngle: vehicle ? vehicle.pitch.rawValue : 0 property real _pitchAngle: vehicle ? vehicle.pitch.rawValue : 0
...@@ -117,4 +119,16 @@ Item { ...@@ -117,4 +119,16 @@ Item {
border.width: 2 border.width: 2
} }
QGCLabel {
anchors.bottomMargin: Math.round(ScreenTools.defaultFontPixelHeight * .75)
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
text: _headingString3
color: "white"
visible: showHeading
property string _headingString: vehicle ? vehicle.heading.rawValue.toFixed(0) : "OFF"
property string _headingString2: _headingString.length === 1 ? "0" + _headingString : _headingString
property string _headingString3: _headingString2.length === 2 ? "0" + _headingString2 : _headingString2
}
} }
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
* @author Gus Grubba <mavlink@grubba.com> * @author Gus Grubba <mavlink@grubba.com>
*/ */
import QtQuick 2.7 import QtQuick 2.7
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
...@@ -79,11 +79,15 @@ Item { ...@@ -79,11 +79,15 @@ Item {
color: Qt.rgba(0,0,0,0.65) color: Qt.rgba(0,0,0,0.65)
QGCLabel { QGCLabel {
text: vehicle ? _heading.toFixed(0) : qsTr("OFF") text: _headingString3
font.family: vehicle ? ScreenTools.demiboldFontFamily : ScreenTools.normalFontFamily font.family: vehicle ? ScreenTools.demiboldFontFamily : ScreenTools.normalFontFamily
font.pointSize: _fontSize < 8 ? 8 : _fontSize; font.pointSize: _fontSize < 8 ? 8 : _fontSize;
color: "white" color: "white"
anchors.centerIn: parent anchors.centerIn: parent
property string _headingString: vehicle ? _heading.toFixed(0) : "OFF"
property string _headingString2: _headingString.length === 1 ? "0" + _headingString : _headingString
property string _headingString3: _headingString2.length === 2 ? "0" + _headingString2 : _headingString2
} }
} }
} }
......
...@@ -7,13 +7,6 @@ ...@@ -7,13 +7,6 @@
* *
****************************************************************************/ ****************************************************************************/
/**
* @file
* @brief QGC Fly View Widgets
* @author Gus Grubba <mavlink@grubba.com>
*/
import QtQuick 2.7 import QtQuick 2.7
import QGroundControl 1.0 import QGroundControl 1.0
...@@ -23,34 +16,30 @@ import QGroundControl.FactSystem 1.0 ...@@ -23,34 +16,30 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FlightMap 1.0 import QGroundControl.FlightMap 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Rectangle {
id: instrumentPanel id: instrumentPanel
height: instrumentColumn.y + instrumentColumn.height + _topBottomMargin height: instrumentColumn.height + (_topBottomMargin * 2)
width: getPreferredInstrumentWidth() width: getPreferredInstrumentWidth()
radius: _showLargeCompass ? width / 2 : ScreenTools.defaultFontPixelWidth / 2
property var _qgcView: qgcView color: _backgroundColor
property real _maxHeight: maxHeight border.width: _showLargeCompass ? 1 : 0
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9) border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property color _backgroundColor: qgcPal.window
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33 property var _qgcView: qgcView
property real _topBottomMargin: (width * 0.05) / 2 property real _maxHeight: maxHeight
property real _availableValueHeight: _maxHeight - (attitudeWidget.height + _spacer1.height + _spacer2.height + (_spacing * 4)) - (_showCompass ? compass.height : 0) property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property color _backgroundColor: qgcPal.window
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
readonly property bool _showCompass: true // !ScreenTools.isShortScreen property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: _maxHeight - (outerCompass.height + _spacer1.height + _spacer2.height + (_spacing * 4)) - (_showLargeCompass ? compass.height : 0)
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _showLargeCompass: QGroundControl.settingsManager.appSettings.showLargeCompass.value
readonly property real _outerRingRatio: 0.95
readonly property real _innerRingRatio: 0.80
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: (_showCompass ? instrumentColumn.height : attitudeWidget.height) + (_topBottomMargin * 2)
radius: width / 2
color: _backgroundColor
border.width: 1
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: _valuesWidget.showPicker() onClicked: _valuesWidget.showPicker()
...@@ -66,23 +55,33 @@ Item { ...@@ -66,23 +55,33 @@ Item {
Item { Item {
width: parent.width width: parent.width
height: attitudeWidget.height height: outerCompass.height
QGCAttitudeWidget { CompassRing {
id: attitudeWidget id: outerCompass
size: parent.width * 0.95 size: parent.width * _outerRingRatio
vehicle: _activeVehicle vehicle: _activeVehicle
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: !_showLargeCompass
}
QGCAttitudeWidget {
id: attitudeWidget
size: parent.width * (_showLargeCompass ? _outerRingRatio : _innerRingRatio)
vehicle: _activeVehicle
anchors.centerIn: outerCompass
showHeading: !_showLargeCompass
} }
Image { Image {
id: gearThingy id: gearThingy
anchors.bottom: attitudeWidget.bottom anchors.bottom: outerCompass.bottom
anchors.right: attitudeWidget.right anchors.right: outerCompass.right
source: qgcPal.globalTheme == QGCPalette.Light ? "/res/gear-black.svg" : "/res/gear-white.svg" source: qgcPal.globalTheme == QGCPalette.Light ? "/res/gear-black.svg" : "/res/gear-white.svg"
mipmap: true mipmap: true
opacity: 0.5 opacity: 0.5
width: attitudeWidget.width * 0.15 width: outerCompass.width * 0.15
sourceSize.width: width sourceSize.width: width
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
MouseArea { MouseArea {
...@@ -96,11 +95,11 @@ Item { ...@@ -96,11 +95,11 @@ Item {
} }
Rectangle { Rectangle {
id: _spacer1 id: _spacer1
height: 1 anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * 0.9 height: 1
color: qgcPal.text width: parent.width * 0.9
anchors.horizontalCenter: parent.horizontalCenter color: qgcPal.text
} }
Item { Item {
...@@ -110,8 +109,8 @@ Item { ...@@ -110,8 +109,8 @@ Item {
Rectangle { Rectangle {
anchors.fill: _valuesWidget anchors.fill: _valuesWidget
color: _backgroundColor color: _backgroundColor
visible: !_showCompass
radius: _spacing radius: _spacing
visible: !_showLargeCompass
} }
InstrumentSwipeView { InstrumentSwipeView {
...@@ -127,20 +126,20 @@ Item { ...@@ -127,20 +126,20 @@ Item {
} }
Rectangle { Rectangle {
id: _spacer2 id: _spacer2
height: 1 anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * 0.9 height: 1
color: qgcPal.text width: parent.width * 0.9
visible: _showCompass color: qgcPal.text
anchors.horizontalCenter: parent.horizontalCenter visible: _showLargeCompass
} }
QGCCompassWidget { QGCCompassWidget {
id: compass id: compass
size: parent.width * 0.95 anchors.horizontalCenter: parent.horizontalCenter
visible: _showCompass size: parent.width * 0.95
vehicle: _activeVehicle vehicle: _activeVehicle
anchors.horizontalCenter: parent.horizontalCenter visible: _showLargeCompass
} }
} }
} }
...@@ -15,6 +15,7 @@ import QtQuick.Layouts 1.3 ...@@ -15,6 +15,7 @@ import QtQuick.Layouts 1.3
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl 1.0 import QGroundControl 1.0
...@@ -147,21 +148,42 @@ QGCFlickable { ...@@ -147,21 +148,42 @@ QGCFlickable {
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
clip: true clip: true
QGCLabel { Column {
id: _label id: column
text: qsTr("Select the values you want to display:") anchors.left: parent.left
} anchors.right: parent.right
spacing: _margins
Loader { FactCheckBox {
id: _loader text: qsTr("Show large compass")
anchors.left: parent.left fact: _showLargeCompass
anchors.right: parent.right visible: _showLargeCompass.visible
anchors.topMargin: _margins
anchors.top: _label.bottom property Fact _showLargeCompass: QGroundControl.settingsManager.appSettings.showLargeCompass
sourceComponent: factGroupList }
property var factGroup: _activeVehicle Item {
property var factGroupName: "Vehicle" width: 1
height: _margins
}
QGCLabel {
id: _label
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("Select the values you want to display:")
}
Loader {
id: _loader
anchors.left: parent.left
anchors.right: parent.right
sourceComponent: factGroupList
property var factGroup: _activeVehicle
property var factGroupName: "Vehicle"
}
} }
} }
} }
......
...@@ -8,6 +8,7 @@ QGCVideoBackground 1.0 QGCVideoBackground.qml ...@@ -8,6 +8,7 @@ QGCVideoBackground 1.0 QGCVideoBackground.qml
CameraWidget 1.0 CameraWidget.qml CameraWidget 1.0 CameraWidget.qml
CenterMapDropButton 1.0 CenterMapDropButton.qml CenterMapDropButton 1.0 CenterMapDropButton.qml
CenterMapDropPanel 1.0 CenterMapDropPanel.qml CenterMapDropPanel 1.0 CenterMapDropPanel.qml
CompassRing 1.0 CompassRing.qml
InstrumentSwipeView 1.0 InstrumentSwipeView.qml InstrumentSwipeView 1.0 InstrumentSwipeView.qml
MapFitFunctions 1.0 MapFitFunctions.qml MapFitFunctions 1.0 MapFitFunctions.qml
MapScale 1.0 MapScale.qml MapScale 1.0 MapScale.qml
......
...@@ -107,5 +107,12 @@ ...@@ -107,5 +107,12 @@
"type": "uint32", "type": "uint32",
"enumStrings": "Indoor,Outdoor", "enumStrings": "Indoor,Outdoor",
"enumValues": "1,0" "enumValues": "1,0"
},
{
"name": "ShowLargeCompass",
"shortDescription": "Show large compass",
"longDescription": "Show large compass on instrument panel",
"type": "bool",
"defaultValue": false
} }
] ]
...@@ -28,6 +28,7 @@ const char* AppSettings::audioMutedName = "AudioMu ...@@ -28,6 +28,7 @@ const char* AppSettings::audioMutedName = "AudioMu
const char* AppSettings::virtualJoystickName = "VirtualTabletJoystick"; const char* AppSettings::virtualJoystickName = "VirtualTabletJoystick";
const char* AppSettings::appFontPointSizeName = "BaseDeviceFontPointSize"; const char* AppSettings::appFontPointSizeName = "BaseDeviceFontPointSize";
const char* AppSettings::indoorPaletteName = "StyleIsDark"; const char* AppSettings::indoorPaletteName = "StyleIsDark";
const char* AppSettings::showLargeCompassName = "ShowLargeCompass";
AppSettings::AppSettings(QObject* parent) AppSettings::AppSettings(QObject* parent)
: SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent) : SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent)
...@@ -44,6 +45,7 @@ AppSettings::AppSettings(QObject* parent) ...@@ -44,6 +45,7 @@ AppSettings::AppSettings(QObject* parent)
, _virtualJoystickFact(NULL) , _virtualJoystickFact(NULL)
, _appFontPointSizeFact(NULL) , _appFontPointSizeFact(NULL)
, _indoorPaletteFact(NULL) , _indoorPaletteFact(NULL)
, _showLargeCompassFact(NULL)
{ {
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only"); qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
...@@ -171,3 +173,13 @@ void AppSettings::_indoorPaletteChanged(void) ...@@ -171,3 +173,13 @@ void AppSettings::_indoorPaletteChanged(void)
qgcApp()->_loadCurrentStyleSheet(); qgcApp()->_loadCurrentStyleSheet();
QGCPalette::setGlobalTheme(indoorPalette()->rawValue().toBool() ? QGCPalette::Dark : QGCPalette::Light); QGCPalette::setGlobalTheme(indoorPalette()->rawValue().toBool() ? QGCPalette::Dark : QGCPalette::Light);
} }
Fact* AppSettings::showLargeCompass(void)
{
if (!_showLargeCompassFact) {
_showLargeCompassFact = _createSettingsFact(showLargeCompassName);
}
return _showLargeCompassFact;
}
...@@ -32,6 +32,7 @@ public: ...@@ -32,6 +32,7 @@ public:
Q_PROPERTY(Fact* virtualJoystick READ virtualJoystick CONSTANT) Q_PROPERTY(Fact* virtualJoystick READ virtualJoystick CONSTANT)
Q_PROPERTY(Fact* appFontPointSize READ appFontPointSize CONSTANT) Q_PROPERTY(Fact* appFontPointSize READ appFontPointSize CONSTANT)
Q_PROPERTY(Fact* indoorPalette READ indoorPalette CONSTANT) Q_PROPERTY(Fact* indoorPalette READ indoorPalette CONSTANT)
Q_PROPERTY(Fact* showLargeCompass READ showLargeCompass CONSTANT)
Fact* offlineEditingFirmwareType (void); Fact* offlineEditingFirmwareType (void);
Fact* offlineEditingVehicleType (void); Fact* offlineEditingVehicleType (void);
...@@ -46,6 +47,7 @@ public: ...@@ -46,6 +47,7 @@ public:
Fact* virtualJoystick (void); Fact* virtualJoystick (void);
Fact* appFontPointSize (void); Fact* appFontPointSize (void);
Fact* indoorPalette (void); Fact* indoorPalette (void);
Fact* showLargeCompass (void);
static const char* appSettingsGroupName; static const char* appSettingsGroupName;
...@@ -62,6 +64,7 @@ public: ...@@ -62,6 +64,7 @@ public:
static const char* virtualJoystickName; static const char* virtualJoystickName;
static const char* appFontPointSizeName; static const char* appFontPointSizeName;
static const char* indoorPaletteName; static const char* indoorPaletteName;
static const char* showLargeCompassName;
private slots: private slots:
void _indoorPaletteChanged(void); void _indoorPaletteChanged(void);
...@@ -80,6 +83,7 @@ private: ...@@ -80,6 +83,7 @@ private:
SettingsFact* _virtualJoystickFact; SettingsFact* _virtualJoystickFact;
SettingsFact* _appFontPointSizeFact; SettingsFact* _appFontPointSizeFact;
SettingsFact* _indoorPaletteFact; SettingsFact* _indoorPaletteFact;
SettingsFact* _showLargeCompassFact;
}; };
#endif #endif
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