Refresh multiview names without recreating stream tiles
This commit is contained in:
1 parent
3ff5ca7009
commit
5286388ada
2 files changed
+15
-4
No files matched your search
@@ -58,8 +58,8 @@ void StreamGridWindow::createTile(Tile& tile) {
|
||||
tile.widget = new QWidget(this);
|
||||
tile.widget->setObjectName(QStringLiteral("streamPreview_%1").arg(tile.source));
|
||||
auto* layout = new QVBoxLayout(tile.widget); layout->setContentsMargins(3, 3, 3, 3); layout->setSpacing(2);
|
||||
auto* name = new QLabel(tile.name, tile.widget); name->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
|
||||
name->setToolTip(tile.name); layout->addWidget(name);
|
||||
tile.title = new QLabel(tile.name, tile.widget); tile.title->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
|
||||
tile.title->setToolTip(tile.name); layout->addWidget(tile.title);
|
||||
tile.status = new QLabel(text("Connecting…"), tile.widget); layout->addWidget(tile.status);
|
||||
#ifdef HAVE_STREAM_CAPTURE
|
||||
auto* preview = new QVideoWidget(tile.widget); preview->setAspectRatioMode(Qt::KeepAspectRatio);
|
||||
@@ -177,7 +177,17 @@ void StreamGridWindow::onSources(const uint8_t* data, int length) {
|
||||
continue;
|
||||
}
|
||||
tile.removeAt = -1;
|
||||
if (tile.epoch == source->epoch && tile.self == source->self) continue;
|
||||
if (tile.epoch == source->epoch && tile.self == source->self) {
|
||||
if (tile.name != source->name) {
|
||||
const QString previous = tile.name; tile.name = source->name;
|
||||
if (tile.self) { tile.title->setText(tile.name); tile.title->setToolTip(tile.name); }
|
||||
else tile.player->setSourceName(tile.name);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop multiview source renamed group=%llx source=%llx epoch=%llx self=%d old=%s new=%s",
|
||||
(unsigned long long)m_group, (unsigned long long)tile.source, (unsigned long long)tile.epoch,
|
||||
tile.self, qPrintable(previous), qPrintable(tile.name));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (m_focused == tile.source) restoreGrid();
|
||||
delete tile.widget;
|
||||
tile = Tile{source->id, source->epoch, source->name, source->self}; createTile(tile);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
// Неизменная группа этого окна.
|
||||
uint64_t group() const { return m_group; }
|
||||
// Заимствованный CHAT_EVT_STREAM_SOURCES: ошибка/другая группа игнорируются; valid=false сохраняет все плитки.
|
||||
// Новая эпоха или смена self пересоздаёт только соответствующую плитку, остальные сохраняют playback.
|
||||
// Новая эпоха или смена self пересоздаёт соответствующую плитку; новое имя обновляет подписи без сброса playback.
|
||||
void onSources(const uint8_t* data, int length);
|
||||
// Последний QVideoFrame локального publisher в QVariant; пустой кадр сбрасывает preview, другая группа игнорируется.
|
||||
void setLocalPreview(uint64_t group, const QVariant& frame);
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
QWidget* widget = nullptr; // Владеет player либо прямым preview, удаляется целиком.
|
||||
QWidget* video = nullptr; // Поверхность изображения; сюда направлены клики.
|
||||
StreamPlayerWindow* player = nullptr; // Только remote: владелец decoder, аудиочасов и viewer.
|
||||
QLabel* title = nullptr; // Подпись self-preview; подпись remote принадлежит StreamPlayerWindow.
|
||||
QLabel* status = nullptr; // Статус прямого preview; у remote им владеет player.
|
||||
qint64 removeAt = -1, retryAt = 0; // Дедлайны m_clock в мс: -1 не удалять, 0 повтор не назначен.
|
||||
unsigned failures = 0; // Backoff decoder: 500мс, 1/2/4/8с, далее максимум 10с.
|
||||
|
||||
Reference in new issue
Block a user