| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147 |
- import Felgo
- import QtMultimedia
- import QtQuick
- import QtQuick.Controls
- import EasyModel 1.0
- import com.example.database 1.0
- import "../controls"
- import "../common"
- import "../model"
- AppPage {
- id: page_sys
- title: qsTr("系统设置")
- backgroundColor: app.theme_backgroundColor
- navigationBarHidden: true
- property var picinfo_list:[]
- signal logoutClicked
- signal themChange(string mode)
- MediaPlayer{
- id: audio
- audioOutput: AudioOutput{}
- source: Qt.resolvedUrl("../../assets/mp3/button.mp3")
- }
- Connections {
- target: mqtt
- }
- Component {
- id: sqlite_component
- AppPage {
- id: sqlite_page
- implicitHeight: 800
- implicitWidth: 1280
- rightBarItem: IconButtonBarItem {
- iconType: IconType.paintbrush
- onClicked: {
- console.log("database")
- sqliteModal.open()
- }
- }
- //行表头-竖向的
- property int verHeaderHeight: 30
- property int verHeaderWidth: 150
- //列表头-横向的
- property int horHeaderHeight: 30
- //滚动条
- property color scrollBarColor: "cyan"
- property int scrollBarWidth: 6
- //列宽
- property variant columnWidthArr: [30,100,100,100,100,100,200,100,100,100,100,100,100]
- property variant table_mqtt_Value: ["id","dtype","ip","port","imei","uid","pwd","clientid","qos","keepalive","sub","pub","offline"]
- property variant table_ftp_Value: ["id","ip","port","dir","uid","pwd","mode"]
- property variant table_location_Value: ["id","lbs_lat","lbs_lng","gps_lat","gps_lng","gps_elevation"]
- property variant table_camera_Value: ["camera_type","mode","stitch_photonum","photo_width","photo_height","auto_focus"]
- property variant table_json_Value: ["id","datetime","json_data","json_data"]
- property int datacount: 1
- DatabaseInterface
- {
- id: db_cfg
- }
- EasyTableModel{
- id: table_model
- horHeader: table_mqtt_Value
- //initData: []//myClass.getdata_JsonArray()
- //initData: []
- }
- //表格内容(不包含表头)
- TableView{
- id: table_view
- height: sqlite_page.implicitHeight
- anchors{
- left: parent.left
- right: parent.right
- top: parent.top
- leftMargin: 30
- topMargin: sqlite_page.horHeaderHeight
- }
- clip: true
- boundsBehavior: Flickable.StopAtBounds
- columnSpacing: 1
- rowSpacing: 1
- //视图的高度
- //contentHeight: rowHeightProvider(0) * rows + rowHeightProvider(rows-1)
- //视图的宽度
- //contentWidth:
- //content内容区域边距,但是不影响滚动条的位置
- //leftMargin:
- //topMargin:
- //此属性可以包含一个函数,该函数返回模型中每行的行高
- rowHeightProvider: function (row) {
- return sqlite_page.verHeaderHeight;
- }
- //此属性可以保存一个函数,该函数返回模型中每个列的列宽
- columnWidthProvider: function (column) {
- return sqlite_page.columnWidthArr[column];
- //return Math.max(1, (table_view.width - leftMargin) / table_view.columns)
- }
- ScrollBar.vertical: ScrollBar {
- id: scroll_vertical
- anchors.right: parent.right
- anchors.rightMargin: 2
- //active: table_view.ScrollBar.vertical.active
- //policy: ScrollBar.AsNeeded
- contentItem: Rectangle{
- visible: (scroll_vertical.size<1.0)
- implicitWidth: sqlite_page.scrollBarWidth
- color: sqlite_page.scrollBarColor
- }
- }
- ScrollBar.horizontal: ScrollBar {
- id: scroll_horizontal
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 2
- //active: table_view.ScrollBar.vertical.active
- //policy: ScrollBar.AsNeeded
- contentItem: Rectangle{
- visible: (scroll_horizontal.size<1.0)
- implicitHeight: sqlite_page.scrollBarWidth
- color: sqlite_page.scrollBarColor
- }
- }
- //model是在C++中定义的,和QtC++是类似的
- model: table_model
- delegate: Rectangle {
- color: (model.row%2)?"orange":Qt.darker("orange") //根据行数设置背景颜色
- AppText{
- id : value_text
- anchors.centerIn: parent
- verticalAlignment: Text.AlignVCenter
- // 水平居中对齐
- horizontalAlignment: Text.AlignHCenter
- //elide: Text.ElideRight
- // selectByMouse: true
- // selectedTextColor: "black"
- // selectionColor: "white"
- //获取单元格对应的值
- text: model.value
- AppButton {
- onClicked: {
- var dialog = InputDialog.inputTextSingleLine(app,
- "请输入要修改内容",
- value_text.text,
- function(ok,text){
- if(ok){
- value_text.text = text
- model.edit=text;
- //将改变写入到数据库中
- console.log("edit",model.value)
- if(sqlite_switch.checked)
- {
- if(table_combox.displayText===table_combox.model[0]||table_combox.displayText===table_combox.model[1])
- {
- columnWidthArr = [30,100,100,100,100,100,200,100,100,100,100,100,100]
- db_cfg.updateData(table_combox.displayText,table_mqtt_Value[index],model.value)
- }
- if(table_combox.displayText===table_combox.model[2]||table_combox.displayText===table_combox.model[3])
- {
- db_cfg.updateData(table_combox.displayText,table_ftp_Value[index],model.value)
- }
- if(table_combox.displayText===table_combox.model[4])
- {
- db_cfg.updateData(table_combox.displayText,table_location_Value[index],model.value)
- }
- if(table_combox.displayText===table_combox.model[5]){
- db_cfg.updateData(table_combox.displayText,table_camera_Value[index],model.value)
- }
- }
- }
- })
- // Disable the negative action
- dialog.negativeAction = false
- // Dismiss when touched outside
- dialog.outsideTouchable = true
- }
- }
- // onEditingFinished: {
- // model.edit=text;
- // //将改变写入到数据库中
- // console.log("edit",model.value)
- // if(sqlite_switch.checked)
- // {
- // if(table_combox.displayText===table_combox.model[0]||table_combox.displayText===table_combox.model[1])
- // {
- // db_cfg.updateData(table_combox.displayText,table_mqtt_Value[index],model.value)
- // }
- // if(table_combox.displayText===table_combox.model[2]||table_combox.displayText===table_combox.model[3])
- // {
- // db_cfg.updateData(table_combox.displayText,table_ftp_Value[index],model.value)
- // }
- // if(table_combox.displayText===table_combox.model[4])
- // {
- // db_cfg.updateData(table_combox.displayText,table_location_Value[index],model.value)
- // }
- // }
- // }
- }
- }
- }
- //横项表头
- Item{
- id: header_horizontal
- anchors{
- left: parent.left
- right: parent.right
- leftMargin: 30//control.verHeaderWidth
- }
- height: sqlite_page.horHeaderHeight
- z: 2
- //暂存鼠标拖动的位置
- property int posXTemp: 0
- MouseArea{
- anchors.fill: parent
- onPressed: {
- header_horizontal.posXTemp=mouseX;
- }
- onPositionChanged: {
- if(table_view.contentX+(header_horizontal.posXTemp-mouseX)>0){
- table_view.contentX+=(header_horizontal.posXTemp-mouseX);
- }else{
- table_view.contentX=0;
- }
- header_horizontal.posXTemp=mouseX;
- }
- }
- Row {
- id: header_horizontal_row
- anchors.fill: parent
- leftPadding: -table_view.contentX
- clip: true
- spacing: 0
- Repeater {
- model: table_view.columns > 0 ? table_view.columns : 0
- Rectangle {
- id: header_horizontal_item
- width: table_view.columnWidthProvider(index)+table_view.columnSpacing
- height: sqlite_page.horHeaderHeight
- color: "purple"
- AppText {
- anchors.centerIn: parent
- text: table_model.headerData(index, Qt.Horizontal)
- }
- Rectangle{
- width: 1
- height: parent.height
- anchors.right: parent.right
- color: "black"
- opacity: 0.5
- }
- MouseArea{
- width: 3
- height: parent.height
- anchors.right: parent.right
- cursorShape: Qt.SplitHCursor
- onPressed: header_horizontal.posXTemp=mouseX;
- onPositionChanged: {
- if((header_horizontal_item.width-(header_horizontal.posXTemp-mouseX))>10){
- header_horizontal_item.width-=(header_horizontal.posXTemp-mouseX);
- }else{
- header_horizontal_item.width=10;
- }
- header_horizontal.posXTemp=mouseX;
- sqlite_page.columnWidthArr[index]=(header_horizontal_item.width-table_view.columnSpacing);
- //刷新布局,这样宽度才会改变
- table_view.forceLayout();
- }
- }
- }
- }
- }
- }
- //竖向表头
- Column {
- id: header_verical
- height: sqlite_page.implicitHeight
- anchors{
- left: parent.left
- top: parent.top
- //bottom: parent.bottom
- topMargin: sqlite_page.horHeaderHeight
- }
- topPadding: -table_view.contentY
- z: 2
- clip: true
- spacing: 1
- Repeater {
- model: table_view.rows > 0 ? table_view.rows : 0
- Rectangle {
- width: 30
- height: table_view.rowHeightProvider(index)
- color: "green"
- Text {
- anchors.centerIn: parent
- text: table_model.headerData(index, Qt.Vertical)
- }
- }
- }
- }
- // JsonListModel {
- // id: jsonModel
- // source: table_model.initData
- // keyField: "id"
- // }
- // AppListView {
- // anchors.fill: parent
- // bottomMargin: nativeUtils.safeAreaInsets.bottom
- // model: jsonModel
- // delegate: SimpleRow {
- // text: model.sub
- // }
- // // Transition animation for adding items
- // add: Transition {
- // NumberAnimation {
- // property: "opacity"
- // from: 0
- // to: 1
- // duration: 1000
- // easing.type: Easing.OutQuad
- // }
- // }
- // }
- AppModal {
- id: sqliteModal
- fullscreen: false
- modalHeight: dp(380) + nativeUtils.safeAreaInsets.bottom
- NavigationStack {
- AppPage {
- title: "配置信息管理"
- rightBarItem: TextButtonBarItem {
- text: "关闭"
- textItem.font.pixelSize: sp(16)
- onClicked: sqliteModal.close()
- }
- Column {
- id: sqliteColumn
- width: parent.width
- Section {
- title: "数据库"
- ComboBox {
- id: sqlite_combox
- height: dp(40)
- width: parent.width/2
- model: ["config.db", "data.db"]
- }
- }
- Section {
- title: "数据表"
- ComboBox {
- id: table_combox
- height: dp(40)
- width: parent.width/2
- model: ["mqtt", "mqtt_other","ftp","ftp_other","location","camera","data"]
- onActivated: {
- console.log(displayText)
- table_model.table_name = displayText
- if(displayText===model[0]||displayText===model[1])
- {
- columnWidthArr = [30,100,100,100,100,100,200,100,100,100,100,100,100]
- table_model.horHeader = table_mqtt_Value
- }
- else if(displayText===model[2]||displayText===model[3])
- {
- table_model.horHeader = table_ftp_Value
- }
- else if(displayText===model[4])
- {
- table_model.horHeader = table_location_Value
- }else if(displayText===model[5]){
- columnWidthArr = [100,100,150,100,100,100]
- table_model.horHeader = table_camera_Value
- }
- else if(displayText===model[6])
- {
- table_model.horHeader = table_json_Value
- }
- table_model.initData=db_cfg.queryData(displayText,datacount)
- }
- }
- }
- AppText {
- id: sqlite_text
- text: "开关:"
- }
- AppSwitch {
- id: sqlite_switch
- anchors.left: sqlite_text.light
- anchors.leftMargin: 10
- onToggled: {
- if(sqlite_switch.checked){
- var dbs = db_cfg.openDatabase(sqlite_combox.displayText)
- if(dbs){
- console.log("打开数据库成功");
- sqlite_combox.enabled = false
- table_combox.enabled = true
- if(sqlite_combox.displayText==="data.db")
- {
- table_combox.displayText=table_combox.model[6];
- }
- table_model.table_name = table_combox.displayText
- table_model.initData=db_cfg.queryData(table_combox.displayText,datacount)
- //text_row_count.text = db_cfg.getTable_row(table_combox.displayText)
- //rowindex_text.text = datacount
- }else{
- sqlite_switch.checked = false
- sqlite_combox.enabled = true;
- console.log("打开数据库失败");
- }
- }else{
- sqlite_combox.enabled = true;
- db_cfg.closeDatabase()
- console.log("关闭数据库");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- Grid {
- anchors.fill: parent
- anchors.leftMargin: 5
- anchors.topMargin:5
- //anchors.horizontalCenter: parent.horizontalCenter
- columns: 1
- rows: 3
- columnSpacing: 10
- rowSpacing: 5
- horizontalItemAlignment: Grid.AlignHCenter
- Rectangle {
- radius: 5
- width: parent.width * 0.995
- height: parent.height*0.18
- color: app.cardColor
- Timer {
- interval: 1000
- running: true
- repeat: true
- onTriggered: {
- picinfo_list = serial.pathinfo()
- text_info.text = "占用大小:" + picinfo_list[2] + "(Mb)" + "文件数量:" + picinfo_list[1]
- text_pathinfo.text = "图片存储目录:" + picinfo_list[0]
- }
- }
- AppImage {
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left //
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/floder.svg"
- }
- Column{
- id: column_info
- anchors.verticalCenter: parent.verticalCenter // 在垂直方向上居中
- anchors.left: parent.left //
- anchors.leftMargin: 100
- AppText{
- id: text_info
- text: "存储占用:" + ""
- color: app.fontColor
- font.bold: true
- }
- AppText{
- id: text_pathinfo
- text:"图片存储目录:"
- fontSize: 10
- color: "gray"
- }
- }
- AppButton {
- id:btn_fresh
- anchors.verticalCenter: parent.verticalCenter // 在垂直方向上居中
- anchors.left: column_info.right
- anchors.leftMargin: dp(50)
- text: "刷新"
- flat: false
- textColor: "black"
- backgroundColor: "#e9e9e9"
- borderColor: "white"
- onClicked: {
- serial.readPathinfo()
- }
- }
- AppButton {
- id:btn_clear
- anchors.verticalCenter: parent.verticalCenter // 在垂直方向上居中
- anchors.left: btn_fresh.right
- text: "清理"
- flat: false
- textColor: "white"
- backgroundColor: "#0aa26b"
- borderColor: "white"
- onClicked: {
- serial.removepic()
- }
- }
- }
- Row{
- //anchors.fill: parent
- width: parent.width
- height: parent.height*0.35
- spacing:5
- Rectangle {
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- radius: 5
- Column{
- anchors.fill: parent
- spacing: 5
- AppImage {
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- // 将元素的顶部锚定到父元素的顶部
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/ztl.svg"
- }
- AppText{
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "状态栏开关"
- color: app.fontColor
- font.bold: true
- }
- Switch{
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- objectName: "openbar_btn"
- id: openbar_btn
- signal opernBar
- signal closeBar
- onClicked: {
- if(openbar_btn.checked==true){
- console.log("打开状态栏")
- opernBar()
- }else{
- console.log("关闭状态栏")
- closeBar()
- }
- }
- }
- }
- }
- Rectangle {
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- Column{
- anchors.fill: parent
- spacing: 5
- AppImage {
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/dhl.svg"
- }
- AppText{
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- id: net_sta
- text: "导航栏开关"
- color: app.fontColor
- font.bold: true
- }
- Switch{
- id: opennav_btn
- objectName: "opennav_btn"
- signal opernNav
- signal closeNav
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- onClicked: {
- if(opennav_btn.checked==true){
- console.log("打开导航栏")
- opernNav()
- }else{
- console.log("关闭导航栏")
- closeNav()
- }
- }
- }
- }
- }
- Rectangle {
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- MouseArea{
- anchors.fill: parent
- onClicked: {
- appimage_theme.visible = false
- apptext_title.visible = false
- apptext_select.visible = false
- row_select.visible = true
- }
- }
- Column {
- id: row_select
- visible: false
- anchors.fill: parent
- spacing: 5
- Component.onCompleted: {
- app.theme_md = settings.getValue("theme_mode")
- if(app.theme_md==="auto"){
- auto_rdb.checked = true
- rec_auto_rdb.border.color = "#0aa26b"
- apptext_select.text = "当前:自动"
- }else if(theme_md==="day"){
- day_rdb.checked = true;
- rec_day_rdb.border.color = "#0aa26b"
- apptext_select.text = "当前:白天"
- }else if(theme_md==="night"){
- night_rdb.checked = true;
- rec_night_rdb.border.color = "#0aa26b"
- apptext_select.text = "当前:黑夜"
- }
- }
- AppText{
- id: apptext_title_mode
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "设置模式"
- font.bold: true
- }
- CustomRadioButton {
- id: auto_rdb
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width*0.8
- checked: true
- text: "自动"
- Rectangle {
- id: rec_auto_rdb
- anchors.fill: parent
- color: "#f5f5f5"
- radius: 5
- border.color: "#f5f5f5"
- border.width: 2
- }
- onCheckedChanged: {
- if(auto_rdb.checked){
- rec_auto_rdb.border.color = "#0aa26b"
- settings.setValue("theme_mode","auto")
- themChange("auto")
- apptext_select.text = "当前:自动"
- }else{
- rec_auto_rdb.border.color = "#f5f5f5"
- }
- row_select.visible = false
- rec_theme.color = app.cardColor
- appimage_theme.visible = true
- apptext_title.visible = true
- apptext_select.visible = true
- }
- }
- CustomRadioButton {
- id: night_rdb
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width*0.8
- text: "黑夜"
- Rectangle {
- id: rec_night_rdb
- anchors.fill: parent
- color: "#f5f5f5"
- radius: 5
- border.color: "#f5f5f5"
- border.width: 2
- }
- onCheckedChanged: {
- if(night_rdb.checked){
- settings.setValue("theme_mode","night")
- rec_night_rdb.border.color = "#0aa26b"
- themChange("night")
- apptext_select.text = "当前:黑夜"
- }else{
- rec_night_rdb.border.color = "#f5f5f5"
- }
- row_select.visible = false
- rec_theme.color = app.cardColor
- appimage_theme.visible = true
- apptext_title.visible = true
- apptext_select.visible = true
- }
- }
- CustomRadioButton {
- id: day_rdb
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width*0.8
- text: "白天"
- Rectangle {
- id: rec_day_rdb
- anchors.fill: parent
- color: "#f5f5f5"
- radius: 5
- border.color: "#f5f5f5"
- border.width: 2
- }
- onCheckedChanged: {
- if(day_rdb.checked){
- settings.setValue("theme_mode","day")
- rec_day_rdb.border.color = "#0aa26b"
- themChange("day")
- apptext_select.text = "当前:白天"
- }else{
- rec_day_rdb.border.color = "#f5f5f5"
- }
- row_select.visible = false
- rec_theme.color = app.cardColor
- appimage_theme.visible = true
- apptext_title.visible = true
- apptext_select.visible = true
- }
- }
- }
- Column {
- anchors.fill: parent
- spacing: 5
- AppImage {
- id: appimage_theme
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/themset.svg"
- }
- AppText{
- id: apptext_title
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "设置主题"
- color: app.fontColor
- font.bold: true
- }
- AppText {
- id: apptext_select
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "当前:" + settings.getValue("theme_mode")
- fontSize: 10
- font.bold: false
- color: "gray"
- }
- }
- }
- Rectangle {
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- Column {
- anchors.fill: parent
- spacing: 10
- AppButton {
- anchors.fill: parent
- onClicked: {
- logoutClicked()
- }
- }
- AppImage {
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/logout.svg"
- }
- AppText{
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "退出登录"
- color: app.fontColor
- font.bold: true
- }
- }
- }
- }
- Row {
- width: parent.width
- height: parent.height*0.43
- spacing: 5
- Rectangle {
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- Column {
- id: column_bi
- anchors.fill: parent
- MouseArea {
- anchors.fill: parent
- onClicked: {
- column_bi.visible = false
- column_bi.enabled = false
- column_bu.visible = true
- column_bu.enabled = true
- }
- }
- AppText{
- anchors.centerIn: parent
- text: "控制系统版本:" + app.boardversionText
- fontSize: 20
- font.bold: true
- color: app.fontColor
- }
- }
- Column {
- id: column_bu
- visible: false
- anchors.fill: parent
- spacing: 10
- AppButton {
- anchors.fill: parent
- onClicked: {
- column_bi.visible = true
- column_bi.enabled = true
- column_bu.visible = false
- column_bu.enabled = false
- var dialog = InputDialog.inputTextSingleLine(page_sys,
- "请输入密钥!",
- "Input here",
- function(ok,text){
- if(ok){
- if(text==="2024"){
- mqtt.sendUpdatesBoard()
- }else{
- /*
- 0:普通消息框,只有一个“确定”按钮。
- 1:警告消息框,通常用于提醒用户注意。
- 2:确认消息框,包含“是”和“否”两个按钮。
- 3:询问消息框,包含“是”、“否”和“取消”三个按钮。
- 4:错误消息框,用于显示错误或异常情况。
- */
- nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
- }
- }
- }
- )
- }
- }
- AppImage {
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/updateboard.svg"
- }
- AppText{
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "升级主板"
- color: app.fontColor
- font.bold: true
- }
- }
- }
- Rectangle {
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- Column {
- id: column_ai
- spacing: 10
- anchors.fill: parent
- MouseArea {
- anchors.fill: parent
- onClicked: {
- column_ai.visible = false
- column_ai.enabled = false
- column_au.visible = true
- column_au.enabled = true
- }
- }
- AppText{
- anchors.centerIn: parent
- text: "App版本:" + app.appversionText
- fontSize: 20
- font.bold: true
- color: app.fontColor
- }
- }
- Column {
- id: column_au
- visible: false
- spacing: 10
- anchors.fill: parent
- AppButton {
- anchors.fill: parent
- onClicked: {
- column_ai.visible = true
- column_ai.enabled = true
- column_au.visible = false
- column_au.enabled = false
- var dialog = InputDialog.inputTextSingleLine(page_sys,
- "请输入密钥!",
- "Input here",
- function(ok,text){
- if(ok){
- if(text==="2024"){
- mqtt.sendUpdateApp()
- }else{
- nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
- }
- }
- }
- )
- }
- }
- AppImage {
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/updateapp.svg"
- }
- AppText{
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- text: "升级App"
- color: app.fontColor
- font.bold: true
- }
- }
- }
- Rectangle {
- id: rec_theme
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- Column {
- anchors.fill: parent
- spacing: 10
- AppButton {
- id: button_reboot
- anchors.fill: parent
- onClicked:{
- serial.reboot()
- }
- }
- AppImage {
- id: image_reboot
- anchors.centerIn: parent
- //anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- fillMode: Image.PreserveAspectFit // 保持纵横比适应
- source: "../../assets/reboot.svg"
- }
- AppText{
- id: text_reboot
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- anchors.top: image_reboot.bottom
- anchors.topMargin: 10
- text: "系统重启"
- color: app.fontColor
- font.bold: true
- }
- }
- }
- Rectangle {
- radius: 5
- width: parent.width*0.245
- height: parent.height
- color: app.cardColor
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if(column_di.visible === false){
- column_di.visible = true
- column_di.enabled = true
- column_debug.visible = false
- column_debug.enabled = false
- }
- }
- }
- Column {
- id: column_di
- spacing: 10
- anchors.fill: parent
- AppButton {
- anchors.centerIn: parent
- text: "高级功能"
- textColor: app.fontColor
- flat: false
- borderColor: "green"
- fontBold: true
- onClicked: {
- var dialog = InputDialog.inputTextSingleLine(page_sys,
- "请输入密钥!",
- "Input here",
- function(ok,text){
- if(ok){
- if(text==="2024"){
- column_di.visible = false
- column_di.enabled = false
- column_debug.visible = true
- column_debug.enabled = true
- }else{
- nativeUtils.displayMessageBox("密钥校验错误!", "", 1)
- }
- }
- }
- )
- }
- }
- }
- Column {
- id: column_debug
- spacing: 10
- visible: false
- enabled: false
- anchors.fill: parent
- AppCheckBox {
- id: acb_log
- text: "日志"
- anchors.horizontalCenter: parent.horizontalCenter
- onCheckedChanged: {
- if(acb_log.checked){
- app.log_enable = true
- console.log("日志开")
- }else{
- app.log_enable = false
- console.log("日志关")
- }
- }
- }
- AppCheckBox {
- id: acb_stitch
- text: "拼接"
- anchors.horizontalCenter: parent.horizontalCenter
- onCheckedChanged: {
- if(acb_stitch.checked){
- app.stitch_enable = true
- console.log("拼接参数开")
- }else{
- app.stitch_enable = false
- console.log("拼接参数关")
- }
- }
- }
- AppCheckBox {
- id: acb_pqt
- text: "清晰度"
- anchors.horizontalCenter: parent.horizontalCenter
- onCheckedChanged: {
- if(acb_pqt.checked){
- app.photoclarity = true
- console.log("拼接参数开")
- }else{
- app.photoclarity = false
- console.log("拼接参数关")
- }
- }
- }
- AppButton {
- anchors.horizontalCenter: parent.horizontalCenter
- text: "SQLITE"
- implicitHeight: 25
- implicitWidth: 40
- flat: false
- onClicked: {
- //打开SQLIT界面
- page_sys.navigationStack.push(sqlite_component)
- // var component = Qt.createComponent("SqlScreen.qml")
- // if(component.status === Component.Ready){
- // var SqlScreen = component.createObject(parent)
- // if(SqlScreen!==null){
- // SqlScreen.show()
- // }
- // }
- }
- }
- }
- }
- }
- }
- }
|