UI: Avoid forcing the user to start the virtual camera

While configuring it.
master
tytan652 2022-08-10 10:48:34 +02:00 committed by Jim
parent 0e61a57bba
commit e3cebb9942
4 changed files with 7 additions and 16 deletions

View File

@ -731,8 +731,6 @@ Basic.VCam.OutputSelection="Output Selection"
Basic.VCam.Internal="Internal"
Basic.VCam.InternalDefault="Program Output (Default)"
Basic.VCam.InternalPreview="Preview Output"
Basic.VCam.Start="Start"
Basic.VCam.Update="Update"
# basic mode file menu
Basic.MainMenu.File="&File"

View File

@ -69,7 +69,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>

View File

@ -40,13 +40,8 @@ OBSBasicVCamConfig::OBSBasicVCamConfig(QWidget *parent)
&QComboBox::currentIndexChanged),
this, &OBSBasicVCamConfig::OutputTypeChanged);
auto start = ui->buttonBox->button(QDialogButtonBox::Ok);
if (!obs_frontend_virtualcam_active())
start->setText(QTStr("Basic.VCam.Start"));
else
start->setText(QTStr("Basic.VCam.Update"));
connect(start, &QPushButton::clicked, this,
&OBSBasicVCamConfig::SaveAndStart);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this,
&OBSBasicVCamConfig::Save);
}
void OBSBasicVCamConfig::OutputTypeChanged(int type)
@ -112,7 +107,7 @@ void OBSBasicVCamConfig::OutputTypeChanged(int type)
}
}
void OBSBasicVCamConfig::SaveAndStart()
void OBSBasicVCamConfig::Save()
{
auto type = (VCamOutputType)ui->outputType->currentIndex();
auto out = ui->outputSelection;
@ -133,10 +128,8 @@ void OBSBasicVCamConfig::SaveAndStart()
vCamConfig->type = type;
// Start the vcam if needed, if already running just update the source
if (!obs_frontend_virtualcam_active())
obs_frontend_start_virtualcam();
else
// If already running just update the source
if (obs_frontend_virtualcam_active())
UpdateOutputSource();
}

View File

@ -20,7 +20,7 @@ public:
private slots:
void OutputTypeChanged(int type);
void SaveAndStart();
void Save();
private:
std::unique_ptr<Ui::OBSBasicVCamConfig> ui;