Update styling and functionality of sidebar in cura

This commit is contained in:
Arjen Hiemstra 2015-04-01 12:09:31 +02:00
parent 39b795073a
commit b782095f60
3 changed files with 96 additions and 75 deletions

View file

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="14"
height="7"
viewBox="0 0 14 7"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="down_arrow.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.4"
inkscape:cx="10.962659"
inkscape:cy="9.0480669"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:window-width="1869"
inkscape:window-height="1167"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid4136" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1045.3622)">
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 0,1045.3622 7,7 7,-7 z"
id="path4138"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -8,11 +8,14 @@ QtObject {
property Component sidebar_header_button: Component {
ButtonStyle {
background: Item {
Image {
Label {
anchors.right: parent.right;
anchors.verticalCenter: parent.verticalCenter;
anchors.top: parent.top;
source: UM.Theme.icons.down_arrow;
text: "▼";
property bool down: control.pressed || (control.checkable && control.checked);
color: down ? UM.Theme.colors.text_pressed : control.hovered ? UM.Theme.colors.text_hover : UM.Theme.colors.text;
}
}
@ -35,6 +38,7 @@ QtObject {
implicitWidth: UM.Theme.sizes.button.width;
implicitHeight: UM.Theme.sizes.button.height;
color: down ? UM.Theme.colors.button_down : control.hovered ? UM.Theme.colors.button_hover : UM.Theme.colors.button;
Behavior on color { ColorAnimation { duration: 50; } }
cornerSize: UM.Theme.sizes.default_margin.width;
}
@ -52,11 +56,23 @@ QtObject {
}
}
property Component category: Component {
property Component sidebar_category: Component {
ButtonStyle {
background: UM.AngledCornerRectangle {
property bool down: control.pressed || (control.checkable && control.checked);
color: down ? UM.Theme.colors.button_down : control.hovered ? UM.Theme.colors.button_hover : UM.Theme.colors.button;
implicitHeight: UM.Theme.sizes.section.height;
color: {
if(!control.enabled) {
return UM.Theme.colors.button_disabled;
} else if(down) {
return UM.Theme.colors.button_down;
} else if(control.hovered) {
return UM.Theme.colors.button_hover;
} else {
return UM.Theme.colors.button;
}
}
Behavior on color { ColorAnimation { duration: 50; } }
cornerSize: UM.Theme.sizes.default_margin.width;
}
label: Row {
@ -68,4 +84,53 @@ QtObject {
}
}
}
property Component scrollview: Component {
ScrollViewStyle {
decrementControl: Item { }
incrementControl: Item { }
scrollBarBackground: UM.AngledCornerRectangle {
implicitWidth: UM.Theme.sizes.scrollbar.width;
cornerSize: UM.Theme.sizes.scrollbar.width;
color: UM.Theme.colors.scrollbar_background;
}
handle: UM.AngledCornerRectangle {
implicitWidth: UM.Theme.sizes.scrollbar.width;
cornerSize: UM.Theme.sizes.scrollbar.width;
color: styleData.pressed ? UM.Theme.colors.scrollbar_handle_down : styleData.hovered ? UM.Theme.colors.scrollbar_handle_hover : UM.Theme.colors.scrollbar_handle;
Behavior on color { ColorAnimation { duration: 50; } }
}
}
}
property variant setting_item: UM.SettingItemStyle {
labelFont: UM.Theme.fonts.default;
labelColor: UM.Theme.colors.setting_label;
spacing: UM.Theme.sizes.default_margin.width;
fixedHeight: UM.Theme.sizes.setting.height;
controlWidth: UM.Theme.sizes.setting_control.width;
controlRightMargin: UM.Theme.sizes.setting_control_margin.width;
controlBorderWidth: 1;
controlColor: UM.Theme.colors.setting_control;
controlHighlightColor: UM.Theme.colors.setting_control_highlight;
controlBorderColor: UM.Theme.colors.setting_control_border;
controlTextColor: UM.Theme.colors.setting_control_text;
controlFont: UM.Theme.fonts.default;
validationErrorColor: Qt.rgba(1.0, 0.0, 0.0, 1.0);
validationWarningColor: Qt.rgba(1.0, 1.0, 0.0, 1.0);
validationOkColor: Qt.rgba(1.0, 1.0, 1.0, 1.0);
unitRightMargin: UM.Theme.sizes.setting_unit_margin.width;
unitColor: UM.Theme.colors.setting_unit;
unitFont: UM.Theme.fonts.default;
}
}

View file

@ -37,19 +37,42 @@
"button": [205, 202, 201, 255],
"button_hover": [174, 174, 174, 255],
"button_down": [12, 169, 227, 255],
"button_text": [255, 255, 255, 255]
"button_text": [255, 255, 255, 255],
"button_disabled": [12, 169, 227, 255],
"scrollbar_background": [245, 245, 245, 255],
"scrollbar_handle": [205, 202, 201, 255],
"scrollbar_handle_hover": [174, 174, 174, 255],
"scrollbar_handle_down": [12, 159, 227, 255],
"setting_label": [174, 174, 174, 255],
"setting_control": [255, 255, 255, 255],
"setting_control_highlight": [245, 245, 245, 255],
"setting_control_border": [174, 174, 174, 255],
"setting_control_text": [35, 35, 35, 255],
"setting_control_hover": [35, 35, 35, 255],
"setting_unit": [174, 174, 174, 255]
},
"sizes": {
"toolbar_button": [2.0, 2.0],
"window_margin": [2.0, 2.0],
"default_margin": [1.0, 1.0],
"panel": [22.0, 10.0],
"toolbar_button": [2.0, 2.0],
"toolbar_spacing": [1.0, 1.0],
"section": [22.0, 3.0],
"section_icon": [2.14, 2.14],
"section_text_margin": [0.33, 0.33],
"setting": [21.0, 2.0],
"setting_control": [6.0, 2.0],
"setting_control_margin": [3.0, 3.0],
"setting_unit_margin": [0.5, 0.5],
"button": [4.25, 4.25],
"button_icon": [3.57, 3.57]
"button_icon": [3.57, 3.57],
"scrollbar": [0.5, 0.5]
}
}