diff --git a/callaudioonlyavataroverlay.cpp b/callaudioonlyavataroverlay.cpp new file mode 100644 index 0000000000000000000000000000000000000000..453039a4d6cf4b57a4cfc94367f1c878c3881b14 --- /dev/null +++ b/callaudioonlyavataroverlay.cpp @@ -0,0 +1,64 @@ +/************************************************************************** +* Copyright (C) 2015-2019 by Savoir-faire Linux * +* Author: Yang Wang <yang.wang@savoirfairelinux.com> * +* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 3 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see <http://www.gnu.org/licenses/>. * +**************************************************************************/ +// directly related to this file +#include "callaudioonlyavataroverlay.h" +#include "ui_callaudioonlyavataroverlay.h" + +CallAudioOnlyAvatarOverlay::CallAudioOnlyAvatarOverlay(QWidget *parent) : + QWidget(parent), + ui(new Ui::CallAudioOnlyAvatarOverlay) +{ + ui->setupUi(this); +} + +CallAudioOnlyAvatarOverlay::~CallAudioOnlyAvatarOverlay() +{ + delete ui; +} + +void +CallAudioOnlyAvatarOverlay::setAvatarVisible(bool visible) +{ + this->setVisible(visible); + ui->avatarLabel->setVisible(visible); + ui->nameLabel->setVisible(visible); +} + +void +CallAudioOnlyAvatarOverlay::writeAvatarOverlay(const std::string& accountId, const lrc::api::conversation::Info& convInfo) +{ + Q_UNUSED(accountId); + + auto contact = LRCInstance::getCurrentAccountInfo().contactModel->getContact(convInfo.participants.at(0)); + ui->avatarLabel->setPixmap(QPixmap::fromImage(Utils::conversationPhoto(convInfo.uid, LRCInstance::getCurrentAccountInfo()))); + + if (contact.profileInfo.type == lrc::api::profile::Type::SIP) { + ui->nameLabel->setText(QString::fromStdString(contact.profileInfo.uri)); + } else { + std::string name = contact.profileInfo.alias; + std::string id = contact.registeredName; + ui->nameLabel->setText(QString::fromStdString(name + "\n" + id)); + } +} + +void +CallAudioOnlyAvatarOverlay::respondToPauseLabel(bool pauseButtonDisplayed) +{ + setAvatarVisible(!pauseButtonDisplayed); +} diff --git a/callaudioonlyavataroverlay.h b/callaudioonlyavataroverlay.h new file mode 100644 index 0000000000000000000000000000000000000000..88511db94f52c26f0dac2179cef449cad63fb0bc --- /dev/null +++ b/callaudioonlyavataroverlay.h @@ -0,0 +1,45 @@ +/************************************************************************** +* Copyright (C) 2015-2019 by Savoir-faire Linux * +* Author: Yang Wang <yang.wang@savoirfairelinux.com> * +* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 3 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see <http://www.gnu.org/licenses/>. * +**************************************************************************/ +#pragma once + +// qt +#include <QWidget> + +// project +#include "lrcinstance.h" +#include "utils.h" + +namespace Ui { +class CallAudioOnlyAvatarOverlay; +} + +class CallAudioOnlyAvatarOverlay : public QWidget +{ + Q_OBJECT + +public: + explicit CallAudioOnlyAvatarOverlay(QWidget *parent = nullptr); + ~CallAudioOnlyAvatarOverlay(); + void setAvatarVisible(bool visible); + void writeAvatarOverlay(const std::string& accountId, const lrc::api::conversation::Info& convInfo); + void respondToPauseLabel(bool pauseButtonDisplayed); + +private: + Ui::CallAudioOnlyAvatarOverlay *ui; +}; diff --git a/callaudioonlyavataroverlay.ui b/callaudioonlyavataroverlay.ui new file mode 100644 index 0000000000000000000000000000000000000000..aa53b681ddfa663b49aaa366fd9085efcd27f6dc --- /dev/null +++ b/callaudioonlyavataroverlay.ui @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CallAudioOnlyAvatarOverlay</class> + <widget class="QWidget" name="CallAudioOnlyAvatarOverlay"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1821</width> + <height>1231</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item alignment="Qt::AlignHCenter|Qt::AlignBottom"> + <widget class="QLabel" name="avatarLabel"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ressources.qrc">:/images/jami.ico</pixmap> + </property> + </widget> + </item> + <item alignment="Qt::AlignHCenter|Qt::AlignTop"> + <widget class="QLabel" name="nameLabel"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <resources> + <include location="ressources.qrc"/> + </resources> + <connections/> +</ui> diff --git a/callwidget.cpp b/callwidget.cpp index bc41a63594ba4398f263b04fb8a6c8090e074de9..c3ab92c9539ed0b9de3bb74e9d1b8e60c474089b 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -653,12 +653,19 @@ void CallWidget::slotShowCallView(const std::string& accountId, if (callModel->hasCall(convInfo.callId)) { auto call = callModel->getCall(convInfo.callId); - ui->videoWidget->resetVideoOverlay(call.audioMuted && (call.status != lrc::api::call::Status::PAUSED), - call.videoMuted && (call.status != lrc::api::call::Status::PAUSED) && (!call.isAudioOnly), - callModel->isRecording(convInfo.callId), - call.status == lrc::api::call::Status::PAUSED); + bool isAudioMuted = call.audioMuted && (call.status != lrc::api::call::Status::PAUSED); + bool isVideoMuted = call.videoMuted && (call.status != lrc::api::call::Status::PAUSED) && (!call.isAudioOnly); + bool isRecording = callModel->isRecording(convInfo.callId); + bool isPaused = call.status == lrc::api::call::Status::PAUSED; + ui->videoWidget->resetVideoOverlay(isAudioMuted, + isVideoMuted, + isRecording, + isPaused, + call.isAudioOnly && call.status != lrc::api::call::Status::PAUSED, + accountId, + convInfo); } else { - ui->videoWidget->resetVideoOverlay(false, false, false, false); + ui->videoWidget->resetVideoOverlay(false, false, false, false, false, accountId, convInfo); } ui->callStackWidget->setCurrentWidget(ui->videoPage); hideMiniSpinner(); diff --git a/jami-qt.pro b/jami-qt.pro index 2cecddcf194e5c354a388862a46fa2e95ad51733..6a38c5becb7404c0385baebd724de63862554cce 100644 --- a/jami-qt.pro +++ b/jami-qt.pro @@ -71,7 +71,8 @@ HEADERS += ./aboutdialog.h \ ./pixbufmanipulator.h \ ./settingswidget.h \ ./updatedownloaddialog.h \ - ./sipinputpanel.h + ./sipinputpanel.h \ + ./callaudioonlyavataroverlay.h SOURCES += ./aboutdialog.cpp \ ./banneditemwidget.cpp \ ./conversationsfilterwidget.cpp \ @@ -124,7 +125,8 @@ SOURCES += ./aboutdialog.cpp \ ./pixbufmanipulator.cpp \ ./smartlistselectorbuttonnotifier.cpp \ ./videooverlay.cpp \ - ./sipinputpanel.cpp + ./sipinputpanel.cpp \ + ./callaudioonlyavataroverlay.cpp FORMS += ./aboutdialog.ui \ ./advancedsipsettingwidget.ui \ ./callwidget.ui \ @@ -148,5 +150,6 @@ FORMS += ./aboutdialog.ui \ ./photoboothwidget.ui \ ./updateconfirmdialog.ui \ ./videoview.ui \ - ./sipkeypad.ui + ./sipkeypad.ui \ + ./callaudioonlyavataroverlay.ui RESOURCES += ressources.qrc diff --git a/ring-client-windows.vcxproj b/ring-client-windows.vcxproj index 38c2ee605e2e3d8d0d55c9fcac884a4d5637eaed..967d9cd510d20c8d721d6c84b9bec8428d0548a9 100644 --- a/ring-client-windows.vcxproj +++ b/ring-client-windows.vcxproj @@ -236,6 +236,7 @@ del /s /q $(OutDir)\Jami.exp</Command> <ClCompile Include="banneditemwidget.cpp" /> <ClCompile Include="bannedlistmodel.cpp" /> <ClCompile Include="animationhelpers.cpp" /> + <ClCompile Include="callaudioonlyavataroverlay.cpp" /> <ClCompile Include="contactpicker.cpp" /> <ClCompile Include="contactpickeritemdelegate.cpp" /> <ClCompile Include="currentaccountcombobox.cpp" /> @@ -453,6 +454,10 @@ del /s /q $(OutDir)\Jami.exp</Command> <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath> <IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath> </QtMoc> + <QtMoc Include="callaudioonlyavataroverlay.h"> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath> + </QtMoc> <ClInclude Include="pixbufmanipulator.h" /> <QtMoc Include="ringbutton.h"> </QtMoc> @@ -634,6 +639,7 @@ del /s /q $(OutDir)\Jami.exp</Command> <SubType>Designer</SubType> </QtUic> <QtUic Include="banneditemwidget.ui" /> + <QtUic Include="callaudioonlyavataroverlay.ui" /> <QtUic Include="callwidget.ui"> <SubType>Designer</SubType> </QtUic> @@ -734,4 +740,4 @@ del /s /q $(OutDir)\Jami.exp</Command> <UserProperties UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" Qt5Version_x0020_x64="$(DefaultQtVersion)" /> </VisualStudio> </ProjectExtensions> -</Project> \ No newline at end of file +</Project> diff --git a/ring-client-windows.vcxproj.filters b/ring-client-windows.vcxproj.filters index 3ecf3139ed8b92152e1cc41ec80b04ac54d01319..0904a63cdcc1d3b3a4e82e03e99f10e5ced4a6b8 100644 --- a/ring-client-windows.vcxproj.filters +++ b/ring-client-windows.vcxproj.filters @@ -219,6 +219,9 @@ <ClCompile Include="levelmeter.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="callaudioonlyavataroverlay.cpp"> + <Filter>Source Files</Filter> + </ClCompile> <ClCompile Include="sipinputpanel.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -380,6 +383,9 @@ <QtMoc Include="levelmeter.h"> <Filter>Header Files</Filter> </QtMoc> + <QtMoc Include="callaudioonlyavataroverlay.h"> + <Filter>Header Files</Filter> + </QtMoc> <QtMoc Include="splashscreen.h"> <Filter>Generated Files</Filter> </QtMoc> @@ -671,6 +677,9 @@ <QtUic Include="contactpicker.ui"> <Filter>Form Files</Filter> </QtUic> + <QtUic Include="callaudioonlyavataroverlay.ui"> + <Filter>Form Files</Filter> + </QtUic> <QtUic Include="sipkeypad.ui"> <Filter>Form Files</Filter> </QtUic> @@ -828,4 +837,4 @@ <Filter>Resource Files</Filter> </Image> </ItemGroup> -</Project> \ No newline at end of file +</Project> diff --git a/stylesheet.css b/stylesheet.css index 337360f4d240c62dabba7890578c17affc234523..0a939c2d8d1fa451f193d33b17c3f68f639e0445 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -210,10 +210,10 @@ QPushButton#sipInputPanelButton:checked { background-color: rgba(0, 192, 213, 0.8); } -QPushButton#hangupButton{ - background-color: rgba(200, 0, 0, 0.6); +QPushButton#hangupButton { + background-color: rgba(0, 0, 0, 140); border-radius: 18px; - border:solid 1px; + border: solid 1px; } QPushButton#hangupButton:hover{ @@ -788,4 +788,11 @@ QProgressBar#audioInputMeter { QProgressBar#audioInputMeter::chunk { background-color: #0c79aa; margin: 2px; - } \ No newline at end of file + } + +QLabel#nameLabel { + font-size: 20px; + font-style: initial; + qproperty-alignment: AlignCenter; + color: white; +} diff --git a/videooverlay.cpp b/videooverlay.cpp index eba851cb05deb7c80e7d171777035f4e850f4b26..dacb05b02c83c4846847c10455ba8fe3c95fe751 100644 --- a/videooverlay.cpp +++ b/videooverlay.cpp @@ -20,14 +20,15 @@ #include "videooverlay.h" #include "ui_videooverlay.h" -#include <QTime> -#include <QMouseEvent> - +#include "videoview.h" #include "lrcinstance.h" #include "contactpicker.h" #include "sipinputpanel.h" #include "utils.h" +#include <QTime> +#include <QMouseEvent> + VideoOverlay::VideoOverlay(QWidget* parent) : QWidget(parent), ui(new Ui::VideoOverlay), @@ -149,15 +150,17 @@ VideoOverlay::on_chatButton_toggled(bool checked) } void -VideoOverlay::on_holdButton_clicked() +VideoOverlay::on_holdButton_toggled(bool checked) { auto callModel = LRCInstance::getCurrentCallModel(); if (callModel->hasCall(callId_)) { callModel->togglePause(callId_); - auto onHold = callModel->getCall(callId_).status == lrc::api::call::Status::PAUSED; - ui->holdButton->setChecked(!onHold); - ui->onHoldLabel->setVisible(!onHold); + bool onHold = callModel->getCall(callId_).status == lrc::api::call::Status::PAUSED; } + //emit that the hold button status changed + emit HoldStatusChanged(checked); + ui->onHoldLabel->setVisible(checked); + } void @@ -265,8 +268,10 @@ VideoOverlay::setCurrentSelectedCalleeDisplayName(const QString& CalleeDisplayNa } void -VideoOverlay::resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding) +VideoOverlay::resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding, bool isAudioOnly) { + //Set irrelevant buttons invisible + ui->noVideoButton->setVisible(!isAudioOnly); // Block the signals of buttons Utils::whileBlocking(ui->noMicButton)->setChecked(isAudioMuted); Utils::whileBlocking(ui->noVideoButton)->setChecked(isVideoMuted); diff --git a/videooverlay.h b/videooverlay.h index 361239cbbbbab602b088bab5ee7ce3f7deb6b350..7ea62e549764e5689aee5c1bd3dcfc7bcdb0b569 100644 --- a/videooverlay.h +++ b/videooverlay.h @@ -48,14 +48,14 @@ public: bool getShowChatView(); void setTransferCallAndSIPPanelAvailability(bool visible); void setCurrentSelectedCalleeDisplayName(const QString& CalleeDisplayName); - void resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding); + void resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding, bool isAudioOnly); //UI SLOTS private slots: void setTime(); void on_hangupButton_clicked(); void on_chatButton_toggled(bool checked); - void on_holdButton_clicked(); + void on_holdButton_toggled(bool checked); void on_noMicButton_toggled(bool checked); void on_noVideoButton_toggled(bool checked); void on_recButton_clicked(); @@ -74,4 +74,6 @@ private: signals: void setChatVisibility(bool visible); + void HoldStatusChanged(bool pauseLabelStatus); + }; diff --git a/videoview.cpp b/videoview.cpp index 93ab645111a68dff7bb16392887071ce4a1ede73..23965dd1b01c37435a2fbd20394300aecf38567d 100644 --- a/videoview.cpp +++ b/videoview.cpp @@ -20,27 +20,27 @@ #include "videoview.h" #include "ui_videoview.h" -#include "utils.h" #include "lrcinstance.h" +#include "utils.h" -#include <QGraphicsOpacityEffect> -#include <QPropertyAnimation> #include <QDesktopWidget> -#include <QMenu> #include <QFileDialog> +#include <QGraphicsOpacityEffect> +#include <QMenu> #include <QMimeData> -#include <QSplitter> +#include <QPropertyAnimation> #include <QScreen> +#include <QSplitter> #include <QWindow> #include <memory> -#include "videooverlay.h" #include "selectareadialog.h" +#include "videooverlay.h" -VideoView::VideoView(QWidget* parent) : - QWidget(parent), - ui(new Ui::VideoView) +VideoView::VideoView(QWidget* parent) + : QWidget(parent) + , ui(new Ui::VideoView) { ui->setupUi(this); @@ -67,9 +67,9 @@ VideoView::VideoView(QWidget* parent) : this, SLOT(showContextMenu(const QPoint&))); connect(overlay_, &VideoOverlay::setChatVisibility, [=](bool visible) { emit this->setChatVisibility(visible); - connect(this, SIGNAL(toggleFullScreenClicked()), ui->videoWidget, SLOT(slotToggleFullScreenClicked())); + connect(this, SIGNAL(toggleFullScreenClicked()), ui->videoWidget, SLOT(slotToggleFullScreenClicked())); }); - + audioOnlyAvatar_ = new CallAudioOnlyAvatarOverlay(this); } VideoView::~VideoView() @@ -119,6 +119,8 @@ VideoView::resizeEvent(QResizeEvent* event) ui->videoWidget->resetPreview(); + audioOnlyAvatar_->resize(this->size()); + overlay_->resize(this->size()); overlay_->show(); overlay_->raise(); @@ -187,7 +189,8 @@ VideoView::simulateShowChatview(bool checked) } void -VideoView::mouseDoubleClickEvent(QMouseEvent* e) { +VideoView::mouseDoubleClickEvent(QMouseEvent* e) +{ QWidget::mouseDoubleClickEvent(e); toggleFullScreen(); } @@ -328,9 +331,7 @@ VideoView::showContextMenu(const QPoint& pos) // possibly select the alternative video sharing device switch (activeDevice.type) { case lrc::api::video::DeviceType::DISPLAY: - sharingEntireScreen_ ? - shareAction->setChecked(true) : - shareAreaAction->setChecked(true); + sharingEntireScreen_ ? shareAction->setChecked(true) : shareAreaAction->setChecked(true); break; case lrc::api::video::DeviceType::FILE: shareFileAction->setChecked(true); @@ -344,7 +345,8 @@ VideoView::showContextMenu(const QPoint& pos) } void -VideoView::pushRenderer(const std::string& callId, bool isSIP) { +VideoView::pushRenderer(const std::string& callId, bool isSIP) +{ currentCallId_ = callId; auto callModel = LRCInstance::getCurrentCallModel(); @@ -406,12 +408,12 @@ VideoView::mouseMoveEvent(QMouseEvent* event) fadeTimer_.start(startfadeOverlayTime_); } - QRect& previewRect = ui->videoWidget->getPreviewRect(); + QRect& previewRect = ui->videoWidget->getPreviewRect(); if (draggingPreview_) { if (previewRect.left() > 0 - && previewRect.top() > 0 - && previewRect.right() < width() - && previewRect.bottom() < height()) { + && previewRect.top() > 0 + && previewRect.right() < width() + && previewRect.bottom() < height()) { previewRect.moveTo(event->pos() - originMouseDisplacement_); if (previewRect.left() <= 0) @@ -431,9 +433,9 @@ VideoView::mouseMoveEvent(QMouseEvent* event) QLine distance = QLine(previewRect.topLeft(), event->pos()); if (resizingPreview_ - and distance.dx() > minimalSize_ - and distance.dy() > minimalSize_ - and geometry().contains(event->pos())) + and distance.dx() > minimalSize_ + and distance.dy() > minimalSize_ + and geometry().contains(event->pos())) previewRect.setBottomRight(event->pos()); } @@ -444,10 +446,38 @@ VideoView::setCurrentCalleeName(const QString& CalleeDisplayName) } void -VideoView::resetVideoOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding) +VideoView::resetVideoOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding, bool isAudioOnly, const std::string& accountId, const lrc::api::conversation::Info& convInfo) { + resetAvatarOverlay(isAudioOnly); + if (isAudioOnly) { + writeAvatarOverlay(accountId, convInfo); + } emit overlay_->setChatVisibility(false); - overlay_->resetOverlay(isAudioMuted, isVideoMuted, isRecording, isHolding); + overlay_->resetOverlay(isAudioMuted, isVideoMuted, isRecording, isHolding, isAudioOnly); +} + +void +VideoView::resetAvatarOverlay(bool isAudioOnly) +{ + audioOnlyAvatar_->setAvatarVisible(isAudioOnly); + if (isAudioOnly) { + disconnect(coordinateOverlays_); + coordinateOverlays_ = connect(overlay_, SIGNAL(HoldStatusChanged(bool)), this, SLOT(slotHoldStatusChanged(bool))); + } else { + disconnect(coordinateOverlays_); + } +} + +void +VideoView::writeAvatarOverlay(const std::string& accountId, const lrc::api::conversation::Info& convInfo) +{ + audioOnlyAvatar_->writeAvatarOverlay(accountId, convInfo); +} + +void +VideoView::slotHoldStatusChanged(bool pauseLabelStatus) +{ + audioOnlyAvatar_->respondToPauseLabel(pauseLabelStatus); } void @@ -467,7 +497,7 @@ VideoView::connectRendering(bool started) } void -VideoView::keyPressEvent(QKeyEvent *event) +VideoView::keyPressEvent(QKeyEvent* event) { // used to manage DTMF // For "#" and "*", qt will automatically read the shift + 3 or 8 @@ -476,13 +506,13 @@ VideoView::keyPressEvent(QKeyEvent *event) } void -VideoView::keyReleaseEvent(QKeyEvent *event) +VideoView::keyReleaseEvent(QKeyEvent* event) { if (keyPressed_ == static_cast<int>(Qt::Key_NumberSign)) { LRCInstance::getCurrentCallModel()->playDTMF(currentCallId_, "#"); } else if (keyPressed_ == static_cast<int>(Qt::Key_Asterisk)) { LRCInstance::getCurrentCallModel()->playDTMF(currentCallId_, "*"); - } else if (keyPressed_ >= 48 && keyPressed_ <= 57){ + } else if (keyPressed_ >= 48 && keyPressed_ <= 57) { //enum Qt::Key_0 = 48, QT::Key_9 = 57 LRCInstance::getCurrentCallModel()->playDTMF(currentCallId_, std::to_string(keyPressed_ - 48)); } diff --git a/videoview.h b/videoview.h index dea14f1bd75ad0da539342e0a619d0ce49b266bc..9b9822cc877c149b4e364d3d3fab0e5cbab52815 100644 --- a/videoview.h +++ b/videoview.h @@ -18,20 +18,22 @@ #pragma once -#include <QWidget> -#include <QTimer> +#include "callaudioonlyavataroverlay.h" +#include "videooverlay.h" + +#include "api/conversationmodel.h" + #include <QMouseEvent> #include <QKeyEvent> #include <QPropertyAnimation> - -#include "videooverlay.h" +#include <QTimer> +#include <QWidget> namespace Ui { class VideoView; } -class VideoView : public QWidget -{ +class VideoView : public QWidget { Q_OBJECT public: @@ -41,7 +43,7 @@ public: void showChatviewIfToggled(); void simulateShowChatview(bool checked); void setCurrentCalleeName(const QString& CalleeDisplayName); - void resetVideoOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding); + void resetVideoOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding, bool isAudioOnly, const std::string& accountId, const lrc::api::conversation::Info& convInfo); void disconnectRendering(); void connectRendering(bool started = false); @@ -65,16 +67,19 @@ private slots: void showContextMenu(const QPoint& pos); void fadeOverlayOut(); void showOverlay(); + void slotHoldStatusChanged(bool pauseLabelStatus); private: Ui::VideoView* ui; VideoOverlay* overlay_; + CallAudioOnlyAvatarOverlay* audioOnlyAvatar_; QPropertyAnimation* fadeAnim_; QTimer fadeTimer_; QWidget* oldParent_; QSize oldSize_; QMetaObject::Connection timerConnection_; QMetaObject::Connection callStatusChangedConnection_; + QMetaObject::Connection coordinateOverlays_; QPoint origin_; QPoint originMouseDisplacement_; bool draggingPreview_ = false; @@ -101,9 +106,12 @@ private: private: void toggleFullScreen(); + void resetAvatarOverlay(bool isAudioOnly); + void writeAvatarOverlay(const std::string& accountId, const lrc::api::conversation::Info& convInfo); signals: void setChatVisibility(bool visible); void videoSettingsClicked(); void toggleFullScreenClicked(); void closing(const std::string& callid); + };