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
}
Item
{
id: mainView
@ -75,6 +76,7 @@ Window
visible: toolbox.viewCategory == "installed"
}
}
ToolboxFooter
{
id: footer

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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; }

View file

@ -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)
}

View file

@ -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