| 15 | : T_BasePage(parent) |
| 16 | { |
| 17 | auto* window = qobject_cast<ElaWindow*>(parent); |
| 18 | setWindowTitle("设置"); |
| 19 | createCustomWidget("调整展示程序的外观、导航与交互效果,设置会即时应用。", "设置"); |
| 20 | auto* mainLayout = createPageLayout(); |
| 21 | auto* appearanceSection = addExampleSection(mainLayout, "外观", "背景绘制与窗口材质可分别调整,系统材质效果取决于平台支持。"); |
| 22 | _themeComboBox = new ElaComboBox(this); |
| 23 | _themeComboBox->setFixedWidth(200); |
| 24 | _themeComboBox->addItems({"浅色", "深色"}); |
| 25 | _themeComboBox->setCurrentIndex(int(eTheme->getThemeMode())); |
| 26 | connect(_themeComboBox, QOverload<int>::of(&ElaComboBox::currentIndexChanged), this, [](int index) { |
| 27 | eTheme->setThemeMode(index == 0 ? ElaThemeType::Light : ElaThemeType::Dark); |
| 28 | }); |
| 29 | connect(eTheme, &ElaTheme::themeModeChanged, this, [this](ElaThemeType::ThemeMode mode) { |
| 30 | const QSignalBlocker blocker(_themeComboBox); |
| 31 | _themeComboBox->setCurrentIndex(int(mode)); |
| 32 | }); |
| 33 | appearanceSection->addWidget(createSettingRow("明暗主题", "为整个展示程序切换主题", _themeComboBox)); |
| 34 | |
| 35 | auto* paintComboBox = new ElaComboBox(this); |
| 36 | paintComboBox->setFixedWidth(200); |
| 37 | paintComboBox->addItems({"纯色背景", "静态图片", "动态图片"}); |
| 38 | paintComboBox->setEnabled(window); |
| 39 | if (window) |
| 40 | { |
| 41 | paintComboBox->setCurrentIndex(int(window->getWindowPaintMode())); |
| 42 | connect(paintComboBox, QOverload<int>::of(&ElaComboBox::currentIndexChanged), this, [window](int index) { |
| 43 | window->setWindowPaintMode(static_cast<ElaWindowType::PaintMode>(index)); |
| 44 | }); |
| 45 | connect(window, &ElaWindow::pWindowPaintModeChanged, this, [window, paintComboBox]() { |
| 46 | const QSignalBlocker blocker(paintComboBox); |
| 47 | paintComboBox->setCurrentIndex(int(window->getWindowPaintMode())); |
| 48 | }); |
| 49 | } |
| 50 | appearanceSection->addWidget(createSettingRow("窗口背景", "在普通背景、图片和动图之间切换", paintComboBox)); |
| 51 | |
| 52 | auto* materialComboBox = new ElaComboBox(this); |
| 53 | materialComboBox->setFixedWidth(200); |
| 54 | materialComboBox->addItems({"默认材质", "Ela 云母"}); |
| 55 | #ifdef Q_OS_WIN |
| 56 | materialComboBox->addItems({"系统云母", "替代云母", "亚克力", "窗口模糊"}); |
| 57 | #endif |
| 58 | materialComboBox->setCurrentIndex(int(eApp->getWindowDisplayMode())); |
| 59 | connect(materialComboBox, QOverload<int>::of(&ElaComboBox::currentIndexChanged), this, [](int index) { |
| 60 | eApp->setWindowDisplayMode(static_cast<ElaApplicationType::WindowDisplayMode>(index)); |
| 61 | }); |
| 62 | connect(eApp, &ElaApplication::pWindowDisplayModeChanged, this, [materialComboBox]() { |
| 63 | const QSignalBlocker blocker(materialComboBox); |
| 64 | materialComboBox->setCurrentIndex(int(eApp->getWindowDisplayMode())); |
| 65 | }); |
| 66 | appearanceSection->addWidget(createSettingRow("窗口材质", "选择应用背景的材质效果", materialComboBox)); |
| 67 | |
| 68 | auto* navigationSection = addExampleSection(mainLayout, "导航与页面", "控制侧边栏的展开方式和页面切换动画。"); |
| 69 | auto* navigationComboBox = new ElaComboBox(this); |
| 70 | navigationComboBox->setFixedWidth(200); |
| 71 | navigationComboBox->addItems({"自动适应", "最小化", "紧凑", "完整展开"}); |
| 72 | navigationComboBox->setEnabled(window); |
| 73 | auto* transitionComboBox = new ElaComboBox(this); |
| 74 | transitionComboBox->setFixedWidth(200); |
nothing calls this directly
no test coverage detected