Merge branch 'settings_rework' of https://github.com/Ultimaker/Cura into settings_rework

This commit is contained in:
Jaime van Kessel 2016-05-12 09:31:43 +02:00
commit 133229d086
15 changed files with 308 additions and 248 deletions

View File

@ -1,6 +1,8 @@
// Copyright (c) 2015 Ultimaker B.V.
// Cura is released under the terms of the AGPLv3 or higher.
pragma Singleton
import QtQuick 2.2
import QtQuick.Controls 1.1
import UM 1.1 as UM
@ -45,6 +47,8 @@ Item
property alias toggleFullScreen: toggleFullScreenAction;
property alias configureSettingVisibility: configureSettingVisibilityAction
UM.I18nCatalog{id: catalog; name:"cura"}
Action
@ -60,6 +64,8 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Undo");
iconName: "edit-undo";
shortcut: StandardKey.Undo;
onTriggered: UM.OperationStack.undo();
enabled: UM.OperationStack.canUndo;
}
Action
@ -68,6 +74,8 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Redo");
iconName: "edit-redo";
shortcut: StandardKey.Redo;
onTriggered: UM.OperationStack.redo();
enabled: UM.OperationStack.canRedo;
}
Action
@ -103,6 +111,7 @@ Item
id: updateProfileAction;
enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Update Current Profile");
onTriggered: UM.ActiveProfile.updateProfile();
}
Action
@ -110,6 +119,7 @@ Item
id: resetProfileAction;
enabled: UM.ActiveProfile.valid && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Reload Current Profile");
onTriggered: UM.ActiveProfile.discardChanges();
}
Action
@ -132,12 +142,14 @@ Item
text: catalog.i18nc("@action:inmenu menubar:help","Show Online &Documentation");
iconName: "help-contents";
shortcut: StandardKey.Help;
onTriggered: CuraActions.openDocumentation();
}
Action {
id: reportBugAction;
text: catalog.i18nc("@action:inmenu menubar:help","Report a &Bug");
iconName: "tools-report-bug";
onTriggered: CuraActions.openBugReportPage();
}
Action
@ -154,6 +166,7 @@ Item
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete";
shortcut: StandardKey.Delete;
onTriggered: Printer.deleteSelection();
}
Action
@ -176,6 +189,7 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Group Objects");
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
iconName: "object-group"
onTriggered: Printer.groupSelected();
}
Action
@ -184,6 +198,7 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Objects");
enabled: UM.Scene.isGroupSelected
iconName: "object-ungroup"
onTriggered: Printer.ungroupSelected();
}
Action
@ -192,6 +207,7 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Objects");
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
iconName: "merge";
onTriggered: Printer.mergeSelected();
}
Action
@ -208,6 +224,7 @@ Item
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete";
shortcut: "Ctrl+D";
onTriggered: Printer.deleteAll();
}
Action
@ -215,18 +232,21 @@ Item
id: reloadAllAction;
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Objects");
iconName: "document-revert";
onTriggered: Printer.reloadAll();
}
Action
{
id: resetAllTranslationAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Object Positions");
onTriggered: Printer.resetAllTranslation();
}
Action
{
id: resetAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Object &Transformations");
onTriggered: Printer.resetAll();
}
Action
@ -244,4 +264,10 @@ Item
iconName: "view-list-text";
shortcut: StandardKey.WhatsThis;
}
Action
{
id: configureSettingVisibilityAction
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
}
}

View File

