mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Merge pull request #1176 from Ultimaker/rework_file_handler
Rework file handler CURA-1263
This commit is contained in:
commit
84759e5808
16 changed files with 1158 additions and 30 deletions
|
@ -11,6 +11,7 @@ import Cura 1.0 as Cura
|
|||
Item
|
||||
{
|
||||
property alias open: openAction;
|
||||
property alias loadWorkspace: loadWorkspaceAction;
|
||||
property alias quit: quitAction;
|
||||
|
||||
property alias undo: undoAction;
|
||||
|
@ -286,6 +287,12 @@ Item
|
|||
shortcut: StandardKey.Open;
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: loadWorkspaceAction
|
||||
text: catalog.i18nc("@action:inmenu menubar:file","&Open Workspace...");
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: showEngineLogAction;
|
||||
|
|
|
@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.1
|
|||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import "Menus"
|
||||
|
@ -67,9 +67,14 @@ UM.MainWindow
|
|||
id: fileMenu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&File");
|
||||
|
||||
MenuItem {
|
||||
MenuItem
|
||||
{
|
||||
action: Cura.Actions.open;
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
action: Cura.Actions.loadWorkspace
|
||||
}
|
||||
|
||||
RecentFilesMenu { }
|
||||
|
||||
|
@ -102,6 +107,12 @@ UM.MainWindow
|
|||
onObjectRemoved: saveAllMenu.removeItem(object)
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
id: saveWorkspaceMenu
|
||||
text: catalog.i18nc("@title:menu menubar:file","Save Workspace")
|
||||
onTriggered: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "file_type": "workspace" });
|
||||
}
|
||||
|
||||
MenuItem { action: Cura.Actions.reloadAll; }
|
||||
|
||||
|
@ -723,6 +734,38 @@ UM.MainWindow
|
|||
onTriggered: openDialog.open()
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: openWorkspaceDialog;
|
||||
|
||||
//: File open dialog title
|
||||
title: catalog.i18nc("@title:window","Open workspace")
|
||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
||||
selectMultiple: false
|
||||
nameFilters: UM.WorkspaceFileHandler.supportedReadFileTypes;
|
||||
folder: CuraApplication.getDefaultPath("dialog_load_path")
|
||||
onAccepted:
|
||||
{
|
||||
//Because several implementations of the file dialog only update the folder
|
||||
//when it is explicitly set.
|
||||
var f = folder;
|
||||
folder = f;
|
||||
|
||||
CuraApplication.setDefaultPath("dialog_load_path", folder);
|
||||
|
||||
for(var i in fileUrls)
|
||||
{
|
||||
UM.WorkspaceFileHandler.readLocalFile(fileUrls[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.loadWorkspace
|
||||
onTriggered:openWorkspaceDialog.open()
|
||||
}
|
||||
|
||||
EngineLog
|
||||
{
|
||||
id: engineLog;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue