feat(ui): style app menus and extract glossary dialog
- Add AppMenu and AppMenuItem so menu labels, mnemonics and shortcuts render consistently under org.kde.union - Move the translation glossary into GlossaryDialog with add, remove and clear-all actions - Regroup the translation preset and instructions settings layout
This commit was merged in pull request #3.
This commit is contained in:
1 parent
9e55dba687
commit
de9e6484ee
24 files changed
+533
-166
No files matched your search
+2
-33
@@ -318,39 +318,8 @@ ApplicationWindow {
|
||||
onAccepted: video.addSubtitleFile(selectedFile)
|
||||
}
|
||||
|
||||
Kirigami.Dialog {
|
||||
GlossaryDialog {
|
||||
id: glossaryDialog
|
||||
title: KI18n.i18nc("@title:window", "Translation Glossary")
|
||||
standardButtons: Kirigami.Dialog.Save | Kirigami.Dialog.Cancel
|
||||
width: Math.min(appWindow.width * 0.9, 650)
|
||||
contentItem: ColumnLayout {
|
||||
ListView {
|
||||
id: glossaryList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 15
|
||||
clip: true
|
||||
model: ListModel { id: glossaryModel }
|
||||
delegate: RowLayout {
|
||||
width: glossaryList.width
|
||||
TextField { text: source; Layout.fillWidth: true; onTextChanged: model.source = text }
|
||||
TextField { text: target; Layout.fillWidth: true; onTextChanged: model.target = text }
|
||||
ToolButton { icon.name: "edit-delete-remove"; onClicked: glossaryModel.remove(index) }
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Button { text: KI18n.i18nc("@action:button", "Add"); onClicked: glossaryModel.append({source: "", target: ""}) }
|
||||
Button { text: KI18n.i18nc("@action:button", "Clear"); onClicked: glossaryModel.clear() }
|
||||
}
|
||||
}
|
||||
onOpened: {
|
||||
glossaryModel.clear()
|
||||
for (const entry of translationService.glossaryEntries) glossaryModel.append(entry)
|
||||
}
|
||||
onAccepted: {
|
||||
const entries = []
|
||||
for (let i = 0; i < glossaryModel.count; ++i) entries.push(glossaryModel.get(i))
|
||||
translationService.saveGlossary(entries)
|
||||
}
|
||||
translator: translationService
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user