1/*
2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { SettingRightLayout } from '../common/SettingRightLayout';
17import Logger from '../model/Logger';
18import { CameraConfig } from './CameraConfig';
19import { GlobalContext } from './GlobalContext';
20
21const TAG = 'SettingList';
22
23@CustomDialog
24export default struct SettingList {
25  private controller: CustomDialogController;
26  @Link leftSliderIndex: number;
27  @State isIndex: number = 0;
28
29  aboutToAppear(): void {
30    this.onSettingMessageFn();
31  }
32
33  onSettingMessageFn(): void {
34    Logger.info(TAG, `onSettingMessageFn settingMessageNum: ${this.leftSliderIndex}`);
35    let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
36    switch (this.leftSliderIndex) {
37      case 2:
38        this.isIndex = cameraConfig.videoStabilizationMode;
39        break;
40      case 3:
41        this.isIndex = cameraConfig.exposureMode;
42        break;
43      case 4:
44        this.isIndex = cameraConfig.focusMode;
45        break;
46      case 5:
47        this.isIndex = cameraConfig.photoQuality;
48        break;
49      case 7:
50        this.isIndex = cameraConfig.photoFormat;
51        break;
52      case 8:
53        this.isIndex = cameraConfig.photoOrientation;
54        break;
55      case 9:
56        this.isIndex = cameraConfig.photoResolution;
57        break;
58      case 10:
59        this.isIndex = cameraConfig.videoResolution;
60        break;
61      case 11:
62        this.isIndex = cameraConfig.videoFrame;
63        break;
64    }
65  }
66
67  build() {
68    Column() {
69      SettingRightLayout({
70        settingMessageNum: $leftSliderIndex,
71        controller: this.controller,
72        isIndex: $isIndex
73      })
74    }
75    .size({ width: '100%', height: '100%' })
76    .backgroundColor('#F1F3F5')
77  }
78}