Skip to content

Commit

Permalink
new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Oct 1, 2021
1 parent 3a7ed9d commit e0d0e89
Show file tree
Hide file tree
Showing 27 changed files with 1,890 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added FileSets/.DS_Store
Binary file not shown.
44 changes: 44 additions & 0 deletions FileSets/PageSettingsShutdown.qml
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
}
}
}
1 change: 1 addition & 0 deletions FileSets/fileList
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/opt/victronenergy/gui/qml/PageSettingsGeneral.qml
Binary file added FileSets/v2.40/.DS_Store
Binary file not shown.
121 changes: 121 additions & 0 deletions FileSets/v2.40/PageSettingsGeneral.qml
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
}
}
}
109 changes: 109 additions & 0 deletions FileSets/v2.40/PageSettingsGeneral.qml.orig
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 added FileSets/v2.60/.DS_Store
Binary file not shown.
Loading

0 comments on commit e0d0e89

Please sign in to comment.