File: source-setting.hpp

package info (click to toggle)
obs-advanced-scene-switcher 1.32.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 43,492 kB
  • sloc: xml: 297,593; cpp: 147,875; python: 387; sh: 280; ansic: 170; makefile: 33
file content (68 lines) | stat: -rw-r--r-- 1,780 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "filter-combo-box.hpp"
#include "help-icon.hpp"

#include <obs.hpp>
#include <optional>
#include <string>
#include <vector>
#include <QWidget>
#include <QLabel>

namespace advss {

class SourceSetting {
public:
	SourceSetting() = default;
	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; }
	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 = "";

	friend class SourceSettingSelection;
};

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

public:
	SourceSettingSelection(QWidget *parent = nullptr);
	void SetSource(const OBSWeakSource &,
		       bool restorePreviousSelection = true);
	void SetSelection(const OBSWeakSource &source, const SourceSetting &);

private slots:
	void SelectionIdxChanged(int);

signals:
	void SelectionChanged(const SourceSetting &);

private:
	void Populate(const OBSWeakSource &);

	FilterComboBox *_settings;
	HelpIcon *_tooltip;
};

} // namespace advss