Center desktop call actions and use a gear button for video settings

This commit is contained in:
evgeny committed 2026-10-28 13:17:19 +01:00
1 parent 53a63670e8
commit 32c6ff5cfa
2 files changed
+30 -5

No files matched your search

+29 -5
View File
@@ -29,7 +29,7 @@ extern "C" {
/* ── рисование иконок звонка (QPainter, без внешних ассетов) ── */
enum class Glyph { Phone, PhoneDown, Mic, MicOff, Camera, CameraOff };
enum class Glyph { Phone, PhoneDown, Mic, MicOff, Camera, CameraOff, Settings };
static QString callText(const char* text) { return QCoreApplication::translate("ChatGui", text); }
@@ -202,6 +202,23 @@ static void drawCameraGlyph(QPainter* p, const QRectF& r, bool off) {
p->restore();
}
static void drawSettingsGlyph(QPainter* p, const QRectF& r) {
const qreal s = r.width();
p->save(); p->translate(r.center());
p->setPen(Qt::NoPen); p->setBrush(Qt::white);
for (int tooth = 0; tooth < 8; ++tooth) {
p->save(); p->rotate(tooth * 45.0);
p->drawRoundedRect(QRectF(-s * 0.10, -s * 0.47, s * 0.20, s * 0.22), s * 0.03, s * 0.03);
p->restore();
}
QPainterPath ring;
ring.setFillRule(Qt::OddEvenFill);
ring.addEllipse(QRectF(-s * 0.34, -s * 0.34, s * 0.68, s * 0.68));
ring.addEllipse(QRectF(-s * 0.14, -s * 0.14, s * 0.28, s * 0.28));
p->drawPath(ring);
p->restore();
}
static QIcon makeRoundIcon(const QColor& bg, Glyph glyph, int size) {
QPixmap pm(size, size);
pm.fill(Qt::transparent);
@@ -218,6 +235,7 @@ static QIcon makeRoundIcon(const QColor& bg, Glyph glyph, int size) {
case Glyph::MicOff: drawMicGlyph(&p, glyphRect, true); break;
case Glyph::Camera: drawCameraGlyph(&p, glyphRect, false); break;
case Glyph::CameraOff: drawCameraGlyph(&p, glyphRect, true); break;
case Glyph::Settings: drawSettingsGlyph(&p, glyphRect); break;
}
p.end();
return QIcon(pm);
@@ -345,12 +363,16 @@ CallWindow::CallWindow(QWidget* parent)
auto* actions = new QHBoxLayout();
m_videoEnabled = makeRoundBtn(makeRoundIcon(QColor("#7f8c8d"), Glyph::CameraOff, 96), callText("Turn video on"), this);
m_videoEnabled->setCheckable(true); m_videoEnabled->setAccessibleName(callText("Turn video on"));
actions->addWidget(m_videoEnabled);
actions->addStretch(1);
m_settingsBtn = new QPushButton(callText("Video settings"), this); m_settingsBtn->setCheckable(true); actions->addWidget(m_settingsBtn);
m_settingsBtn = makeRoundBtn(makeRoundIcon(QColor("#7f8c8d"), Glyph::Settings, 96), callText("Video settings"), this);
m_settingsBtn->setCheckable(true); m_settingsBtn->setAccessibleName(callText("Video settings")); actions->addWidget(m_settingsBtn);
m_showVideoBtn = new QPushButton(callText("Show video"), this); actions->addWidget(m_showVideoBtn);
lay->addLayout(actions);
connect(m_settingsBtn, &QPushButton::toggled, this, [this] { updateVideoPresentation(); });
connect(m_settingsBtn, &QPushButton::toggled, this, [this](bool checked) {
m_settingsBtn->setIcon(makeRoundIcon(checked ? QColor("#2980b9") : QColor("#7f8c8d"), Glyph::Settings, 96));
DEBUG_INFO(DEBUG_CATEGORY_CALL, "desktop video settings visible=%d", checked);
updateVideoPresentation();
});
connect(m_showVideoBtn, &QPushButton::clicked, this, [this] {
if (m_videoWindow->isMinimized()) m_videoWindow->showNormal(); else m_videoWindow->show();
m_videoWindow->raise(); m_videoWindow->activateWindow();
@@ -456,6 +478,7 @@ CallWindow::CallWindow(QWidget* parent)
m_declineCell = wrapWithCaption(m_declineBtn, QCoreApplication::translate("ChatGui", "Decline"));
m_hangupCell = wrapWithCaption(m_hangupBtn, QCoreApplication::translate("ChatGui", "End call"));
m_muteCell = wrapWithCaption(m_muteBtn, QCoreApplication::translate("ChatGui", "Mute"), &m_muteCaption);
m_videoCell = wrapWithCaption(m_videoEnabled, callText("Camera"));
QHBoxLayout* btn = new QHBoxLayout();
btn->setSpacing(10);
@@ -464,6 +487,7 @@ CallWindow::CallWindow(QWidget* parent)
btn->addWidget(m_declineCell);
btn->addWidget(m_hangupCell);
btn->addWidget(m_muteCell);
btn->addWidget(m_videoCell);
btn->addStretch(1);
lay->addLayout(btn);
videoLayout->addWidget(m_deviceCombo);
@@ -580,7 +604,7 @@ void CallWindow::updateVideoPresentation() {
m_localPreview->setVisible(active && !receiving && !m_localImage.isNull());
m_connectionLabel->setVisible(active); m_bgpPathLabel->setVisible(active && !m_bgpPathLabel->text().isEmpty());
m_statsLabel->setVisible(active && !m_statsLabel->text().isEmpty());
m_videoEnabled->setVisible(active); m_settingsBtn->setVisible(active);
m_videoCell->setVisible(active); m_settingsBtn->setVisible(active);
m_videoControls->setVisible(settings); m_showVideoBtn->setVisible(receiving);
m_videoStatus->setVisible(active && !m_videoStatus->text().isEmpty());
QSize panelMinimum = m_panel->minimumSizeHint();
+1
View File
@@ -96,5 +96,6 @@ private:
QWidget* m_declineCell; // Кнопка Decline и подпись.
QWidget* m_hangupCell; // Кнопка Hangup и подпись.
QWidget* m_muteCell; // Кнопка mute и подпись.
QWidget* m_videoCell; // Кнопка камеры и подпись справа от mute в общей центрированной строке.
QLabel* m_muteCaption; // Меняется между Mute/Unmute.
};