fix(camera): use combobox for photo output format - #516
Conversation
1. 将 settings.json 与 panel_settings.json 中 outsetting.outformat.picformat 的控件类型由 formatLabel 改为 combobox,默认值改为索引 0; 2. 在 Settings::init 中仿照 vidformat 为 picformat 填充下拉项(JPG/PNG); 3. 在 Settings::onValueChanged 中新增 picformat 分支发出 photoFormatChanged 信号,并在 Settings.h 声明该信号; ===================================== 1. changed the widget type of outsetting.outformat.picformat from formatLabel to combobox in settings.json and panel_settings.json, with default index 0; 2. populated picformat combobox items (JPG/PNG) in Settings::init, mirroring vidformat; 3. added a picformat branch in Settings::onValueChanged to emit photoFormatChanged, and declared the signal in Settings.h; Log: 设置界面"输出格式-照片"由静态标签改为下拉框,与视频格式下拉框保持一致 PMS: https://pms.uniontech.com/bug-view-156865.html
There was a problem hiding this comment.
Sorry @Resurgamz, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Resurgamz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
CLA Assistant Lite bot: You can retrigger this bot by commenting recheck in this Pull Request |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideSwitches the photo output format setting from a custom read-only label to a standard combobox, mirroring the existing video format combobox, and wires it into the settings change signal pipeline via a new photoFormatChanged signal. Sequence diagram for handling photo format combobox changessequenceDiagram
actor User
participant DSettingsDialog
participant DSettings
participant Settings
User->>DSettingsDialog: select photo format (e.g. PNG)
DSettingsDialog->>DSettings: setOption("outsetting.outformat.picformat", value)
DSettings-->>Settings: valueChanged(key, value)
Settings->>Settings: onValueChanged(key, value)
Settings->>Settings: photoFormatChanged(photoFormat)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review★ 总体评分:92分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // Settings.cpp
void Settings::onValueChanged(const QString & key, const QVariant & value)
{
// ... existing code ...
if (key == "outsetting.outformat.picformat") {
QPointer<DSettingsOption> formatOpt = m_settings->option("outsetting.outformat.picformat");
int index = value.toInt();
QStringList items = formatOpt->data("items").toStringList();
if (index >= 0 && items.size() > index) {
QString photoFormat = items[index];
emit photoFormatChanged(photoFormat);
}
}
} |
fix(camera): 照片输出格式改为下拉框
根因分析
设置界面"输出格式-照片"显示为静态文本而非下拉框。根因:
src/assets/resource/settings.json中outsetting.outformat.picformat的控件类型声明为自定义formatLabel,对应工厂createFormatLabelOptionHandle(src/src/mainwindow.cpp)只渲染只读DLabel(" JPG");而同组vidformat已是combobox。两者类型不一致导致照片格式不是下拉框。关键证据:
settings.json:166-170/panel_settings.json:164-168:picformattype=formatLabel,vidformattype=combobox。mainwindow.cpp:134:createFormatLabelOptionHandle渲染静态DLabel,无下拉交互。(问题点 1、2:分割线/行高/间距根因在 DTK5
dtkwidget上游content.cpp硬编码,不在本仓库,经根因复核不在本次范围。)修复方案
仿照同组已正常工作的
vidformat(combobox + items + onValueChanged emitvideoFormatChanged)镜像实现picformat:settings.json/panel_settings.json:picformattypeformatLabel→combobox,default" JPG"→0(JPG)。Settings.cpp::init:为picformat填充下拉项["JPG","PNG"](setData("items", ...))。Settings.cpp::onValueChanged:新增picformat分支,发出photoFormatChanged(QString)(带越界保护,镜像vidformat)。Settings.h:声明photoFormatChanged(QString)信号。combobox为 DTK 内建类型,DSettingsDialog自动渲染下拉框,无需自定义工厂;formatLabel工厂注册保留(panel 模式vidformat仍用)。改动安全评估
低风险。
onValueChanged仅通过connect(DSettings::valueChanged)接入,无直接调用者;本次为纯新增兄弟分支,不改签名、不触碰既有分支(含近期 shutter-audio 修复逻辑),无回归风险。已知遗留(本次按批准范围仅修 Settings 侧)
photoFormatChanged信号当前无消费者:照片保存路径仍硬编码.jpg(videowidget.cpp:771)与img.save(...,"JPG")(majorimageprocessingthread.cpp:123/421/440)。即用户选 PNG 时照片仍以 JPG 保存。完整端到端(PNG 实际保存)需追加videowidget.cpp/majorimageprocessingthread.cpp/mainwindow.cpp消费侧接线,超出本次批准文件范围,留待后续。Summary by Sourcery
Switch photo output format setting to a combobox and emit a dedicated change signal for it.
New Features:
Enhancements: