mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 13:15:57 +08:00
Move Actions to their own file for more separation
This commit is contained in:
parent
5607cf5afd
commit
f4ea538615
134
Printer.qml
134
Printer.qml
@ -27,23 +27,23 @@ UM.MainWindow {
|
|||||||
//: File menu
|
//: File menu
|
||||||
title: qsTr("&File");
|
title: qsTr("&File");
|
||||||
|
|
||||||
MenuItem { action: openAction; }
|
MenuItem { action: actions.open; }
|
||||||
MenuItem { action: saveAction; }
|
MenuItem { action: actions.save; }
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
MenuItem { action: quitAction; }
|
MenuItem { action: actions.quit; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
//: Edit menu
|
//: Edit menu
|
||||||
title: qsTr("&Edit");
|
title: qsTr("&Edit");
|
||||||
|
|
||||||
MenuItem { action: undoAction; }
|
MenuItem { action: actions.undo; }
|
||||||
MenuItem { action: redoAction; }
|
MenuItem { action: actions.redo; }
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
MenuItem { action: deleteAction; }
|
MenuItem { action: actions.deleteSelection; }
|
||||||
MenuItem { action: deleteAllAction; }
|
MenuItem { action: actions.deleteAll; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
@ -69,8 +69,8 @@ UM.MainWindow {
|
|||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
|
|
||||||
MenuItem { action: addMachineAction; }
|
MenuItem { action: actions.addMachine; }
|
||||||
MenuItem { action: settingsAction; }
|
MenuItem { action: actions.settings; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
@ -85,15 +85,15 @@ UM.MainWindow {
|
|||||||
//: Settings menu
|
//: Settings menu
|
||||||
title: qsTr("&Settings");
|
title: qsTr("&Settings");
|
||||||
|
|
||||||
MenuItem { action: preferencesAction; }
|
MenuItem { action: actions.preferences; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
//: Help menu
|
//: Help menu
|
||||||
title: qsTr("&Help");
|
title: qsTr("&Help");
|
||||||
|
|
||||||
MenuItem { action: helpAction; enabled: false; }
|
MenuItem { action: actions.help; }
|
||||||
MenuItem { action: aboutAction; enabled: false; }
|
MenuItem { action: actions.about; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,9 +126,9 @@ UM.MainWindow {
|
|||||||
top: parent.top;
|
top: parent.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo: undoAction;
|
undo: actions.undo;
|
||||||
redo: redoAction;
|
redo: actions.redo;
|
||||||
settings: settingsAction;
|
settings: actions.settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePane {
|
FilePane {
|
||||||
@ -145,7 +145,7 @@ UM.MainWindow {
|
|||||||
width: UM.Theme.panelWidth;
|
width: UM.Theme.panelWidth;
|
||||||
height: base.height / 2 - UM.Theme.toolbarHeight;
|
height: base.height / 2 - UM.Theme.toolbarHeight;
|
||||||
|
|
||||||
onRequestOpenFile: openAction.trigger();
|
onRequestOpenFile: actions.open.trigger();
|
||||||
onOpenFile: UM.Controller.addMesh(file);
|
onOpenFile: UM.Controller.addMesh(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,105 +198,29 @@ UM.MainWindow {
|
|||||||
|
|
||||||
UM.PreferencesDialog { id: preferences }
|
UM.PreferencesDialog { id: preferences }
|
||||||
|
|
||||||
Action {
|
PrinterActions {
|
||||||
id: undoAction;
|
id: actions;
|
||||||
//: Undo action
|
|
||||||
text: qsTr("Undo");
|
|
||||||
iconName: "edit-undo";
|
|
||||||
shortcut: StandardKey.Undo;
|
|
||||||
onTriggered: UM.OperationStack.undo();
|
|
||||||
enabled: UM.OperationStack.canUndo;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
open.onTriggered: openDialog.open();
|
||||||
id: redoAction;
|
save.onTriggered: saveDialog.open();
|
||||||
//: Redo action
|
|
||||||
text: qsTr("Redo");
|
|
||||||
iconName: "edit-redo";
|
|
||||||
shortcut: StandardKey.Redo;
|
|
||||||
onTriggered: UM.OperationStack.redo();
|
|
||||||
enabled: UM.OperationStack.canRedo;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
quit.onTriggered: base.visible = false;
|
||||||
id: quitAction;
|
|
||||||
//: Quit action
|
|
||||||
text: qsTr("Quit");
|
|
||||||
iconName: "application-exit";
|
|
||||||
shortcut: StandardKey.Quit;
|
|
||||||
onTriggered: base.visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
undo.onTriggered: UM.OperationStack.undo();
|
||||||
id: preferencesAction;
|
undo.enabled: UM.OperationStack.canUndo;
|
||||||
//: Preferences action
|
redo.onTriggered: UM.OperationStack.redo();
|
||||||
text: qsTr("Preferences");
|
redo.enabled: UM.OperationStack.canRedo;
|
||||||
iconName: "configure";
|
|
||||||
onTriggered: preferences.visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
deleteSelection.onTriggered: UM.Controller.removeSelection();
|
||||||
id: settingsAction;
|
|
||||||
//: Manage Printers action
|
|
||||||
text: qsTr("Configure Printers");
|
|
||||||
iconSource: UM.Resources.getIcon("settings.png");
|
|
||||||
onTriggered: preferences.visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
preferences.onTriggered: preferences.visible = true;
|
||||||
id: helpAction;
|
settings.onTriggered: preferences.visible = true;
|
||||||
//: Show Manual action
|
|
||||||
text: qsTr("Show Manual");
|
|
||||||
iconName: "help-contents";
|
|
||||||
shortcut: StandardKey.Help;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
|
||||||
id: aboutAction;
|
|
||||||
//: About action
|
|
||||||
text: qsTr("About...");
|
|
||||||
iconName: "help-about";
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
|
||||||
id: deleteAction;
|
|
||||||
//: Delete selection action
|
|
||||||
text: qsTr("Delete Selection");
|
|
||||||
iconName: "edit-delete";
|
|
||||||
shortcut: StandardKey.Delete;
|
|
||||||
onTriggered: UM.Controller.removeSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
|
||||||
id: deleteAllAction;
|
|
||||||
//: Clear build platform action
|
|
||||||
text: qsTr("Clear Build Platform");
|
|
||||||
iconName: "edit-clear";
|
|
||||||
enabled: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
|
||||||
id: openAction;
|
|
||||||
//: Open file action
|
|
||||||
text: qsTr("Open...");
|
|
||||||
iconName: "document-open";
|
|
||||||
shortcut: StandardKey.Open;
|
|
||||||
onTriggered: openDialog.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
|
||||||
id: saveAction;
|
|
||||||
//: Save file action
|
|
||||||
text: qsTr("Save...");
|
|
||||||
iconName: "document-save";
|
|
||||||
shortcut: StandardKey.Save;
|
|
||||||
onTriggered: saveDialog.open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
id: contextMenu;
|
id: contextMenu;
|
||||||
|
|
||||||
MenuItem { action: deleteAction; }
|
MenuItem { action: actions.deleteSelection; }
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
|
111
PrinterActions.qml
Normal file
111
PrinterActions.qml
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
|
||||||
|
Item {
|
||||||
|
property alias open: openAction;
|
||||||
|
property alias save: saveAction;
|
||||||
|
property alias quit: quitAction;
|
||||||
|
|
||||||
|
property alias undo: undoAction;
|
||||||
|
property alias redo: redoAction;
|
||||||
|
|
||||||
|
property alias deleteSelection: deleteAction;
|
||||||
|
property alias deleteAll: deleteAllAction;
|
||||||
|
|
||||||
|
property alias addMachine: addMachineAction;
|
||||||
|
property alias settings: settingsAction;
|
||||||
|
|
||||||
|
property alias preferences: preferencesAction;
|
||||||
|
property alias help: helpAction;
|
||||||
|
property alias about: aboutAction;
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: undoAction;
|
||||||
|
//: Undo action
|
||||||
|
text: qsTr("Undo");
|
||||||
|
iconName: "edit-undo";
|
||||||
|
shortcut: StandardKey.Undo;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: redoAction;
|
||||||
|
//: Redo action
|
||||||
|
text: qsTr("Redo");
|
||||||
|
iconName: "edit-redo";
|
||||||
|
shortcut: StandardKey.Redo;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: quitAction;
|
||||||
|
//: Quit action
|
||||||
|
text: qsTr("Quit");
|
||||||
|
iconName: "application-exit";
|
||||||
|
shortcut: StandardKey.Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: preferencesAction;
|
||||||
|
//: Preferences action
|
||||||
|
text: qsTr("Preferences");
|
||||||
|
iconName: "configure";
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: addMachineAction;
|
||||||
|
//: Add a Machine action
|
||||||
|
text: qsTr("Add Printer...");
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: settingsAction;
|
||||||
|
//: Manage Printers action
|
||||||
|
text: qsTr("Configure Printers");
|
||||||
|
iconName: "configure";
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: helpAction;
|
||||||
|
//: Show Manual action
|
||||||
|
text: qsTr("Show Manual");
|
||||||
|
iconName: "help-contents";
|
||||||
|
shortcut: StandardKey.Help;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: aboutAction;
|
||||||
|
//: About action
|
||||||
|
text: qsTr("About...");
|
||||||
|
iconName: "help-about";
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: deleteAction;
|
||||||
|
//: Delete selection action
|
||||||
|
text: qsTr("Delete Selection");
|
||||||
|
iconName: "edit-delete";
|
||||||
|
shortcut: StandardKey.Delete;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: deleteAllAction;
|
||||||
|
//: Clear build platform action
|
||||||
|
text: qsTr("Clear Build Platform");
|
||||||
|
iconName: "edit-clear";
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: openAction;
|
||||||
|
//: Open file action
|
||||||
|
text: qsTr("Open...");
|
||||||
|
iconName: "document-open";
|
||||||
|
shortcut: StandardKey.Open;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: saveAction;
|
||||||
|
//: Save file action
|
||||||
|
text: qsTr("Save...");
|
||||||
|
iconName: "document-save";
|
||||||
|
shortcut: StandardKey.Save;
|
||||||
|
}
|
||||||
|
}
|
@ -153,6 +153,7 @@ UM.Toolbar {
|
|||||||
foregroundHighlightColor: "black";
|
foregroundHighlightColor: "black";
|
||||||
}
|
}
|
||||||
action: base.settings;
|
action: base.settings;
|
||||||
|
iconSource: UM.Resources.getIcon("settings.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { width: UM.Theme.windowRightMargin; }
|
Item { width: UM.Theme.windowRightMargin; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user