2023-07-21 08:44:10 +00:00
import QtQuick 2.15
import QtQuick . Controls 2.15
import QtQuick . Layouts 1.15
import QtQml 2.15
import QtQml . Models 2.14
import StatusQ . Controls 0.1
2023-09-12 09:26:57 +00:00
import StatusQ . Components 0.1
2023-07-21 08:44:10 +00:00
import StatusQ . Core 0.1
import StatusQ . Popups . Dialog 0.1
import StatusQ . Core . Theme 0.1
import utils 1.0
StatusDialog {
id: root
required property var community
2023-09-12 09:26:57 +00:00
signal importControlNode ( var community )
2023-07-21 08:44:10 +00:00
width: 640
2023-09-12 09:26:57 +00:00
header: StatusDialogHeader {
headline.title: qsTr ( "Make this device the control node for %1" ) . arg ( root . community . name )
actions.closeButton.onClicked: root . close ( )
leftComponent: StatusSmartIdenticon {
asset.name: root . community . image
asset.isImage: ! ! asset . name
}
}
2023-07-21 08:44:10 +00:00
closePolicy: Popup . NoAutoClose
component Paragraph: StatusBaseText {
Layout.fillWidth: true
font.pixelSize: Style . current . primaryTextFontSize
lineHeightMode: Text . FixedHeight
lineHeight: 22
wrapMode: Text . Wrap
verticalAlignment: Text . AlignVCenter
}
2023-09-12 09:26:57 +00:00
contentItem: ColumnLayout {
spacing: Style . current . padding
2023-07-21 08:44:10 +00:00
Paragraph {
2023-09-12 09:26:57 +00:00
text: qsTr ( "Are you sure you want to make this device the control node for %1? This device should be one that you are able to keep online and running Status at all times to enable the Community to function correctly." ) . arg ( root . community . name )
2023-07-21 08:44:10 +00:00
}
2023-09-12 09:26:57 +00:00
StatusDialogDivider {
Layout.fillWidth: true
2023-07-21 08:44:10 +00:00
}
Paragraph {
2023-09-12 09:26:57 +00:00
text: qsTr ( "I acknowledge that..." )
2023-07-21 08:44:10 +00:00
}
2023-09-12 09:26:57 +00:00
StatusCheckBox {
id: agreementCheckBox
2023-07-21 08:44:10 +00:00
Layout.fillWidth: true
2023-09-12 09:26:57 +00:00
font.pixelSize: Style . current . primaryTextFontSize
text: qsTr ( "I must keep this device online and running Status" )
2023-07-21 08:44:10 +00:00
}
2023-09-12 09:26:57 +00:00
StatusCheckBox {
id: agreementCheckBox2
2023-07-21 08:44:10 +00:00
Layout.fillWidth: true
2023-09-12 09:26:57 +00:00
font.pixelSize: Style . current . primaryTextFontSize
text: qsTr ( "My other synced device will cease to be the control node for this Community" )
2023-07-21 08:44:10 +00:00
}
}
footer: StatusDialogFooter {
2023-09-12 09:26:57 +00:00
rightButtons: ObjectModel {
StatusFlatButton {
text: qsTr ( "Cancel" )
onClicked: root . close ( )
}
2023-07-21 08:44:10 +00:00
StatusButton {
text: qsTr ( "Make this device the control node for %1" ) . arg ( root . community . name )
2023-09-12 09:26:57 +00:00
enabled: agreementCheckBox . checked && agreementCheckBox2 . checked
2023-07-21 08:44:10 +00:00
onClicked: {
2023-09-12 09:26:57 +00:00
root . importControlNode ( root . community )
2023-07-21 08:44:10 +00:00
root . close ( )
}
}
}
}
}