import QtQuick import Felgo 4.0 import "pages" import "common" import "logic" import "model" App { id: app licenseKey: "6BBDF824AF729C33ECAA6DC917319EDB8A7F76A9EB5217C380F81C28203CF84078DBCEEC5DB44C7DB60373C0FFE65240DA17EAC1C8376F5939F26782D2A3110CFCDB938C557DDAC8C63F942AF917CD7BCD4235973E76002E69BE740BD2FE99BB7F22AD12408FB5EE3D3A538E604803F0947C372A8486E63B5CF101A18B6CEDF7AEDC615273B15ADBCF1DCC54F123FA093609F650378D2F2BC11C74421663CAB7C178C4123AF6C8B6E44EE45A5A790448F85D4039D7EB1C23C3CA97B42E0724B2987C185114E732662A4EFD507EDC0E5DC2DA7A9FF7754678F48BFC8AAFD40B21926B5A1FD427E279FDE44EC0315229371F4D77B918CC4663CB71572051E1E84DCBF8E183C44981C9D921DB7C5A02879E2D9352ECEC03FF21D99F941B9E31E10D6D625D2603135C101658FEA17FB7B397" 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 } }