Keep call diagnostics in settings and translate video controls
This commit is contained in:
1 parent
434b59b1c7
commit
87a2075dec
3 files changed
+24
-9
No files matched your search
@@ -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());
|
||||
}
|
||||
Reference in new issue
Block a user