Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customization checks and links page #1826

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ set (VENUS_QML_MODULE_SOURCES
components/listitems/ListMountStateButton.qml
components/listitems/ListPvInverterPositionRadioButtonGroup.qml
components/listitems/ListEvChargerPositionRadioButtonGroup.qml
components/listitems/ListRebootButton.qml
components/listitems/ListRelayState.qml
components/listitems/ListResetHistory.qml
components/listitems/ListTemperatureRelay.qml
Expand Down Expand Up @@ -512,6 +513,7 @@ set (VENUS_QML_MODULE_SOURCES
pages/settings/PageSettingsModbusDiscovered.qml
pages/settings/PageSettingsModbusTcp.qml
pages/settings/PageSettingsModbusTcpServices.qml
pages/settings/PageSettingsModificationChecks.qml
pages/settings/PageSettingsNodeRed.qml
pages/settings/PageSettingsRelay.qml
pages/settings/PageSettingsRelayTempSensors.qml
Expand All @@ -524,6 +526,7 @@ set (VENUS_QML_MODULE_SOURCES
pages/settings/PageSettingsTailscale.qml
pages/settings/PageSettingsTankPump.qml
pages/settings/PageSettingsTcpIp.qml
pages/settings/PageSettingsUsefulLinks.qml
pages/settings/PageSettingsVecanDevice.qml
pages/settings/PageSettingsVecanDevices.qml
pages/settings/PageSettingsWifi.qml
Expand Down Expand Up @@ -1258,4 +1261,3 @@ add_custom_target(
DEPENDS "${PROJECT_SOURCE_DIR}/src/themeobjects.h"
)
add_dependencies(${PROJECT_NAME} theme_parser)

52 changes: 52 additions & 0 deletions components/listitems/ListRebootButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
** Copyright (C) 2025 Victron Energy B.V.
** See LICENSE.txt for license information.
*/

import QtQuick
import QtQuick.Controls.impl as CP
import Victron.VenusOS
import QtQuick.Templates as T

ListButton {
id: root

//text: CommonWords.reboot
//% "Reboot now"
//button.text: qsTrId("settings_reboot_now")
writeAccessLevel: VenusOS.User_AccessType_User
onClicked: Global.dialogLayer.open(confirmRebootDialogComponent)

Component {
id: confirmRebootDialogComponent

ModalWarningDialog {
//% "Press 'OK' to reboot"
title: qsTrId("press_ok_to_reboot")
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkAndCancel
onClosed: {
if (result === T.Dialog.Accepted) {
Global.venusPlatform.reboot()
Qt.callLater(Global.dialogLayer.open, rebootingDialogComponent)
}
}
}
}

Component {
id: rebootingDialogComponent

ModalWarningDialog {
title: BackendConnection.type === BackendConnection.DBusSource
//% "Rebooting..."
? qsTrId("dialoglayer_rebooting")
//% "Device has been rebooted."
: qsTrId("dialoglayer_rebooted")

// On device, dialog cannot be dismissed; just wait until device is rebooted.
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkOnly
footer.enabled: BackendConnection.type !== BackendConnection.DBusSource
footer.opacity: footer.enabled ? 1 : 0
}
}
}
2 changes: 1 addition & 1 deletion pages/SettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SwipeViewPage {
SettingsListNavigation {
//% "General"
text: qsTrId("settings_general")
//% "Access control, Display, Language"
//% "Access control, Display, Language, Support"
secondaryText: qsTrId("settings_access_control_display_language")
pageSource: "/pages/settings/PageSettingsGeneral.qml"
iconSource: "qrc:/images/icon_general_32.png"
Expand Down
66 changes: 35 additions & 31 deletions pages/settings/PageSettingsGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import QtQuick
import Victron.VenusOS
import QtQuick.Templates as T

Page {
id: root
Expand Down Expand Up @@ -136,44 +135,49 @@ Page {

SettingsListHeader { }

ListButton {
ListRebootButton {
text: CommonWords.reboot
//% "Reboot now"
button.text: qsTrId("settings_reboot_now")
writeAccessLevel: VenusOS.User_AccessType_User
onClicked: Global.dialogLayer.open(confirmRebootDialogComponent)
}

Component {
id: confirmRebootDialogComponent
SettingsListHeader { }

ModalWarningDialog {
//% "Press 'OK' to reboot"
title: qsTrId("press_ok_to_reboot")
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkAndCancel
onClosed: {
if (result === T.Dialog.Accepted) {
Global.venusPlatform.reboot()
Qt.callLater(Global.dialogLayer.open, rebootingDialogComponent)
}
}
ListNavigation {
//% "Useful Links"
text: qsTrId("pagesettingsgeneral_useful_links")
onClicked: Global.pageManager.pushPage("/pages/settings/PageSettingsUsefulLinks.qml", {"title": text})
}

ListNavigation {
//% "Modification checks"
text: qsTrId("pagesettingsgeneral_modification_checks")
secondaryText: getSystemState()
secondaryLabel.color: fsModifiedState === 0 && systemHooksState === 0 && modelItem.value.indexOf("Raspberry") === -1 ? Theme.color_font_primary : Theme.color_red
onClicked: Global.pageManager.pushPage("/pages/settings/PageSettingsModificationChecks.qml", {"title": text})

readonly property int fsModifiedState: fsModifiedStateItem.isValid ? fsModifiedStateItem.value : -1
readonly property int systemHooksState: systemHooksStateItem.isValid ? systemHooksStateItem.value : -1

property bool restoreFirmwareIntegrityPressed: false

function getSystemState() {
if (fsModifiedState === 0 && systemHooksState === 0) {
//% "Unmodified"
return qsTrId("pagesettingsmodificationchecks_unmodified")
} else {
//% "Modified"
return qsTrId("pagesettingsmodificationchecks_modified")
}
}

Component {
id: rebootingDialogComponent

ModalWarningDialog {
title: BackendConnection.type === BackendConnection.DBusSource
//% "Rebooting..."
? qsTrId("dialoglayer_rebooting")
//% "Device has been rebooted."
: qsTrId("dialoglayer_rebooted")

// On device, dialog cannot be dismissed; just wait until device is rebooted.
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkOnly
footer.enabled: BackendConnection.type !== BackendConnection.DBusSource
footer.opacity: footer.enabled ? 1 : 0
}
VeQuickItem {
id: fsModifiedStateItem
uid: Global.venusPlatform.serviceUid + "/ModificationChecks/FsModifiedState"
}
VeQuickItem {
id: systemHooksStateItem
uid: Global.venusPlatform.serviceUid + "/ModificationChecks/SystemHooksState"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions pages/settings/PageSettingsIntegrations.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import Victron.VenusOS
Page {
id: root

readonly property bool allModificationsEnabled: allModificationsEnabledItem.isValid && allModificationsEnabledItem.value === 1

VeQuickItem {
id: allModificationsEnabledItem
uid: Global.systemSettings.serviceUid + "/Settings/System/ModificationChecks/AllModificationsEnabled"
}

GradientListView {
id: settingsListView

Expand Down Expand Up @@ -172,12 +179,19 @@ Page {
preferredVisible: osLargeFeatures.visible
}

PrimaryListLabel {
//% "This features are disabled, since \"All modifications enabled\" under \"Settings -> General -> Modification checks\" is disabled."
text: qsTrId("settings_large_features_currently_disabled")
preferredVisible: !root.allModificationsEnabled
}

ListSwitch {
id: signalk

//% "Signal K"
text: qsTrId("settings_large_signal_k")
dataItem.uid: Global.venusPlatform.serviceUid + "/Services/SignalK/Enabled"
enabled: userHasWriteAccess && root.allModificationsEnabled
preferredVisible: dataItem.isValid
}

Expand Down
Loading
Loading