mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-10-10 15:27:53 -06:00
Replace separate machine/profile menus in menubar with a single "Settings" menu
Contributes to CURA-342
This commit is contained in:
parent
1a56da464c
commit
0270aecdc3
2 changed files with 37 additions and 184 deletions
|
@ -92,7 +92,7 @@ Item
|
||||||
Action
|
Action
|
||||||
{
|
{
|
||||||
id: preferencesAction;
|
id: preferencesAction;
|
||||||
text: catalog.i18nc("@action:inmenu menubar:settings","&Preferences...");
|
text: catalog.i18nc("@action:inmenu","Configure Cura...");
|
||||||
iconName: "configure";
|
iconName: "configure";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,5 +282,6 @@ Item
|
||||||
{
|
{
|
||||||
id: configureSettingVisibilityAction
|
id: configureSettingVisibilityAction
|
||||||
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
|
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
|
||||||
|
iconName: "configure"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,41 +52,13 @@ UM.MainWindow
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
id: fileMenu
|
id: fileMenu
|
||||||
//: File menu
|
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel","&File");
|
title: catalog.i18nc("@title:menu menubar:toplevel","&File");
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
action: Cura.Actions.open;
|
action: Cura.Actions.open;
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu
|
RecentFilesMenu { }
|
||||||
{
|
|
||||||
id: recentFilesMenu;
|
|
||||||
title: catalog.i18nc("@title:menu menubar:file", "Open &Recent")
|
|
||||||
iconName: "document-open-recent";
|
|
||||||
|
|
||||||
enabled: Printer.recentFiles.length > 0;
|
|
||||||
|
|
||||||
Instantiator
|
|
||||||
{
|
|
||||||
model: Printer.recentFiles
|
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text:
|
|
||||||
{
|
|
||||||
var path = modelData.toString()
|
|
||||||
return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1);
|
|
||||||
}
|
|
||||||
onTriggered: {
|
|
||||||
UM.MeshFileHandler.readLocalFile(modelData);
|
|
||||||
var meshName = backgroundItem.getMeshName(modelData.toString())
|
|
||||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onObjectAdded: recentFilesMenu.insertItem(index, object)
|
|
||||||
onObjectRemoved: recentFilesMenu.removeItem(object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
|
@ -127,7 +99,6 @@ UM.MainWindow
|
||||||
|
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
//: Edit menu
|
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Edit");
|
title: catalog.i18nc("@title:menu menubar:toplevel","&Edit");
|
||||||
|
|
||||||
MenuItem { action: Cura.Actions.undo; }
|
MenuItem { action: Cura.Actions.undo; }
|
||||||
|
@ -143,173 +114,45 @@ UM.MainWindow
|
||||||
MenuItem { action: Cura.Actions.unGroupObjects;}
|
MenuItem { action: Cura.Actions.unGroupObjects;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewMenu { title: catalog.i18nc("@title:menu", "&View") }
|
||||||
|
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel","&View");
|
id: settingsMenu
|
||||||
id: top_view_menu
|
title: catalog.i18nc("@title:menu", "&Settings")
|
||||||
Instantiator
|
|
||||||
{
|
PrinterMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Printer") }
|
||||||
model: UM.ViewModel { }
|
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text: model.name;
|
|
||||||
checkable: true;
|
|
||||||
checked: model.active;
|
|
||||||
exclusiveGroup: view_menu_top_group;
|
|
||||||
onTriggered: UM.Controller.setActiveView(model.id);
|
|
||||||
}
|
|
||||||
onObjectAdded: top_view_menu.insertItem(index, object)
|
|
||||||
onObjectRemoved: top_view_menu.removeItem(object)
|
|
||||||
}
|
|
||||||
ExclusiveGroup { id: view_menu_top_group; }
|
|
||||||
}
|
|
||||||
Menu
|
|
||||||
{
|
|
||||||
id: machineMenu;
|
|
||||||
//: Machine menu
|
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Printer");
|
|
||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
model: UM.ContainerStacksModel
|
model: Cura.ExtrudersModel { }
|
||||||
{
|
Menu {
|
||||||
filter: {"type": "machine"}
|
title: model.name
|
||||||
}
|
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text: model.name;
|
|
||||||
checkable: true;
|
|
||||||
checked: Cura.MachineManager.activeMachineId == model.id
|
|
||||||
exclusiveGroup: machineMenuGroup;
|
|
||||||
onTriggered: Cura.MachineManager.setActiveMachine(model.id);
|
|
||||||
}
|
|
||||||
onObjectAdded: machineMenu.insertItem(index, object)
|
|
||||||
onObjectRemoved: machineMenu.removeItem(object)
|
|
||||||
}
|
|
||||||
|
|
||||||
ExclusiveGroup { id: machineMenuGroup; }
|
NozzleMenu { title: catalog.i18nc("@title:menu", "&Nozzle"); visible: Cura.MachineManager.hasVariants }
|
||||||
|
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials }
|
||||||
|
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); }
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
Instantiator
|
MenuItem { text: "Set as Active Extruder" }
|
||||||
{
|
|
||||||
model: UM.InstanceContainersModel
|
|
||||||
{
|
|
||||||
filter:
|
|
||||||
{
|
|
||||||
"type": "variant",
|
|
||||||
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
|
|
||||||
}
|
}
|
||||||
}
|
onObjectAdded: settingsMenu.insertItem(index, object)
|
||||||
MenuItem {
|
onObjectRemoved: settingsMenu.removeItem(object)
|
||||||
text: model.name;
|
|
||||||
checkable: true;
|
|
||||||
checked: model.id == Cura.MachineManager.activeVariantId;
|
|
||||||
exclusiveGroup: machineVariantsGroup;
|
|
||||||
onTriggered: Cura.MachineManager.setActiveVariant(model.id)
|
|
||||||
}
|
|
||||||
onObjectAdded: machineMenu.insertItem(index, object)
|
|
||||||
onObjectRemoved: machineMenu.removeItem(object)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExclusiveGroup { id: machineVariantsGroup; }
|
NozzleMenu { title: catalog.i18nc("@title:menu", "&Nozzle"); visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasVariants }
|
||||||
|
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasMaterials }
|
||||||
|
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); visible: machineExtruderCount.properties.value <= 1 }
|
||||||
|
|
||||||
MenuSeparator { visible: Cura.MachineManager.hasVariants; }
|
|
||||||
|
|
||||||
MenuItem { action: Cura.Actions.addMachine; }
|
|
||||||
MenuItem { action: Cura.Actions.configureMachines; }
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu
|
|
||||||
{
|
|
||||||
id: profileMenu
|
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel", "P&rofile")
|
|
||||||
|
|
||||||
Instantiator
|
|
||||||
{
|
|
||||||
id: profileMenuInstantiator
|
|
||||||
model: UM.InstanceContainersModel
|
|
||||||
{
|
|
||||||
filter:
|
|
||||||
{
|
|
||||||
var result = { "type": "quality" };
|
|
||||||
if(Cura.MachineManager.filterQualityByMachine)
|
|
||||||
{
|
|
||||||
result.definition = Cura.MachineManager.activeDefinitionId;
|
|
||||||
if(Cura.MachineManager.hasMaterials)
|
|
||||||
{
|
|
||||||
result.material = Cura.MachineManager.activeMaterialId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result.definition = "fdmprinter"
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
property int separatorIndex: -1
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
property QtObject model_data: model
|
|
||||||
property int model_index: index
|
|
||||||
sourceComponent: profileMenuItemDelegate
|
|
||||||
}
|
|
||||||
|
|
||||||
onObjectAdded:
|
|
||||||
{
|
|
||||||
//Insert a separator between readonly and custom profiles
|
|
||||||
if(separatorIndex < 0 && index > 0) {
|
|
||||||
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
|
|
||||||
profileMenu.insertSeparator(index);
|
|
||||||
separatorIndex = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Because of the separator, custom profiles move one index lower
|
|
||||||
profileMenu.insertItem((model.getItem(index).readOnly) ? index : index + 1, object.item);
|
|
||||||
}
|
|
||||||
onObjectRemoved:
|
|
||||||
{
|
|
||||||
//When adding a profile, the menu is rebuild by removing all items.
|
|
||||||
//If a separator was added, we need to remove that too.
|
|
||||||
if(separatorIndex >= 0)
|
|
||||||
{
|
|
||||||
profileMenu.removeItem(profileMenu.items[separatorIndex])
|
|
||||||
separatorIndex = -1;
|
|
||||||
}
|
|
||||||
profileMenu.removeItem(object.item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ExclusiveGroup { id: profileMenuGroup; }
|
|
||||||
|
|
||||||
Component
|
|
||||||
{
|
|
||||||
id: profileMenuItemDelegate
|
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
id: item
|
|
||||||
text: model_data ? model_data.name : ""
|
|
||||||
checkable: true
|
|
||||||
checked: Cura.MachineManager.activeQualityId == model_data.id
|
|
||||||
exclusiveGroup: profileMenuGroup
|
|
||||||
onTriggered: Cura.MachineManager.setActiveQuality(model_data.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuSeparator { id: profileMenuSeparator }
|
|
||||||
|
|
||||||
MenuItem { action: Cura.Actions.addProfile }
|
|
||||||
MenuItem { action: Cura.Actions.updateProfile }
|
|
||||||
MenuItem { action: Cura.Actions.resetProfile }
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
MenuItem { action: Cura.Actions.manageProfiles }
|
|
||||||
|
MenuItem { action: Cura.Actions.configureSettingVisibility }
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
id: extension_menu
|
id: extension_menu
|
||||||
//: Extensions menu
|
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions");
|
title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions");
|
||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
|
@ -343,8 +186,7 @@ UM.MainWindow
|
||||||
|
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
//: Settings menu
|
title: catalog.i18nc("@title:menu menubar:toplevel","P&references");
|
||||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Settings");
|
|
||||||
|
|
||||||
MenuItem { action: Cura.Actions.preferences; }
|
MenuItem { action: Cura.Actions.preferences; }
|
||||||
}
|
}
|
||||||
|
@ -362,6 +204,16 @@ UM.MainWindow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: machineExtruderCount
|
||||||
|
|
||||||
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
|
key: "machine_extruder_count"
|
||||||
|
watchedProperties: [ "value" ]
|
||||||
|
storeIndex: 0
|
||||||
|
}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: contentItem;
|
id: contentItem;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue