Skip to content

Commit

Permalink
Give option to show stream stats in settings->audio/wifi
Browse files Browse the repository at this point in the history
Closes #543
  • Loading branch information
streetpea committed Feb 3, 2025
1 parent 5d7006a commit 39565c5
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gui/include/qmlsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class QmlSettings : public QObject
Q_PROPERTY(int noiseSuppressLevel READ noiseSuppressLevel WRITE setNoiseSuppressLevel NOTIFY noiseSuppressLevelChanged)
Q_PROPERTY(int echoSuppressLevel READ echoSuppressLevel WRITE setEchoSuppressLevel NOTIFY echoSuppressLevelChanged)
#endif
Q_PROPERTY(bool showStreamStats READ showStreamStats WRITE setShowStreamStats NOTIFY showStreamStatsChanged)
Q_PROPERTY(float hapticOverride READ hapticOverride WRITE setHapticOverride NOTIFY hapticOverrideChanged)
Q_PROPERTY(int displayTargetContrast READ displayTargetContrast WRITE setDisplayTargetContrast NOTIFY displayTargetContrastChanged)
Q_PROPERTY(int displayTargetPeak READ displayTargetPeak WRITE setDisplayTargetPeak NOTIFY displayTargetPeakChanged)
Expand Down Expand Up @@ -153,6 +154,9 @@ class QmlSettings : public QObject
int audioVideoDisabled() const;
void setAudioVideoDisabled(int disabled);

bool showStreamStats() const;
void setShowStreamStats(bool enabled);

int displayTargetContrast() const;
void setDisplayTargetContrast(int contrast);

Expand Down Expand Up @@ -546,6 +550,7 @@ class QmlSettings : public QObject
void hideCursorChanged();
void hapticOverrideChanged();
void audioVideoDisabledChanged();
void showStreamStatsChanged();
void fpsLocalPS4Changed();
void fpsRemotePS4Changed();
void fpsLocalPS5Changed();
Expand Down
3 changes: 3 additions & 0 deletions gui/include/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ class Settings : public QObject
RumbleHapticsIntensity GetRumbleHapticsIntensity() const;
void SetRumbleHapticsIntensity(RumbleHapticsIntensity intensity);

bool GetShowStreamStats() const { return settings.value("settings/show_stream_stats", false).toBool(); }
void SetShowStreamStats(bool enabled) { settings.setValue("settings/show_stream_stats", enabled); }

bool GetButtonsByPosition() const { return settings.value("settings/buttons_by_pos", false).toBool(); }
void SetButtonsByPosition(bool enabled) { settings.setValue("settings/buttons_by_pos", enabled); }

Expand Down
17 changes: 16 additions & 1 deletion gui/src/qml/SettingsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,6 @@ DialogView {

C.Slider {
Layout.preferredWidth: 250
lastInFocusChain: true
from: 0
to: 100
stepSize: 1
Expand All @@ -1430,6 +1429,21 @@ DialogView {
Layout.alignment: Qt.AlignRight
text: qsTr("(5%)")
}

Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Show Stream Stats During Gameplay")
}
C.CheckBox {
lastInFocusChain: true
checked: Chiaki.settings.showStreamStats
onToggled: Chiaki.settings.showStreamStats = !Chiaki.settings.showStreamStats
}

Label {
Layout.alignment: Qt.AlignRight
text: qsTr("(Unchecked)")
}
}
}
}
Expand Down Expand Up @@ -2180,6 +2194,7 @@ DialogView {

C.Button {
id: profile
firstInFocusChain: true
text: qsTr("Manage Profiles")
onClicked: {
root.showProfileDialog()
Expand Down
93 changes: 93 additions & 0 deletions gui/src/qml/StreamView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,99 @@ Item {
}
}

Item {
id: streamStats
anchors.fill: parent
visible: Chiaki.settings.showStreamStats && !menuView.visible && !sessionLoading && !sessionError && !(Chiaki.settings.audioVideoDisabled & 0x02)
Label {
anchors {
right: statsConsoleNameLabel.right
bottom: statsConsoleNameLabel.top
bottomMargin: 5
rightMargin: 5

}
text: "Mbps"
font.pixelSize: 18
visible: Chiaki.session

Label {
anchors {
right: parent.left
baseline: parent.baseline
rightMargin: 5
}
text: visible ? Chiaki.session.measuredBitrate.toFixed(1) : ""
color: Material.accent
font.bold: true
font.pixelSize: 28
}
}

Label {
id: statsConsoleNameLabel
anchors {
right: parent.right
bottom: parent.bottom
bottomMargin: 30
}
ColumnLayout {
anchors {
right: parent.right
top: parent.top
bottom: parent.bottom
rightMargin: 5
}
RowLayout {
Layout.alignment: Qt.AlignRight
Label {
id: statsPacketLossLabel
text: qsTr("packet loss")
font.pixelSize: 15
opacity: parent.visible
visible: opacity

Behavior on opacity { NumberAnimation { duration: 250 } }

Label {
anchors {
right: parent.left
baseline: parent.baseline
rightMargin: 5
}
text: visible ? "%1<font size=\"1\">%</font>".arg((Chiaki.session?.averagePacketLoss * 100).toFixed(1)) : ""
font.bold: true
color: "#ef9a9a" // Material.Red
font.pixelSize: 18
}
}
}

Label {
text: qsTr("dropped frames")
font.pixelSize: 15
opacity: parent.visible
visible: opacity

Behavior on opacity { NumberAnimation { duration: 250 } }

Label {
id: statsDroppedFramesLabel
anchors {
right: parent.left
baseline: parent.baseline
rightMargin: 5
}
text: visible ? Chiaki.window.droppedFrames : ""
color: "#ef9a9a" // Material.Red
font.bold: true
font.pixelSize: 18
}
}
}
}
}

Item {
id: menuView
property bool closing: false
Expand Down
12 changes: 12 additions & 0 deletions gui/src/qmlsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ void QmlSettings::setHideCursor(bool enabled)
emit hideCursorChanged();
}

bool QmlSettings::showStreamStats() const
{
return settings->GetShowStreamStats();
}

void QmlSettings::setShowStreamStats(bool enabled)
{
settings->SetShowStreamStats(enabled);
emit showStreamStatsChanged();
}

float QmlSettings::hapticOverride() const
{
return settings->GetHapticOverride();
Expand Down Expand Up @@ -1534,6 +1545,7 @@ void QmlSettings::refreshAllKeys()
emit rumbleHapticsIntensityChanged();
emit buttonsByPositionChanged();
emit startMicUnmutedChanged();
emit showStreamStatsChanged();
#ifdef CHIAKI_GUI_ENABLE_STEAMDECK_NATIVE
emit verticalDeckChanged();
emit steamDeckHapticsChanged();
Expand Down

0 comments on commit 39565c5

Please sign in to comment.