Commit 0b7fe5dc authored by Edric Milaret's avatar Edric Milaret Committed by Stepan Salenikovich

video: don't show the preview maximized during calls

Add option whether or not the preview should be maximized when it is the
only video. Set the default to false so that it is not maximized during
calls when the the peer has no video or it has not started yet.

Change-Id: I14a95c7b4b9f418a62f0bf65f1b1fb66e4cf1730
Tuleap: #279
parent 9c3e7f78
......@@ -86,6 +86,8 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
}
}
});
ui->videoView->setIsFullPreview(true);
#ifndef ENABLE_AUTOUPDATE
ui->checkUpdateButton->hide();
ui->intervalUpdateCheckSpinBox->hide();
......
......@@ -23,6 +23,7 @@ VideoWidget::VideoWidget(QWidget* parent) :
, previewRenderer_(nullptr)
, renderer_(nullptr)
, isPreviewDisplayed_(true)
, fullPreview_(false)
{
connect(&Video::PreviewManager::instance(),
SIGNAL(previewStarted(Video::Renderer*)),
......@@ -113,13 +114,13 @@ VideoWidget::paintEvent(QPaintEvent* evt) {
}
}
if (previewImage_) {
auto previewHeight = !renderer_ ? height() : height()/4;
auto previewWidth = !renderer_ ? width() : width()/4;
auto previewHeight = fullPreview_ ? height() : height()/4;
auto previewWidth = fullPreview_ ? width() : width()/4;
auto scaledPreview = previewImage_->scaled(previewWidth, previewHeight, Qt::KeepAspectRatio);
auto xDiff = (previewWidth - scaledPreview.width()) / 2;
auto yDiff = (previewHeight - scaledPreview.height()) / 2;
auto yPos = !renderer_ ? yDiff : height() - previewHeight - previewMargin_;
auto xPos = !renderer_ ? xDiff : width() - scaledPreview.width() - previewMargin_;
auto yPos = fullPreview_ ? yDiff : height() - previewHeight - previewMargin_;
auto xPos = fullPreview_ ? xDiff : width() - scaledPreview.width() - previewMargin_;
painter.drawImage(QRect(xPos,yPos,scaledPreview.width(),scaledPreview.height()),
scaledPreview);
}
......@@ -165,3 +166,8 @@ void
VideoWidget::setPreviewDisplay(bool display) {
isPreviewDisplayed_ = display;
}
void
VideoWidget::setIsFullPreview(bool full) {
fullPreview_ = full;
}
......@@ -36,6 +36,7 @@ public:
void paintEvent(QPaintEvent* evt);
void setPreviewDisplay(bool display);
void setDistantRenderer(Video::Renderer* renderer);
void setIsFullPreview(bool full);
public slots:
void previewStarted(Video::Renderer* renderer);
......@@ -55,6 +56,7 @@ private:
std::vector<uint8_t> frameDistant_;
std::vector<uint8_t> framePreview_;
bool isPreviewDisplayed_;
bool fullPreview_;
constexpr static int previewMargin_ = 15;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment