Solved merge conflict. CURA-3321

This commit is contained in:
Jack Ha 2017-03-07 10:34:53 +01:00
commit 42d939b34e
65 changed files with 1358 additions and 418 deletions

View file

@ -262,6 +262,7 @@ Item
id: reloadAllAction;
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
iconName: "document-revert";
shortcut: "F5"
onTriggered: Printer.reloadAll();
}

15
resources/qml/Cura.qml Normal file → Executable file
View file

@ -870,6 +870,21 @@ UM.MainWindow
}
}
DiscardOrKeepProfileChangesDialog
{
id: discardOrKeepProfileChangesDialog
}
Connections
{
target: Printer
onShowDiscardOrKeepProfileChanges:
{
discardOrKeepProfileChangesDialog.show()
}
}
Connections
{
target: Cura.Actions.addMachine

View file

@ -0,0 +1,214 @@
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the AGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.1 as Cura
UM.Dialog
{
id: base
title: catalog.i18nc("@title:window", "Discard or Keep changes")
width: 500
height: 300
property var changesModel: Cura.UserChangesModel{ id: userChangesModel}
onVisibilityChanged:
{
if(visible)
{
changesModel.forceUpdate()
}
}
Column
{
anchors.fill: parent
spacing: UM.Theme.getSize("default_margin").width
UM.I18nCatalog
{
id: catalog;
name:"cura"
}
Row
{
height: childrenRect.height
anchors.margins: UM.Theme.getSize("default_margin").width
anchors.left: parent.left
anchors.right: parent.right
spacing: UM.Theme.getSize("default_margin").width
UM.RecolorImage
{
source: UM.Theme.getIcon("star")
width : 30
height: width
color: UM.Theme.getColor("setting_control_button")
}
Label
{
text: "You have customized some profile settings.\nWould you like to keep or discard those settings?"
anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default_bold")
wrapMode: Text.WordWrap
}
}
TableView
{
anchors.margins: UM.Theme.getSize("default_margin").width
anchors.left: parent.left
anchors.right: parent.right
height: base.height - 200
id: tableView
Component
{
id: labelDelegate
Label
{
property var extruder_name: userChangesModel.getItem(styleData.row).extruder
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default")
text:
{
var result = styleData.value
if (extruder_name!= "")
{
result += " (" + extruder_name + ")"
}
return result
}
}
}
Component
{
id: defaultDelegate
Label
{
text: styleData.value
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("setting_control_disabled_text")
}
}
TableViewColumn
{
role: "label"
title: catalog.i18nc("@title:column", "Profile settings")
delegate: labelDelegate
width: tableView.width * 0.5
}
TableViewColumn
{
role: "original_value"
title: "Default"
width: tableView.width * 0.25
delegate: defaultDelegate
}
TableViewColumn
{
role: "user_value"
title: catalog.i18nc("@title:column", "Customized")
width: tableView.width * 0.25 - 1
}
section.property: "category"
section.delegate: Label
{
text: section
font.bold: true
}
model: base.changesModel
}
Item
{
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: UM.Theme.getSize("default_margin").width
height:childrenRect.height
ComboBox
{
id: discardOrKeepProfileChangesDropDownButton
model: [
catalog.i18nc("@option:discardOrKeep", "Always ask me this"),
catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"),
catalog.i18nc("@option:discardOrKeep", "Keep and never ask again")
]
width: 300
currentIndex: UM.Preferences.getValue("cura/choice_on_profile_override")
onCurrentIndexChanged:
{
UM.Preferences.setValue("cura/choice_on_profile_override", currentIndex)
if (currentIndex == 1) {
// 1 == "Discard and never ask again", so only enable the "Discard" button
discardButton.enabled = true
keepButton.enabled = false
}
else if (currentIndex == 2) {
// 2 == "Keep and never ask again", so only enable the "Keep" button
keepButton.enabled = true
discardButton.enabled = false
}
else {
// 0 == "Always ask me this", so show both
keepButton.enabled = true
discardButton.enabled = true
}
}
}
}
Item
{
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: UM.Theme.getSize("default_margin").width
height:childrenRect.height
Button
{
id: discardButton
text: catalog.i18nc("@action:button", "Discard");
anchors.right: parent.right
onClicked:
{
Printer.discardOrKeepProfileChangesClosed("discard")
base.hide()
}
isDefault: true
}
Button
{
id: keepButton
text: catalog.i18nc("@action:button", "Keep");
anchors.right: discardButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
onClicked:
{
Printer.discardOrKeepProfileChangesClosed("keep")
base.hide()
}
}
Button
{
id: createNewProfileButton
text: catalog.i18nc("@action:button", "Create New Profile");
anchors.left: parent.left
action: Cura.Actions.addProfile
onClicked: base.hide()
}
}
}
}

38
resources/qml/Preferences/GeneralPage.qml Normal file → Executable file
View file

@ -45,6 +45,10 @@ UM.PreferencesPage
showOverhangCheckbox.checked = boolCheck(UM.Preferences.getValue("view/show_overhang"))
UM.Preferences.resetPreference("view/center_on_select");
centerOnSelectCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select"))
UM.Preferences.resetPreference("view/top_layer_count");
topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count"))
UM.Preferences.resetPreference("cura/choice_on_profile_override")
choiceOnProfileOverrideDropDownButton.currentIndex = UM.Preferences.getValue("cura/choice_on_profile_override")
if (plugins.find("id", "SliceInfoPlugin") > -1) {
UM.Preferences.resetPreference("info/send_slice_info")
@ -337,6 +341,40 @@ UM.PreferencesPage
}
}
Item
{
//: Spacer
height: UM.Theme.getSize("default_margin").height
width: UM.Theme.getSize("default_margin").width
}
Label
{
font.bold: true
text: catalog.i18nc("@label", "Override Profile")
}
UM.TooltipArea
{
width: childrenRect.width;
height: childrenRect.height;
text: catalog.i18nc("@info:tooltip", "When you have made changes to a profile and switched to a different one, a dialog will be shown asking whether you want to keep your modifications or not, or you can choose a default behaviour and never show that dialog again.")
ComboBox
{
id: choiceOnProfileOverrideDropDownButton
model: [
catalog.i18nc("@option:discardOrKeep", "Always ask me this"),
catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"),
catalog.i18nc("@option:discardOrKeep", "Keep and never ask again")
]
width: 300
currentIndex: UM.Preferences.getValue("cura/choice_on_profile_override")
onCurrentIndexChanged: UM.Preferences.setValue("cura/choice_on_profile_override", currentIndex)
}
}
Item
{

View file

@ -89,15 +89,20 @@ UM.ManagementPage
id: machineActionRepeater
model: base.currentItem ? Cura.MachineActionManager.getSupportedActions(Cura.MachineManager.getDefinitionByMachineId(base.currentItem.id)) : null
Button
Item
{
text: machineActionRepeater.model[index].label
onClicked:
width: childrenRect.width + 2
height: childrenRect.height
Button
{
actionDialog.content = machineActionRepeater.model[index].displayItem;
machineActionRepeater.model[index].displayItem.reset();
actionDialog.title = machineActionRepeater.model[index].label;
actionDialog.show();
text: machineActionRepeater.model[index].label
onClicked:
{
actionDialog.content = machineActionRepeater.model[index].displayItem;
machineActionRepeater.model[index].displayItem.reset();
actionDialog.title = machineActionRepeater.model[index].label;
actionDialog.show();
}
}
}
}

View file

@ -98,9 +98,9 @@ SettingItem
selectByMouse: true;
maximumLength: 10;
maximumLength: (definition.type == "[int]") ? 20 : 10;
validator: RegExpValidator { regExp: (definition.type == "int") ? /^-?[0-9]{0,10}$/ : /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } // definition.type property from parent loader used to disallow fractional number entry
validator: RegExpValidator { regExp: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,9}\s*,)*(\s*-?[0-9]{0,9})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } // definition.type property from parent loader used to disallow fractional number entry
Binding
{

View file

@ -217,6 +217,8 @@ Item
{
case "int":
return "SettingTextField.qml"
case "[int]":
return "SettingTextField.qml"
case "float":
return "SettingTextField.qml"
case "enum":