mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 06:19:05 +08:00
CURA-4870 Create a customized popup for the sync dropdown and fill it out with the information about the printers in the group
This commit is contained in:
parent
3aa3729635
commit
6952e3f5c1
@ -7,39 +7,82 @@ import QtQuick.Controls 2.0
|
|||||||
import UM 1.2 as UM
|
import UM 1.2 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
ItemDelegate
|
Rectangle
|
||||||
{
|
{
|
||||||
contentItem: Label
|
id: configurationItem
|
||||||
{
|
|
||||||
text: model.name
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
color: UM.Theme.getColor("setting_control_text")
|
|
||||||
font: UM.Theme.getFont("default")
|
|
||||||
elide: Text.ElideRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
|
|
||||||
|
|
||||||
background: Rectangle
|
property var printer: null
|
||||||
{
|
signal configurationSelected()
|
||||||
id: swatch
|
|
||||||
height: Math.round(UM.Theme.getSize("setting_control").height / 2)
|
|
||||||
width: height
|
|
||||||
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
|
|
||||||
|
|
||||||
|
anchors.leftMargin: 25
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
|
border.color: "black"
|
||||||
radius: Math.round(width / 2)
|
|
||||||
|
|
||||||
color: model.color
|
Rectangle
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle
|
|
||||||
{
|
{
|
||||||
color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent"
|
id: printerInformation
|
||||||
border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent"
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: printer.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: extruderInformation
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: extrudersRow
|
||||||
|
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: printer.extruders
|
||||||
|
delegate: Item
|
||||||
|
{
|
||||||
|
id: extruderInfo
|
||||||
|
|
||||||
|
width: Math.round(parent.width / 2)
|
||||||
|
height: childrenRect.height
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: materialLabel
|
||||||
|
text: modelData.activeMaterial != null ? modelData.activeMaterial.name : ""
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: parent.width
|
||||||
|
font: UM.Theme.getFont("very_small")
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: printCoreLabel
|
||||||
|
text: modelData.hotendID
|
||||||
|
anchors.top: materialLabel.bottom
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: parent.width
|
||||||
|
font: UM.Theme.getFont("very_small")
|
||||||
|
opacity: 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rectangle
|
||||||
|
// {
|
||||||
|
// id: buildplateInformation
|
||||||
|
//
|
||||||
|
// Label
|
||||||
|
// {
|
||||||
|
// text: printer.name + "-" + printer.type
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
id: mouse
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: configurationSelected()
|
||||||
|
hoverEnabled: true
|
||||||
}
|
}
|
||||||
}
|
}
|
57
resources/qml/Menus/ConfigurationListView.qml
Normal file
57
resources/qml/Menus/ConfigurationListView.qml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
|
||||||
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
id: base
|
||||||
|
property var outputDevice: Cura.MachineManager.printerOutputDevices[0]
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: header
|
||||||
|
color: "red"
|
||||||
|
height: 25
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
height: childrenRect.height
|
||||||
|
model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : null
|
||||||
|
delegate: Rectangle
|
||||||
|
{
|
||||||
|
height: childrenRect.height
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: printerTypeHeader
|
||||||
|
text: modelData.machine_type
|
||||||
|
}
|
||||||
|
|
||||||
|
GridView
|
||||||
|
{
|
||||||
|
id: grid
|
||||||
|
anchors.top: printerTypeHeader.bottom
|
||||||
|
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
|
||||||
|
width: base.width
|
||||||
|
cellWidth: Math.round(base.width / 2)
|
||||||
|
cellHeight: 100 * screenScaleFactor
|
||||||
|
model: outputDevice.printers
|
||||||
|
delegate: ConfigurationItem
|
||||||
|
{
|
||||||
|
height: grid.cellHeight
|
||||||
|
width: grid.cellWidth
|
||||||
|
printer: modelData
|
||||||
|
onConfigurationSelected:
|
||||||
|
{
|
||||||
|
outputDevice.setActivePrinter(printer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,114 +2,94 @@
|
|||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls 2.3 as QQC2
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
import UM 1.2 as UM
|
import UM 1.2 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
ComboBox
|
Item
|
||||||
{
|
{
|
||||||
id: control
|
id: configurationSelector
|
||||||
|
|
||||||
property var panelWidth: control.width
|
property var panelWidth: control.width
|
||||||
|
property var panelVisible: false
|
||||||
model: ListModel {
|
Button
|
||||||
|
|
||||||
ListElement {
|
|
||||||
name: "Configuration 1"
|
|
||||||
color: "yellow"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
name: "Configuration 2"
|
|
||||||
color: "black"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
name: "Configuration 3"
|
|
||||||
color: "green"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
name: "Configuration 4"
|
|
||||||
color: "red"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
textRole: "name"
|
|
||||||
|
|
||||||
indicator: UM.RecolorImage
|
|
||||||
{
|
{
|
||||||
id: downArrow
|
text: "SYNC"
|
||||||
x: control.width - width - control.rightPadding
|
width: parent.width
|
||||||
y: control.topPadding + Math.round((control.availableHeight - height) / 2)
|
height: parent.height
|
||||||
|
|
||||||
source: UM.Theme.getIcon("arrow_bottom")
|
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
|
||||||
height: UM.Theme.getSize("standard_arrow").height
|
|
||||||
sourceSize.width: width + 5 * screenScaleFactor
|
|
||||||
sourceSize.height: width + 5 * screenScaleFactor
|
|
||||||
|
|
||||||
color: UM.Theme.getColor("setting_control_text");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
style: ButtonStyle
|
||||||
|
{
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
color:
|
color:
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if(control.pressed)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_disabled");
|
return UM.Theme.getColor("sidebar_header_active");
|
||||||
}
|
}
|
||||||
if (control.hovered || control.activeFocus)
|
else if(control.hovered)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_highlight");
|
return UM.Theme.getColor("sidebar_header_hover");
|
||||||
}
|
}
|
||||||
return UM.Theme.getColor("setting_control");
|
else
|
||||||
}
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
|
||||||
border.color:
|
|
||||||
{
|
{
|
||||||
if (!enabled)
|
return UM.Theme.getColor("sidebar_header_bar");
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control_disabled_border")
|
|
||||||
}
|
|
||||||
if (control.hovered || control.activeFocus)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control_border_highlight")
|
|
||||||
}
|
|
||||||
return UM.Theme.getColor("setting_control_border")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Behavior on color { ColorAnimation { duration: 50; } }
|
||||||
|
|
||||||
contentItem: Label
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
|
id: downArrow
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.left: parent.left
|
anchors.right: parent.right
|
||||||
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
anchors.right: downArrow.left
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
sourceSize.width: width
|
||||||
text: "HOLA"
|
sourceSize.height: width
|
||||||
renderType: Text.NativeRendering
|
color: UM.Theme.getColor("text_emphasis")
|
||||||
font: UM.Theme.getFont("default")
|
source: UM.Theme.getIcon("arrow_bottom")
|
||||||
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: sidebarComboBoxLabel
|
||||||
|
color: UM.Theme.getColor("sidebar_header_text_active")
|
||||||
|
text: control.text
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2
|
||||||
|
anchors.right: downArrow.left
|
||||||
|
anchors.rightMargin: control.rightMargin
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
font: UM.Theme.getFont("large")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
label: Label {}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup: Popup {
|
onClicked:
|
||||||
y: control.height - UM.Theme.getSize("default_lining").height
|
{
|
||||||
x: control.width - width
|
panelVisible = !panelVisible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.Popup
|
||||||
|
{
|
||||||
|
id: popup
|
||||||
|
y: configurationSelector.height - UM.Theme.getSize("default_lining").height
|
||||||
|
x: configurationSelector.width - width
|
||||||
width: panelWidth
|
width: panelWidth
|
||||||
implicitHeight: contentItem.implicitHeight
|
height: 300 //contentItem.height
|
||||||
|
visible: panelVisible
|
||||||
padding: UM.Theme.getSize("default_lining").width
|
padding: UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
contentItem: ListView {
|
contentItem: ConfigurationListView {
|
||||||
clip: true
|
width: panelWidth - 2 * UM.Theme.getSize("default_lining").width
|
||||||
implicitHeight: contentHeight
|
|
||||||
model: control.popup.visible ? control.delegateModel : null
|
|
||||||
currentIndex: control.highlightedIndex
|
|
||||||
|
|
||||||
ScrollIndicator.vertical: ScrollIndicator { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
@ -117,11 +97,4 @@ ComboBox
|
|||||||
border.color: UM.Theme.getColor("setting_control_border")
|
border.color: UM.Theme.getColor("setting_control_border")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: ConfigurationItem
|
|
||||||
{
|
|
||||||
width: panelWidth - 2 * UM.Theme.getSize("default_lining").width
|
|
||||||
height: control.height - 2 * UM.Theme.getSize("default_lining").height
|
|
||||||
highlighted: control.highlightedIndex == index
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user