FirmwareUpdateWindow.qml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Cura is released under the terms of the AGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Window 2.2
  5. import QtQuick.Controls 1.2
  6. import UM 1.1 as UM
  7. UM.Dialog
  8. {
  9. id: base;
  10. width: 500 * Screen.devicePixelRatio;
  11. height: 100 * Screen.devicePixelRatio;
  12. visible: true;
  13. modality: Qt.ApplicationModal;
  14. title: catalog.i18nc("@title:window","Firmware Update");
  15. Column
  16. {
  17. anchors.fill: parent;
  18. Label
  19. {
  20. anchors
  21. {
  22. left: parent.left;
  23. right: parent.right;
  24. }
  25. text: {
  26. if (manager.errorCode == 0)
  27. {
  28. if (manager.firmwareUpdateCompleteStatus)
  29. {
  30. //: Firmware update status label
  31. return catalog.i18nc("@label","Firmware update completed.")
  32. }
  33. else if (manager.progress == 0)
  34. {
  35. //: Firmware update status label
  36. return catalog.i18nc("@label","Starting firmware update, this may take a while.")
  37. }
  38. else
  39. {
  40. //: Firmware update status label
  41. return catalog.i18nc("@label","Updating firmware.")
  42. }
  43. }
  44. else
  45. {
  46. switch (manager.errorCode)
  47. {
  48. case 1:
  49. //: Firmware update status label
  50. return catalog.i18nc("@label","Firmware update failed due to an unknown error.")
  51. case 2:
  52. //: Firmware update status label
  53. return catalog.i18nc("@label","Firmware update failed due to an communication error.")
  54. case 3:
  55. //: Firmware update status label
  56. return catalog.i18nc("@label","Firmware update failed due to an input/output error.")
  57. case 4:
  58. //: Firmware update status label
  59. return catalog.i18nc("@label","Firmware update failed due to missing firmware.")
  60. default:
  61. //: Firmware update status label
  62. return catalog.i18nc("@label", "Unknown error code: %1").arg(manager.errorCode)
  63. }
  64. }
  65. }
  66. wrapMode: Text.Wrap;
  67. }
  68. ProgressBar
  69. {
  70. id: prog
  71. value: manager.firmwareUpdateCompleteStatus ? 100 : manager.progress
  72. minimumValue: 0
  73. maximumValue: 100
  74. indeterminate: (manager.progress < 1) && (!manager.firmwareUpdateCompleteStatus)
  75. anchors
  76. {
  77. left: parent.left;
  78. right: parent.right;
  79. }
  80. }
  81. SystemPalette
  82. {
  83. id: palette;
  84. }
  85. UM.I18nCatalog { id: catalog; name: "cura"; }
  86. }
  87. rightButtons: [
  88. Button
  89. {
  90. text: catalog.i18nc("@action:button","Close");
  91. enabled: manager.firmwareUpdateCompleteStatus;
  92. onClicked: base.visible = false;
  93. }
  94. ]
  95. }