Clean up actions for open/save

This commit is contained in:
Arjen Hiemstra 2015-02-11 14:54:24 +01:00
parent 242b46dcca
commit 64b76b1fec
2 changed files with 11 additions and 6 deletions

View file

@ -10,6 +10,7 @@ Button {
text: "Save"; text: "Save";
signal saveRequested();
iconSource: UM.Resources.getIcon('save.png'); iconSource: UM.Resources.getIcon('save.png');
onClicked: saveDialog.open(); onClicked: saveDialog.open();

View file

@ -26,8 +26,8 @@ UM.MainWindow {
Menu { Menu {
title: '&File'; title: '&File';
MenuItem { action: loadFileAction; } MenuItem { action: openAction; }
MenuItem { action: saveFileAction; } MenuItem { action: saveAction; }
MenuSeparator { } MenuSeparator { }
@ -132,7 +132,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: openDialog.open(); onRequestOpenFile: openAction.trigger();
onOpenFile: UM.Controller.addMesh(file); onOpenFile: UM.Controller.addMesh(file);
} }
@ -161,6 +161,8 @@ UM.MainWindow {
width: UM.Theme.panelWidth; width: UM.Theme.panelWidth;
height: 40; height: 40;
onSaveRequested: saveAction.trigger();
} }
// UM.JobList { anchors.left: parent.left; anchors.bottom: parent.bottom; width: parent.width / 10; height: parent.height / 5; } // UM.JobList { anchors.left: parent.left; anchors.bottom: parent.bottom; width: parent.width / 10; height: parent.height / 5; }
@ -256,7 +258,7 @@ UM.MainWindow {
} }
Action { Action {
id: loadFileAction; id: openAction;
text: "Open..."; text: "Open...";
iconName: "document-open"; iconName: "document-open";
shortcut: StandardKey.Open; shortcut: StandardKey.Open;
@ -264,11 +266,11 @@ UM.MainWindow {
} }
Action { Action {
id: saveFileAction; id: saveAction;
text: "Save..."; text: "Save...";
iconName: "document-save"; iconName: "document-save";
shortcut: StandardKey.Save; shortcut: StandardKey.Save;
enabled: false; onTriggered: saveDialog.open();
} }
Menu { Menu {
@ -297,6 +299,8 @@ UM.MainWindow {
title: "Choose Filename"; title: "Choose Filename";
selectExisting: false; selectExisting: false;
modality: Qt.NonModal
onAccepted: onAccepted:
{ {
Printer.saveGCode(fileUrl); Printer.saveGCode(fileUrl);