summary refs log tree commit diff
path: root/src/TextInputWidget.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-08-14 07:59:39 +0000
committerGitHub <noreply@github.com>2020-08-14 07:59:39 +0000
commit3fece53eb7bc38a338ac85faa58638c251d3cda7 (patch)
tree4e8c69ff9cccf376185f3a430ef1b07c06c288f4 /src/TextInputWidget.cpp
parentAdded translation using Weblate (Sinhala) (diff)
parentAppease the linter (diff)
downloadnheko-3fece53eb7bc38a338ac85faa58638c251d3cda7.tar.xz
Merge pull request #237 from trilene/voip
Support voice calls
Diffstat (limited to 'src/TextInputWidget.cpp')
-rw-r--r--src/TextInputWidget.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp

index 3e3915bb..a3392170 100644 --- a/src/TextInputWidget.cpp +++ b/src/TextInputWidget.cpp
@@ -453,6 +453,15 @@ TextInputWidget::TextInputWidget(QWidget *parent) topLayout_->setSpacing(0); topLayout_->setContentsMargins(13, 1, 13, 0); +#ifdef GSTREAMER_AVAILABLE + callBtn_ = new FlatButton(this); + changeCallButtonState(WebRTCSession::State::DISCONNECTED); + connect(&WebRTCSession::instance(), + &WebRTCSession::stateChanged, + this, + &TextInputWidget::changeCallButtonState); +#endif + QIcon send_file_icon; send_file_icon.addFile(":/icons/icons/ui/paper-clip-outline.png"); @@ -521,6 +530,9 @@ TextInputWidget::TextInputWidget(QWidget *parent) emojiBtn_->setIcon(emoji_icon); emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight)); +#ifdef GSTREAMER_AVAILABLE + topLayout_->addWidget(callBtn_); +#endif topLayout_->addWidget(sendFileBtn_); topLayout_->addWidget(input_); topLayout_->addWidget(emojiBtn_); @@ -528,6 +540,9 @@ TextInputWidget::TextInputWidget(QWidget *parent) setLayout(topLayout_); +#ifdef GSTREAMER_AVAILABLE + connect(callBtn_, &FlatButton::clicked, this, &TextInputWidget::callButtonPress); +#endif connect(sendMessageBtn_, &FlatButton::clicked, input_, &FilteredTextEdit::submit); connect(sendFileBtn_, SIGNAL(clicked()), this, SLOT(openFileSelection())); connect(input_, &FilteredTextEdit::message, this, &TextInputWidget::sendTextMessage); @@ -652,3 +667,19 @@ TextInputWidget::paintEvent(QPaintEvent *) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } + +void +TextInputWidget::changeCallButtonState(WebRTCSession::State state) +{ + QIcon icon; + if (state == WebRTCSession::State::ICEFAILED || + state == WebRTCSession::State::DISCONNECTED) { + callBtn_->setToolTip(tr("Place a call")); + icon.addFile(":/icons/icons/ui/place-call.png"); + } else { + callBtn_->setToolTip(tr("Hang up")); + icon.addFile(":/icons/icons/ui/end-call.png"); + } + callBtn_->setIcon(icon); + callBtn_->setIconSize(QSize(ButtonHeight * 1.1, ButtonHeight * 1.1)); +}