浏览代码

UI: Show "stopping" text on buttons when waiting for stop

The new cutoff timing fix means that streaming/recording has to remain
active for bit until the stream/recording has reached the expecting stop
timestamp.  This means that the buttons would continue to say "Stop
streaming/recording" while waiting for the output to stop itself at the
appropriate timing.

So instead of letting it do that and confusing the user, the buttons
will now say "stopping" when the button is pressed to indicate to the
user that the stream/recording is in the process of stopping.
jp9000 9 年之前
父节点
当前提交
4a3804518d

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

@@ -293,7 +293,9 @@ Basic.Main.Connecting="Connecting..."
 Basic.Main.StartRecording="Start Recording"
 Basic.Main.StartRecording="Start Recording"
 Basic.Main.StartStreaming="Start Streaming"
 Basic.Main.StartStreaming="Start Streaming"
 Basic.Main.StopRecording="Stop Recording"
 Basic.Main.StopRecording="Stop Recording"
+Basic.Main.StoppingRecording="Stopping Recording..."
 Basic.Main.StopStreaming="Stop Streaming"
 Basic.Main.StopStreaming="Stop Streaming"
+Basic.Main.StoppingStreaming="Stopping Stream..."
 Basic.Main.ForceStopStreaming="Stop Streaming (discard delay)"
 Basic.Main.ForceStopStreaming="Stop Streaming (discard delay)"
 
 
 # basic mode file menu
 # basic mode file menu

+ 18 - 6
obs/window-basic-main-outputs.cpp

@@ -27,10 +27,10 @@ static void OBSStreamStopping(void *data, calldata_t *params)
 
 
 	int sec = (int)obs_output_get_active_delay(obj);
 	int sec = (int)obs_output_get_active_delay(obj);
 	if (sec == 0)
 	if (sec == 0)
-		return;
-
-	QMetaObject::invokeMethod(output->main,
-			"StreamDelayStopping", Q_ARG(int, sec));
+		QMetaObject::invokeMethod(output->main, "StreamStopping");
+	else
+		QMetaObject::invokeMethod(output->main,
+				"StreamDelayStopping", Q_ARG(int, sec));
 }
 }
 
 
 static void OBSStartStreaming(void *data, calldata_t *params)
 static void OBSStartStreaming(void *data, calldata_t *params)
@@ -75,6 +75,14 @@ static void OBSStopRecording(void *data, calldata_t *params)
 	UNUSED_PARAMETER(params);
 	UNUSED_PARAMETER(params);
 }
 }
 
 
+static void OBSRecordStopping(void *data, calldata_t *params)
+{
+	BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data);
+	QMetaObject::invokeMethod(output->main, "RecordStopping");
+
+	UNUSED_PARAMETER(params);
+}
+
 static void FindBestFilename(string &strPath, bool noSpace)
 static void FindBestFilename(string &strPath, bool noSpace)
 {
 {
 	int num = 2;
 	int num = 2;
@@ -281,7 +289,7 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_)
 
 
 	streamDelayStarting.Connect(obs_output_get_signal_handler(streamOutput),
 	streamDelayStarting.Connect(obs_output_get_signal_handler(streamOutput),
 			"starting", OBSStreamStarting, this);
 			"starting", OBSStreamStarting, this);
-	streamDelayStopping.Connect(obs_output_get_signal_handler(streamOutput),
+	streamStopping.Connect(obs_output_get_signal_handler(streamOutput),
 			"stopping", OBSStreamStopping, this);
 			"stopping", OBSStreamStopping, this);
 
 
 	startStreaming.Connect(obs_output_get_signal_handler(streamOutput),
 	startStreaming.Connect(obs_output_get_signal_handler(streamOutput),
@@ -304,6 +312,8 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_)
 			"start", OBSStartRecording, this);
 			"start", OBSStartRecording, this);
 	stopRecording.Connect(obs_output_get_signal_handler(fileOutput),
 	stopRecording.Connect(obs_output_get_signal_handler(fileOutput),
 			"stop", OBSStopRecording, this);
 			"stop", OBSStopRecording, this);
+	recordStopping.Connect(obs_output_get_signal_handler(fileOutput),
+			"stopping", OBSRecordStopping, this);
 }
 }
 
 
 int SimpleOutput::GetAudioBitrate() const
 int SimpleOutput::GetAudioBitrate() const
