dedup qml: move accessible properties to MyButton

This commit is contained in:
Justin Wang 2023-05-23 17:26:49 +02:00 committed by AT
parent d22f9242d7
commit fc76760f7a
6 changed files with 5 additions and 22 deletions

View File

@ -234,12 +234,10 @@ Dialog {
text: "Remove" text: "Remove"
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 20 anchors.rightMargin: 20
Accessible.description: qsTr("Remove button to remove model from filesystem")
onClicked: { onClicked: {
Download.removeModel(modelData.filename); Download.removeModel(modelData.filename);
} }
Accessible.role: Accessible.Button
Accessible.name: qsTr("Remove button")
Accessible.description: qsTr("Remove button to remove model from filesystem")
} }
} }
@ -298,6 +296,7 @@ Dialog {
anchors.topMargin: 15 anchors.topMargin: 15
anchors.rightMargin: 20 anchors.rightMargin: 20
visible: !modelData.isChatGPT && !modelData.installed && !modelData.calcHash visible: !modelData.isChatGPT && !modelData.installed && !modelData.calcHash
Accessible.description: qsTr("Cancel/Download button to stop/start the download")
onClicked: { onClicked: {
if (!downloading) { if (!downloading) {
downloading = true; downloading = true;
@ -307,9 +306,6 @@ Dialog {
Download.cancelDownload(modelData.filename); Download.cancelDownload(modelData.filename);
} }
} }
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Cancel/Download button to stop/start the download")
} }
} }
@ -420,8 +416,6 @@ Dialog {
} }
MyButton { MyButton {
text: qsTr("Browse") text: qsTr("Browse")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Opens a folder picker dialog to choose where to save model files") Accessible.description: qsTr("Opens a folder picker dialog to choose where to save model files")
onClicked: modelPathDialog.open() onClicked: modelPathDialog.open()
} }

View File

@ -20,4 +20,6 @@ Button {
radius: 10 radius: 10
color: theme.backgroundLight color: theme.backgroundLight
} }
Accessible.role: Accessible.Button
Accessible.name: text
} }

View File

@ -119,15 +119,11 @@ NOTE: By turning on this feature, you will be sending your data to the GPT4All O
spacing: 10 spacing: 10
MyButton { MyButton {
text: qsTr("Enable") text: qsTr("Enable")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Enable opt-in button") Accessible.description: qsTr("Enable opt-in button")
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
} }
MyButton { MyButton {
text: qsTr("Cancel") text: qsTr("Cancel")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Cancel opt-in button") Accessible.description: qsTr("Cancel opt-in button")
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
} }

View File

@ -50,6 +50,7 @@ Dialog {
anchors.verticalCenter: label.verticalCenter anchors.verticalCenter: label.verticalCenter
padding: 20 padding: 20
text: qsTr("Update") text: qsTr("Update")
Accessible.description: qsTr("Update to new version")
onClicked: { onClicked: {
if (!LLM.checkForUpdates()) if (!LLM.checkForUpdates())
checkForUpdatesError.open() checkForUpdatesError.open()

View File

@ -530,8 +530,6 @@ Dialog {
Layout.column: 1 Layout.column: 1
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Restore Defaults") text: qsTr("Restore Defaults")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Restores the settings dialog to a default state") Accessible.description: qsTr("Restores the settings dialog to a default state")
onClicked: { onClicked: {
settingsDialog.restoreGenerationDefaults() settingsDialog.restoreGenerationDefaults()
@ -646,8 +644,6 @@ Dialog {
Layout.row: 2 Layout.row: 2
Layout.column: 2 Layout.column: 2
text: qsTr("Browse") text: qsTr("Browse")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Opens a folder picker dialog to choose where to save model files") Accessible.description: qsTr("Opens a folder picker dialog to choose where to save model files")
onClicked: modelPathDialog.open() onClicked: modelPathDialog.open()
} }
@ -747,8 +743,6 @@ Dialog {
Layout.column: 1 Layout.column: 1
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Restore Defaults") text: qsTr("Restore Defaults")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Restores the settings dialog to a default state") Accessible.description: qsTr("Restores the settings dialog to a default state")
onClicked: { onClicked: {
settingsDialog.restoreApplicationDefaults() settingsDialog.restoreApplicationDefaults()

View File

@ -79,15 +79,11 @@ Dialog {
spacing: 10 spacing: 10
MyButton { MyButton {
text: qsTr("Submit") text: qsTr("Submit")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Submits the user's response") Accessible.description: qsTr("Submits the user's response")
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
} }
MyButton { MyButton {
text: qsTr("Cancel") text: qsTr("Cancel")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Closes the response dialog") Accessible.description: qsTr("Closes the response dialog")
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
} }