| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- import QtQuick
- import Felgo 4.0
- import "pages"
- import "common"
- import "logic"
- import "model"
- App {
- id: app
- licenseKey: "7A0F7761276CA0ACFD172072656BA4B6567C0D73526F505C4383F731A317F0756F5FA09CD0B3CD0D0F30279EC5EA2D0FD851E07D4E59CDB32E3C5E26B341969809B11E2051E4881C86B38D72897C0808F5593230C44D3B5B3C4929986F4354F11BE16FB196173178BE2D52B4BD4803CCF2BC85B3E96B0023CA0904B3DEDEC45EC24ECD27EAABCE9DA4A1EB5CDA9B340C4691E6F8487D894BD777574A6A0FF22AAF95815969D68CC8C31798E2B0B5366346236DFAEF6CD2FE6596930C402195EAFA06ECB608B90947EA8CA20D97EC36A0D57B87288EBC33AEFFE2B124FB741972B70D8178E14690C4409774487F7F0C4A2B8F6C48CA3EC9A81075CB50EB46D9A6775DE013346B616165EDC9D2064C6DC3F5B51227B1685449BB441DFC11876CD23813C3737107B6BEC44EBC1B691A45E6"
- color: "#000"
- property string theme_md: ""
- property string theme_select: "day"
- property color theme_backgroundColor: theme_select == "day" ? "#d8d8d8" :(theme_select == "night" ? "#00000":"#d8d8d8")
- property color cardColor: theme_select == "day" ? "#f5f5f5" :(theme_select == "night" ? "#2b2b2b":"#f5f5f5") //背景色 //前景色
- property color fontColor: theme_select == "day" ? "black" :(theme_select == "night" ? "white":"black")
- property string boardversionText: ""
- property string appversionText: ""
- property int logoutcnt
- property bool log_enable: false
- property bool stitch_enable: false
- property bool photoclarity: false
- signal logoutClicked
- signal tmChange(string md)
- signal stitchEnable(bool sw)
- onInitTheme: {
- Theme.platform = "ios"
- Theme.navigationTabBar.titlePressedColor= "green"
- Theme.navigationTabBar.backgroundColor= app.cardColor
- Theme.navigationTabBar.titleColor = app.fontColor
- }
- // 新增一个函数来接收 HomePage 发送的文本
- function bvReceived(datbv){
- boardversionText = datbv
- }
- function appReceived(datbv){
- appversionText = datbv
- }
- onLogoutClicked: {
- // loginpage.pushed()
- logic.logout()
- // jump to main page after logout
- navigation.currentIndex = 0
- //navigation.currentNavigationItem.navigationStack.popAllExceptFirst()
- }
- // business logic}
- Logic {
- id: logic
- }
- // model
- DataModel {
- id: dataModel
- dispatcher: logic // data model handles actions sent by logic
- }
- // view
- Navigation {
- objectName: "Navigation_main"
- id: navigation
- navigationMode: Theme.isAndroid ? navigationModeTabs : navigationModeDefault
- drawerLogoBackgroundColor: "red"
- Component.onCompleted: {
- for(var i = 0;i < navigation.count; i++){
- navigation.currentIndex = i
- }
- navigation.currentIndex = 0
- }
- function setCurrentTab(index){
- navigation.currentIndex = index
- }
- // only enable if user is logged in
- // login page below overlays navigation then
- // first tab
- NavigationItem {
- id: uiComponentsItem
- title: "主界面"
- iconType: IconType.home
- Loader{
- asynchronous: true
- source: "pages/HomePage.qml"
- }
- }
- NavigationItem {
- title: "测试维护"
- iconType: IconType.gears
- objectName: "autofocus_Item"
- TestPage {
- //id: autofocus_id
- }
- }
- // second tab
- NavigationItem {
- title: qsTr("图像查看") // use qsTr for strings you want to translate
- iconType: IconType.qrcode
- NavigationStack {
- PhotostitcherPage {
- onVisibleChanged: {
- if(visible){
- console.log("进入图像查看界面,开始初始化加载...")
- loadRootDirectory()
- }
- }
- }
- }
- }
- // fourth tab
- NavigationItem {
- objectName: "systemset_Item"
- title: qsTr("系统设置") // use qsTr for strings you want to translate
- iconType: IconType.gears
- NavigationStack {
- initialPage: ProfilePage {
- id: page_sys
- onThemChange: {
- app.theme_select = mode
- app.theme_md = mode
- Theme.navigationTabBar.backgroundColor= app.cardColor
- Theme.navigationTabBar.titleColor = app.fontColor
- Theme.navigationTabBar.dividerColor = "green"
- console.log("配置主题模式:",app.theme_select)
- }
- // handle logout
- onLogoutClicked: {
- //loginpage.pushed()
- logic.logout()
- // jump to main page after logout
- navigation.currentIndex = 0
- serial.setLightness(-255)
- //navigation.currentNavigationItem.navigationStack.popAllExceptFirst()
- }
- }
- }
- }
- tabPosition: Navigation.Left
- }
- Timer{
- interval: 1000
- running: true
- repeat: true
- onTriggered: {
- if(navigation.currentIndex === 0&&loginpage.logintimeout%5===0){
- serial.readBoardData()
- }
- loginpage.logintimeout--
- ProfilePage.boardversion = "123"
- console.log("休眠计数:",loginpage.logintimeout)
- if(loginpage.logintimeout===0){ //?秒后进入休眠
- loginpage.logintimeout = 300
- logoutClicked()
- //关闭屏幕(亮度设置为0)
- serial.setLightness(-255)
- }
- }
- }
-
- Connections{
- target: curl
- onDownloadFinished :function(result){
- //notificationPage.visible = false
- if(result){
- navigation.setCurrentTab(1) //升级文件下载成功,跳转到日志界面
- }
- }
- }
- LocalNotificationPage {
- id: notificationPage
- visible:false
- }
- // login page lies on top of previous items and overlays if user is not logged in
- LoginPage {
- id: loginpage
- title: "植物病菌孢子捕捉分析系统"
- Connections{
- target: serial
- }
- visible: opacity > 0
- enabled: visible
- opacity: dataModel.userLoggedIn ? 0 : 1 // hide if user is logged in
- /*
- 这段代码的作用是设置页面的透明度,并且添加了一个数值动画(NumberAnimation),动画持续时间为250毫秒。
- 具体解释如下:
- opacity:表示设置元素的透明度。在这里,可能是应用于页面元素,用于控制页面的可见性。
- NumberAnimation:是一个数字动画,用于在一段时间内改变一个数字的值,这里是用来控制透明度的变化。
- duration: 250:指定动画的持续时间,这里是250毫秒,表示透明度变化会在250毫秒内完成。
- 综合起来,这段代码实现了一个在页面上添加的透明度变化效果,使页面在250毫秒内淡入或淡出,具体效果可能会受到上下文和其他代码的影响。
- */
- Behavior on opacity { NumberAnimation { duration: 250 } } // page fade in/out
- }
- }
|