summary refs log tree commit diff
path: root/src/TextInputWidget.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-08-17 20:40:33 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-08-17 20:40:33 +0200
commitde7ec4d2b38888ee88d0a45b05d5a4a7cc730a4d (patch)
tree7d65f5bcbe6996c24f0f5103160e0d4d23bb0983 /src/TextInputWidget.cpp
parentAdd /clear-timeline command (diff)
parentMerge pull request #237 from trilene/voip (diff)
downloadnheko-de7ec4d2b38888ee88d0a45b05d5a4a7cc730a4d.tar.xz
Merge remote-tracking branch 'origin/master' into new-event-store
Conflicts:
	CMakeLists.txt
	io.github.NhekoReborn.Nheko.json
	src/Cache.cpp
	src/timeline/TimelineModel.cpp
	src/timeline/TimelineModel.h
	src/timeline/TimelineViewManager.cpp
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 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)); +}