diff --git a/src/assets/resource/panel_settings.json b/src/assets/resource/panel_settings.json index ad800144..0921efd7 100644 --- a/src/assets/resource/panel_settings.json +++ b/src/assets/resource/panel_settings.json @@ -167,8 +167,8 @@ { "key": "picformat", "name": "Photo:", - "type":"formatLabel", - "default": " JPG" + "type":"combobox", + "default": 0 }, { "key": "vidformat", diff --git a/src/assets/resource/settings.json b/src/assets/resource/settings.json index 90d8354b..a7202f6e 100644 --- a/src/assets/resource/settings.json +++ b/src/assets/resource/settings.json @@ -165,8 +165,8 @@ { "key": "picformat", "name": "Photo:", - "type":"formatLabel", - "default": " JPG" + "type":"combobox", + "default": 0 }, { "key": "vidformat", diff --git a/src/src/Settings.cpp b/src/src/Settings.cpp index 4009d21a..fd6d387c 100644 --- a/src/src/Settings.cpp +++ b/src/src/Settings.cpp @@ -70,6 +70,10 @@ void Settings::init() } m_settings->option("outsetting.outformat.vidformat")->setData("items", videoFormatList); + QStringList photoFormatList; + photoFormatList << tr("JPG") << tr("PNG"); + m_settings->option("outsetting.outformat.picformat")->setData("items", photoFormatList); + m_settings->setBackend(m_backend); connect(m_settings, &DSettings::valueChanged, this, &Settings::onValueChanged); @@ -269,6 +273,14 @@ void Settings::onValueChanged(const QString & key, const QVariant & value) emit videoFormatChanged(videoFormat); } } + + if (key.startsWith("outsetting.outformat.picformat")) { + QPointer formatOpt = m_settings->option("outsetting.outformat.picformat"); + if (value >= 0 && formatOpt->data("items").toStringList().size() > value.toInt()) { + QString photoFormat = formatOpt->data("items").toStringList()[value.toInt()]; + emit photoFormatChanged(photoFormat); + } + } } Settings::~Settings() diff --git a/src/src/Settings.h b/src/src/Settings.h index 77c0472f..5fbf54e1 100644 --- a/src/src/Settings.h +++ b/src/src/Settings.h @@ -154,6 +154,12 @@ public slots: */ void videoFormatChanged(QString format); + /** + * @brief photoFormatChanged 拍照照片格式 + * @param format 照片格式 + */ + void photoFormatChanged(QString format); + private: Settings(); static Settings m_instance;