Browse Source

Keep call diagnostics in settings and translate video controls

master
evgeny 6 days ago
parent
commit
87a2075dec
  1. 23
      tools/chatgui/src/callwindow.cpp
  2. 5
      tools/chatgui/translations/chatgui_en.ts
  3. 5
      tools/chatgui/translations/chatgui_ru.ts

23
tools/chatgui/src/callwindow.cpp

@ -32,6 +32,8 @@ extern "C" {
enum class Glyph { Phone, PhoneDown, Mic, MicOff };
static QString callText(const char* text) { return QCoreApplication::translate("ChatGui", text); }
static QColor colorForName(const QString& name) {
static const QColor palette[] = {
QColor("#5B9BD5"), QColor("#70AD47"), QColor("#ED7D31"),
@ -212,10 +214,10 @@ CallWindow::CallWindow(QWidget* parent)
m_videoControls = new QWidget(this); auto* videoLayout = new QVBoxLayout(m_videoControls);
videoLayout->setContentsMargins(0, 0, 0, 0);
auto* actions = new QHBoxLayout();
m_videoEnabled = new QCheckBox(tr("Send video"), this); actions->addWidget(m_videoEnabled);
m_videoEnabled = new QCheckBox(callText("Send video"), this); actions->addWidget(m_videoEnabled);
actions->addStretch(1);
m_settingsBtn = new QPushButton(tr("Call settings"), this); m_settingsBtn->setCheckable(true); actions->addWidget(m_settingsBtn);
m_fullScreenBtn = new QPushButton(tr("Full screen"), this); actions->addWidget(m_fullScreenBtn);
m_settingsBtn = new QPushButton(callText("Call settings"), this); m_settingsBtn->setCheckable(true); actions->addWidget(m_settingsBtn);
m_fullScreenBtn = new QPushButton(callText("Full screen"), this); actions->addWidget(m_fullScreenBtn);
lay->addLayout(actions);
connect(m_settingsBtn, &QPushButton::toggled, this, [this] { updateVideoPresentation(); });
connect(m_fullScreenBtn, &QPushButton::clicked, this, &CallWindow::toggleFullScreen);
@ -223,9 +225,9 @@ CallWindow::CallWindow(QWidget* parent)
m_camera = new QComboBox(this);
for (const auto& camera : CallVideoEngine::cameras()) m_camera->addItem(camera.first, camera.second);
m_resolution = new QComboBox(this); m_resolution->addItem("640×480", QSize(640, 480)); m_resolution->addItem("1280×720", QSize(1280, 720));
m_codec = new QComboBox(this); m_codec->addItem(tr("Auto (H.265 → H.264)"), 0); m_codec->addItem("H.265", 2); m_codec->addItem("H.264", 1);
m_codec = new QComboBox(this); m_codec->addItem(callText("Auto (H.265 → H.264)"), 0); m_codec->addItem("H.265", 2); m_codec->addItem("H.264", 1);
modes->addWidget(m_camera, 1); modes->addWidget(m_resolution); modes->addWidget(m_codec); videoLayout->addLayout(modes);
auto* rates = new QHBoxLayout(); rates->addWidget(new QLabel(tr("Bitrate range, kbit/s:"), this));
auto* rates = new QHBoxLayout(); rates->addWidget(new QLabel(callText("Bitrate range, kbit/s:"), this));
m_videoMin = new QSpinBox(this); m_videoMax = new QSpinBox(this);
for (auto* spin : {m_videoMin, m_videoMax}) { spin->setRange(300, 4000); spin->setSingleStep(100); rates->addWidget(spin); }
m_videoMin->setValue(300); m_videoMax->setValue(4000); videoLayout->addLayout(rates); lay->addWidget(m_videoControls);
@ -294,7 +296,10 @@ CallWindow::CallWindow(QWidget* parent)
setState(Outgoing);
}
CallWindow::~CallWindow() = default;
CallWindow::~CallWindow() {
// Остановить callbacks до удаления дочерних виджетов окна.
m_video->disconnect(this); m_video->stop();
}
void CallWindow::setPeerName(const QString& name) {
m_peerLabel->setText(name);
@ -382,7 +387,7 @@ void CallWindow::toggleFullScreen() {
if (m_remoteImage.isNull()) return;
if (isFullScreen()) leaveFullScreen();
else { m_windowGeometry = saveGeometry(); showFullScreen(); }
m_fullScreenBtn->setText(isFullScreen() ? tr("Exit full screen") : tr("Full screen"));
m_fullScreenBtn->setText(isFullScreen() ? callText("Exit full screen") : callText("Full screen"));
}
void CallWindow::updateVideoPresentation() {
@ -401,7 +406,7 @@ void CallWindow::updateVideoPresentation() {
m_statsLabel->setVisible(settings && !m_statsLabel->text().isEmpty());
m_videoEnabled->setVisible(active); m_settingsBtn->setVisible(active);
m_videoControls->setVisible(settings); m_fullScreenBtn->setVisible(receiving);
m_fullScreenBtn->setText(isFullScreen() ? tr("Exit full screen") : tr("Full screen"));
m_fullScreenBtn->setText(isFullScreen() ? callText("Exit full screen") : callText("Full screen"));
m_videoStatus->setVisible(active && !m_videoStatus->text().isEmpty());
update();
}
@ -496,5 +501,5 @@ void CallWindow::setAudioStats(int rtt, int buffer, int tempo, int dropped, int
"ms\nBuffer drops: %7 · Underruns: %8")
.arg(buffer).arg(reserve).arg(minimum).arg(maximum)
.arg(tempo / 100.0, 0, 'f', 2).arg(rtt).arg(dropped).arg(underruns));
m_statsLabel->show();
m_statsLabel->setVisible(m_state == Active && m_settingsBtn->isChecked());
}

5
tools/chatgui/translations/chatgui_en.ts

@ -3,6 +3,11 @@
<TS version="2.1" language="en_US" sourcelanguage="en_US">
<context>
<name>ChatGui</name>
<message><source>Call settings</source><translation>Call settings</translation></message>
<message><source>Full screen</source><translation>Full screen</translation></message>
<message><source>Exit full screen</source><translation>Exit full screen</translation></message>
<message><source>Auto (H.265 → H.264)</source><translation>Auto (H.265 → H.264)</translation></message>
<message><source>Bitrate range, kbit/s:</source><translation>Bitrate range, kbit/s:</translation></message>
<message><source> kbit/s</source><translation> kbit/s</translation></message>
<message><source>Call video: minimum bitrate</source><translation>Call video: minimum bitrate</translation></message>
<message><source>Call video: maximum bitrate</source><translation>Call video: maximum bitrate</translation></message>

5
tools/chatgui/translations/chatgui_ru.ts

@ -3,6 +3,11 @@
<TS version="2.1" language="ru_RU" sourcelanguage="en_US">
<context>
<name>ChatGui</name>
<message><source>Call settings</source><translation>Настройки звонка</translation></message>
<message><source>Full screen</source><translation>На весь экран</translation></message>
<message><source>Exit full screen</source><translation>Выйти из полного экрана</translation></message>
<message><source>Auto (H.265 → H.264)</source><translation>Авто (H.265 → H.264)</translation></message>
<message><source>Bitrate range, kbit/s:</source><translation>Битрейт, кбит/с:</translation></message>
<message><source> kbit/s</source><translation> кбит/с</translation></message>
<message><source>Call video: minimum bitrate</source><translation>Видеозвонок: минимальный битрейт</translation></message>
<message><source>Call video: maximum bitrate</source><translation>Видеозвонок: максимальный битрейт</translation></message>

Loading…
Cancel
Save