2014-03-23 01:07:54 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QScrollArea>
|
|
|
|
#include <obs.hpp>
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class QFormLayout;
|
|
|
|
class OBSPropertiesView;
|
2014-06-27 19:55:47 -07:00
|
|
|
class QLabel;
|
2014-03-23 01:07:54 -07:00
|
|
|
|
|
|
|
typedef void (*PropertiesUpdateCallback)(void *obj, obs_data_t settings);
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
class WidgetInfo : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
OBSPropertiesView *view;
|
|
|
|
obs_property_t property;
|
|
|
|
QWidget *widget;
|
|
|
|
|
|
|
|
void BoolChanged(const char *setting);
|
|
|
|
void IntChanged(const char *setting);
|
|
|
|
void FloatChanged(const char *setting);
|
|
|
|
void TextChanged(const char *setting);
|
2014-06-27 19:55:47 -07:00
|
|
|
bool PathChanged(const char *setting);
|
2014-03-23 01:07:54 -07:00
|
|
|
void ListChanged(const char *setting);
|
2014-07-19 12:00:14 -07:00
|
|
|
bool ColorChanged(const char *setting);
|
2014-05-30 02:44:14 -07:00
|
|
|
void ButtonClicked();
|
2014-03-23 01:07:54 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
inline WidgetInfo(OBSPropertiesView *view_, obs_property_t prop,
|
|
|
|
QWidget *widget_)
|
|
|
|
: view(view_), property(prop), widget(widget_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void ControlChanged();
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
class OBSPropertiesView : public QScrollArea {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
friend class WidgetInfo;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QWidget *widget;
|
|
|
|
obs_properties_t properties;
|
|
|
|
OBSData settings;
|
|
|
|
void *obj;
|
|
|
|
PropertiesUpdateCallback callback;
|
2014-04-24 01:43:54 -07:00
|
|
|
int minSize;
|
2014-03-23 01:07:54 -07:00
|
|
|
std::vector<std::unique_ptr<WidgetInfo>> children;
|
2014-04-24 01:43:54 -07:00
|
|
|
std::string lastFocused;
|
|
|
|
QWidget *lastWidget;
|
2014-04-04 00:30:37 -07:00
|
|
|
|
2014-03-23 01:07:54 -07:00
|
|
|
QWidget *NewWidget(obs_property_t prop, QWidget *widget,
|
|
|
|
const char *signal);
|
|
|
|
|
|
|
|
QWidget *AddCheckbox(obs_property_t prop);
|
|
|
|
QWidget *AddText(obs_property_t prop);
|
2014-06-27 19:55:47 -07:00
|
|
|
void AddPath(obs_property_t prop, QFormLayout *layout, QLabel **label);
|
2014-03-23 01:07:54 -07:00
|
|
|
QWidget *AddInt(obs_property_t prop);
|
|
|
|
QWidget *AddFloat(obs_property_t prop);
|
2014-06-21 13:13:30 -07:00
|
|
|
QWidget *AddList(obs_property_t prop, bool &warning);
|
2014-05-30 02:44:14 -07:00
|
|
|
QWidget *AddButton(obs_property_t prop);
|
2014-07-19 12:00:14 -07:00
|
|
|
void AddColor(obs_property_t prop, QFormLayout *layout, QLabel *&label);
|
2014-03-23 01:07:54 -07:00
|
|
|
|
|
|
|
void AddProperty(obs_property_t property, QFormLayout *layout);
|
|
|
|
|
2014-04-24 01:43:54 -07:00
|
|
|
public slots:
|
|
|
|
void RefreshProperties();
|
|
|
|
|
2014-03-23 01:07:54 -07:00
|
|
|
public:
|
|
|
|
OBSPropertiesView(OBSData settings,
|
|
|
|
obs_properties_t properties,
|
2014-04-24 01:43:54 -07:00
|
|
|
void *obj, PropertiesUpdateCallback callback,
|
|
|
|
int minSize = 0);
|
2014-03-23 01:07:54 -07:00
|
|
|
|
|
|
|
inline ~OBSPropertiesView()
|
|
|
|
{
|
|
|
|
obs_properties_destroy(properties);
|
|
|
|
}
|
|
|
|
};
|