PrintMonitor.qml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. // Copyright (c) 2017 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import UM 1.2 as UM
  8. import Cura 1.0 as Cura
  9. Column
  10. {
  11. id: printMonitor
  12. property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
  13. Cura.ExtrudersModel
  14. {
  15. id: extrudersModel
  16. simpleNames: true
  17. }
  18. Rectangle
  19. {
  20. id: connectedPrinterHeader
  21. width: parent.width
  22. height: Math.floor(childrenRect.height + UM.Theme.getSize("default_margin").height * 2)
  23. color: UM.Theme.getColor("setting_category")
  24. Label
  25. {
  26. id: connectedPrinterNameLabel
  27. font: UM.Theme.getFont("large")
  28. color: UM.Theme.getColor("text")
  29. anchors.left: parent.left
  30. anchors.top: parent.top
  31. anchors.margins: UM.Theme.getSize("default_margin").width
  32. text: connectedPrinter != null ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected")
  33. }
  34. Label
  35. {
  36. id: connectedPrinterAddressLabel
  37. text: (connectedPrinter != null && connectedPrinter.address != null) ? connectedPrinter.address : ""
  38. font: UM.Theme.getFont("small")
  39. color: UM.Theme.getColor("text_inactive")
  40. anchors.top: parent.top
  41. anchors.right: parent.right
  42. anchors.margins: UM.Theme.getSize("default_margin").width
  43. }
  44. Label
  45. {
  46. text: connectedPrinter != null ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.")
  47. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  48. font: UM.Theme.getFont("very_small")
  49. wrapMode: Text.WordWrap
  50. anchors.left: parent.left
  51. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  52. anchors.right: parent.right
  53. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  54. anchors.top: connectedPrinterNameLabel.bottom
  55. }
  56. }
  57. Rectangle
  58. {
  59. color: UM.Theme.getColor("sidebar_lining")
  60. width: parent.width
  61. height: childrenRect.height
  62. Flow
  63. {
  64. id: extrudersGrid
  65. spacing: UM.Theme.getSize("sidebar_lining_thin").width
  66. width: parent.width
  67. Repeater
  68. {
  69. id: extrudersRepeater
  70. model: machineExtruderCount.properties.value
  71. delegate: Rectangle
  72. {
  73. id: extruderRectangle
  74. color: UM.Theme.getColor("sidebar")
  75. width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.floor(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
  76. height: UM.Theme.getSize("sidebar_extruder_box").height
  77. Label //Extruder name.
  78. {
  79. text: ExtruderManager.getExtruderName(index) != "" ? ExtruderManager.getExtruderName(index) : catalog.i18nc("@label", "Extruder")
  80. color: UM.Theme.getColor("text")
  81. font: UM.Theme.getFont("default")
  82. anchors.left: parent.left
  83. anchors.top: parent.top
  84. anchors.margins: UM.Theme.getSize("default_margin").width
  85. }
  86. Label //Target temperature.
  87. {
  88. id: extruderTargetTemperature
  89. text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.targetHotendTemperatures[index] != null) ? Math.round(connectedPrinter.targetHotendTemperatures[index]) + "°C" : ""
  90. font: UM.Theme.getFont("small")
  91. color: UM.Theme.getColor("text_inactive")
  92. anchors.right: parent.right
  93. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  94. anchors.bottom: extruderTemperature.bottom
  95. MouseArea //For tooltip.
  96. {
  97. id: extruderTargetTemperatureTooltipArea
  98. hoverEnabled: true
  99. anchors.fill: parent
  100. onHoveredChanged:
  101. {
  102. if (containsMouse)
  103. {
  104. base.showTooltip(
  105. base,
  106. {x: 0, y: extruderTargetTemperature.mapToItem(base, 0, -parent.height / 4).y},
  107. catalog.i18nc("@tooltip", "The target temperature of the hotend. The hotend will heat up or cool down towards this temperature. If this is 0, the hotend heating is turned off.")
  108. );
  109. }
  110. else
  111. {
  112. base.hideTooltip();
  113. }
  114. }
  115. }
  116. }
  117. Label //Temperature indication.
  118. {
  119. id: extruderTemperature
  120. text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.hotendTemperatures[index] != null) ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : ""
  121. color: UM.Theme.getColor("text")
  122. font: UM.Theme.getFont("large")
  123. anchors.right: extruderTargetTemperature.left
  124. anchors.top: parent.top
  125. anchors.margins: UM.Theme.getSize("default_margin").width
  126. MouseArea //For tooltip.
  127. {
  128. id: extruderTemperatureTooltipArea
  129. hoverEnabled: true
  130. anchors.fill: parent
  131. onHoveredChanged:
  132. {
  133. if (containsMouse)
  134. {
  135. base.showTooltip(
  136. base,
  137. {x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y},
  138. catalog.i18nc("@tooltip", "The current temperature of this extruder.")
  139. );
  140. }
  141. else
  142. {
  143. base.hideTooltip();
  144. }
  145. }
  146. }
  147. }
  148. Rectangle //Material colour indication.
  149. {
  150. id: materialColor
  151. width: Math.floor(materialName.height * 0.75)
  152. height: Math.floor(materialName.height * 0.75)
  153. radius: width / 2
  154. color: (connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialColors[index] : "#00000000"
  155. border.width: UM.Theme.getSize("default_lining").width
  156. border.color: UM.Theme.getColor("lining")
  157. visible: connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != ""
  158. anchors.left: parent.left
  159. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  160. anchors.verticalCenter: materialName.verticalCenter
  161. MouseArea //For tooltip.
  162. {
  163. id: materialColorTooltipArea
  164. hoverEnabled: true
  165. anchors.fill: parent
  166. onHoveredChanged:
  167. {
  168. if (containsMouse)
  169. {
  170. base.showTooltip(
  171. base,
  172. {x: 0, y: parent.mapToItem(base, 0, -parent.height / 2).y},
  173. catalog.i18nc("@tooltip", "The colour of the material in this extruder.")
  174. );
  175. }
  176. else
  177. {
  178. base.hideTooltip();
  179. }
  180. }
  181. }
  182. }
  183. Label //Material name.
  184. {
  185. id: materialName
  186. text: (connectedPrinter != null && connectedPrinter.materialNames[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialNames[index] : ""
  187. font: UM.Theme.getFont("default")
  188. color: UM.Theme.getColor("text")
  189. anchors.left: materialColor.right
  190. anchors.bottom: parent.bottom
  191. anchors.margins: UM.Theme.getSize("default_margin").width
  192. MouseArea //For tooltip.
  193. {
  194. id: materialNameTooltipArea
  195. hoverEnabled: true
  196. anchors.fill: parent
  197. onHoveredChanged:
  198. {
  199. if (containsMouse)
  200. {
  201. base.showTooltip(
  202. base,
  203. {x: 0, y: parent.mapToItem(base, 0, 0).y},
  204. catalog.i18nc("@tooltip", "The material in this extruder.")
  205. );
  206. }
  207. else
  208. {
  209. base.hideTooltip();
  210. }
  211. }
  212. }
  213. }
  214. Label //Variant name.
  215. {
  216. id: variantName
  217. text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null) ? connectedPrinter.hotendIds[index] : ""
  218. font: UM.Theme.getFont("default")
  219. color: UM.Theme.getColor("text")
  220. anchors.right: parent.right
  221. anchors.bottom: parent.bottom
  222. anchors.margins: UM.Theme.getSize("default_margin").width
  223. MouseArea //For tooltip.
  224. {
  225. id: variantNameTooltipArea
  226. hoverEnabled: true
  227. anchors.fill: parent
  228. onHoveredChanged:
  229. {
  230. if (containsMouse)
  231. {
  232. base.showTooltip(
  233. base,
  234. {x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y},
  235. catalog.i18nc("@tooltip", "The nozzle inserted in this extruder.")
  236. );
  237. }
  238. else
  239. {
  240. base.hideTooltip();
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. Rectangle
  250. {
  251. color: UM.Theme.getColor("sidebar_lining")
  252. width: parent.width
  253. height: UM.Theme.getSize("sidebar_lining_thin").width
  254. }
  255. Rectangle
  256. {
  257. color: UM.Theme.getColor("sidebar")
  258. width: parent.width
  259. height: machineHeatedBed.properties.value == "True" ? UM.Theme.getSize("sidebar_extruder_box").height : 0
  260. visible: machineHeatedBed.properties.value == "True"
  261. Label //Build plate label.
  262. {
  263. text: catalog.i18nc("@label", "Build plate")
  264. font: UM.Theme.getFont("default")
  265. color: UM.Theme.getColor("text")
  266. anchors.left: parent.left
  267. anchors.top: parent.top
  268. anchors.margins: UM.Theme.getSize("default_margin").width
  269. }
  270. Label //Target temperature.
  271. {
  272. id: bedTargetTemperature
  273. text: connectedPrinter != null ? connectedPrinter.targetBedTemperature + "°C" : ""
  274. font: UM.Theme.getFont("small")
  275. color: UM.Theme.getColor("text_inactive")
  276. anchors.right: parent.right
  277. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  278. anchors.bottom: bedCurrentTemperature.bottom
  279. MouseArea //For tooltip.
  280. {
  281. id: bedTargetTemperatureTooltipArea
  282. hoverEnabled: true
  283. anchors.fill: parent
  284. onHoveredChanged:
  285. {
  286. if (containsMouse)
  287. {
  288. base.showTooltip(
  289. base,
  290. {x: 0, y: bedTargetTemperature.mapToItem(base, 0, -parent.height / 4).y},
  291. catalog.i18nc("@tooltip", "The target temperature of the heated bed. The bed will heat up or cool down towards this temperature. If this is 0, the bed heating is turned off.")
  292. );
  293. }
  294. else
  295. {
  296. base.hideTooltip();
  297. }
  298. }
  299. }
  300. }
  301. Label //Current temperature.
  302. {
  303. id: bedCurrentTemperature
  304. text: connectedPrinter != null ? connectedPrinter.bedTemperature + "°C" : ""
  305. font: UM.Theme.getFont("large")
  306. color: UM.Theme.getColor("text")
  307. anchors.right: bedTargetTemperature.left
  308. anchors.top: parent.top
  309. anchors.margins: UM.Theme.getSize("default_margin").width
  310. MouseArea //For tooltip.
  311. {
  312. id: bedTemperatureTooltipArea
  313. hoverEnabled: true
  314. anchors.fill: parent
  315. onHoveredChanged:
  316. {
  317. if (containsMouse)
  318. {
  319. base.showTooltip(
  320. base,
  321. {x: 0, y: bedCurrentTemperature.mapToItem(base, 0, -parent.height / 4).y},
  322. catalog.i18nc("@tooltip", "The current temperature of the heated bed.")
  323. );
  324. }
  325. else
  326. {
  327. base.hideTooltip();
  328. }
  329. }
  330. }
  331. }
  332. Rectangle //Input field for pre-heat temperature.
  333. {
  334. id: preheatTemperatureControl
  335. color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok")
  336. property var showError:
  337. {
  338. if(bedTemperature.properties.maximum_value != "None" && bedTemperature.properties.maximum_value < Math.floor(preheatTemperatureInput.text))
  339. {
  340. return true;
  341. } else
  342. {
  343. return false;
  344. }
  345. }
  346. enabled:
  347. {
  348. if (connectedPrinter == null)
  349. {
  350. return false; //Can't preheat if not connected.
  351. }
  352. if (!connectedPrinter.acceptsCommands)
  353. {
  354. return false; //Not allowed to do anything.
  355. }
  356. if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "paused" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline")
  357. {
  358. return false; //Printer is in a state where it can't react to pre-heating.
  359. }
  360. return true;
  361. }
  362. border.width: UM.Theme.getSize("default_lining").width
  363. border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : preheatTemperatureInputMouseArea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
  364. anchors.left: parent.left
  365. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  366. anchors.bottom: parent.bottom
  367. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  368. width: UM.Theme.getSize("setting_control").width
  369. height: UM.Theme.getSize("setting_control").height
  370. visible: connectedPrinter != null ? connectedPrinter.canPreHeatBed: true
  371. Rectangle //Highlight of input field.
  372. {
  373. anchors.fill: parent
  374. anchors.margins: UM.Theme.getSize("default_lining").width
  375. color: UM.Theme.getColor("setting_control_highlight")
  376. opacity: preheatTemperatureControl.hovered ? 1.0 : 0
  377. }
  378. Label //Maximum temperature indication.
  379. {
  380. text: (bedTemperature.properties.maximum_value != "None" ? bedTemperature.properties.maximum_value : "") + "°C"
  381. color: UM.Theme.getColor("setting_unit")
  382. font: UM.Theme.getFont("default")
  383. anchors.right: parent.right
  384. anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
  385. anchors.verticalCenter: parent.verticalCenter
  386. }
  387. MouseArea //Change cursor on hovering.
  388. {
  389. id: preheatTemperatureInputMouseArea
  390. hoverEnabled: true
  391. anchors.fill: parent
  392. cursorShape: Qt.IBeamCursor
  393. onHoveredChanged:
  394. {
  395. if (containsMouse)
  396. {
  397. base.showTooltip(
  398. base,
  399. {x: 0, y: preheatTemperatureInputMouseArea.mapToItem(base, 0, 0).y},
  400. catalog.i18nc("@tooltip of temperature input", "The temperature to pre-heat the bed to.")
  401. );
  402. }
  403. else
  404. {
  405. base.hideTooltip();
  406. }
  407. }
  408. }
  409. TextInput
  410. {
  411. id: preheatTemperatureInput
  412. font: UM.Theme.getFont("default")
  413. color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
  414. selectByMouse: true
  415. maximumLength: 10
  416. enabled: parent.enabled
  417. validator: RegExpValidator { regExp: /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } //Floating point regex.
  418. anchors.left: parent.left
  419. anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
  420. anchors.right: parent.right
  421. anchors.verticalCenter: parent.verticalCenter
  422. renderType: Text.NativeRendering
  423. Component.onCompleted:
  424. {
  425. if (!bedTemperature.properties.value)
  426. {
  427. text = "";
  428. }
  429. if ((bedTemperature.resolve != "None" && bedTemperature.resolve) && (bedTemperature.stackLevels[0] != 0) && (bedTemperature.stackLevels[0] != 1))
  430. {
  431. // We have a resolve function. Indicates that the setting is not settable per extruder and that
  432. // we have to choose between the resolved value (default) and the global value
  433. // (if user has explicitly set this).
  434. text = bedTemperature.resolve;
  435. }
  436. else
  437. {
  438. text = bedTemperature.properties.value;
  439. }
  440. }
  441. }
  442. }
  443. UM.RecolorImage
  444. {
  445. id: preheatCountdownIcon
  446. width: UM.Theme.getSize("save_button_specs_icons").width
  447. height: UM.Theme.getSize("save_button_specs_icons").height
  448. sourceSize.width: width
  449. sourceSize.height: height
  450. color: UM.Theme.getColor("text")
  451. visible: preheatCountdown.visible
  452. source: UM.Theme.getIcon("print_time")
  453. anchors.right: preheatCountdown.left
  454. anchors.rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2)
  455. anchors.verticalCenter: preheatCountdown.verticalCenter
  456. }
  457. Timer
  458. {
  459. id: preheatUpdateTimer
  460. interval: 100 //Update every 100ms. You want to update every 1s, but then you have one timer for the updating running out of sync with the actual date timer and you might skip seconds.
  461. running: connectedPrinter != null && connectedPrinter.preheatBedRemainingTime != ""
  462. repeat: true
  463. onTriggered: update()
  464. property var endTime: new Date() //Set initial endTime to be the current date, so that the endTime has initially already passed and the timer text becomes invisible if you were to update.
  465. function update()
  466. {
  467. preheatCountdown.text = ""
  468. if (connectedPrinter != null)
  469. {
  470. preheatCountdown.text = connectedPrinter.preheatBedRemainingTime;
  471. }
  472. if (preheatCountdown.text == "") //Either time elapsed or not connected.
  473. {
  474. stop();
  475. }
  476. }
  477. }
  478. Label
  479. {
  480. id: preheatCountdown
  481. text: connectedPrinter != null ? connectedPrinter.preheatBedRemainingTime : ""
  482. visible: text != "" //Has no direct effect, but just so that we can link visibility of clock icon to visibility of the countdown text.
  483. font: UM.Theme.getFont("default")
  484. color: UM.Theme.getColor("text")
  485. anchors.right: preheatButton.left
  486. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  487. anchors.verticalCenter: preheatButton.verticalCenter
  488. }
  489. Button //The pre-heat button.
  490. {
  491. id: preheatButton
  492. height: UM.Theme.getSize("setting_control").height
  493. visible: connectedPrinter != null ? connectedPrinter.canPreHeatBed: true
  494. enabled:
  495. {
  496. if (!preheatTemperatureControl.enabled)
  497. {
  498. return false; //Not connected, not authenticated or printer is busy.
  499. }
  500. if (preheatUpdateTimer.running)
  501. {
  502. return true; //Can always cancel if the timer is running.
  503. }
  504. if (bedTemperature.properties.minimum_value != "None" && Math.floor(preheatTemperatureInput.text) < Math.floor(bedTemperature.properties.minimum_value))
  505. {
  506. return false; //Target temperature too low.
  507. }
  508. if (bedTemperature.properties.maximum_value != "None" && Math.floor(preheatTemperatureInput.text) > Math.floor(bedTemperature.properties.maximum_value))
  509. {
  510. return false; //Target temperature too high.
  511. }
  512. if (Math.floor(preheatTemperatureInput.text) == 0)
  513. {
  514. return false; //Setting the temperature to 0 is not allowed (since that cancels the pre-heating).
  515. }
  516. return true; //Preconditions are met.
  517. }
  518. anchors.right: parent.right
  519. anchors.bottom: parent.bottom
  520. anchors.margins: UM.Theme.getSize("default_margin").width
  521. style: ButtonStyle {
  522. background: Rectangle
  523. {
  524. border.width: UM.Theme.getSize("default_lining").width
  525. implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
  526. border.color:
  527. {
  528. if(!control.enabled)
  529. {
  530. return UM.Theme.getColor("action_button_disabled_border");
  531. }
  532. else if(control.pressed)
  533. {
  534. return UM.Theme.getColor("action_button_active_border");
  535. }
  536. else if(control.hovered)
  537. {
  538. return UM.Theme.getColor("action_button_hovered_border");
  539. }
  540. else
  541. {
  542. return UM.Theme.getColor("action_button_border");
  543. }
  544. }
  545. color:
  546. {
  547. if(!control.enabled)
  548. {
  549. return UM.Theme.getColor("action_button_disabled");
  550. }
  551. else if(control.pressed)
  552. {
  553. return UM.Theme.getColor("action_button_active");
  554. }
  555. else if(control.hovered)
  556. {
  557. return UM.Theme.getColor("action_button_hovered");
  558. }
  559. else
  560. {
  561. return UM.Theme.getColor("action_button");
  562. }
  563. }
  564. Behavior on color
  565. {
  566. ColorAnimation
  567. {
  568. duration: 50
  569. }
  570. }
  571. Label
  572. {
  573. id: actualLabel
  574. anchors.centerIn: parent
  575. color:
  576. {
  577. if(!control.enabled)
  578. {
  579. return UM.Theme.getColor("action_button_disabled_text");
  580. }
  581. else if(control.pressed)
  582. {
  583. return UM.Theme.getColor("action_button_active_text");
  584. }
  585. else if(control.hovered)
  586. {
  587. return UM.Theme.getColor("action_button_hovered_text");
  588. }
  589. else
  590. {
  591. return UM.Theme.getColor("action_button_text");
  592. }
  593. }
  594. font: UM.Theme.getFont("action_button")
  595. text: preheatUpdateTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat")
  596. }
  597. }
  598. }
  599. onClicked:
  600. {
  601. if (!preheatUpdateTimer.running)
  602. {
  603. connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout);
  604. preheatUpdateTimer.start();
  605. preheatUpdateTimer.update(); //Update once before the first timer is triggered.
  606. }
  607. else
  608. {
  609. connectedPrinter.cancelPreheatBed();
  610. preheatUpdateTimer.update();
  611. }
  612. }
  613. onHoveredChanged:
  614. {
  615. if (hovered)
  616. {
  617. base.showTooltip(
  618. base,
  619. {x: 0, y: preheatButton.mapToItem(base, 0, 0).y},
  620. catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.")
  621. );
  622. }
  623. else
  624. {
  625. base.hideTooltip();
  626. }
  627. }
  628. }
  629. }
  630. UM.SettingPropertyProvider
  631. {
  632. id: bedTemperature
  633. containerStackId: Cura.MachineManager.activeMachineId
  634. key: "material_bed_temperature"
  635. watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
  636. storeIndex: 0
  637. property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
  638. }
  639. UM.SettingPropertyProvider
  640. {
  641. id: machineExtruderCount
  642. containerStackId: Cura.MachineManager.activeMachineId
  643. key: "machine_extruder_count"
  644. watchedProperties: ["value"]
  645. }
  646. Loader
  647. {
  648. sourceComponent: monitorSection
  649. property string label: catalog.i18nc("@label", "Active print")
  650. }
  651. Loader
  652. {
  653. sourceComponent: monitorItem
  654. property string label: catalog.i18nc("@label", "Job Name")
  655. property string value: connectedPrinter != null ? connectedPrinter.jobName : ""
  656. }
  657. Loader
  658. {
  659. sourceComponent: monitorItem
  660. property string label: catalog.i18nc("@label", "Printing Time")
  661. property string value: connectedPrinter != null ? getPrettyTime(connectedPrinter.timeTotal) : ""
  662. }
  663. Loader
  664. {
  665. sourceComponent: monitorItem
  666. property string label: catalog.i18nc("@label", "Estimated time left")
  667. property string value: connectedPrinter != null ? getPrettyTime(connectedPrinter.timeTotal - connectedPrinter.timeElapsed) : ""
  668. visible: connectedPrinter != null && (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "paused")
  669. }
  670. Component
  671. {
  672. id: monitorItem
  673. Row
  674. {
  675. height: UM.Theme.getSize("setting_control").height
  676. width: Math.floor(base.width - 2 * UM.Theme.getSize("default_margin").width)
  677. anchors.left: parent.left
  678. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  679. Label
  680. {
  681. width: Math.floor(parent.width * 0.4)
  682. anchors.verticalCenter: parent.verticalCenter
  683. text: label
  684. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  685. font: UM.Theme.getFont("default")
  686. elide: Text.ElideRight
  687. }
  688. Label
  689. {
  690. width: Math.floor(parent.width * 0.6)
  691. anchors.verticalCenter: parent.verticalCenter
  692. text: value
  693. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  694. font: UM.Theme.getFont("default")
  695. elide: Text.ElideRight
  696. }
  697. }
  698. }
  699. Component
  700. {
  701. id: monitorSection
  702. Rectangle
  703. {
  704. color: UM.Theme.getColor("setting_category")
  705. width: base.width
  706. height: UM.Theme.getSize("section").height
  707. Label
  708. {
  709. anchors.verticalCenter: parent.verticalCenter
  710. anchors.left: parent.left
  711. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  712. text: label
  713. font: UM.Theme.getFont("setting_category")
  714. color: UM.Theme.getColor("setting_category_text")
  715. }
  716. }
  717. }
  718. }