Beautify Answer Button for VOIP Toaster

Display peername on voip notify text

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8307 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2015-05-28 13:59:20 +00:00
parent 8b8ffa8caa
commit fc97cdcfa2
4 changed files with 71 additions and 26 deletions

View File

@ -35,6 +35,7 @@
#include "QVideoDevice.h" #include "QVideoDevice.h"
#include <retroshare/rsstatus.h> #include <retroshare/rsstatus.h>
#include <retroshare/rspeers.h>
#define CALL_START ":/images/call-start.png" #define CALL_START ":/images/call-start.png"
#define CALL_STOP ":/images/call-stop.png" #define CALL_STOP ":/images/call-stop.png"
@ -288,7 +289,7 @@ void VOIPChatWidgetHolder::addVideoData(const RsPeerId &peer_id, QByteArray* arr
{ {
if (!videoCaptureToggleButton->isChecked()) { if (!videoCaptureToggleButton->isChecked()) {
if (mChatWidget) { if (mChatWidget) {
QString buttonName = QString::fromStdString(peer_id.toStdString()); QString buttonName = QString::fromUtf8(rsPeers->getPeerName(peer_id).c_str());
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName); button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){ if (it == buttonMapTakeVideo.end()){
@ -380,7 +381,7 @@ void VOIPChatWidgetHolder::addAudioData(const RsPeerId &peer_id, QByteArray* arr
} }
if (mChatWidget) { if (mChatWidget) {
QString buttonName = QString::fromStdString(peer_id.toStdString()); QString buttonName = QString::fromUtf8(rsPeers->getPeerName(peer_id).c_str());
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName); button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){ if (it == buttonMapTakeVideo.end()){

View File

@ -40,9 +40,11 @@ VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, co
switch (mType){ switch (mType){
case AudioCall: case AudioCall:
toasterButton->setIcon(QIcon("://images/call-start.png")); toasterButton->setIcon(QIcon("://images/call-start.png"));
toasterButton->setText(tr("Answer"));
break; break;
case VideoCall: case VideoCall:
toasterButton->setIcon(QIcon("://images/video-icon-on.png")); toasterButton->setIcon(QIcon("://images/video-icon-on.png"));
toasterButton->setText(tr("Answer with video"));
break; break;
default: default:
ChatDialog::chatFriend(ChatId(mPeerId)); ChatDialog::chatFriend(ChatId(mPeerId));
@ -53,7 +55,7 @@ VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, co
/* set informations */ /* set informations */
textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE)); textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(mPeerId).c_str())); //toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(mPeerId).c_str()));
avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME); avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
avatarWidget->setId(ChatId(mPeerId)); avatarWidget->setId(ChatId(mPeerId));
} }

View File

@ -37,7 +37,7 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout" name="gridLayout_2">
<property name="margin"> <property name="margin">
<number>2</number> <number>2</number>
</property> </property>
@ -70,7 +70,7 @@
</size> </size>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../images.qrc">:/images/logo/logo_16.png</pixmap> <pixmap>:/images/logo/logo_16.png</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
@ -80,7 +80,7 @@
<item> <item>
<widget class="QLabel" name="toasterLabel"> <widget class="QLabel" name="toasterLabel">
<property name="text"> <property name="text">
<string notr="true">Name</string> <string notr="true">RetroShare</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -112,7 +112,7 @@
</size> </size>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/closenormal.png</normaloff>:/images/closenormal.png</iconset> <normaloff>:/images/closenormal.png</normaloff>:/images/closenormal.png</iconset>
</property> </property>
<property name="flat"> <property name="flat">
@ -123,27 +123,70 @@
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QGridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>2</number>
</property>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QPushButton" name="toasterButton"> <widget class="QLabel" name="textLabel">
<property name="text"> <property name="minimumSize">
<string>Show Chat</string> <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>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="textLabel"> <widget class="QPushButton" name="toasterButton">
<property name="maximumSize"> <property name="styleSheet">
<size> <string notr="true">QPushButton{
<width>218</width> border: 1px solid #199909;
<height>43</height> font-size: 12pt; color: white;
</size> 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);
}
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);
}
QPushButton::pressed{
border: 1px solid #333333;
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>
<property name="wordWrap"> <property name="text">
<bool>true</bool> <string/>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
@ -179,8 +222,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="VOIP_images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -322,7 +322,7 @@ void VOIPToasterNotify::voipAudioCallReceived(const RsPeerId &peer_id)
if (!mToasterAudioCall.contains(peer_id)){ if (!mToasterAudioCall.contains(peer_id)){
ToasterItemData toasterItemData; ToasterItemData toasterItemData;
toasterItemData.mPeerId = peer_id; toasterItemData.mPeerId = peer_id;
toasterItemData.mMsg = tr("Audio Call received from this peer."); toasterItemData.mMsg = QString::fromUtf8(rsPeers->getPeerName(toasterItemData.mPeerId).c_str()) + " " + tr("calling");
mPendingToasterAudioCall.push_back(toasterItemData); mPendingToasterAudioCall.push_back(toasterItemData);
mToasterAudioCall.insert(peer_id, NULL); mToasterAudioCall.insert(peer_id, NULL);
@ -346,7 +346,7 @@ void VOIPToasterNotify::voipVideoCallReceived(const RsPeerId &peer_id)
if (!mToasterVideoCall.contains(peer_id)){ if (!mToasterVideoCall.contains(peer_id)){
ToasterItemData toasterItemData; ToasterItemData toasterItemData;
toasterItemData.mPeerId = peer_id; toasterItemData.mPeerId = peer_id;
toasterItemData.mMsg = tr("Video Call received from this peer."); toasterItemData.mMsg = QString::fromUtf8(rsPeers->getPeerName(toasterItemData.mPeerId).c_str()) + " " + tr("calling");
mPendingToasterVideoCall.push_back(toasterItemData); mPendingToasterVideoCall.push_back(toasterItemData);
mToasterVideoCall.insert(peer_id, NULL); mToasterVideoCall.insert(peer_id, NULL);