ProfilePage.qml 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. import Felgo
  2. import QtMultimedia
  3. import QtQuick
  4. import QtQuick.Controls
  5. import EasyModel 1.0
  6. import com.example.database 1.0
  7. import "../controls"
  8. import "../common"
  9. import "../model"
  10. AppPage {
  11. id: page_sys
  12. title: qsTr("系统设置")
  13. backgroundColor: app.theme_backgroundColor
  14. navigationBarHidden: true
  15. property var picinfo_list:[]
  16. signal logoutClicked
  17. signal themChange(string mode)
  18. // 参数重置二次确认挂起标志:
  19. // nativeUtils 是全局单例,其它页面/流程也会弹 messageBox,
  20. // 必须用标志位区分"本次参数重置弹窗"的确认/取消,避免其它弹窗误触发重置指令
  21. property bool resetConfirmPending: false
  22. Connections {
  23. target: nativeUtils
  24. function onMessageBoxFinished(accepted) {
  25. if(!resetConfirmPending) return
  26. resetConfirmPending = false
  27. if(accepted){
  28. console.log("参数重置已确认,发送JSONRPC恢复出厂设置指令!")
  29. serial.makeJsonRpc("factory_reset", "")
  30. }else{
  31. console.log("参数重置已取消")
  32. }
  33. }
  34. }
  35. MediaPlayer{
  36. id: audio
  37. audioOutput: AudioOutput{}
  38. source: Qt.resolvedUrl("../../assets/mp3/button.mp3")
  39. }
  40. Connections {
  41. target: mqtt
  42. }
  43. // 权限管理页:以 Component 形式定义,供"权限管理"按钮 push 进入
  44. Component {
  45. id: permission_component
  46. PermissionPage {
  47. }
  48. }
  49. Component {
  50. id: sqlite_component
  51. AppPage {
  52. id: sqlite_page
  53. implicitHeight: 800
  54. implicitWidth: 1280
  55. rightBarItem: IconButtonBarItem {
  56. iconType: IconType.paintbrush
  57. onClicked: {
  58. console.log("database")
  59. sqliteModal.open()
  60. }
  61. }
  62. property int verHeaderHeight: 30
  63. property int verHeaderWidth: 150
  64. property int horHeaderHeight: 30
  65. property color scrollBarColor: "cyan"
  66. property int scrollBarWidth: 6
  67. property variant columnWidthArr: [30,100,100,100,100,100,200,100,100,100,100,100,100]
  68. property variant table_mqtt_Value: ["id","dtype","ip","port","imei","uid","pwd","clientid","qos","keepalive","sub","pub","offline"]
  69. property variant table_ftp_Value: ["id","ip","port","dir","uid","pwd","mode"]
  70. property variant table_location_Value: ["id","lbs_lat","lbs_lng","gps_lat","gps_lng","gps_elevation"]
  71. property variant table_camera_Value: ["camera_type","mode","stitch_photonum","photo_width","photo_height","auto_focus"]
  72. property variant table_json_Value: ["id","datetime","json_data","json_data"]
  73. property int datacount: 1
  74. DatabaseInterface
  75. {
  76. id: db_cfg
  77. }
  78. EasyTableModel{
  79. id: table_model
  80. horHeader: table_mqtt_Value
  81. }
  82. TableView{
  83. id: table_view
  84. height: sqlite_page.implicitHeight
  85. anchors{
  86. left: parent.left
  87. right: parent.right
  88. top: parent.top
  89. leftMargin: 30
  90. topMargin: sqlite_page.horHeaderHeight
  91. }
  92. clip: true
  93. boundsBehavior: Flickable.StopAtBounds
  94. columnSpacing: 1
  95. rowSpacing: 1
  96. rowHeightProvider: function (row) {
  97. return sqlite_page.verHeaderHeight;
  98. }
  99. columnWidthProvider: function (column) {
  100. return sqlite_page.columnWidthArr[column];
  101. }
  102. ScrollBar.vertical: ScrollBar {
  103. id: scroll_vertical
  104. anchors.right: parent.right
  105. anchors.rightMargin: 2
  106. contentItem: Rectangle{
  107. visible: (scroll_vertical.size<1.0)
  108. implicitWidth: sqlite_page.scrollBarWidth
  109. color: sqlite_page.scrollBarColor
  110. }
  111. }
  112. ScrollBar.horizontal: ScrollBar {
  113. id: scroll_horizontal
  114. anchors.bottom: parent.bottom
  115. anchors.bottomMargin: 2
  116. contentItem: Rectangle{
  117. visible: (scroll_horizontal.size<1.0)
  118. implicitHeight: sqlite_page.scrollBarWidth
  119. color: sqlite_page.scrollBarColor
  120. }
  121. }
  122. model: table_model
  123. delegate: Rectangle {
  124. color: (model.row%2)?"orange":Qt.darker("orange")
  125. AppText{
  126. id : value_text
  127. anchors.centerIn: parent
  128. verticalAlignment: Text.AlignVCenter
  129. horizontalAlignment: Text.AlignHCenter
  130. text: model.value
  131. AppButton {
  132. onClicked: {
  133. var dialog = InputDialog.inputTextSingleLine(app,
  134. "请输入要修改内容",
  135. value_text.text,
  136. function(ok,text){
  137. if(ok){
  138. value_text.text = text
  139. model.edit=text;
  140. console.log("edit",model.value)
  141. if(sqlite_switch.checked)
  142. {
  143. if(table_combox.displayText===table_combox.model[0]||table_combox.displayText===table_combox.model[1])
  144. {
  145. columnWidthArr = [30,100,100,100,100,100,200,100,100,100,100,100,100]
  146. db_cfg.updateData(table_combox.displayText,table_mqtt_Value[index],model.value)
  147. }
  148. if(table_combox.displayText===table_combox.model[2]||table_combox.displayText===table_combox.model[3])
  149. {
  150. db_cfg.updateData(table_combox.displayText,table_ftp_Value[index],model.value)
  151. }
  152. if(table_combox.displayText===table_combox.model[4])
  153. {
  154. db_cfg.updateData(table_combox.displayText,table_location_Value[index],model.value)
  155. }
  156. if(table_combox.displayText===table_combox.model[5]){
  157. db_cfg.updateData(table_combox.displayText,table_camera_Value[index],model.value)
  158. }
  159. }
  160. }
  161. })
  162. dialog.negativeAction = false
  163. dialog.outsideTouchable = true
  164. }
  165. }
  166. }
  167. }
  168. }
  169. Item{
  170. id: header_horizontal
  171. anchors{
  172. left: parent.left
  173. right: parent.right
  174. leftMargin: 30
  175. }
  176. height: sqlite_page.horHeaderHeight
  177. z: 2
  178. property int posXTemp: 0
  179. MouseArea{
  180. anchors.fill: parent
  181. onPressed: {
  182. header_horizontal.posXTemp=mouseX;
  183. }
  184. onPositionChanged: {
  185. if(table_view.contentX+(header_horizontal.posXTemp-mouseX)>0){
  186. table_view.contentX+=(header_horizontal.posXTemp-mouseX);
  187. }else{
  188. table_view.contentX=0;
  189. }
  190. header_horizontal.posXTemp=mouseX;
  191. }
  192. }
  193. Row {
  194. id: header_horizontal_row
  195. anchors.fill: parent
  196. leftPadding: -table_view.contentX
  197. clip: true
  198. spacing: 0
  199. Repeater {
  200. model: table_view.columns > 0 ? table_view.columns : 0
  201. Rectangle {
  202. id: header_horizontal_item
  203. width: table_view.columnWidthProvider(index)+table_view.columnSpacing
  204. height: sqlite_page.horHeaderHeight
  205. color: "purple"
  206. AppText {
  207. anchors.centerIn: parent
  208. text: table_model.headerData(index, Qt.Horizontal)
  209. }
  210. Rectangle{
  211. width: 1
  212. height: parent.height
  213. anchors.right: parent.right
  214. color: "black"
  215. opacity: 0.5
  216. }
  217. MouseArea{
  218. width: 3
  219. height: parent.height
  220. anchors.right: parent.right
  221. cursorShape: Qt.SplitHCursor
  222. onPressed: header_horizontal.posXTemp=mouseX;
  223. onPositionChanged: {
  224. if((header_horizontal_item.width-(header_horizontal.posXTemp-mouseX))>10){
  225. header_horizontal_item.width-=(header_horizontal.posXTemp-mouseX);
  226. }else{
  227. header_horizontal_item.width=10;
  228. }
  229. header_horizontal.posXTemp=mouseX;
  230. sqlite_page.columnWidthArr[index]=(header_horizontal_item.width-table_view.columnSpacing);
  231. table_view.forceLayout();
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. Column {
  239. id: header_verical
  240. height: sqlite_page.implicitHeight
  241. anchors{
  242. left: parent.left
  243. top: parent.top
  244. topMargin: sqlite_page.horHeaderHeight
  245. }
  246. topPadding: -table_view.contentY
  247. z: 2
  248. clip: true
  249. spacing: 1
  250. Repeater {
  251. model: table_view.rows > 0 ? table_view.rows : 0
  252. Rectangle {
  253. width: 30
  254. height: table_view.rowHeightProvider(index)
  255. color: "green"
  256. Text {
  257. anchors.centerIn: parent
  258. text: table_model.headerData(index, Qt.Vertical)
  259. }
  260. }
  261. }
  262. }
  263. AppModal {
  264. id: sqliteModal
  265. fullscreen: false
  266. modalHeight: dp(380) + nativeUtils.safeAreaInsets.bottom
  267. NavigationStack {
  268. AppPage {
  269. title: "配置信息管理"
  270. rightBarItem: TextButtonBarItem {
  271. text: "关闭"
  272. textItem.font.pixelSize: sp(16)
  273. onClicked: sqliteModal.close()
  274. }
  275. Column {
  276. id: sqliteColumn
  277. width: parent.width
  278. Section {
  279. title: "数据库"
  280. ComboBox {
  281. id: sqlite_combox
  282. height: dp(40)
  283. width: parent.width/2
  284. model: ["config.db", "data.db"]
  285. }
  286. }
  287. Section {
  288. title: "数据表"
  289. ComboBox {
  290. id: table_combox
  291. height: dp(40)
  292. width: parent.width/2
  293. model: ["mqtt", "mqtt_other","ftp","ftp_other","location","camera","data"]
  294. onActivated: {
  295. console.log(displayText)
  296. table_model.table_name = displayText
  297. if(displayText===model[0]||displayText===model[1])
  298. {
  299. columnWidthArr = [30,100,100,100,100,100,200,100,100,100,100,100,100]
  300. table_model.horHeader = table_mqtt_Value
  301. }
  302. else if(displayText===model[2]||displayText===model[3])
  303. {
  304. table_model.horHeader = table_ftp_Value
  305. }
  306. else if(displayText===model[4])
  307. {
  308. table_model.horHeader = table_location_Value
  309. }else if(displayText===model[5]){
  310. columnWidthArr = [100,100,150,100,100,100]
  311. table_model.horHeader = table_camera_Value
  312. }
  313. else if(displayText===model[6])
  314. {
  315. table_model.horHeader = table_json_Value
  316. }
  317. table_model.initData=db_cfg.queryData(displayText,datacount)
  318. }
  319. }
  320. }
  321. AppText {
  322. id: sqlite_text
  323. text: "开关:"
  324. }
  325. AppSwitch {
  326. id: sqlite_switch
  327. anchors.left: sqlite_text.light
  328. anchors.leftMargin: 10
  329. onToggled: {
  330. if(sqlite_switch.checked){
  331. var dbs = db_cfg.openDatabase(sqlite_combox.displayText)
  332. if(dbs){
  333. console.log("打开数据库成功");
  334. sqlite_combox.enabled = false
  335. table_combox.enabled = true
  336. if(sqlite_combox.displayText==="data.db")
  337. {
  338. table_combox.displayText=table_combox.model[6];
  339. }
  340. table_model.table_name = table_combox.displayText
  341. table_model.initData=db_cfg.queryData(table_combox.displayText,datacount)
  342. }else{
  343. sqlite_switch.checked = false
  344. sqlite_combox.enabled = true;
  345. console.log("打开数据库失败");
  346. }
  347. }else{
  348. sqlite_combox.enabled = true;
  349. db_cfg.closeDatabase()
  350. console.log("关闭数据库");
  351. }
  352. }
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. Grid {
  361. anchors.fill: parent
  362. anchors.leftMargin: 5
  363. anchors.topMargin:5
  364. columns: 1
  365. rows: 3
  366. columnSpacing: 10
  367. rowSpacing: 5
  368. horizontalItemAlignment: Grid.AlignHCenter
  369. Rectangle {
  370. radius: 5
  371. width: parent.width * 0.995
  372. height: parent.height*0.18
  373. color: app.cardColor
  374. Timer {
  375. interval: 1000
  376. running: true
  377. repeat: true
  378. onTriggered: {
  379. picinfo_list = serial.pathinfo()
  380. text_info.text = "占用大小:" + picinfo_list[2] + "(Mb)" + "文件数量:" + picinfo_list[1]
  381. text_pathinfo.text = "图片存储目录:" + picinfo_list[0]
  382. }
  383. }
  384. AppImage {
  385. anchors.verticalCenter: parent.verticalCenter
  386. anchors.left: parent.left
  387. fillMode: Image.PreserveAspectFit
  388. source: "../../assets/floder.svg"
  389. }
  390. Column{
  391. id: column_info
  392. anchors.verticalCenter: parent.verticalCenter
  393. anchors.left: parent.left
  394. anchors.leftMargin: 100
  395. AppText{
  396. id: text_info
  397. text: "存储占用:" + ""
  398. color: app.fontColor
  399. font.bold: true
  400. }
  401. AppText{
  402. id: text_pathinfo
  403. text:"图片存储目录:"
  404. fontSize: 10
  405. color: "gray"
  406. }
  407. }
  408. AppButton {
  409. id:btn_fresh
  410. anchors.verticalCenter: parent.verticalCenter
  411. anchors.left: column_info.right
  412. anchors.leftMargin: dp(50)
  413. text: "刷新"
  414. flat: false
  415. textColor: "black"
  416. backgroundColor: "#e9e9e9"
  417. borderColor: "white"
  418. onClicked: {
  419. serial.readPathinfo()
  420. }
  421. }
  422. AppButton {
  423. id:btn_clear
  424. anchors.verticalCenter: parent.verticalCenter
  425. anchors.left: btn_fresh.right
  426. text: "清理"
  427. flat: false
  428. textColor: "white"
  429. backgroundColor: "#0aa26b"
  430. borderColor: "white"
  431. onClicked: {
  432. serial.removepic()
  433. }
  434. }
  435. // 权限管理入口:定位/电话/文件与媒体/修改系统设置等权限的检测与开启
  436. AppButton {
  437. id:btn_permission
  438. anchors.verticalCenter: parent.verticalCenter
  439. anchors.left: btn_clear.right
  440. anchors.leftMargin: dp(10)
  441. text: "权限管理"
  442. flat: false
  443. textColor: "white"
  444. backgroundColor: "#1a73e8"
  445. borderColor: "white"
  446. onClicked: {
  447. page_sys.navigationStack.push(permission_component)
  448. }
  449. }
  450. // 参数重置:二次弹窗确认后,串口发 JSONRPC 指令把 MCU 参数恢复出厂设置
  451. AppButton {
  452. id:btn_param_reset
  453. anchors.verticalCenter: parent.verticalCenter
  454. anchors.left: btn_permission.right
  455. anchors.leftMargin: dp(10)
  456. text: "参数重置"
  457. flat: false
  458. textColor: "white"
  459. backgroundColor: "#d9534f"
  460. borderColor: "white"
  461. onClicked: {
  462. resetConfirmPending = true
  463. nativeUtils.displayMessageBox(
  464. "参数重置确认",
  465. "将把MCU参数恢复出厂设置,该操作不可撤销!\n是否继续?",
  466. 1
  467. )
  468. }
  469. }
  470. }
  471. Row{
  472. width: parent.width
  473. height: parent.height*0.39
  474. spacing:5
  475. Rectangle {
  476. width: parent.width*0.245
  477. height: parent.height
  478. color: app.cardColor
  479. radius: 5
  480. Column{
  481. anchors.fill: parent
  482. spacing: 5
  483. AppImage {
  484. anchors.horizontalCenter: parent.horizontalCenter
  485. fillMode: Image.PreserveAspectFit
  486. source: "../../assets/ztl.svg"
  487. }
  488. AppText{
  489. anchors.horizontalCenter: parent.horizontalCenter
  490. text: "状态栏开关"
  491. color: app.fontColor
  492. font.bold: true
  493. }
  494. Switch{
  495. anchors.horizontalCenter: parent.horizontalCenter
  496. objectName: "openbar_btn"
  497. id: openbar_btn
  498. signal opernBar
  499. signal closeBar
  500. onClicked: {
  501. if(openbar_btn.checked==true){
  502. console.log("打开状态栏")
  503. opernBar()
  504. }else{
  505. console.log("关闭状态栏")
  506. closeBar()
  507. }
  508. }
  509. }
  510. }
  511. }
  512. Rectangle {
  513. radius: 5
  514. width: parent.width*0.245
  515. height: parent.height
  516. color: app.cardColor
  517. Column{
  518. anchors.fill: parent
  519. spacing: 5
  520. AppImage {
  521. anchors.horizontalCenter: parent.horizontalCenter
  522. fillMode: Image.PreserveAspectFit
  523. source: "../../assets/dhl.svg"
  524. }
  525. AppText{
  526. anchors.horizontalCenter: parent.horizontalCenter
  527. id: net_sta
  528. text: "导航栏开关"
  529. color: app.fontColor
  530. font.bold: true
  531. }
  532. Switch{
  533. id: opennav_btn
  534. objectName: "opennav_btn"
  535. signal opernNav
  536. signal closeNav
  537. anchors.horizontalCenter: parent.horizontalCenter
  538. onClicked: {
  539. if(opennav_btn.checked==true){
  540. console.log("打开导航栏")
  541. opernNav()
  542. }else{
  543. console.log("关闭导航栏")
  544. closeNav()
  545. }
  546. }
  547. }
  548. }
  549. }
  550. Rectangle {
  551. radius: 5
  552. width: parent.width*0.245
  553. height: parent.height
  554. color: app.cardColor
  555. MouseArea{
  556. anchors.fill: parent
  557. onClicked: {
  558. appimage_theme.visible = false
  559. apptext_title.visible = false
  560. apptext_select.visible = false
  561. row_select.visible = true
  562. }
  563. }
  564. Column {
  565. id: row_select
  566. visible: false
  567. anchors.fill: parent
  568. spacing: 5
  569. Component.onCompleted: {
  570. app.theme_md = settings.getValue("theme_mode")
  571. if(app.theme_md==="auto"){
  572. auto_rdb.checked = true
  573. rec_auto_rdb.border.color = "#0aa26b"
  574. apptext_select.text = "当前:自动"
  575. }else if(theme_md==="day"){
  576. day_rdb.checked = true;
  577. rec_day_rdb.border.color = "#0aa26b"
  578. apptext_select.text = "当前:白天"
  579. }else if(theme_md==="night"){
  580. night_rdb.checked = true;
  581. rec_night_rdb.border.color = "#0aa26b"
  582. apptext_select.text = "当前:黑夜"
  583. }
  584. }
  585. AppText{
  586. id: apptext_title_mode
  587. anchors.horizontalCenter: parent.horizontalCenter
  588. text: "设置模式"
  589. font.bold: true
  590. }
  591. CustomRadioButton {
  592. id: auto_rdb
  593. anchors.horizontalCenter: parent.horizontalCenter
  594. width: parent.width*0.8
  595. checked: true
  596. text: "自动"
  597. Rectangle {
  598. id: rec_auto_rdb
  599. anchors.fill: parent
  600. color: "#f5f5f5"
  601. radius: 5
  602. border.color: "#f5f5f5"
  603. border.width: 2
  604. }
  605. onCheckedChanged: {
  606. if(auto_rdb.checked){
  607. rec_auto_rdb.border.color = "#0aa26b"
  608. settings.setValue("theme_mode","auto")
  609. themChange("auto")
  610. apptext_select.text = "当前:自动"
  611. }else{
  612. rec_auto_rdb.border.color = "#f5f5f5"
  613. }
  614. row_select.visible = false
  615. rec_theme.color = app.cardColor
  616. appimage_theme.visible = true
  617. apptext_title.visible = true
  618. apptext_select.visible = true
  619. }
  620. }
  621. CustomRadioButton {
  622. id: night_rdb
  623. anchors.horizontalCenter: parent.horizontalCenter
  624. width: parent.width*0.8
  625. text: "黑夜"
  626. Rectangle {
  627. id: rec_night_rdb
  628. anchors.fill: parent
  629. color: "#f5f5f5"
  630. radius: 5
  631. border.color: "#f5f5f5"
  632. border.width: 2
  633. }
  634. onCheckedChanged: {
  635. if(night_rdb.checked){
  636. settings.setValue("theme_mode","night")
  637. rec_night_rdb.border.color = "#0aa26b"
  638. themChange("night")
  639. apptext_select.text = "当前:黑夜"
  640. }else{
  641. rec_night_rdb.border.color = "#f5f5f5"
  642. }
  643. row_select.visible = false
  644. rec_theme.color = app.cardColor
  645. appimage_theme.visible = true
  646. apptext_title.visible = true
  647. apptext_select.visible = true
  648. }
  649. }
  650. CustomRadioButton {
  651. id: day_rdb
  652. anchors.horizontalCenter: parent.horizontalCenter
  653. width: parent.width*0.8
  654. text: "白天"
  655. Rectangle {
  656. id: rec_day_rdb
  657. anchors.fill: parent
  658. color: "#f5f5f5"
  659. radius: 5
  660. border.color: "#f5f5f5"
  661. border.width: 2
  662. }
  663. onCheckedChanged: {
  664. if(day_rdb.checked){
  665. settings.setValue("theme_mode","day")
  666. rec_day_rdb.border.color = "#0aa26b"
  667. themChange("day")
  668. apptext_select.text = "当前:白天"
  669. }else{
  670. rec_day_rdb.border.color = "#f5f5f5"
  671. }
  672. row_select.visible = false
  673. rec_theme.color = app.cardColor
  674. appimage_theme.visible = true
  675. apptext_title.visible = true
  676. apptext_select.visible = true
  677. }
  678. }
  679. }
  680. Column {
  681. anchors.fill: parent
  682. spacing: 5
  683. topPadding: 10
  684. AppImage {
  685. id: appimage_theme
  686. anchors.horizontalCenter: parent.horizontalCenter
  687. fillMode: Image.PreserveAspectFit
  688. source: "../../assets/themset.svg"
  689. }
  690. AppText{
  691. id: apptext_title
  692. anchors.horizontalCenter: parent.horizontalCenter
  693. text: "设置主题"
  694. color: app.fontColor
  695. font.bold: true
  696. }
  697. AppText {
  698. id: apptext_select
  699. anchors.horizontalCenter: parent.horizontalCenter
  700. text: "当前:" + settings.getValue("theme_mode")
  701. fontSize: 10
  702. font.bold: false
  703. color: "gray"
  704. }
  705. }
  706. }
  707. Rectangle {
  708. radius: 5
  709. width: parent.width*0.245
  710. height: parent.height
  711. color: app.cardColor
  712. Column {
  713. anchors.fill: parent
  714. spacing: 5
  715. topPadding: 10
  716. AppButton {
  717. anchors.fill: parent
  718. onClicked: {
  719. logoutClicked()
  720. }
  721. }
  722. AppImage {
  723. id: image_exit
  724. anchors.horizontalCenter: parent.horizontalCenter
  725. fillMode: Image.PreserveAspectFit
  726. source: "../../assets/logout.svg"
  727. }
  728. AppText{
  729. anchors.horizontalCenter: parent.horizontalCenter
  730. text: "退出登录"
  731. color: app.fontColor
  732. font.bold: true
  733. }
  734. }
  735. }
  736. }
  737. Row {
  738. width: parent.width
  739. height: parent.height*0.39
  740. spacing: 5
  741. Rectangle {
  742. radius: 5
  743. width: parent.width*0.245
  744. height: parent.height
  745. color: app.cardColor
  746. Column {
  747. anchors.fill: parent
  748. spacing: 5
  749. topPadding: 10
  750. AppImage {
  751. anchors.horizontalCenter: parent.horizontalCenter
  752. fillMode: Image.PreserveAspectFit
  753. source: "../../assets/updateboard.svg"
  754. }
  755. AppText {
  756. anchors.horizontalCenter: parent.horizontalCenter
  757. text: "升级主板"
  758. color: app.fontColor
  759. font.bold: true
  760. }
  761. AppText {
  762. anchors.horizontalCenter: parent.horizontalCenter
  763. text: "当前:" + app.boardversionText
  764. fontSize: 10
  765. color: "gray"
  766. }
  767. MouseArea {
  768. anchors.horizontalCenter: parent.horizontalCenter
  769. width: parent.width * 0.7
  770. height: dp(30)
  771. AppText {
  772. anchors.centerIn: parent
  773. text: "点击升级"
  774. color: "#0aa26b"
  775. font.pixelSize: sp(12)
  776. }
  777. onClicked: {
  778. var dialog = InputDialog.inputTextSingleLine(page_sys,
  779. "请输入密钥!",
  780. "Input here",
  781. function(ok, text){
  782. if(ok){
  783. if(text==="2024"){
  784. mqtt.sendUpdatesBoard()
  785. }else{
  786. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  787. }
  788. }
  789. }
  790. )
  791. }
  792. }
  793. }
  794. }
  795. Rectangle {
  796. radius: 5
  797. width: parent.width*0.245
  798. height: parent.height
  799. color: app.cardColor
  800. Column {
  801. anchors.fill: parent
  802. spacing: 5
  803. topPadding: 10
  804. AppImage {
  805. anchors.horizontalCenter: parent.horizontalCenter
  806. fillMode: Image.PreserveAspectFit
  807. source: "../../assets/updateapp.svg"
  808. }
  809. AppText {
  810. anchors.horizontalCenter: parent.horizontalCenter
  811. text: "升级App"
  812. color: app.fontColor
  813. font.bold: true
  814. }
  815. AppText {
  816. anchors.horizontalCenter: parent.horizontalCenter
  817. text: "当前:" + app.appversionText
  818. fontSize: 10
  819. color: "gray"
  820. }
  821. MouseArea {
  822. anchors.horizontalCenter: parent.horizontalCenter
  823. width: parent.width * 0.7
  824. height: dp(30)
  825. AppText {
  826. anchors.centerIn: parent
  827. text: "点击升级"
  828. color: "#0aa26b"
  829. font.pixelSize: sp(12)
  830. }
  831. onClicked: {
  832. var dialog = InputDialog.inputTextSingleLine(page_sys,
  833. "请输入密钥!",
  834. "Input here",
  835. function(ok, text){
  836. if(ok){
  837. if(text==="2024"){
  838. mqtt.sendUpdateApp()
  839. }else{
  840. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  841. }
  842. }
  843. }
  844. )
  845. }
  846. }
  847. }
  848. }
  849. Rectangle {
  850. id: rec_theme
  851. radius: 5
  852. width: parent.width*0.245
  853. height: parent.height
  854. color: app.cardColor
  855. Column {
  856. anchors.fill: parent
  857. anchors.topMargin: parent.height * 0.15
  858. spacing: 10
  859. AppImage {
  860. id: image_reboot
  861. anchors.horizontalCenter: parent.horizontalCenter
  862. fillMode: Image.PreserveAspectFit
  863. source: "../../assets/reboot.svg"
  864. }
  865. AppText{
  866. id: text_reboot
  867. anchors.horizontalCenter: parent.horizontalCenter
  868. text: "系统重启"
  869. color: app.fontColor
  870. font.bold: true
  871. }
  872. MouseArea {
  873. anchors.horizontalCenter: parent.horizontalCenter
  874. width: parent.width * 0.7
  875. height: dp(30)
  876. AppText {
  877. anchors.centerIn: parent
  878. text: "点击重启"
  879. color: "#0aa26b"
  880. font.pixelSize: sp(12)
  881. }
  882. onClicked: {
  883. var dialog = InputDialog.inputTextSingleLine(page_sys,
  884. "请输入密钥!",
  885. "Input here",
  886. function(ok, text){
  887. if(ok){
  888. if(text==="2024"){
  889. serial.reboot()
  890. }else{
  891. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  892. }
  893. }
  894. }
  895. )
  896. }
  897. }
  898. }
  899. }
  900. Rectangle {
  901. radius: 5
  902. width: parent.width*0.245
  903. height: parent.height
  904. color: app.cardColor
  905. Column {
  906. anchors.centerIn: parent
  907. anchors.horizontalCenter: parent.horizontalCenter
  908. spacing: 5
  909. AppText {
  910. anchors.horizontalCenter: parent.horizontalCenter
  911. text: "参数调试"
  912. color: app.fontColor
  913. font.bold: true
  914. }
  915. MouseArea {
  916. anchors.horizontalCenter: parent.horizontalCenter
  917. width: parent.width * 0.7
  918. height: dp(30)
  919. AppText {
  920. anchors.centerIn: parent
  921. text: "点击进入"
  922. color: "#0aa26b"
  923. font.pixelSize: sp(12)
  924. }
  925. onClicked: {
  926. var dialog = InputDialog.inputTextSingleLine(page_sys,
  927. "请输入密钥!",
  928. "Input here",
  929. function(ok, text){
  930. if(ok){
  931. if(text==="2024"){
  932. page_sys.navigationStack.push(sqlite_component)
  933. }else{
  934. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  935. }
  936. }
  937. }
  938. )
  939. }
  940. }
  941. }
  942. }
  943. }
  944. }
  945. }