UI: Make streaming/recording buttons checkable

This makes it so the buttons appear "pressed" while streaming/recording
to more visibly help indicate that they are currently active.

Closes jp9000/obs-studio#1039
This commit is contained in:
nleseul 2017-10-06 14:51:03 -04:00 committed by jp9000
parent 6778be17d9
commit d22a75401d
3 changed files with 16 additions and 2 deletions

View File

@ -794,8 +794,12 @@ QPushButton:pressed#exitButton {
border: 1px solid rgb(240, 98, 146); /* Pink (Secondary) */
}
QPushButton:checked#streamButton,
QPushButton:checked#recordButton,
QPushButton:checked[themeID="replayBufferButton"],
QPushButton:checked#modeSwitch {
QPushButton:checked#modeSwitch,
QPushButton:checked#settingsButton,
QPushButton:checked#exitButton {
background-color: rgba(240, 98, 146, 0.5); /* Pink (Secondary) */
border: 1px solid rgba(240, 98, 146, 0.5); /* Pink (Secondary) */
}

View File

@ -954,7 +954,7 @@
<string>Basic.Main.StartStreaming</string>
</property>
<property name="checkable">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
@ -978,6 +978,9 @@
<property name="text">
<string>Basic.Main.StartRecording</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>

View File

@ -4192,6 +4192,7 @@ void OBSBasic::StartStreaming()
if (!outputHandler->StartStreaming(service)) {
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
ui->streamButton->setEnabled(true);
ui->streamButton->setChecked(false);
if (sysTrayStream) {
sysTrayStream->setText(ui->streamButton->text());
@ -4314,6 +4315,7 @@ void OBSBasic::StreamDelayStarting(int sec)
{
ui->streamButton->setText(QTStr("Basic.Main.StopStreaming"));
ui->streamButton->setEnabled(true);
ui->streamButton->setChecked(true);
if (sysTrayStream) {
sysTrayStream->setText(ui->streamButton->text());
@ -4339,6 +4341,7 @@ void OBSBasic::StreamDelayStopping(int sec)
{
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
ui->streamButton->setEnabled(true);
ui->streamButton->setChecked(false);
if (sysTrayStream) {
sysTrayStream->setText(ui->streamButton->text());
@ -4362,6 +4365,7 @@ void OBSBasic::StreamingStart()
{
ui->streamButton->setText(QTStr("Basic.Main.StopStreaming"));
ui->streamButton->setEnabled(true);
ui->streamButton->setChecked(true);
ui->statusbar->StreamStarted(outputHandler->streamOutput);
if (sysTrayStream) {
@ -4432,6 +4436,7 @@ void OBSBasic::StreamingStop(int code, QString last_error)
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
ui->streamButton->setEnabled(true);
ui->streamButton->setChecked(false);
if (sysTrayStream) {
sysTrayStream->setText(ui->streamButton->text());
@ -4501,6 +4506,7 @@ void OBSBasic::RecordingStart()
{
ui->statusbar->RecordingStarted(outputHandler->fileOutput);
ui->recordButton->setText(QTStr("Basic.Main.StopRecording"));
ui->recordButton->setChecked(true);
if (sysTrayRecord)
sysTrayRecord->setText(ui->recordButton->text());
@ -4518,6 +4524,7 @@ void OBSBasic::RecordingStop(int code)
{
ui->statusbar->RecordingStopped();
ui->recordButton->setText(QTStr("Basic.Main.StartRecording"));
ui->recordButton->setChecked(false);
if (sysTrayRecord)
sysTrayRecord->setText(ui->recordButton->text());