|
@@ -43,7 +43,7 @@ static void CreateTransitionScene(OBSSource scene, const char *text,
|
|
|
|
|
|
OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
: QDialog(parent),
|
|
: QDialog(parent),
|
|
- preview(new OBSQTDisplay(this)),
|
|
|
|
|
|
+ ui(new Ui::OBSBasicProperties),
|
|
main(qobject_cast<OBSBasic *>(parent)),
|
|
main(qobject_cast<OBSBasic *>(parent)),
|
|
acceptClicked(false),
|
|
acceptClicked(false),
|
|
source(source_),
|
|
source(source_),
|
|
@@ -51,8 +51,7 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
OBSBasicProperties::SourceRemoved, this),
|
|
OBSBasicProperties::SourceRemoved, this),
|
|
renamedSignal(obs_source_get_signal_handler(source), "rename",
|
|
renamedSignal(obs_source_get_signal_handler(source), "rename",
|
|
OBSBasicProperties::SourceRenamed, this),
|
|
OBSBasicProperties::SourceRenamed, this),
|
|
- oldSettings(obs_data_create()),
|
|
|
|
- buttonBox(new QDialogButtonBox(this))
|
|
|
|
|
|
+ oldSettings(obs_data_create())
|
|
{
|
|
{
|
|
int cx = (int)config_get_int(App()->GlobalConfig(), "PropertiesWindow",
|
|
int cx = (int)config_get_int(App()->GlobalConfig(), "PropertiesWindow",
|
|
"cx");
|
|
"cx");
|
|
@@ -61,24 +60,12 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
|
|
|
|
enum obs_source_type type = obs_source_get_type(source);
|
|
enum obs_source_type type = obs_source_get_type(source);
|
|
|
|
|
|
- buttonBox->setObjectName(QStringLiteral("buttonBox"));
|
|
|
|
- buttonBox->setStandardButtons(QDialogButtonBox::Ok |
|
|
|
|
- QDialogButtonBox::Cancel |
|
|
|
|
- QDialogButtonBox::RestoreDefaults);
|
|
|
|
|
|
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
- buttonBox->button(QDialogButtonBox::Ok)->setText(QTStr("OK"));
|
|
|
|
- buttonBox->button(QDialogButtonBox::Cancel)->setText(QTStr("Cancel"));
|
|
|
|
- buttonBox->button(QDialogButtonBox::RestoreDefaults)
|
|
|
|
- ->setText(QTStr("Defaults"));
|
|
|
|
|
|
+ ui->setupUi(this);
|
|
|
|
|
|
if (cx > 400 && cy > 400)
|
|
if (cx > 400 && cy > 400)
|
|
resize(cx, cy);
|
|
resize(cx, cy);
|
|
- else
|
|
|
|
- resize(720, 580);
|
|
|
|
-
|
|
|
|
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
-
|
|
|
|
- QMetaObject::connectSlotsByName(this);
|
|
|
|
|
|
|
|
/* The OBSData constructor increments the reference once */
|
|
/* The OBSData constructor increments the reference once */
|
|
obs_data_release(oldSettings);
|
|
obs_data_release(oldSettings);
|
|
@@ -93,30 +80,13 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
(PropertiesVisualUpdateCb)obs_source_update);
|
|
(PropertiesVisualUpdateCb)obs_source_update);
|
|
view->setMinimumHeight(150);
|
|
view->setMinimumHeight(150);
|
|
|
|
|
|
- preview->setMinimumSize(20, 150);
|
|
|
|
- preview->setSizePolicy(
|
|
|
|
- QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
|
|
|
-
|
|
|
|
- // Create a QSplitter to keep a unified workflow here.
|
|
|
|
- windowSplitter = new QSplitter(Qt::Orientation::Vertical, this);
|
|
|
|
- windowSplitter->addWidget(preview);
|
|
|
|
- windowSplitter->addWidget(view);
|
|
|
|
- windowSplitter->setChildrenCollapsible(false);
|
|
|
|
- //windowSplitter->setSizes(QList<int>({ 16777216, 150 }));
|
|
|
|
- windowSplitter->setStretchFactor(0, 3);
|
|
|
|
- windowSplitter->setStretchFactor(1, 1);
|
|
|
|
-
|
|
|
|
- setLayout(new QVBoxLayout(this));
|
|
|
|
- layout()->addWidget(windowSplitter);
|
|
|
|
|
|
+ ui->propertiesLayout->addWidget(view);
|
|
|
|
|
|
if (type == OBS_SOURCE_TYPE_TRANSITION) {
|
|
if (type == OBS_SOURCE_TYPE_TRANSITION) {
|
|
connect(view, SIGNAL(PropertiesRefreshed()), this,
|
|
connect(view, SIGNAL(PropertiesRefreshed()), this,
|
|
SLOT(AddPreviewButton()));
|
|
SLOT(AddPreviewButton()));
|
|
}
|
|
}
|
|
|
|
|
|
- layout()->addWidget(buttonBox);
|
|
|
|
- layout()->setAlignment(buttonBox, Qt::AlignBottom);
|
|
|
|
-
|
|
|
|
view->show();
|
|
view->show();
|
|
installEventFilter(CreateShortcutFilter());
|
|
installEventFilter(CreateShortcutFilter());
|
|
|
|
|
|
@@ -131,13 +101,13 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
this);
|
|
this);
|
|
|
|
|
|
auto addDrawCallback = [this]() {
|
|
auto addDrawCallback = [this]() {
|
|
- obs_display_add_draw_callback(preview->GetDisplay(),
|
|
|
|
|
|
+ obs_display_add_draw_callback(ui->preview->GetDisplay(),
|
|
OBSBasicProperties::DrawPreview,
|
|
OBSBasicProperties::DrawPreview,
|
|
this);
|
|
this);
|
|
};
|
|
};
|
|
auto addTransitionDrawCallback = [this]() {
|
|
auto addTransitionDrawCallback = [this]() {
|
|
obs_display_add_draw_callback(
|
|
obs_display_add_draw_callback(
|
|
- preview->GetDisplay(),
|
|
|
|
|
|
+ ui->preview->GetDisplay(),
|
|
OBSBasicProperties::DrawTransitionPreview, this);
|
|
OBSBasicProperties::DrawTransitionPreview, this);
|
|
};
|
|
};
|
|
uint32_t caps = obs_source_get_output_flags(source);
|
|
uint32_t caps = obs_source_get_output_flags(source);
|
|
@@ -146,8 +116,8 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
bool drawable_preview = (caps & OBS_SOURCE_VIDEO) != 0;
|
|
bool drawable_preview = (caps & OBS_SOURCE_VIDEO) != 0;
|
|
|
|
|
|
if (drawable_preview && drawable_type) {
|
|
if (drawable_preview && drawable_type) {
|
|
- preview->show();
|
|
|
|
- connect(preview.data(), &OBSQTDisplay::DisplayCreated,
|
|
|
|
|
|
+ ui->preview->show();
|
|
|
|
+ connect(ui->preview, &OBSQTDisplay::DisplayCreated,
|
|
addDrawCallback);
|
|
addDrawCallback);
|
|
|
|
|
|
} else if (type == OBS_SOURCE_TYPE_TRANSITION) {
|
|
} else if (type == OBS_SOURCE_TYPE_TRANSITION) {
|
|
@@ -190,12 +160,12 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|
|
|
|
|
connect(view, &OBSPropertiesView::Changed, updateCallback);
|
|
connect(view, &OBSPropertiesView::Changed, updateCallback);
|
|
|
|
|
|
- preview->show();
|
|
|
|
- connect(preview.data(), &OBSQTDisplay::DisplayCreated,
|
|
|
|
|
|
+ ui->preview->show();
|
|
|
|
+ connect(ui->preview, &OBSQTDisplay::DisplayCreated,
|
|
addTransitionDrawCallback);
|
|
addTransitionDrawCallback);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- preview->hide();
|
|
|
|
|
|
+ ui->preview->hide();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -333,7 +303,7 @@ void OBSBasicProperties::UpdateProperties(void *data, calldata_t *)
|
|
|
|
|
|
void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
|
|
void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
|
|
{
|
|
{
|
|
- QDialogButtonBox::ButtonRole val = buttonBox->buttonRole(button);
|
|
|
|
|
|
+ QDialogButtonBox::ButtonRole val = ui->buttonBox->buttonRole(button);
|
|
|
|
|
|
if (val == QDialogButtonBox::AcceptRole) {
|
|
if (val == QDialogButtonBox::AcceptRole) {
|
|
|
|
|
|
@@ -472,10 +442,10 @@ void OBSBasicProperties::Cleanup()
|
|
config_set_int(App()->GlobalConfig(), "PropertiesWindow", "cy",
|
|
config_set_int(App()->GlobalConfig(), "PropertiesWindow", "cy",
|
|
height());
|
|
height());
|
|
|
|
|
|
- obs_display_remove_draw_callback(preview->GetDisplay(),
|
|
|
|
|
|
+ obs_display_remove_draw_callback(ui->preview->GetDisplay(),
|
|
OBSBasicProperties::DrawPreview, this);
|
|
OBSBasicProperties::DrawPreview, this);
|
|
obs_display_remove_draw_callback(
|
|
obs_display_remove_draw_callback(
|
|
- preview->GetDisplay(),
|
|
|
|
|
|
+ ui->preview->GetDisplay(),
|
|
OBSBasicProperties::DrawTransitionPreview, this);
|
|
OBSBasicProperties::DrawTransitionPreview, this);
|
|
}
|
|
}
|
|
|
|
|