Refactoring; no longer use "Printer" to identify CuraApplication

This commit is contained in:
Jaime van Kessel 2017-03-30 20:19:05 +02:00
parent e0c77231e0
commit f82aecb7ca
14 changed files with 59 additions and 49 deletions

View file

@ -351,7 +351,7 @@ Item
property bool roundValues: true
property var activeHandle: upperHandle
property bool layersVisible: UM.LayerView.layerActivity && Printer.platformActivity ? true : false
property bool layersVisible: UM.LayerView.layerActivity && CuraApplication.platformActivity ? true : false
function getUpperValueFromHandle()
{

View file

@ -183,7 +183,7 @@ Item
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete";
shortcut: StandardKey.Delete;
onTriggered: Printer.deleteSelection();
onTriggered: CuraApplication.deleteSelection();
}
Action
@ -207,7 +207,7 @@ Item
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
iconName: "object-group"
shortcut: "Ctrl+G";
onTriggered: Printer.groupSelected();
onTriggered: CuraApplication.groupSelected();
}
Action
@ -217,7 +217,7 @@ Item
enabled: UM.Scene.isGroupSelected
iconName: "object-ungroup"
shortcut: "Ctrl+Shift+G";
onTriggered: Printer.ungroupSelected();
onTriggered: CuraApplication.ungroupSelected();
}
Action
@ -227,7 +227,7 @@ Item
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
iconName: "merge";
shortcut: "Ctrl+Alt+G";
onTriggered: Printer.mergeSelected();
onTriggered: CuraApplication.mergeSelected();
}
Action
@ -244,7 +244,7 @@ Item
enabled: UM.Controller.toolsEnabled;
iconName: "edit-select-all";
shortcut: "Ctrl+A";
onTriggered: Printer.selectAll();
onTriggered: CuraApplication.selectAll();
}
Action
@ -254,7 +254,7 @@ Item
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete";
shortcut: "Ctrl+D";
onTriggered: Printer.deleteAll();
onTriggered: CuraApplication.deleteAll();
}
Action
@ -263,21 +263,21 @@ Item
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
iconName: "document-revert";
shortcut: "F5"
onTriggered: Printer.reloadAll();
onTriggered: CuraApplication.reloadAll();
}
Action
{
id: resetAllTranslationAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Positions");
onTriggered: Printer.resetAllTranslation();
onTriggered: CuraApplication.resetAllTranslation();
}
Action
{
id: resetAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model &Transformations");
onTriggered: Printer.resetAll();
onTriggered: CuraApplication.resetAll();
}
Action

View file

@ -40,7 +40,9 @@ UM.Dialog
function loadModelFiles(fileUrls)
{
for (var i in fileUrls)
Printer.readLocalFile(fileUrls[i]);
{
CuraApplication.readLocalFile(fileUrls[i]);
}
var meshName = backgroundItem.getMeshName(fileUrls[0].toString());
backgroundItem.hasMesh(decodeURIComponent(meshName));

View file

@ -21,7 +21,7 @@ UM.MainWindow
property bool monitoringPrint: false
Component.onCompleted:
{
Printer.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
// Workaround silly issues with QML Action's shortcut property.
//
// Currently, there is no way to define shortcuts as "Application Shortcut".
@ -502,7 +502,7 @@ UM.MainWindow
icon: StandardIcon.Question
onYes:
{
Printer.deleteAll();
CuraApplication.deleteAll();
Cura.Actions.resetProfile.trigger();
}
}
@ -619,7 +619,7 @@ UM.MainWindow
{
if(objectContextMenu.objectId != 0)
{
Printer.deleteObject(objectContextMenu.objectId);
CuraApplication.deleteObject(objectContextMenu.objectId);
objectContextMenu.objectId = 0;
}
}
@ -652,7 +652,7 @@ UM.MainWindow
{
if(objectContextMenu.objectId != 0)
{
Printer.centerObject(objectContextMenu.objectId);
CuraApplication.centerObject(objectContextMenu.objectId);
objectContextMenu.objectId = 0;
}
}
@ -898,14 +898,14 @@ UM.MainWindow
{
id: messageDialog
modality: Qt.ApplicationModal
onAccepted: Printer.messageBoxClosed(clickedButton)
onApply: Printer.messageBoxClosed(clickedButton)
onDiscard: Printer.messageBoxClosed(clickedButton)
onHelp: Printer.messageBoxClosed(clickedButton)
onNo: Printer.messageBoxClosed(clickedButton)
onRejected: Printer.messageBoxClosed(clickedButton)
onReset: Printer.messageBoxClosed(clickedButton)
onYes: Printer.messageBoxClosed(clickedButton)
onAccepted: CuraApplication.messageBoxClosed(clickedButton)
onApply: CuraApplication.messageBoxClosed(clickedButton)
onDiscard: CuraApplication.messageBoxClosed(clickedButton)
onHelp: CuraApplication.messageBoxClosed(clickedButton)
onNo: CuraApplication.messageBoxClosed(clickedButton)
onRejected: CuraApplication.messageBoxClosed(clickedButton)
onReset: CuraApplication.messageBoxClosed(clickedButton)
onYes: CuraApplication.messageBoxClosed(clickedButton)
}
Connections

View file

@ -190,7 +190,7 @@ UM.Dialog
anchors.right: parent.right
onClicked:
{
Printer.discardOrKeepProfileChangesClosed("discard")
CuraApplication.discardOrKeepProfileChangesClosed("discard")
base.hide()
}
isDefault: true
@ -204,7 +204,7 @@ UM.Dialog
anchors.rightMargin: UM.Theme.getSize("default_margin").width
onClicked:
{
Printer.discardOrKeepProfileChangesClosed("keep")
CuraApplication.discardOrKeepProfileChangesClosed("keep")
base.hide()
}
}

