ProfilePage.qml 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152
  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.39
  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.centerIn: parent //垂直居中显示
  712. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  713. source: "../../assets/themset.svg"
  714. }
  715. AppText{
  716. id: apptext_title
  717. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  718. anchors.top: appimage_theme.bottom
  719. anchors.topMargin: 10
  720. text: "设置主题"
  721. color: app.fontColor
  722. font.bold: true
  723. }
  724. AppText {
  725. id: apptext_select
  726. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  727. text: "当前:" + settings.getValue("theme_mode")
  728. fontSize: 10
  729. font.bold: false
  730. color: "gray"
  731. }
  732. }
  733. }
  734. Rectangle {
  735. radius: 5
  736. width: parent.width*0.245
  737. height: parent.height
  738. color: app.cardColor
  739. Column {
  740. anchors.fill: parent
  741. spacing: 10
  742. AppButton {
  743. anchors.fill: parent
  744. onClicked: {
  745. logoutClicked()
  746. }
  747. }
  748. AppImage {
  749. id: image_exit
  750. anchors.centerIn: parent //垂直居中显示
  751. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  752. source: "../../assets/logout.svg"
  753. }
  754. AppText{
  755. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  756. anchors.top: image_exit.bottom
  757. anchors.topMargin: 10
  758. text: "退出登录"
  759. color: app.fontColor
  760. font.bold: true
  761. }
  762. }
  763. }
  764. }
  765. Row {
  766. width: parent.width
  767. height: parent.height*0.39
  768. spacing: 5
  769. Rectangle {
  770. radius: 5
  771. width: parent.width*0.245
  772. height: parent.height
  773. color: app.cardColor
  774. Column {
  775. id: column_bi
  776. anchors.fill: parent
  777. MouseArea {
  778. anchors.fill: parent
  779. onClicked: {
  780. column_bi.visible = false
  781. column_bi.enabled = false
  782. column_bu.visible = true
  783. column_bu.enabled = true
  784. }
  785. }
  786. AppText{
  787. anchors.centerIn: parent
  788. text: "控制系统版本:" + app.boardversionText
  789. fontSize: 20
  790. font.bold: true
  791. color: app.fontColor
  792. }
  793. }
  794. Column {
  795. id: column_bu
  796. visible: false
  797. anchors.fill: parent
  798. spacing: 10
  799. AppButton {
  800. anchors.fill: parent
  801. onClicked: {
  802. column_bi.visible = true
  803. column_bi.enabled = true
  804. column_bu.visible = false
  805. column_bu.enabled = false
  806. var dialog = InputDialog.inputTextSingleLine(page_sys,
  807. "请输入密钥!",
  808. "Input here",
  809. function(ok,text){
  810. if(ok){
  811. if(text==="2024"){
  812. mqtt.sendUpdatesBoard()
  813. }else{
  814. /*
  815. 0:普通消息框,只有一个“确定”按钮。
  816. 1:警告消息框,通常用于提醒用户注意。
  817. 2:确认消息框,包含“是”和“否”两个按钮。
  818. 3:询问消息框,包含“是”、“否”和“取消”三个按钮。
  819. 4:错误消息框,用于显示错误或异常情况。
  820. */
  821. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  822. }
  823. }
  824. }
  825. )
  826. }
  827. }
  828. AppImage {
  829. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  830. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  831. source: "../../assets/updateboard.svg"
  832. }
  833. AppText{
  834. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  835. text: "升级主板"
  836. color: app.fontColor
  837. font.bold: true
  838. }
  839. }
  840. }
  841. Rectangle {
  842. radius: 5
  843. width: parent.width*0.245
  844. height: parent.height
  845. color: app.cardColor
  846. Column {
  847. id: column_ai
  848. spacing: 10
  849. anchors.fill: parent
  850. MouseArea {
  851. anchors.fill: parent
  852. onClicked: {
  853. column_ai.visible = false
  854. column_ai.enabled = false
  855. column_au.visible = true
  856. column_au.enabled = true
  857. }
  858. }
  859. AppText{
  860. anchors.centerIn: parent
  861. text: "App版本:" + app.appversionText
  862. fontSize: 20
  863. font.bold: true
  864. color: app.fontColor
  865. }
  866. }
  867. Column {
  868. id: column_au
  869. visible: false
  870. spacing: 10
  871. anchors.fill: parent
  872. AppButton {
  873. anchors.fill: parent
  874. onClicked: {
  875. column_ai.visible = true
  876. column_ai.enabled = true
  877. column_au.visible = false
  878. column_au.enabled = false
  879. var dialog = InputDialog.inputTextSingleLine(page_sys,
  880. "请输入密钥!",
  881. "Input here",
  882. function(ok,text){
  883. if(ok){
  884. if(text==="2024"){
  885. mqtt.sendUpdateApp()
  886. }else{
  887. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  888. }
  889. }
  890. }
  891. )
  892. }
  893. }
  894. AppImage {
  895. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  896. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  897. source: "../../assets/updateapp.svg"
  898. }
  899. AppText{
  900. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  901. text: "升级App"
  902. color: app.fontColor
  903. font.bold: true
  904. }
  905. }
  906. }
  907. Rectangle {
  908. id: rec_theme
  909. radius: 5
  910. width: parent.width*0.245
  911. height: parent.height
  912. color: app.cardColor
  913. Column {
  914. anchors.fill: parent
  915. spacing: 10
  916. AppButton {
  917. id: button_reboot
  918. anchors.fill: parent
  919. onClicked:{
  920. serial.reboot()
  921. }
  922. }
  923. AppImage {
  924. id: image_reboot
  925. anchors.centerIn: parent
  926. //anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  927. fillMode: Image.PreserveAspectFit // 保持纵横比适应
  928. source: "../../assets/reboot.svg"
  929. }
  930. AppText{
  931. id: text_reboot
  932. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  933. anchors.top: image_reboot.bottom
  934. anchors.topMargin: 10
  935. text: "系统重启"
  936. color: app.fontColor
  937. font.bold: true
  938. }
  939. }
  940. }
  941. Rectangle {
  942. radius: 5
  943. width: parent.width*0.245
  944. height: parent.height
  945. color: app.cardColor
  946. MouseArea {
  947. anchors.fill: parent
  948. onClicked: {
  949. if(column_di.visible === false){
  950. column_di.visible = true
  951. column_di.enabled = true
  952. column_debug.visible = false
  953. column_debug.enabled = false
  954. }
  955. }
  956. }
  957. Column {
  958. id: column_di
  959. spacing: 10
  960. anchors.fill: parent
  961. AppButton {
  962. anchors.centerIn: parent
  963. text: "高级功能"
  964. textColor: app.fontColor
  965. flat: false
  966. borderColor: "green"
  967. fontBold: true
  968. onClicked: {
  969. var dialog = InputDialog.inputTextSingleLine(page_sys,
  970. "请输入密钥!",
  971. "Input here",
  972. function(ok,text){
  973. if(ok){
  974. if(text==="2024"){
  975. column_di.visible = false
  976. column_di.enabled = false
  977. column_debug.visible = true
  978. column_debug.enabled = true
  979. }else{
  980. nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
  981. }
  982. }
  983. }
  984. )
  985. }
  986. }
  987. }
  988. Column {
  989. id: column_debug
  990. spacing: 10
  991. visible: false
  992. enabled: false
  993. anchors.fill: parent
  994. AppCheckBox {
  995. id: acb_log
  996. text: "日志"
  997. anchors.horizontalCenter: parent.horizontalCenter
  998. onCheckedChanged: {
  999. if(acb_log.checked){
  1000. app.log_enable = true
  1001. console.log("日志开")
  1002. }else{
  1003. app.log_enable = false
  1004. console.log("日志关")
  1005. }
  1006. }
  1007. }
  1008. AppCheckBox {
  1009. id: acb_stitch
  1010. text: "拼接"
  1011. anchors.horizontalCenter: parent.horizontalCenter
  1012. onCheckedChanged: {
  1013. if(acb_stitch.checked){
  1014. app.stitch_enable = true
  1015. console.log("拼接参数开")
  1016. }else{
  1017. app.stitch_enable = false
  1018. console.log("拼接参数关")
  1019. }
  1020. }
  1021. }
  1022. AppCheckBox {
  1023. id: acb_pqt
  1024. text: "清晰度"
  1025. anchors.horizontalCenter: parent.horizontalCenter
  1026. onCheckedChanged: {
  1027. if(acb_pqt.checked){
  1028. app.photoclarity = true
  1029. console.log("拼接参数开")
  1030. }else{
  1031. app.photoclarity = false
  1032. console.log("拼接参数关")
  1033. }
  1034. }
  1035. }
  1036. AppButton {
  1037. anchors.horizontalCenter: parent.horizontalCenter
  1038. text: "SQLITE"
  1039. implicitHeight: 25
  1040. implicitWidth: 40
  1041. flat: false
  1042. onClicked: {
  1043. //打开SQLIT界面
  1044. page_sys.navigationStack.push(sqlite_component)
  1045. // var component = Qt.createComponent("SqlScreen.qml")
  1046. // if(component.status === Component.Ready){
  1047. // var SqlScreen = component.createObject(parent)
  1048. // if(SqlScreen!==null){
  1049. // SqlScreen.show()
  1050. // }
  1051. // }
  1052. }
  1053. }
  1054. }
  1055. }
  1056. }
  1057. }
  1058. }