@ -10,6 +10,8 @@ import QtQuick.Dialogs 1.1
import UM 1.2 as UM
import Cura 1.0 as Cura
import "."
UM.MainWindow
{
id: base
@ -54,7 +56,7 @@ UM.MainWindow
title: catalog.i18nc("@title:menu menubar:toplevel","&File");
MenuItem {
action: actions.open;
action: Actions.open;
}
Menu
@ -116,11 +118,11 @@ UM.MainWindow
}
}
MenuItem { action: actions.reloadAll; }
MenuItem { action: Actions.reloadAll; }
MenuSeparator { }
MenuItem { action: actions.quit; }
MenuItem { action: Actions.quit; }
}
Menu
@ -128,17 +130,17 @@ UM.MainWindow
//: Edit menu
title: catalog.i18nc("@title:menu menubar:toplevel","&Edit");
MenuItem { action: actions.undo; }
MenuItem { action: actions.redo; }
MenuItem { action: Actions.undo; }
MenuItem { action: Actions.redo; }
MenuSeparator { }
MenuItem { action: actions.deleteSelection; }
MenuItem { action: actions.deleteAll; }
MenuItem { action: actions.resetAllTranslation; }
MenuItem { action: actions.resetAll; }
MenuItem { action: Actions.deleteSelection; }
MenuItem { action: Actions.deleteAll; }
MenuItem { action: Actions.resetAllTranslation; }
MenuItem { action: Actions.resetAll; }
MenuSeparator { }
MenuItem { action: actions.groupObjects;}
MenuItem { action: actions.mergeObjects;}
MenuItem { action: actions.unGroupObjects;}
MenuItem { action: Actions.groupObjects;}
MenuItem { action: Actions.mergeObjects;}
MenuItem { action: Actions.unGroupObjects;}
}
Menu
@ -205,10 +207,10 @@ UM.MainWindow
ExclusiveGroup { id: machineVariantsGroup; }
MenuSeparator { visible: UM.MachineManager.hasVariants; }
// MenuSeparator { visible: UM.MachineManager.hasVariants; }
MenuItem { action: actions.addMachine; }
MenuItem { action: actions.configureMachines; }
MenuItem { action: Actions.addMachine; }
MenuItem { action: Actions.configureMachines; }
}
Menu
@ -281,11 +283,11 @@ UM.MainWindow
MenuSeparator { id: profileMenuSeparator }
MenuItem { action: actions.updateProfile; }
MenuItem { action: actions.resetProfile; }
MenuItem { action: actions.addProfile; }
MenuItem { action: Actions.updateProfile; }
MenuItem { action: Actions.resetProfile; }
MenuItem { action: Actions.addProfile; }
MenuSeparator { }
MenuItem { action: actions.manageProfiles; }
MenuItem { action: Actions.manageProfiles; }
}
Menu
@ -296,7 +298,7 @@ UM.MainWindow
Instantiator
{
model: UM.Models.extensionModel
model: UM.ExtensionModel { }
Menu
{
@ -327,7 +329,7 @@ UM.MainWindow
//: Settings menu
title: catalog.i18nc("@title:menu menubar:toplevel","&Settings");
MenuItem { action: actions.preferences; }
MenuItem { action: Actions.preferences; }
}
Menu
@ -335,11 +337,11 @@ UM.MainWindow
//: Help menu
title: catalog.i18nc("@title:menu menubar:toplevel","&Help");
MenuItem { action: actions.showEngineLog; }
MenuItem { action: actions.documentation; }
MenuItem { action: actions.reportBug; }
MenuItem { action: Actions.showEngineLog; }
MenuItem { action: Actions.documentation; }
MenuItem { action: Actions.reportBug; }
MenuSeparator { }
MenuItem { action: actions.about; }
MenuItem { action: Actions.about; }
}
}
@ -429,7 +431,7 @@ UM.MainWindow
left: parent.left;
//leftMargin: UM.Theme.getSize("loadfile_margin").width
}
action: actions.open;
action: Actions.open;
}
Image
@ -517,22 +519,12 @@ UM.MainWindow
width: UM.Theme.getSize("sidebar").width;
addMachineAction: actions.addMachine;
configureMachinesAction: actions.configureMachines;
addProfileAction: actions.addProfile;
updateProfileAction: actions.updateProfile;
resetProfileAction: actions.resetProfile;
manageProfilesAction: actions.manageProfiles;
configureSettingsAction: Action
{
onTriggered:
{
preferences.visible = true;
preferences.setPage(2);
preferences.getCurrentItem().scrollToSection(source.key);
}
}
addMachineAction: Actions.addMachine;
configureMachinesAction: Actions.configureMachines;
addProfileAction: Actions.addProfile;
updateProfileAction: Actions.updateProfile;
resetProfileAction: Actions.resetProfile;
manageProfilesAction: Actions.manageProfiles;
}
}
}
@ -565,73 +557,16 @@ UM.MainWindow
}
}
Actions
Connections
{
id: actions;
target: Actions.preferences
onTriggered: preferences.visible = true
}
open.onTriggered: openDialog.open();
quit.onTriggered: base.visible = false;
undo.onTriggered: UM.OperationStack.undo();
undo.enabled: UM.OperationStack.canUndo;
redo.onTriggered: UM.OperationStack.redo();
redo.enabled: UM.OperationStack.canRedo;
deleteSelection.onTriggered:
{
Printer.deleteSelection();
}
deleteObject.onTriggered:
{
if(objectContextMenu.objectId != 0)
{
Printer.deleteObject(objectContextMenu.objectId);
objectContextMenu.objectId = 0;
}
}
multiplyObject.onTriggered:
{
if(objectContextMenu.objectId != 0)
{
Printer.multiplyObject(objectContextMenu.objectId, 1);
objectContextMenu.objectId = 0;
}
}
centerObject.onTriggered:
{
if(objectContextMenu.objectId != 0)
{
Printer.centerObject(objectContextMenu.objectId);
objectContextMenu.objectId = 0;
}
}
groupObjects.onTriggered:
{
Printer.groupSelected();
}
unGroupObjects.onTriggered:
{
Printer.ungroupSelected();
}
mergeObjects.onTriggered:
{
Printer.mergeSelected();
}
deleteAll.onTriggered: Printer.deleteAll();
resetAllTranslation.onTriggered: Printer.resetAllTranslation();
resetAll.onTriggered: Printer.resetAll();
reloadAll.onTriggered: Printer.reloadAll();
addMachine.onTriggered: addMachineDialog.visible = true;
addProfile.onTriggered:
Connections
{
target: Actions.addProfile
onTriggered:
{
UM.MachineManager.createProfile();
preferences.setPage(4);
@ -640,26 +575,37 @@ UM.MainWindow
// Show the renameDialog after a very short delay so the preference page has time to initiate
showProfileNameDialogTimer.start();
}
updateProfile.onTriggered: UM.ActiveProfile.updateProfile();
resetProfile.onTriggered: UM.ActiveProfile.discardChanges();
}
preferences.onTriggered: preferences.visible = true;
configureMachines.onTriggered:
Connections
{
target: Actions.configureMachines
onTriggered:
{
preferences.visible = true;
preferences.setPage(3);
}
manageProfiles.onTriggered:
}
Connections
{
target: Actions.manageProfiles
onTriggered:
{
preferences.visible = true;
preferences.setPage(4);
}
}
documentation.onTriggered: CuraActions.openDocumentation();
reportBug.onTriggered: CuraActions.openBugReportPage();
showEngineLog.onTriggered: engineLog.visible = true;
about.onTriggered: aboutDialog.visible = true;
toggleFullScreen.onTriggered: base.toggleFullscreen();
Connections
{
target: Actions.configureSettingVisibility
onTriggered:
{
preferences.visible = true;
preferences.setPage(2);
preferences.getCurrentItem().scrollToSection(source.key);
}
}
Timer
@ -676,29 +622,68 @@ UM.MainWindow
id: objectContextMenu;
property variant objectId: -1;
MenuItem { action: actions.centerObject; }
MenuItem { action: actions.deleteObject; }
MenuItem { action: actions.multiplyObject; }
MenuItem { action: Actions.centerObject; }
MenuItem { action: Actions.deleteObject; }
MenuItem { action: Actions.multiplyObject; }
MenuSeparator { }
MenuItem { action: actions.deleteAll; }
MenuItem { action: actions.reloadAll; }
MenuItem { action: actions.resetAllTranslation; }
MenuItem { action: actions.resetAll; }
MenuItem { action: actions.groupObjects; }
MenuItem { action: actions.mergeObjects; }
MenuItem { action: actions.unGroupObjects; }
MenuItem { action: Actions.deleteAll; }
MenuItem { action: Actions.reloadAll; }
MenuItem { action: Actions.resetAllTranslation; }
MenuItem { action: Actions.resetAll; }
MenuItem { action: Actions.groupObjects; }
MenuItem { action: Actions.mergeObjects; }
MenuItem { action: Actions.unGroupObjects; }
Connections
{
target: Actions.deleteObject
onTriggered:
{
if(objectContextMenu.objectId != 0)
{
Printer.deleteObject(objectContextMenu.objectId);
objectContextMenu.objectId = 0;
}
}
}
Connections
{
target: Actions.multiplyObject
onTriggered:
{
if(objectContextMenu.objectId != 0)
{
Printer.multiplyObject(objectContextMenu.objectId, 1);
objectContextMenu.objectId = 0;
}
}
}
Connections
{
target: Actions.centerObject
onTriggered:
{
if(objectContextMenu.objectId != 0)
{
Printer.centerObject(objectContextMenu.objectId);
objectContextMenu.objectId = 0;
}
}
}
}
Menu
{
id: contextMenu;
MenuItem { action: actions.deleteAll; }
MenuItem { action: actions.reloadAll; }
MenuItem { action: actions.resetAllTranslation; }
MenuItem { action: actions.resetAll; }
MenuItem { action: actions.groupObjects; }
MenuItem { action: actions.mergeObjects; }
MenuItem { action: actions.unGroupObjects; }
MenuItem { action: Actions.deleteAll; }
MenuItem { action: Actions.reloadAll; }
MenuItem { action: Actions.resetAllTranslation; }
MenuItem { action: Actions.resetAll; }
MenuItem { action: Actions.groupObjects; }
MenuItem { action: Actions.mergeObjects; }
MenuItem { action: Actions.unGroupObjects; }
}
Connections
@ -717,6 +702,18 @@ UM.MainWindow
}
}
Connections
{
target: Actions.quit
onTriggered: base.visible = false;
}
Connections
{
target: Actions.toggleFullScreen
onTriggered: base.toggleFullscreen();
}
FileDialog
{
id: openDialog;
@ -741,21 +738,45 @@ UM.MainWindow
}
}
Connections
{
target: Actions.open
onTriggered: openDialog.open()
}
EngineLog
{
id: engineLog;
}
Connections
{
target: Actions.showEngineLog
onTriggered: engineLog.visible = true;
}
AddMachineDialog
{
id: addMachineDialog
}
Connections
{
target: Actions.addMachine
onTriggered: addMachineDialog.visible = true;
}
AboutDialog
{
id: aboutDialog
}
Connections
{
target: Actions.about
onTriggered: aboutDialog.visible = true;
}
Connections
{
target: Printer

View File

@ -8,12 +8,14 @@ import QtQuick.Layouts 1.1
import UM 1.1 as UM
import ".."
Button {
id: base;
style: UM.Theme.styles.sidebar_category;
signal showTooltip();
signal showTooltip(string text);
signal hideTooltip();
signal contextMenuRequested()
@ -43,7 +45,7 @@ Button {
iconSource: UM.Theme.getIcon("settings");
onClicked: {
Actions.configureSettingVisibility()
Actions.configureSettingVisibility.trigger(definition)
}
}
@ -69,11 +71,13 @@ Button {
iconSource: UM.Theme.getIcon("notice")
onEntered: {
base.showTooltip()
base.showTooltip(catalog.i18nc("@label", "This setting is normally calculated, but it currently has an absolute value set.\n\nClick to restore the calculated value."))
}
onExited: {
base.hideTooltip();
}
UM.I18nCatalog { id: catalog; name: "cura" }
}
}

View File

@ -12,9 +12,10 @@ SettingItem
{
id: base
MouseArea
contents: MouseArea
{
id: control
anchors.fill: parent
property bool checked:
{
@ -46,19 +47,20 @@ SettingItem
{
if (!enabled)
{
return base.style.controlDisabledColor
return UM.Theme.getColor("setting_control_disabled")
}
if(base.containsMouse || base.activeFocus)
if(control.containsMouse || control.activeFocus)
{
return base.style.controlHighlightColor
return UM.Theme.getColor("setting_control_highlight")
}
else
{
return base.style.controlColor
return UM.Theme.getColor("setting_control")
}
}
border.width: base.style.controlBorderWidth;
border.color: !enabled ? base.style.controlDisabledBorderColor : control.containsMouse ? base.style.controlBorderHighlightColor : base.style.controlBorderColor;
border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter
@ -67,9 +69,9 @@ SettingItem
height: parent.height/2.5
sourceSize.width: width
sourceSize.height: width
color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor;
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
source: UM.Theme.getIcon("check")
opacity: control.checked
opacity: control.checked ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 100; } }
}
}