@@ -762,7 +772,7 @@ AdvancedOutput::AdvancedOutput(OBSBasic *main_) : BasicOutputHandler(main_)
 
 
 	streamDelayStarting.Connect(obs_output_get_signal_handler(streamOutput),
 	streamDelayStarting.Connect(obs_output_get_signal_handler(streamOutput),
 			"starting", OBSStreamStarting, this);
 			"starting", OBSStreamStarting, this);
-	streamDelayStopping.Connect(obs_output_get_signal_handler(streamOutput),
+	streamStopping.Connect(obs_output_get_signal_handler(streamOutput),
 			"stopping", OBSStreamStopping, this);
 			"stopping", OBSStreamStopping, this);
 
 
 	startStreaming.Connect(obs_output_get_signal_handler(streamOutput),
 	startStreaming.Connect(obs_output_get_signal_handler(streamOutput),
@@ -774,6 +784,8 @@ AdvancedOutput::AdvancedOutput(OBSBasic *main_) : BasicOutputHandler(main_)
 			"start", OBSStartRecording, this);
 			"start", OBSStartRecording, this);
 	stopRecording.Connect(obs_output_get_signal_handler(fileOutput),
 	stopRecording.Connect(obs_output_get_signal_handler(fileOutput),
 			"stop", OBSStopRecording, this);
 			"stop", OBSStopRecording, this);
+	recordStopping.Connect(obs_output_get_signal_handler(fileOutput),
+			"stopping", OBSRecordStopping, this);
 }
 }
 
 
 void AdvancedOutput::UpdateStreamSettings()
 void AdvancedOutput::UpdateStreamSettings()

+ 2 - 1
obs/window-basic-main-outputs.hpp

@@ -15,7 +15,8 @@ struct BasicOutputHandler {
 	OBSSignal              startStreaming;
 	OBSSignal              startStreaming;
 	OBSSignal              stopStreaming;
 	OBSSignal              stopStreaming;
 	OBSSignal              streamDelayStarting;
 	OBSSignal              streamDelayStarting;
-	OBSSignal              streamDelayStopping;
+	OBSSignal              streamStopping;
+	OBSSignal              recordStopping;
 
 
 	inline BasicOutputHandler(OBSBasic *main_) : main(main_) {}
 	inline BasicOutputHandler(OBSBasic *main_) : main(main_) {}
 
 

+ 10 - 0
obs/window-basic-main.cpp

@@ -3422,6 +3422,11 @@ void OBSBasic::StreamingStart()
 	blog(LOG_INFO, STREAMING_START);
 	blog(LOG_INFO, STREAMING_START);
 }
 }
 
 
+void OBSBasic::StreamStopping()
+{
+	ui->streamButton->setText(QTStr("Basic.Main.StoppingStreaming"));
+}
+
 void OBSBasic::StreamingStop(int code)
 void OBSBasic::StreamingStop(int code)
 {
 {
 	const char *errorMessage;
 	const char *errorMessage;
@@ -3482,6 +3487,11 @@ void OBSBasic::StartRecording()
 		outputHandler->StartRecording();
 		outputHandler->StartRecording();
 }
 }
 
 
+void OBSBasic::RecordStopping()
+{
+	ui->recordButton->setText(QTStr("Basic.Main.StoppingRecording"));
+}
+
 void OBSBasic::StopRecording()
 void OBSBasic::StopRecording()
 {
 {
 	SaveProject();
 	SaveProject();

+ 2 - 0
obs/window-basic-main.hpp

@@ -289,12 +289,14 @@ public slots:
 	void StreamDelayStopping(int sec);
 	void StreamDelayStopping(int sec);
 
 
 	void StreamingStart();
 	void StreamingStart();
+	void StreamStopping();
 	void StreamingStop(int errorcode);
 	void StreamingStop(int errorcode);
 
 
 	void StartRecording();
 	void StartRecording();
 	void StopRecording();
 	void StopRecording();
 
 
 	void RecordingStart();
 	void RecordingStart();
+	void RecordStopping();
 	void RecordingStop(int code);
 	void RecordingStop(int code);
 
 
 	void SaveProjectDeferred();
 	void SaveProjectDeferred();