ForCAX/entry/src/main/ets/pages/subpages/info/SWEnv.ets
JackLee 45176b5d7e 1-调整部分UI组件
2-调整背景颜色为有限度透明

提醒:OpenCAX由于商标已经被注册,所以本软件即日起改名NXEA
2026-04-28 21:57:30 +08:00

115 lines
3.8 KiB
Plaintext

import {mdwInfo}from '../../dispwininfo/DispWinInfo'
import { TextComboBox } from '../../customcontroller/ComboBox';
import { deviceInfo } from '@kit.BasicServicesKit';
import { display } from '@kit.ArkUI';
import {
TitleButton,
ModelType,
EventType
} from "../../interface/Interface";
import {
FreeWinMode,
ExtractFonts
} from '../../initevent/InitEnv';
export let DisplayMode:Array<TitleButton>=[
{btnModel:[ModelType.BASE],btnName:"横屏",btnNamed:"",btnIcon:"",btnTips:"横屏",btnEvent:{uid:'',command:'',page:'',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:"反向横屏",btnNamed:"",btnIcon:"",btnTips:"反向横屏",btnEvent:{uid:'',command:'',page:'',type:EventType.EVENT,args:[]}}
]
export let DrivceMode:Array<TitleButton>=[
{btnModel:[ModelType.BASE],btnName:"2in1",btnNamed:"",btnIcon:"",btnTips:"2in1",btnEvent:{uid:'',command:'',page:'',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:"tablet",btnNamed:"",btnIcon:"",btnTips:"tablet",btnEvent:{uid:'',command:'',page:'',type:EventType.EVENT,args:[]}}
]
//软件介绍
@ComponentV2
export struct SWEnv {
//所有检测状态
@Local envState:boolean=false;
//设备支持状态
@Local drivceState:boolean=false;
//字体释放状态
@Local fontState:boolean=false;
//设置初始化读取状态
@Local optsState:boolean=false;
//事件初始化状态
@Local eventState:boolean=false;
//自由窗口状态
@Local freeWinState:boolean=false;
//屏幕方向状态
@Local winOriState:boolean=false;
//当前屏幕方向文本
@Local currentDispOriStr?:string;
//当前设备型号
@Local currentDrivceStr?:string;
aboutToAppear(): void {
this.fontState=ExtractFonts();
this.freeWinState=FreeWinMode();
if(display.getDefaultDisplaySync().orientation===1){
this.currentDispOriStr=DisplayMode[0].btnName
this.winOriState=true;
}else if(display.getDefaultDisplaySync().orientation===3){
this.currentDispOriStr=DisplayMode[1].btnName
this.winOriState=true;
}else{
this.currentDispOriStr='当前模式不支持'
}
this.currentDrivceStr=deviceInfo.deviceType;
for(let i=0;i<=DrivceMode.length;i++){
if(this.currentDrivceStr==DrivceMode[i].btnName){
this.drivceState=true;
break;
}
}
}
@Builder
build(){
Column(){
Row(){
Image($r('app.media.base_background'))
.width(mdwInfo.winWidth*0.1)
.height(mdwInfo.winWidth*0.08)
.backgroundImageSize({
width: '100%', // 图片宽度占满按钮
height: '100%' // 图片高度占满按钮
})
}.justifyContent(FlexAlign.Center)
.height('30%')
Column(){
Row(){
TextComboBox({name:'支持设备型号:',menu:DrivceMode})
Blank().layoutWeight(1)
Text(`当前设备型号:${this.currentDrivceStr}`)
Blank().width('10%')
Text('状态:')
Checkbox().select(this.drivceState);
}.height('10%')
Row(){
TextComboBox({name:'屏幕支持方向:',menu:DisplayMode})
Blank().layoutWeight(1)
Text(`屏幕当前方向:${this.currentDispOriStr}`)
Blank().width('10%')
Text('状态:')
Checkbox().select(this.winOriState);
}.height('10%')
Row(){
Text('沙箱字体状态:')
Blank().layoutWeight(1)
Text('状态:')
Checkbox().select(this.fontState);
}.height('10%')
Row(){
Text('自由窗口状态:')
Blank().layoutWeight(1)
Text('状态:')
Checkbox().select(this.freeWinState);
}.height('10%')
Blank().layoutWeight(1)
}.height('70%')
.margin({ top: 0,left:'25%',bottom:0,right:'25%'})
}
}
}