ProfilePage.qml 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  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. MediaPlayer{
  19. id: audio
  20. audioOutput: AudioOutput{}
  21. source: Qt.resolvedUrl("../../assets/mp3/button.mp3")
  22. }
  23. Connections {
  24. target: mqtt
  25. }
  26. Component {
  27. id: sqlite_component
  28. AppPage {
  29. id: sqlite_page
  30. implicitHeight: 800
  31. implicitWidth: 1280
  32. rightBarItem: IconButtonBarItem {
  33. iconType: IconType.paintbrush
  34. onClicked: {
  35. console.log("database")
  36. sqliteModal.open()
  37. }
  38. }
  39. //行表头-竖向的
  40. property int verHeaderHeight: 30
  41. property int verHeaderWidth: 150
  42. //列表头-横向的
  43. property int horHeaderHeight: 30
  44. //滚动条
  45. property color scrollBarColor: "cyan"
  46. property int scrollBarWidth: 6
  47. //列宽
  48. property variant columnWidthArr: [30,100,100,100,100,100,200,100,100,100,100,100,100]
  49. property variant table_mqtt_Value: ["id","dtype","ip","port","imei","uid","pwd","clientid","qos","keepalive","sub","pub","offline"]
  50. property variant table_ftp_Value: ["id","ip","port","dir","uid","pwd","mode"]
  51. property variant table_location_Value: ["id","lbs_lat","lbs_lng","gps_lat","gps_lng","gps_elevation"]
  52. property variant table_camera_Value: ["camera_type","mode","stitch_photonum","photo_width","photo_height","auto_focus"]
  53. property variant table_json_Value: ["id","datetime","json_data","json_data"]
  54. property int datacount: 1
  55. DatabaseInterface
  56. {
  57. id: db_cfg
  58. }
  59. EasyTableModel{
  60. id: table_model
  61. horHeader: table_mqtt_Value
  62. //initData: []//myClass.getdata_JsonArray()
  63. //initData: []
  64. }
  65. //表格内容(不包含表头)
  66. TableView{
  67. id: table_view
  68. height: sqlite_page.implicitHeight
  69. anchors{
  70. left: parent.left
  71. right: parent.right
  72. top: parent.top
  73. leftMargin: 30
  74. topMargin: sqlite_page.horHeaderHeight
  75. }
  76. clip: true
  77. boundsBehavior: Flickable.StopAtBounds
  78. columnSpacing: 1
  79. rowSpacing: 1
  80. //视图的高度
  81. //contentHeight: rowHeightProvider(0) * rows + rowHeightProvider(rows-1)
  82. //视图的宽度
  83. //contentWidth:
  84. //content内容区域边距,但是不影响滚动条的位置
  85. //leftMargin:
  86. //topMargin:
  87. //此属性可以包含一个函数,该函数返回模型中每行的行高
  88. rowHeightProvider: function (row) {
  89. return sqlite_page.verHeaderHeight;
  90. }
  91. //此属性可以保存一个函数,该函数返回模型中每个列的列宽
  92. columnWidthProvider: function (column) {
  93. return sqlite_page.columnWidthArr[column];
  94. //return Math.max(1, (table_view.width - leftMargin) / table_view.columns)
  95. }
  96. ScrollBar.vertical: ScrollBar {
  97. id: scroll_vertical
  98. anchors.right: parent.right
  99. anchors.rightMargin: 2
  100. //active: table_view.ScrollBar.vertical.active
  101. //policy: ScrollBar.AsNeeded
  102. contentItem: Rectangle{
  103. visible: (scroll_vertical.size<1.0)
  104. implicitWidth: sqlite_page.scrollBarWidth
  105. color: sqlite_page.scrollBarColor
  106. }
  107. }
  108. ScrollBar.horizontal: ScrollBar {
  109. id: scroll_horizontal
  110. anchors.bottom: parent.bottom
  111. anchors.bottomMargin: 2
  112. //active: table_view.ScrollBar.vertical.active
  113. //policy: ScrollBar.AsNeeded
  114. contentItem: Rectangle{
  115. visible: (scroll_horizontal.size<1.0)
  116. implicitHeight: sqlite_page.scrollBarWidth
  117. color: sqlite_page.scrollBarColor
  118. }
  119. }
  120. //model是在C++中定义的,和QtC++是类似的
  121. model: table_model
  122. delegate: Rectangle {
  123. color: (model.row%2)?"orange":Qt.darker("orange") //根据行数设置背景颜色
  124. AppText{
  125. id : value_text
  126. anchors.centerIn: parent
  127. verticalAlignment: Text.AlignVCenter
  128. // 水平居中对齐
  129. horizontalAlignment: Text.AlignHCenter
  130. //elide: Text.ElideRight
  131. // selectByMouse: true
  132. // selectedTextColor: "black"
  133. // selectionColor: "white"
  134. //获取单元格对应的值
  135. text: model.value
  136. AppButton {
  137. onClicked: {
  138. var dialog = InputDialog.inputTextSingleLine(app,
  139. "请输入要修改内容",
  140. value_text.text,
  141. function(ok,text){
  142. if(ok){
  143. value_text.text = text
  144. model.edit=text;
  145. //将改变写入到数据库中
  146. console.log("edit",model.value)
  147. if(sqlite_switch.checked)
  148. {
  149. if(table_combox.displayText===table_combox.model[0]||table_combox.displayText===table_combox.model[1])
  150. {
  151. columnWidthArr = [30,100,100,100,100,100,200,100,100,100,100,100,100]
  152. db_cfg.updateData(table_combox.displayText,table_mqtt_Value[index],model.value)
  153. }
  154. if(table_combox.displayText===table_combox.model[2]||table_combox.displayText===table_combox.model[3])
  155. {
  156. db_cfg.updateData(table_combox.displayText,table_ftp_Value[index],model.value)
  157. }
  158. if(table_combox.displayText===table_combox.model[4])
  159. {
  160. db_cfg.updateData(table_combox.displayText,table_location_Value[index],model.value)
  161. }
  162. if(table_combox.displayText===table_combox.model[5]){
  163. db_cfg.updateData(table_combox.displayText,table_camera_Value[index],model.value)
  164. }
  165. }
  166. }
  167. })
  168. // Disable the negative action
  169. dialog.negativeAction = false
  170. // Dismiss when touched outside
  171. dialog.outsideTouchable = true
  172. }
  173. }
  174. // onEditingFinished: {
  175. // model.edit=text;
  176. // //将改变写入到数据库中
  177. // console.log("edit",model.value)
  178. // if(sqlite_switch.checked)
  179. // {
  180. // if(table_combox.displayText===table_combox.model[0]||table_combox.displayText===table_combox.model[1])
  181. // {
  182. // db_cfg.updateData(table_combox.displayText,table_mqtt_Value[index],model.value)
  183. // }
  184. // if(table_combox.displayText===table_combox.model[2]||table_combox.displayText===table_combox.model[3])
  185. // {
  186. // db_cfg.updateData(table_combox.displayText,table_ftp_Value[index],model.value)
  187. // }
  188. // if(table_combox.displayText===table_combox.model[4])
  189. // {
  190. // db_cfg.updateData(table_combox.displayText,table_location_Value[index],model.value)
  191. // }
  192. // }
  193. // }
  194. }
  195. }
  196. }
  197. //横项表头
  198. Item{
  199. id: header_horizontal
  200. anchors{
  201. left: parent.left
  202. right: parent.right
  203. leftMargin: 30//control.verHeaderWidth
  204. }
  205. height: sqlite_page.horHeaderHeight
  206. z: 2
  207. //暂存鼠标拖动的位置
  208. property int posXTemp: 0
  209. MouseArea{
  210. anchors.fill: parent
  211. onPressed: {
  212. header_horizontal.posXTemp=mouseX;
  213. }
  214. onPositionChanged: {
  215. if(table_view.contentX+(header_horizontal.posXTemp-mouseX)>0){
  216. table_view.contentX+=(header_horizontal.posXTemp-mouseX);
  217. }else{
  218. table_view.contentX=0;
  219. }
  220. header_horizontal.posXTemp=mouseX;
  221. }
  222. }
  223. Row {
  224. id: header_horizontal_row
  225. anchors.fill: parent
  226. leftPadding: -table_view.contentX
  227. clip: true
  228. spacing: 0
  229. Repeater {
  230. model: table_view.columns > 0 ? table_view.columns : 0
  231. Rectangle {
  232. id: header_horizontal_item
  233. width: table_view.columnWidthProvider(index)+table_view.columnSpacing
  234. height: sqlite_page.horHeaderHeight
  235. color: "purple"
  236. AppText {
  237. anchors.centerIn: parent
  238. text: table_model.headerData(index, Qt.Horizontal)
  239. }
  240. Rectangle{
  241. width: 1
  242. height: parent.height
  243. anchors.right: parent.right
  244. color: "black"
  245. opacity: 0.5
  246. }
  247. MouseArea{
  248. width: 3
  249. height: parent.height
  250. anchors.right: parent.right
  251. cursorShape: Qt.SplitHCursor
  252. onPressed: header_horizontal.posXTemp=mouseX;
  253. onPositionChanged: {
  254. if((header_horizontal_item.width-(header_horizontal.posXTemp-mouseX))>10){
  255. header_horizontal_item.width-=(header_horizontal.posXTemp-mouseX);
  256. }else{
  257. header_horizontal_item.width=10;
  258. }
  259. header_horizontal.posXTemp=mouseX;
  260. sqlite_page.columnWidthArr[index]=(header_horizontal_item.width-table_view.columnSpacing);
  261. //刷新布局,这样宽度才会改变
  262. table_view.forceLayout();
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. //竖向表头
  270. Column {
  271. id: header_verical
  272. height: sqlite_page.implicitHeight
  273. anchors{
  274. left: parent.left
  275. top: parent.top
  276. //bottom: parent.bottom
  277. topMargin: sqlite_page.horHeaderHeight
  278. }
  279. topPadding: -table_view.contentY
  280. z: 2
  281. clip: true
  282. spacing: 1
  283. Repeater {
  284. model: table_view.rows > 0 ? table_view.rows : 0
  285. Rectangle {
  286. width: 30
  287. height: table_view.rowHeightProvider(index)
  288. color: "green"
  289. Text {
  290. anchors.centerIn: parent
  291. text: table_model.headerData(index, Qt.Vertical)
  292. }
  293. }
  294. }
  295. }
  296. // JsonListModel {
  297. // id: jsonModel
  298. // source: table_model.initData
  299. // keyField: "id"
  300. // }
  301. // AppListView {
  302. // anchors.fill: parent
  303. // bottomMargin: nativeUtils.safeAreaInsets.bottom
  304. // model: jsonModel
  305. // delegate: SimpleRow {
  306. // text: model.sub
  307. // }
  308. // // Transition animation for adding items
  309. // add: Transition {
  310. // NumberAnimation {
  311. // property: "opacity"
  312. // from: 0
  313. // to: 1
  314. // duration: 1000
  315. // easing.type: Easing.OutQuad
  316. // }
  317. // }
  318. // }
  319. AppModal {
  320. id: sqliteModal
  321. fullscreen: false
  322. modalHeight: dp(380) + nativeUtils.safeAreaInsets.bottom
  323. NavigationStack {
  324. AppPage {
  325. title: "配置信息管理"
  326. rightBarItem: TextButtonBarItem {
  327. text: "关闭"
  328. textItem.font.pixelSize: sp(16)
  329. onClicked: sqliteModal.close()
  330. }
  331. Column {
  332. id: sqliteColumn
  333. width: parent.width
  334. Section {
  335. title: "数据库"
  336. ComboBox {
  337. id: sqlite_combox
  338. height: dp(40)
  339. width: parent.width/2
  340. model: ["config.db", "data.db"]
  341. }
  342. }
  343. Section {
  344. title: "数据表"
  345. ComboBox {
  346. id: table_combox
  347. height: dp(40)
  348. width: parent.width/2
  349. model: ["mqtt", "mqtt_other","ftp","ftp_other","location","camera","data"]
  350. onActivated: {
  351. console.log(displayText)
  352. table_model.table_name = displayText
  353. if(displayText===model[0]||displayText===model[1])
  354. {
  355. columnWidthArr = [30,100,100,100,100,100,200,100,100,100,100,100,100]
  356. table_model.horHeader = table_mqtt_Value
  357. }
  358. else if(displayText===model[2]||displayText===model[3])
  359. {
  360. table_model.horHeader = table_ftp_Value
  361. }
  362. else if(displayText===model[4])
  363. {
  364. table_model.horHeader = table_location_Value
  365. }else if(displayText===model[5]){
  366. columnWidthArr = [100,100,150,100,100,100]
  367. table_model.horHeader = table_camera_Value
  368. }
  369. else if(displayText===model[6])
  370. {
  371. table_model.horHeader = table_json_Value
  372. }
  373. table_model.initData=db_cfg.queryData(displayText,datacount)
  374. }
  375. }
  376. }
  377. AppText {
  378. id: sqlite_text
  379. text: "开关:"
  380. }
  381. AppSwitch {
  382. id: sqlite_switch
  383. anchors.left: sqlite_text.light
  384. anchors.leftMargin: 10
  385. onToggled: {
  386. if(sqlite_switch.checked){
  387. var dbs = db_cfg.openDatabase(sqlite_combox.displayText)
  388. if(dbs){
  389. console.log("打开数据库成功");
  390. sqlite_combox.enabled = false
  391. table_combox.enabled = true
  392. if(sqlite_combox.displayText==="data.db")
  393. {
  394. table_combox.displayText=table_combox.model[6];
  395. }
  396. table_model.table_name = table_combox.displayText
  397. table_model.initData=db_cfg.queryData(table_combox.displayText,datacount)
  398. //text_row_count.text = db_cfg.getTable_row(table_combox.displayText)
  399. //rowindex_text.text = datacount
  400. }else{
  401. sqlite_switch.checked = false
  402. sqlite_combox.enabled = true;
  403. console.log("打开数据库失败");
  404. }
  405. }else{
  406. sqlite_combox.enabled = true;
  407. db_cfg.closeDatabase()
  408. console.log("关闭数据库");
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }
  415. }
  416. }
  417. }
  418. Grid {
  419. anchors.fill: parent
  420. anchors.leftMargin: 5
  421. anchors.topMargin:5
  422. //anchors.horizontalCenter: parent.horizontalCenter
  423. columns: 1
  424. rows: 3
  425. columnSpacing: 10
  426. rowSpacing: 5
  427. horizontalItemAlignment: Grid.AlignHCenter
  428. Rectangle {
  429. radius: 5
  430. width: parent.width * 0.995
  431. height: parent.height*0.18
  432. color: app.cardColor
  433. Timer {
  434. interval: 1000
  435. running: true
  436. repeat: true
  437. onTriggered: {
  438. picinfo_list = serial.pathinfo()
  439. text_info.text = "占用大小:" + picinfo_list[2] + "(Mb)" + "文件数量:" + picinfo_list[1]
  440. text_pathinfo.text = "图片存储目录:" + picinfo_list[0]
  441. }
  442. }
  443. AppImage {
  444. anchors.verticalCenter: parent.verticalCenter
  445. anchors.left: parent.left //
  446. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  447. source: "../../assets/floder.svg"
  448. }
  449. Column{
  450. id: column_info
  451. anchors.verticalCenter: parent.verticalCenter // 在垂直方向上居中
  452. anchors.left: parent.left //
  453. anchors.leftMargin: 100
  454. AppText{
  455. id: text_info
  456. text: "存储占用:" + ""
  457. color: app.fontColor
  458. font.bold: true
  459. }
  460. AppText{
  461. id: text_pathinfo
  462. text:"图片存储目录:"
  463. fontSize: 10
  464. color: "gray"
  465. }
  466. }
  467. AppButton {
  468. id:btn_fresh
  469. anchors.verticalCenter: parent.verticalCenter // 在垂直方向上居中
  470. anchors.left: column_info.right
  471. anchors.leftMargin: dp(50)
  472. text: "刷新"
  473. flat: false
  474. textColor: "black"
  475. backgroundColor: "#e9e9e9"
  476. borderColor: "white"
  477. onClicked: {
  478. serial.readPathinfo()
  479. }
  480. }
  481. AppButton {
  482. id:btn_clear
  483. anchors.verticalCenter: parent.verticalCenter // 在垂直方向上居中
  484. anchors.left: btn_fresh.right
  485. text: "清理"
  486. flat: false
  487. textColor: "white"
  488. backgroundColor: "#0aa26b"
  489. borderColor: "white"
  490. onClicked: {
  491. serial.removepic()
  492. }
  493. }
  494. }
  495. Row{
  496. //anchors.fill: parent
  497. width: parent.width
  498. height: parent.height*0.35
  499. spacing:5
  500. Rectangle {
  501. width: parent.width*0.245
  502. height: parent.height
  503. color: app.cardColor
  504. radius: 5
  505. Column{
  506. anchors.fill: parent
  507. spacing: 5
  508. AppImage {
  509. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  510. // 将元素的顶部锚定到父元素的顶部
  511. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  512. source: "../../assets/ztl.svg"
  513. }
  514. AppText{
  515. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  516. text: "状态栏开关"
  517. color: app.fontColor
  518. font.bold: true
  519. }
  520. Switch{
  521. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  522. objectName: "openbar_btn"
  523. id: openbar_btn
  524. signal opernBar
  525. signal closeBar
  526. onClicked: {
  527. if(openbar_btn.checked==true){
  528. console.log("打开状态栏")
  529. opernBar()
  530. }else{
  531. console.log("关闭状态栏")
  532. closeBar()
  533. }
  534. }
  535. }
  536. }
  537. }
  538. Rectangle {
  539. radius: 5
  540. width: parent.width*0.245
  541. height: parent.height
  542. color: app.cardColor
  543. Column{
  544. anchors.fill: parent
  545. spacing: 5
  546. AppImage {
  547. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  548. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  549. source: "../../assets/dhl.svg"
  550. }
  551. AppText{
  552. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  553. id: net_sta
  554. text: "导航栏开关"
  555. color: app.fontColor
  556. font.bold: true
  557. }
  558. Switch{
  559. id: opennav_btn
  560. objectName: "opennav_btn"
  561. signal opernNav
  562. signal closeNav
  563. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  564. onClicked: {
  565. if(opennav_btn.checked==true){
  566. console.log("打开导航栏")
  567. opernNav()
  568. }else{
  569. console.log("关闭导航栏")
  570. closeNav()
  571. }
  572. }
  573. }
  574. }
  575. }
  576. Rectangle {
  577. radius: 5
  578. width: parent.width*0.245
  579. height: parent.height
  580. color: app.cardColor
  581. MouseArea{
  582. anchors.fill: parent
  583. onClicked: {
  584. appimage_theme.visible = false
  585. apptext_title.visible = false
  586. apptext_select.visible = false
  587. row_select.visible = true
  588. }
  589. }
  590. Column {
  591. id: row_select
  592. visible: false
  593. anchors.fill: parent
  594. spacing: 5
  595. Component.onCompleted: {
  596. app.theme_md = settings.getValue("theme_mode")
  597. if(app.theme_md==="auto"){
  598. auto_rdb.checked = true
  599. rec_auto_rdb.border.color = "#0aa26b"
  600. apptext_select.text = "当前:自动"
  601. }else if(theme_md==="day"){
  602. day_rdb.checked = true;
  603. rec_day_rdb.border.color = "#0aa26b"
  604. apptext_select.text = "当前:白天"
  605. }else if(theme_md==="night"){
  606. night_rdb.checked = true;
  607. rec_night_rdb.border.color = "#0aa26b"
  608. apptext_select.text = "当前:黑夜"
  609. }
  610. }
  611. AppText{
  612. id: apptext_title_mode
  613. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  614. text: "设置模式"
  615. font.bold: true
  616. }
  617. CustomRadioButton {
  618. id: auto_rdb
  619. anchors.horizontalCenter: parent.horizontalCenter
  620. width: parent.width*0.8
  621. checked: true
  622. text: "自动"
  623. Rectangle {
  624. id: rec_auto_rdb
  625. anchors.fill: parent
  626. color: "#f5f5f5"
  627. radius: 5
  628. border.color: "#f5f5f5"
  629. border.width: 2
  630. }
  631. onCheckedChanged: {
  632. if(auto_rdb.checked){
  633. rec_auto_rdb.border.color = "#0aa26b"
  634. settings.setValue("theme_mode","auto")
  635. themChange("auto")
  636. apptext_select.text = "当前:自动"
  637. }else{
  638. rec_auto_rdb.border.color = "#f5f5f5"
  639. }
  640. row_select.visible = false
  641. rec_theme.color = app.cardColor
  642. appimage_theme.visible = true
  643. apptext_title.visible = true
  644. apptext_select.visible = true
  645. }
  646. }
  647. CustomRadioButton {
  648. id: night_rdb
  649. anchors.horizontalCenter: parent.horizontalCenter
  650. width: parent.width*0.8
  651. text: "黑夜"
  652. Rectangle {
  653. id: rec_night_rdb
  654. anchors.fill: parent
  655. color: "#f5f5f5"
  656. radius: 5
  657. border.color: "#f5f5f5"
  658. border.width: 2
  659. }
  660. onCheckedChanged: {
  661. if(night_rdb.checked){
  662. settings.setValue("theme_mode","night")
  663. rec_night_rdb.border.color = "#0aa26b"
  664. themChange("night")
  665. apptext_select.text = "当前:黑夜"
  666. }else{
  667. rec_night_rdb.border.color = "#f5f5f5"
  668. }
  669. row_select.visible = false
  670. rec_theme.color = app.cardColor
  671. appimage_theme.visible = true
  672. apptext_title.visible = true
  673. apptext_select.visible = true
  674. }
  675. }
  676. CustomRadioButton {
  677. id: day_rdb
  678. anchors.horizontalCenter: parent.horizontalCenter
  679. width: parent.width*0.8
  680. text: "白天"
  681. Rectangle {
  682. id: rec_day_rdb
  683. anchors.fill: parent
  684. color: "#f5f5f5"
  685. radius: 5
  686. border.color: "#f5f5f5"
  687. border.width: 2
  688. }
  689. onCheckedChanged: {
  690. if(day_rdb.checked){
  691. settings.setValue("theme_mode","day")
  692. rec_day_rdb.border.color = "#0aa26b"
  693. themChange("day")
  694. apptext_select.text = "当前:白天"
  695. }else{
  696. rec_day_rdb.border.color = "#f5f5f5"
  697. }
  698. row_select.visible = false
  699. rec_theme.color = app.cardColor
  700. appimage_theme.visible = true
  701. apptext_title.visible = true
  702. apptext_select.visible = true
  703. }
  704. }
  705. }
  706. Column {
  707. anchors.fill: parent
  708. spacing: 5
  709. AppImage {
  710. id: appimage_theme
  711. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  712. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  713. source: "../../assets/themset.svg"
  714. }
  715. AppText{
  716. id: apptext_title
  717. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  718. text: "设置主题"
  719. color: app.fontColor
  720. font.bold: true
  721. }
  722. AppText {
  723. id: apptext_select
  724. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  725. text: "当前:" + settings.getValue("theme_mode")
  726. fontSize: 10
  727. font.bold: false
  728. color: "gray"
  729. }
  730. }
  731. }
  732. Rectangle {
  733. radius: 5
  734. width: parent.width*0.245
  735. height: parent.height
  736. color: app.cardColor
  737. Column {
  738. anchors.fill: parent
  739. spacing: 10
  740. AppButton {
  741. anchors.fill: parent
  742. onClicked: {
  743. logoutClicked()
  744. }
  745. }
  746. AppImage {
  747. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  748. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  749. source: "../../assets/logout.svg"
  750. }
  751. AppText{
  752. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  753. text: "退出登录"
  754. color: app.fontColor
  755. font.bold: true
  756. }
  757. }
  758. }
  759. }
  760. Row {
  761. width: parent.width
  762. height: parent.height*0.43
  763. spacing: 5
  764. Rectangle {
  765. radius: 5
  766. width: parent.width*0.245
  767. height: parent.height
  768. color: app.cardColor
  769. Column {
  770. id: column_bi
  771. anchors.fill: parent
  772. MouseArea {
  773. anchors.fill: parent
  774. onClicked: {
  775. column_bi.visible = false
  776. column_bi.enabled = false
  777. column_bu.visible = true
  778. column_bu.enabled = true
  779. }
  780. }
  781. AppText{
  782. anchors.centerIn: parent
  783. text: "控制系统版本:" + app.boardversionText
  784. fontSize: 20
  785. font.bold: true
  786. color: app.fontColor
  787. }
  788. }
  789. Column {
  790. id: column_bu
  791. visible: false
  792. anchors.fill: parent
  793. spacing: 10
  794. AppButton {
  795. anchors.fill: parent
  796. onClicked: {
  797. column_bi.visible = true
  798. column_bi.enabled = true
  799. column_bu.visible = false
  800. column_bu.enabled = false
  801. var dialog = InputDialog.inputTextSingleLine(page_sys,
  802. "请输入密钥!",
  803. "Input here",
  804. function(ok,text){
  805. if(ok){
  806. if(text==="2024"){
  807. mqtt.sendUpdatesBoard()
  808. }else{
  809. /*
  810. 0:普通消息框,只有一个“确定”按钮。
  811. 1:警告消息框,通常用于提醒用户注意。
  812. 2:确认消息框,包含“是”和“否”两个按钮。
  813. 3:询问消息框,包含“是”、“否”和“取消”三个按钮。
  814. 4:错误消息框,用于显示错误或异常情况。
  815. */
  816. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  817. }
  818. }
  819. }
  820. )
  821. }
  822. }
  823. AppImage {
  824. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  825. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  826. source: "../../assets/updateboard.svg"
  827. }
  828. AppText{
  829. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  830. text: "升级主板"
  831. color: app.fontColor
  832. font.bold: true
  833. }
  834. }
  835. }
  836. Rectangle {
  837. radius: 5
  838. width: parent.width*0.245
  839. height: parent.height
  840. color: app.cardColor
  841. Column {
  842. id: column_ai
  843. spacing: 10
  844. anchors.fill: parent
  845. MouseArea {
  846. anchors.fill: parent
  847. onClicked: {
  848. column_ai.visible = false
  849. column_ai.enabled = false
  850. column_au.visible = true
  851. column_au.enabled = true
  852. }
  853. }
  854. AppText{
  855. anchors.centerIn: parent
  856. text: "App版本:" + app.appversionText
  857. fontSize: 20
  858. font.bold: true
  859. color: app.fontColor
  860. }
  861. }
  862. Column {
  863. id: column_au
  864. visible: false
  865. spacing: 10
  866. anchors.fill: parent
  867. AppButton {
  868. anchors.fill: parent
  869. onClicked: {
  870. column_ai.visible = true
  871. column_ai.enabled = true
  872. column_au.visible = false
  873. column_au.enabled = false
  874. var dialog = InputDialog.inputTextSingleLine(page_sys,
  875. "请输入密钥!",
  876. "Input here",
  877. function(ok,text){
  878. if(ok){
  879. if(text==="2024"){
  880. mqtt.sendUpdateApp()
  881. }else{
  882. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  883. }
  884. }
  885. }
  886. )
  887. }
  888. }
  889. AppImage {
  890. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  891. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  892. source: "../../assets/updateapp.svg"
  893. }
  894. AppText{
  895. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  896. text: "升级App"
  897. color: app.fontColor
  898. font.bold: true
  899. }
  900. }
  901. }
  902. Rectangle {
  903. id: rec_theme
  904. radius: 5
  905. width: parent.width*0.245
  906. height: parent.height
  907. color: app.cardColor
  908. Column {
  909. anchors.fill: parent
  910. spacing: 10
  911. AppButton {
  912. id: button_reboot
  913. anchors.fill: parent
  914. onClicked:{
  915. serial.reboot()
  916. }
  917. }
  918. AppImage {
  919. id: image_reboot
  920. anchors.centerIn: parent
  921. //anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  922. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  923. source: "../../assets/reboot.svg"
  924. }
  925. AppText{
  926. id: text_reboot
  927. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  928. anchors.top: image_reboot.bottom
  929. anchors.topMargin: 10
  930. text: "系统重启"
  931. color: app.fontColor
  932. font.bold: true
  933. }
  934. }
  935. }
  936. Rectangle {
  937. radius: 5
  938. width: parent.width*0.245
  939. height: parent.height
  940. color: app.cardColor
  941. MouseArea {
  942. anchors.fill: parent
  943. onClicked: {
  944. if(column_di.visible === false){
  945. column_di.visible = true
  946. column_di.enabled = true
  947. column_debug.visible = false
  948. column_debug.enabled = false
  949. }
  950. }
  951. }
  952. Column {
  953. id: column_di
  954. spacing: 10
  955. anchors.fill: parent
  956. AppButton {
  957. anchors.centerIn: parent
  958. text: "高级功能"
  959. textColor: app.fontColor
  960. flat: false
  961. borderColor: "green"
  962. fontBold: true
  963. onClicked: {
  964. var dialog = InputDialog.inputTextSingleLine(page_sys,
  965. "请输入密钥!",
  966. "Input here",
  967. function(ok,text){
  968. if(ok){
  969. if(text==="2024"){
  970. column_di.visible = false
  971. column_di.enabled = false
  972. column_debug.visible = true
  973. column_debug.enabled = true
  974. }else{
  975. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  976. }
  977. }
  978. }
  979. )
  980. }
  981. }
  982. }
  983. Column {
  984. id: column_debug
  985. spacing: 10
  986. visible: false
  987. enabled: false
  988. anchors.fill: parent
  989. AppCheckBox {
  990. id: acb_log
  991. text: "日志"
  992. anchors.horizontalCenter: parent.horizontalCenter
  993. onCheckedChanged: {
  994. if(acb_log.checked){
  995. app.log_enable = true
  996. console.log("日志开")
  997. }else{
  998. app.log_enable = false
  999. console.log("日志关")
  1000. }
  1001. }
  1002. }
  1003. AppCheckBox {
  1004. id: acb_stitch
  1005. text: "拼接"
  1006. anchors.horizontalCenter: parent.horizontalCenter
  1007. onCheckedChanged: {
  1008. if(acb_stitch.checked){
  1009. app.stitch_enable = true
  1010. console.log("拼接参数开")
  1011. }else{
  1012. app.stitch_enable = false
  1013. console.log("拼接参数关")
  1014. }
  1015. }
  1016. }
  1017. AppCheckBox {
  1018. id: acb_pqt
  1019. text: "清晰度"
  1020. anchors.horizontalCenter: parent.horizontalCenter
  1021. onCheckedChanged: {
  1022. if(acb_pqt.checked){
  1023. app.photoclarity = true
  1024. console.log("拼接参数开")
  1025. }else{
  1026. app.photoclarity = false
  1027. console.log("拼接参数关")
  1028. }
  1029. }
  1030. }
  1031. AppButton {
  1032. anchors.horizontalCenter: parent.horizontalCenter
  1033. text: "SQLITE"
  1034. implicitHeight: 25
  1035. implicitWidth: 40
  1036. flat: false
  1037. onClicked: {
  1038. //打开SQLIT界面
  1039. page_sys.navigationStack.push(sqlite_component)
  1040. // var component = Qt.createComponent("SqlScreen.qml")
  1041. // if(component.status === Component.Ready){
  1042. // var SqlScreen = component.createObject(parent)
  1043. // if(SqlScreen!==null){
  1044. // SqlScreen.show()
  1045. // }
  1046. // }
  1047. }
  1048. }
  1049. }
  1050. }
  1051. }
  1052. }
  1053. }