From a809575bc85dd808ad20910442192b0059d0f198 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 11 Sep 2018 16:05:53 +0200 Subject: [PATCH] Add bunch of ID's to qml components so it's easier to test them. CURA-5618 --- plugins/Toolbox/resources/qml/Toolbox.qml | 2 ++ .../qml/ToolboxDownloadsGridTile.qml | 1 + .../Toolbox/resources/qml/ToolboxHeader.qml | 4 ++++ resources/qml/AddMachineDialog.qml | 2 ++ resources/qml/Cura.qml | 12 +++++++++-- resources/qml/Preferences/GeneralPage.qml | 20 +++++++++---------- resources/qml/Settings/SettingCategory.qml | 3 +++ 7 files changed, 31 insertions(+), 13 deletions(-) diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index 2a56898503..4fb8192d81 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -33,6 +33,7 @@ Window { id: header } + Item { id: mainView @@ -75,6 +76,7 @@ Window visible: toolbox.viewCategory == "installed" } } + ToolboxFooter { id: footer diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index 4366db041c..887140bbfa 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -9,6 +9,7 @@ import UM 1.1 as UM Item { + id: toolboxDownloadsGridTile property int packageCount: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getTotalNumberOfMaterialPackagesByAuthor(model.id) : 1 property int installedPackages: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0) height: childrenRect.height diff --git a/plugins/Toolbox/resources/qml/ToolboxHeader.qml b/plugins/Toolbox/resources/qml/ToolboxHeader.qml index 9c9f967d54..ca6197d6c3 100644 --- a/plugins/Toolbox/resources/qml/ToolboxHeader.qml +++ b/plugins/Toolbox/resources/qml/ToolboxHeader.qml @@ -21,8 +21,10 @@ Item left: parent.left leftMargin: UM.Theme.getSize("default_margin").width } + ToolboxTabButton { + id: pluginsTabButton text: catalog.i18nc("@title:tab", "Plugins") active: toolbox.viewCategory == "plugin" && enabled enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" @@ -36,6 +38,7 @@ Item ToolboxTabButton { + id: materialsTabButton text: catalog.i18nc("@title:tab", "Materials") active: toolbox.viewCategory == "material" && enabled enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" @@ -49,6 +52,7 @@ Item } ToolboxTabButton { + id: installedTabButton text: catalog.i18nc("@title:tab", "Installed") active: toolbox.viewCategory == "installed" anchors diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/AddMachineDialog.qml index a635f1f8d1..2b49ce9c31 100644 --- a/resources/qml/AddMachineDialog.qml +++ b/resources/qml/AddMachineDialog.qml @@ -79,6 +79,7 @@ UM.Dialog section.property: "section" section.delegate: Button { + id: machineSectionButton text: section width: machineList.width style: ButtonStyle @@ -214,6 +215,7 @@ UM.Dialog Button { + id: addPrinterButton text: catalog.i18nc("@action:button", "Add Printer") anchors.bottom: parent.bottom anchors.right: parent.right diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index b9febdeb32..07154a0729 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -104,11 +104,13 @@ UM.MainWindow title: catalog.i18nc("@title:menu menubar:toplevel","&File"); MenuItem { + id: newProjectMenu action: Cura.Actions.newProject; } MenuItem { + id: openMenu action: Cura.Actions.open; } @@ -148,6 +150,7 @@ UM.MainWindow MenuItem { + id: exportSelectionMenu text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection..."); enabled: UM.Selection.hasSelection; iconName: "document-save-as"; @@ -156,7 +159,11 @@ UM.MainWindow MenuSeparator { } - MenuItem { action: Cura.Actions.reloadAll; } + MenuItem + { + id: reloadAllMenu + action: Cura.Actions.reloadAll; + } MenuSeparator { } @@ -284,6 +291,7 @@ UM.MainWindow Menu { + id: preferencesMenu title: catalog.i18nc("@title:menu menubar:toplevel","P&references"); MenuItem { action: Cura.Actions.preferences; } @@ -291,7 +299,7 @@ UM.MainWindow Menu { - //: Help menu + id: helpMenu title: catalog.i18nc("@title:menu menubar:toplevel","&Help"); MenuItem { action: Cura.Actions.showProfileFolder; } diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 5f60b23477..bba2cf764a 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -13,6 +13,7 @@ UM.PreferencesPage { //: General configuration page title title: catalog.i18nc("@title:tab","General") + id: generalPreferencesPage function setDefaultLanguage(languageCode) { @@ -283,9 +284,6 @@ UM.PreferencesPage } } - - - Label { id: languageCaption @@ -308,7 +306,7 @@ UM.PreferencesPage width: childrenRect.width; height: childrenRect.height; - text: catalog.i18nc("@info:tooltip","Slice automatically when changing settings.") + text: catalog.i18nc("@info:tooltip", "Slice automatically when changing settings.") CheckBox { @@ -316,7 +314,7 @@ UM.PreferencesPage checked: boolCheck(UM.Preferences.getValue("general/auto_slice")) onClicked: UM.Preferences.setValue("general/auto_slice", checked) - text: catalog.i18nc("@option:check","Slice automatically"); + text: catalog.i18nc("@option:check", "Slice automatically"); } } @@ -330,7 +328,7 @@ UM.PreferencesPage Label { font.bold: true - text: catalog.i18nc("@label","Viewport behavior") + text: catalog.i18nc("@label", "Viewport behavior") } UM.TooltipArea @@ -338,7 +336,7 @@ UM.PreferencesPage width: childrenRect.width; height: childrenRect.height; - text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.") + text: catalog.i18nc("@info:tooltip", "Highlight unsupported areas of the model in red. Without support these areas will not print properly.") CheckBox { @@ -347,14 +345,14 @@ UM.PreferencesPage checked: boolCheck(UM.Preferences.getValue("view/show_overhang")) onClicked: UM.Preferences.setValue("view/show_overhang", checked) - text: catalog.i18nc("@option:check","Display overhang"); + text: catalog.i18nc("@option:check", "Display overhang"); } } UM.TooltipArea { width: childrenRect.width; height: childrenRect.height; - text: catalog.i18nc("@info:tooltip","Moves the camera so the model is in the center of the view when a model is selected") + text: catalog.i18nc("@info:tooltip", "Moves the camera so the model is in the center of the view when a model is selected") CheckBox { @@ -368,12 +366,12 @@ UM.PreferencesPage UM.TooltipArea { width: childrenRect.width; height: childrenRect.height; - text: catalog.i18nc("@info:tooltip","Should the default zoom behavior of cura be inverted?") + text: catalog.i18nc("@info:tooltip", "Should the default zoom behavior of cura be inverted?") CheckBox { id: invertZoomCheckbox - text: catalog.i18nc("@action:button","Invert the direction of camera zoom."); + text: catalog.i18nc("@action:button", "Invert the direction of camera zoom."); checked: boolCheck(UM.Preferences.getValue("view/invert_zoom")) onClicked: UM.Preferences.setValue("view/invert_zoom", checked) } diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 419285d893..842b3fd185 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -16,6 +16,7 @@ Button anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width background: Rectangle { + id: backgroundRectangle implicitHeight: UM.Theme.getSize("section").height color: { if (base.color) { @@ -35,6 +36,7 @@ Button Behavior on color { ColorAnimation { duration: 50; } } Rectangle { + id: backgroundLiningRectangle height: UM.Theme.getSize("default_lining").height width: parent.width anchors.bottom: parent.bottom @@ -68,6 +70,7 @@ Button anchors.left: parent.left Label { + id: settingNameLabel anchors { left: parent.left