-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,890 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/////// new menu for system shutdown | ||
|
||
import QtQuick 1.1 | ||
import "utils.js" as Utils | ||
import com.victron.velib 1.0 | ||
|
||
MbPage | ||
{ | ||
id: root | ||
title: qsTr("System Shutdown") | ||
VBusItem { id: shutdownItem; bind: Utils.path("com.victronenergy.shutdown", "/Shutdown") } | ||
|
||
model: VisualItemModel | ||
{ | ||
|
||
MbItemText | ||
{ | ||
text: qsTr("<b>NOTE:</b> GX device must be power cycled to restart it after shutting down") | ||
wrapMode: Text.WordWrap | ||
horizontalAlignment: Text.AlignLeft | ||
show: shutdownItem.valid | ||
} | ||
MbItemText | ||
{ | ||
text: qsTr("No shutdown dBus parameter - check ShutdownMonitor service") | ||
wrapMode: Text.WordWrap | ||
horizontalAlignment: Text.AlignLeft | ||
show: !shutdownItem.valid | ||
} | ||
MbOK | ||
{ | ||
id: shutdown | ||
description: qsTr("Shutdown?") | ||
writeAccessLevel: User.AccessUser | ||
onClicked: | ||
{ | ||
toast.createToast(qsTr("Shutting down..."), 10000, "icon-restart-active") | ||
if (shutdownItem.valid) | ||
shutdownItem.setValue (1) | ||
} | ||
show: shutdownItem.valid | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/opt/victronenergy/gui/qml/PageSettingsGeneral.qml |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
//////// Modified to add Shutdown command (RPI only) | ||
|
||
import QtQuick 1.1 | ||
import com.victron.velib 1.0 | ||
import "utils.js" as Utils | ||
|
||
MbPage | ||
{ | ||
id: root | ||
property string bindPrefix: "com.victronenergy.settings" | ||
|
||
//////// add for Shutdown command | ||
VBusItem { id: shutdownItem; bind: Utils.path("com.victronenergy.shutdown", "/Shutdown") } | ||
|
||
model: VisualItemModel { | ||
MbItemOptions { | ||
id: accessLevelSelect | ||
description: qsTr("Access level") | ||
bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") | ||
magicKeys: true | ||
writeAccessLevel: User.AccessUser | ||
possibleValues: [ | ||
MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, | ||
MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, | ||
MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, | ||
MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } | ||
] | ||
|
||
// change to super user mode if the right button is pressed for a while | ||
property int repeatCount | ||
onFocusChanged: repeatCount = 0 | ||
|
||
function open() { | ||
if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { | ||
if (accessLevelSelect.value !== User.AccessSuperUser) | ||
accessLevelSelect.item.setValue(User.AccessSuperUser) | ||
repeatCount = 0 | ||
} | ||
} | ||
} | ||
|
||
MbEditBox { | ||
show: user.accessLevel >= User.AccessSuperUser | ||
description: "Set root password" | ||
onEditDone: { | ||
if (newValue.length < 6) { | ||
toast.createToast("Please enter at least 6 characters") | ||
} else { | ||
toast.createToast(vePlatform.setRootPassword(newValue)) | ||
item.value = "" | ||
} | ||
} | ||
} | ||
|
||
MbSwitch { | ||
name: qsTr("SSH on LAN") | ||
show: user.accessLevel >= User.AccessSuperUser | ||
bind: "com.victronenergy.settings/Settings/System/SSHLocal" | ||
} | ||
|
||
MbSwitch { | ||
id: remoteSupportOnOff | ||
name: qsTr("Remote support") | ||
bind: "com.victronenergy.settings/Settings/System/RemoteSupport" | ||
} | ||
|
||
MbItemValue { | ||
description: qsTr("Remote support tunnel") | ||
item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") | ||
show: remoteSupportOnOff.item.value | ||
} | ||
|
||
MbItemValue { | ||
id: remotePort | ||
description: qsTr("Remote support port") | ||
item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportPort" | ||
show: remoteSupportOnOff.item.value | ||
} | ||
|
||
MbOK { | ||
id: reboot | ||
description: qsTr("Reboot?") | ||
writeAccessLevel: User.AccessUser | ||
onClicked: { | ||
toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") | ||
vePlatform.reboot() | ||
} | ||
} | ||
//////// add for Shutdown command | ||
MbSubMenu | ||
{ | ||
description: qsTr("Shutdown") | ||
subpage: Component { PageSettingsShutdown {} } | ||
show: shutdownItem.valid | ||
} | ||
|
||
MbSwitch { | ||
property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} | ||
name: qsTr("Audible alarm") | ||
bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") | ||
show: hasBuzzer.valid | ||
} | ||
|
||
MbItemOptions { | ||
id: demoOnOff | ||
description: qsTr("Demo mode") | ||
bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") | ||
possibleValues: [ | ||
MbOption { description: qsTr("Disabled"); value: 0 }, | ||
MbOption { description: qsTr("ESS demo"); value: 1 }, | ||
MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, | ||
MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } | ||
] | ||
} | ||
|
||
MbItemText { | ||
text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") | ||
wrapMode: Text.WordWrap | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import QtQuick 1.1 | ||
import com.victron.velib 1.0 | ||
import "utils.js" as Utils | ||
|
||
MbPage | ||
{ | ||
id: root | ||
property string bindPrefix: "com.victronenergy.settings" | ||
|
||
model: VisualItemModel { | ||
MbItemOptions { | ||
id: accessLevelSelect | ||
description: qsTr("Access level") | ||
bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") | ||
magicKeys: true | ||
writeAccessLevel: User.AccessUser | ||
possibleValues: [ | ||
MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, | ||
MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, | ||
MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, | ||
MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } | ||
] | ||
|
||
// change to super user mode if the right button is pressed for a while | ||
property int repeatCount | ||
onFocusChanged: repeatCount = 0 | ||
|
||
function open() { | ||
if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { | ||
if (accessLevelSelect.value !== User.AccessSuperUser) | ||
accessLevelSelect.item.setValue(User.AccessSuperUser) | ||
repeatCount = 0 | ||
} | ||
} | ||
} | ||
|
||
MbEditBox { | ||
show: user.accessLevel >= User.AccessSuperUser | ||
description: "Set root password" | ||
onEditDone: { | ||
if (newValue.length < 6) { | ||
toast.createToast("Please enter at least 6 characters") | ||
} else { | ||
toast.createToast(vePlatform.setRootPassword(newValue)) | ||
item.value = "" | ||
} | ||
} | ||
} | ||
|
||
MbSwitch { | ||
name: qsTr("SSH on LAN") | ||
show: user.accessLevel >= User.AccessSuperUser | ||
bind: "com.victronenergy.settings/Settings/System/SSHLocal" | ||
} | ||
|
||
MbSwitch { | ||
id: remoteSupportOnOff | ||
name: qsTr("Remote support") | ||
bind: "com.victronenergy.settings/Settings/System/RemoteSupport" | ||
} | ||
|
||
MbItemValue { | ||
description: qsTr("Remote support tunnel") | ||
item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") | ||
show: remoteSupportOnOff.item.value | ||
} | ||
|
||
MbItemValue { | ||
id: remotePort | ||
description: qsTr("Remote support port") | ||
item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportPort" | ||
show: remoteSupportOnOff.item.value | ||
} | ||
|
||
MbOK { | ||
id: reboot | ||
description: qsTr("Reboot?") | ||
writeAccessLevel: User.AccessUser | ||
onClicked: { | ||
toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") | ||
vePlatform.reboot() | ||
} | ||
} | ||
|
||
MbSwitch { | ||
property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} | ||
name: qsTr("Audible alarm") | ||
bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") | ||
show: hasBuzzer.valid | ||
} | ||
|
||
MbItemOptions { | ||
id: demoOnOff | ||
description: qsTr("Demo mode") | ||
bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") | ||
possibleValues: [ | ||
MbOption { description: qsTr("Disabled"); value: 0 }, | ||
MbOption { description: qsTr("ESS demo"); value: 1 }, | ||
MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, | ||
MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } | ||
] | ||
} | ||
|
||
MbItemText { | ||
text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") | ||
wrapMode: Text.WordWrap | ||
} | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.