From fc76760f7ab0d01264f619c6db64661964cb177f Mon Sep 17 00:00:00 2001 From: Justin Wang Date: Tue, 23 May 2023 17:26:49 +0200 Subject: [PATCH] dedup qml: move accessible properties to MyButton --- gpt4all-chat/qml/ModelDownloaderDialog.qml | 10 ++-------- gpt4all-chat/qml/MyButton.qml | 2 ++ gpt4all-chat/qml/NetworkDialog.qml | 4 ---- gpt4all-chat/qml/NewVersionDialog.qml | 1 + gpt4all-chat/qml/SettingsDialog.qml | 6 ------ gpt4all-chat/qml/ThumbsDownDialog.qml | 4 ---- 6 files changed, 5 insertions(+), 22 deletions(-) diff --git a/gpt4all-chat/qml/ModelDownloaderDialog.qml b/gpt4all-chat/qml/ModelDownloaderDialog.qml index a9ad4363..e9b25eac 100644 --- a/gpt4all-chat/qml/ModelDownloaderDialog.qml +++ b/gpt4all-chat/qml/ModelDownloaderDialog.qml @@ -234,12 +234,10 @@ Dialog { text: "Remove" anchors.right: parent.right anchors.rightMargin: 20 + Accessible.description: qsTr("Remove button to remove model from filesystem") onClicked: { 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.rightMargin: 20 visible: !modelData.isChatGPT && !modelData.installed && !modelData.calcHash + Accessible.description: qsTr("Cancel/Download button to stop/start the download") onClicked: { if (!downloading) { downloading = true; @@ -307,9 +306,6 @@ Dialog { 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 { 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") onClicked: modelPathDialog.open() } diff --git a/gpt4all-chat/qml/MyButton.qml b/gpt4all-chat/qml/MyButton.qml index 0e10a6e0..96d4ce93 100644 --- a/gpt4all-chat/qml/MyButton.qml +++ b/gpt4all-chat/qml/MyButton.qml @@ -20,4 +20,6 @@ Button { radius: 10 color: theme.backgroundLight } + Accessible.role: Accessible.Button + Accessible.name: text } \ No newline at end of file diff --git a/gpt4all-chat/qml/NetworkDialog.qml b/gpt4all-chat/qml/NetworkDialog.qml index 546b16cf..b9da2082 100644 --- a/gpt4all-chat/qml/NetworkDialog.qml +++ b/gpt4all-chat/qml/NetworkDialog.qml @@ -119,15 +119,11 @@ NOTE: By turning on this feature, you will be sending your data to the GPT4All O spacing: 10 MyButton { text: qsTr("Enable") - Accessible.role: Accessible.Button - Accessible.name: text Accessible.description: qsTr("Enable opt-in button") DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole } MyButton { text: qsTr("Cancel") - Accessible.role: Accessible.Button - Accessible.name: text Accessible.description: qsTr("Cancel opt-in button") DialogButtonBox.buttonRole: DialogButtonBox.RejectRole } diff --git a/gpt4all-chat/qml/NewVersionDialog.qml b/gpt4all-chat/qml/NewVersionDialog.qml index baffe559..68175582 100644 --- a/gpt4all-chat/qml/NewVersionDialog.qml +++ b/gpt4all-chat/qml/NewVersionDialog.qml @@ -50,6 +50,7 @@ Dialog { anchors.verticalCenter: label.verticalCenter padding: 20 text: qsTr("Update") + Accessible.description: qsTr("Update to new version") onClicked: { if (!LLM.checkForUpdates()) checkForUpdatesError.open() diff --git a/gpt4all-chat/qml/SettingsDialog.qml b/gpt4all-chat/qml/SettingsDialog.qml index bd538852..40a4e719 100644 --- a/gpt4all-chat/qml/SettingsDialog.qml +++ b/gpt4all-chat/qml/SettingsDialog.qml @@ -530,8 +530,6 @@ Dialog { Layout.column: 1 Layout.fillWidth: true text: qsTr("Restore Defaults") - Accessible.role: Accessible.Button - Accessible.name: text Accessible.description: qsTr("Restores the settings dialog to a default state") onClicked: { settingsDialog.restoreGenerationDefaults() @@ -646,8 +644,6 @@ Dialog { Layout.row: 2 Layout.column: 2 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") onClicked: modelPathDialog.open() } @@ -747,8 +743,6 @@ Dialog { Layout.column: 1 Layout.fillWidth: true text: qsTr("Restore Defaults") - Accessible.role: Accessible.Button - Accessible.name: text Accessible.description: qsTr("Restores the settings dialog to a default state") onClicked: { settingsDialog.restoreApplicationDefaults() diff --git a/gpt4all-chat/qml/ThumbsDownDialog.qml b/gpt4all-chat/qml/ThumbsDownDialog.qml index 090c4969..21c66231 100644 --- a/gpt4all-chat/qml/ThumbsDownDialog.qml +++ b/gpt4all-chat/qml/ThumbsDownDialog.qml @@ -79,15 +79,11 @@ Dialog { spacing: 10 MyButton { text: qsTr("Submit") - Accessible.role: Accessible.Button - Accessible.name: text Accessible.description: qsTr("Submits the user's response") DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole } MyButton { text: qsTr("Cancel") - Accessible.role: Accessible.Button - Accessible.name: text Accessible.description: qsTr("Closes the response dialog") DialogButtonBox.buttonRole: DialogButtonBox.RejectRole }