From 2cc0f6dcd73879d43cbb44f6cffa669c6d054f89 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 27 Oct 2015 18:52:01 +0100 Subject: [PATCH] Added Decline Button to Voip Toaster Added new stylesheet from Beluga for the voip buttons --- plugins/VOIP/gui/VOIPChatWidgetHolder.cpp | 31 ++--- plugins/VOIP/gui/VOIPChatWidgetHolder.h | 4 +- plugins/VOIP/gui/VOIPGUIHandler.cpp | 42 +++++++ plugins/VOIP/gui/VOIPGUIHandler.h | 2 + plugins/VOIP/gui/VOIPToasterItem.cpp | 26 +++- plugins/VOIP/gui/VOIPToasterItem.h | 1 + plugins/VOIP/gui/VOIPToasterItem.ui | 139 +++++++++++++++------- 7 files changed, 183 insertions(+), 62 deletions(-) diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp index adb447973..87a5d2f5e 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp @@ -374,8 +374,8 @@ void VOIPChatWidgetHolder::addNewAudioButtonMap(const RsPeerId &peer_id) .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #22c70d, stop: 1 #116a06);") + .append("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(122, 230, 110, 255)," + "stop:0.494318 rgba(36, 191, 16, 255), stop:0.505682 rgba(26, 162, 9, 255), stop:1 rgba(17, 106, 6, 255));") ); buttonT->updateImage(); @@ -391,8 +391,8 @@ void VOIPChatWidgetHolder::addNewAudioButtonMap(const RsPeerId &peer_id) .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #c7220d, stop: 1 #6a1106);") + .append("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 124, 110, 255), stop:0.494318 rgba(191, 35, 16, 255), " + "stop:0.505682 rgba(162, 26, 9, 255), stop:1 rgba(106, 17, 6, 255));") ); buttonD->updateImage(); @@ -427,8 +427,8 @@ void VOIPChatWidgetHolder::addNewVideoButtonMap(const RsPeerId &peer_id) .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #22c70d, stop: 1 #116a06);") + .append("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(122, 230, 110, 255)," + "stop:0.494318 rgba(36, 191, 16, 255), stop:0.505682 rgba(26, 162, 9, 255), stop:1 rgba(17, 106, 6, 255));") ); buttonT->updateImage(); @@ -444,8 +444,8 @@ void VOIPChatWidgetHolder::addNewVideoButtonMap(const RsPeerId &peer_id) .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #c7220d, stop: 1 #6a1106);") + .append("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 124, 110, 255), stop:0.494318 rgba(191, 35, 16, 255), " + "stop:0.505682 rgba(162, 26, 9, 255), stop:1 rgba(106, 17, 6, 255));") ); buttonD->updateImage(); @@ -826,7 +826,8 @@ void VOIPChatWidgetHolder::botMouseEnterTake() .append("border-radius: 6px;") .append("padding: 3px;") .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #444444, stop: 1 #222222);") + "stop: 0 #444444, stop: 1 #222222);") + ); //source->setDown(true); } @@ -841,8 +842,8 @@ void VOIPChatWidgetHolder::botMouseLeaveTake() .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #22c70d, stop: 1 #116a06);") + .append("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(153, 240, 143, 255)," + "stop:0.494318 rgba(59, 201, 40, 255), stop:0.505682 rgba(46, 172, 29, 255), stop:1 rgba(30, 116, 20, 255));") ); //source->setDown(false); } @@ -857,8 +858,8 @@ void VOIPChatWidgetHolder::botMouseEnterDecline() .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #444444, stop: 1 #222222);") + .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " + "stop: 0 #444444, stop: 1 #222222);") ); //source->setDown(true); } @@ -873,8 +874,8 @@ void VOIPChatWidgetHolder::botMouseLeaveDecline() .append("min-width: 128px; min-height: 24px;") .append("border-radius: 6px;") .append("padding: 3px;") - .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, " - "stop: 0 #c7220d, stop: 1 #6a1106);") + .append("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(240, 154, 143, 255), " + "stop:0.494318 rgba(201, 57, 40, 255), stop:0.505682 rgba(172, 45, 29, 255), stop:1 rgba(116, 30, 20, 255));") ); //source->setDown(false); } diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.h b/plugins/VOIP/gui/VOIPChatWidgetHolder.h index 0d805f059..666b9c2ab 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.h +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.h @@ -68,6 +68,8 @@ public slots: void sendVideoData(); void startAudioCapture(); void startVideoCapture(); + void hangupCallAudio() ; + void hangupCallVideo() ; private slots: void toggleAudioListen(); @@ -80,8 +82,6 @@ private slots: void toggleFullScreen(); void toggleFullScreenFS(); void hangupCall() ; - void hangupCallAudio() ; - void hangupCallVideo() ; void botMouseEnterTake(); void botMouseLeaveTake(); void botMouseEnterDecline(); diff --git a/plugins/VOIP/gui/VOIPGUIHandler.cpp b/plugins/VOIP/gui/VOIPGUIHandler.cpp index 03e4739be..6a7d7d703 100644 --- a/plugins/VOIP/gui/VOIPGUIHandler.cpp +++ b/plugins/VOIP/gui/VOIPGUIHandler.cpp @@ -223,3 +223,45 @@ void VOIPGUIHandler::AnswerVideoCall(const RsPeerId &peer_id) std::cerr << "VOIPGUIHandler::AnswerVideoCall() Error: answer video call for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl; } } + +void VOIPGUIHandler::HangupAudioCall(const RsPeerId &peer_id) +{ + ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ; + if (di) { + ChatWidget *cw = di->getChatWidget(); + if(cw) { + const QList &chatWidgetHolderList = cw->chatWidgetHolderList(); + + foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList) + { + VOIPChatWidgetHolder *acwh = dynamic_cast(chatWidgetHolder) ; + + if (acwh) + acwh->hangupCallAudio(); + } + } + } else { + std::cerr << "VOIPGUIHandler::HangupAudioCall() Error: hangup audio call for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl; + } +} + +void VOIPGUIHandler::HangupVideoCall(const RsPeerId &peer_id) +{ + ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ; + if (di) { + ChatWidget *cw = di->getChatWidget(); + if(cw) { + const QList &chatWidgetHolderList = cw->chatWidgetHolderList(); + + foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList) + { + VOIPChatWidgetHolder *acwh = dynamic_cast(chatWidgetHolder) ; + + if (acwh) + acwh->hangupCallVideo(); + } + } + } else { + std::cerr << "VOIPGUIHandler::HangupVideoCall() Error: hangup video call for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl; + } +} diff --git a/plugins/VOIP/gui/VOIPGUIHandler.h b/plugins/VOIP/gui/VOIPGUIHandler.h index cb52890c1..bacd17451 100644 --- a/plugins/VOIP/gui/VOIPGUIHandler.h +++ b/plugins/VOIP/gui/VOIPGUIHandler.h @@ -42,6 +42,8 @@ class VOIPGUIHandler: public QObject public: static void AnswerAudioCall(const RsPeerId &peer_id) ; static void AnswerVideoCall(const RsPeerId &peer_id) ; + static void HangupAudioCall(const RsPeerId &peer_id) ; + static void HangupVideoCall(const RsPeerId &peer_id) ; public slots: void ReceivedInvitation(const RsPeerId &peer_id, int flags) ; diff --git a/plugins/VOIP/gui/VOIPToasterItem.cpp b/plugins/VOIP/gui/VOIPToasterItem.cpp index e704f5433..54659caac 100644 --- a/plugins/VOIP/gui/VOIPToasterItem.cpp +++ b/plugins/VOIP/gui/VOIPToasterItem.cpp @@ -39,18 +39,19 @@ VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, co switch (mType){ case AudioCall: - toasterButton->setIcon(QIcon("://images/call-start.png")); - toasterButton->setText(tr("Answer")); + //acceptButton->setIcon(QIcon("://images/call-start.png")); + acceptButton->setText(tr("Answer")); break; case VideoCall: - toasterButton->setIcon(QIcon("://images/video-icon-on.png")); - toasterButton->setText(tr("Answer with video")); + acceptButton->setIcon(QIcon("://images/video-icon-on.png")); + acceptButton->setText(tr("Answer with video")); break; default: ChatDialog::chatFriend(ChatId(mPeerId)); } - connect(toasterButton, SIGNAL(clicked()), SLOT(chatButtonSlot())); + connect(acceptButton, SIGNAL(clicked()), SLOT(chatButtonSlot())); + connect(declineButton, SIGNAL(clicked()), SLOT(declineButtonSlot())); connect(closeButton, SIGNAL(clicked()), SLOT(hide())); /* set informations */ @@ -79,6 +80,21 @@ void VOIPToasterItem::chatButtonSlot() hide(); } +void VOIPToasterItem::declineButtonSlot() +{ + switch (mType){ + case AudioCall: + VOIPGUIHandler::HangupAudioCall(mPeerId); + break; + case VideoCall: + VOIPGUIHandler::HangupVideoCall(mPeerId); + break; + default: + ChatDialog::chatFriend(ChatId(mPeerId)); + } + hide(); +} + #ifdef VOIPTOASTERNOTIFY_ALL void VOIPToasterItem::voipAcceptReceived(const RsPeerId &, int ) { diff --git a/plugins/VOIP/gui/VOIPToasterItem.h b/plugins/VOIP/gui/VOIPToasterItem.h index 8d4f82ebd..e796db4e5 100644 --- a/plugins/VOIP/gui/VOIPToasterItem.h +++ b/plugins/VOIP/gui/VOIPToasterItem.h @@ -44,6 +44,7 @@ public: private slots: void chatButtonSlot(); + void declineButtonSlot(); #ifdef VOIPTOASTERNOTIFY_ALL void voipAcceptReceived(const RsPeerId &peer_id, int flags) ; // emitted when the peer accepts the call diff --git a/plugins/VOIP/gui/VOIPToasterItem.ui b/plugins/VOIP/gui/VOIPToasterItem.ui index 758c01165..ef1a3e402 100644 --- a/plugins/VOIP/gui/VOIPToasterItem.ui +++ b/plugins/VOIP/gui/VOIPToasterItem.ui @@ -6,27 +6,36 @@ 0 0 - 300 - 100 + 440 + 102 - 300 + 440 100 - 300 - 100 + 440 + 102 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -38,7 +47,16 @@ QFrame::Raised - + + 2 + + + 2 + + + 2 + + 2 @@ -124,59 +142,36 @@ - - - - - 0 - 24 - - - - - 218 - 24 - - - - - 75 - true - - - - true - - - + + 6 + - + QPushButton{ border: 1px solid #199909; -font-size: 12pt; color: white; +font-size: 12pt; color: white; min-width: 128px; min-height: 24px; border-radius: 6px; -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, - stop: 0 #22c70d, stop: 1 #116a06); +background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(122, 230, 110, 255), stop:0.494318 rgba(36, 191, 16, 255), stop:0.505682 rgba(26, 162, 9, 255), stop:1 rgba(17, 106, 6, 255)); } QPushButton::hover{ border: 1px solid #199909; font-size: 12pt; color: white; min-width: 128px; min-height: 24px; border-radius: 6px; -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, - stop: 0 #26df0f, stop: 1 #1db20a); +background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(153, 240, 143, 255), stop:0.494318 rgba(59, 201, 40, 255), stop:0.505682 rgba(46, 172, 29, 255), stop:1 rgba(30, 116, 20, 255)); } QPushButton::pressed{ -border: 1px solid #333333; +border: 1px solid #6a1106; font-size: 12pt; color: white; min-width: 128px; min-height: 24px; border-radius: 6px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, stop: 0 #444444, stop: 1 #222222); -} +} + @@ -205,6 +200,70 @@ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, + + + + QPushButton{ +border: 1px solid #6a1106; +font-size: 12pt; color: white; +min-width: 128px; min-height: 24px; +border-radius: 6px; +background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 124, 110, 255), stop:0.494318 rgba(191, 35, 16, 255), stop:0.505682 rgba(162, 26, 9, 255), stop:1 rgba(106, 17, 6, 255)); +} +QPushButton::hover{ +border: 1px solid #6a1106; +font-size: 12pt; color: white; +min-width: 128px; min-height: 24px; +border-radius: 6px; +background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(240, 154, 143, 255), stop:0.494318 rgba(201, 57, 40, 255), stop:0.505682 rgba(172, 45, 29, 255), stop:1 rgba(116, 30, 20, 255)); +} + +QPushButton::pressed{ +border: 1px solid #6a1106; +font-size: 12pt; color: white; +min-width: 128px; min-height: 24px; +border-radius: 6px; +background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, + stop: 0 #444444, stop: 1 #222222); +} + + + + Decline + + + + 22 + 22 + + + + + + + + + 0 + 24 + + + + + 218 + 24 + + + + + 75 + true + + + + true + + +