UI: Hide preview for sources and filters where possible
Hides the preview window for audio sources in the properties menu and contextually in the filters menu to save on gui space.
This commit is contained in:
parent
6b37de3c65
commit
57f8c5e328
@ -390,6 +390,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
|
@ -56,7 +56,8 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
OBSBasicFilters::SourceRemoved, this),
|
||||
renameSourceSignal (obs_source_get_signal_handler(source),
|
||||
"rename",
|
||||
OBSBasicFilters::SourceRenamed, this)
|
||||
OBSBasicFilters::SourceRenamed, this),
|
||||
noPreviewMargin (13)
|
||||
{
|
||||
main = reinterpret_cast<OBSBasic*>(parent);
|
||||
|
||||
@ -97,10 +98,10 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Reset),
|
||||
SIGNAL(clicked()), this, SLOT(ResetFilters()));
|
||||
|
||||
uint32_t flags = obs_source_get_output_flags(source);
|
||||
bool audio = (flags & OBS_SOURCE_AUDIO) != 0;
|
||||
bool audioOnly = (flags & OBS_SOURCE_VIDEO) == 0;
|
||||
bool async = (flags & OBS_SOURCE_ASYNC) != 0;
|
||||
uint32_t caps = obs_source_get_output_flags(source);
|
||||
bool audio = (caps & OBS_SOURCE_AUDIO) != 0;
|
||||
bool audioOnly = (caps & OBS_SOURCE_VIDEO) == 0;
|
||||
bool async = (caps & OBS_SOURCE_ASYNC) != 0;
|
||||
|
||||
if (!async && !audio) {
|
||||
ui->asyncWidget->setVisible(false);
|
||||
@ -121,13 +122,19 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
};
|
||||
|
||||
enum obs_source_type type = obs_source_get_type(source);
|
||||
uint32_t caps = obs_source_get_output_flags(source);
|
||||
bool drawable_type = type == OBS_SOURCE_TYPE_INPUT ||
|
||||
type == OBS_SOURCE_TYPE_SCENE;
|
||||
|
||||
if (drawable_type && (caps & OBS_SOURCE_VIDEO) != 0)
|
||||
connect(ui->preview, &OBSQTDisplay::DisplayCreated,
|
||||
addDrawCallback);
|
||||
if ((caps & OBS_SOURCE_VIDEO) != 0) {
|
||||
ui->rightLayout->setContentsMargins(0, 0, 0, 0);
|
||||
ui->preview->show();
|
||||
if (drawable_type)
|
||||
connect(ui->preview, &OBSQTDisplay::DisplayCreated,
|
||||
addDrawCallback);
|
||||
} else {
|
||||
ui->rightLayout->setContentsMargins(0, noPreviewMargin, 0, 0);
|
||||
ui->preview->hide();
|
||||
}
|
||||
}
|
||||
|
||||
OBSBasicFilters::~OBSBasicFilters()
|
||||
@ -179,6 +186,15 @@ void OBSBasicFilters::UpdatePropertiesView(int row, bool async)
|
||||
OBSBasicFilters::UpdateProperties,
|
||||
this);
|
||||
|
||||
uint32_t caps = obs_source_get_output_flags(filter);
|
||||
if ((caps & OBS_SOURCE_VIDEO)) {
|
||||
ui->rightLayout->setContentsMargins(0, 0, 0, 0);
|
||||
ui->preview->show();
|
||||
} else {
|
||||
ui->rightLayout->setContentsMargins(0, noPreviewMargin, 0, 0);
|
||||
ui->preview->hide();
|
||||
}
|
||||
|
||||
obs_data_release(settings);
|
||||
|
||||
view->setMaximumHeight(250);
|
||||
|
@ -72,6 +72,8 @@ private:
|
||||
|
||||
bool isAsync;
|
||||
|
||||
int noPreviewMargin;
|
||||
|
||||
private slots:
|
||||
void AddFilter(OBSSource filter);
|
||||
void RemoveFilter(OBSSource filter);
|
||||
|
@ -114,15 +114,19 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
||||
obs_display_add_draw_callback(preview->GetDisplay(),
|
||||
OBSBasicProperties::DrawPreview, this);
|
||||
};
|
||||
|
||||
enum obs_source_type type = obs_source_get_type(source);
|
||||
uint32_t caps = obs_source_get_output_flags(source);
|
||||
bool drawable_type = type == OBS_SOURCE_TYPE_INPUT ||
|
||||
type == OBS_SOURCE_TYPE_SCENE;
|
||||
bool drawable_preview = (caps & OBS_SOURCE_VIDEO) != 0;
|
||||
|
||||
if (drawable_type && (caps & OBS_SOURCE_VIDEO) != 0)
|
||||
if (drawable_preview && drawable_type) {
|
||||
preview->show();
|
||||
connect(preview.data(), &OBSQTDisplay::DisplayCreated,
|
||||
addDrawCallback);
|
||||
} else {
|
||||
preview->hide();
|
||||
}
|
||||
}
|
||||
|
||||
OBSBasicProperties::~OBSBasicProperties()
|
||||
|
Loading…
x
Reference in New Issue
Block a user