diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp
index 91846230..0a88c230 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);
@@ -654,3 +669,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));
+}
|