Commit 0fccfa87 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Move all delegates in a Components singleton to avoid global IDs

Move all current/highlight properties to Shared to avoid global scope

Move all convert methods to Shared to avoid global scope
parent 651458ec
......@@ -130,6 +130,7 @@ Project {
"components/AbstractDialogDetailsIO.qml",
"components/Circle.qml",
"components/ClickableTextLabel.qml",
"components/Components.qml",
"components/DelegateAnalogActuator.qml",
"components/DelegateAnalogActuatorMini.qml",
"components/DelegateAnalogActuatorWide.qml",
......
......@@ -40,10 +40,19 @@
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
#include <QtMath>
SharedObject::SharedObject (QObject * parent)
: QObject (parent)
, m_manager (&Manager::instance ())
, m_showOnlyEditable (true)
, m_showDescriptions (false)
, m_currentNode (Q_NULLPTR)
, m_currentDashboard (Q_NULLPTR)
, m_highlightIO (Q_NULLPTR)
, m_highlightSensor (Q_NULLPTR)
, m_highlightActuator (Q_NULLPTR)
, m_highlightPhyVal (Q_NULLPTR)
, m_settings (QSettings::IniFormat, QSettings::UserScope, "QtCANv2", "TestBench")
{
m_mruModel = new QQmlVariantListModel (this);
......@@ -74,6 +83,7 @@ void SharedObject::registerQmlTypes (QQmlEngine * qmlEngine) {
qmlEngine->addImportPath (":/import");
// singletons
Help::registerQmlModule (uri, maj, min, "Help");
qmlRegisterSingletonType (QUrl ("qrc:///components/Components.qml"), uri, maj, min, "Components");
qmlRegisterSingletonType<SharedObject> (uri, maj, min, "Shared", &SharedObject::qmlSingletonProvider);
// must not be instanciated in QML enum
qmlRegisterUncreatableType<Tabs> (uri, maj, min, "Tabs", msg);
......@@ -209,6 +219,19 @@ QObject * SharedObject::qmlSingletonProvider (QQmlEngine * qmlEngine, QJSEngine
return new SharedObject;
}
qreal SharedObject::intToFloat (const int value, const int decimals) const {
return qreal (qreal (value) / qreal (qPow (10, decimals)));
}
int SharedObject::floatToInt (const qreal value, const int decimals) const {
return int (value * int (qPow (10, decimals)));
}
QString SharedObject::format (const int value, const int decimals, const QString unit) const {
const QString tmp = QString::number (intToFloat (value, decimals), 'f', decimals);
return (!unit.isEmpty () ? tmp % ' ' % unit : tmp);
}
void SharedObject::addMru (const QString & filePath) {
QStringList tmp = m_settings.value ("mru").toStringList ();
tmp.removeAll (filePath);
......
......@@ -14,13 +14,27 @@
class Manager;
class NetworkDefinition;
class Node;
class Dashboard;
class AbstractIO;
class AbstractSensor;
class AbstractActuator;
class PhysicalValue;
class SharedObject : public QObject {
Q_OBJECT
QML_CONSTANT_PTR_PROPERTY (Manager, manager)
QML_CONSTANT_PTR_PROPERTY (QQmlVariantListModel, mruModel)
QML_WRITABLE_VAR_PROPERTY (bool, rememberTheme)
QML_WRITABLE_VAR_PROPERTY (bool, showOnlyEditable)
QML_WRITABLE_VAR_PROPERTY (bool, showDescriptions)
QML_WRITABLE_CSTREF_PROPERTY (QString, lastFolderUsed)
QML_CONSTANT_PTR_PROPERTY (QQmlVariantListModel, mruModel)
QML_WRITABLE_PTR_PROPERTY (Node, currentNode)
QML_WRITABLE_PTR_PROPERTY (Dashboard, currentDashboard)
QML_WRITABLE_PTR_PROPERTY (AbstractIO, highlightIO)
QML_WRITABLE_PTR_PROPERTY (AbstractSensor, highlightSensor)
QML_WRITABLE_PTR_PROPERTY (AbstractActuator, highlightActuator)
QML_WRITABLE_PTR_PROPERTY (PhysicalValue, highlightPhyVal)
public:
explicit SharedObject (QObject * parent = Q_NULLPTR);
......@@ -29,6 +43,10 @@ public:
static QObject * qmlSingletonProvider (QQmlEngine * qmlEngine, QJSEngine * jsEngine);
Q_INVOKABLE qreal intToFloat (const int value, const int decimals) const;
Q_INVOKABLE int floatToInt (const qreal value, const int decimals) const;
Q_INVOKABLE QString format (const int value, const int decimals, const QString unit = "") const;
public slots:
void addMru (const QString & filePath);
void removeMru (const QString & filePath);
......
pragma Singleton;
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
QtObject {
id: base;
readonly property Component symbolPlug : Component { SymbolPlug { } }
readonly property Component delegateAin : Component { DelegateControlAin { } }
readonly property Component delegateAout : Component { DelegateControlAout { } }
readonly property Component delegateDin : Component { DelegateControlDin { } }
readonly property Component delegateDout : Component { DelegateControlDout { } }
readonly property Component delegateAnalogSensor : Component { DelegateAnalogSensor { } }
readonly property Component delegateAnalogSensorMini : Component { DelegateAnalogSensorMini { } }
readonly property Component delegateAnalogSensorWide : Component { DelegateAnalogSensorWide { } }
readonly property Component delegateDigitalSensor : Component { DelegateDigitalSensor { } }
readonly property Component delegateDigitalSensorMini : Component { DelegateDigitalSensorMini { } }
readonly property Component delegateHybridSensor : Component { DelegateHybridSensor { } }
readonly property Component delegateHybridSensorMini : Component { DelegateHybridSensorMini { } }
readonly property Component delegateAnalogActuator : Component { DelegateAnalogActuator { } }
readonly property Component delegateAnalogActuatorMini : Component { DelegateAnalogActuatorMini { } }
readonly property Component delegateAnalogActuatorWide : Component { DelegateAnalogActuatorWide { } }
readonly property Component delegateDigitalActuator : Component { DelegateDigitalActuator { } }
readonly property Component delegateDigitalActuatorMini : Component { DelegateDigitalActuatorMini { } }
readonly property Component delegateHybridActuator : Component { DelegateHybridActuator { } }
readonly property Component delegateHybridActuatorMini : Component { DelegateHybridActuatorMini { } }
readonly property Component delegateRoutineOnTimer : Component { DelegateRoutineOnTimer { } }
readonly property Component delegateRoutineOnEvent : Component { DelegateRoutineOnEvent { } }
readonly property Component delegateRoutineOnCanFrame : Component { DelegateRoutineOnCanFrame { } }
readonly property Component delegateRoutineOnSerialFrame : Component { DelegateRoutineOnSerialFrame { } }
readonly property Component delegateRoutineOnCanOpenObdValChange : Component { DelegateRoutineOnCanOpenObdValChange { } }
readonly property Component delegateRoutineOnCanOpenNmtStateChange : Component { DelegateRoutineOnCanOpenNmtStateChange { } }
readonly property Component delegateRoutineOnCanOpenSdoReadReply : Component { DelegateRoutineOnCanOpenSdoReadReply { } }
readonly property Component delegateRoutineOnCanOpenSdoWriteRequest : Component { DelegateRoutineOnCanOpenSdoWriteRequest { } }
readonly property Component delegatePhyVal : Component { DelegatePhyValTable { } }
readonly property Component delegatePhyGroup : Component { DelegatePhyGroupTable { } }
readonly property Component delegatePhyBlock : Component { DelegatePhyBlockTable { } }
readonly property Component delegatePhyMarker : Component { DelegatePhyMarkerTable { } }
readonly property Component delegateRawNodeTable : Component { DelegateRawNodeTable { } }
readonly property Component delegateRawBoardTable : Component { DelegateRawBoardTable { } }
readonly property Component delegateRawAinTable : Component { DelegateRawAinTable { } }
readonly property Component delegateRawDinTable : Component { DelegateRawDinTable { } }
readonly property Component delegateRawDoutTable : Component { DelegateRawDoutTable { } }
readonly property Component delegateRawAoutTable : Component { DelegateRawAoutTable { } }
readonly property Component dlgAinDetails : Component { DialogDetailsAin { } }
readonly property Component dlgAoutDetails : Component { DialogDetailsAout { } }
readonly property Component dlgDinDetails : Component { DialogDetailsDin { } }
readonly property Component dlgDoutDetails : Component { DialogDetailsDout { } }
readonly property Component dlgConfCanBus : Component { DialogConfigCanBus { } }
readonly property Component dlgConfSerialBus : Component { DialogConfigSerialBus { } }
readonly property Component dlgOpen : Component { DialogOpenNetworkDefinition { } }
readonly property Component dlgImport : Component { DialogImportSnapshot { } }
readonly property Component dlgExport : Component { DialogExportSnapshot { } }
readonly property Component dlgPrintLocation : Component { DialogPrintDatasheet { } }
readonly property Component singleShot : Component {
Timer {
repeat: false;
running: true;
onTriggered: {
callback ();
destroy ();
}
property var callback : function () { }
}
}
}
......@@ -121,7 +121,7 @@ StretchColumnContainer {
}
Stretcher { }
TextLabel {
text: (actuator ? format (actuator.valSpeed, actuator.decimals) : "");
text: (actuator ? Shared.format (actuator.valSpeed, actuator.decimals) : "");
font.family: Style.fontFixedName;
anchors.baseline: lblActuatorPhySpeed.baseline;
}
......@@ -133,8 +133,8 @@ StretchColumnContainer {
TextLabel {
text: (actuator
? "(" + [
format (actuator.minSpeed, actuator.decimals),
format (actuator.maxSpeed, actuator.decimals),
Shared.format (actuator.minSpeed, actuator.decimals),
Shared.format (actuator.maxSpeed, actuator.decimals),
].join (Style.charThreeDots) + ")"
: "");
color: Style.colorBorder;
......
......@@ -3,7 +3,7 @@ import QtQmlTricks.UiElements 2.0;
import QtCAN.CanTestBench 2.0;
TextLabel {
text: (actuator ? format (actuator.valSpeed, actuator.decimals, actuator.unit) : "");
text: (actuator ? Shared.format (actuator.valSpeed, actuator.decimals, actuator.unit) : "");
property AnalogActuator actuator : null;
}
......@@ -35,12 +35,12 @@ StretchColumnContainer {
enabled: slider.enabled;
padding: Style.spacingSmall;
decimals: (sensor ? sensor.decimals : 0);
minValue: (sensor ? intToFloat (sensor.minPhy, sensor.decimals) : 0);
maxValue: (sensor ? intToFloat (sensor.maxPhy, sensor.decimals) : 1);
minValue: (sensor ? Shared.intToFloat (sensor.minPhy, sensor.decimals) : 0);
maxValue: (sensor ? Shared.intToFloat (sensor.maxPhy, sensor.decimals) : 1);
anchors.verticalCenter: parent.verticalCenter;
onEdited: { sensor.valPhy = floatToInt (value, sensor.decimals); }
onEdited: { sensor.valPhy = Shared.floatToInt (value, sensor.decimals); }
Binding on value { value: (sensor ? intToFloat (sensor.valPhy, sensor.decimals) : 0); }
Binding on value { value: (sensor ? Shared.intToFloat (sensor.valPhy, sensor.decimals) : 0); }
}
}
StretchRowContainer {
......@@ -56,7 +56,7 @@ StretchColumnContainer {
Stretcher { }
TextLabel {
id: viewSensorPhyVal;
text: (sensor ? format (sensor.valPhy, sensor.decimals) : "");
text: (sensor ? Shared.format (sensor.valPhy, sensor.decimals) : "");
font.family: Style.fontFixedName;
color: (sensor
? (sensor.valPhy >= sensor.minPhy && sensor.valPhy <= sensor.maxPhy
......@@ -74,8 +74,8 @@ StretchColumnContainer {
TextLabel {
text: (sensor
? "(" + [
format (sensor.minPhy, sensor.decimals),
format (sensor.maxPhy, sensor.decimals),
Shared.format (sensor.minPhy, sensor.decimals),
Shared.format (sensor.maxPhy, sensor.decimals),
].join (Style.charThreeDots) + ")"
: "");
color: Style.colorBorder;
......
......@@ -3,7 +3,7 @@ import QtQmlTricks.UiElements 2.0;
import QtCAN.CanTestBench 2.0;
TextLabel {
text: (sensor ? format (sensor.valPhy, sensor.decimals, sensor.unit) : "");
text: (sensor ? Shared.format (sensor.valPhy, sensor.decimals, sensor.unit) : "");
color: (sensor
? ((sensor.valPhy >= sensor.minPhy &&
sensor.valPhy <= sensor.maxPhy)
......
......@@ -53,7 +53,7 @@ StretchColumnContainer {
Stretcher { }
TextLabel {
id: viewSensorHighThreshold;
text: (actuator ? format (actuator.ratedSpeed, actuator.decimals) : "");
text: (actuator ? Shared.format (actuator.ratedSpeed, actuator.decimals) : "");
font.family: Style.fontFixedName;
anchors.baseline: lblActuatorRatedSpeed.baseline;
}
......
......@@ -6,7 +6,7 @@ Row {
spacing: Style.spacingSmall;
TextLabel {
text: (actuator ? format (actuator.valSpeed, actuator.decimals, actuator.unit) : "");
text: (actuator ? Shared.format (actuator.valSpeed, actuator.decimals, actuator.unit) : "");
anchors.verticalCenter: parent.verticalCenter;
}
Circle {
......
......@@ -53,7 +53,7 @@ StretchColumnContainer {
Stretcher { }
TextLabel {
id: viewSensorPhyVal;
text: (sensor ? format (sensor.valPhy, sensor.decimals) : "");
text: (sensor ? Shared.format (sensor.valPhy, sensor.decimals) : "");
font.family: Style.fontFixedName;
anchors.baseline: lblSensorPhyVal.baseline;
}
......@@ -76,7 +76,7 @@ StretchColumnContainer {
Stretcher { }
TextLabel {
id: viewSensorLowThreshold;
text: (sensor ? format (sensor.lowThresholdPhy, sensor.decimals) : "");
text: (sensor ? Shared.format (sensor.lowThresholdPhy, sensor.decimals) : "");
font.family: Style.fontFixedName;
anchors.baseline: lblSensorLowThreshold.baseline;
}
......@@ -99,7 +99,7 @@ StretchColumnContainer {
Stretcher { }
TextLabel {
id: viewSensorHighThreshold;
text: (sensor ? format (sensor.highThresholdPhy, sensor.decimals) : "");
text: (sensor ? Shared.format (sensor.highThresholdPhy, sensor.decimals) : "");
font.family: Style.fontFixedName;
anchors.baseline: lblSensorHighThreshold.baseline;
}
......
......@@ -6,7 +6,7 @@ Row {
spacing: Style.spacingSmall;
TextLabel {
text: (sensor ? format (sensor.valPhy, sensor.decimals, sensor.unit) : "");
text: (sensor ? Shared.format (sensor.valPhy, sensor.decimals, sensor.unit) : "");
anchors.verticalCenter: parent.verticalCenter;
}
Circle {
......
......@@ -11,7 +11,7 @@ StretchRowContainer {
TextButton {
flat: true;
icon: SymbolLoader {
symbol: compoSymbolPlug;
symbol: Components.symbolPlug;
size: Style.fontSizeSmall;
}
padding: (Style.lineSize * 2);
......@@ -48,12 +48,12 @@ StretchRowContainer {
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
if (link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = link.source;
Shared.highlightIO = null;
Shared.highlightIO = link.source;
}
else if (link.source.family === ObjectFamily.VALUE) {
highlightPhyVal = null;
highlightPhyVal = link.source;
Shared.highlightPhyVal = null;
Shared.highlightPhyVal = link.source;
}
}
}
......
......@@ -11,7 +11,7 @@ StretchRowContainer {
TextButton {
flat: true;
icon: SymbolLoader {
symbol: compoSymbolPlug;
symbol: Components.symbolPlug;
size: Style.fontSizeSmall;
}
padding: (Style.lineSize * 2);
......@@ -48,12 +48,12 @@ StretchRowContainer {
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
if (link.target.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = link.target;
Shared.highlightIO = null;
Shared.highlightIO = link.target;
}
else if (link.target.family === ObjectFamily.VALUE) {
highlightPhyVal = null;
highlightPhyVal = link.target;
Shared.highlightPhyVal = null;
Shared.highlightPhyVal = link.target;
}
}
}
......
......@@ -5,7 +5,7 @@ import QtCAN.CanTestBench 2.0;
ExpandableGroup {
id: base;
expandable: (dims.shouldBeVisible || !toggleShowOnlyEditable.checked);
expandable: (dims.shouldBeVisible || !Shared.showOnlyEditable);
iconItem: Rectangle {
color: block.color;
implicitWidth: Style.iconSize (1);
......
......@@ -31,10 +31,10 @@ ExpandableGroup {
id: creator;
component: {
switch (modelData ["family"]) {
case ObjectFamily.VALUE: return compoDelegatePhyVal;
case ObjectFamily.GROUP: return compoDelegatePhyGroup;
case ObjectFamily.BLOCK: return compoDelegatePhyBlock;
case ObjectFamily.MARKER: return compoDelegatePhyMarker;
case ObjectFamily.VALUE: return Components.delegatePhyVal;
case ObjectFamily.GROUP: return Components.delegatePhyGroup;
case ObjectFamily.BLOCK: return Components.delegatePhyBlock;
case ObjectFamily.MARKER: return Components.delegatePhyMarker;
default: return null;
}
}
......
......@@ -5,7 +5,7 @@ import QtCAN.CanTestBench 2.0;
ExpandableGroup {
id: base;
expandable: (dims.shouldBeVisible || !toggleShowOnlyEditable.checked);
expandable: (dims.shouldBeVisible || !Shared.showOnlyEditable);
iconItem: SvgIconLoader {
icon: "others/target";
size: Style.iconSize (1);
......
......@@ -22,9 +22,9 @@ MouseArea {
property PhysicalValue phyVal : null;
readonly property bool shouldBeVisible : (current || editable || !toggleShowOnlyEditable.checked);
readonly property bool shouldBeVisible : (current || editable || !Shared.showOnlyEditable);
readonly property bool current : (phyVal === highlightPhyVal);
readonly property bool current : (phyVal === Shared.highlightPhyVal);
readonly property bool editable : (phyVal.min !== phyVal.max);
signal needVisible (Item item);
......
......@@ -55,8 +55,8 @@ MouseArea {
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightSensor = null;
highlightSensor = io.link.source;
Shared.highlightSensor = null;
Shared.highlightSensor = io.link.source;
}
}
Stretcher { }
......
......@@ -56,8 +56,8 @@ MouseArea {
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightActuator = null;
highlightActuator = io.link.target;
Shared.highlightActuator = null;
Shared.highlightActuator = io.link.target;
}
}
Stretcher { }
......
......@@ -27,14 +27,14 @@ ExpandableGroup {
switch (io.type) {
case ObjectType.ANALOG:
switch (io.direction) {
case ObjectDirection.INPUT: return compoDelegateRawAinTable;
case ObjectDirection.OUTPUT: return compoDelegateRawAoutTable;
case ObjectDirection.INPUT: return Components.delegateRawAinTable;
case ObjectDirection.OUTPUT: return Components.delegateRawAoutTable;
}
break;
case ObjectType.DIGITAL:
switch (io.direction) {
case ObjectDirection.INPUT: return compoDelegateRawDinTable;
case ObjectDirection.OUTPUT: return compoDelegateRawDoutTable;
case ObjectDirection.INPUT: return Components.delegateRawDinTable;
case ObjectDirection.OUTPUT: return Components.delegateRawDoutTable;
}
break;
}
......
......@@ -55,8 +55,8 @@ MouseArea {
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightSensor = null;
highlightSensor = io.link.source;
Shared.highlightSensor = null;
Shared.highlightSensor = io.link.source;
}
}
Stretcher { }
......
......@@ -55,8 +55,8 @@ MouseArea {
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightActuator = null;
highlightActuator = io.link.target;
Shared.highlightActuator = null;
Shared.highlightActuator = io.link.target;
}
}
Stretcher { }
......
......@@ -23,7 +23,7 @@ ExpandableGroup {
Repeater {
model: node.boards;
delegate: InstanceCreator {
component: compoDelegateRawBoardTable;
component: Components.delegateRawBoardTable;
properties: ({ "board" : modelData });
ExtraAnchors.horizontalFill: parent;
}
......
......@@ -106,7 +106,7 @@ AbstractDialogDetailsIO {
TextButton {
flat: true;
icon: SymbolLoader {
symbol: compoSymbolPlug;
symbol: Components.symbolPlug;
size: Style.iconSize (0.5);
}
textColor: (ain && ain.link && ain.link.source
......@@ -126,12 +126,12 @@ AbstractDialogDetailsIO {
anchors.baseline: lblLinkedSensor.baseline;
onClicked: {
if (ain.link.source.family === ObjectFamily.SENSOR) {
highlightSensor = null;
highlightSensor = ain.link.source;
Shared.highlightSensor = null;
Shared.highlightSensor = ain.link.source;
}
else if (ain.link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = ain.link.source;
Shared.highlightIO = null;
Shared.highlightIO = ain.link.source;
}
else { }
}
......
......@@ -106,7 +106,7 @@ AbstractDialogDetailsIO {
TextButton {
flat: true;
icon: SymbolLoader {
symbol: compoSymbolPlug;
symbol: Components.symbolPlug;
size: Style.iconSize (0.5);
}
textColor: (aout && aout.link && aout.link.target
......@@ -126,12 +126,12 @@ AbstractDialogDetailsIO {
anchors.baseline: lblLinkedActuator.baseline;
onClicked: {
if (aout.link.target.family === ObjectFamily.ACTUATOR) {
highlightActuator = null;
highlightActuator = aout.link.target;
Shared.highlightActuator = null;
Shared.highlightActuator = aout.link.target;
}
else if (aout.link.target.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = aout.link.target;
Shared.highlightIO = null;
Shared.highlightIO = aout.link.target;
}
else { }
}
......
......@@ -38,7 +38,7 @@ AbstractDialogDetailsIO {
TextButton {
flat: true;
icon: SymbolLoader {
symbol: compoSymbolPlug;
symbol: Components.symbolPlug;
size: Style.iconSize (0.5);
}
textColor: (din && din.link && din.link.source
......@@ -58,12 +58,12 @@ AbstractDialogDetailsIO {
anchors.baseline: lblLinkedSensor.baseline;
onClicked: {
if (din.link.source.family === ObjectFamily.SENSOR) {
highlightSensor = null;
highlightSensor = din.link.source;
Shared.highlightSensor = null;
Shared.highlightSensor = din.link.source;
}
else if (din.link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = din.link.source;
Shared.highlightIO = null;
Shared.highlightIO = din.link.source;
}
else { }
}
......
......@@ -38,7 +38,7 @@ AbstractDialogDetailsIO {
TextButton {
flat: true;
icon: SymbolLoader {
symbol: compoSymbolPlug;
symbol: Components.symbolPlug;
size: Style.iconSize (0.5);
}
textColor: (dout && dout.link && dout.link.target
......@@ -58,12 +58,12 @@ AbstractDialogDetailsIO {
anchors.baseline: lblLinkedActuator.baseline;
onClicked: {
if (dout.link.target.family === ObjectFamily.ACTUATOR) {
highlightActuator = null;
highlightActuator = dout.link.target;
Shared.highlightActuator = null;
Shared.highlightActuator = dout.link.target;
}
else if (dout.link.target.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = dout.link.target;
Shared.highlightIO = null;
Shared.highlightIO = dout.link.target;
}
else { }
}
......
......@@ -10,7 +10,7 @@ Repeater {
id: delegateDimensionTable;
visible: (modelData ["highlightCount"] > 0 ||
modelData ["editableCount"] > 0 ||
!toggleShowOnlyEditable.checked);
!Shared.showOnlyEditable);
uidLabel {
text: dimension.uid;
font.italic: true;
......@@ -69,7 +69,7 @@ Repeater {
if (phyVal.min !== phyVal.max) {
++editableCount;
}
if (phyVal === highlightPhyVal) {
if (phyVal === Shared.highlightPhyVal) {
++highlightCount;
}
});
......
......@@ -1004,7 +1004,7 @@ NetworkDefinition {
id: display1;
size: 60;
unit: "m";
value: intToFloat (sensorArmElev.valPhy, sensorArmElev.decimals);
value: Shared.intToFloat (sensorArmElev.valPhy, sensorArmElev.decimals);
legend: "Altitude";
digits: 2;
decimals: sensorArmElev.decimals;
......@@ -1112,9 +1112,9 @@ NetworkDefinition {
unit: "m";
legend: "Extension sensor";
lineColor: "darkcyan";
currentValue: intToFloat (sensorExt.valPhy, sensorExt.decimals);
minValue: intToFloat (sensorExt.minPhy, sensorExt.decimals);
maxValue: intToFloat (sensorExt.maxPhy, sensorExt.decimals);
currentValue: Shared.intToFloat (sensorExt.valPhy, sensorExt.decimals);
minValue: Shared.intToFloat (sensorExt.minPhy, sensorExt.decimals);
maxValue: Shared.intToFloat (sensorExt.maxPhy, sensorExt.decimals);
decimals: 0;
markValues: [5, 10, 15, 20, 25, 30];
}
......@@ -1122,9 +1122,9 @@ NetworkDefinition {
unit: "°";
legend: "Slewing sensor";
lineColor: "darkgreen";
currentValue: intToFloat (sensorSlewAng.valPhy, sensorSlewAng.decimals);
minValue: intToFloat (sensorSlewAng.minPhy, sensorSlewAng.decimals);
maxValue: intToFloat (sensorSlewAng.maxPhy, sensorSlewAng.decimals);
currentValue: Shared.intToFloat (sensorSlewAng.valPhy, sensorSlewAng.decimals);
minValue: Shared.intToFloat (sensorSlewAng.minPhy, sensorSlewAng.decimals);
maxValue: Shared.intToFloat (sensorSlewAng.maxPhy, sensorSlewAng.decimals);
decimals: 0;
markValues: [90, 180, 270];
}
......@@ -1132,9 +1132,9 @@ NetworkDefinition {
unit: "°";
legend: "Angle sensor";
lineColor: "darkred";
currentValue: intToFloat (sensorAngUpDown.valPhy, sensorAngUpDown.decimals);
minValue: intToFloat (sensorAngUpDown.minPhy, sensorAngUpDown.decimals);
maxValue: intToFloat (sensorAngUpDown.maxPhy, sensorAngUpDown.decimals);
currentValue: Shared.intToFloat (sensorAngUpDown.valPhy, sensorAngUpDown.decimals);
minValue: Shared.intToFloat (sensorAngUpDown.minPhy, sensorAngUpDown.decimals);
maxValue: Shared.intToFloat (sensorAngUpDown.maxPhy, sensorAngUpDown.decimals);
decimals: 0;
markValues: [15, 45];
}
......@@ -1146,8 +1146,4 @@ NetworkDefinition {
height: 480;
}
]
function intToFloat (number, decimals) {
return (number / Math.pow (10, decimals));
}
}
This diff is collapsed.
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