Преглед изворни кода

UI: Avoid forcing the user to start the virtual camera

While configuring it.
tytan652 пре 3 година
родитељ
комит
e3cebb9942

+ 0 - 2
UI/data/locale/en-US.ini

@@ -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"

+ 1 - 1
UI/forms/OBSBasicVCamConfig.ui

@@ -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>

+ 5 - 12
UI/window-basic-vcam-config.cpp

@@ -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();
 }
 

+ 1 - 1
UI/window-basic-vcam-config.hpp

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