yolobs-studio/UI/visibility-item-widget.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.8 KiB
C++
Raw Normal View History

2016-02-23 23:16:51 +00:00
#pragma once
#include <QWidget>
#include <QStyledItemDelegate>
#include <obs.hpp>
class QLabel;
class QLineEdit;
class QListWidget;
class QListWidgetItem;
class VisibilityCheckBox;
2018-02-19 19:54:37 +00:00
class LockedCheckBox;
2016-02-23 23:16:51 +00:00
class VisibilityItemWidget : public QWidget {
Q_OBJECT
private:
OBSSceneItem item;
OBSSource source;
QLabel *label = nullptr;
VisibilityCheckBox *vis = nullptr;
2018-02-19 19:54:37 +00:00
LockedCheckBox *lock = nullptr;
2016-02-23 23:16:51 +00:00
QString oldName;
OBSSignal sceneRemoveSignal;
OBSSignal enabledSignal;
OBSSignal renamedSignal;
bool sceneRemoved = false;
bool active = false;
bool selected = false;
static void OBSSceneRemove(void *param, calldata_t *data);
static void OBSSceneItemRemove(void *param, calldata_t *data);
static void OBSSceneItemVisible(void *param, calldata_t *data);
2018-02-19 19:54:37 +00:00
static void OBSSceneItemLocked(void *param, calldata_t *data);
2016-02-23 23:16:51 +00:00
static void OBSSourceEnabled(void *param, calldata_t *data);
static void OBSSourceRenamed(void *param, calldata_t *data);
void DisconnectItemSignals();
private slots:
void VisibilityClicked(bool visible);
2018-02-19 19:54:37 +00:00
void LockClicked(bool locked);
2016-02-23 23:16:51 +00:00
void SourceEnabled(bool enabled);
void SourceRenamed(QString name);
2018-02-19 19:54:37 +00:00
void SourceLocked(bool locked);
2016-02-23 23:16:51 +00:00
public:
VisibilityItemWidget(obs_source_t *source);
VisibilityItemWidget(obs_sceneitem_t *item);
~VisibilityItemWidget();
void SetColor(const QColor &color, bool active, bool selected);
};
class VisibilityItemDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
VisibilityItemDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
2019-09-22 21:19:10 +00:00
const QModelIndex &index) const override;
2016-02-23 23:16:51 +00:00
};
void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item,
2019-09-22 21:19:10 +00:00
obs_source_t *source);
2016-02-23 23:16:51 +00:00
void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item,
2019-09-22 21:19:10 +00:00
obs_sceneitem_t *sceneItem);