Browse Source

Merge pull request #1974 from DDRBoxman/state

decklink-ui: Show the state of outputs in the decklink dialog
Jim 6 years ago
parent
commit
fc54a3b708

+ 27 - 1
UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp

@@ -122,6 +122,19 @@ void DecklinkOutputUI::PropertiesChanged()
 	SaveSettings();
 }
 
+void DecklinkOutputUI::OutputStateChanged(bool active)
+{
+	QString text;
+	if (active) {
+		text = QString(obs_module_text("OutputState.Active"));
+	} else {
+		text = QString(obs_module_text("OutputState.Idle"));
+	}
+
+	QMetaObject::invokeMethod(ui->outputStatus, "setText",
+				  Q_ARG(QString, text));
+}
+
 void DecklinkOutputUI::StartPreviewOutput()
 {
 	SavePreviewSettings();
@@ -136,4 +149,17 @@ void DecklinkOutputUI::StopPreviewOutput()
 void DecklinkOutputUI::PreviewPropertiesChanged()
 {
 	SavePreviewSettings();
-}
+}
+
+void DecklinkOutputUI::PreviewOutputStateChanged(bool active)
+{
+	QString text;
+	if (active) {
+		text = QString(obs_module_text("OutputState.Active"));
+	} else {
+		text = QString(obs_module_text("OutputState.Idle"));
+	}
+
+	QMetaObject::invokeMethod(ui->previewOutputStatus, "setText",
+				  Q_ARG(QString, text));
+}

+ 4 - 0
UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h

@@ -16,10 +16,14 @@ public slots:
 	void StopOutput();
 	void PropertiesChanged();
 
+	void OutputStateChanged(bool);
+
 	void StartPreviewOutput();
 	void StopPreviewOutput();
 	void PreviewPropertiesChanged();
 
+	void PreviewOutputStateChanged(bool);
+
 public:
 	std::unique_ptr<Ui_Output> ui;
 	DecklinkOutputUI(QWidget *parent);

+ 5 - 0
UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp

@@ -65,6 +65,8 @@ void output_start()
 			obs_data_release(settings);
 
 			main_output_running = true;
+
+			doUI->OutputStateChanged(true);
 		}
 	}
 }
@@ -75,6 +77,7 @@ void output_stop()
 		obs_output_stop(output);
 		obs_output_release(output);
 		main_output_running = false;
+		doUI->OutputStateChanged(false);
 	}
 }
 
@@ -153,6 +156,7 @@ void preview_output_start()
 			obs_output_start(context.output);
 
 			preview_output_running = true;
+			doUI->PreviewOutputStateChanged(true);
 		}
 	}
 }
@@ -178,6 +182,7 @@ void preview_output_stop()
 		video_output_close(context.video_queue);
 
 		preview_output_running = false;
+		doUI->PreviewOutputStateChanged(false);
 	}
 }
 

+ 15 - 1
UI/frontend-plugins/decklink-output-ui/forms/output.ui

@@ -42,7 +42,7 @@
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <property name="spacing">
-      <number>-1</number>
+      <number>6</number>
      </property>
      <item>
       <spacer name="horizontalSpacer">
@@ -57,6 +57,13 @@
        </property>
       </spacer>
      </item>
+     <item>
+      <widget class="QLabel" name="outputStatus">
+       <property name="text">
+        <string>OutputState.Idle</string>
+       </property>
+      </widget>
+     </item>
      <item>
       <widget class="QPushButton" name="startOutput">
        <property name="text">
@@ -98,6 +105,13 @@
        </property>
       </spacer>
      </item>
+     <item>
+      <widget class="QLabel" name="previewOutputStatus">
+       <property name="text">
+        <string>OutputState.Idle</string>
+       </property>
+      </widget>
+     </item>
      <item>
       <widget class="QPushButton" name="startPreviewOutput">
        <property name="text">