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

Commonise GeneratorDisableAutoStartDialog to reduce duplication #1825

Merged
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ set (VENUS_QML_MODULE_SOURCES
components/dialogs/GeneratorDialog.qml
components/dialogs/GeneratorStartDialog.qml
components/dialogs/GeneratorStopDialog.qml
components/dialogs/GeneratorDisableAutoStartDialog.qml
components/dialogs/InverterChargerModeDialog.qml
components/dialogs/InverterChargerEssModeDialog.qml
components/dialogs/ModalDialog.qml
Expand Down
14 changes: 2 additions & 12 deletions components/PageGensetModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,8 @@ ObjectModel {
Component {
id: confirmationDialogComponent

ModalWarningDialog {
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkAndCancel

//% "Disable autostart?"
title: qsTrId("ac-in-genset_disableautostartdialog_title")

//% "Autostart will be disabled and the generator won't automatically start based on the configured conditions.\nIf the generator is currently running due to a autostart condition, disabling autostart will also stop it immediately."
description: qsTrId("ac-in-genset_disableautostartdialog_description")

onAccepted: {
autostartSwitch.dataItem.setValue(false)
}
GeneratorDisableAutoStartDialog {
onAccepted: autostartSwitch.dataItem.setValue(false)
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions components/dialogs/GeneratorDisableAutoStartDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
** Copyright (C) 2023 Victron Energy B.V.
** See LICENSE.txt for license information.
*/

import QtQuick
import Victron.VenusOS

ModalWarningDialog {
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkAndCancel

//% "Disable autostart?"
title: qsTrId("ac-in-genset_disableautostartdialog_title")

//% "Autostart will be disabled and the generator won't automatically start based on the configured conditions.\nIf the generator is currently running due to a autostart condition, disabling autostart will also stop it immediately."
description: qsTrId("ac-in-genset_disableautostartdialog_description")
}
14 changes: 2 additions & 12 deletions pages/controlcards/GeneratorCard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,8 @@ ControlCard {
Component {
id: confirmationDialogComponent

ModalWarningDialog {
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkAndCancel

//% "Disable autostart?"
title: qsTrId("controlcard_generator_disableautostartdialog_title")

//% "Autostart will be disabled and the generator won't automatically start based on the configured conditions.\nIf the generator is currently running due to a autostart condition, disabling autostart will also stop it immediately."
description: qsTrId("controlcard_generator_disableautostartdialog_description")

onAccepted: {
root.generator.setAutoStart(false)
}
GeneratorDisableAutoStartDialog {
onAccepted: root.generator.setAutoStart(false)
}
}
}
Expand Down
Loading