Update live player captions independently of playback state

This commit is contained in:
evgeny committed 2026-10-28 00:58:59 +01:00
1 parent 9d2ddcc496
commit 3ff5ca7009
2 files changed
+16 -3

No files matched your search

+13 -3
View File
@@ -127,9 +127,10 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
m_playback->group = group; m_playback->source = source; m_playback->epoch = epoch;
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop viewer requested id=%llu source=%llx epoch=%llx",
(unsigned long long)m_playback->id, (unsigned long long)source, (unsigned long long)epoch);
setWindowTitle(text("Live stream: %1").arg(name)); resize(800, 500);
resize(800, 500);
setObjectName(QStringLiteral("streamPlayer_%1").arg(source));
auto* layout = new QVBoxLayout(this); auto* title = new QLabel(name, this); layout->addWidget(title);
auto* layout = new QVBoxLayout(this); m_title = new QLabel(this); layout->addWidget(m_title);
setSourceName(name);
m_status = new QLabel(text("Connecting…"), this); layout->addWidget(m_status);
m_render = new VideoRenderWidget(this, true); layout->addWidget(m_render, 1);
m_telemetry = new QLabel(this); m_telemetry->setObjectName(QStringLiteral("streamTelemetry"));
@@ -145,7 +146,7 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
auto* close = new QPushButton(text("Close player"), this); controls->addWidget(close); layout->addLayout(controls);
if (embedded) {
fullscreen->hide(); close->hide(); layout->setContentsMargins(3, 3, 3, 3); layout->setSpacing(2);
title->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); title->setToolTip(name);
m_title->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
m_status->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); setMinimumSize(0, 0);
}
connect(volume, &QSlider::valueChanged, this, [this](int value) { m_playback->volume = value / 100.0f; });
@@ -160,6 +161,15 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
StreamPlayerWindow::~StreamPlayerWindow() { stop(); }
/* Имя относится к представлению, а не идентичности media-сессии. */
void StreamPlayerWindow::setSourceName(const QString& name) {
m_title->setText(name); m_title->setToolTip(name);
setWindowTitle(text("Live stream: %1").arg(name));
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "desktop viewer name id=%llu source=%llx epoch=%llx name=%s",
(unsigned long long)m_playback->id, (unsigned long long)m_playback->source,
(unsigned long long)m_playback->epoch, qPrintable(name));
}
bool StreamPlayerWindow::finished() const { return m_playback->complete; }
bool StreamPlayerWindow::failed() const { return m_playback->failed; }
int StreamPlayerWindow::drainTimeoutMs() const {