EngineLog.qml 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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.Controls 1.1
  5. import QtQuick.Layouts 1.1
  6. import UM 1.0 as UM
  7. UM.Dialog {
  8. id: dialog;
  9. //: Engine Log dialog title
  10. title: qsTr("Engine Log");
  11. modality: Qt.NonModal;
  12. TextArea {
  13. id: textArea
  14. anchors.fill: parent;
  15. Timer {
  16. id: updateTimer;
  17. interval: 1000;
  18. running: false;
  19. repeat: true;
  20. onTriggered: textArea.text = Printer.getEngineLog();
  21. }
  22. }
  23. rightButtons: Button {
  24. //: Close engine log button
  25. text: qsTr("Close");
  26. onClicked: dialog.visible = false;
  27. }
  28. onVisibleChanged: {
  29. if(visible) {
  30. textArea.text = Printer.getEngineLog();
  31. updateTimer.start();
  32. } else {
  33. updateTimer.stop();
  34. }
  35. }
  36. }