FirmwareUpdateWindow.qml 3.4 KB

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