diff --git a/tools/chatgui/src/streamgrid_window.cpp b/tools/chatgui/src/streamgrid_window.cpp index b8d3d071..ee5c82df 100644 --- a/tools/chatgui/src/streamgrid_window.cpp +++ b/tools/chatgui/src/streamgrid_window.cpp @@ -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); diff --git a/tools/chatgui/src/streamgrid_window.h b/tools/chatgui/src/streamgrid_window.h index a8c095c2..c82aa45d 100644 --- a/tools/chatgui/src/streamgrid_window.h +++ b/tools/chatgui/src/streamgrid_window.h @@ -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с.