Added Decline Button to Voip Toaster

Added new stylesheet from Beluga for the voip buttons
This commit is contained in:
defnax 2015-10-27 18:52:01 +01:00
parent afa3f53b14
commit 2cc0f6dcd7
7 changed files with 183 additions and 62 deletions

View File

@ -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);
}

View File

@ -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();

View File

@ -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<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(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<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(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;
}
}

View File

@ -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) ;

View File

@ -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 )
{

View File

@ -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

View File

@ -6,27 +6,36 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>100</height>
<width>440</width>
<height>102</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<width>440</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>100</height>
<width>440</width>
<height>102</height>
</size>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -38,7 +47,16 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="spacing">
@ -124,59 +142,36 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="StyledLabel" name="textLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>218</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="1">
<widget class="QPushButton" name="toasterButton">
<widget class="QPushButton" name="acceptButton">
<property name="styleSheet">
<string notr="true">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);
} </string>
}
</string>
</property>
<property name="text">
<string/>
@ -205,6 +200,70 @@ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67,
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="declineButton">
<property name="styleSheet">
<string notr="true">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);
}
</string>
</property>
<property name="text">
<string>Decline</string>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="StyledLabel" name="textLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>218</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>