UI: Add status icons for recording and streaming

This commit is contained in:
Bennik2000 2020-04-14 20:16:33 +02:00
parent a43c10b173
commit d8e67d2f3c
10 changed files with 364 additions and 14 deletions

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 2.1166666 2.1166667"
height="8"
width="8">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-294.88332)"
id="layer1">
<circle
r="0.52916664"
cy="295.94165"
cx="1.0583333"
id="path4544"
style="fill:#d40000;fill-opacity:1;stroke:none;stroke-width:0.06614584;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 2.1166666 2.1166667"
height="8"
width="8">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-294.88332)"
id="layer1">
<circle
r="0.52916664"
cy="295.94165"
cx="1.0583333"
id="path4544"
style="fill:#999999;fill-opacity:1;stroke:none;stroke-width:0.06614584;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 5.2916665 5.2916668"
height="20"
width="20">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-291.70832)"
id="layer1">
<rect
y="293.03125"
x="1.3229166"
height="2.6458333"
width="1.0583333"
id="rect822"
style="fill:#999999;fill-opacity:1;stroke:none;stroke-width:0.5020116;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<rect
y="293.03125"
x="2.9104166"
height="2.6458333"
width="1.0583333"
id="rect822-1"
style="fill:#999999;fill-opacity:1;stroke:none;stroke-width:0.5020116;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 5.2916665 5.2916668"
height="20"
width="20">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-291.70832)"
id="layer1">
<rect
y="293.03125"
x="1.3229166"
height="2.6458333"
width="1.0583333"
id="rect822"
style="fill:#d4ae00;fill-opacity:1;stroke:none;stroke-width:0.5020116;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<rect
y="293.03125"
x="2.9104166"
height="2.6458333"
width="1.0583333"
id="rect822-1"
style="fill:#d4ae00;fill-opacity:1;stroke:none;stroke-width:0.5020116;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 2.1166666 2.1166667"
height="8"
width="8">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-294.88332)"
id="layer1">
<circle
r="0.39687499"
cy="295.94165"
cx="1.0582843"
id="path4544-3"
style="fill:#5079cc;fill-opacity:1;stroke:none;stroke-width:0.13229169;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
d="M 0.41577997,296.5497 A 0.79374999,0.79374999 0 0 1 0.13224262,295.94165 0.79374999,0.79374999 0 0 1 0.41577996,295.3336"
id="path4546-7"
style="fill:none;fill-opacity:1;stroke:#5079cc;stroke-width:0.15875001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
transform="scale(-1,1)"
d="m -1.7008867,296.5497 a 0.79374999,0.79374999 0 0 1 -0.2835374,-0.60805 0.79374999,0.79374999 0 0 1 0.2835374,-0.60805"
id="path4546-1-3"
style="fill:none;fill-opacity:1;stroke:#5079cc;stroke-width:0.15875001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
d="M 0.63239977,296.41847 A 0.62244385,0.62244385 0 0 1 0.4100551,295.94165 0.62244385,0.62244385 0 0 1 0.63239977,295.46483"
id="path4546-5-7"
style="fill:none;fill-opacity:1;stroke:#5079cc;stroke-width:0.15875001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
transform="scale(-1,1)"
d="m -1.484193,296.41847 a 0.62244391,0.62244391 0 0 1 -0.2223447,-0.47682 0.62244391,0.62244391 0 0 1 0.2223447,-0.47682"
id="path4546-5-4-2"
style="fill:none;fill-opacity:1;stroke:#5079cc;stroke-width:0.15875001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 2.1166666 2.1166667"
height="8"
width="8">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-294.88332)"
id="layer1">
<circle
r="0.39687499"
cy="295.94165"
cx="1.0583333"
id="path4544"
style="fill:#7f7d7f;fill-opacity:1;stroke:none;stroke-width:0.13229167;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
d="M 0.41582902,296.5497 A 0.79374999,0.79374999 0 0 1 0.13229167,295.94165 0.79374999,0.79374999 0 0 1 0.41582902,295.3336"
id="path4546"
style="fill:none;fill-opacity:1;stroke:#7f7d7f;stroke-width:0.15875;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
transform="scale(-1,1)"
d="m -1.7009357,296.5497 a 0.79374999,0.79374999 0 0 1 -0.2835373,-0.60805 0.79374999,0.79374999 0 0 1 0.2835373,-0.60805"
id="path4546-1"
style="fill:none;fill-opacity:1;stroke:#7f7d7f;stroke-width:0.15875;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
d="M 0.6324488,296.41847 A 0.6224438,0.6224438 0 0 1 0.41010416,295.94165 0.6224438,0.6224438 0 0 1 0.6324488,295.46483"
id="path4546-5"
style="fill:none;fill-opacity:1;stroke:#7f7d7f;stroke-width:0.15875;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<path
transform="scale(-1,1)"
d="m -1.484242,296.41847 a 0.62244385,0.62244385 0 0 1 -0.2223447,-0.47682 0.62244385,0.62244385 0 0 1 0.2223447,-0.47682"
id="path4546-5-4"
style="fill:none;fill-opacity:1;stroke:#7f7d7f;stroke-width:0.15875;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -34,6 +34,12 @@
<file>images/sources/text.svg</file>
<file>images/sources/window.svg</file>
<file>images/sources/default.svg</file>
<file>images/recording-active.svg</file>
<file>images/recording-inactive.svg</file>
<file>images/recording-pause.svg</file>
<file>images/recording-pause-inactive.svg</file>
<file>images/streaming-active.svg</file>
<file>images/streaming-inactive.svg</file>
</qresource>
<qresource prefix="/settings">
<file>images/settings/output.svg</file>

