Polish voice call UI
This commit is contained in:
parent
da9995fc3d
commit
88cfa3a8fa
18 changed files with 348 additions and 146 deletions
|
|
@ -1,43 +1,83 @@
|
|||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Utils.h"
|
||||
#include "dialogs/AcceptCall.h"
|
||||
#include "ui/Avatar.h"
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
AcceptCall::AcceptCall(const QString &caller, const QString &displayName, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
AcceptCall::AcceptCall(
|
||||
const QString &caller,
|
||||
const QString &displayName,
|
||||
const QString &roomName,
|
||||
const QString &avatarUrl,
|
||||
QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setAutoFillBackground(true);
|
||||
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||
setWindowModality(Qt::WindowModal);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(conf::modals::WIDGET_SPACING);
|
||||
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
||||
|
||||
auto buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->setSpacing(15);
|
||||
buttonLayout->setMargin(0);
|
||||
QFont f;
|
||||
f.setPointSizeF(f.pointSizeF());
|
||||
|
||||
QFont labelFont;
|
||||
labelFont.setWeight(QFont::Medium);
|
||||
|
||||
QLabel *displayNameLabel = nullptr;
|
||||
if (!displayName.isEmpty() && displayName != caller) {
|
||||
displayNameLabel = new QLabel(displayName, this);
|
||||
labelFont.setPointSizeF(f.pointSizeF() * 2);
|
||||
displayNameLabel ->setFont(labelFont);
|
||||
displayNameLabel ->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
|
||||
QLabel *callerLabel = new QLabel(caller, this);
|
||||
labelFont.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
callerLabel->setFont(labelFont);
|
||||
callerLabel->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QLabel *voiceCallLabel = new QLabel("Voice Call", this);
|
||||
labelFont.setPointSizeF(f.pointSizeF() * 1.1);
|
||||
voiceCallLabel->setFont(labelFont);
|
||||
voiceCallLabel->setAlignment(Qt::AlignCenter);
|
||||
|
||||
auto avatar = new Avatar(this, QFontMetrics(f).height() * 6);
|
||||
if (!avatarUrl.isEmpty())
|
||||
avatar->setImage(avatarUrl);
|
||||
else
|
||||
avatar->setLetter(utils::firstChar(roomName));
|
||||
|
||||
const int iconSize = 24;
|
||||
auto buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->setSpacing(20);
|
||||
acceptBtn_ = new QPushButton(tr("Accept"), this);
|
||||
acceptBtn_->setDefault(true);
|
||||
rejectBtn_ = new QPushButton(tr("Reject"), this);
|
||||
acceptBtn_->setIcon(QIcon(":/icons/icons/ui/place-call.png"));
|
||||
acceptBtn_->setIconSize(QSize(iconSize, iconSize));
|
||||
|
||||
buttonLayout->addStretch(1);
|
||||
rejectBtn_ = new QPushButton(tr("Reject"), this);
|
||||
rejectBtn_->setIcon(QIcon(":/icons/icons/ui/end-call.png"));
|
||||
rejectBtn_->setIconSize(QSize(iconSize, iconSize));
|
||||
buttonLayout->addWidget(acceptBtn_);
|
||||
buttonLayout->addWidget(rejectBtn_);
|
||||
|
||||
QLabel *label;
|
||||
if (!displayName.isEmpty() && displayName != caller)
|
||||
label = new QLabel("Accept call from " + displayName + " (" + caller + ")?", this);
|
||||
else
|
||||
label = new QLabel("Accept call from " + caller + "?", this);
|
||||
|
||||
layout->addWidget(label);
|
||||
if (displayNameLabel)
|
||||
layout->addWidget(displayNameLabel, 0, Qt::AlignCenter);
|
||||
layout->addWidget(callerLabel, 0, Qt::AlignCenter);
|
||||
layout->addWidget(voiceCallLabel, 0, Qt::AlignCenter);
|
||||
layout->addWidget(avatar, 0, Qt::AlignCenter);
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(acceptBtn_, &QPushButton::clicked, this, [this]() {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
class QPushButton;
|
||||
class QString;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
|
|
@ -12,7 +12,12 @@ class AcceptCall : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AcceptCall(const QString &caller, const QString &displayName, QWidget *parent = nullptr);
|
||||
AcceptCall(
|
||||
const QString &caller,
|
||||
const QString &displayName,
|
||||
const QString &roomName,
|
||||
const QString &avatarUrl,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void accept();
|
||||
|
|
|
|||
|
|
@ -4,12 +4,18 @@
|
|||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Utils.h"
|
||||
#include "dialogs/PlaceCall.h"
|
||||
#include "ui/Avatar.h"
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
PlaceCall::PlaceCall(const QString &callee, const QString &displayName, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
PlaceCall::PlaceCall(
|
||||
const QString &callee,
|
||||
const QString &displayName,
|
||||
const QString &roomName,
|
||||
const QString &avatarUrl,
|
||||
QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setAutoFillBackground(true);
|
||||
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||
|
|
@ -20,25 +26,31 @@ PlaceCall::PlaceCall(const QString &callee, const QString &displayName, QWidget
|
|||
layout->setSpacing(conf::modals::WIDGET_SPACING);
|
||||
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
||||
|
||||
auto buttonLayout = new QHBoxLayout();
|
||||
auto buttonLayout = new QHBoxLayout(this);
|
||||
buttonLayout->setSpacing(15);
|
||||
buttonLayout->setMargin(0);
|
||||
|
||||
QFont f;
|
||||
f.setPointSizeF(f.pointSizeF());
|
||||
auto avatar = new Avatar(this, QFontMetrics(f).height() * 3);
|
||||
if (!avatarUrl.isEmpty())
|
||||
avatar->setImage(avatarUrl);
|
||||
else
|
||||
avatar->setLetter(utils::firstChar(roomName));
|
||||
|
||||
voiceBtn_ = new QPushButton(tr("Voice Call"), this);
|
||||
voiceBtn_->setDefault(true);
|
||||
videoBtn_ = new QPushButton(tr("Video Call"), this);
|
||||
//videoBtn_ = new QPushButton(tr("Video Call"), this);
|
||||
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||
|
||||
buttonLayout->addStretch(1);
|
||||
buttonLayout->addWidget(avatar);
|
||||
buttonLayout->addWidget(voiceBtn_);
|
||||
buttonLayout->addWidget(videoBtn_);
|
||||
//buttonLayout->addWidget(videoBtn_);
|
||||
buttonLayout->addWidget(cancelBtn_);
|
||||
|
||||
QLabel *label;
|
||||
if (!displayName.isEmpty() && displayName != callee)
|
||||
label = new QLabel("Place a call to " + displayName + " (" + callee + ")?", this);
|
||||
else
|
||||
label = new QLabel("Place a call to " + callee + "?", this);
|
||||
QString name = displayName.isEmpty() ? callee : displayName;
|
||||
QLabel *label = new QLabel("Place a call to " + name + "?", this);
|
||||
|
||||
layout->addWidget(label);
|
||||
layout->addLayout(buttonLayout);
|
||||
|
|
@ -47,10 +59,10 @@ PlaceCall::PlaceCall(const QString &callee, const QString &displayName, QWidget
|
|||
emit voice();
|
||||
emit close();
|
||||
});
|
||||
connect(videoBtn_, &QPushButton::clicked, this, [this]() {
|
||||
/*connect(videoBtn_, &QPushButton::clicked, this, [this]() {
|
||||
emit video();
|
||||
emit close();
|
||||
});
|
||||
});*/
|
||||
connect(cancelBtn_, &QPushButton::clicked, this, [this]() {
|
||||
emit cancel();
|
||||
emit close();
|
||||
|
|
|
|||
|
|
@ -12,16 +12,21 @@ class PlaceCall : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PlaceCall(const QString &callee, const QString &displayName, QWidget *parent = nullptr);
|
||||
PlaceCall(
|
||||
const QString &callee,
|
||||
const QString &displayName,
|
||||
const QString &roomName,
|
||||
const QString &avatarUrl,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void voice();
|
||||
void video();
|
||||
// void video();
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
QPushButton *voiceBtn_;
|
||||
QPushButton *videoBtn_;
|
||||
// QPushButton *videoBtn_;
|
||||
QPushButton *cancelBtn_;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue