Commit ea3f13d0 authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent 88575cd6
This diff is collapsed.
...@@ -359,7 +359,7 @@ CustomBuild { ...@@ -359,7 +359,7 @@ CustomBuild {
$$PWD/qgroundcontrol.qrc \ $$PWD/qgroundcontrol.qrc \
$$PWD/qgcresources.qrc \ $$PWD/qgcresources.qrc \
$$PWD/qgcimages.qrc \ $$PWD/qgcimages.qrc \
$$PWD/InstrumentValueIcons.qrc \ $$PWD/resources/InstrumentValueIcons/InstrumentValueIcons.qrc \
} }
# On Qt 5.9 android versions there is the following bug: https://bugreports.qt.io/browse/QTBUG-61424 # On Qt 5.9 android versions there is the following bug: https://bugreports.qt.io/browse/QTBUG-61424
...@@ -647,8 +647,9 @@ HEADERS += \ ...@@ -647,8 +647,9 @@ HEADERS += \
src/QmlControls/AppMessages.h \ src/QmlControls/AppMessages.h \
src/QmlControls/EditPositionDialogController.h \ src/QmlControls/EditPositionDialogController.h \
src/QmlControls/FlightPathSegment.h \ src/QmlControls/FlightPathSegment.h \
src/QmlControls/HorizontalFactValueGrid.h \
src/QmlControls/InstrumentValueData.h \ src/QmlControls/InstrumentValueData.h \
src/QmlControls/InstrumentValueArea.h \ src/QmlControls/FactValueGrid.h \
src/QmlControls/ParameterEditorController.h \ src/QmlControls/ParameterEditorController.h \
src/QmlControls/QGCFileDialogController.h \ src/QmlControls/QGCFileDialogController.h \
src/QmlControls/QGCImageProvider.h \ src/QmlControls/QGCImageProvider.h \
...@@ -661,6 +662,7 @@ HEADERS += \ ...@@ -661,6 +662,7 @@ HEADERS += \
src/QmlControls/TerrainProfile.h \ src/QmlControls/TerrainProfile.h \
src/QmlControls/ToolStripAction.h \ src/QmlControls/ToolStripAction.h \
src/QmlControls/ToolStripActionList.h \ src/QmlControls/ToolStripActionList.h \
src/QmlControls/VerticalFactValueGrid.h \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \ src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \
src/Settings/ADSBVehicleManagerSettings.h \ src/Settings/ADSBVehicleManagerSettings.h \
src/Settings/AppSettings.h \ src/Settings/AppSettings.h \
...@@ -857,8 +859,9 @@ SOURCES += \ ...@@ -857,8 +859,9 @@ SOURCES += \
src/QmlControls/AppMessages.cc \ src/QmlControls/AppMessages.cc \
src/QmlControls/EditPositionDialogController.cc \ src/QmlControls/EditPositionDialogController.cc \
src/QmlControls/FlightPathSegment.cc \ src/QmlControls/FlightPathSegment.cc \
src/QmlControls/HorizontalFactValueGrid.cc \
src/QmlControls/InstrumentValueData.cc \ src/QmlControls/InstrumentValueData.cc \
src/QmlControls/InstrumentValueArea.cc \ src/QmlControls/FactValueGrid.cc \
src/QmlControls/ParameterEditorController.cc \ src/QmlControls/ParameterEditorController.cc \
src/QmlControls/QGCFileDialogController.cc \ src/QmlControls/QGCFileDialogController.cc \
src/QmlControls/QGCImageProvider.cc \ src/QmlControls/QGCImageProvider.cc \
...@@ -871,6 +874,7 @@ SOURCES += \ ...@@ -871,6 +874,7 @@ SOURCES += \
src/QmlControls/TerrainProfile.cc \ src/QmlControls/TerrainProfile.cc \
src/QmlControls/ToolStripAction.cc \ src/QmlControls/ToolStripAction.cc \
src/QmlControls/ToolStripActionList.cc \ src/QmlControls/ToolStripActionList.cc \
src/QmlControls/VerticalFactValueGrid.cc \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \ src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \
src/Settings/ADSBVehicleManagerSettings.cc \ src/Settings/ADSBVehicleManagerSettings.cc \
src/Settings/AppSettings.cc \ src/Settings/AppSettings.cc \
......
...@@ -98,9 +98,10 @@ ...@@ -98,9 +98,10 @@
<file alias="QGroundControl/Controls/FWLandingPatternMapVisual.qml">src/PlanView/FWLandingPatternMapVisual.qml</file> <file alias="QGroundControl/Controls/FWLandingPatternMapVisual.qml">src/PlanView/FWLandingPatternMapVisual.qml</file>
<file alias="QGroundControl/Controls/GeoFenceEditor.qml">src/PlanView/GeoFenceEditor.qml</file> <file alias="QGroundControl/Controls/GeoFenceEditor.qml">src/PlanView/GeoFenceEditor.qml</file>
<file alias="QGroundControl/Controls/GeoFenceMapVisuals.qml">src/PlanView/GeoFenceMapVisuals.qml</file> <file alias="QGroundControl/Controls/GeoFenceMapVisuals.qml">src/PlanView/GeoFenceMapVisuals.qml</file>
<file alias="QGroundControl/Controls/HorizontalFactValueGrid.qml">src/QmlControls/HorizontalFactValueGrid.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file> <file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/InstrumentValue.qml">src/QmlControls/InstrumentValue.qml</file> <file alias="QGroundControl/Controls/InstrumentValueLabel.qml">src/QmlControls/InstrumentValueLabel.qml</file>
<file alias="QGroundControl/Controls/InstrumentValueArea.qml">src/QmlControls/InstrumentValueArea.qml</file> <file alias="QGroundControl/Controls/InstrumentValueValue.qml">src/QmlControls/InstrumentValueValue.qml</file>
<file alias="QGroundControl/Controls/InstrumentValueEditDialog.qml">src/QmlControls/InstrumentValueEditDialog.qml</file> <file alias="QGroundControl/Controls/InstrumentValueEditDialog.qml">src/QmlControls/InstrumentValueEditDialog.qml</file>
<file alias="QGroundControl/Controls/JoystickThumbPad.qml">src/QmlControls/JoystickThumbPad.qml</file> <file alias="QGroundControl/Controls/JoystickThumbPad.qml">src/QmlControls/JoystickThumbPad.qml</file>
<file alias="QGroundControl/Controls/KMLOrSHPFileDialog.qml">src/QmlControls/KMLOrSHPFileDialog.qml</file> <file alias="QGroundControl/Controls/KMLOrSHPFileDialog.qml">src/QmlControls/KMLOrSHPFileDialog.qml</file>
...@@ -182,6 +183,7 @@ ...@@ -182,6 +183,7 @@
<file alias="QGroundControl/Controls/TransectStyleComplexItemStats.qml">src/PlanView/TransectStyleComplexItemStats.qml</file> <file alias="QGroundControl/Controls/TransectStyleComplexItemStats.qml">src/PlanView/TransectStyleComplexItemStats.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file> <file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file> <file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/VerticalFactValueGrid.qml">src/QmlControls/VerticalFactValueGrid.qml</file>
<file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file> <file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file>
<file alias="QGroundControl/FactControls/AltitudeFactTextField.qml">src/FactSystem/FactControls/AltitudeFactTextField.qml</file> <file alias="QGroundControl/FactControls/AltitudeFactTextField.qml">src/FactSystem/FactControls/AltitudeFactTextField.qml</file>
<file alias="QGroundControl/FactControls/FactBitmask.qml">src/FactSystem/FactControls/FactBitmask.qml</file> <file alias="QGroundControl/FactControls/FactBitmask.qml">src/FactSystem/FactControls/FactBitmask.qml</file>
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ def main(): ...@@ -10,7 +10,7 @@ def main():
files = os.listdir(".") files = os.listdir(".")
for filename in files: for filename in files:
if filename.endswith(".svg"): if filename.endswith(".svg"):
qrcFile.write("\t\t<file alias=\"%s\">resources/InstrumentValueIcons/%s</file>\n" % (filename, filename)) qrcFile.write("\t\t<file alias=\"%s\">%s</file>\n" % (filename, filename))
qrcFile.write("\t</qresource>\n") qrcFile.write("\t</qresource>\n")
qrcFile.write("</RCC>\n") qrcFile.write("</RCC>\n")
......
...@@ -23,12 +23,11 @@ import QGroundControl.FlightMap 1.0 ...@@ -23,12 +23,11 @@ import QGroundControl.FlightMap 1.0
import QGroundControl 1.0 import QGroundControl 1.0
/// Value page for InstrumentPanel PageView /// Value page for InstrumentPanel PageView
InstrumentValueArea { VerticalFactValueGrid {
id: _root id: _root
width: pageWidth width: pageWidth
userSettingsGroup: valuePageUserSettingsGroup userSettingsGroup: valuePageUserSettingsGroup
defaultSettingsGroup: valuePageDefaultSettingsGroup defaultSettingsGroup: valuePageDefaultSettingsGroup
orientation: InstrumentValueArea.VerticalOrientation
property bool showSettingsIcon: true property bool showSettingsIcon: true
property bool showLockIcon: true property bool showLockIcon: true
......
...@@ -78,7 +78,8 @@ ...@@ -78,7 +78,8 @@
#if defined(QGC_ENABLE_MAVLINK_INSPECTOR) #if defined(QGC_ENABLE_MAVLINK_INSPECTOR)
#include "MAVLinkInspectorController.h" #include "MAVLinkInspectorController.h"
#endif #endif
#include "InstrumentValueArea.h" #include "HorizontalFactValueGrid.h"
#include "VerticalFactValueGrid.h"
#include "InstrumentValueData.h" #include "InstrumentValueData.h"
#include "AppMessages.h" #include "AppMessages.h"
#include "SimulatedPosition.h" #include "SimulatedPosition.h"
...@@ -543,7 +544,9 @@ void QGCApplication::_initCommon() ...@@ -543,7 +544,9 @@ void QGCApplication::_initCommon()
qmlRegisterUncreatableType<QGCGeoBoundingCube> ("QGroundControl.FlightMap", 1, 0, "QGCGeoBoundingCube", kRefOnly); qmlRegisterUncreatableType<QGCGeoBoundingCube> ("QGroundControl.FlightMap", 1, 0, "QGCGeoBoundingCube", kRefOnly);
qmlRegisterUncreatableType<TrajectoryPoints> ("QGroundControl.FlightMap", 1, 0, "TrajectoryPoints", kRefOnly); qmlRegisterUncreatableType<TrajectoryPoints> ("QGroundControl.FlightMap", 1, 0, "TrajectoryPoints", kRefOnly);
qmlRegisterType<InstrumentValueArea> (kQGCTemplates, 1, 0, "InstrumentValueArea"); qmlRegisterUncreatableType<FactValueGrid> (kQGCTemplates, 1, 0, "FactValueGrid", kRefOnly);
qmlRegisterType<HorizontalFactValueGrid> (kQGCTemplates, 1, 0, "HorizontalFactValueGrid");
qmlRegisterType<VerticalFactValueGrid> (kQGCTemplates, 1, 0, "VerticalFactValueGrid");
qmlRegisterType<QGCMapCircle> ("QGroundControl.FlightMap", 1, 0, "QGCMapCircle"); qmlRegisterType<QGCMapCircle> ("QGroundControl.FlightMap", 1, 0, "QGCMapCircle");
...@@ -551,7 +554,6 @@ void QGCApplication::_initCommon() ...@@ -551,7 +554,6 @@ void QGCApplication::_initCommon()
qmlRegisterType<ESP8266ComponentController> (kQGCControllers, 1, 0, "ESP8266ComponentController"); qmlRegisterType<ESP8266ComponentController> (kQGCControllers, 1, 0, "ESP8266ComponentController");
qmlRegisterType<ScreenToolsController> (kQGCControllers, 1, 0, "ScreenToolsController"); qmlRegisterType<ScreenToolsController> (kQGCControllers, 1, 0, "ScreenToolsController");
qmlRegisterType<PlanMasterController> (kQGCControllers, 1, 0, "PlanMasterController"); qmlRegisterType<PlanMasterController> (kQGCControllers, 1, 0, "PlanMasterController");
qmlRegisterType<InstrumentValueArea> (kQGCTemplates, 1, 0, "InstrumentValueArea");
qmlRegisterType<QGCFileDialogController> (kQGCControllers, 1, 0, "QGCFileDialogController"); qmlRegisterType<QGCFileDialogController> (kQGCControllers, 1, 0, "QGCFileDialogController");
qmlRegisterType<RCChannelMonitorController> (kQGCControllers, 1, 0, "RCChannelMonitorController"); qmlRegisterType<RCChannelMonitorController> (kQGCControllers, 1, 0, "RCChannelMonitorController");
qmlRegisterType<JoystickConfigController> (kQGCControllers, 1, 0, "JoystickConfigController"); qmlRegisterType<JoystickConfigController> (kQGCControllers, 1, 0, "JoystickConfigController");
......
This diff is collapsed.
...@@ -13,17 +13,18 @@ ...@@ -13,17 +13,18 @@
#include "QmlObjectListModel.h" #include "QmlObjectListModel.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include <QQuickItem> #include <QGridLayout>
#include <QSettings>
class InstrumentValueData; class InstrumentValueData;
class InstrumentValueArea : public QQuickItem class FactValueGrid : public QQuickItem
{ {
Q_OBJECT Q_OBJECT
public: public:
InstrumentValueArea(QQuickItem *parent = nullptr); FactValueGrid(QQuickItem *parent = nullptr);
InstrumentValueArea(const QString& defaultSettingsGroup); FactValueGrid(const QString& defaultSettingsGroup);
enum Orientation { enum Orientation {
HorizontalOrientation=0, // Labels will be to the left of the value HorizontalOrientation=0, // Labels will be to the left of the value
...@@ -39,77 +40,72 @@ public: ...@@ -39,77 +40,72 @@ public:
}; };
Q_ENUMS(FontSize) Q_ENUMS(FontSize)
// valuePageDefaultSettingsGroup: // defaultSettingsGroup:
// This is the setting group name for default settings which are used when the user has not modified anything from the default setup. These settings will be overwritten // This is the setting group name for default settings which are used when the user has not modified anything from the default setup. These settings will be overwritten
// prior to each use by the call to QGCCorePlugin::instrumentValueAreaCreateDefaultSettings. // prior to each use by the call to QGCCorePlugin::FactValueGridCreateDefaultSettings.
// valuePageUserSettingsGroup: // userSettingsGroup:
// This is the settings group name for user modified settings. Settings will be saved to here whenever the user modified anything. Also at that point in time the // This is the settings group name for user modified settings. Settings will be saved to here whenever the user modified anything. Also at that point in time the
// defaults settings group will be removed. // defaults settings group will be removed.
// The combination of the two valuePage*SettingsGroup values allows each InstrumentValueArea to have it's own persistence space. // The combination of the two valuePage*SettingsGroup values allows each FactValueGrid to have it's own persistence space.
Q_PROPERTY(QString valuePageDefaultSettingsGroup MEMBER valuePageDefaultSettingsGroup CONSTANT) Q_PROPERTY(QmlObjectListModel* rows MEMBER _rows NOTIFY rowsChanged)
Q_PROPERTY(QString valuePageUserSettingsGroup MEMBER _valuePageUserSettingsGroup CONSTANT) Q_PROPERTY(int columnCount MEMBER _columnCount NOTIFY columnCountChanged)
Q_PROPERTY(QString userSettingsGroup MEMBER _userSettingsGroup NOTIFY userSettingsGroupChanged) Q_PROPERTY(QString userSettingsGroup MEMBER _userSettingsGroup NOTIFY userSettingsGroupChanged)
Q_PROPERTY(QString defaultSettingsGroup MEMBER _defaultSettingsGroup NOTIFY defaultSettingsGroupChanged) Q_PROPERTY(QString defaultSettingsGroup MEMBER _defaultSettingsGroup NOTIFY defaultSettingsGroupChanged)
Q_PROPERTY(Orientation orientation MEMBER _orientation NOTIFY orientationChanged) Q_PROPERTY(Orientation orientation MEMBER _orientation CONSTANT)
Q_PROPERTY(QStringList iconNames READ iconNames CONSTANT) Q_PROPERTY(QStringList iconNames READ iconNames CONSTANT)
Q_PROPERTY(FontSize fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) Q_PROPERTY(FontSize fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(QStringList fontSizeNames MEMBER _fontSizeNames CONSTANT) Q_PROPERTY(QStringList fontSizeNames MEMBER _fontSizeNames CONSTANT)
Q_PROPERTY(QmlObjectListModel* rowValues MEMBER _rowValues NOTIFY rowValuesChanged)
Q_INVOKABLE InstrumentValueData* appendColumn (int rowIndex); Q_INVOKABLE void resetToDefaults (void);
Q_INVOKABLE void deleteLastColumn (int rowIndex); Q_INVOKABLE QmlObjectListModel* appendRow (void);
Q_INVOKABLE QmlObjectListModel* appendRow (bool addBlanksColumn = true); Q_INVOKABLE void deleteLastRow (void);
Q_INVOKABLE QmlObjectListModel* insertRow (int atIndex, bool addBlanksColumn = true); Q_INVOKABLE void appendColumn (void);
Q_INVOKABLE void deleteRow (int rowIndex); Q_INVOKABLE void deleteLastColumn (void);
Q_INVOKABLE void resetToDefaults (void);
FontSize fontSize (void) const { return _fontSize; } FontSize fontSize (void) const { return _fontSize; }
QmlObjectListModel* rowValues (void) { return _rowValues; } QStringList iconNames (void) const { return _iconNames; }
QStringList iconNames (void) const { return _iconNames; }
void setFontSize(FontSize fontSize); void setFontSize(FontSize fontSize);
// Override from QQmlParserStatus // Override from QQmlParserStatus
void componentComplete(void) final; void componentComplete(void) final;
static const QString valuePageDefaultSettingsGroup;
signals: signals:
void userSettingsGroupChanged (const QString& userSettingsGroup); void userSettingsGroupChanged (const QString& userSettingsGroup);
void defaultSettingsGroupChanged(const QString& defaultSettingsGroup); void defaultSettingsGroupChanged(const QString& defaultSettingsGroup);
void rowValuesChanged (QmlObjectListModel* rowValues);
void orientationChanged (Orientation orientation);
void fontSizeChanged (FontSize fontSize); void fontSizeChanged (FontSize fontSize);
void rowsChanged (QmlObjectListModel* model);
void columnCountChanged (int columnCount);
private slots: protected:
void _saveSettings(void);
private:
void _connectSignals (void);
void _checkForDeprecatedSettings (void);
bool _validRowIndex (int rowIndex);
InstrumentValueData* _createNewInstrumentValueWorker (QmlObjectListModel* rowModel);
void _loadSettings (void);
QString _pascalCase (const QString& text);
Q_DISABLE_COPY(InstrumentValueArea) Q_DISABLE_COPY(FactValueGrid)
QString _defaultSettingsGroup; // Settings group to read from if the user has not modified from the default settings QString _defaultSettingsGroup; // Settings group to read from if the user has not modified from the default settings
QString _userSettingsGroup; // Settings group to read from for user modified settings QString _userSettingsGroup; // Settings group to read from for user modified settings
Orientation _orientation = VerticalOrientation; Orientation _orientation = VerticalOrientation;
FontSize _fontSize = DefaultFontSize; FontSize _fontSize = DefaultFontSize;
QmlObjectListModel* _rowValues = nullptr;
bool _preventSaveSettings = false; bool _preventSaveSettings = false;
QmlObjectListModel* _rows = nullptr;
int _columnCount = 0;
private:
InstrumentValueData* _createNewInstrumentValueWorker (QObject* parent);
void _saveSettings (void);
void _loadSettings (void);
void _connectSignals (void);
void _connectSaveSignals (InstrumentValueData* value);
QString _pascalCase (const QString& text);
void _saveValueData (QSettings& settings, InstrumentValueData* value);
void _loadValueData (QSettings& settings, InstrumentValueData* value);
// These are user facing string for the various enums. // These are user facing string for the various enums.
static QStringList _iconNames; static QStringList _iconNames;
static const QStringList _fontSizeNames; static const QStringList _fontSizeNames;
static const QString _valuePageUserSettingsGroup;
static const char* _versionKey; static const char* _versionKey;
static const char* _rowsKey; static const char* _rowsKey;
static const char* _columnsKey; static const char* _columnsKey;
...@@ -129,7 +125,7 @@ private: ...@@ -129,7 +125,7 @@ private:
static const char* _deprecatedGroupKey; static const char* _deprecatedGroupKey;
}; };
QML_DECLARE_TYPE(InstrumentValueArea) QML_DECLARE_TYPE(FactValueGrid)
Q_DECLARE_METATYPE(InstrumentValueArea::FontSize) Q_DECLARE_METATYPE(FactValueGrid::FontSize)
Q_DECLARE_METATYPE(InstrumentValueArea::Orientation) Q_DECLARE_METATYPE(FactValueGrid::Orientation)
/****************************************************************************
*
* (c) 2009-2020 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.
*
****************************************************************************/
#include "HorizontalFactValueGrid.h"
#include "InstrumentValueData.h"
#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include <QSettings>
const QString HorizontalFactValueGrid::_toolbarUserSettingsGroup ("ToolbarUserSettings2");
const QString HorizontalFactValueGrid::toolbarDefaultSettingsGroup ("ToolbarDefaultSettings2");
HorizontalFactValueGrid::HorizontalFactValueGrid(QQuickItem* parent)
: FactValueGrid(parent)
{
_orientation = HorizontalOrientation;
}
HorizontalFactValueGrid::HorizontalFactValueGrid(const QString& defaultSettingsGroup)
: FactValueGrid(defaultSettingsGroup)
{
_orientation = HorizontalOrientation;
}
/****************************************************************************
*
* (c) 2009-2020 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.
*
****************************************************************************/
#pragma once
#include "FactSystem.h"
#include "QmlObjectListModel.h"
#include "QGCApplication.h"
#include "FactValueGrid.h"
class InstrumentValueData;
class HorizontalFactValueGrid : public FactValueGrid
{
Q_OBJECT
public:
HorizontalFactValueGrid(QQuickItem *parent = nullptr);
HorizontalFactValueGrid(const QString& defaultSettingsGroup);
Q_PROPERTY(QString toolbarDefaultSettingsGroup MEMBER toolbarDefaultSettingsGroup CONSTANT)
Q_PROPERTY(QString toolbarUserSettingsGroup MEMBER _toolbarUserSettingsGroup CONSTANT)
static const QString toolbarDefaultSettingsGroup;
private:
Q_DISABLE_COPY(HorizontalFactValueGrid)
static const QString _toolbarUserSettingsGroup;
};
QML_DECLARE_TYPE(HorizontalFactValueGrid)
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.5
import QtQml 2.12
import QGroundControl.Templates 1.0 as T
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl 1.0
// Note: This control will spit out qWarnings like this: "QGridLayoutEngine::addItem: Cell (0, 1) already taken"
// This is due to Qt bug https://bugreports.qt.io/browse/QTBUG-65121
// If this becomes a problem I'll implement our own grid layout control
T.HorizontalFactValueGrid {
id: _root
width: topLevelRowLayout.width
property bool settingsUnlocked: false
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property int _rowMax: 2
property real _rowButtonWidth: ScreenTools.minTouchPixels
property real _rowButtonHeight: ScreenTools.minTouchPixels / 2
property real _editButtonSpacing: 2
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
RowLayout {
id: topLevelRowLayout
height: parent.height
Item {
id: lockItem
Layout.fillHeight: true
width: ScreenTools.minTouchPixels
visible: settingsUnlocked
enabled: settingsUnlocked
QGCColoredImage {
anchors.centerIn: parent
source: "/res/LockOpen.svg"
mipmap: true
width: parent.width * 0.75
height: width
sourceSize.width: width
color: qgcPal.text
fillMode: Image.PreserveAspectFit
}
QGCMouseArea {
fillItem: parent
onClicked: settingsUnlocked = false
}
}
ColumnLayout {
Layout.fillHeight: true
GridLayout {
id: valueGrid
Layout.preferredHeight: _root.height
rows: _root.rows.count
rowSpacing: 0
Repeater {
model: _root.rows
Repeater {
id: labelRepeater
model: object
property real _index: index
InstrumentValueLabel {
Layout.row: labelRepeater._index
Layout.column: index * 2
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
instrumentValueData: object
}
}
}
Repeater {
model: _root.rows
Repeater {
id: valueRepeater
model: object
property real _index: index
InstrumentValueValue {
Layout.row: valueRepeater._index
Layout.column: index * 2 + 1
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft
instrumentValueData: object
}
}
}
}
RowLayout {
id: rowButtons
height: ScreenTools.minTouchPixels / 2
Layout.fillWidth: true
spacing: 1
visible: settingsUnlocked
enabled: settingsUnlocked
QGCButton {
Layout.fillWidth: true
Layout.preferredHeight: parent.height
text: qsTr("+")
onClicked: appendRow()
}
QGCButton {
Layout.fillWidth: true
Layout.preferredHeight: parent.height
text: qsTr("-")
enabled: _root.rows.count > 1
onClicked: deleteLastRow()
}
}
}
ColumnLayout {
Layout.fillHeight: true
Layout.bottomMargin: rowButtons.height
Layout.preferredWidth: ScreenTools.minTouchPixels / 2
spacing: 1
visible: settingsUnlocked
enabled: settingsUnlocked
QGCButton {
Layout.fillHeight: true
Layout.preferredHeight: ScreenTools.minTouchPixels
Layout.preferredWidth: parent.width
text: qsTr("+")
onClicked: appendColumn()
}
QGCButton {
Layout.fillHeight: true
Layout.preferredHeight: ScreenTools.minTouchPixels
Layout.preferredWidth: parent.width
text: qsTr("-")
enabled: _root.columnCount > 1
onClicked: deleteLastColumn()
}
}
}
QGCMouseArea {
x: valueGrid.x + lockItem.width + topLevelRowLayout.spacing
y: valueGrid.y
width: valueGrid.width
height: valueGrid.height
visible: settingsUnlocked
onClicked: {
var item = valueGrid.childAt(mouse.x, mouse.y)
//console.log(item, item ? item.instrumentValueData : "null", item && item.parent ? item.parent.instrumentValueData : "null")
if (item && item.instrumentValueData !== undefined) {
mainWindow.showPopupDialog(valueEditDialog, { instrumentValueData: item.instrumentValueData })
}
}
/*Rectangle {
anchors.fill: parent
border.color: "green"
border.width: 1
color: "transparent"
}*/
}
Component {
id: valueEditDialog
InstrumentValueEditDialog { }
}
}
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.5
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
Item {
id: root
height: value.y + value.height
property var instrumentValueData: null
property bool recalcOk: false
property var _rgFontSizes: [ ScreenTools.defaultFontPointSize, ScreenTools.smallFontPointSize, ScreenTools.mediumFontPointSize, ScreenTools.largeFontPointSize ]
property var _rgFontSizeRatios: [ 1, ScreenTools.smallFontPointRatio, ScreenTools.mediumFontPointRatio, ScreenTools.largeFontPointRatio ]
property real _doubleDescent: ScreenTools.defaultFontDescent * 2
property real _tightDefaultFontHeight: ScreenTools.defaultFontPixelHeight - _doubleDescent
property var _rgFontSizeTightHeights: [ _tightDefaultFontHeight * _rgFontSizeRatios[0] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[1] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[2] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[3] + 2 ]
property real _tightHeight: _rgFontSizeTightHeights[instrumentValueData.instrumentValueArea.fontSize]
property real _fontSize: _rgFontSizes[instrumentValueData.instrumentValueArea.fontSize]
property real _horizontalLabelSpacing: ScreenTools.defaultFontPixelWidth
property real _blankEntryHeight: ScreenTools.defaultFontPixelHeight * 2
property bool _showIcon: instrumentValueData.icon || instrumentValueData.rangeType === InstrumentValueData.IconSelectRange
// After fighting with using layout and/or anchors I gave up and just do a manual recalc to position items which ends up being much simpler
function recalcPositions() {
if (!recalcOk) {
return
}
var smallVerticalSpacing = 2
var halfWidth = width / 2
var halfHorizontalSpacing = _horizontalLabelSpacing / 2
if (_showIcon) {
if (instrumentValueData.instrumentValueArea.orientation === InstrumentValueArea.VerticalOrientation) {
valueIcon.x = (width - valueIcon.width) / 2
valueIcon.y = 0
value.x = (width - value.width) / 2
value.y = valueIcon.height + smallVerticalSpacing
} else {
value.y = 0 // value assumed to be taller
valueIcon.y = (value.height - valueIcon.height) / 2
value.x = halfWidth + halfHorizontalSpacing
valueIcon.x = halfWidth - halfHorizontalSpacing - valueIcon.width
}
label.x = label.y = 0
} else {
if (instrumentValueData.text) {
if (instrumentValueData.instrumentValueArea.orientation === InstrumentValueArea.VerticalOrientation) {
label.x = (width - label.width) / 2
label.y = 0
value.x = (width - value.width) / 2
value.y = label.height + smallVerticalSpacing
} else {
value.y = 0 // value assumed to be taller
label.y = (value.height - label.height) / 2
value.x = halfWidth + halfHorizontalSpacing
label.x = halfWidth - halfHorizontalSpacing - label.width
}
} else {
value.x = (width - value.width) / 2
value.y = (height - value.height) / 2
}
valueIcon.x = valueIcon.y = 0
}
}
onRecalcOkChanged: recalcPositions()
onWidthChanged: recalcPositions()
Connections {
target: instrumentValueData
onIconChanged: recalcPositions()
}
QGCColoredImage {
id: valueIcon
height: _tightHeight
width: height
source: icon
sourceSize.height: height
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
color: instrumentValueData.isValidColor(instrumentValueData.currentColor) ? instrumentValueData.currentColor : qgcPal.text
opacity: instrumentValueData.currentOpacity
visible: _showIcon
onWidthChanged: root.recalcPositions()
onHeightChanged: root.recalcPositions()
property string icon
readonly property string iconPrefix: "/InstrumentValueIcons/"
function updateIcon() {
if (instrumentValueData.rangeType === InstrumentValueData.IconSelectRange) {
icon = iconPrefix + instrumentValueData.currentIcon
} else if (instrumentValueData.icon) {
icon = iconPrefix + instrumentValueData.icon
} else {
icon = ""
}
}
Connections {
target: instrumentValueData
onRangeTypeChanged: valueIcon.updateIcon()
onCurrentIconChanged: valueIcon.updateIcon()
onIconChanged: valueIcon.updateIcon()
}
Component.onCompleted: updateIcon();
}
QGCLabel {
id: blank
anchors.horizontalCenter: parent.horizontalCenter
height: _columnButtonsTotalHeight
font.pointSize: ScreenTools.smallFontPointSize
text: _settingsUnlocked ? qsTr("BLANK") : ""
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
visible: !instrumentValueData.fact
onWidthChanged: root.recalcPositions()
onHeightChanged: root.recalcPositions()
}
QGCLabel {
id: label
height: _tightHeight
text: instrumentValueData.text
verticalAlignment: Text.AlignVCenter
visible: !_showIcon
onWidthChanged: root.recalcPositions()
onHeightChanged: root.recalcPositions()
}
QGCLabel {
id: value
font.pointSize: _fontSize
text: visible ? (instrumentValueData.fact.enumOrValueString + (instrumentValueData.showUnits ? instrumentValueData.fact.units : "")) : ""
verticalAlignment: Text.AlignVCenter
visible: instrumentValueData.fact
onWidthChanged: root.recalcPositions()
onHeightChanged: root.recalcPositions()
}
}
This diff is collapsed.
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
****************************************************************************/ ****************************************************************************/
#include "InstrumentValueData.h" #include "InstrumentValueData.h"
#include "InstrumentValueArea.h" #include "FactValueGrid.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCCorePlugin.h" #include "QGCCorePlugin.h"
#include <QSettings> #include <QSettings>
const char* InstrumentValueData::_vehicleFactGroupName = "Vehicle"; const char* InstrumentValueData::vehicleFactGroupName = "Vehicle";
// Important: The indices of these strings must match the InstrumentValueData::RangeType enum // Important: The indices of these strings must match the InstrumentValueData::RangeType enum
const QStringList InstrumentValueData::_rangeTypeNames = { const QStringList InstrumentValueData::_rangeTypeNames = {
...@@ -24,9 +24,9 @@ const QStringList InstrumentValueData::_rangeTypeNames = { ...@@ -24,9 +24,9 @@ const QStringList InstrumentValueData::_rangeTypeNames = {
QT_TRANSLATE_NOOP("InstrumentValue", "Icon"), QT_TRANSLATE_NOOP("InstrumentValue", "Icon"),
}; };
InstrumentValueData::InstrumentValueData(InstrumentValueArea* instrumentValueArea, QObject *parent) InstrumentValueData::InstrumentValueData(FactValueGrid* factValueGrid, QObject* parent)
: QObject (parent) : QObject (parent)
, _instrumentValueArea (instrumentValueArea) , _factValueGrid(factValueGrid)
{ {
MultiVehicleManager* multiVehicleManager = qgcApp()->toolbox()->multiVehicleManager(); MultiVehicleManager* multiVehicleManager = qgcApp()->toolbox()->multiVehicleManager();
connect(multiVehicleManager, &MultiVehicleManager::activeVehicleChanged, this, &InstrumentValueData::_activeVehicleChanged); connect(multiVehicleManager, &MultiVehicleManager::activeVehicleChanged, this, &InstrumentValueData::_activeVehicleChanged);
...@@ -57,14 +57,14 @@ void InstrumentValueData::_activeVehicleChanged(Vehicle* activeVehicle) ...@@ -57,14 +57,14 @@ void InstrumentValueData::_activeVehicleChanged(Vehicle* activeVehicle)
for (QString& name: _factGroupNames) { for (QString& name: _factGroupNames) {
name[0] = name[0].toUpper(); name[0] = name[0].toUpper();
} }
_factGroupNames.prepend(_vehicleFactGroupName); _factGroupNames.prepend(vehicleFactGroupName);
emit factGroupNamesChanged(_factGroupNames); emit factGroupNamesChanged(_factGroupNames);
if (_fact) { if (_fact) {
_fact = nullptr; _fact = nullptr;
FactGroup* factGroup = nullptr; FactGroup* factGroup = nullptr;
if (_factGroupName == _vehicleFactGroupName) { if (_factGroupName == vehicleFactGroupName) {
factGroup = _activeVehicle; factGroup = _activeVehicle;
} else { } else {
factGroup = _activeVehicle->getFactGroup(_factGroupName); factGroup = _activeVehicle->getFactGroup(_factGroupName);
...@@ -108,7 +108,7 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f ...@@ -108,7 +108,7 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
} }
FactGroup* factGroup = nullptr; FactGroup* factGroup = nullptr;
if (factGroupName == _vehicleFactGroupName) { if (factGroupName == vehicleFactGroupName) {
factGroup = _activeVehicle; factGroup = _activeVehicle;
} else { } else {
factGroup = _activeVehicle->getFactGroup(factGroupName); factGroup = _activeVehicle->getFactGroup(factGroupName);
...@@ -225,7 +225,7 @@ void InstrumentValueData::_resetRangeInfo(void) ...@@ -225,7 +225,7 @@ void InstrumentValueData::_resetRangeInfo(void)
_rangeOpacities.append(1.0); _rangeOpacities.append(1.0);
break; break;
case IconSelectRange: case IconSelectRange:
_rangeIcons.append(_instrumentValueArea->iconNames()[0]); _rangeIcons.append(_factValueGrid->iconNames()[0]);
break; break;
} }
} }
...@@ -250,7 +250,7 @@ void InstrumentValueData::addRangeValue(void) ...@@ -250,7 +250,7 @@ void InstrumentValueData::addRangeValue(void)
_rangeOpacities.append(1.0); _rangeOpacities.append(1.0);
break; break;
case IconSelectRange: case IconSelectRange:
_rangeIcons.append(_instrumentValueArea->iconNames()[0]); _rangeIcons.append(_factValueGrid->iconNames()[0]);
break; break;
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <QObject> #include <QObject>
class InstrumentValueArea; class FactValueGrid;
class InstrumentValueData : public QObject class InstrumentValueData : public QObject
{ {
...@@ -30,9 +30,9 @@ public: ...@@ -30,9 +30,9 @@ public:
}; };
Q_ENUMS(RangeType) Q_ENUMS(RangeType)
explicit InstrumentValueData(InstrumentValueArea* instrumentValueArea, QObject *parent = nullptr); explicit InstrumentValueData(FactValueGrid* factValueGrid, QObject* parent);
Q_PROPERTY(InstrumentValueArea* instrumentValueArea MEMBER _instrumentValueArea CONSTANT) Q_PROPERTY(FactValueGrid* factValueGrid MEMBER _factValueGrid CONSTANT)
Q_PROPERTY(QStringList factGroupNames MEMBER _factGroupNames NOTIFY factGroupNamesChanged) Q_PROPERTY(QStringList factGroupNames MEMBER _factGroupNames NOTIFY factGroupNamesChanged)
Q_PROPERTY(QStringList factValueNames MEMBER _factValueNames NOTIFY factValueNamesChanged) Q_PROPERTY(QStringList factValueNames MEMBER _factValueNames NOTIFY factValueNamesChanged)
Q_PROPERTY(QString factGroupName READ factGroupName NOTIFY factGroupNameChanged) Q_PROPERTY(QString factGroupName READ factGroupName NOTIFY factGroupNameChanged)
...@@ -78,6 +78,9 @@ public: ...@@ -78,6 +78,9 @@ public:
void setRangeIcons (const QVariantList& rangeIcons); void setRangeIcons (const QVariantList& rangeIcons);
void setRangeOpacities (const QVariantList& rangeOpacities); void setRangeOpacities (const QVariantList& rangeOpacities);
static const char* vehicleFactGroupName;
signals: signals:
void factChanged (Fact* fact); void factChanged (Fact* fact);
void factNameChanged (const QString& factName); void factNameChanged (const QString& factName);
...@@ -107,7 +110,7 @@ private: ...@@ -107,7 +110,7 @@ private:
void _updateIcon (void); void _updateIcon (void);
void _updateOpacity (void); void _updateOpacity (void);
InstrumentValueArea* _instrumentValueArea = nullptr; FactValueGrid* _factValueGrid = nullptr;
Vehicle* _activeVehicle = nullptr; Vehicle* _activeVehicle = nullptr;
QmlObjectListModel* _rowModel = nullptr; QmlObjectListModel* _rowModel = nullptr;
Fact* _fact = nullptr; Fact* _fact = nullptr;
...@@ -139,7 +142,6 @@ private: ...@@ -139,7 +142,6 @@ private:
// These are user facing string for the various enums. // These are user facing string for the various enums.
static const QStringList _rangeTypeNames; static const QStringList _rangeTypeNames;
static const char* _vehicleFactGroupName;
}; };
QML_DECLARE_TYPE(InstrumentValueData) QML_DECLARE_TYPE(InstrumentValueData)
......
...@@ -33,27 +33,13 @@ QGCPopupDialog { ...@@ -33,27 +33,13 @@ QGCPopupDialog {
GridLayout { GridLayout {
rowSpacing: _margins rowSpacing: _margins
columnSpacing: _margins columnSpacing: _margins
columns: 3 columns: 2
QGCCheckBox {
id: valueCheckBox
text: qsTr("Value")
checked: instrumentValueData.fact
onClicked: {
if (checked) {
instrumentValueData.setFact(instrumentValueData.factGroupNames[0], instrumentValueData.factValueNames[0])
} else {
instrumentValueData.clearFact()
}
}
}
QGCComboBox { QGCComboBox {
id: factGroupCombo id: factGroupCombo
Layout.fillWidth: true Layout.fillWidth: true
model: instrumentValueData.factGroupNames model: instrumentValueData.factGroupNames
sizeToContents: true sizeToContents: true
enabled: valueCheckBox.checked
Component.onCompleted: currentIndex = find(instrumentValueData.factGroupName) Component.onCompleted: currentIndex = find(instrumentValueData.factGroupName)
onActivated: { onActivated: {
instrumentValueData.setFact(currentText, "") instrumentValueData.setFact(currentText, "")
...@@ -71,7 +57,6 @@ QGCPopupDialog { ...@@ -71,7 +57,6 @@ QGCPopupDialog {
Layout.fillWidth: true Layout.fillWidth: true
model: instrumentValueData.factValueNames model: instrumentValueData.factValueNames
sizeToContents: true sizeToContents: true
enabled: valueCheckBox.checked
Component.onCompleted: currentIndex = find(instrumentValueData.factName) Component.onCompleted: currentIndex = find(instrumentValueData.factName)
onActivated: { onActivated: {
instrumentValueData.setFact(instrumentValueData.factGroupName, currentText) instrumentValueData.setFact(instrumentValueData.factGroupName, currentText)
...@@ -90,17 +75,18 @@ QGCPopupDialog { ...@@ -90,17 +75,18 @@ QGCPopupDialog {
Component.onCompleted: checked = instrumentValueData.icon != "" Component.onCompleted: checked = instrumentValueData.icon != ""
onClicked: { onClicked: {
instrumentValueData.text = "" instrumentValueData.text = ""
instrumentValueData.icon = instrumentValueData.iconNames[0] instrumentValueData.icon = instrumentValueData.factValueGrid.iconNames[0]
var updateFunction = function(icon){ instrumentValueData.icon = icon } var updateFunction = function(icon){ instrumentValueData.icon = icon }
mainWindow.showPopupDialog(iconPickerDialog, { iconNames: instrumentValueData.instrumentValueArea.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction }) mainWindow.showPopupDialog(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction })
} }
} }
QGCColoredImage { QGCColoredImage {
id: valueIcon
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
height: ScreenTools.implicitComboBoxHeight height: ScreenTools.implicitComboBoxHeight
width: height width: height
source: "/InstrumentValueIcons/" + (instrumentValueData.icon ? instrumentValueData.icon : instrumentValueData.instrumentValueArea.iconNames[0]) source: "/InstrumentValueIcons/" + (instrumentValueData.icon ? instrumentValueData.icon : instrumentValueData.factValueGrid.iconNames[0])
sourceSize.height: height sourceSize.height: height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
mipmap: true mipmap: true
...@@ -112,12 +98,16 @@ QGCPopupDialog { ...@@ -112,12 +98,16 @@ QGCPopupDialog {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var updateFunction = function(icon){ instrumentValueData.icon = icon } var updateFunction = function(icon){ instrumentValueData.icon = icon }
mainWindow.showPopupDialog(iconPickerDialog, { iconNames: instrumentValueData.instrumentValueArea.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction }) mainWindow.showPopupDialog(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction })
} }
} }
}
Item { height: 1; width: 1 } Rectangle {
anchors.fill: valueIcon
color: qgcPal.text
visible: valueIcon.status === Image.Error
}
}
QGCRadioButton { QGCRadioButton {
id: textRadio id: textRadio
...@@ -132,7 +122,6 @@ QGCPopupDialog { ...@@ -132,7 +122,6 @@ QGCPopupDialog {
QGCTextField { QGCTextField {
id: labelTextField id: labelTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 2
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 10 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 10
text: instrumentValueData.text text: instrumentValueData.text
enabled: textRadio.checked enabled: textRadio.checked
...@@ -144,13 +133,14 @@ QGCPopupDialog { ...@@ -144,13 +133,14 @@ QGCPopupDialog {
QGCComboBox { QGCComboBox {
id: fontSizeCombo id: fontSizeCombo
Layout.fillWidth: true Layout.fillWidth: true
model: instrumentValueData.instrumentValueArea.fontSizeNames model: instrumentValueData.factValueGrid.fontSizeNames
currentIndex: instrumentValueData.instrumentValueArea.fontSize currentIndex: instrumentValueData.factValueGrid.fontSize
sizeToContents: true sizeToContents: true
onActivated: instrumentValueData.instrumentValueArea.fontSize = index onActivated: instrumentValueData.factValueGrid.fontSize = index
} }
QGCCheckBox { QGCCheckBox {
Layout.columnSpan: 2
text: qsTr("Show Units") text: qsTr("Show Units")
checked: instrumentValueData.showUnits checked: instrumentValueData.showUnits
onClicked: instrumentValueData.showUnits = checked onClicked: instrumentValueData.showUnits = checked
...@@ -160,7 +150,6 @@ QGCPopupDialog { ...@@ -160,7 +150,6 @@ QGCPopupDialog {
QGCComboBox { QGCComboBox {
id: rangeTypeCombo id: rangeTypeCombo
Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
model: instrumentValueData.rangeTypeNames model: instrumentValueData.rangeTypeNames
currentIndex: instrumentValueData.rangeType currentIndex: instrumentValueData.rangeType
...@@ -170,7 +159,7 @@ QGCPopupDialog { ...@@ -170,7 +159,7 @@ QGCPopupDialog {
Loader { Loader {
id: rangeLoader id: rangeLoader
Layout.columnSpan: 3 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: item ? item.width : 0 Layout.preferredWidth: item ? item.width : 0
Layout.preferredHeight: item ? item.height : 0 Layout.preferredHeight: item ? item.height : 0
...@@ -403,7 +392,7 @@ QGCPopupDialog { ...@@ -403,7 +392,7 @@ QGCPopupDialog {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var updateFunction = function(icon){ updateIconValue(index, icon) } var updateFunction = function(icon){ updateIconValue(index, icon) }
mainWindow.showPopupDialog(iconPickerDialog, { iconNames: instrumentValueData.instrumentValueArea.iconNames, icon: modelData, updateIconFunction: updateFunction }) mainWindow.showPopupDialog(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: modelData, updateIconFunction: updateFunction })
} }
} }
} }
......
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.5
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Templates 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
ColumnLayout {
property var instrumentValueData: null
property bool _verticalOrientation: instrumentValueData.factValueGrid.orientation === FactValueGrid.VerticalOrientation
property var _rgFontSizes: [ ScreenTools.defaultFontPointSize, ScreenTools.smallFontPointSize, ScreenTools.mediumFontPointSize, ScreenTools.largeFontPointSize ]
property var _rgFontSizeRatios: [ 1, ScreenTools.smallFontPointRatio, ScreenTools.mediumFontPointRatio, ScreenTools.largeFontPointRatio ]
property real _doubleDescent: ScreenTools.defaultFontDescent * 2
property real _tightDefaultFontHeight: ScreenTools.defaultFontPixelHeight - _doubleDescent
property var _rgFontSizeTightHeights: [ _tightDefaultFontHeight * _rgFontSizeRatios[0] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[1] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[2] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[3] + 2 ]
property real _tightHeight: _rgFontSizeTightHeights[instrumentValueData.factValueGrid.fontSize]
property bool _iconVisible: instrumentValueData.rangeType === InstrumentValueData.IconSelectRange || instrumentValueData.icon
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
QGCColoredImage {
id: valueIcon
Layout.alignment: _verticalOrientation ? Qt.AlignHCenter : Qt.AlignVCenter
height: _tightHeight * 0.75
width: height
sourceSize.height: height
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
color: instrumentValueData.isValidColor(instrumentValueData.currentColor) ? instrumentValueData.currentColor : qgcPal.text
opacity: instrumentValueData.currentOpacity
visible: _iconVisible
readonly property string iconPrefix: "/InstrumentValueIcons/"
function updateIcon() {
if (instrumentValueData.rangeType === InstrumentValueData.IconSelectRange) {
valueIcon.source = iconPrefix + instrumentValueData.currentIcon
} else if (instrumentValueData.icon) {
valueIcon.source = iconPrefix + instrumentValueData.icon
} else {
valueIcon.source = ""
}
}
Connections {
target: instrumentValueData
onRangeTypeChanged: valueIcon.updateIcon()
onCurrentIconChanged: valueIcon.updateIcon()
onIconChanged: valueIcon.updateIcon()
}
Component.onCompleted: updateIcon();
Rectangle {
anchors.fill: valueIcon
color: qgcPal.text
visible: valueIcon.status === Image.Error
}
}
QGCLabel {
Layout.alignment: _verticalOrientation ? Qt.AlignHCenter : Qt.AlignVCenter
height: _tightHeight
font.pointSize: ScreenTools.smallFontPointSize
text: instrumentValueData.text
visible: !_iconVisible
}
}
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.5
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Templates 1.0
import QGroundControl.Templates 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
ColumnLayout {
property var instrumentValueData: null
property bool settingsUnlocked: false
property bool _verticalOrientation: instrumentValueData.factValueGrid.orientation === FactValueGrid.VerticalOrientation
property var _rgFontSizes: [ ScreenTools.defaultFontPointSize, ScreenTools.smallFontPointSize, ScreenTools.mediumFontPointSize, ScreenTools.largeFontPointSize ]
property var _rgFontSizeRatios: [ 1, ScreenTools.smallFontPointRatio, ScreenTools.mediumFontPointRatio, ScreenTools.largeFontPointRatio ]
property real _doubleDescent: ScreenTools.defaultFontDescent * 2
property real _tightDefaultFontHeight: ScreenTools.defaultFontPixelHeight - _doubleDescent
property var _rgFontSizeTightHeights: [ _tightDefaultFontHeight * _rgFontSizeRatios[0] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[1] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[2] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[3] + 2 ]
property real _tightHeight: _rgFontSizeTightHeights[instrumentValueData.factValueGrid.fontSize]
property real _fontSize: _rgFontSizes[instrumentValueData.factValueGrid.fontSize]
property real _horizontalLabelSpacing: ScreenTools.defaultFontPixelWidth
property bool _valueVisible: instrumentValueData.fact
property real _width: 0
property real _height: 0
QGCLabel {
Layout.alignment: _verticalOrientation ? Qt.AlignHCenter : Qt.AlignVCenter
font.pointSize: _fontSize
text: instrumentValueData.fact.enumOrValueString + (instrumentValueData.showUnits ? " " + instrumentValueData.fact.units : "")
visible: _valueVisible
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
}
}
...@@ -9,19 +9,30 @@ ...@@ -9,19 +9,30 @@
import QtQuick 2.12 import QtQuick 2.12
Item { Rectangle {
property string name: "control" id: _root
border.width: borderColor === undefined ? 0 : 1
border.color: borderColor
color: "transparent"
Component.onCompleted: console.log("QGCControlDebug.onCompleted name,x,y,width,height,visible,z,parent", name, x, y, width, height, visible, z, parent) property string name
property color borderColor
function logEverything() {
console.log(qsTr("%1 x:%2 y:%3 width:%4 height:%5 visible: %6 enabled: %7 z:%8 parent:%9 implicitWidth/Height:%10:%11", "Do not translate").arg(name).arg(parent.x).arg(parent.y).arg(parent.width).arg(parent.height).arg(parent.visible).arg(parent.enabled).arg(parent.z).arg(parent.parent))
}
Component.onCompleted: logEverything()
Connections { Connections {
target: parent target: parent
onXChanged: console.log(name, "xChanged", parent.x) onXChanged: { console.log(name, "xChanged", parent.x); logEverything() }
onYChanged: console.log(name, "yChanged", parent.y) onYChanged: { console.log(name, "yChanged", parent.y); logEverything() }
onWidthChanged: console.log(name, "widthChanged", parent.width) onWidthChanged: { console.log(name, "widthChanged", parent.width); logEverything() }
onHeightChanged: console.log(name, "heightChanged", parent.height) onHeightChanged: { console.log(name, "heightChanged", parent.height); logEverything() }
onVisibleChanged: console.log(name, "visibleChanged", parent.visible) onVisibleChanged: { console.log(name, "visibleChanged", parent.visible); logEverything() }
onZChanged: console.log(name, "zChanged", parent.z) onZChanged: { console.log(name, "zChanged", parent.z); logEverything() }
onParentChanged: console.log(name, "parentChanged", parent.parent) onParentChanged: { console.log(name, "parentChanged", parent.parent); logEverything() }
onEnabledChanged: { console.log(name, "enabledChanged", parent.enabled); logEverything() }
} }
} }
/****************************************************************************
*
* (c) 2009-2020 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.
*
****************************************************************************/
#include "VerticalFactValueGrid.h"
#include "InstrumentValueData.h"
#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include <QSettings>
const QString VerticalFactValueGrid::_valuePageUserSettingsGroup ("ValuePageUserSettings2");
const QString VerticalFactValueGrid::valuePageDefaultSettingsGroup("ValuePageDefaultSettings2");
VerticalFactValueGrid::VerticalFactValueGrid(QQuickItem* parent)
: FactValueGrid(parent)
{
_orientation = VerticalOrientation;
}
VerticalFactValueGrid::VerticalFactValueGrid(const QString& defaultSettingsGroup)
: FactValueGrid(defaultSettingsGroup)
{
_orientation = VerticalOrientation;
}
/****************************************************************************
*
* (c) 2009-2020 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.
*
****************************************************************************/
#pragma once
#include "FactSystem.h"
#include "QmlObjectListModel.h"
#include "QGCApplication.h"
#include "FactValueGrid.h"
class InstrumentValueData;
class VerticalFactValueGrid : public FactValueGrid
{
Q_OBJECT
public:
VerticalFactValueGrid(QQuickItem *parent = nullptr);
VerticalFactValueGrid(const QString& defaultSettingsGroup);
Q_PROPERTY(QString valuePageDefaultSettingsGroup MEMBER valuePageDefaultSettingsGroup CONSTANT)
Q_PROPERTY(QString valuePageUserSettingsGroup MEMBER _valuePageUserSettingsGroup CONSTANT)
static const QString valuePageDefaultSettingsGroup;
private:
Q_DISABLE_COPY(VerticalFactValueGrid)
static const QString _valuePageUserSettingsGroup;
};
QML_DECLARE_TYPE(VerticalFactValueGrid)
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.5
import QtQml 2.12
import QGroundControl.Templates 1.0 as T
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl 1.0
// Note: This control will spit out qWarnings like this: "QGridLayoutEngine::addItem: Cell (0, 1) already taken"
// This is due to Qt bug https://bugreports.qt.io/browse/QTBUG-65121
// If this becomes a problem I'll implement our own grid layout control
T.VerticalFactValueGrid {
id: _root
height: childrenRect.height
property bool settingsUnlocked: false
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
RowLayout {
id: topLevelRowLayout
width: parent.width
ColumnLayout {
Layout.fillWidth: true
GridLayout {
id: valueGrid
Layout.preferredWidth: _root.width
rows: _root.rows.count * 2
rowSpacing: 0
Repeater {
model: _root.rows
Repeater {
id: labelRepeater
model: object
property real _index: index
InstrumentValueLabel {
Layout.row: labelRepeater._index * 2
Layout.column: index
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
instrumentValueData: object
}
}
}
Repeater {
model: _root.rows
Repeater {
id: valueRepeater
model: object
property real _index: index
InstrumentValueValue {
Layout.row: valueRepeater._index * 2 + 1
Layout.column: index
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
instrumentValueData: object
}
}
}
}
RowLayout {
id: rowButtons
height: ScreenTools.minTouchPixels / 2
Layout.fillWidth: true
spacing: 1
visible: settingsUnlocked
QGCButton {
Layout.fillWidth: true
Layout.preferredHeight: parent.height
text: qsTr("+")
onClicked: appendRow()
}
QGCButton {
Layout.fillWidth: true
Layout.preferredHeight: parent.height
text: qsTr("-")
enabled: _root.rows.count > 1
onClicked: deleteLastRow()
}
}
}
ColumnLayout {
Layout.fillHeight: true
Layout.bottomMargin: rowButtons.height
width: ScreenTools.minTouchPixels / 2
spacing: 1
visible: settingsUnlocked
QGCButton {
Layout.fillHeight: true
Layout.preferredHeight: ScreenTools.minTouchPixels
Layout.preferredWidth: parent.width
text: qsTr("+")
onClicked: appendColumn()
}
QGCButton {
Layout.fillHeight: true
Layout.preferredHeight: ScreenTools.minTouchPixels
Layout.preferredWidth: parent.width
text: qsTr("-")
enabled: _root.columnCount > 1
onClicked: deleteLastColumn()
}
}
}
QGCMouseArea {
x: valueGrid.x
y: valueGrid.y
width: valueGrid.width
height: valueGrid.height
visible: settingsUnlocked
onClicked: {
var item = valueGrid.childAt(mouse.x, mouse.y)
//console.log(item, item ? item.instrumentValueData : "null", item && item.parent ? item.parent.instrumentValueData : "null")
if (item && item.instrumentValueData !== undefined) {
mainWindow.showPopupDialog(valueEditDialog, { instrumentValueData: item.instrumentValueData })
}
}
/*Rectangle {
anchors.fill: parent
border.color: "green"
border.width: 1
color: "transparent"
}*/
}
Component {
id: valueEditDialog
InstrumentValueEditDialog { }
}
}
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#endif #endif
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#include "QGCCameraManager.h" #include "QGCCameraManager.h"
#include "InstrumentValueArea.h" #include "HorizontalFactValueGrid.h"
#include "VerticalFactValueGrid.h"
#include "InstrumentValueData.h" #include "InstrumentValueData.h"
#include <QtQml> #include <QtQml>
...@@ -220,55 +221,55 @@ QVariantList &QGCCorePlugin::settingsPages() ...@@ -220,55 +221,55 @@ QVariantList &QGCCorePlugin::settingsPages()
{ {
if(!_p->pGeneral) { if(!_p->pGeneral) {
_p->pGeneral = new QmlComponentInfo(tr("General"), _p->pGeneral = new QmlComponentInfo(tr("General"),
QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"), QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"),
QUrl::fromUserInput("qrc:/res/gear-white.svg")); QUrl::fromUserInput("qrc:/res/gear-white.svg"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pGeneral))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pGeneral)));
_p->pCommLinks = new QmlComponentInfo(tr("Comm Links"), _p->pCommLinks = new QmlComponentInfo(tr("Comm Links"),
QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"), QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pCommLinks))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pCommLinks)));
_p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"), _p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"),
QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps)));
#if defined(QGC_GST_TAISYNC_ENABLED) #if defined(QGC_GST_TAISYNC_ENABLED)
_p->pTaisync = new QmlComponentInfo(tr("Taisync"), _p->pTaisync = new QmlComponentInfo(tr("Taisync"),
QUrl::fromUserInput("qrc:/qml/TaisyncSettings.qml"), QUrl::fromUserInput("qrc:/qml/TaisyncSettings.qml"),
QUrl::fromUserInput("")); QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pTaisync))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pTaisync)));
#endif #endif
#if defined(QGC_GST_MICROHARD_ENABLED) #if defined(QGC_GST_MICROHARD_ENABLED)
_p->pMicrohard = new QmlComponentInfo(tr("Microhard"), _p->pMicrohard = new QmlComponentInfo(tr("Microhard"),
QUrl::fromUserInput("qrc:/qml/MicrohardSettings.qml"), QUrl::fromUserInput("qrc:/qml/MicrohardSettings.qml"),
QUrl::fromUserInput("")); QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMicrohard))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMicrohard)));
#endif #endif
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
_p->pAirmap = new QmlComponentInfo(tr("AirMap"), _p->pAirmap = new QmlComponentInfo(tr("AirMap"),
QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"), QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
QUrl::fromUserInput("")); QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pAirmap))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pAirmap)));
#endif #endif
_p->pMAVLink = new QmlComponentInfo(tr("MAVLink"), _p->pMAVLink = new QmlComponentInfo(tr("MAVLink"),
QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMAVLink))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMAVLink)));
_p->pConsole = new QmlComponentInfo(tr("Console"), _p->pConsole = new QmlComponentInfo(tr("Console"),
QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml")); QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pConsole))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pConsole)));
_p->pHelp = new QmlComponentInfo(tr("Help"), _p->pHelp = new QmlComponentInfo(tr("Help"),
QUrl::fromUserInput("qrc:/qml/HelpSettings.qml")); QUrl::fromUserInput("qrc:/qml/HelpSettings.qml"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pHelp))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pHelp)));
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
//-- These are always present on Debug builds //-- These are always present on Debug builds
_p->pMockLink = new QmlComponentInfo(tr("Mock Link"), _p->pMockLink = new QmlComponentInfo(tr("Mock Link"),
QUrl::fromUserInput("qrc:/qml/MockLink.qml")); QUrl::fromUserInput("qrc:/qml/MockLink.qml"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMockLink))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMockLink)));
_p->pDebug = new QmlComponentInfo(tr("Debug"), _p->pDebug = new QmlComponentInfo(tr("Debug"),
QUrl::fromUserInput("qrc:/qml/DebugWindow.qml")); QUrl::fromUserInput("qrc:/qml/DebugWindow.qml"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pDebug))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pDebug)));
_p->pQmlTest = new QmlComponentInfo(tr("Palette Test"), _p->pQmlTest = new QmlComponentInfo(tr("Palette Test"),
QUrl::fromUserInput("qrc:/qml/QmlTest.qml")); QUrl::fromUserInput("qrc:/qml/QmlTest.qml"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pQmlTest))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pQmlTest)));
#endif #endif
} }
...@@ -361,7 +362,7 @@ bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMeta ...@@ -361,7 +362,7 @@ bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMeta
#endif #endif
metaData.setRawDefaultValue(outdoorPalette); metaData.setRawDefaultValue(outdoorPalette);
return true; return true;
//-- Auto Save Telemetry Logs //-- Auto Save Telemetry Logs
} else if (metaData.name() == AppSettings::telemetrySaveName) { } else if (metaData.name() == AppSettings::telemetrySaveName) {
#if defined (__mobile__) #if defined (__mobile__)
metaData.setRawDefaultValue(false); metaData.setRawDefaultValue(false);
...@@ -397,10 +398,9 @@ void QGCCorePlugin::setShowAdvancedUI(bool show) ...@@ -397,10 +398,9 @@ void QGCCorePlugin::setShowAdvancedUI(bool show)
} }
} }
void QGCCorePlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo) void QGCCorePlugin::paletteOverride(QString /*colorName*/, QGCPalette::PaletteColorInfo_t& /*colorInfo*/)
{ {
Q_UNUSED(colorName);
Q_UNUSED(colorInfo);
} }
QString QGCCorePlugin::showAdvancedUIMessage() const QString QGCCorePlugin::showAdvancedUIMessage() const
...@@ -411,30 +411,47 @@ QString QGCCorePlugin::showAdvancedUIMessage() const ...@@ -411,30 +411,47 @@ QString QGCCorePlugin::showAdvancedUIMessage() const
"Are you sure you want to enable Advanced Mode?"); "Are you sure you want to enable Advanced Mode?");
} }
void QGCCorePlugin::instrumentValueAreaCreateDefaultSettings(const QString& defaultSettingsGroup) void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString& defaultSettingsGroup)
{ {
if (defaultSettingsGroup == InstrumentValueArea::valuePageDefaultSettingsGroup) { if (defaultSettingsGroup == VerticalFactValueGrid::valuePageDefaultSettingsGroup) {
InstrumentValueArea instrumentValueArea(defaultSettingsGroup); VerticalFactValueGrid factValueGrid(defaultSettingsGroup);
factValueGrid.setFontSize(FactValueGrid::LargeFontSize);
QmlObjectListModel* row = factValueGrid.appendRow();
InstrumentValueData* value = row->value<InstrumentValueData*>(0);
value->setFact("Vehicle", "DistanceToHome");
value->setText(value->fact()->shortDescription());
value->setShowUnits(true);
row = factValueGrid.appendRow();
value = row->value<InstrumentValueData*>(0);
value->setFact("Vehicle", "FlightDistance");
value->setText(value->fact()->shortDescription());
value->setShowUnits(true);
instrumentValueArea.setFontSize(InstrumentValueArea::LargeFontSize); row = factValueGrid.appendRow();
value = row->value<InstrumentValueData*>(0);
value->setFact("Vehicle", "FlightTime");
value->setText(value->fact()->shortDescription());
value->setShowUnits(false);
} else if (defaultSettingsGroup == HorizontalFactValueGrid::toolbarDefaultSettingsGroup) {
HorizontalFactValueGrid factValueGrid(defaultSettingsGroup);
QmlObjectListModel* columnModel = instrumentValueArea.appendRow(); factValueGrid.setFontSize(FactValueGrid::LargeFontSize);
InstrumentValueData* colValue = columnModel->value<InstrumentValueData*>(0);
colValue->setFact("Vehicle", "AltitudeRelative");
colValue->setText(colValue->fact()->shortDescription());
colValue->setShowUnits(true);
columnModel = instrumentValueArea.appendRow(); QmlObjectListModel* row = factValueGrid.appendRow();
colValue = columnModel->value<InstrumentValueData*>(0); InstrumentValueData* value = row->value<InstrumentValueData*>(0);
colValue->setFact("Vehicle", "GroundSpeed"); value->setFact("Vehicle", "AltitudeRelative");
colValue->setText(colValue->fact()->shortDescription()); value->setIcon("arrow-thick-up.svg");
colValue->setShowUnits(true); value->setText(value->fact()->shortDescription());
value->setShowUnits(true);
columnModel = instrumentValueArea.appendRow(); row = factValueGrid.appendRow();
colValue = columnModel->value<InstrumentValueData*>(0); value = row->value<InstrumentValueData*>(0);
colValue->setFact("Vehicle", "FlightTime"); value->setFact("Vehicle", "GroundSpeed");
colValue->setText(colValue->fact()->shortDescription()); value->setIcon("arrow-thick-right.svg");
colValue->setShowUnits(false); value->setShowUnits(true);
} }
} }
...@@ -526,8 +543,8 @@ const QVariantList &QGCCorePlugin::toolBarIndicators(void) ...@@ -526,8 +543,8 @@ const QVariantList &QGCCorePlugin::toolBarIndicators(void)
//-- Default list of indicators for all vehicles. //-- Default list of indicators for all vehicles.
if(_toolBarIndicatorList.size() == 0) { if(_toolBarIndicatorList.size() == 0) {
_toolBarIndicatorList = QVariantList({ _toolBarIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")),
}); });
} }
return _toolBarIndicatorList; return _toolBarIndicatorList;
} }
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
/// Allows a plugin to override the specified color name from the palette /// Allows a plugin to override the specified color name from the palette
virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo); virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo);
virtual void instrumentValueAreaCreateDefaultSettings(const QString& defaultSettingsGroup); virtual void factValueGridCreateDefaultSettings(const QString& defaultSettingsGroup);
/// Allows the plugin to override or get access to the QmlApplicationEngine to do things like add import /// Allows the plugin to override or get access to the QmlApplicationEngine to do things like add import
/// path or stuff things into the context prior to window creation. /// path or stuff things into the context prior to window creation.
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* *
****************************************************************************/ ****************************************************************************/
import QtQuick 2.11 import QtQuick 2.11
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
......
...@@ -209,15 +209,31 @@ Item { ...@@ -209,15 +209,31 @@ Item {
id: toolsFlickable id: toolsFlickable
anchors.leftMargin: ScreenTools.defaultFontPixelHeight / 2 anchors.leftMargin: ScreenTools.defaultFontPixelHeight / 2
anchors.left: separator.right anchors.left: separator.right
anchors.right: connectionStatus.visible ? connectionStatus.left : parent.right
anchors.bottomMargin: 1 anchors.bottomMargin: 1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
contentWidth: indicatorLoader.width anchors.right: connectionStatus.visible ? connectionStatus.left : parent.right
contentWidth: indicatorLoader.x + indicatorLoader.width
flickableDirection: Flickable.HorizontalFlick flickableDirection: Flickable.HorizontalFlick
clip: !valueArea.settingsUnlocked
HorizontalFactValueGrid {
id: valueArea
anchors.top: parent.top
anchors.bottom: parent.bottom
userSettingsGroup: toolbarUserSettingsGroup
defaultSettingsGroup: toolbarDefaultSettingsGroup
QGCMouseArea {
anchors.fill: parent
visible: !parent.settingsUnlocked
onClicked: parent.settingsUnlocked = true
}
}
Loader { Loader {
id: indicatorLoader id: indicatorLoader
anchors.left: valueArea.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
source: "qrc:/toolbar/MainToolBarIndicators.qml" source: "qrc:/toolbar/MainToolBarIndicators.qml"
......
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