mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #5920
Mick Sayson (2): fix(groups): Avoid segfault when resizing group audio window fix(groups): Correct color of labels in group call
This commit is contained in:
commit
22787a7f3c
|
@ -37,7 +37,7 @@
|
||||||
class LabeledVideo : public QFrame
|
class LabeledVideo : public QFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LabeledVideo(const QPixmap& avatar, QWidget* parent = nullptr, bool expanding = true)
|
LabeledVideo(const QPixmap& avatar, QString fontColorString, QWidget* parent = nullptr, bool expanding = true)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
qDebug() << "Created expanding? " << expanding;
|
qDebug() << "Created expanding? " << expanding;
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
connect(videoSurface, &VideoSurface::ratioChanged, this, &LabeledVideo::updateSize);
|
connect(videoSurface, &VideoSurface::ratioChanged, this, &LabeledVideo::updateSize);
|
||||||
label = new CroppingLabel(this);
|
label = new CroppingLabel(this);
|
||||||
label->setTextFormat(Qt::PlainText);
|
label->setTextFormat(Qt::PlainText);
|
||||||
label->setStyleSheet("color: white");
|
label->setStyleSheet(QString("color: %1").arg(fontColorString));
|
||||||
|
|
||||||
label->setAlignment(Qt::AlignCenter);
|
label->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ GroupNetCamView::GroupNetCamView(int group, QWidget* parent)
|
||||||
: GenericNetCamView(parent)
|
: GenericNetCamView(parent)
|
||||||
, group(group)
|
, group(group)
|
||||||
{
|
{
|
||||||
videoLabelSurface = new LabeledVideo(QPixmap(), this, false);
|
videoLabelSurface = new LabeledVideo(QPixmap(), "white", this, false);
|
||||||
videoSurface = videoLabelSurface->getVideoSurface();
|
videoSurface = videoLabelSurface->getVideoSurface();
|
||||||
videoSurface->setMinimumHeight(256);
|
videoSurface->setMinimumHeight(256);
|
||||||
videoSurface->setContentsMargins(6, 6, 6, 0);
|
videoSurface->setContentsMargins(6, 6, 6, 0);
|
||||||
|
@ -128,13 +128,18 @@ GroupNetCamView::GroupNetCamView(int group, QWidget* parent)
|
||||||
|
|
||||||
QScrollArea* scrollArea = new QScrollArea();
|
QScrollArea* scrollArea = new QScrollArea();
|
||||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
// Note this is needed to prevent oscillations that result in segfaults
|
||||||
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
scrollArea->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||||
|
|
||||||
scrollArea->setFrameStyle(QFrame::NoFrame);
|
scrollArea->setFrameStyle(QFrame::NoFrame);
|
||||||
QWidget* widget = new QWidget(nullptr);
|
QWidget* widget = new QWidget(nullptr);
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
horLayout = new QHBoxLayout(widget);
|
horLayout = new QHBoxLayout(widget);
|
||||||
horLayout->addStretch(1);
|
horLayout->addStretch(1);
|
||||||
|
|
||||||
selfVideoSurface = new LabeledVideo(Nexus::getProfile()->loadAvatar(), this);
|
selfVideoSurface = new LabeledVideo(Nexus::getProfile()->loadAvatar(), "black", this);
|
||||||
horLayout->addWidget(selfVideoSurface);
|
horLayout->addWidget(selfVideoSurface);
|
||||||
|
|
||||||
horLayout->addStretch(1);
|
horLayout->addStretch(1);
|
||||||
|
@ -171,7 +176,7 @@ void GroupNetCamView::clearPeers()
|
||||||
void GroupNetCamView::addPeer(const ToxPk& peer, const QString& name)
|
void GroupNetCamView::addPeer(const ToxPk& peer, const QString& name)
|
||||||
{
|
{
|
||||||
QPixmap groupAvatar = Nexus::getProfile()->loadAvatar(peer);
|
QPixmap groupAvatar = Nexus::getProfile()->loadAvatar(peer);
|
||||||
LabeledVideo* labeledVideo = new LabeledVideo(groupAvatar, this);
|
LabeledVideo* labeledVideo = new LabeledVideo(groupAvatar, "black", this);
|
||||||
labeledVideo->setText(name);
|
labeledVideo->setText(name);
|
||||||
horLayout->insertWidget(horLayout->count() - 1, labeledVideo);
|
horLayout->insertWidget(horLayout->count() - 1, labeledVideo);
|
||||||
PeerVideo peerVideo;
|
PeerVideo peerVideo;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user