Add bunch of ID's to qml components so it's easier to test them.

CURA-5618
This commit is contained in:
Jaime van Kessel 2018-09-11 16:05:53 +02:00
parent f628b63c29
commit a809575bc8
7 changed files with 31 additions and 13 deletions

View file

@ -33,6 +33,7 @@ Window
{ {
id: header id: header
} }
Item Item
{ {
id: mainView id: mainView
@ -75,6 +76,7 @@ Window
visible: toolbox.viewCategory == "installed" visible: toolbox.viewCategory == "installed"
} }
} }
ToolboxFooter ToolboxFooter
{ {
id: footer id: footer

View file

@ -9,6 +9,7 @@ import UM 1.1 as UM
Item Item
{ {
id: toolboxDownloadsGridTile
property int packageCount: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getTotalNumberOfMaterialPackagesByAuthor(model.id) : 1 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) property int installedPackages: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0)
height: childrenRect.height height: childrenRect.height

View file

@ -21,8 +21,10 @@ Item
left: parent.left left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width leftMargin: UM.Theme.getSize("default_margin").width
} }
ToolboxTabButton ToolboxTabButton
{ {
id: pluginsTabButton
text: catalog.i18nc("@title:tab", "Plugins") text: catalog.i18nc("@title:tab", "Plugins")
active: toolbox.viewCategory == "plugin" && enabled active: toolbox.viewCategory == "plugin" && enabled
enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
@ -36,6 +38,7 @@ Item
ToolboxTabButton ToolboxTabButton
{ {
id: materialsTabButton
text: catalog.i18nc("@title:tab", "Materials") text: catalog.i18nc("@title:tab", "Materials")
active: toolbox.viewCategory == "material" && enabled active: toolbox.viewCategory == "material" && enabled
enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
@ -49,6 +52,7 @@ Item
} }
ToolboxTabButton ToolboxTabButton
{ {
id: installedTabButton
text: catalog.i18nc("@title:tab", "Installed") text: catalog.i18nc("@title:tab", "Installed")
active: toolbox.viewCategory == "installed" active: toolbox.viewCategory == "installed"
anchors anchors

View file

@ -79,6 +79,7 @@ UM.Dialog
section.property: "section" section.property: "section"
section.delegate: Button section.delegate: Button
{ {
id: machineSectionButton
text: section text: section
width: machineList.width width: machineList.width
style: ButtonStyle style: ButtonStyle
@ -214,6 +215,7 @@ UM.Dialog
Button Button
{ {
id: addPrinterButton
text: catalog.i18nc("@action:button", "Add Printer") text: catalog.i18nc("@action:button", "Add Printer")
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right

View file

@ -104,11 +104,13 @@ UM.MainWindow
title: catalog.i18nc("@title:menu menubar:toplevel","&File"); title: catalog.i18nc("@title:menu menubar:toplevel","&File");
MenuItem MenuItem
{ {
id: newProjectMenu
action: Cura.Actions.newProject; action: Cura.Actions.newProject;
} }
MenuItem MenuItem
{ {
id: openMenu
action: Cura.Actions.open; action: Cura.Actions.open;
} }
@ -148,6 +150,7 @@ UM.MainWindow
MenuItem MenuItem
{ {
id: exportSelectionMenu
text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection..."); text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...");
enabled: UM.Selection.hasSelection; enabled: UM.Selection.hasSelection;
iconName: "document-save-as"; iconName: "document-save-as";
@ -156,7 +159,11 @@ UM.MainWindow
MenuSeparator { } MenuSeparator { }
MenuItem { action: Cura.Actions.reloadAll; } MenuItem
{
id: reloadAllMenu
action: Cura.Actions.reloadAll;
}
MenuSeparator { } MenuSeparator { }
@ -284,6 +291,7 @@ UM.MainWindow
Menu Menu
{ {
id: preferencesMenu
title: catalog.i18nc("@title:menu menubar:toplevel","P&references"); title: catalog.i18nc("@title:menu menubar:toplevel","P&references");
MenuItem { action: Cura.Actions.preferences; } MenuItem { action: Cura.Actions.preferences; }
@ -291,7 +299,7 @@ UM.MainWindow
Menu Menu
{ {
//: Help menu id: helpMenu
title: catalog.i18nc("@title:menu menubar:toplevel","&Help"); title: catalog.i18nc("@title:menu menubar:toplevel","&Help");
MenuItem { action: Cura.Actions.showProfileFolder; } MenuItem { action: Cura.Actions.showProfileFolder; }

View file

@ -13,6 +13,7 @@ UM.PreferencesPage
{ {
//: General configuration page title //: General configuration page title
title: catalog.i18nc("@title:tab","General") title: catalog.i18nc("@title:tab","General")
id: generalPreferencesPage
function setDefaultLanguage(languageCode) function setDefaultLanguage(languageCode)
{ {
@ -283,9 +284,6 @@ UM.PreferencesPage
} }
} }
Label Label
{ {
id: languageCaption id: languageCaption
@ -308,7 +306,7 @@ UM.PreferencesPage
width: childrenRect.width; width: childrenRect.width;
height: childrenRect.height; height: childrenRect.height;
text: catalog.i18nc("@info:tooltip","Slice automatically when changing settings.") text: catalog.i18nc("@info:tooltip", "Slice automatically when changing settings.")
CheckBox CheckBox
{ {
@ -316,7 +314,7 @@ UM.PreferencesPage
checked: boolCheck(UM.Preferences.getValue("general/auto_slice")) checked: boolCheck(UM.Preferences.getValue("general/auto_slice"))
onClicked: UM.Preferences.setValue("general/auto_slice", checked) 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 Label
{ {
font.bold: true font.bold: true
text: catalog.i18nc("@label","Viewport behavior") text: catalog.i18nc("@label", "Viewport behavior")
} }
UM.TooltipArea UM.TooltipArea
@ -338,7 +336,7 @@ UM.PreferencesPage
width: childrenRect.width; width: childrenRect.width;
height: childrenRect.height; 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 CheckBox
{ {
@ -347,14 +345,14 @@ UM.PreferencesPage
checked: boolCheck(UM.Preferences.getValue("view/show_overhang")) checked: boolCheck(UM.Preferences.getValue("view/show_overhang"))
onClicked: UM.Preferences.setValue("view/show_overhang", checked) onClicked: UM.Preferences.setValue("view/show_overhang", checked)
text: catalog.i18nc("@option:check","Display overhang"); text: catalog.i18nc("@option:check", "Display overhang");
} }
} }
UM.TooltipArea { UM.TooltipArea {
width: childrenRect.width; width: childrenRect.width;
height: childrenRect.height; 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 CheckBox
{ {
@ -368,12 +366,12 @@ UM.PreferencesPage
UM.TooltipArea { UM.TooltipArea {
width: childrenRect.width; width: childrenRect.width;
height: childrenRect.height; 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 CheckBox
{ {
id: invertZoomCheckbox 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")) checked: boolCheck(UM.Preferences.getValue("view/invert_zoom"))
onClicked: UM.Preferences.setValue("view/invert_zoom", checked) onClicked: UM.Preferences.setValue("view/invert_zoom", checked)
} }

View file

@ -16,6 +16,7 @@ Button
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
background: Rectangle background: Rectangle
{ {
id: backgroundRectangle
implicitHeight: UM.Theme.getSize("section").height implicitHeight: UM.Theme.getSize("section").height
color: { color: {
if (base.color) { if (base.color) {
@ -35,6 +36,7 @@ Button
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
Rectangle Rectangle
{ {
id: backgroundLiningRectangle
height: UM.Theme.getSize("default_lining").height height: UM.Theme.getSize("default_lining").height
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -68,6 +70,7 @@ Button
anchors.left: parent.left anchors.left: parent.left
Label { Label {
id: settingNameLabel
anchors anchors
{ {
left: parent.left left: parent.left