mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 06:05:52 +08:00
15.10 restyling of the sidebar header
Not yet finished Contributes to: issue CURA-60
This commit is contained in:
parent
9fd5ea4f9f
commit
3df4d69c37
@ -8,96 +8,112 @@ import QtQuick.Layouts 1.1
|
|||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
Column
|
ColumnLayout
|
||||||
{
|
{
|
||||||
id: base;
|
id: base;
|
||||||
|
// Machine Setup
|
||||||
property variant modesModel;
|
property variant modesModel;
|
||||||
property alias currentModeIndex: modeMenu.currentIndex;
|
property alias currentModeIndex: modesList.currentIndex;
|
||||||
property Action addMachineAction;
|
property Action addMachineAction;
|
||||||
property Action configureMachinesAction;
|
property Action configureMachinesAction;
|
||||||
|
|
||||||
spacing: UM.Theme.sizes.default_margin.height;
|
|
||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
RowLayout
|
property int totalHeightHeader: childrenRect.height
|
||||||
{
|
spacing: 0
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
|
||||||
|
|
||||||
width: parent.width - UM.Theme.sizes.default_margin.width * 2;
|
Rectangle {
|
||||||
height: UM.Theme.sizes.line.height;
|
id: settingsModeRow
|
||||||
|
width: base.width
|
||||||
|
height: UM.Theme.sizes.sidebar_header.height
|
||||||
|
anchors.top: parent.top
|
||||||
|
color: UM.Theme.colors.sidebar_header_bar
|
||||||
|
|
||||||
Label
|
Label{
|
||||||
{
|
id: settingsModeLabel
|
||||||
//: Configuration mode label
|
text: catalog.i18nc("@label","Print setup: ");
|
||||||
text: catalog.i18nc("@label","Mode:");
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||||
font: UM.Theme.fonts.sidebar_header;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: UM.Theme.colors.text_inactive;
|
width: parent.width/100*45
|
||||||
|
font: UM.Theme.fonts.default;
|
||||||
|
color: UM.Theme.colors.text_white
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton
|
Rectangle{
|
||||||
{
|
id: settingsModeSelection
|
||||||
text: base.modesModel ? base.modesModel.get(modeMenu.currentIndex).text : "";
|
width: parent.width/100*55
|
||||||
|
height: childrenRect.height - UM.Theme.sizes.default_margin.width;
|
||||||
style: UM.Theme.styles.sidebar_header_button;
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.sizes.default_margin.width;
|
||||||
Layout.preferredWidth: base.width * 0.25;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
color: "red"
|
||||||
menu: Menu
|
Component{
|
||||||
{
|
id: wizardDelegate
|
||||||
id: modeMenu;
|
Button {
|
||||||
|
id: simpleModeButton
|
||||||
property int currentIndex: 0;
|
height: settingsModeSelection.height
|
||||||
|
anchors.left: parent.left
|
||||||
Instantiator
|
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
|
||||||
{
|
anchors.top: parent.top
|
||||||
model: base.modesModel;
|
width: parent.width / 2
|
||||||
|
text: model.text
|
||||||
MenuItem
|
style: ButtonStyle {
|
||||||
{
|
background: Rectangle {
|
||||||
text: model.text;
|
color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button
|
||||||
checkable: true;
|
Behavior on color { ColorAnimation { duration: 50; } }
|
||||||
checked: modeMenu.currentIndex == index;
|
Label {
|
||||||
exclusiveGroup: modeMenuGroup;
|
anchors.centerIn: parent
|
||||||
onTriggered: modeMenu.currentIndex = index;
|
color: UM.Theme.colors.load_save_button_text
|
||||||
|
font: UM.Theme.fonts.default
|
||||||
|
text: control.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
label: Item { }
|
||||||
}
|
}
|
||||||
onObjectAdded: modeMenu.insertItem(index, object)
|
|
||||||
onObjectRemoved: modeMenu.removeItem(object)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExclusiveGroup { id: modeMenuGroup; }
|
ListView{
|
||||||
|
id: modesList
|
||||||
|
property var index: 0
|
||||||
|
model: base.modesModel
|
||||||
|
delegate: wizardDelegate
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.sizes.sidebar_header.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle {
|
||||||
{
|
id: machineSelectionRow
|
||||||
width: 1;
|
width: base.width - (UM.Theme.sizes.default_margin.width * 2)
|
||||||
height: parent.height;
|
height: UM.Theme.sizes.sidebar_header.height
|
||||||
color: UM.Theme.colors.border;
|
anchors.top: settingsModeRow.bottom
|
||||||
}
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
Label
|
Label{
|
||||||
{
|
id: machineSelectionLabel
|
||||||
//: Machine selection label
|
//: Machine selection label
|
||||||
text: catalog.i18nc("@label","Machine:");
|
text: catalog.i18nc("@label","Machine:");
|
||||||
|
anchors.left: parent.left
|
||||||
font: UM.Theme.fonts.sidebar_header;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: UM.Theme.colors.text_inactive;
|
font: UM.Theme.fonts.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton
|
ToolButton {
|
||||||
{
|
id: machineSelection
|
||||||
id: machineButton;
|
|
||||||
text: UM.Application.machineName;
|
text: UM.Application.machineName;
|
||||||
|
width: parent.width/100*55
|
||||||
|
height: UM.Theme.sizes.sidebar_header.height
|
||||||
tooltip: UM.Application.machineName;
|
tooltip: UM.Application.machineName;
|
||||||
|
//style: UM.Theme.styles.sidebar_header_button;
|
||||||
style: UM.Theme.styles.sidebar_header_button;
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Layout.fillWidth: true;
|
|
||||||
|
|
||||||
menu: Menu
|
menu: Menu
|
||||||
{
|
{
|
||||||
id: machineMenu;
|
id: machineSelectionMenu
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
model: UM.Models.machinesModel
|
model: UM.Models.machinesModel
|
||||||
@ -113,7 +129,7 @@ Column
|
|||||||
onObjectRemoved: machineMenu.removeItem(object)
|
onObjectRemoved: machineMenu.removeItem(object)
|
||||||
}
|
}
|
||||||
|
|
||||||
ExclusiveGroup { id: machineMenuGroup; }
|
ExclusiveGroup { id: machineSelectionMenuGroup; }
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
@ -123,6 +139,40 @@ Column
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////tot hier
|
||||||
|
|
||||||
|
// ToolButton
|
||||||
|
// {
|
||||||
|
// text: base.modesModel ? base.modesModel.get(modeMenu.currentIndex).text : "";
|
||||||
|
//
|
||||||
|
// style: UM.Theme.styles.sidebar_header_button;
|
||||||
|
//
|
||||||
|
// menu: Menu
|
||||||
|
// {
|
||||||
|
// id: modeMenu;
|
||||||
|
//
|
||||||
|
// property int currentIndex: 0;
|
||||||
|
//
|
||||||
|
// Instantiator
|
||||||
|
// {
|
||||||
|
// model: base.modesModel;
|
||||||
|
//
|
||||||
|
// MenuItem
|
||||||
|
// {
|
||||||
|
// text: model.text;
|
||||||
|
// checkable: true;
|
||||||
|
// checked: modeMenu.currentIndex == index;
|
||||||
|
// exclusiveGroup: modeMenuGroup;
|
||||||
|
// onTriggered: modeMenu.currentIndex = index;
|
||||||
|
// }
|
||||||
|
// onObjectAdded: modeMenu.insertItem(index, object)
|
||||||
|
// onObjectRemoved: modeMenu.removeItem(object)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ExclusiveGroup { id: modeMenuGroup; }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
/*
|
||||||
UM.SidebarCategoryHeader
|
UM.SidebarCategoryHeader
|
||||||
{
|
{
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
@ -135,5 +185,5 @@ Column
|
|||||||
enabled: false;
|
enabled: false;
|
||||||
|
|
||||||
color: UM.Theme.colors.primary;
|
color: UM.Theme.colors.primary;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user