diff --git a/FileSets/v3.00~25/PageGenerator.qml 2.orig b/FileSets/v3.00~25/PageGenerator.qml 2.orig new file mode 100644 index 00000000..91cb59fe --- /dev/null +++ b/FileSets/v3.00~25/PageGenerator.qml 2.orig @@ -0,0 +1,189 @@ +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage { + id: root + title: qsTr("Generator start/stop") + property string settingsBindPrefix + property string startStopBindPrefix + property alias startStopModel: _startStopModel + property bool allowDisableAutostart: true + property VBusItem activeCondition: VBusItem { bind: Utils.path(startStopBindPrefix, "/RunningByCondition") } + property VBusItem generatorState: VBusItem { bind: Utils.path(startStopBindPrefix, "/State") } + property VBusItem runningTime: VBusItem { bind: Utils.path(startStopBindPrefix, "/Runtime") } + property VBusItem historicalData: VBusItem { bind: Utils.path(settingsBindPrefix, "/AccumulatedDaily") } + property VBusItem functionEnabled: VBusItem { bind: Utils.path(startStopBindPrefix, "/State") } + + function getState() + { + if (generatorState.value === 10) + return qsTr("Error") + + switch(activeCondition.value) { + case 'soc': + return qsTr("Running by SOC condition") + case 'acload': + return qsTr("Running by AC Load condition") + case 'batterycurrent': + return qsTr("Running by battery current condition") + case 'batteryvoltage': + return qsTr("Running by battery voltage condition") + case 'inverterhightemp': + return qsTr("Running by inverter high temperature") + case 'inverteroverload': + return qsTr("Running by inverter overload") + case 'testrun': + return qsTr("Test run") + case 'lossofcommunication': + return qsTr("Running by loss of communication") + case 'manual': + return qsTr("Manually started") + default: + return qsTr("Stopped") + } + } + + model: startStopModel + + function formatError(text, value) + { + return "#" + value.toString() + " " + text + } + + VisibleItemModel { + id: _startStopModel + + MbItemValue { + description: qsTr("State") + item.text: activeCondition.valid ? getState() : '---' + } + + MbItemOptions { + id: _gensetStatus + description: qsTr("Error") + bind: Utils.path(startStopBindPrefix, "/Error") + readonly: true + show: valid + possibleValues: [ + MbOption { description: qsTr("No error"); value: 0 }, + MbOption { description: formatError(qsTr("Remote switch control disabled"), 1); value: 1 }, + MbOption { description: formatError(qsTr("Generator in fault condition"), 2); value: 2 }, + MbOption { description: formatError(qsTr("Generator not detected at AC input"), 3); value: 3 } + ] + } + + MbItemValue { + description: qsTr("Run time") + item.text: runningTime.valid ? Utils.secondsToNoSecsString(runningTime.value) : "0" + show: generatorState.value === 1 + } + + MbItemValue { + description: qsTr("Total run time") + item { + bind: Utils.path(settingsBindPrefix, "/AccumulatedTotal") + text: Utils.secondsToNoSecsString(item.value) + } + } + + MbItemValue { + description: qsTr("Accumulated running time since last test run") + show: user.accessLevel >= User.AccessService && nextTestRun.show + backgroundColor: style.backgroundColorService + item { + text: Utils.secondsToNoSecsString(item.value) + bind: Utils.path(startStopBindPrefix, "/TestRunIntervalRuntime") + } + } + + MbItemValue { + id: nextTestRun + description: qsTr("Time to next test run") + show: item.valid && item.value > 0 + item { + text: { + var remainingTime = item.value - new Date().getTime() / 1000 + if (remainingTime > 0) + return Utils.secondsToNoSecsString(remainingTime).toString() + return qsTr("Running now") + } + bind: Utils.path(startStopBindPrefix, "/NextTestRun") + } + } + + MbSwitch { + name: qsTr("Auto start functionality") + bind: Utils.path(settingsBindPrefix, "/AutoStartEnabled") + show: allowDisableAutostart + } + + MbSubMenu { + description: qsTr("Manual start") + subpage: Component { + MbPage { + id: manualStartPage + title: qsTr("Manual start") + model: VisibleItemModel { + MbSwitch { + id: manualSwitch + name: qsTr("Start generator") + bind: Utils.path(startStopBindPrefix, "/ManualStart") + writeAccessLevel: User.AccessUser + onCheckedChanged: { + if (manualStartPage.active) { + if (!checked) + toast.createToast(qsTr("Stopping, generator will continue running if other conditions are reached"), 3000) + if (checked && stopTimer.value == 0) + toast.createToast(qsTr("Starting, generator won't stop till user intervention"), 5000) + if (checked && stopTimer.value > 0) + toast.createToast(qsTr("Starting. The generator will stop in %1, unless other conditions keep it running").arg(Utils.secondsToString(stopTimer.value)), 5000) + } + } + + VBusItem { + id: stopTimer + bind: Utils.path(startStopBindPrefix, "/ManualStartTimer") + } + } + + MbEditBoxTime { + description: qsTr("Run for (hh:mm)") + readonly: manualSwitch.checked + item.bind: Utils.path(startStopBindPrefix, "/ManualStartTimer") + writeAccessLevel: User.AccessUser + } + } + } + } + } + + MbSubMenu { + description: qsTr("Daily run time") + subpage: MbPage { + // Invert the order + property variant keys: historicalData.valid ? + Object.keys(JSON.parse(historicalData.value)).reverse() : 0 + + title: qsTr("Daily run time") + focus: active + model: keys + delegate: MbItemValue { + description: Qt.formatDate(new Date(parseInt(keys[index]) * 1000), "dd-MM-yyyy"); + item.text: Utils.secondsToNoSecsString(JSON.parse(historicalData.value)[keys[index]]) + } + } + } + + MbSubMenu { + id: conditions + description: qsTr("Settings") + subpage: Component { + PageSettingsGenerator { + settingsBindPrefix: root.settingsBindPrefix + startStopBindPrefix: root.startStopBindPrefix + } + } + } + } +} diff --git a/FileSets/v3.00~25/PageMain 2.qml b/FileSets/v3.00~25/PageMain 2.qml new file mode 100644 index 00000000..fc1446a7 --- /dev/null +++ b/FileSets/v3.00~25/PageMain 2.qml @@ -0,0 +1,280 @@ +//////// modified order to put Settings, then Notifications at top of list + +import QtQuick 1.1 +import "utils.js" as Utils +import com.victron.velib 1.0 + +MbPage { + id: root + title: qsTr("Device List") + property VBusItem moveSettings: VBusItem { id: moveSettings; bind: Utils.path("com.victronenergy.settings", "/Settings/GuiMods/MoveSettings")} + property bool settingsAtTop: moveSettings.valid && moveSettings.value === 1 + + model: VisualModels { +//////// put Settings at top of list + VisibleItemModel { + MbSubMenu { + description: qsTr("Settings") + subpage: Component { PageSettings {} } + show: settingsAtTop + } + +//////// put Notifications second + MbSubMenu { + id: menuNotificationsTop + description: qsTr("Notifications") + item: VBusItem { + property variant active: NotificationCenter.notifications.filter( + function isActive(obj) { return obj.active} ) + value: active.length > 0 ? active.length : "" + } + subpage: Component { PageNotifications {} } + show: settingsAtTop + } + + MbOK { + description: qsTr("Remove disconnected devices") + value: qsTr("Press to remove") + show: settingsAtTop && deviceList.disconnectedDevices != 0 + editable: true + + function clicked() { + listview.decrementCurrentIndex() + deviceList.removeDisconnected() + } + } + } + VisualDataModel { + model: VeSortFilterProxyModel { + model: DeviceList { + id: deviceList + onRowsAboutToBeRemoved: { + for (var i = first; i <= last; i++) + deviceList.page(i).destroy() + } + } + sortRole: DeviceList.DescriptionRole + dynamicSortFilter: true + naturalSort: true + sortCaseSensitivity: Qt.CaseInsensitive + } + + delegate: MbDevice { + iconId: "icon-toolbar-enter" + service: model.page.service + subpage: model.page + } + } + + VisibleItemModel { + MbSubMenu { + id: menuNotifications + description: qsTr("Notifications") + item: VBusItem { + property variant active: NotificationCenter.notifications.filter( + function isActive(obj) { return obj.active} ) + value: active.length > 0 ? active.length : "" + } + subpage: Component { PageNotifications {} } + show: !settingsAtTop + } + + MbSubMenu { + description: qsTr("Settings") + subpage: Component { PageSettings {} } + show: !settingsAtTop + } + + MbOK { + description: qsTr("Remove disconnected devices") + value: qsTr("Press to remove") + show: !settingsAtTop && deviceList.disconnectedDevices != 0 + editable: true + + function clicked() { + listview.decrementCurrentIndex() + deviceList.removeDisconnected() + } + } + } + } + + Component { + id: vebusPage + PageVebus {} + } + + Component { + id: multiRsPage + PageMultiRs {} + } + + Component { + id: batteryPage + PageBattery {} + } + + Component { + id: solarChargerPage + PageSolarCharger {} + } + + Component { + id: acInPage + PageAcIn {} + } + + Component { + id: acChargerPage + PageAcCharger {} + } + + Component { + id: tankPage + PageTankSensor {} + } + + Component { + id: motorDrivePage + PageMotorDrive {} + } + + Component { + id: inverterPage + PageInverter {} + } + + Component { + id: pulseCounterPage + PagePulseCounter {} + } + + Component { + id: digitalInputPage + PageDigitalInput {} + } + + Component { + id: temperatureSensorPage + PageTemperatureSensor {} + } + + Component { + id: unsupportedDevicePage + PageUnsupportedDevice {} + } + + Component { + id: meteoDevicePage + PageMeteo {} + } + + Component { + id: evChargerPage + PageEvCharger {} + } + + Component { + id: dcMeterPage + PageDcMeter {} + } + + Component { + id: alternatorPage + PageAlternator {} + } + + function addService(service) + { + var name = service.name + + var page + switch(service.type) + { + case DBusService.DBUS_SERVICE_MULTI: + page = vebusPage + break; + case DBusService.DBUS_SERVICE_MULTI_RS: + page = multiRsPage + break; + case DBusService.DBUS_SERVICE_BATTERY: + page = batteryPage + break; + case DBusService.DBUS_SERVICE_SOLAR_CHARGER: + page = solarChargerPage + break; + case DBusService.DBUS_SERVICE_PV_INVERTER: + page = acInPage + break; + case DBusService.DBUS_SERVICE_AC_CHARGER: + page = acChargerPage + break; + case DBusService.DBUS_SERVICE_TANK: + page = tankPage + break; + case DBusService.DBUS_SERVICE_GRIDMETER: + page = acInPage + break + case DBusService.DBUS_SERVICE_GENSET: + page = acInPage + break + case DBusService.DBUS_SERVICE_MOTOR_DRIVE: + page = motorDrivePage + break + case DBusService.DBUS_SERVICE_INVERTER: + page = inverterPage + break; + case DBusService.DBUS_SERVICE_TEMPERATURE_SENSOR: + page = temperatureSensorPage + break; + case DBusService.DBUS_SERVICE_SYSTEM_CALC: + return; + case DBusService.DBUS_SERVICE_DIGITAL_INPUT: + page = digitalInputPage + break; + case DBusService.DBUS_SERVICE_PULSE_COUNTER: + page = pulseCounterPage + break; + case DBusService.DBUS_SERVICE_UNSUPPORTED: + page = unsupportedDevicePage + break; + case DBusService.DBUS_SERVICE_METEO: + page = meteoDevicePage + break; + case DBusService.DBUS_SERVICE_VECAN: + return; + case DBusService.DBUS_SERVICE_EVCHARGER: + page = evChargerPage + break + case DBusService.DBUS_SERVICE_ACLOAD: + page = acInPage + break + case DBusService.DBUS_SERVICE_HUB4: + return; + case DBusService.DBUS_SERVICE_FUELCELL: + case DBusService.DBUS_SERVICE_DCSOURCE: + case DBusService.DBUS_SERVICE_DCLOAD: + case DBusService.DBUS_SERVICE_DCSYSTEM: + page = dcMeterPage + break + case DBusService.DBUS_SERVICE_ALTERNATOR: + page = alternatorPage + break + default: + console.log("unknown service " + name) + return; + } + + deviceList.append(service, page.createObject(root, {service: service, bindPrefix: service.name})) + } + + Component.onCompleted: { + for (var i = 0; i < DBusServices.count; i++) + addService(DBusServices.at(i)) + } + + Connections { + target: DBusServices + onDbusServiceFound: addService(service) + } +} diff --git a/version b/version index b677c3df..ab268476 100644 --- a/version +++ b/version @@ -1 +1 @@ -v7.30~3 +v7.30~4