ADMIN_Settings.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. import QtQuick 2.5
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Layouts 1.0
  4. import ApplicationLauncher 1.0
  5. import "qrc:/Globals"
  6. Rectangle {
  7. id: root
  8. width: parent.width
  9. height: parent.height
  10. color: "white"
  11. property color inputBackgrund: "lightgray"
  12. property int inputRadius: 4
  13. property int inputHeight: 40
  14. property int inputFontSize: 22
  15. Flickable {
  16. id: flickable
  17. anchors.fill: parent
  18. contentWidth: content.width
  19. contentHeight: content.height
  20. interactive: contentHeight > height
  21. flickableDirection: Flickable.VerticalFlick
  22. Item {
  23. id: content
  24. x: 0
  25. y: 0
  26. width: flickable.width
  27. //============================================================================
  28. ApplicationLaunch {
  29. id: factoryResetSCRIPT
  30. appName: ""
  31. arguments: ""
  32. onAppFinished: {
  33. Qt.quit(); //Beenden und am Target neustarten
  34. }
  35. }
  36. Rectangle {
  37. property int factoryRestFontSize: 20
  38. property int factoryResetRectHeight: 40
  39. id: factoryResetRECT
  40. x: ((root.width / 17) * 14) - 10
  41. y: (root.height / 12)
  42. width: (root.width / 17) * 3
  43. height: factoryResetRectHeight
  44. color: Globals.customer_color_base
  45. border.color: "lightgray"
  46. border.width: 3
  47. Label {
  48. anchors.centerIn: parent
  49. font.pixelSize: roleFontSize
  50. //:ID: admin_factory_reset_butt buttontext for factory reset button
  51. text: qsTrId("_factory_reset")
  52. }
  53. MouseArea {
  54. anchors.fill : parent
  55. onClicked: {
  56. sysinfo.beep();
  57. factoryResetSCRIPT.appName = Globals.baseDir + "/Scripts/FactoryReset.sh " + sysinfo.currentCpuArchitecture;
  58. factoryResetSCRIPT.launchScript();
  59. }
  60. }
  61. }
  62. // Rectangle {
  63. // id : pwdEngRECT
  64. // x: (root.width / 17) * 4
  65. // y: (root.height / 6)
  66. // width: (parent.width / 17) * 3
  67. // height: inputHeight
  68. // radius: inputRadius
  69. // color: inputBackgrund
  70. // TextInput {
  71. // id: pwdEngINPUT
  72. // y: (parent.height - font.pixelSize) / 2
  73. // x: y
  74. // width: parent.width - (parent.height - font.pixelSize)
  75. // clip: true
  76. // color: "black"
  77. // font.pixelSize: inputFontSize
  78. // echoMode: TextInput.Password
  79. // passwordMaskDelay: 250
  80. // text: ""
  81. // onAccepted: {
  82. // }
  83. // Keys.onPressed: {
  84. // if(event.key == Qt.Key_Left) {
  85. // pwdAdminRepeatINPUT.focus = true;
  86. // }
  87. // if(event.key == Qt.Key_Right) {
  88. // pwdEngRepeatINPUT.focus = true;
  89. // }
  90. // if(event.key == Qt.Key_Up)
  91. // {
  92. // pwdAdminINPUT.focus = true;
  93. // }
  94. // if(event.key == Qt.Key_Down)
  95. // {
  96. // pwdAdminINPUT.focus = true;
  97. // }
  98. // if((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
  99. // {
  100. // pwdEngRepeatINPUT.focus = true;
  101. // }
  102. // }
  103. // }
  104. // }
  105. // Rectangle {
  106. // id : pwdEngRepatRECT
  107. // x: (root.width / 17) * 8
  108. // y: (root.height / 6)
  109. // width: (parent.width / 17) * 3
  110. // height: inputHeight
  111. // radius: inputRadius
  112. // color: inputBackgrund
  113. // TextInput {
  114. // id: pwdEngRepeatINPUT
  115. // x: (parent.height - font.pixelSize) / 2
  116. // y: x
  117. // width: parent.width - (parent.height - font.pixelSize)
  118. // clip: true
  119. // color: "black"
  120. // font.pixelSize: inputFontSize
  121. // echoMode: TextInput.Password
  122. // passwordMaskDelay: 250
  123. // text: ""
  124. // onAccepted: {
  125. // }
  126. // Keys.onPressed: {
  127. // if(event.key == Qt.Key_Left) {
  128. // pwdEngINPUT.focus = true;
  129. // }
  130. // if(event.key == Qt.Key_Right) {
  131. // pwdAdminINPUT.focus = true;
  132. // }
  133. // if(event.key == Qt.Key_Up)
  134. // {
  135. // pwdAdminRepeatINPUT.focus = true;
  136. // }
  137. // if(event.key == Qt.Key_Down)
  138. // {
  139. // pwdAdminRepeatINPUT.focus = true;
  140. // }
  141. // if((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
  142. // {
  143. // pwdAdminINPUT.focus = true;
  144. // }
  145. // }
  146. // }
  147. // }
  148. // Rectangle {
  149. // id : pwdEngRECTLAB
  150. // x: (root.width / 17) / 3
  151. // y: (root.height / 6)
  152. // width: (parent.width / 17) * 3
  153. // height: inputHeight
  154. // Label {
  155. // id: pwdEngLABEL
  156. // x: (parent.height - font.pixelSize) / 2
  157. // y: x
  158. // font.pixelSize: inputFontSize
  159. // text: Globals.getActUserRoleText("eng")
  160. // }
  161. // }
  162. // ButtHMI {
  163. // id : pwdEngBUTT
  164. // property bool isValid : ((pwdEngINPUT.length > 0) && (pwdEngINPUT.text == pwdEngRepeatINPUT.text)) ? true : false
  165. // buttX: (root.width / 17) * 12
  166. // buttY: (root.height / 6)
  167. // buttWidth: inputHeight
  168. // buttHeight: buttWidth
  169. // text: "\uf0c7" //floppy-sign
  170. // color: isValid == true ?Globals.customer_color_base:inputBackgrund //((pwdEngINPUT.length > 0) && (pwdEngINPUT.text == pwdEngRepeatINPUT.text)) ? Globals.customer_color_base : inputBackgrund
  171. // borderColor: color
  172. // onButtPressed: {
  173. // if(isValid) {
  174. // if(pwdEngINPUT.text == "*")
  175. // settings.setValue("UserRoleEng/Password", "*");
  176. // else
  177. // settings.setValue("UserRoleEng/Password", Qt.md5(pwdEngINPUT.text));
  178. // pwdEngINPUT.text = pwdEngRepeatINPUT.text = "";
  179. // }
  180. // }
  181. // }
  182. Rectangle {
  183. id : pwdAdminRECT
  184. x: (root.width / 17) * 4
  185. y: (root.height / 6) * 3
  186. width: (parent.width / 17) * 3
  187. height: inputHeight
  188. radius: inputRadius
  189. color: inputBackgrund
  190. TextInput {
  191. id: pwdAdminINPUT
  192. x: (parent.height - font.pixelSize) / 2
  193. y: x
  194. width: parent.width - (parent.height - font.pixelSize)
  195. clip: true
  196. color: "black"
  197. font.pixelSize: inputFontSize
  198. echoMode: TextInput.Password
  199. passwordMaskDelay: 250
  200. text: ""
  201. onAccepted: {
  202. }
  203. Keys.onPressed: {
  204. if(event.key == Qt.Key_Left) {
  205. pwdEngRepeatINPUT.focus = true;
  206. }
  207. if(event.key == Qt.Key_Right) {
  208. pwdAdminRepeatINPUT.focus = true;
  209. }
  210. if(event.key == Qt.Key_Up)
  211. {
  212. pwdEngINPUT.focus = true;
  213. }
  214. if(event.key == Qt.Key_Down)
  215. {
  216. pwdEngINPUT.focus = true;
  217. }
  218. if((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
  219. {
  220. pwdAdminRepeatINPUT.focus = true;
  221. }
  222. }
  223. }
  224. }
  225. Rectangle {
  226. id : pwdAdminRepatRECT
  227. x: (root.width / 17) * 8
  228. y: (root.height / 6) * 3
  229. width: (parent.width / 17) * 3
  230. height: inputHeight
  231. radius: inputRadius
  232. color: inputBackgrund
  233. TextInput {
  234. id: pwdAdminRepeatINPUT
  235. x: (parent.height - font.pixelSize) / 2
  236. y: x
  237. width: parent.width - (parent.height - font.pixelSize)
  238. clip: true
  239. color: "black"
  240. font.pixelSize: inputFontSize
  241. passwordMaskDelay: 250
  242. echoMode: TextInput.Password
  243. text: ""
  244. onAccepted: {
  245. }
  246. Keys.onPressed: {
  247. if(event.key == Qt.Key_Left) {
  248. pwdAdminINPUT.focus = true;
  249. }
  250. if(event.key == Qt.Key_Right) {
  251. pwdEngINPUT.focus = true;
  252. }
  253. if(event.key == Qt.Key_Up)
  254. {
  255. pwdEngRepeatINPUT.focus = true;
  256. }
  257. if(event.key == Qt.Key_Down)
  258. {
  259. pwdEngRepeatINPUT.focus = true;
  260. }
  261. if((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
  262. {
  263. pwdEngINPUT.focus = true;
  264. }
  265. }
  266. }
  267. }
  268. Rectangle {
  269. id : pwdAdminRECTLAB
  270. x: (root.width / 17) / 3
  271. y: (root.height / 6) * 3
  272. width: (parent.width / 17) * 3
  273. height: inputHeight
  274. Label {
  275. id: pwdAdminLABEL
  276. x: (parent.height - font.pixelSize) / 2
  277. y: x
  278. font.pixelSize: inputFontSize
  279. text: Globals.getActUserRoleText("admin")
  280. }
  281. }
  282. ButtHMI {
  283. id : pwdAdminBUTT
  284. property bool isValid : ((pwdAdminINPUT.length > 0) && (pwdAdminINPUT.text == pwdAdminRepeatINPUT.text)) ? true : false
  285. buttX: (root.width / 17) * 12
  286. buttY: (root.height / 6) * 3
  287. buttWidth: inputHeight
  288. buttHeight: buttWidth
  289. text: "\uf0c7" //floppy-sign
  290. color: isValid == true ?Globals.customer_color_base:inputBackgrund
  291. borderColor: color
  292. onButtPressed: {
  293. if(isValid) {
  294. if(pwdAdminINPUT.text == "*")
  295. settings.setValue("UserRoleAdmin/Password", "*");
  296. else
  297. settings.setValue("UserRoleAdmin/Password", Qt.md5(pwdAdminINPUT.text));
  298. pwdAdminINPUT.text = pwdAdminRepeatINPUT.text = "";
  299. }
  300. }
  301. }
  302. //============================================================================
  303. }
  304. }
  305. }