Add option to set and check list source settings by name

This makes it easier to select the intended settings value as the
underlying value often has no direct connection to the user facing name.

It also makes it possible to select list entries whos underlying value
changes frequently, but the user facing value does not.
(E.g. device IDs based on the input port compared to the device name)
This commit is contained in:
WarmUpTill
2025-06-17 20:58:27 +02:00
committed by WarmUpTill
parent 874b9b86e2
commit 3e1fdbde45
14 changed files with 492 additions and 48 deletions

View File

@@ -14,15 +14,18 @@ namespace advss {
class SourceSetting {
public:
SourceSetting() = default;
SourceSetting(const std::string &id, const std::string &description,
SourceSetting(const std::string &id, obs_property_type type,
const std::string &description,
const std::string &longDescription = "");
bool Save(obs_data_t *obj) const;
bool Load(obs_data_t *obj);
std::string GetID() const { return _id; }
EXPORT bool operator==(const SourceSetting &other) const;
bool IsList() const;
bool operator==(const SourceSetting &other) const;
private:
std::string _id = "";
obs_property_type _type = OBS_PROPERTY_INVALID;
std::string _description = "";
std::string _longDescription = "";
@@ -32,8 +35,14 @@ private:
std::vector<SourceSetting> GetSoruceSettings(obs_source_t *source);
std::optional<std::string> GetSourceSettingValue(const OBSWeakSource &source,
const SourceSetting &setting);
std::optional<std::string>
GetSourceSettingListEntryName(const OBSWeakSource &source,
const SourceSetting &setting);
void SetSourceSetting(obs_source_t *source, const SourceSetting &setting,
const std::string &value);
void SetSourceSettingListEntryValueByName(obs_source_t *source,
const SourceSetting &setting,
const std::string &name);
class SourceSettingSelection : public QWidget {
Q_OBJECT