Place camera thumbnail inside remote picture and document call layout
This commit is contained in:
1 parent
87a2075dec
commit
a0db643acb
2 files changed
+15
-3
No files matched your search
@@ -197,6 +197,7 @@ CallWindow::CallWindow(QWidget* parent)
|
||||
m_panel = new QWidget(this); m_panel->setObjectName("callPanel"); m_panel->setMaximumWidth(640);
|
||||
m_panel->setStyleSheet("QWidget#callPanel { background: palette(window); border-radius: 12px; }");
|
||||
root->addWidget(m_panel, 0, Qt::AlignHCenter | Qt::AlignBottom);
|
||||
root->addStretch(1);
|
||||
QVBoxLayout* lay = new QVBoxLayout(m_panel);
|
||||
lay->setContentsMargins(16, 20, 16, 16);
|
||||
lay->setSpacing(8);
|
||||
@@ -400,6 +401,7 @@ void CallWindow::updateVideoPresentation() {
|
||||
} else leaveFullScreen();
|
||||
}
|
||||
bool active = m_state == Active, settings = active && m_settingsBtn->isChecked();
|
||||
static_cast<QVBoxLayout*>(layout())->setStretch(2, receiving ? 0 : 1);
|
||||
m_localPreview->setVisible(active && !receiving && !m_localImage.isNull());
|
||||
m_avatarLabel->setVisible(!receiving); m_statusLabel->setVisible(!receiving);
|
||||
m_connectionLabel->setVisible(settings); m_bgpPathLabel->setVisible(settings && !m_bgpPathLabel->text().isEmpty());
|
||||
@@ -416,10 +418,11 @@ void CallWindow::paintEvent(QPaintEvent* event) {
|
||||
if (!m_receivingVideo) return;
|
||||
QPainter painter(this); painter.fillRect(rect(), Qt::black); painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
QSize remote = m_remoteImage.size().scaled(size(), Qt::KeepAspectRatio);
|
||||
painter.drawImage(QRect(QPoint((width() - remote.width()) / 2, (height() - remote.height()) / 2), remote), m_remoteImage);
|
||||
QRect videoRect(QPoint((width() - remote.width()) / 2, (height() - remote.height()) / 2), remote);
|
||||
painter.drawImage(videoRect, m_remoteImage);
|
||||
if (!m_localImage.isNull()) {
|
||||
QSize preview = m_localImage.size().scaled(qMin(240, width() / 4), qMin(180, height() / 4), Qt::KeepAspectRatio);
|
||||
QRect target(QPoint(width() - preview.width() - 20, 20), preview);
|
||||
QSize preview = m_localImage.size().scaled(qMin(240, remote.width() / 4), qMin(180, remote.height() / 4), Qt::KeepAspectRatio);
|
||||
QRect target(QPoint(videoRect.right() - preview.width() - 20, videoRect.top() + 20), preview);
|
||||
painter.setPen(QPen(Qt::white, 2)); painter.drawRect(target.adjusted(-1, -1, 1, 1));
|
||||
painter.drawImage(target, m_localImage);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user