Require a direct choice for opt-in

This commit is contained in:
Adam Treat 2023-04-29 03:55:06 -04:00
parent e6b919ee49
commit 233505c48f

View File

@ -10,11 +10,12 @@ import llm
Dialog { Dialog {
id: startupDialog id: startupDialog
anchors.centerIn: parent anchors.centerIn: parent
modal: false modal: true
opacity: 0.9 opacity: 0.9
padding: 20 padding: 20
width: 1024 width: 1024
height: column.height + 40 height: column.height + 40
closePolicy: !optInStatisticsRadio.choiceMade || !optInNetworkRadio.choiceMade ? Popup.NoAutoClose : (Popup.CloseOnEscape | Popup.CloseOnPressOutside)
Theme { Theme {
id: theme id: theme
@ -139,22 +140,41 @@ model release that uses your data!")
Accessible.description: qsTr("Label for opt-in") Accessible.description: qsTr("Label for opt-in")
} }
CheckBox { ButtonGroup {
id: optInStatisticsBox buttons: optInStatisticsRadio.children
onClicked: {
Network.usageStatsActive = optInStatisticsRadio.checked
if (optInNetworkRadio.choiceMade && optInStatisticsRadio.choiceMade)
startupDialog.close();
}
}
RowLayout {
id: optInStatisticsRadio
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.row: 0 Layout.row: 0
Layout.column: 1 Layout.column: 1
property bool defaultChecked: Network.usageStatsActive property bool defaultChecked: Network.usageStatsActive
checked: defaultChecked property alias checked: optInStatisticsRadioYes.checked
Accessible.role: Accessible.CheckBox property bool choiceMade: optInStatisticsRadioYes.checked || optInStatisticsRadioNo.checked
Accessible.name: qsTr("Opt-in for anonymous usage statistics")
Accessible.description: qsTr("Checkbox to allow opt-in for anonymous usage statistics") RadioButton {
onClicked: { id: optInStatisticsRadioYes
Network.usageStatsActive = optInStatisticsBox.checked checked: optInStatisticsRadio.defaultChecked
if (optInNetworkBox.checked && optInStatisticsBox.checked) text: qsTr("Yes")
startupDialog.close() Accessible.role: Accessible.RadioButton
Accessible.name: qsTr("Opt-in for anonymous usage statistics")
Accessible.description: qsTr("Radio button to allow opt-in for anonymous usage statistics")
}
RadioButton {
id: optInStatisticsRadioNo
text: qsTr("No")
Accessible.role: Accessible.RadioButton
Accessible.name: qsTr("Opt-out for anonymous usage statistics")
Accessible.description: qsTr("Radio button to allow opt-out for anonymous usage statistics")
} }
} }
Label { Label {
id: optInNetwork id: optInNetwork
text: "Opt-in to anonymous sharing of chats to the GPT4All Datalake" text: "Opt-in to anonymous sharing of chats to the GPT4All Datalake"
@ -166,20 +186,38 @@ model release that uses your data!")
Accessible.description: qsTr("Checkbox to allow opt-in for network") Accessible.description: qsTr("Checkbox to allow opt-in for network")
} }
CheckBox { ButtonGroup {
id: optInNetworkBox buttons: optInNetworkRadio.children
onClicked: {
Network.isActive = optInNetworkRadio.checked
if (optInNetworkRadio.choiceMade && optInStatisticsRadio.choiceMade)
startupDialog.close();
}
}
RowLayout {
id: optInNetworkRadio
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.row: 1 Layout.row: 1
Layout.column: 1 Layout.column: 1
property bool defaultChecked: Network.isActive property bool defaultChecked: Network.isActive
checked: defaultChecked property alias checked: optInNetworkRadioYes.checked
Accessible.role: Accessible.CheckBox property bool choiceMade: optInNetworkRadioYes.checked || optInNetworkRadioNo.checked
Accessible.name: qsTr("Opt-in for network")
Accessible.description: qsTr("Label for opt-in") RadioButton {
onClicked: { id: optInNetworkRadioYes
Network.isActive = optInNetworkBox.checked checked: optInNetworkRadio.defaultChecked
if (optInNetworkBox.checked && optInStatisticsBox.checked) text: qsTr("Yes")
startupDialog.close() Accessible.role: Accessible.RadioButton
Accessible.name: qsTr("Opt-in for network")
Accessible.description: qsTr("Radio button to allow opt-in anonymous sharing of chats to the GPT4All Datalake")
}
RadioButton {
id: optInNetworkRadioNo
text: qsTr("No")
Accessible.role: Accessible.RadioButton
Accessible.name: qsTr("Opt-out for network")
Accessible.description: qsTr("Radio button to allow opt-out anonymous sharing of chats to the GPT4All Datalake")
} }
} }
} }