View file

@ -7712,6 +7712,8 @@ void OBSBasic::PauseRecording()
pause->setChecked(true);
pause->blockSignals(false);
ui->statusbar->RecordingPaused();
if (trayIcon)
trayIcon->setIcon(QIcon(":/res/images/obs_paused.png"));
@ -7739,6 +7741,8 @@ void OBSBasic::UnpauseRecording()
pause->setChecked(false);
pause->blockSignals(false);
ui->statusbar->RecordingUnpaused();
if (trayIcon)
trayIcon->setIcon(
QIcon(":/res/images/tray_active.png"));

View file

@ -11,18 +11,36 @@ OBSBasicStatusBar::OBSBasicStatusBar(QWidget *parent)
: QStatusBar(parent),
delayInfo(new QLabel),
droppedFrames(new QLabel),
streamIcon(new QLabel),
streamTime(new QLabel),
recordIcon(new QLabel),
recordTime(new QLabel),
cpuUsage(new QLabel),
transparentPixmap(20, 20),
greenPixmap(20, 20),
grayPixmap(20, 20),
redPixmap(20, 20)
redPixmap(20, 20),
recordingActivePixmap(QIcon(":/res/images/recording-active.svg")
.pixmap(QSize(20, 20))),
recordingPausePixmap(QIcon(":/res/images/recording-pause.svg")
.pixmap(QSize(20, 20))),
recordingPauseInactivePixmap(
QIcon(":/res/images/recording-pause-inactive.svg")
.pixmap(QSize(20, 20))),
recordingInactivePixmap(QIcon(":/res/images/recording-inactive.svg")
.pixmap(QSize(20, 20))),
streamingActivePixmap(QIcon(":/res/images/streaming-active.svg")
.pixmap(QSize(20, 20))),
streamingInactivePixmap(QIcon(":/res/images/streaming-inactive.svg")
.pixmap(QSize(20, 20)))
{
streamTime->setText(QString("LIVE: 00:00:00"));
recordTime->setText(QString("REC: 00:00:00"));
cpuUsage->setText(QString("CPU: 0.0%, 0.00 fps"));
streamIcon->setPixmap(streamingInactivePixmap);
recordIcon->setPixmap(recordingInactivePixmap);
QWidget *brWidget = new QWidget(this);
QHBoxLayout *brLayout = new QHBoxLayout(brWidget);
brLayout->setContentsMargins(0, 0, 0, 0);
@ -39,8 +57,12 @@ OBSBasicStatusBar::OBSBasicStatusBar(QWidget *parent)
delayInfo->setAlignment(Qt::AlignVCenter);
droppedFrames->setAlignment(Qt::AlignRight);
droppedFrames->setAlignment(Qt::AlignVCenter);
streamIcon->setAlignment(Qt::AlignRight);
streamIcon->setAlignment(Qt::AlignVCenter);
streamTime->setAlignment(Qt::AlignRight);
streamTime->setAlignment(Qt::AlignVCenter);
recordIcon->setAlignment(Qt::AlignRight);
recordIcon->setAlignment(Qt::AlignVCenter);
recordTime->setAlignment(Qt::AlignRight);
recordTime->setAlignment(Qt::AlignVCenter);
cpuUsage->setAlignment(Qt::AlignRight);
@ -50,13 +72,15 @@ OBSBasicStatusBar::OBSBasicStatusBar(QWidget *parent)
delayInfo->setIndent(20);
droppedFrames->setIndent(20);
streamTime->setIndent(20);
recordTime->setIndent(20);
streamIcon->setIndent(20);
recordIcon->setIndent(20);
cpuUsage->setIndent(20);
kbps->setIndent(10);
addPermanentWidget(droppedFrames);
addPermanentWidget(streamIcon);
addPermanentWidget(streamTime);
addPermanentWidget(recordIcon);
addPermanentWidget(recordTime);
addPermanentWidget(cpuUsage);
addPermanentWidget(delayInfo);
@ -93,6 +117,14 @@ void OBSBasicStatusBar::Activate()
statusSquare->setPixmap(grayPixmap);
}
}
if (streamOutput) {
streamIcon->setPixmap(streamingActivePixmap);
}
if (recordOutput) {
recordIcon->setPixmap(recordingActivePixmap);
}
}
void OBSBasicStatusBar::Deactivate()
@ -103,11 +135,13 @@ void OBSBasicStatusBar::Deactivate()
if (!streamOutput) {
streamTime->setText(QString("LIVE: 00:00:00"));
streamIcon->setPixmap(streamingInactivePixmap);
totalStreamSeconds = 0;
}
if (!recordOutput) {
recordTime->setText(QString("REC: 00:00:00"));
recordIcon->setPixmap(recordingInactivePixmap);
totalRecordSeconds = 0;
}
@ -247,25 +281,26 @@ void OBSBasicStatusBar::UpdateRecordTime()
{
bool paused = os_atomic_load_bool(&recording_paused);
if (!paused)
if (!paused) {
totalRecordSeconds++;
QString text;
if (paused) {
text = QStringLiteral("REC: PAUSED");
} else {
int seconds = totalRecordSeconds % 60;
int totalMinutes = totalRecordSeconds / 60;
int minutes = totalMinutes % 60;
int hours = totalMinutes / 60;
text = QString::asprintf("REC: %02d:%02d:%02d", hours, minutes,
seconds);
}
QString text = QString::asprintf("REC: %02d:%02d:%02d", hours,
minutes, seconds);
recordTime->setText(text);
recordTime->setMinimumWidth(recordTime->width());
recordTime->setText(text);
recordTime->setMinimumWidth(recordTime->width());
} else {
recordIcon->setPixmap(streamPauseIconToggle
? recordingPauseInactivePixmap
: recordingPausePixmap);
streamPauseIconToggle = !streamPauseIconToggle;
}
}
void OBSBasicStatusBar::UpdateDroppedFrames()
@ -483,3 +518,22 @@ void OBSBasicStatusBar::RecordingStopped()
recordOutput = nullptr;
Deactivate();
}
void OBSBasicStatusBar::RecordingPaused()
{
QString text = QStringLiteral("REC: PAUSED");
recordTime->setText(text);
recordTime->setMinimumWidth(recordTime->width());
if (recordOutput) {
recordIcon->setPixmap(recordingPausePixmap);
streamPauseIconToggle = true;
}
}
void OBSBasicStatusBar::RecordingUnpaused()
{
if (recordOutput) {
recordIcon->setPixmap(recordingActivePixmap);
}
}