View file

@ -27,7 +27,7 @@ UM.Dialog
interval: 1000;
running: false;
repeat: true;
onTriggered: textArea.text = Printer.getEngineLog();
onTriggered: textArea.text = CuraApplication.getEngineLog();
}
UM.I18nCatalog{id: catalog; name:"cura"}
}
@ -43,7 +43,7 @@ UM.Dialog
{
if(visible)
{
textArea.text = Printer.getEngineLog();
textArea.text = CuraApplication.getEngineLog();
updateTimer.start();
} else
{

View file

@ -12,7 +12,7 @@ import Cura 1.0 as Cura
Item {
id: base
property bool activity: Printer.platformActivity
property bool activity: CuraApplication.platformActivity
property string fileBaseName
property variant activeMachineName: Cura.MachineManager.activeMachineName
@ -141,7 +141,7 @@ Item {
verticalAlignment: Text.AlignVCenter
font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text_subtext")
text: Printer.getSceneBoundingBoxString
text: CuraApplication.getSceneBoundingBoxString
}
Rectangle

View file

@ -13,11 +13,11 @@ Menu
title: catalog.i18nc("@title:menu menubar:file", "Open &Recent")
iconName: "document-open-recent";
enabled: Printer.recentFiles.length > 0;
enabled: CuraApplication.recentFiles.length > 0;
Instantiator
{
model: Printer.recentFiles
model: CuraApplication.recentFiles
MenuItem
{
text:
@ -36,12 +36,14 @@ Menu
var choice = UM.Preferences.getValue("cura/choice_on_open_project");
if (choice == "open_as_project")
{
toOpenAsProject = true;
else if (choice == "open_as_model")
}else if (choice == "open_as_model"){
toOpenAsModel = true;
else
}else{
toShowDialog = true;
}
}
else {
toOpenAsModel = true;
}
@ -54,9 +56,13 @@ Menu
// open file in the prefered way
if (toOpenAsProject)
{
UM.WorkspaceFileHandler.readLocalFile(modelData);
}
else if (toOpenAsModel)
Printer.readLocalFile(modelData);
{
CuraApplication.readLocalFile(modelData);
}
var meshName = backgroundItem.getMeshName(modelData.toString())
backgroundItem.hasMesh(decodeURIComponent(meshName))
}

View file

@ -80,7 +80,7 @@ Item
}
}
property bool activity: Printer.platformActivity;
property bool activity: CuraApplication.platformActivity;
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
property string fileBaseName
property string statusText:
@ -205,8 +205,8 @@ Item
onAdditionalComponentsChanged:
{
if(areaId == "monitorButtons") {
for (var component in Printer.additionalComponents["monitorButtons"]) {
Printer.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
for (var component in CuraApplication.additionalComponents["monitorButtons"]) {
CuraApplication.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
}
}
}

View file

@ -20,7 +20,7 @@ UM.Dialog
height: minimumHeight
property var objectId: 0;
onAccepted: Printer.multiplyObject(base.objectId, parseInt(copiesField.text))
onAccepted: CuraApplication.multiplyObject(base.objectId, parseInt(copiesField.text))
property variant catalog: UM.I18nCatalog { name: "cura" }

View file

@ -40,7 +40,9 @@ UM.Dialog
function loadModelFiles(fileUrls)
{
for (var i in fileUrls)
Printer.readLocalFile(fileUrls[i]);
{
CuraApplication.readLocalFile(fileUrls[i]);
}
var meshName = backgroundItem.getMeshName(fileUrls[0].toString());
backgroundItem.hasMesh(decodeURIComponent(meshName));

View file

@ -43,7 +43,7 @@ UM.ManagementPage
{
text: catalog.i18nc("@action:button", "Add");
iconName: "list-add";
onClicked: Printer.requestAddPrinter()
onClicked: CuraApplication.requestAddPrinter()
},
Button
{
@ -216,8 +216,8 @@ UM.ManagementPage
Component.onCompleted:
{
for (var component in Printer.additionalComponents["machinesDetailPane"]) {
Printer.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
}
}
}
@ -227,8 +227,8 @@ UM.ManagementPage
onAdditionalComponentsChanged:
{
if(areaId == "machinesDetailPane") {
for (var component in Printer.additionalComponents["machinesDetailPane"]) {
Printer.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
}
}
}

View file

@ -16,7 +16,7 @@ Item {
property int backendState: UM.Backend.state;
property var backend: CuraApplication.getBackend();
property bool activity: Printer.platformActivity;
property bool activity: CuraApplication.platformActivity;
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
property string fileBaseName
@ -110,8 +110,8 @@ Item {
onAdditionalComponentsChanged:
{
if(areaId == "saveButton") {
for (var component in Printer.additionalComponents["saveButton"]) {
Printer.additionalComponents["saveButton"][component].parent = additionalComponentsRow
for (var component in CuraApplication.additionalComponents["saveButton"]) {
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
}

View file

@ -155,14 +155,14 @@ Item
containerId: Cura.MachineManager.activeDefinitionId
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
expanded: Printer.expandedCategories
expanded: CuraApplication.expandedCategories
onExpandedChanged:
{
if(!findingSettings)
{
// Do not change expandedCategories preference while filtering settings
// because all categories are expanded while filtering
Printer.setExpandedCategories(expanded)
CuraApplication.setExpandedCategories(expanded)
}
}
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()