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
|
#pragma once
#include "export-symbol-helper.hpp"
#include "list-editor.hpp"
#include "obs-module-helper.hpp"
#include "variable-string.hpp"
#include <obs-data.h>
namespace advss {
class StringList : public QList<StringVariable> {
public:
using QList<StringVariable>::QList;
EXPORT bool Save(obs_data_t *obj, const char *name,
const char *elementName = "string") const;
EXPORT bool Load(obs_data_t *obj, const char *name,
const char *elementName = "string");
EXPORT void ResolveVariables();
friend class StringListEdit;
};
class ADVSS_EXPORT StringListEdit : public ListEditor {
Q_OBJECT
public:
StringListEdit(
QWidget *parent, const QString &addString = "",
const QString &addStringDescription = "",
int maxStringSize = 170,
const std::function<bool(const std::string &)> &filter =
[](const std::string &) { return false; },
const std::function<void(std::string &input)> &preprocess =
[](std::string &) {});
void SetStringList(const StringList &);
StringList GetStringList() const { return _stringList; }
void SetMaxStringSize(int);
private slots:
void Add();
void Remove();
void Up();
void Down();
void Clicked(QListWidgetItem *);
signals:
void StringListChanged(const StringList &);
private:
StringList _stringList;
QString _addString;
QString _addStringDescription;
int _maxStringSize = 170;
std::function<bool(const std::string &)> _filterCallback;
std::function<void(std::string &)> _preprocessCallback;
};
} // namespace advss
|