0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

frontend-tools: Add ability to start timer if output is already active

This adds the ability to start the output timer if streaming or recording is already active.
This commit is contained in:
cg2121 2016-10-17 21:49:24 -05:00
parent 4505d5ac33
commit 6639847017
2 changed files with 21 additions and 10 deletions

View File

@ -37,24 +37,32 @@ void OutputTimer::closeEvent(QCloseEvent*)
void OutputTimer::StreamingTimerButton()
{
if (obs_frontend_streaming_active())
obs_frontend_streaming_stop();
else
if (!obs_frontend_streaming_active()) {
obs_frontend_streaming_start();
} else if (streamingAlreadyActive) {
StreamTimerStart();
streamingAlreadyActive = false;
} else if (obs_frontend_streaming_active()) {
obs_frontend_streaming_stop();
}
}
void OutputTimer::RecordingTimerButton()
{
if (obs_frontend_recording_active())
obs_frontend_recording_stop();
else
if (!obs_frontend_recording_active()) {
obs_frontend_recording_start();
} else if (recordingAlreadyActive) {
RecordTimerStart();
recordingAlreadyActive = false;
} else if (obs_frontend_recording_active()) {
obs_frontend_recording_stop();
}
}
void OutputTimer::StreamTimerStart()
{
if (!isVisible()) {
ui->outputTimerStream->setEnabled(false);
streamingAlreadyActive = true;
return;
}
@ -88,7 +96,7 @@ void OutputTimer::StreamTimerStart()
void OutputTimer::RecordTimerStart()
{
if (!isVisible()) {
ui->outputTimerRecord->setEnabled(false);
recordingAlreadyActive = true;
return;
}
@ -121,7 +129,7 @@ void OutputTimer::RecordTimerStart()
void OutputTimer::StreamTimerStop()
{
ui->outputTimerStream->setEnabled(true);
streamingAlreadyActive = false;
if (!isVisible() && streamingTimer->isActive() == false)
return;
@ -139,7 +147,7 @@ void OutputTimer::StreamTimerStop()
void OutputTimer::RecordTimerStop()
{
ui->outputTimerRecord->setEnabled(true);
recordingAlreadyActive = false;
if (!isVisible() && recordingTimer->isActive() == false)
return;

View File

@ -30,6 +30,9 @@ public slots:
void EventStopRecording();
private:
bool streamingAlreadyActive = false;
bool recordingAlreadyActive = false;
QTimer *streamingTimer;
QTimer *recordingTimer;
QTimer *streamingTimerDisplay;