From 7a206441c86cd2aa84cbbbc6be803f03b2f355ab Mon Sep 17 00:00:00 2001 From: trilene Date: Fri, 10 Jul 2020 19:19:48 -0400 Subject: Support voice calls --- src/dialogs/PlaceCall.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/dialogs/PlaceCall.cpp (limited to 'src/dialogs/PlaceCall.cpp') diff --git a/src/dialogs/PlaceCall.cpp b/src/dialogs/PlaceCall.cpp new file mode 100644 index 00000000..8b37ff6a --- /dev/null +++ b/src/dialogs/PlaceCall.cpp @@ -0,0 +1,60 @@ +#include +#include +#include +#include + +#include "Config.h" +#include "dialogs/PlaceCall.h" + +namespace dialogs { + +PlaceCall::PlaceCall(const QString &callee, const QString &displayName, QWidget *parent) + : QWidget(parent) +{ + setAutoFillBackground(true); + setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); + setWindowModality(Qt::WindowModal); + setAttribute(Qt::WA_DeleteOnClose, true); + + 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); + + voiceBtn_ = new QPushButton(tr("Voice Call"), this); + voiceBtn_->setDefault(true); + videoBtn_ = new QPushButton(tr("Video Call"), this); + cancelBtn_ = new QPushButton(tr("Cancel"), this); + + buttonLayout->addStretch(1); + buttonLayout->addWidget(voiceBtn_); + 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); + + layout->addWidget(label); + layout->addLayout(buttonLayout); + + connect(voiceBtn_, &QPushButton::clicked, this, [this]() { + emit voice(); + emit close(); + }); + connect(videoBtn_, &QPushButton::clicked, this, [this]() { + emit video(); + emit close(); + }); + connect(cancelBtn_, &QPushButton::clicked, this, [this]() { + emit cancel(); + emit close(); + }); +} + +} -- cgit 1.5.1