mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 23:35:57 +08:00
Go back to "Recommended/Custom" tabs
CURA-4146
This commit is contained in:
parent
1c747a962f
commit
3a22d1916f
@ -190,122 +190,15 @@ Rectangle
|
||||
}
|
||||
ExclusiveGroup { id: modeMenuGroup; }
|
||||
|
||||
Label
|
||||
ListView
|
||||
{
|
||||
id: toggleLeftText
|
||||
anchors.right: modeToggleSwitch.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: ""
|
||||
color:
|
||||
{
|
||||
if(toggleLeftTextMouseArea.containsMouse)
|
||||
{
|
||||
return UM.Theme.getColor("mode_switch_text_hover");
|
||||
}
|
||||
else if(!modeToggleSwitch.checked)
|
||||
{
|
||||
return UM.Theme.getColor("mode_switch_text_checked");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("mode_switch_text");
|
||||
}
|
||||
}
|
||||
font: UM.Theme.getFont("default")
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: toggleLeftTextMouseArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
modeToggleSwitch.checked = false;
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
clicked.connect(modeToggleSwitch.clicked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Switch
|
||||
{
|
||||
id: modeToggleSwitch
|
||||
checked: false
|
||||
anchors.right: toggleRightText.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
property bool _hovered: modeToggleSwitchMouseArea.containsMouse || toggleLeftTextMouseArea.containsMouse || toggleRightTextMouseArea.containsMouse
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: modeToggleSwitchMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
|
||||
onCheckedChanged:
|
||||
{
|
||||
var index = 0;
|
||||
if (checked)
|
||||
{
|
||||
index = 1;
|
||||
}
|
||||
updateActiveMode(index);
|
||||
}
|
||||
|
||||
function updateActiveMode(index)
|
||||
{
|
||||
base.currentModeIndex = index;
|
||||
UM.Preferences.setValue("cura/active_mode", index);
|
||||
}
|
||||
|
||||
style: UM.Theme.styles.mode_switch
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: toggleRightText
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: ""
|
||||
color:
|
||||
{
|
||||
if(toggleRightTextMouseArea.containsMouse)
|
||||
{
|
||||
return UM.Theme.getColor("mode_switch_text_hover");
|
||||
}
|
||||
else if(modeToggleSwitch.checked)
|
||||
{
|
||||
return UM.Theme.getColor("mode_switch_text_checked");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("mode_switch_text");
|
||||
}
|
||||
}
|
||||
font: UM.Theme.getFont("default")
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: toggleRightTextMouseArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
modeToggleSwitch.checked = true;
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
clicked.connect(modeToggleSwitch.clicked)
|
||||
}
|
||||
}
|
||||
id: modesList
|
||||
property var index: 0
|
||||
model: modesListModel
|
||||
delegate: wizardDelegate
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,14 +474,10 @@ Rectangle
|
||||
})
|
||||
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
||||
|
||||
toggleLeftText.text = modesListModel.get(0).text;
|
||||
toggleRightText.text = modesListModel.get(1).text;
|
||||
|
||||
var index = parseInt(UM.Preferences.getValue("cura/active_mode"));
|
||||
if (index)
|
||||
var index = parseInt(UM.Preferences.getValue("cura/active_mode"))
|
||||
if(index)
|
||||
{
|
||||
currentModeIndex = index;
|
||||
modeToggleSwitch.checked = index > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,37 +8,6 @@ import QtQuick.Controls.Styles 1.1
|
||||
import UM 1.1 as UM
|
||||
|
||||
QtObject {
|
||||
property Component info_button: Component {
|
||||
ButtonStyle {
|
||||
label: Text {
|
||||
renderType: Text.NativeRendering
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font: UM.Theme.getFont("small")
|
||||
color: UM.Theme.getColor("button_text")
|
||||
text: control.text
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
implicitHeight: UM.Theme.getSize("info_button").height
|
||||
implicitWidth: width
|
||||
border.width: 0
|
||||
radius: height * 0.5
|
||||
|
||||
color: {
|
||||
if (control.pressed) {
|
||||
return UM.Theme.getColor("button_active");
|
||||
} else if (control.hovered) {
|
||||
return UM.Theme.getColor("button_hover");
|
||||
} else {
|
||||
return UM.Theme.getColor("button");
|
||||
}
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Component mode_switch: Component {
|
||||
SwitchStyle {
|
||||
groove: Rectangle {
|
||||
|
@ -334,8 +334,6 @@
|
||||
|
||||
"infill_button_margin": [0.5, 0.5],
|
||||
|
||||
"jobspecs_line": [2.0, 2.0],
|
||||
|
||||
"info_button": [0.6, 0.6]
|
||||
"jobspecs_line": [2.0, 2.0]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user