mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 22:45:53 +08:00
Merge branch 'CURA-4146' of github.com:Ultimaker/Cura
This commit is contained in:
commit
d5daf9ff81
@ -190,122 +190,15 @@ Rectangle
|
|||||||
}
|
}
|
||||||
ExclusiveGroup { id: modeMenuGroup; }
|
ExclusiveGroup { id: modeMenuGroup; }
|
||||||
|
|
||||||
Label
|
ListView
|
||||||
{
|
{
|
||||||
id: toggleLeftText
|
id: modesList
|
||||||
anchors.right: modeToggleSwitch.left
|
property var index: 0
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
model: modesListModel
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
delegate: wizardDelegate
|
||||||
text: ""
|
anchors.top: parent.top
|
||||||
color:
|
anchors.left: parent.left
|
||||||
{
|
width: parent.width
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,14 +474,10 @@ Rectangle
|
|||||||
})
|
})
|
||||||
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
||||||
|
|
||||||
toggleLeftText.text = modesListModel.get(0).text;
|
var index = parseInt(UM.Preferences.getValue("cura/active_mode"))
|
||||||
toggleRightText.text = modesListModel.get(1).text;
|
if(index)
|
||||||
|
|
||||||
var index = parseInt(UM.Preferences.getValue("cura/active_mode"));
|
|
||||||
if (index)
|
|
||||||
{
|
{
|
||||||
currentModeIndex = index;
|
currentModeIndex = index;
|
||||||
modeToggleSwitch.checked = index > 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,37 +8,6 @@ import QtQuick.Controls.Styles 1.1
|
|||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
QtObject {
|
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 {
|
property Component mode_switch: Component {
|
||||||
SwitchStyle {
|
SwitchStyle {
|
||||||
groove: Rectangle {
|
groove: Rectangle {
|
||||||
|
@ -334,8 +334,6 @@
|
|||||||
|
|
||||||
"infill_button_margin": [0.5, 0.5],
|
"infill_button_margin": [0.5, 0.5],
|
||||||
|
|
||||||
"jobspecs_line": [2.0, 2.0],
|
"jobspecs_line": [2.0, 2.0]
|
||||||
|
|
||||||
"info_button": [0.6, 0.6]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user