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. // Copyright (c) 2015 Ultimaker B.V.
// Cura is released under the terms of the AGPLv3 or higher. // Cura is released under the terms of the AGPLv3 or higher.
pragma Singleton
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import UM 1.1 as UM import UM 1.1 as UM
@ -45,6 +47,8 @@ Item
property alias toggleFullScreen: toggleFullScreenAction; property alias toggleFullScreen: toggleFullScreenAction;
property alias configureSettingVisibility: configureSettingVisibilityAction
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name:"cura"}
Action Action
@ -60,6 +64,8 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Undo"); text: catalog.i18nc("@action:inmenu menubar:edit","&Undo");
iconName: "edit-undo"; iconName: "edit-undo";
shortcut: StandardKey.Undo; shortcut: StandardKey.Undo;
onTriggered: UM.OperationStack.undo();
enabled: UM.OperationStack.canUndo;
} }
Action Action
@ -68,6 +74,8 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Redo"); text: catalog.i18nc("@action:inmenu menubar:edit","&Redo");
iconName: "edit-redo"; iconName: "edit-redo";
shortcut: StandardKey.Redo; shortcut: StandardKey.Redo;
onTriggered: UM.OperationStack.redo();
enabled: UM.OperationStack.canRedo;
} }
Action Action
@ -103,6 +111,7 @@ Item
id: updateProfileAction; id: updateProfileAction;
enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Update Current Profile"); text: catalog.i18nc("@action:inmenu menubar:profile","&Update Current Profile");
onTriggered: UM.ActiveProfile.updateProfile();
} }
Action Action
@ -110,6 +119,7 @@ Item
id: resetProfileAction; id: resetProfileAction;
enabled: UM.ActiveProfile.valid && UM.ActiveProfile.hasCustomisedValues enabled: UM.ActiveProfile.valid && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Reload Current Profile"); text: catalog.i18nc("@action:inmenu menubar:profile","&Reload Current Profile");
onTriggered: UM.ActiveProfile.discardChanges();
} }
Action Action
@ -132,12 +142,14 @@ Item
text: catalog.i18nc("@action:inmenu menubar:help","Show Online &Documentation"); text: catalog.i18nc("@action:inmenu menubar:help","Show Online &Documentation");
iconName: "help-contents"; iconName: "help-contents";
shortcut: StandardKey.Help; shortcut: StandardKey.Help;
onTriggered: CuraActions.openDocumentation();
} }
Action { Action {
id: reportBugAction; id: reportBugAction;
text: catalog.i18nc("@action:inmenu menubar:help","Report a &Bug"); text: catalog.i18nc("@action:inmenu menubar:help","Report a &Bug");
iconName: "tools-report-bug"; iconName: "tools-report-bug";
onTriggered: CuraActions.openBugReportPage();
} }
Action Action
@ -154,6 +166,7 @@ Item
enabled: UM.Controller.toolsEnabled; enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete"; iconName: "edit-delete";
shortcut: StandardKey.Delete; shortcut: StandardKey.Delete;
onTriggered: Printer.deleteSelection();
} }
Action Action
@ -176,6 +189,7 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Group Objects"); text: catalog.i18nc("@action:inmenu menubar:edit","&Group Objects");
enabled: UM.Scene.numObjectsSelected > 1 ? true: false enabled: UM.Scene.numObjectsSelected > 1 ? true: false
iconName: "object-group" iconName: "object-group"
onTriggered: Printer.groupSelected();
} }
Action Action
@ -184,6 +198,7 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Objects"); text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Objects");
enabled: UM.Scene.isGroupSelected enabled: UM.Scene.isGroupSelected
iconName: "object-ungroup" iconName: "object-ungroup"
onTriggered: Printer.ungroupSelected();
} }
Action Action
@ -192,6 +207,7 @@ Item
text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Objects"); text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Objects");
enabled: UM.Scene.numObjectsSelected > 1 ? true: false enabled: UM.Scene.numObjectsSelected > 1 ? true: false
iconName: "merge"; iconName: "merge";
onTriggered: Printer.mergeSelected();
} }
Action Action
@ -208,6 +224,7 @@ Item
enabled: UM.Controller.toolsEnabled; enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete"; iconName: "edit-delete";
shortcut: "Ctrl+D"; shortcut: "Ctrl+D";
onTriggered: Printer.deleteAll();
} }
Action Action
@ -215,18 +232,21 @@ Item
id: reloadAllAction; id: reloadAllAction;
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Objects"); text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Objects");
iconName: "document-revert"; iconName: "document-revert";
onTriggered: Printer.reloadAll();
} }
Action Action
{ {
id: resetAllTranslationAction; id: resetAllTranslationAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Object Positions"); text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Object Positions");
onTriggered: Printer.resetAllTranslation();
} }
Action Action
{ {
id: resetAllAction; id: resetAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Object &Transformations"); text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Object &Transformations");
onTriggered: Printer.resetAll();
} }
Action Action
@ -244,4 +264,10 @@ Item
iconName: "view-list-text"; iconName: "view-list-text";
shortcut: StandardKey.WhatsThis; 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 UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
import "."
UM.MainWindow UM.MainWindow
{ {
id: base id: base
@ -54,7 +56,7 @@ UM.MainWindow
title: catalog.i18nc("@title:menu menubar:toplevel","&File"); title: catalog.i18nc("@title:menu menubar:toplevel","&File");
MenuItem { MenuItem {
action: actions.open; action: Actions.open;
} }
Menu Menu
@ -116,11 +118,11 @@ UM.MainWindow
} }
} }
MenuItem { action: actions.reloadAll; } MenuItem { action: Actions.reloadAll; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: actions.quit; } MenuItem { action: Actions.quit; }
} }
Menu Menu
@ -128,17 +130,17 @@ UM.MainWindow
//: Edit menu //: Edit menu
title: catalog.i18nc("@title:menu menubar:toplevel","&Edit"); title: catalog.i18nc("@title:menu menubar:toplevel","&Edit");
MenuItem { action: actions.undo; } MenuItem { action: Actions.undo; }
MenuItem { action: actions.redo; } MenuItem { action: Actions.redo; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: actions.deleteSelection; } MenuItem { action: Actions.deleteSelection; }
MenuItem { action: actions.deleteAll; } MenuItem { action: Actions.deleteAll; }
MenuItem { action: actions.resetAllTranslation; } MenuItem { action: Actions.resetAllTranslation; }
MenuItem { action: actions.resetAll; } MenuItem { action: Actions.resetAll; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: actions.groupObjects;} MenuItem { action: Actions.groupObjects;}
MenuItem { action: actions.mergeObjects;} MenuItem { action: Actions.mergeObjects;}
MenuItem { action: actions.unGroupObjects;} MenuItem { action: Actions.unGroupObjects;}
} }
Menu Menu
@ -205,10 +207,10 @@ UM.MainWindow
ExclusiveGroup { id: machineVariantsGroup; } ExclusiveGroup { id: machineVariantsGroup; }
MenuSeparator { visible: UM.MachineManager.hasVariants; } // MenuSeparator { visible: UM.MachineManager.hasVariants; }
MenuItem { action: actions.addMachine; } MenuItem { action: Actions.addMachine; }
MenuItem { action: actions.configureMachines; } MenuItem { action: Actions.configureMachines; }
} }
Menu Menu
@ -281,11 +283,11 @@ UM.MainWindow
MenuSeparator { id: profileMenuSeparator } MenuSeparator { id: profileMenuSeparator }
MenuItem { action: actions.updateProfile; } MenuItem { action: Actions.updateProfile; }
MenuItem { action: actions.resetProfile; } MenuItem { action: Actions.resetProfile; }
MenuItem { action: actions.addProfile; } MenuItem { action: Actions.addProfile; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: actions.manageProfiles; } MenuItem { action: Actions.manageProfiles; }
} }
Menu Menu
@ -296,7 +298,7 @@ UM.MainWindow
Instantiator Instantiator
{ {
model: UM.Models.extensionModel model: UM.ExtensionModel { }
Menu Menu
{ {
@ -327,7 +329,7 @@ UM.MainWindow
//: Settings menu //: Settings menu
title: catalog.i18nc("@title:menu menubar:toplevel","&Settings"); title: catalog.i18nc("@title:menu menubar:toplevel","&Settings");
MenuItem { action: actions.preferences; } MenuItem { action: Actions.preferences; }
} }
Menu Menu
@ -335,11 +337,11 @@ UM.MainWindow
//: Help menu //: Help menu
title: catalog.i18nc("@title:menu menubar:toplevel","&Help"); title: catalog.i18nc("@title:menu menubar:toplevel","&Help");
MenuItem { action: actions.showEngineLog; } MenuItem { action: Actions.showEngineLog; }
MenuItem { action: actions.documentation; } MenuItem { action: Actions.documentation; }
MenuItem { action: actions.reportBug; } MenuItem { action: Actions.reportBug; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: actions.about; } MenuItem { action: Actions.about; }
} }
} }
@ -429,7 +431,7 @@ UM.MainWindow
left: parent.left; left: parent.left;
//leftMargin: UM.Theme.getSize("loadfile_margin").width //leftMargin: UM.Theme.getSize("loadfile_margin").width
} }
action: actions.open; action: Actions.open;
} }
Image Image
@ -517,22 +519,12 @@ UM.MainWindow
width: UM.Theme.getSize("sidebar").width; width: UM.Theme.getSize("sidebar").width;
addMachineAction: actions.addMachine; addMachineAction: Actions.addMachine;
configureMachinesAction: actions.configureMachines; configureMachinesAction: Actions.configureMachines;
addProfileAction: actions.addProfile; addProfileAction: Actions.addProfile;
updateProfileAction: actions.updateProfile; updateProfileAction: Actions.updateProfile;
resetProfileAction: actions.resetProfile; resetProfileAction: Actions.resetProfile;
manageProfilesAction: actions.manageProfiles; manageProfilesAction: Actions.manageProfiles;
configureSettingsAction: Action
{
onTriggered:
{
preferences.visible = true;
preferences.setPage(2);
preferences.getCurrentItem().scrollToSection(source.key);
}
}
} }
} }
} }
@ -565,73 +557,16 @@ UM.MainWindow
} }
} }
Actions Connections
{ {
id: actions; target: Actions.preferences
onTriggered: preferences.visible = true
}
open.onTriggered: openDialog.open(); Connections
{
quit.onTriggered: base.visible = false; target: Actions.addProfile
onTriggered:
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:
{ {
UM.MachineManager.createProfile(); UM.MachineManager.createProfile();
preferences.setPage(4); 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 // Show the renameDialog after a very short delay so the preference page has time to initiate
showProfileNameDialogTimer.start(); showProfileNameDialogTimer.start();
} }
updateProfile.onTriggered: UM.ActiveProfile.updateProfile(); }
resetProfile.onTriggered: UM.ActiveProfile.discardChanges();
preferences.onTriggered: preferences.visible = true; Connections
configureMachines.onTriggered: {
target: Actions.configureMachines
onTriggered:
{ {
preferences.visible = true; preferences.visible = true;
preferences.setPage(3); preferences.setPage(3);
} }
manageProfiles.onTriggered: }
Connections
{
target: Actions.manageProfiles
onTriggered:
{ {
preferences.visible = true; preferences.visible = true;
preferences.setPage(4); preferences.setPage(4);
} }
}
documentation.onTriggered: CuraActions.openDocumentation(); Connections
reportBug.onTriggered: CuraActions.openBugReportPage(); {
showEngineLog.onTriggered: engineLog.visible = true; target: Actions.configureSettingVisibility
about.onTriggered: aboutDialog.visible = true; onTriggered:
toggleFullScreen.onTriggered: base.toggleFullscreen(); {
preferences.visible = true;
preferences.setPage(2);
preferences.getCurrentItem().scrollToSection(source.key);
}
} }
Timer Timer
@ -676,29 +622,68 @@ UM.MainWindow
id: objectContextMenu; id: objectContextMenu;
property variant objectId: -1; property variant objectId: -1;
MenuItem { action: actions.centerObject; } MenuItem { action: Actions.centerObject; }
MenuItem { action: actions.deleteObject; } MenuItem { action: Actions.deleteObject; }
MenuItem { action: actions.multiplyObject; } MenuItem { action: Actions.multiplyObject; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: actions.deleteAll; } MenuItem { action: Actions.deleteAll; }
MenuItem { action: actions.reloadAll; } MenuItem { action: Actions.reloadAll; }
MenuItem { action: actions.resetAllTranslation; } MenuItem { action: Actions.resetAllTranslation; }
MenuItem { action: actions.resetAll; } MenuItem { action: Actions.resetAll; }
MenuItem { action: actions.groupObjects; } MenuItem { action: Actions.groupObjects; }
MenuItem { action: actions.mergeObjects; } MenuItem { action: Actions.mergeObjects; }
MenuItem { action: actions.unGroupObjects; } 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 Menu
{ {
id: contextMenu; id: contextMenu;
MenuItem { action: actions.deleteAll; } MenuItem { action: Actions.deleteAll; }
MenuItem { action: actions.reloadAll; } MenuItem { action: Actions.reloadAll; }
MenuItem { action: actions.resetAllTranslation; } MenuItem { action: Actions.resetAllTranslation; }
MenuItem { action: actions.resetAll; } MenuItem { action: Actions.resetAll; }
MenuItem { action: actions.groupObjects; } MenuItem { action: Actions.groupObjects; }
MenuItem { action: actions.mergeObjects; } MenuItem { action: Actions.mergeObjects; }
MenuItem { action: actions.unGroupObjects; } MenuItem { action: Actions.unGroupObjects; }
} }
Connections Connections
@ -717,6 +702,18 @@ UM.MainWindow
} }
} }
Connections
{
target: Actions.quit
onTriggered: base.visible = false;
}
Connections
{
target: Actions.toggleFullScreen
onTriggered: base.toggleFullscreen();
}
FileDialog FileDialog
{ {
id: openDialog; id: openDialog;
@ -741,21 +738,45 @@ UM.MainWindow
} }
} }
Connections
{
target: Actions.open
onTriggered: openDialog.open()
}
EngineLog EngineLog
{ {
id: engineLog; id: engineLog;
} }
Connections
{
target: Actions.showEngineLog
onTriggered: engineLog.visible = true;
}
AddMachineDialog AddMachineDialog
{ {
id: addMachineDialog id: addMachineDialog
} }
Connections
{
target: Actions.addMachine
onTriggered: addMachineDialog.visible = true;
}
AboutDialog AboutDialog
{ {
id: aboutDialog id: aboutDialog
} }
Connections
{
target: Actions.about
onTriggered: aboutDialog.visible = true;
}
Connections Connections
{ {
target: Printer target: Printer

View File

@ -8,12 +8,14 @@ import QtQuick.Layouts 1.1
import UM 1.1 as UM import UM 1.1 as UM
import ".."
Button { Button {
id: base; id: base;
style: UM.Theme.styles.sidebar_category; style: UM.Theme.styles.sidebar_category;
signal showTooltip(); signal showTooltip(string text);
signal hideTooltip(); signal hideTooltip();
signal contextMenuRequested() signal contextMenuRequested()
@ -43,7 +45,7 @@ Button {
iconSource: UM.Theme.getIcon("settings"); iconSource: UM.Theme.getIcon("settings");
onClicked: { onClicked: {
Actions.configureSettingVisibility() Actions.configureSettingVisibility.trigger(definition)
} }
} }
@ -69,11 +71,13 @@ Button {
iconSource: UM.Theme.getIcon("notice") iconSource: UM.Theme.getIcon("notice")
onEntered: { 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: { onExited: {
base.hideTooltip(); base.hideTooltip();
} }
UM.I18nCatalog { id: catalog; name: "cura" }
} }
} }

View File

@ -12,9 +12,10 @@ SettingItem
{ {
id: base id: base
MouseArea contents: MouseArea
{ {
id: control id: control
anchors.fill: parent
property bool checked: property bool checked:
{ {
@ -46,19 +47,20 @@ SettingItem
{ {
if (!enabled) 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 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 { UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -67,9 +69,9 @@ SettingItem
height: parent.height/2.5 height: parent.height/2.5
sourceSize.width: width sourceSize.width: width
sourceSize.height: 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") source: UM.Theme.getIcon("check")
opacity: control.checked opacity: control.checked ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
} }
} }

View File

@ -11,12 +11,12 @@ SettingItem
{ {
id: base id: base
ComboBox contents: ComboBox
{ {
// signal valueChanged(string value);
// id: base
model: definition.options model: definition.options
textRole: "name"; textRole: "value";
anchors.fill: parent
MouseArea MouseArea
{ {
@ -33,33 +33,33 @@ SettingItem
{ {
if (!enabled) if (!enabled)
{ {
return base.style.controlDisabledColor return UM.Theme.getColor("setting_control_disabled")
} }
if(control.hovered || base.activeFocus) if(control.hovered || base.activeFocus)
{ {
return base.style.controlHighlightColor return UM.Theme.getColor("setting_control_highlight")
} }
else else
{ {
return base.style.controlColor return UM.Theme.getColor("setting_control")
} }
} }
border.width: base.style.controlBorderWidth; border.width: UM.Theme.getSize("default_lining").width;
border.color: !enabled ? base.style.controlDisabledBorderColor : control.hovered ? base.style.controlBorderHighlightColor : base.style.controlBorderColor; 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: Item
{ {
Label Label
{ {
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: base.style.controlBorderWidth anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: downArrow.left; anchors.right: downArrow.left;
anchors.rightMargin: base.style.controlBorderWidth; anchors.rightMargin: UM.Theme.getSize("default_lining").width;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
text: control.currentText; text: control.currentText;
font: base.style.controlFont; font: UM.Theme.getFont("default");
color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor; color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
elide: Text.ElideRight; elide: Text.ElideRight;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
@ -69,7 +69,7 @@ SettingItem
{ {
id: downArrow id: downArrow
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: base.style.controlBorderWidth * 2; anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
source: UM.Theme.getIcon("arrow_bottom") source: UM.Theme.getIcon("arrow_bottom")
@ -78,7 +78,7 @@ SettingItem
sourceSize.width: width + 5 sourceSize.width: width + 5
sourceSize.height: 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; height: UM.Theme.getSize("section").height;
property alias contents: controlContainer.children property alias contents: controlContainer.children;
property bool hovered: false
signal contextMenuRequested() signal contextMenuRequested()
signal showTooltip(var position); signal showTooltip(string text);
signal hideTooltip(); signal hideTooltip();
MouseArea MouseArea
@ -49,7 +50,7 @@ Item {
interval: 500; interval: 500;
repeat: false; repeat: false;
onTriggered: base.showTooltip({ x: mouse.mouseX, y: mouse.mouseY }); onTriggered: base.showTooltip(definition.description);
} }
} }
@ -106,7 +107,7 @@ Item {
controlContainer.notifyReset(); 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: onExited:
{ {
if(controlContainer.item && controlContainer.item.hovered) if(controlContainer.item && controlContainer.item.hovered)
@ -140,7 +141,7 @@ Item {
iconSource: UM.Theme.getIcon("notice"); 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: { onExited: {
if(controlContainer.item && controlContainer.item.hovered) { if(controlContainer.item && controlContainer.item.hovered) {
@ -154,15 +155,16 @@ Item {
} }
Rectangle Item
{ {
id: controlContainer; id: controlContainer;
color: "red"
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
width: UM.Theme.getSize("setting_control").width; 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; property alias hovered: mouseArea.containsMouse;
border.width: base.style.controlBorderWidth; border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? base.style.controlDisabledBorderColor : hovered ? base.style.controlBorderHighlightColor : base.style.controlBorderColor 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 property variant parentValue: value //From parent loader
function notifyReset() { function notifyReset() {
input.text = format(parentValue) input.text = format(parentValue)
} }
// color: { color: {
// if (!enabled) if (!enabled)
// { {
// return base.style.controlDisabledColor return UM.Theme.getColor("setting_control_disabled")
// } }
// switch(definition.validationState) //From parent loader switch(definition.validationState)
// { {
// case 0: case 0:
// return base.style.validationErrorColor; return UM.Theme.getColor("setting_validation_error")
// case 1: case 1:
// return base.style.validationErrorColor; return UM.Theme.getColor("setting_validation_error")
// case 2: case 2:
// return base.style.validationErrorColor; return UM.Theme.getColor("setting_validation_error")
// case 3: case 3:
// return base.style.validationWarningColor; return UM.Theme.getColor("setting_validation_warning")
// case 4: case 4:
// return base.style.validationWarningColor; return UM.Theme.getColor("setting_validation_warning")
// case 5: case 5:
// return base.style.validationOkColor; return UM.Theme.getColor("setting_validation_ok")
//
// default: default:
// return base.style.controlTextColor; return UM.Theme.getColor("setting_control")
// } }
// } }
Rectangle Rectangle
{ {
anchors.fill: parent; anchors.fill: parent;
anchors.margins: base.style.controlBorderWidth; anchors.margins: UM.Theme.getSize("default_lining").width;
color: base.style.controlHighlightColor; color: UM.Theme.getColor("setting_control_highlight")
opacity: 0.35 opacity: 0.35
// opacity: !control.hovered ? 0 : valid == 5 ? 1.0 : 0.35; // opacity: !control.hovered ? 0 : valid == 5 ? 1.0 : 0.35;
} }
@ -63,12 +63,12 @@ SettingItem
Label Label
{ {
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: base.style.unitRightMargin; anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
text: definition.unit; text: definition.unit;
color: base.style.unitColor color: UM.Theme.getColor("setting_unit")
font: base.style.unitFont; font: UM.Theme.getFont("default")
} }
MouseArea MouseArea
@ -86,7 +86,7 @@ SettingItem
anchors anchors
{ {
left: parent.left left: parent.left
leftMargin: base.style.unitRightMargin leftMargin: UM.Theme.unitRightMargin
right: parent.right right: parent.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
@ -108,8 +108,8 @@ SettingItem
} }
} }
color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor; color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
font: base.style.controlFont; font: UM.Theme.getFont("default");
selectByMouse: true; selectByMouse: true;

View File

@ -4,10 +4,16 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import UM 1.2 as UM
SettingItem SettingItem
{ {
Label contents: Label
{ {
anchors.fill: parent
text: value + " " + unit; 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 UM 1.2 as UM
import ".."
ScrollView ScrollView
{ {
id: base; id: base;
@ -30,11 +32,14 @@ ScrollView
{ {
id: delegate id: delegate
width: ListView.view.width width: UM.Theme.getSize("sidebar").width;
height: UM.Theme.getSize("section").height;
property var definition: model property var definition: model
property var settingDefinitionsModel: definitionsModel property var settingDefinitionsModel: definitionsModel
asynchronous: true
source: source:
{ {
switch(model.type) switch(model.type)
@ -43,13 +48,11 @@ ScrollView
return "SettingTextField.qml" return "SettingTextField.qml"
case "float": case "float":
return "SettingTextField.qml" return "SettingTextField.qml"
case "double":
return "SettingTextField.qml"
case "enum": case "enum":
return "SettingComboBox.qml" return "SettingComboBox.qml"
case "boolean": case "bool":
return "SettingCheckBox.qml" return "SettingCheckBox.qml"
case "string": case "str":
return "SettingTextField.qml" return "SettingTextField.qml"
case "category": case "category":
return "SettingCategory.qml" return "SettingCategory.qml"
@ -62,12 +65,35 @@ ScrollView
{ {
target: item target: item
onContextMenuRequested: { contextMenu.key = model.key; contextMenu.popup() } 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"; } 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 Menu
{ {
id: contextMenu; id: contextMenu;
@ -85,7 +111,7 @@ ScrollView
//: Settings context menu action //: Settings context menu action
text: catalog.i18nc("@action:menu", "Configure setting visiblity..."); 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) function showTooltip(item, position, text)
{ {
tooltip.text = text; tooltip.text = text;
position = item.mapToItem(base, position.x, position.y / 2); position = item.mapToItem(base, position.x, position.y);
tooltip.show(position); tooltip.show(position);
} }
@ -247,7 +247,6 @@ Rectangle
id: sidebarAdvanced; id: sidebarAdvanced;
visible: false; visible: false;
configureSettings: base.configureSettingsAction;
onShowTooltip: base.showTooltip(item, location, text) onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip() onHideTooltip: base.hideTooltip()
} }

View File

@ -120,7 +120,7 @@ Item
} }
} }
onEntered: { onEntered: {
base.showTooltip(infillCellRight, Qt.point(-infillCellRight.x, parent.height), model.text); base.showTooltip(infillCellRight, Qt.point(-infillCellRight.x, 0), model.text);
} }
onExited: { onExited: {
base.hideTooltip(); base.hideTooltip();
@ -224,7 +224,7 @@ Item
onEntered: onEntered:
{ {
parent.hovered_ex = true 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.")); 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: onExited:
@ -257,7 +257,7 @@ Item
onEntered: onEntered:
{ {
parent.hovered_ex = true 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.")); 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: onExited:

View File

@ -31,7 +31,7 @@ UM.PointingRectangle {
y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height; y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height;
} }
base.opacity = 1; 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() { function hide() {

View File

@ -25,7 +25,7 @@ Item {
Repeater { Repeater {
id: repeat id: repeat
model: UM.Models.toolModel model: UM.ToolModel { }
Button { Button {
text: model.name 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 { property Component combobox: Component {
ComboBoxStyle { ComboBoxStyle {
background: Rectangle { background: Rectangle {