PrintMonitor.qml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. // Copyright (c) 2017 Ultimaker B.V.
  2. // Cura is released under the terms of the AGPLv3 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: childrenRect.height + UM.Theme.getSize("default_margin").height * 2
  23. color: UM.Theme.getColor("setting_category")
  24. Text
  25. {
  26. id: connectedPrinterNameLabel
  27. text: connectedPrinter != null ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected")
  28. font: UM.Theme.getFont("large")
  29. color: UM.Theme.getColor("text")
  30. anchors.left: parent.left
  31. anchors.top: parent.top
  32. anchors.margins: UM.Theme.getSize("default_margin").width
  33. }
  34. Text
  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. Text
  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 : extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2
  76. height: UM.Theme.getSize("sidebar_extruder_box").height
  77. Text //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. Text //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. Text //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: materialName.height * 0.75
  152. height: materialName.height * 0.75
  153. color: (connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialColors[index] : "#00000000"
  154. border.width: UM.Theme.getSize("default_lining").width
  155. border.color: UM.Theme.getColor("lining")
  156. visible: connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != ""
  157. anchors.left: parent.left
  158. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  159. anchors.verticalCenter: materialName.verticalCenter
  160. MouseArea //For tooltip.
  161. {
  162. id: materialColorTooltipArea
  163. hoverEnabled: true
  164. anchors.fill: parent
  165. onHoveredChanged:
  166. {
  167. if (containsMouse)
  168. {
  169. base.showTooltip(
  170. base,
  171. {x: 0, y: parent.mapToItem(base, 0, -parent.height / 2).y},
  172. catalog.i18nc("@tooltip", "The colour of the material in this extruder.")
  173. );
  174. }
  175. else
  176. {
  177. base.hideTooltip();
  178. }
  179. }
  180. }
  181. }
  182. Text //Material name.
  183. {
  184. id: materialName
  185. text: (connectedPrinter != null && connectedPrinter.materialNames[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialNames[index] : ""
  186. font: UM.Theme.getFont("default")
  187. color: UM.Theme.getColor("text")
  188. anchors.left: materialColor.right
  189. anchors.bottom: parent.bottom
  190. anchors.margins: UM.Theme.getSize("default_margin").width
  191. MouseArea //For tooltip.
  192. {
  193. id: materialNameTooltipArea
  194. hoverEnabled: true
  195. anchors.fill: parent
  196. onHoveredChanged:
  197. {
  198. if (containsMouse)
  199. {
  200. base.showTooltip(
  201. base,
  202. {x: 0, y: parent.mapToItem(base, 0, 0).y},
  203. catalog.i18nc("@tooltip", "The material in this extruder.")
  204. );
  205. }
  206. else
  207. {
  208. base.hideTooltip();
  209. }
  210. }
  211. }
  212. }
  213. Text //Variant name.
  214. {
  215. id: variantName
  216. text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null) ? connectedPrinter.hotendIds[index] : ""
  217. font: UM.Theme.getFont("default")
  218. color: UM.Theme.getColor("text")
  219. anchors.right: parent.right
  220. anchors.bottom: parent.bottom
  221. anchors.margins: UM.Theme.getSize("default_margin").width
  222. MouseArea //For tooltip.
  223. {
  224. id: variantNameTooltipArea
  225. hoverEnabled: true
  226. anchors.fill: parent
  227. onHoveredChanged:
  228. {
  229. if (containsMouse)
  230. {
  231. base.showTooltip(
  232. base,
  233. {x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y},
  234. catalog.i18nc("@tooltip", "The nozzle inserted in this extruder.")
  235. );
  236. }
  237. else
  238. {
  239. base.hideTooltip();
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. Rectangle
  249. {
  250. color: UM.Theme.getColor("sidebar_lining")
  251. width: parent.width
  252. height: UM.Theme.getSize("sidebar_lining_thin").width
  253. }
  254. Rectangle
  255. {
  256. color: UM.Theme.getColor("sidebar")
  257. width: parent.width
  258. height: machineHeatedBed.properties.value == "True" ? UM.Theme.getSize("sidebar_extruder_box").height : 0
  259. visible: machineHeatedBed.properties.value == "True"
  260. Text //Build plate label.
  261. {
  262. text: catalog.i18nc("@label", "Build plate")
  263. font: UM.Theme.getFont("default")
  264. color: UM.Theme.getColor("text")
  265. anchors.left: parent.left
  266. anchors.top: parent.top
  267. anchors.margins: UM.Theme.getSize("default_margin").width
  268. }
  269. Text //Target temperature.
  270. {
  271. id: bedTargetTemperature
  272. text: connectedPrinter != null ? connectedPrinter.targetBedTemperature + "°C" : ""
  273. font: UM.Theme.getFont("small")
  274. color: UM.Theme.getColor("text_inactive")
  275. anchors.right: parent.right
  276. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  277. anchors.bottom: bedCurrentTemperature.bottom
  278. MouseArea //For tooltip.
  279. {
  280. id: bedTargetTemperatureTooltipArea
  281. hoverEnabled: true
  282. anchors.fill: parent
  283. onHoveredChanged:
  284. {
  285. if (containsMouse)
  286. {
  287. base.showTooltip(
  288. base,
  289. {x: 0, y: bedTargetTemperature.mapToItem(base, 0, -parent.height / 4).y},
  290. 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.")
  291. );
  292. }
  293. else
  294. {
  295. base.hideTooltip();
  296. }
  297. }
  298. }
  299. }
  300. Text //Current temperature.
  301. {
  302. id: bedCurrentTemperature
  303. text: connectedPrinter != null ? connectedPrinter.bedTemperature + "°C" : ""
  304. font: UM.Theme.getFont("large")
  305. color: UM.Theme.getColor("text")
  306. anchors.right: bedTargetTemperature.left
  307. anchors.top: parent.top
  308. anchors.margins: UM.Theme.getSize("default_margin").width
  309. MouseArea //For tooltip.
  310. {
  311. id: bedTemperatureTooltipArea
  312. hoverEnabled: true
  313. anchors.fill: parent
  314. onHoveredChanged:
  315. {
  316. if (containsMouse)
  317. {
  318. base.showTooltip(
  319. base,
  320. {x: 0, y: bedCurrentTemperature.mapToItem(base, 0, -parent.height / 4).y},
  321. catalog.i18nc("@tooltip", "The current temperature of the heated bed.")
  322. );
  323. }
  324. else
  325. {
  326. base.hideTooltip();
  327. }
  328. }
  329. }
  330. }
  331. Rectangle //Input field for pre-heat temperature.
  332. {
  333. id: preheatTemperatureControl
  334. color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok")
  335. property var showError:
  336. {
  337. if(bedTemperature.properties.maximum_value != "None" && bedTemperature.properties.maximum_value < parseInt(preheatTemperatureInput.text))
  338. {
  339. return true;
  340. } else
  341. {
  342. return false;
  343. }
  344. }
  345. enabled:
  346. {
  347. if (connectedPrinter == null)
  348. {
  349. return false; //Can't preheat if not connected.
  350. }
  351. if (!connectedPrinter.acceptsCommands)
  352. {
  353. return false; //Not allowed to do anything.
  354. }
  355. if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "paused" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline")
  356. {
  357. return false; //Printer is in a state where it can't react to pre-heating.
  358. }
  359. return true;
  360. }
  361. border.width: UM.Theme.getSize("default_lining").width
  362. 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")
  363. anchors.left: parent.left
  364. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  365. anchors.bottom: parent.bottom
  366. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  367. width: UM.Theme.getSize("setting_control").width
  368. height: UM.Theme.getSize("setting_control").height
  369. visible: connectedPrinter != null ? connectedPrinter.canPreHeatBed: true
  370. Rectangle //Highlight of input field.
  371. {
  372. anchors.fill: parent
  373. anchors.margins: UM.Theme.getSize("default_lining").width
  374. color: UM.Theme.getColor("setting_control_highlight")
  375. opacity: preheatTemperatureControl.hovered ? 1.0 : 0
  376. }
  377. Text //Maximum temperature indication.
  378. {
  379. text: (bedTemperature.properties.maximum_value != "None" ? bedTemperature.properties.maximum_value : "") + "°C"
  380. color: UM.Theme.getColor("setting_unit")
  381. font: UM.Theme.getFont("default")
  382. anchors.right: parent.right
  383. anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
  384. anchors.verticalCenter: parent.verticalCenter
  385. }
  386. MouseArea //Change cursor on hovering.
  387. {
  388. id: preheatTemperatureInputMouseArea
  389. hoverEnabled: true
  390. anchors.fill: parent
  391. cursorShape: Qt.IBeamCursor
  392. onHoveredChanged:
  393. {
  394. if (containsMouse)
  395. {
  396. base.showTooltip(
  397. base,
  398. {x: 0, y: preheatTemperatureInputMouseArea.mapToItem(base, 0, 0).y},
  399. catalog.i18nc("@tooltip of temperature input", "The temperature to pre-heat the bed to.")
  400. );
  401. }
  402. else
  403. {
  404. base.hideTooltip();
  405. }
  406. }
  407. }
  408. TextInput
  409. {
  410. id: preheatTemperatureInput
  411. font: UM.Theme.getFont("default")
  412. color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
  413. selectByMouse: true
  414. maximumLength: 10
  415. enabled: parent.enabled
  416. validator: RegExpValidator { regExp: /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } //Floating point regex.
  417. anchors.left: parent.left
  418. anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
  419. anchors.right: parent.right
  420. anchors.verticalCenter: parent.verticalCenter
  421. Component.onCompleted:
  422. {
  423. if ((bedTemperature.resolve != "None" && bedTemperature.resolve) && (bedTemperature.stackLevels[0] != 0) && (bedTemperature.stackLevels[0] != 1))
  424. {
  425. // We have a resolve function. Indicates that the setting is not settable per extruder and that
  426. // we have to choose between the resolved value (default) and the global value
  427. // (if user has explicitly set this).
  428. text = bedTemperature.resolve;
  429. }
  430. else
  431. {
  432. text = bedTemperature.properties.value;
  433. }
  434. }
  435. }
  436. }
  437. UM.RecolorImage
  438. {
  439. id: preheatCountdownIcon
  440. width: UM.Theme.getSize("save_button_specs_icons").width
  441. height: UM.Theme.getSize("save_button_specs_icons").height
  442. sourceSize.width: width
  443. sourceSize.height: height
  444. color: UM.Theme.getColor("text")
  445. visible: preheatCountdown.visible
  446. source: UM.Theme.getIcon("print_time")
  447. anchors.right: preheatCountdown.left
  448. anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2
  449. anchors.verticalCenter: preheatCountdown.verticalCenter
  450. }
  451. Timer
  452. {
  453. id: preheatUpdateTimer
  454. 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.
  455. running: connectedPrinter != null && connectedPrinter.preheatBedRemainingTime != ""
  456. repeat: true
  457. onTriggered: update()
  458. 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.
  459. function update()
  460. {
  461. preheatCountdown.text = ""
  462. if (connectedPrinter != null)
  463. {
  464. preheatCountdown.text = connectedPrinter.preheatBedRemainingTime;
  465. }
  466. if (preheatCountdown.text == "") //Either time elapsed or not connected.
  467. {
  468. stop();
  469. }
  470. }
  471. }
  472. Text
  473. {
  474. id: preheatCountdown
  475. text: connectedPrinter != null ? connectedPrinter.preheatBedRemainingTime : ""
  476. visible: text != "" //Has no direct effect, but just so that we can link visibility of clock icon to visibility of the countdown text.
  477. font: UM.Theme.getFont("default")
  478. color: UM.Theme.getColor("text")
  479. anchors.right: preheatButton.left
  480. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  481. anchors.verticalCenter: preheatButton.verticalCenter
  482. }
  483. Button //The pre-heat button.
  484. {
  485. id: preheatButton
  486. height: UM.Theme.getSize("setting_control").height
  487. visible: connectedPrinter != null ? connectedPrinter.canPreHeatBed: true
  488. enabled:
  489. {
  490. if (!preheatTemperatureControl.enabled)
  491. {
  492. return false; //Not connected, not authenticated or printer is busy.
  493. }
  494. if (preheatUpdateTimer.running)
  495. {
  496. return true; //Can always cancel if the timer is running.
  497. }
  498. if (bedTemperature.properties.minimum_value != "None" && parseInt(preheatTemperatureInput.text) < parseInt(bedTemperature.properties.minimum_value))
  499. {
  500. return false; //Target temperature too low.
  501. }
  502. if (bedTemperature.properties.maximum_value != "None" && parseInt(preheatTemperatureInput.text) > parseInt(bedTemperature.properties.maximum_value))
  503. {
  504. return false; //Target temperature too high.
  505. }
  506. if (parseInt(preheatTemperatureInput.text) == 0)
  507. {
  508. return false; //Setting the temperature to 0 is not allowed (since that cancels the pre-heating).
  509. }
  510. return true; //Preconditions are met.
  511. }
  512. anchors.right: parent.right
  513. anchors.bottom: parent.bottom
  514. anchors.margins: UM.Theme.getSize("default_margin").width
  515. style: ButtonStyle {
  516. background: Rectangle
  517. {
  518. border.width: UM.Theme.getSize("default_lining").width
  519. implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
  520. border.color:
  521. {
  522. if(!control.enabled)
  523. {
  524. return UM.Theme.getColor("action_button_disabled_border");
  525. }
  526. else if(control.pressed)
  527. {
  528. return UM.Theme.getColor("action_button_active_border");
  529. }
  530. else if(control.hovered)
  531. {
  532. return UM.Theme.getColor("action_button_hovered_border");
  533. }
  534. else
  535. {
  536. return UM.Theme.getColor("action_button_border");
  537. }
  538. }
  539. color:
  540. {
  541. if(!control.enabled)
  542. {
  543. return UM.Theme.getColor("action_button_disabled");
  544. }
  545. else if(control.pressed)
  546. {
  547. return UM.Theme.getColor("action_button_active");
  548. }
  549. else if(control.hovered)
  550. {
  551. return UM.Theme.getColor("action_button_hovered");
  552. }
  553. else
  554. {
  555. return UM.Theme.getColor("action_button");
  556. }
  557. }
  558. Behavior on color
  559. {
  560. ColorAnimation
  561. {
  562. duration: 50
  563. }
  564. }
  565. Text
  566. {
  567. id: actualLabel
  568. anchors.centerIn: parent
  569. color:
  570. {
  571. if(!control.enabled)
  572. {
  573. return UM.Theme.getColor("action_button_disabled_text");
  574. }
  575. else if(control.pressed)
  576. {
  577. return UM.Theme.getColor("action_button_active_text");
  578. }
  579. else if(control.hovered)
  580. {
  581. return UM.Theme.getColor("action_button_hovered_text");
  582. }
  583. else
  584. {
  585. return UM.Theme.getColor("action_button_text");
  586. }
  587. }
  588. font: UM.Theme.getFont("action_button")
  589. text: preheatUpdateTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat")
  590. }
  591. }
  592. }
  593. onClicked:
  594. {
  595. if (!preheatUpdateTimer.running)
  596. {
  597. connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout);
  598. preheatUpdateTimer.start();
  599. preheatUpdateTimer.update(); //Update once before the first timer is triggered.
  600. }
  601. else
  602. {
  603. connectedPrinter.cancelPreheatBed();
  604. preheatUpdateTimer.update();
  605. }
  606. }
  607. onHoveredChanged:
  608. {
  609. if (hovered)
  610. {
  611. base.showTooltip(
  612. base,
  613. {x: 0, y: preheatButton.mapToItem(base, 0, 0).y},
  614. 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.")
  615. );
  616. }
  617. else
  618. {
  619. base.hideTooltip();
  620. }
  621. }
  622. }
  623. }
  624. UM.SettingPropertyProvider
  625. {
  626. id: bedTemperature
  627. containerStackId: Cura.MachineManager.activeMachineId
  628. key: "material_bed_temperature"
  629. watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
  630. storeIndex: 0
  631. property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
  632. }
  633. UM.SettingPropertyProvider
  634. {
  635. id: machineExtruderCount
  636. containerStackId: Cura.MachineManager.activeMachineId
  637. key: "machine_extruder_count"
  638. watchedProperties: ["value"]
  639. }
  640. Loader
  641. {
  642. sourceComponent: monitorSection
  643. property string label: catalog.i18nc("@label", "Active print")
  644. }
  645. Loader
  646. {
  647. sourceComponent: monitorItem
  648. property string label: catalog.i18nc("@label", "Job Name")
  649. property string value: connectedPrinter != null ? connectedPrinter.jobName : ""
  650. }
  651. Loader
  652. {
  653. sourceComponent: monitorItem
  654. property string label: catalog.i18nc("@label", "Printing Time")
  655. property string value: connectedPrinter != null ? getPrettyTime(connectedPrinter.timeTotal) : ""
  656. }
  657. Loader
  658. {
  659. sourceComponent: monitorItem
  660. property string label: catalog.i18nc("@label", "Estimated time left")
  661. property string value: connectedPrinter != null ? getPrettyTime(connectedPrinter.timeTotal - connectedPrinter.timeElapsed) : ""
  662. visible: connectedPrinter != null && (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "paused")
  663. }
  664. Component
  665. {
  666. id: monitorItem
  667. Row
  668. {
  669. height: UM.Theme.getSize("setting_control").height
  670. width: base.width - 2 * UM.Theme.getSize("default_margin").width
  671. anchors.left: parent.left
  672. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  673. Text
  674. {
  675. width: parent.width * 0.4
  676. anchors.verticalCenter: parent.verticalCenter
  677. text: label
  678. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  679. font: UM.Theme.getFont("default")
  680. elide: Text.ElideRight
  681. }
  682. Text
  683. {
  684. width: parent.width * 0.6
  685. anchors.verticalCenter: parent.verticalCenter
  686. text: value
  687. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  688. font: UM.Theme.getFont("default")
  689. elide: Text.ElideRight
  690. }
  691. }
  692. }
  693. Component
  694. {
  695. id: monitorSection
  696. Rectangle
  697. {
  698. color: UM.Theme.getColor("setting_category")
  699. width: base.width
  700. height: UM.Theme.getSize("section").height
  701. Text
  702. {
  703. anchors.verticalCenter: parent.verticalCenter
  704. anchors.left: parent.left
  705. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  706. text: label
  707. font: UM.Theme.getFont("setting_category")
  708. color: UM.Theme.getColor("setting_category_text")
  709. }
  710. }
  711. }
  712. }