styles.qml 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.1
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import UM 1.1 as UM
  7. QtObject
  8. {
  9. property Component sidebar_header_button: Component
  10. {
  11. ButtonStyle
  12. {
  13. background: Rectangle
  14. {
  15. color:
  16. {
  17. if(control.enabled)
  18. {
  19. if(control.valueError)
  20. {
  21. return Theme.getColor("setting_validation_error_background");
  22. }
  23. else if(control.valueWarning)
  24. {
  25. return Theme.getColor("setting_validation_warning_background");
  26. }
  27. else
  28. {
  29. return Theme.getColor("setting_control");
  30. }
  31. }
  32. else
  33. {
  34. return Theme.getColor("setting_control_disabled");
  35. }
  36. }
  37. border.width: Theme.getSize("default_lining").width
  38. border.color:
  39. {
  40. if (control.enabled)
  41. {
  42. if (control.valueError)
  43. {
  44. return Theme.getColor("setting_validation_error");
  45. }
  46. else if (control.valueWarning)
  47. {
  48. return Theme.getColor("setting_validation_warning");
  49. }
  50. else if (control.hovered)
  51. {
  52. return Theme.getColor("setting_control_border_highlight");
  53. }
  54. else
  55. {
  56. return Theme.getColor("setting_control_border");
  57. }
  58. }
  59. else
  60. {
  61. return Theme.getColor("setting_control_disabled_border");
  62. }
  63. }
  64. UM.RecolorImage
  65. {
  66. id: downArrow
  67. anchors.verticalCenter: parent.verticalCenter
  68. anchors.right: parent.right
  69. anchors.rightMargin: Theme.getSize("default_margin").width
  70. width: Theme.getSize("standard_arrow").width
  71. height: Theme.getSize("standard_arrow").height
  72. sourceSize.width: width
  73. sourceSize.height: width
  74. color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text")
  75. source: Theme.getIcon("arrow_bottom")
  76. }
  77. Label
  78. {
  79. id: sidebarComboBoxLabel
  80. color: control.enabled ? Theme.getColor("setting_control_text") : Theme.getColor("setting_control_disabled_text")
  81. text: control.text;
  82. elide: Text.ElideRight;
  83. anchors.left: parent.left;
  84. anchors.leftMargin: Theme.getSize("setting_unit_margin").width
  85. anchors.right: downArrow.left;
  86. anchors.rightMargin: control.rightMargin;
  87. anchors.verticalCenter: parent.verticalCenter;
  88. font: Theme.getFont("default")
  89. }
  90. }
  91. label: Label{}
  92. }
  93. }
  94. property Component main_window_header_tab: Component
  95. {
  96. ButtonStyle
  97. {
  98. // This property will be back-propagated when the width of the label is calculated
  99. property var buttonWidth: 0
  100. background: Item
  101. {
  102. implicitHeight: control.height
  103. implicitWidth: buttonWidth
  104. Rectangle
  105. {
  106. id: buttonFace
  107. implicitHeight: parent.height
  108. implicitWidth: parent.width
  109. radius: UM.Theme.getSize("action_button_radius").width
  110. color:
  111. {
  112. if (control.checked)
  113. {
  114. return UM.Theme.getColor("main_window_header_button_background_active")
  115. }
  116. else
  117. {
  118. if (control.hovered)
  119. {
  120. return UM.Theme.getColor("main_window_header_button_background_hovered")
  121. }
  122. return UM.Theme.getColor("main_window_header_button_background_inactive")
  123. }
  124. }
  125. }
  126. }
  127. label: Item
  128. {
  129. id: contents
  130. anchors.horizontalCenter: parent.horizontalCenter
  131. anchors.verticalCenter: parent.verticalCenter
  132. height: control.height
  133. width: buttonLabel.width + 4 * UM.Theme.getSize("default_margin").width
  134. Label
  135. {
  136. id: buttonLabel
  137. text: control.text
  138. anchors.verticalCenter: parent.verticalCenter
  139. anchors.horizontalCenter: parent.horizontalCenter
  140. font: UM.Theme.getFont("medium_bold")
  141. color:
  142. {
  143. if (control.checked)
  144. {
  145. return UM.Theme.getColor("main_window_header_button_text_active")
  146. }
  147. else
  148. {
  149. if (control.hovered)
  150. {
  151. return UM.Theme.getColor("main_window_header_button_text_hovered")
  152. }
  153. return UM.Theme.getColor("main_window_header_button_text_inactive")
  154. }
  155. }
  156. }
  157. Component.onCompleted:
  158. {
  159. buttonWidth = width
  160. }
  161. }
  162. }
  163. }
  164. property Component tool_button: Component
  165. {
  166. ButtonStyle
  167. {
  168. background: Item
  169. {
  170. implicitWidth: Theme.getSize("button").width;
  171. implicitHeight: Theme.getSize("button").height;
  172. UM.PointingRectangle
  173. {
  174. id: button_tooltip
  175. anchors.left: parent.right
  176. anchors.leftMargin: Theme.getSize("button_tooltip_arrow").width * 2
  177. anchors.verticalCenter: parent.verticalCenter
  178. target: Qt.point(parent.x, y + Math.round(height/2))
  179. arrowSize: Theme.getSize("button_tooltip_arrow").width
  180. color: Theme.getColor("button_tooltip")
  181. opacity: control.hovered ? 1.0 : 0.0;
  182. visible: control.text != ""
  183. width: control.hovered ? button_tip.width + Theme.getSize("button_tooltip").width : 0
  184. height: Theme.getSize("button_tooltip").height
  185. Behavior on width { NumberAnimation { duration: 100; } }
  186. Behavior on opacity { NumberAnimation { duration: 100; } }
  187. Label
  188. {
  189. id: button_tip
  190. anchors.horizontalCenter: parent.horizontalCenter
  191. anchors.verticalCenter: parent.verticalCenter;
  192. text: control.text;
  193. font: Theme.getFont("button_tooltip");
  194. color: Theme.getColor("tooltip_text");
  195. }
  196. }
  197. Rectangle
  198. {
  199. id: buttonFace;
  200. anchors.fill: parent;
  201. property bool down: control.pressed || (control.checkable && control.checked);
  202. color:
  203. {
  204. if(control.customColor !== undefined && control.customColor !== null)
  205. {
  206. return control.customColor
  207. }
  208. else if(control.checkable && control.checked && control.hovered)
  209. {
  210. return Theme.getColor("button_active_hover");
  211. }
  212. else if(control.pressed || (control.checkable && control.checked))
  213. {
  214. return Theme.getColor("button_active");
  215. }
  216. else if(control.hovered)
  217. {
  218. return Theme.getColor("button_hover");
  219. }
  220. else
  221. {
  222. return Theme.getColor("button");
  223. }
  224. }
  225. Behavior on color { ColorAnimation { duration: 50; } }
  226. border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
  227. border.color: Theme.getColor("tool_button_border")
  228. UM.RecolorImage
  229. {
  230. id: tool_button_arrow
  231. anchors.right: parent.right;
  232. anchors.rightMargin: Theme.getSize("button").width - Math.round(Theme.getSize("button_icon").width / 4)
  233. anchors.bottom: parent.bottom;
  234. anchors.bottomMargin: Theme.getSize("button").height - Math.round(Theme.getSize("button_icon").height / 4)
  235. width: Theme.getSize("standard_arrow").width
  236. height: Theme.getSize("standard_arrow").height
  237. sourceSize.width: width
  238. sourceSize.height: width
  239. visible: control.menu != null;
  240. color:
  241. {
  242. if(control.checkable && control.checked && control.hovered)
  243. {
  244. return Theme.getColor("button_text_active_hover");
  245. }
  246. else if(control.pressed || (control.checkable && control.checked))
  247. {
  248. return Theme.getColor("button_text_active");
  249. }
  250. else if(control.hovered)
  251. {
  252. return Theme.getColor("button_text_hover");
  253. }
  254. else
  255. {
  256. return Theme.getColor("button_text");
  257. }
  258. }
  259. source: Theme.getIcon("arrow_bottom")
  260. }
  261. }
  262. }
  263. label: Item
  264. {
  265. UM.RecolorImage
  266. {
  267. anchors.centerIn: parent;
  268. opacity: !control.enabled ? 0.2 : 1.0
  269. source: control.iconSource;
  270. width: Theme.getSize("button_icon").width;
  271. height: Theme.getSize("button_icon").height;
  272. color:
  273. {
  274. if(control.checkable && control.checked && control.hovered)
  275. {
  276. return Theme.getColor("button_text_active_hover");
  277. }
  278. else if(control.pressed || (control.checkable && control.checked))
  279. {
  280. return Theme.getColor("button_text_active");
  281. }
  282. else if(control.hovered)
  283. {
  284. return Theme.getColor("button_text_hover");
  285. }
  286. else
  287. {
  288. return Theme.getColor("button_text");
  289. }
  290. }
  291. sourceSize: Theme.getSize("button_icon")
  292. }
  293. }
  294. }
  295. }
  296. property Component small_tool_button: Component
  297. {
  298. ButtonStyle
  299. {
  300. background: Item
  301. {
  302. implicitWidth: Theme.getSize("small_button").width;
  303. implicitHeight: Theme.getSize("small_button").height;
  304. Rectangle
  305. {
  306. id: smallButtonFace;
  307. anchors.fill: parent;
  308. property bool down: control.pressed || (control.checkable && control.checked);
  309. color:
  310. {
  311. if(control.customColor !== undefined && control.customColor !== null)
  312. {
  313. return control.customColor
  314. }
  315. else if(control.checkable && control.checked && control.hovered)
  316. {
  317. return Theme.getColor("small_button_active_hover");
  318. }
  319. else if(control.pressed || (control.checkable && control.checked))
  320. {
  321. return Theme.getColor("small_button_active");
  322. }
  323. else if(control.hovered)
  324. {
  325. return Theme.getColor("small_button_hover");
  326. }
  327. else
  328. {
  329. return Theme.getColor("small_button");
  330. }
  331. }
  332. Behavior on color { ColorAnimation { duration: 50; } }
  333. border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
  334. border.color: Theme.getColor("tool_button_border")
  335. UM.RecolorImage
  336. {
  337. id: smallToolButtonArrow
  338. width: 5
  339. height: 5
  340. sourceSize.width: 5
  341. sourceSize.height: 5
  342. visible: control.menu != null;
  343. color:
  344. {
  345. if(control.checkable && control.checked && control.hovered)
  346. {
  347. return Theme.getColor("small_button_text_active_hover");
  348. }
  349. else if(control.pressed || (control.checkable && control.checked))
  350. {
  351. return Theme.getColor("small_button_text_active");
  352. }
  353. else if(control.hovered)
  354. {
  355. return Theme.getColor("small_button_text_hover");
  356. }
  357. else
  358. {
  359. return Theme.getColor("small_button_text");
  360. }
  361. }
  362. source: Theme.getIcon("arrow_bottom")
  363. }
  364. }
  365. }
  366. label: Item
  367. {
  368. UM.RecolorImage
  369. {
  370. anchors.centerIn: parent
  371. opacity: !control.enabled ? 0.2 : 1.0
  372. source: control.iconSource;
  373. width: Theme.getSize("small_button_icon").width
  374. height: Theme.getSize("small_button_icon").height
  375. color:
  376. {
  377. if(control.checkable && control.checked && control.hovered)
  378. {
  379. return Theme.getColor("small_button_text_active_hover");
  380. }
  381. else if(control.pressed || (control.checkable && control.checked))
  382. {
  383. return Theme.getColor("small_button_text_active");
  384. }
  385. else if(control.hovered)
  386. {
  387. return Theme.getColor("small_button_text_hover");
  388. }
  389. else
  390. {
  391. return Theme.getColor("small_button_text");
  392. }
  393. }
  394. sourceSize: Theme.getSize("small_button_icon")
  395. }
  396. }
  397. }
  398. }
  399. property Component progressbar: Component
  400. {
  401. ProgressBarStyle
  402. {
  403. background: Rectangle
  404. {
  405. implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2)
  406. implicitHeight: Theme.getSize("progressbar").height
  407. color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : Theme.getColor("progressbar_background")
  408. }
  409. progress: Rectangle
  410. {
  411. color:
  412. {
  413. if(control.indeterminate)
  414. {
  415. return "transparent";
  416. }
  417. else if(control.hasOwnProperty("controlColor"))
  418. {
  419. return control.controlColor;
  420. }
  421. else
  422. {
  423. return Theme.getColor("progressbar_control");
  424. }
  425. }
  426. radius: Theme.getSize("progressbar_radius").width
  427. Rectangle
  428. {
  429. radius: Theme.getSize("progressbar_radius").width
  430. color: control.hasOwnProperty("controlColor") ? control.controlColor : Theme.getColor("progressbar_control")
  431. width: Theme.getSize("progressbar_control").width
  432. height: Theme.getSize("progressbar_control").height
  433. visible: control.indeterminate
  434. SequentialAnimation on x
  435. {
  436. id: xAnim
  437. property int animEndPoint: Theme.getSize("message").width - Math.round((Theme.getSize("default_margin").width * 2.5)) - Theme.getSize("progressbar_control").width
  438. running: control.indeterminate && control.visible
  439. loops: Animation.Infinite
  440. NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;}
  441. NumberAnimation { from: xAnim.animEndPoint; to: 0; duration: 2000;}
  442. }
  443. }
  444. }
  445. }
  446. }
  447. property Component sidebar_category: Component
  448. {
  449. ButtonStyle
  450. {
  451. background: Rectangle
  452. {
  453. anchors.fill: parent
  454. anchors.left: parent.left
  455. anchors.leftMargin: Theme.getSize("thick_margin").width
  456. anchors.right: parent.right
  457. anchors.rightMargin: Theme.getSize("thick_margin").width
  458. implicitHeight: Theme.getSize("section").height
  459. color:
  460. {
  461. if(control.color)
  462. {
  463. return control.color;
  464. }
  465. else if(!control.enabled)
  466. {
  467. return Theme.getColor("setting_category_disabled");
  468. }
  469. else if(control.hovered && control.checkable && control.checked)
  470. {
  471. return Theme.getColor("setting_category_active_hover");
  472. }
  473. else if(control.pressed || (control.checkable && control.checked))
  474. {
  475. return Theme.getColor("setting_category_active");
  476. }
  477. else if(control.hovered)
  478. {
  479. return Theme.getColor("setting_category_hover");
  480. }
  481. else
  482. {
  483. return Theme.getColor("setting_category");
  484. }
  485. }
  486. Behavior on color { ColorAnimation { duration: 50; } }
  487. Rectangle
  488. {
  489. height: Theme.getSize("default_lining").height
  490. width: parent.width
  491. anchors.bottom: parent.bottom
  492. color:
  493. {
  494. if(!control.enabled)
  495. {
  496. return Theme.getColor("setting_category_disabled_border");
  497. }
  498. else if((control.hovered || control.activeFocus) && control.checkable && control.checked)
  499. {
  500. return Theme.getColor("setting_category_active_hover_border");
  501. }
  502. else if(control.pressed || (control.checkable && control.checked))
  503. {
  504. return Theme.getColor("setting_category_active_border");
  505. }
  506. else if(control.hovered || control.activeFocus)
  507. {
  508. return Theme.getColor("setting_category_hover_border");
  509. }
  510. else
  511. {
  512. return Theme.getColor("setting_category_border");
  513. }
  514. }
  515. }
  516. }
  517. label: Item
  518. {
  519. anchors.fill: parent
  520. anchors.left: parent.left
  521. Item
  522. {
  523. id: icon
  524. anchors.left: parent.left
  525. height: parent.height
  526. width: Theme.getSize("section_icon_column").width
  527. UM.RecolorImage
  528. {
  529. anchors.verticalCenter: parent.verticalCenter
  530. anchors.left: parent.left
  531. anchors.leftMargin: Theme.getSize("thick_margin").width
  532. color:
  533. {
  534. if(!control.enabled)
  535. {
  536. return Theme.getColor("setting_category_disabled_text");
  537. }
  538. else if((control.hovered || control.activeFocus) && control.checkable && control.checked)
  539. {
  540. return Theme.getColor("setting_category_active_hover_text");
  541. }
  542. else if(control.pressed || (control.checkable && control.checked))
  543. {
  544. return Theme.getColor("setting_category_active_text");
  545. }
  546. else if(control.hovered || control.activeFocus)
  547. {
  548. return Theme.getColor("setting_category_hover_text");
  549. }
  550. else
  551. {
  552. return Theme.getColor("setting_category_text");
  553. }
  554. }
  555. source: control.iconSource;
  556. width: Theme.getSize("section_icon").width;
  557. height: Theme.getSize("section_icon").height;
  558. sourceSize.width: width + 15 * screenScaleFactor
  559. sourceSize.height: width + 15 * screenScaleFactor
  560. }
  561. }
  562. Label
  563. {
  564. anchors
  565. {
  566. left: icon.right
  567. leftMargin: Theme.getSize("default_margin").width
  568. right: parent.right
  569. verticalCenter: parent.verticalCenter
  570. }
  571. text: control.text
  572. font: Theme.getFont("setting_category")
  573. color:
  574. {
  575. if(!control.enabled)
  576. {
  577. return Theme.getColor("setting_category_disabled_text");
  578. }
  579. else if((control.hovered || control.activeFocus) && control.checkable && control.checked)
  580. {
  581. return Theme.getColor("setting_category_active_hover_text");
  582. }
  583. else if(control.pressed || (control.checkable && control.checked))
  584. {
  585. return Theme.getColor("setting_category_active_text");
  586. }
  587. else if(control.hovered || control.activeFocus)
  588. {
  589. return Theme.getColor("setting_category_hover_text");
  590. }
  591. else
  592. {
  593. return Theme.getColor("setting_category_text");
  594. }
  595. }
  596. fontSizeMode: Text.HorizontalFit
  597. minimumPointSize: 8
  598. }
  599. UM.RecolorImage
  600. {
  601. id: category_arrow
  602. anchors.verticalCenter: parent.verticalCenter
  603. anchors.right: parent.right
  604. anchors.rightMargin: Theme.getSize("default_margin").width * 3 - Math.round(width / 2)
  605. width: Theme.getSize("standard_arrow").width
  606. height: Theme.getSize("standard_arrow").height
  607. sourceSize.width: width
  608. sourceSize.height: width
  609. color:
  610. {
  611. if(!control.enabled)
  612. {
  613. return Theme.getColor("setting_category_disabled_text");
  614. }
  615. else if((control.hovered || control.activeFocus) && control.checkable && control.checked)
  616. {
  617. return Theme.getColor("setting_category_active_hover_text");
  618. }
  619. else if(control.pressed || (control.checkable && control.checked))
  620. {
  621. return Theme.getColor("setting_category_active_text");
  622. }
  623. else if(control.hovered || control.activeFocus)
  624. {
  625. return Theme.getColor("setting_category_hover_text");
  626. }
  627. else
  628. {
  629. return Theme.getColor("setting_category_text");
  630. }
  631. }
  632. source: control.checked ? Theme.getIcon("arrow_bottom") : Theme.getIcon("arrow_left")
  633. }
  634. }
  635. }
  636. }
  637. property Component scrollview: Component
  638. {
  639. ScrollViewStyle
  640. {
  641. decrementControl: Item { }
  642. incrementControl: Item { }
  643. transientScrollBars: false
  644. scrollBarBackground: Rectangle
  645. {
  646. implicitWidth: Theme.getSize("scrollbar").width
  647. radius: Math.round(implicitWidth / 2)
  648. color: Theme.getColor("scrollbar_background");
  649. }
  650. handle: Rectangle
  651. {
  652. id: scrollViewHandle
  653. implicitWidth: Theme.getSize("scrollbar").width;
  654. radius: Math.round(implicitWidth / 2)
  655. color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle");
  656. Behavior on color { ColorAnimation { duration: 50; } }
  657. }
  658. }
  659. }
  660. property Component combobox: Component
  661. {
  662. ComboBoxStyle
  663. {
  664. background: Rectangle
  665. {
  666. implicitHeight: Theme.getSize("setting_control").height;
  667. implicitWidth: Theme.getSize("setting_control").width;
  668. color: control.hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control")
  669. Behavior on color { ColorAnimation { duration: 50; } }
  670. border.width: Theme.getSize("default_lining").width;
  671. border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
  672. }
  673. label: Item
  674. {
  675. Label
  676. {
  677. anchors.left: parent.left
  678. anchors.leftMargin: Theme.getSize("default_lining").width
  679. anchors.right: downArrow.left
  680. anchors.rightMargin: Theme.getSize("default_lining").width
  681. anchors.verticalCenter: parent.verticalCenter
  682. text: control.currentText
  683. font: Theme.getFont("default");
  684. color: !enabled ? Theme.getColor("setting_control_disabled_text") : Theme.getColor("setting_control_text")
  685. elide: Text.ElideRight
  686. verticalAlignment: Text.AlignVCenter
  687. }
  688. UM.RecolorImage
  689. {
  690. id: downArrow
  691. anchors.right: parent.right
  692. anchors.rightMargin: Theme.getSize("default_lining").width * 2
  693. anchors.verticalCenter: parent.verticalCenter
  694. source: Theme.getIcon("arrow_bottom")
  695. width: Theme.getSize("standard_arrow").width
  696. height: Theme.getSize("standard_arrow").height
  697. sourceSize.width: width + 5 * screenScaleFactor
  698. sourceSize.height: width + 5 * screenScaleFactor
  699. color: Theme.getColor("setting_control_text");
  700. }
  701. }
  702. }
  703. }
  704. // Combobox with items with colored rectangles
  705. property Component combobox_color: Component
  706. {
  707. ComboBoxStyle
  708. {
  709. background: Rectangle
  710. {
  711. color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control")
  712. border.width: UM.Theme.getSize("default_lining").width
  713. border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
  714. }
  715. label: Item
  716. {
  717. Label
  718. {
  719. anchors.left: parent.left
  720. anchors.leftMargin: UM.Theme.getSize("default_lining").width
  721. anchors.right: swatch.left
  722. anchors.rightMargin: UM.Theme.getSize("default_lining").width
  723. anchors.verticalCenter: parent.verticalCenter
  724. text: control.currentText
  725. font: UM.Theme.getFont("default")
  726. color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
  727. elide: Text.ElideRight
  728. verticalAlignment: Text.AlignVCenter
  729. }
  730. Rectangle
  731. {
  732. id: swatch
  733. height: Math.round(UM.Theme.getSize("setting_control").height / 2)
  734. width: height
  735. anchors.right: downArrow.left
  736. anchors.verticalCenter: parent.verticalCenter
  737. anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
  738. radius: Math.round(width / 2)
  739. border.width: UM.Theme.getSize("default_lining").width
  740. border.color: UM.Theme.getColor("lining")
  741. color: (control.color_override !== "") ? control.color_override : control.color
  742. }
  743. UM.RecolorImage
  744. {
  745. id: downArrow
  746. anchors.right: parent.right
  747. anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
  748. anchors.verticalCenter: parent.verticalCenter
  749. source: UM.Theme.getIcon("arrow_bottom")
  750. width: UM.Theme.getSize("standard_arrow").width
  751. height: UM.Theme.getSize("standard_arrow").height
  752. sourceSize.width: width + 5 * screenScaleFactor
  753. sourceSize.height: width + 5 * screenScaleFactor
  754. color: UM.Theme.getColor("setting_control_text")
  755. }
  756. }
  757. }
  758. }
  759. property Component checkbox: Component
  760. {
  761. CheckBoxStyle
  762. {
  763. background: Item { }
  764. indicator: Rectangle
  765. {
  766. implicitWidth: Theme.getSize("checkbox").width
  767. implicitHeight: Theme.getSize("checkbox").height
  768. color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox")
  769. Behavior on color { ColorAnimation { duration: 50; } }
  770. radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0
  771. border.width: Theme.getSize("default_lining").width
  772. border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border")
  773. UM.RecolorImage
  774. {
  775. anchors.verticalCenter: parent.verticalCenter
  776. anchors.horizontalCenter: parent.horizontalCenter
  777. width: Math.round(parent.width / 2.5)
  778. height: Math.round(parent.height / 2.5)
  779. sourceSize.width: width
  780. sourceSize.height: width
  781. color: Theme.getColor("checkbox_mark")
  782. source: control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check")
  783. opacity: control.checked
  784. Behavior on opacity { NumberAnimation { duration: 100; } }
  785. }
  786. }
  787. label: Label
  788. {
  789. text: control.text
  790. color: Theme.getColor("checkbox_text")
  791. font: Theme.getFont("default")
  792. elide: Text.ElideRight
  793. }
  794. }
  795. }
  796. property Component partially_checkbox: Component
  797. {
  798. CheckBoxStyle
  799. {
  800. background: Item { }
  801. indicator: Rectangle
  802. {
  803. implicitWidth: Theme.getSize("checkbox").width
  804. implicitHeight: Theme.getSize("checkbox").height
  805. color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox");
  806. Behavior on color { ColorAnimation { duration: 50; } }
  807. radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0
  808. border.width: Theme.getSize("default_lining").width;
  809. border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
  810. UM.RecolorImage
  811. {
  812. anchors.verticalCenter: parent.verticalCenter
  813. anchors.horizontalCenter: parent.horizontalCenter
  814. width: Math.round(parent.width / 2.5)
  815. height: Math.round(parent.height / 2.5)
  816. sourceSize.width: width
  817. sourceSize.height: width
  818. color: Theme.getColor("checkbox_mark")
  819. source:
  820. {
  821. if (control.checkbox_state == 2)
  822. {
  823. return Theme.getIcon("solid");
  824. }
  825. else
  826. {
  827. return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check");
  828. }
  829. }
  830. opacity: control.checked
  831. Behavior on opacity { NumberAnimation { duration: 100; } }
  832. }
  833. }
  834. label: Label
  835. {
  836. text: control.text
  837. color: Theme.getColor("checkbox_text")
  838. font: Theme.getFont("default")
  839. }
  840. }
  841. }
  842. property Component text_field: Component
  843. {
  844. TextFieldStyle
  845. {
  846. textColor: Theme.getColor("setting_control_text")
  847. placeholderTextColor: Theme.getColor("setting_control_text")
  848. font: Theme.getFont("default")
  849. background: Rectangle
  850. {
  851. implicitHeight: control.height;
  852. implicitWidth: control.width;
  853. border.width: Theme.getSize("default_lining").width;
  854. border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
  855. color: Theme.getColor("setting_validation_ok");
  856. Label
  857. {
  858. anchors.right: parent.right;
  859. anchors.rightMargin: Theme.getSize("setting_unit_margin").width;
  860. anchors.verticalCenter: parent.verticalCenter;
  861. text: control.unit ? control.unit : ""
  862. color: Theme.getColor("setting_unit");
  863. font: Theme.getFont("default");
  864. }
  865. }
  866. }
  867. }
  868. property Component sidebar_action_button: Component
  869. {
  870. ButtonStyle
  871. {
  872. background: Rectangle
  873. {
  874. border.width: UM.Theme.getSize("default_lining").width
  875. border.color:
  876. {
  877. if(!control.enabled)
  878. {
  879. return UM.Theme.getColor("action_button_disabled_border");
  880. }
  881. else if(control.pressed)
  882. {
  883. return UM.Theme.getColor("action_button_active_border");
  884. }
  885. else if(control.hovered)
  886. {
  887. return UM.Theme.getColor("action_button_hovered_border");
  888. }
  889. else
  890. {
  891. return UM.Theme.getColor("action_button_border");
  892. }
  893. }
  894. color:
  895. {
  896. if(!control.enabled)
  897. {
  898. return UM.Theme.getColor("action_button_disabled");
  899. }
  900. else if(control.pressed)
  901. {
  902. return UM.Theme.getColor("action_button_active");
  903. }
  904. else if(control.hovered)
  905. {
  906. return UM.Theme.getColor("action_button_hovered");
  907. }
  908. else
  909. {
  910. return UM.Theme.getColor("action_button");
  911. }
  912. }
  913. Behavior on color { ColorAnimation { duration: 50 } }
  914. implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2)
  915. Label
  916. {
  917. id: actualLabel
  918. anchors.centerIn: parent
  919. color:
  920. {
  921. if(!control.enabled)
  922. {
  923. return UM.Theme.getColor("action_button_disabled_text");
  924. }
  925. else if(control.pressed)
  926. {
  927. return UM.Theme.getColor("action_button_active_text");
  928. }
  929. else if(control.hovered)
  930. {
  931. return UM.Theme.getColor("action_button_hovered_text");
  932. }
  933. else
  934. {
  935. return UM.Theme.getColor("action_button_text");
  936. }
  937. }
  938. font: UM.Theme.getFont("action_button")
  939. text: control.text
  940. }
  941. }
  942. label: Item { }
  943. }
  944. }
  945. property Component toolbox_action_button: Component
  946. {
  947. ButtonStyle
  948. {
  949. background: Rectangle
  950. {
  951. implicitWidth: UM.Theme.getSize("toolbox_action_button").width
  952. implicitHeight: UM.Theme.getSize("toolbox_action_button").height
  953. color:
  954. {
  955. if (control.installed)
  956. {
  957. return UM.Theme.getColor("action_button_disabled");
  958. }
  959. else
  960. {
  961. if (control.hovered)
  962. {
  963. return UM.Theme.getColor("primary_hover");
  964. }
  965. else
  966. {
  967. return UM.Theme.getColor("primary");
  968. }
  969. }
  970. }
  971. }
  972. label: Label
  973. {
  974. text: control.text
  975. color:
  976. {
  977. if (control.installed)
  978. {
  979. return UM.Theme.getColor("action_button_disabled_text");
  980. }
  981. else
  982. {
  983. if (control.hovered)
  984. {
  985. return UM.Theme.getColor("button_text_hover");
  986. }
  987. else
  988. {
  989. return UM.Theme.getColor("button_text");
  990. }
  991. }
  992. }
  993. verticalAlignment: Text.AlignVCenter
  994. horizontalAlignment: Text.AlignHCenter
  995. font: UM.Theme.getFont("default_bold")
  996. }
  997. }
  998. }
  999. }