UI: Update the filters window to be resizeable
Updates the filters window to use a QSplitter layout for the properties area. The handle is disabled for audio filter windows. The handle and property area are hidden when there are no filters.
This commit is contained in:
parent
02f3495b72
commit
f5947d9b9b
@ -437,45 +437,152 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="rightContainerLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="rightLayout">
|
||||
<item>
|
||||
<widget class="OBSQTDisplay" name="preview" native="true">
|
||||
<widget class="QFrame" name="rightContainerLayout">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="rightLayout">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="previewFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Reset</set>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="OBSQTDisplay" name="preview" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QFrame" name="propertiesFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="propertiesLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -119,6 +119,7 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
if (audioOnly) {
|
||||
ui->effectWidget->setVisible(false);
|
||||
ui->separatorLine->setVisible(false);
|
||||
UpdateSplitter(false);
|
||||
}
|
||||
|
||||
if (async && !audioOnly && ui->asyncFilters->count() == 0 &&
|
||||
@ -129,6 +130,12 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
if (audioOnly || (audio && !async))
|
||||
ui->asyncLabel->setText(QTStr("Basic.Filters.AudioFilters"));
|
||||
|
||||
if (async && audio && ui->asyncFilters->count() == 0) {
|
||||
UpdateSplitter(false);
|
||||
} else if (!audioOnly) {
|
||||
UpdateSplitter();
|
||||
}
|
||||
|
||||
auto addDrawCallback = [this]() {
|
||||
obs_display_add_draw_callback(ui->preview->GetDisplay(),
|
||||
OBSBasicFilters::DrawPreview,
|
||||
@ -147,7 +154,6 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
addDrawCallback);
|
||||
} else {
|
||||
ui->rightLayout->setContentsMargins(0, noPreviewMargin, 0, 0);
|
||||
ui->rightContainerLayout->insertStretch(1);
|
||||
ui->preview->hide();
|
||||
}
|
||||
|
||||
@ -255,7 +261,8 @@ void OBSBasicFilters::UpdatePropertiesView(int row, bool async)
|
||||
{
|
||||
if (view) {
|
||||
updatePropertiesSignal.Disconnect();
|
||||
ui->rightLayout->removeWidget(view);
|
||||
ui->propertiesFrame->setVisible(false);
|
||||
view->hide();
|
||||
view->deleteLater();
|
||||
view = nullptr;
|
||||
}
|
||||
@ -284,9 +291,9 @@ void OBSBasicFilters::UpdatePropertiesView(int row, bool async)
|
||||
"update_properties",
|
||||
OBSBasicFilters::UpdateProperties, this);
|
||||
|
||||
view->setMaximumHeight(250);
|
||||
view->setMinimumHeight(150);
|
||||
ui->rightLayout->addWidget(view);
|
||||
UpdateSplitter();
|
||||
ui->propertiesLayout->addWidget(view);
|
||||
view->show();
|
||||
}
|
||||
|
||||
@ -438,6 +445,28 @@ void OBSBasicFilters::UpdateFilters()
|
||||
main->SaveProject();
|
||||
}
|
||||
|
||||
void OBSBasicFilters::UpdateSplitter()
|
||||
{
|
||||
bool show_splitter_frame =
|
||||
ui->asyncFilters->count() + ui->effectFilters->count() > 0;
|
||||
UpdateSplitter(show_splitter_frame);
|
||||
}
|
||||
|
||||
void OBSBasicFilters::UpdateSplitter(bool show_splitter_frame)
|
||||
{
|
||||
bool show_splitter_handle = show_splitter_frame;
|
||||
uint32_t caps = obs_source_get_output_flags(source);
|
||||
if ((caps & OBS_SOURCE_VIDEO) == 0)
|
||||
show_splitter_handle = false;
|
||||
|
||||
for (int i = 0; i < ui->rightLayout->count(); i++) {
|
||||
QSplitterHandle *hndl = ui->rightLayout->handle(i);
|
||||
hndl->setEnabled(show_splitter_handle);
|
||||
}
|
||||
|
||||
ui->propertiesFrame->setVisible(show_splitter_frame);
|
||||
}
|
||||
|
||||
static bool filter_compatible(bool async, uint32_t sourceFlags,
|
||||
uint32_t filterFlags)
|
||||
{
|
||||
|
@ -50,6 +50,8 @@ private:
|
||||
inline OBSSource GetFilter(int row, bool async);
|
||||
|
||||
void UpdateFilters();
|
||||
void UpdateSplitter();
|
||||
void UpdateSplitter(bool show_splitter_frame);
|
||||
void UpdatePropertiesView(int row, bool async);
|
||||
|
||||
static void OBSSourceFilterAdded(void *param, calldata_t *data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user