View File

@ -11,12 +11,12 @@ SettingItem
{
id: base
ComboBox
contents: ComboBox
{
// signal valueChanged(string value);
// id: base
model: definition.options
textRole: "name";
textRole: "value";
anchors.fill: parent
MouseArea
{
@ -33,33 +33,33 @@ SettingItem
{
if (!enabled)
{
return base.style.controlDisabledColor
return UM.Theme.getColor("setting_control_disabled")
}
if(control.hovered || base.activeFocus)
{
return base.style.controlHighlightColor
return UM.Theme.getColor("setting_control_highlight")
}
else
{
return base.style.controlColor
return UM.Theme.getColor("setting_control")
}
}
border.width: base.style.controlBorderWidth;
border.color: !enabled ? base.style.controlDisabledBorderColor : control.hovered ? base.style.controlBorderHighlightColor : base.style.controlBorderColor;
border.width: UM.Theme.getSize("default_lining").width;
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
}
label: Item
{
Label
{
anchors.left: parent.left;
anchors.leftMargin: base.style.controlBorderWidth
anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: downArrow.left;
anchors.rightMargin: base.style.controlBorderWidth;
anchors.rightMargin: UM.Theme.getSize("default_lining").width;
anchors.verticalCenter: parent.verticalCenter;
text: control.currentText;
font: base.style.controlFont;
color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor;
font: UM.Theme.getFont("default");
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
elide: Text.ElideRight;
verticalAlignment: Text.AlignVCenter;
@ -69,7 +69,7 @@ SettingItem
{
id: downArrow
anchors.right: parent.right;
anchors.rightMargin: base.style.controlBorderWidth * 2;
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2;
anchors.verticalCenter: parent.verticalCenter;
source: UM.Theme.getIcon("arrow_bottom")
@ -78,7 +78,7 @@ SettingItem
sourceSize.width: width + 5
sourceSize.height: width + 5
color: base.style.controlTextColor;
color: UM.Theme.getColor("setting_control_text");
}
}

View File

@ -15,10 +15,11 @@ Item {
height: UM.Theme.getSize("section").height;
property alias contents: controlContainer.children
property alias contents: controlContainer.children;
property bool hovered: false
signal contextMenuRequested()
signal showTooltip(var position);
signal showTooltip(string text);
signal hideTooltip();
MouseArea
@ -49,7 +50,7 @@ Item {
interval: 500;
repeat: false;
onTriggered: base.showTooltip({ x: mouse.mouseX, y: mouse.mouseY });
onTriggered: base.showTooltip(definition.description);
}
}
@ -106,7 +107,7 @@ Item {
controlContainer.notifyReset();
}
onEntered: base.showResetTooltip({ x: mouse.mouseX, y: mouse.mouseY })
onEntered: base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile."))
onExited:
{
if(controlContainer.item && controlContainer.item.hovered)
@ -140,7 +141,7 @@ Item {
iconSource: UM.Theme.getIcon("notice");
onEntered: base.showInheritanceTooltip({ x: mouse.mouseX, y: mouse.mouseY })
onEntered: base.showTooltip(catalog.i18nc("@label", "This setting is normally calculated, but it currently has an absolute value set.\n\nClick to restore the calculated value."))
onExited: {
if(controlContainer.item && controlContainer.item.hovered) {
@ -154,15 +155,16 @@ Item {
}
Rectangle
Item
{
id: controlContainer;
color: "red"
anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter;
width: UM.Theme.getSize("setting_control").width;
height: UM.Theme.getSize("setting_contorl").height
height: UM.Theme.getSize("setting_control").height
}
UM.I18nCatalog { id: catalog; name: "cura" }
}

View File

@ -18,44 +18,44 @@ SettingItem
property alias hovered: mouseArea.containsMouse;
border.width: base.style.controlBorderWidth;
border.color: !enabled ? base.style.controlDisabledBorderColor : hovered ? base.style.controlBorderHighlightColor : base.style.controlBorderColor
border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
property variant parentValue: value //From parent loader
function notifyReset() {
input.text = format(parentValue)
}
// color: {
// if (!enabled)
// {
// return base.style.controlDisabledColor
// }
// switch(definition.validationState) //From parent loader
// {
// case 0:
// return base.style.validationErrorColor;
// case 1:
// return base.style.validationErrorColor;
// case 2:
// return base.style.validationErrorColor;
// case 3:
// return base.style.validationWarningColor;
// case 4:
// return base.style.validationWarningColor;
// case 5:
// return base.style.validationOkColor;
//
// default:
// return base.style.controlTextColor;
// }
// }
color: {
if (!enabled)
{
return UM.Theme.getColor("setting_control_disabled")
}
switch(definition.validationState)
{
case 0:
return UM.Theme.getColor("setting_validation_error")
case 1:
return UM.Theme.getColor("setting_validation_error")
case 2:
return UM.Theme.getColor("setting_validation_error")
case 3:
return UM.Theme.getColor("setting_validation_warning")
case 4:
return UM.Theme.getColor("setting_validation_warning")
case 5:
return UM.Theme.getColor("setting_validation_ok")
default:
return UM.Theme.getColor("setting_control")
}
}
Rectangle
{
anchors.fill: parent;
anchors.margins: base.style.controlBorderWidth;
color: base.style.controlHighlightColor;
anchors.margins: UM.Theme.getSize("default_lining").width;
color: UM.Theme.getColor("setting_control_highlight")
opacity: 0.35
// opacity: !control.hovered ? 0 : valid == 5 ? 1.0 : 0.35;
}
@ -63,12 +63,12 @@ SettingItem
Label
{
anchors.right: parent.right;
anchors.rightMargin: base.style.unitRightMargin;
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.verticalCenter: parent.verticalCenter;
text: definition.unit;
color: base.style.unitColor
font: base.style.unitFont;
color: UM.Theme.getColor("setting_unit")
font: UM.Theme.getFont("default")
}
MouseArea
@ -86,7 +86,7 @@ SettingItem
anchors
{
left: parent.left
leftMargin: base.style.unitRightMargin
leftMargin: UM.Theme.unitRightMargin
right: parent.right
verticalCenter: parent.verticalCenter
}
@ -108,8 +108,8 @@ SettingItem
}
}
color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor;
font: base.style.controlFont;
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default");
selectByMouse: true;

View File

@ -4,10 +4,16 @@
import QtQuick 2.1
import QtQuick.Controls 1.1
import UM 1.2 as UM
SettingItem
{
Label
contents: Label
{
anchors.fill: parent
text: value + " " + unit;
color: UM.Theme.getColor("setting_control_text")
verticalAlignment: Qt.AlignVCenter
}
}

View File

@ -8,6 +8,8 @@ import QtQuick.Layouts 1.1
import UM 1.2 as UM
import ".."
ScrollView
{
id: base;
@ -30,11 +32,14 @@ ScrollView
{
id: delegate
width: ListView.view.width
width: UM.Theme.getSize("sidebar").width;
height: UM.Theme.getSize("section").height;
property var definition: model
property var settingDefinitionsModel: definitionsModel
asynchronous: true
source:
{
switch(model.type)
@ -43,13 +48,11 @@ ScrollView
return "SettingTextField.qml"
case "float":
return "SettingTextField.qml"
case "double":
return "SettingTextField.qml"
case "enum":
return "SettingComboBox.qml"
case "boolean":
case "bool":
return "SettingCheckBox.qml"
case "string":
case "str":
return "SettingTextField.qml"
case "category":
return "SettingCategory.qml"
@ -62,12 +65,35 @@ ScrollView
{
target: item
onContextMenuRequested: { contextMenu.key = model.key; contextMenu.popup() }
onShowTooltip: base.showTooltip(delegate, position, model.description)
onShowTooltip: base.showTooltip(delegate, { x: 0, y: delegate.height / 2 }, text)
onHideTooltip: base.hideTooltip()
}
}
UM.I18nCatalog { id: catalog; name: "uranium"; }
add: Transition {
SequentialAnimation {
NumberAnimation { properties: "height"; from: 0; duration: 100 }
NumberAnimation { properties: "opacity"; from: 0; duration: 100 }
}
}
remove: Transition {
SequentialAnimation {
NumberAnimation { properties: "opacity"; to: 0; duration: 100 }
NumberAnimation { properties: "height"; to: 0; duration: 100 }
}
}
addDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: 100 }
}
removeDisplaced: Transition {
SequentialAnimation {
PauseAnimation { duration: 100; }
NumberAnimation { properties: "x,y"; duration: 100 }
}
}
Menu
{
id: contextMenu;
@ -85,7 +111,7 @@ ScrollView
//: Settings context menu action
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
onTriggered: if(base.configureSettings) base.configureSettings.trigger(contextMenu);
onTriggered: Actions.configureSettingVisibility.trigger(contextMenu);
}
}
}

View File

@ -27,7 +27,7 @@ Rectangle
function showTooltip(item, position, text)
{
tooltip.text = text;
position = item.mapToItem(base, position.x, position.y / 2);
position = item.mapToItem(base, position.x, position.y);
tooltip.show(position);
}
@ -247,7 +247,6 @@ Rectangle
id: sidebarAdvanced;
visible: false;
configureSettings: base.configureSettingsAction;
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
}

View File

@ -120,7 +120,7 @@ Item
}
}
onEntered: {
base.showTooltip(infillCellRight, Qt.point(-infillCellRight.x, parent.height), model.text);
base.showTooltip(infillCellRight, Qt.point(-infillCellRight.x, 0), model.text);
}
onExited: {
base.hideTooltip();
@ -224,7 +224,7 @@ Item
onEntered:
{
parent.hovered_ex = true
base.showTooltip(brimCheckBox, Qt.point(-helpersCellRight.x, parent.height),
base.showTooltip(brimCheckBox, Qt.point(-helpersCellRight.x, 0),
catalog.i18nc("@label", "Enable printing a brim. This will add a single-layer-thick flat area around your object which is easy to cut off afterwards."));
}
onExited:
@ -257,7 +257,7 @@ Item
onEntered:
{
parent.hovered_ex = true
base.showTooltip(supportCheckBox, Qt.point(-helpersCellRight.x, parent.height),
base.showTooltip(supportCheckBox, Qt.point(-helpersCellRight.x, 0),
catalog.i18nc("@label", "Enable printing support structures. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air."));
}
onExited:

View File

@ -31,7 +31,7 @@ UM.PointingRectangle {
y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height;
}
base.opacity = 1;
target = Qt.point(40 , position.y)
target = Qt.point(40 , position.y + UM.Theme.getSize("tooltip_arrow_margins").height / 2)
}
function hide() {

View File

@ -25,7 +25,7 @@ Item {
Repeater {
id: repeat
model: UM.Models.toolModel
model: UM.ToolModel { }
Button {
text: model.name

3
resources/qml/qmldir Normal file
View File

@ -0,0 +1,3 @@
module Cura
singleton Actions 1.0 Actions.qml

View File

@ -280,35 +280,6 @@ QtObject {
}
}
property variant setting_item: UM.SettingItemStyle {
labelFont: Theme.getFont("default");
labelColor: Theme.getColor("setting_control_text");
spacing: Theme.getSize("default_lining").height;
fixedHeight: Theme.getSize("setting").height;
controlWidth: Theme.getSize("setting_control").width;
controlRightMargin: Theme.getSize("setting_control_margin").width;
controlColor: Theme.getColor("setting_control");
controlHighlightColor: Theme.getColor("setting_control_highlight");
controlBorderColor: Theme.getColor("setting_control_border");
controlBorderHighlightColor: Theme.getColor("setting_control_border_highlight");
controlTextColor: Theme.getColor("setting_control_text");
controlBorderWidth: Theme.getSize("default_lining").width;
controlDisabledColor: Theme.getColor("setting_control_disabled");
controlDisabledTextColor: Theme.getColor("setting_control_disabled_text");
controlDisabledBorderColor: Theme.getColor("setting_control_disabled_border");
controlFont: Theme.getFont("default");
validationErrorColor: Theme.getColor("setting_validation_error");
validationWarningColor: Theme.getColor("setting_validation_warning");
validationOkColor: Theme.getColor("setting_validation_ok");
unitRightMargin: Theme.getSize("setting_unit_margin").width;
unitColor: Theme.getColor("setting_unit");
unitFont: Theme.getFont("default");
}
property Component combobox: Component {
ComboBoxStyle {
background: Rectangle {