View file

@ -14,8 +14,10 @@ class OBSBasicStatusBar : public QStatusBar {
private:
QLabel *delayInfo;
QLabel *droppedFrames;
QLabel *streamIcon;
QLabel *streamTime;
QLabel *recordTime;
QLabel *recordIcon;
QLabel *cpuUsage;
QLabel *kbps;
QLabel *statusSquare;
@ -24,6 +26,7 @@ private:
obs_output_t *recordOutput = nullptr;
bool active = false;
bool overloadedNotify = true;
bool streamPauseIconToggle = false;
int retries = 0;
int totalStreamSeconds = 0;
@ -48,6 +51,13 @@ private:
QPixmap grayPixmap;
QPixmap redPixmap;
QPixmap recordingActivePixmap;
QPixmap recordingPausePixmap;
QPixmap recordingPauseInactivePixmap;
QPixmap recordingInactivePixmap;
QPixmap streamingActivePixmap;
QPixmap streamingInactivePixmap;
float lastCongestion = 0.0f;
QPointer<QTimer> refreshTimer;
@ -81,6 +91,8 @@ public:
void StreamStopped();
void RecordingStarted(obs_output_t *output);
void RecordingStopped();
void RecordingPaused();
void RecordingUnpaused();
void ReconnectClear();
};