Add "Update Current Profile" and "Reset Current Profile" menu items to profile dropdowns

CURA-970
This commit is contained in:
fieldOfView 2016-04-28 10:29:51 +02:00
parent d7aa8e71bf
commit f6ce963b73
4 changed files with 42 additions and 6 deletions

View File

@ -32,6 +32,8 @@ Item
property alias addMachine: addMachineAction; property alias addMachine: addMachineAction;
property alias configureMachines: settingsAction; property alias configureMachines: settingsAction;
property alias addProfile: addProfileAction; property alias addProfile: addProfileAction;
property alias updateProfile: updateProfileAction;
property alias resetProfile: resetProfileAction;
property alias manageProfiles: manageProfilesAction; property alias manageProfiles: manageProfilesAction;
property alias preferences: preferencesAction; property alias preferences: preferencesAction;
@ -96,11 +98,25 @@ Item
iconName: "configure"; iconName: "configure";
} }
Action
{
id: updateProfileAction;
enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Update Current Profile");
}
Action
{
id: resetProfileAction;
enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Reset Current Profile");
}
Action Action
{ {
id: addProfileAction; id: addProfileAction;
enabled: UM.ActiveProfile.valid enabled: UM.ActiveProfile.valid
text: catalog.i18nc("@action:inmenu menubar:profile","&Add Profile..."); text: catalog.i18nc("@action:inmenu menubar:profile","&Create New Profile...");
} }
Action Action

View File

@ -229,7 +229,7 @@ UM.MainWindow
//Insert a separator between readonly and custom profiles //Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) { if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) { if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
profileMenu.addSeparator(); profileMenu.insertSeparator(index);
separatorIndex = index; separatorIndex = index;
} }
} }
@ -277,7 +277,10 @@ UM.MainWindow
MenuSeparator { id: profileMenuSeparator } MenuSeparator { id: profileMenuSeparator }
MenuItem { action: actions.updateProfile; }
MenuItem { action: actions.resetProfile; }
MenuItem { action: actions.addProfile; } MenuItem { action: actions.addProfile; }
MenuSeparator { }
MenuItem { action: actions.manageProfiles; } MenuItem { action: actions.manageProfiles; }
} }
@ -513,6 +516,8 @@ UM.MainWindow
addMachineAction: actions.addMachine; addMachineAction: actions.addMachine;
configureMachinesAction: actions.configureMachines; configureMachinesAction: actions.configureMachines;
addProfileAction: actions.addProfile; addProfileAction: actions.addProfile;
updateProfileAction: actions.updateProfile;
resetProfileAction: actions.resetProfile;
manageProfilesAction: actions.manageProfiles; manageProfilesAction: actions.manageProfiles;
configureSettingsAction: Action configureSettingsAction: Action
@ -623,6 +628,8 @@ UM.MainWindow
addMachine.onTriggered: addMachineWizard.visible = true; addMachine.onTriggered: addMachineWizard.visible = true;
addProfile.onTriggered: { UM.MachineManager.createProfile(); preferences.visible = true; preferences.setPage(4); } addProfile.onTriggered: { UM.MachineManager.createProfile(); preferences.visible = true; preferences.setPage(4); }
updateProfile.onTriggered: { UM.ActiveProfile.updateProfile() }
resetProfile.onTriggered: { UM.ActiveProfile.discardChanges() }
preferences.onTriggered: { preferences.visible = true; } preferences.onTriggered: { preferences.visible = true; }
configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(3); } configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(3); }

View File

@ -14,6 +14,8 @@ Item{
property int totalHeightProfileSetup: childrenRect.height property int totalHeightProfileSetup: childrenRect.height
property Action manageProfilesAction property Action manageProfilesAction
property Action addProfileAction property Action addProfileAction
property Action updateProfileAction
property Action resetProfileAction
signal showTooltip(Item item, point location, string text) signal showTooltip(Item item, point location, string text)
signal hideTooltip() signal hideTooltip()
@ -67,7 +69,7 @@ Item{
//Insert a separator between readonly and custom profiles //Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) { if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) { if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
profileSelectionMenu.addSeparator(); profileSelectionMenu.insertSeparator(index);
separatorIndex = index; separatorIndex = index;
} }
} }
@ -113,9 +115,16 @@ Item{
} }
MenuSeparator { } MenuSeparator { }
MenuItem {
action: base.updateProfileAction;
}
MenuItem {
action: base.resetProfileAction;
}
MenuItem { MenuItem {
action: base.addProfileAction; action: base.addProfileAction;
} }
MenuSeparator { }
MenuItem { MenuItem {
action: base.manageProfilesAction; action: base.manageProfilesAction;
} }

View File

@ -15,6 +15,8 @@ Rectangle
property Action addMachineAction; property Action addMachineAction;
property Action configureMachinesAction; property Action configureMachinesAction;
property Action addProfileAction; property Action addProfileAction;
property Action updateProfileAction;
property Action resetProfileAction;
property Action manageProfilesAction; property Action manageProfilesAction;
property Action configureSettingsAction; property Action configureSettingsAction;
property int currentModeIndex; property int currentModeIndex;
@ -66,6 +68,8 @@ Rectangle
ProfileSetup { ProfileSetup {
id: profileItem id: profileItem
addProfileAction: base.addProfileAction addProfileAction: base.addProfileAction
updateProfileAction: base.updateProfileAction
resetProfileAction: base.resetProfileAction
manageProfilesAction: base.manageProfilesAction manageProfilesAction: base.manageProfilesAction
anchors.top: settingsModeSelection.bottom anchors.top: settingsModeSelection.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height