Терминальный проект КиберПлат [open source]
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
4.0KB

  1. /* @file Экран блокировки терминала. */
  2. import QtQuick 2.2
  3. import Core.Types 1.0
  4. Image {
  5. width: Core.graphics.width
  6. height: Core.graphics.height
  7. fillMode: Image.Tile
  8. source: "/GraphicsItems/images/background_tile.png"
  9. Rectangle {
  10. width: Core.graphics.width - 60
  11. height: 670
  12. anchors.centerIn: parent
  13. color: "transparent"
  14. Column {
  15. spacing: 30
  16. anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; }
  17. Image {
  18. width: 420
  19. height: 260
  20. anchors.horizontalCenter: parent.horizontalCenter
  21. source: "/GraphicsItems/images/logo_cyberplat_big.png"
  22. }
  23. Row {
  24. spacing: 10
  25. anchors { horizontalCenter: parent.horizontalCenter; }
  26. Repeater {
  27. model: statusModel
  28. AnimatedImage {
  29. source: image ? "/GraphicsItems/images/" + image : ""
  30. }
  31. }
  32. }
  33. Column {
  34. spacing: 10
  35. anchors { horizontalCenter: parent.horizontalCenter; }
  36. Text {
  37. anchors { horizontalCenter: parent.horizontalCenter; }
  38. text: qsTr("#terminal_not_available")
  39. color: "#F2F2F2"
  40. font.pointSize: 24
  41. }
  42. Text {
  43. anchors { horizontalCenter: parent.horizontalCenter; }
  44. text: qsTr("#dont_power_off_terminal")
  45. color: "#FFCD34"
  46. font.pointSize: 36
  47. visible: Boolean(global.parameters) && global.parameters.hasOwnProperty("firmware_upload")
  48. }
  49. Text {
  50. id: terminalName
  51. anchors { horizontalCenter: parent.horizontalCenter; }
  52. text: qsTr("#terminal").arg(Core.environment.terminal.AP)
  53. color: "#F2F2F2"
  54. font.pointSize: 16
  55. }
  56. Text {
  57. id: terminalPhone
  58. anchors { horizontalCenter: parent.horizontalCenter; }
  59. text: qsTr("#support").arg(Core.environment.dealer.phone)
  60. color: "#F2F2F2"
  61. font.pointSize: 16
  62. }
  63. }
  64. }
  65. }
  66. // Расположение зон: 1 2
  67. // 5
  68. // 3 4
  69. // Зона 1
  70. MouseArea {
  71. x: 0
  72. y: 0
  73. width: parent.width/3
  74. height: parent.height/3
  75. onClicked: selectArea(1)
  76. }
  77. // Зона 2
  78. MouseArea {
  79. x: parent.width - parent.width/3
  80. y: 0
  81. width: parent.width/3
  82. height: parent.height/3
  83. onClicked: selectArea(2)
  84. }
  85. // Зона 3
  86. MouseArea {
  87. x: 0
  88. y: parent.height - parent.height/3
  89. width: parent.width/3
  90. height: parent.height/3
  91. onClicked: selectArea(3)
  92. }
  93. // Зона 4
  94. MouseArea {
  95. x: parent.width - parent.width/3
  96. y: parent.height - parent.height/3
  97. width: parent.width/3
  98. height: parent.height/3
  99. onClicked: selectArea(4)
  100. }
  101. // Зона 5
  102. MouseArea {
  103. x: parent.width/3
  104. y: parent.height/3
  105. width: parent.width/3
  106. height: parent.height/3
  107. onClicked: selectArea(5)
  108. }
  109. Timer {
  110. id: screenActivityTimer
  111. interval: 5000;
  112. onTriggered: onScreenActivityTimeout()
  113. }
  114. ListModel {
  115. id: statusModel
  116. }
  117. QtObject {
  118. id: global
  119. property variant icons
  120. property string clickSequence
  121. property variant parameters
  122. }
  123. Component.onCompleted: {
  124. global.icons = {
  125. "blocked": "ic_blocked.png",
  126. "config_failure": "ic_config.png",
  127. "validator_failure": "ic_validator_error.png",
  128. "printer_failure": "ic_printer_error.png",
  129. "update_in_progress": "ic_update.png",
  130. "network_failure": "ic_network_error.png",
  131. "crypt_failure": "ic_crypt.png",
  132. "cardreader_failure": "ic_card_error.png",
  133. "token_failure": "ic_token_error.png",
  134. "firmware_upload": "waiting.gif",
  135. "account_balance_failure": "ic_balance_error.png"
  136. };
  137. }
  138. function selectArea(aAreaNumber) {
  139. screenActivityTimer.start();
  140. global.clickSequence += "%1".arg(aAreaNumber);
  141. Core.postEvent(EventType.UpdateScenario, {signal: "screen_password_updated", password: global.clickSequence});
  142. Core.log.normal("Clicked sequence: %1.".arg(global.clickSequence));
  143. }
  144. function onScreenActivityTimeout() {
  145. screenActivityTimer.stop();
  146. global.clickSequence = "";
  147. }
  148. function notifyHandler(aEvent, aParameters) {
  149. statusModel.clear();
  150. global.parameters = aParameters;
  151. for (var i in aParameters) {
  152. if (aParameters[i]) {
  153. statusModel.append({image: global.icons[i]});
  154. }
  155. }
  156. }
  157. }