mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 22:35:03 -06:00
Move mode-toggle out of header
Tweak tool-buttons and fonts
This commit is contained in:
parent
1ba1009b60
commit
64bd41e611
4 changed files with 117 additions and 86 deletions
|
@ -15,6 +15,7 @@ Rectangle
|
|||
property Action addMachineAction;
|
||||
property Action configureMachinesAction;
|
||||
property Action manageProfilesAction;
|
||||
property int currentModeIndex;
|
||||
|
||||
color: UM.Theme.colors.sidebar;
|
||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||
|
@ -49,18 +50,6 @@ Rectangle
|
|||
|
||||
addMachineAction: base.addMachineAction;
|
||||
configureMachinesAction: base.configureMachinesAction;
|
||||
modesModel: modesListModel;
|
||||
|
||||
currentModeIndex:
|
||||
{
|
||||
var index = parseInt(UM.Preferences.getValue("cura/active_mode"))
|
||||
if(index)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex);
|
||||
}
|
||||
|
||||
ProfileSetup {
|
||||
|
@ -71,16 +60,97 @@ Rectangle
|
|||
height: totalHeightProfileSetup
|
||||
}
|
||||
|
||||
currentModeIndex:
|
||||
{
|
||||
var index = parseInt(UM.Preferences.getValue("cura/active_mode"))
|
||||
if(index)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
onCurrentModeIndexChanged:
|
||||
{
|
||||
UM.Preferences.setValue("cura/active_mode", currentModeIndex);
|
||||
}
|
||||
|
||||
Label {
|
||||
id: settingsModeLabel
|
||||
text: catalog.i18nc("@label:listbox","Print Setup:");
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||
anchors.top: profileItem.bottom
|
||||
anchors.topMargin: UM.Theme.sizes.default_margin.height
|
||||
width: parent.width/100*45
|
||||
font: UM.Theme.fonts.default;
|
||||
color: UM.Theme.colors.text
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: settingsModeSelection
|
||||
width: parent.width/100*55
|
||||
height: UM.Theme.sizes.sidebar_header_mode_toggle.height
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.sizes.default_margin.width
|
||||
anchors.top: profileItem.bottom
|
||||
anchors.topMargin: UM.Theme.sizes.default_margin.height
|
||||
Component{
|
||||
id: wizardDelegate
|
||||
Button {
|
||||
height: settingsModeSelection.height
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width / 2
|
||||
text: model.text
|
||||
exclusiveGroup: modeMenuGroup;
|
||||
checkable: true;
|
||||
checked: base.currentModeIndex == index
|
||||
onClicked: base.currentModeIndex = index
|
||||
style: ButtonStyle {
|
||||
background: Rectangle {
|
||||
border.color: control.checked ? UM.Theme.colors.toggle_checked_border :
|
||||
control.pressed ? UM.Theme.colors.toggle_active_border :
|
||||
control.hovered ? UM.Theme.colors.toggle_hovered_border : UM.Theme.colors.toggle_unchecked_border
|
||||
color: control.checked ? UM.Theme.colors.toggle_checked :
|
||||
control.pressed ? UM.Theme.colors.toggle_active :
|
||||
control.hovered ? UM.Theme.colors.toggle_hovered : UM.Theme.colors.toggle_unchecked
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
color: control.checked ? UM.Theme.colors.toggle_checked_text :
|
||||
control.pressed ? UM.Theme.colors.toggle_active_text :
|
||||
control.hovered ? UM.Theme.colors.toggle_hovered_text : UM.Theme.colors.toggle_unchecked_text
|
||||
font: UM.Theme.fonts.default
|
||||
text: control.text;
|
||||
}
|
||||
}
|
||||
label: Item { }
|
||||
}
|
||||
}
|
||||
}
|
||||
ExclusiveGroup { id: modeMenuGroup; }
|
||||
ListView{
|
||||
id: modesList
|
||||
property var index: 0
|
||||
model: modesListModel
|
||||
delegate: wizardDelegate
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
id: sidebarContents;
|
||||
anchors.bottom: saveButton.top
|
||||
anchors.top: profileItem.bottom
|
||||
anchors.top: settingsModeSelection.bottom
|
||||
anchors.topMargin: UM.Theme.sizes.default_margin.height
|
||||
anchors.left: base.left
|
||||
anchors.right: base.right
|
||||
|
||||
source: modesListModel.count > header.currentModeIndex ? modesListModel.get(header.currentModeIndex).file : "";
|
||||
source: modesListModel.count > base.currentModeIndex ? modesListModel.get(base.currentModeIndex).file : "";
|
||||
|
||||
property Item sidebar: base;
|
||||
|
||||
|
@ -123,6 +193,6 @@ Rectangle
|
|||
{
|
||||
modesListModel.append({ text: catalog.i18nc("@title:tab", "Simple"), file: "SidebarSimple.qml" })
|
||||
modesListModel.append({ text: catalog.i18nc("@title:tab", "Advanced"), file: "SidebarAdvanced.qml" })
|
||||
sidebarContents.setSource(modesListModel.get(header.currentModeIndex).file)
|
||||
sidebarContents.setSource(modesListModel.get(base.currentModeIndex).file)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue