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

Minor cleanup

parent 5cc5b733
......@@ -250,9 +250,9 @@ void Manager::reset (void) {
void Manager::deinit (void) {
static QElapsedTimer bench;
bench.restart ();
update_ready (false);
if (m_currentNetwork) {
NetworkDefinition * oldNet = m_currentNetwork;
update_ready (false);
update_hasValidNetwork (false);
update_currentNetwork (Q_NULLPTR);
QCoreApplication::processEvents ();
......
......@@ -7,13 +7,13 @@ import QtCAN.Utils 2.0;
import "components";
Item {
id: window;
id: root;
onNetworkChanged: {
Shared.currentNode = null;
Shared.highlightIO = null;
Shared.highlightSensor = null;
Shared.currentNode = null;
Shared.highlightIO = null;
Shared.highlightSensor = null;
Shared.highlightActuator = null;
Shared.highlightPhyVal = null;
Shared.highlightPhyVal = null;
if (network) {
if (network.hideSensorsPanel) {
panelSensors.collapse ();
......@@ -53,12 +53,8 @@ Item {
}
}
readonly property NetworkDefinition network : (Shared.manager.hasValidNetwork
? Shared.manager.currentNetwork
: null);
readonly property PhysicalWorld world : (Shared.manager.ready && network ? network.world : null);
readonly property NetworkDefinition network : (Shared.manager.ready && Shared.manager.hasValidNetwork ? Shared.manager.currentNetwork : null);
readonly property PhysicalWorld world : (Shared.manager.ready && network ? network.world : null);
readonly property ObjectRefListModel nodesList : (Shared.manager.ready ? Shared.manager.nodes : null);
readonly property ObjectRefListModel sensorsList : (Shared.manager.ready ? Shared.manager.sensors : null);
readonly property ObjectRefListModel actuatorsList : (Shared.manager.ready ? Shared.manager.actuators : null);
......@@ -67,7 +63,7 @@ Item {
readonly property ObjectRefListModel serialBusList : (Shared.manager.ready ? Shared.manager.serialBuses : null);
function singleShot (delay, callback) {
Components.singleShot.createObject (window, {
Components.singleShot.createObject (root, {
"interval" : delay,
"callback" : callback,
});
......@@ -123,7 +119,7 @@ Item {
color: Style.colorForeground;
}
anchors.verticalCenter: parent.verticalCenter;
onClicked: { Components.dlgOpen.createObject (window, { }); }
onClicked: { Components.dlgOpen.createObject (root, { }); }
}
SvgIconLoader {
icon: "actions/info";
......@@ -208,7 +204,7 @@ Item {
icon: "actions/import";
color: Style.colorForeground;
}
onClicked: { Components.dlgImport.createObject (window, { }); }
onClicked: { Components.dlgImport.createObject (root, { }); }
}
TextButton {
text: qsTr ("Export state");
......@@ -216,13 +212,13 @@ Item {
icon: "actions/export";
color: Style.colorForeground;
}
onClicked: { Components.dlgExport.createObject (window, { }); }
onClicked: { Components.dlgExport.createObject (root, { }); }
}
TextButton {
text: qsTr ("Print as HTML");
icon: SvgIconLoader { icon: "devices/printer"; }
anchors.verticalCenter: parent.verticalCenter;
onClicked: { Components.dlgPrintLocation.createObject (window, { }); }
onClicked: { Components.dlgPrintLocation.createObject (root, { }); }
}
}
}
......@@ -271,7 +267,7 @@ Item {
delegate: DelegateCanBus {
canBus: modelData;
onClicked: {
Components.dlgConfCanBus.createObject (window, {
Components.dlgConfCanBus.createObject (root, {
"canBus" : canBus,
});
}
......@@ -282,7 +278,7 @@ Item {
delegate: DelegateSerialBus {
serialBus: modelData;
onClicked: {
Components.dlgConfSerialBus.createObject (window, {
Components.dlgConfSerialBus.createObject (root, {
"serialBus" : serialBus,
});
}
......@@ -1413,8 +1409,8 @@ Item {
id: compoDetachedWindow;
Window {
color: window.color;
title: (window.title + " (detached 3D view)");
color: root.color;
title: (root.title + " (detached 3D view)");
visible: true;
onClosing: { delegate3dView.attach (); }
......@@ -1535,7 +1531,7 @@ Item {
RendererItem {
id: renderer;
world: (network ? network.world : null);
world: root.world;
viewingSide: comboSide.currentKey;
viewingZoom: sliderDistance.value;
usePerspective: togglePerspective.value;
......
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