Keep multiview captions and controls below video and use logarithmic volume
This commit is contained in:
1 parent
213a1010c2
commit
5a8807bf89
3 files changed
+24
-9
No files matched your search
@@ -25,6 +25,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <cmath>
|
||||
|
||||
extern "C" {
|
||||
#include "../../../lib/debug_config.h"
|
||||
@@ -199,7 +200,7 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
|
||||
auto* volumeBox = new QWidget(bar); auto* volumeLayout = new QVBoxLayout(volumeBox);
|
||||
volumeLayout->setContentsMargins(0, 0, 0, 0); volumeLayout->setSpacing(0);
|
||||
auto* volume = new StreamVolumeSlider(volumeBox); volume->setObjectName(QStringLiteral("streamVolume"));
|
||||
volume->setAccessibleName(text("Stream volume")); volume->setToolTip(QStringLiteral("100%")); volumeLayout->addWidget(volume);
|
||||
volume->setAccessibleName(text("Stream volume")); volume->setToolTip(QStringLiteral("0 dB")); volumeLayout->addWidget(volume);
|
||||
auto* volumeLabel = new QLabel(text("Volume"), volumeBox); volumeLabel->setAlignment(Qt::AlignCenter);
|
||||
volumeLayout->addWidget(volumeLabel); controls->addWidget(volumeBox);
|
||||
m_fullscreen = new QPushButton(text("Fullscreen"), bar); m_fullscreen->setObjectName(QStringLiteral("streamFullscreen"));
|
||||
@@ -210,8 +211,12 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
|
||||
setWindowControlsVisible(false); layout->setContentsMargins(3, 3, 3, 3); layout->setSpacing(2); setMinimumSize(0, 0);
|
||||
}
|
||||
connect(volume, &QSlider::valueChanged, this, [this, volume](int value) {
|
||||
m_playback->volume = value / 100.0f; volume->setToolTip(QStringLiteral("%1%").arg(value));
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "desktop viewer volume id=%llu percent=%d", (unsigned long long)m_playback->id, value);
|
||||
const float decibels = (value - 100) * 0.6f;
|
||||
const float gain = value ? std::pow(10.0f, decibels / 20.0f) : 0.0f;
|
||||
m_playback->volume = gain;
|
||||
volume->setToolTip(value ? QStringLiteral("%1 dB").arg(decibels, 0, 'f', 1) : QStringLiteral("−∞ dB"));
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "desktop viewer volume id=%llu position=%d gain=%.6f",
|
||||
(unsigned long long)m_playback->id, value, gain);
|
||||
});
|
||||
connect(m_fullscreen, &QPushButton::clicked, this, [this, embedded] {
|
||||
if (embedded) emit fullscreenRequested(); else if (isFullScreen()) showNormal(); else showFullScreen();
|
||||
|
||||
Reference in new issue
Block a user