setting.cc预留导入导出配置文件

This commit is contained in:
2025-11-27 15:02:39 +08:00
parent 98dcfa1520
commit c86c24488c
2 changed files with 99 additions and 48 deletions

View File

@@ -244,6 +244,28 @@ static auto AddProfileLongItem(creeper::ThemeManager& manager) {
fbpro::Clickable {[]{ ShowAddProfileDialog(); }},
};
}
static auto ImportProfileLongItem(creeper::ThemeManager& manager) {
return new FilledButton {
fbpro::ThemeManager {manager},
fbpro::Text {QStringLiteral("导入配置")},
widget::pro::SizePolicy {QSizePolicy::Fixed, QSizePolicy::Expanding},
widget::pro::MinimumHeight {40},
widget::pro::MinimumWidth {320},
fbpro::Radius {12},
fbpro::Clickable {[]{ qDebug() << "ImportProfileLongItem"; }},
};
}
static auto ExportProfileLongItem(creeper::ThemeManager& manager) {
return new FilledButton {
fbpro::ThemeManager {manager},
fbpro::Text {QStringLiteral("导出配置")},
widget::pro::SizePolicy {QSizePolicy::Fixed, QSizePolicy::Expanding},
widget::pro::MinimumHeight {40},
widget::pro::MinimumWidth {320},
fbpro::Radius {12},
fbpro::Clickable {[]{ qDebug() << "ExportProfileLongItem"; }},
};
}
static auto ProfileItemComponent(creeper::ThemeManager& manager, ConfigProfile& profile,
const std::shared_ptr<MutableValue<std::vector<ConfigProfile>>>& profiles_store) {
QString matrix_size = "规格:" + QString{ "%1 * %2" }.arg(profile.matrix_width).arg(profile.matrix_height);
@@ -421,9 +443,19 @@ auto SettingComponent(SettingComponentState& state) noexcept -> raw_pointer<QWid
lnpro::Alignment {Qt::AlignTop},
lnpro::Margin {10},
lnpro::Spacing {10},
lnpro::Item{
AddProfileLongItem(state.manager)
lnpro::Item<Row> {
lnpro::Item{
AddProfileLongItem(state.manager)
},
lnpro::Item {
ImportProfileLongItem(state.manager)
},
lnpro::Item {
ExportProfileLongItem(state.manager)
}
},
col::pro::Item<ScrollArea>{
scroll::pro::ThemeManager { state.manager },
scroll::pro::HorizontalScrollBarPolicy { Qt::ScrollBarAlwaysOff },