Beautfy the stylesheet for the "Accept Call" Button, display notify text for voip calls too.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8286 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2015-05-22 16:02:16 +00:00
parent a1082e9f41
commit c0ecc0da7a
2 changed files with 66 additions and 17 deletions

View File

@ -194,6 +194,12 @@ void VOIPChatWidgetHolder::hangupCall()
hangupButton->hide(); hangupButton->hide();
} }
void VOIPChatWidgetHolder::startAudioCapture()
{
audioCaptureToggleButton->setChecked(true);
toggleAudioCapture();
}
void VOIPChatWidgetHolder::toggleAudioCapture() void VOIPChatWidgetHolder::toggleAudioCapture()
{ {
if (audioCaptureToggleButton->isChecked()) { if (audioCaptureToggleButton->isChecked()) {
@ -220,6 +226,13 @@ void VOIPChatWidgetHolder::toggleAudioCapture()
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("Outgoing Call is started..."), ChatWidget::MSGTYPE_SYSTEM); mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("Outgoing Call is started..."), ChatWidget::MSGTYPE_SYSTEM);
} }
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
RSButtonOnText *button = it.value();
delete button;
it = buttonMapTakeVideo.erase(it);
}
} else { } else {
disconnect(inputAudioProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData())); disconnect(inputAudioProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData()));
if (inputAudioDevice) { if (inputAudioDevice) {
@ -284,11 +297,13 @@ void VOIPChatWidgetHolder::addVideoData(const QString name, QByteArray* array)
, tr("%1 inviting you to start a video conversation. do you want Accept or Decline the invitation?").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM); , tr("%1 inviting you to start a video conversation. do you want Accept or Decline the invitation?").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Accept Video Call")); RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Accept Video Call"));
button->setToolTip(tr("Activate camera")); button->setToolTip(tr("Activate camera"));
button->setStyleSheet(QString("background-color: green;") button->setStyleSheet(QString("border: 1px solid #199909;")
.append("border-style: outset;") .append("font-size: 12pt; color: white;")
.append("border-width: 5px;") .append("min-width: 128px; min-height: 24px;")
.append("border-radius: 5px;") .append("border-radius: 6px;")
.append("border-color: beige;") .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
"stop: 0 #22c70d, stop: 1 #116a06);")
); );
button->updateImage(); button->updateImage();
@ -307,12 +322,14 @@ void VOIPChatWidgetHolder::botMouseEnter()
{ {
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender()); RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){ if (source){
source->setStyleSheet(QString("background-color: red;") source->setStyleSheet(QString("border: 1px solid #333333;")
.append("border-style: outset;") .append("font-size: 12pt; color: white;")
.append("border-width: 5px;") .append("min-width: 128px; min-height: 24px;")
.append("border-radius: 5px;") .append("border-radius: 6px;")
.append("border-color: beige;") .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
); "stop: 0 #444444, stop: 1 #222222);")
);
//source->setDown(true); //source->setDown(true);
} }
} }
@ -321,12 +338,14 @@ void VOIPChatWidgetHolder::botMouseLeave()
{ {
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender()); RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){ if (source){
source->setStyleSheet(QString("background-color: green;") source->setStyleSheet(QString("border: 1px solid #199909;")
.append("border-style: outset;") .append("font-size: 12pt; color: white;")
.append("border-width: 5px;") .append("min-width: 128px; min-height: 24px;")
.append("border-radius: 5px;") .append("border-radius: 6px;")
.append("border-color: beige;") .append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
); "stop: 0 #22c70d, stop: 1 #116a06);")
);
//source->setDown(false); //source->setDown(false);
} }
} }
@ -353,6 +372,35 @@ void VOIPChatWidgetHolder::addAudioData(const QString name, QByteArray* array)
anim->setDuration(400); anim->setDuration(400);
anim->start(); anim->start();
} }
if (mChatWidget) {
QString buttonName = name;
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("%1 inviting you to start a audio conversation. do you want Accept or Decline the invitation?").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Accept Call"));
button->setToolTip(tr("Activate audio"));
button->setStyleSheet(QString("border: 1px solid #199909;")
.append("font-size: 12pt; color: white;")
.append("min-width: 128px; min-height: 24px;")
.append("border-radius: 6px;")
.append("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
"stop: 0 #22c70d, stop: 1 #116a06);")
);
button->updateImage();
connect(button,SIGNAL(clicked()),this,SLOT(startAudioCapture()));
connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));
buttonMapTakeVideo.insert(buttonName, button);
}
}
// soundManager->play(VOIP_SOUND_INCOMING_CALL); // soundManager->play(VOIP_SOUND_INCOMING_CALL);

View File

@ -56,6 +56,7 @@ private slots:
void toggleAudioCapture(); void toggleAudioCapture();
void toggleVideoCapture(); void toggleVideoCapture();
void startVideoCapture(); void startVideoCapture();
void startAudioCapture();
void hangupCall() ; void hangupCall() ;
void botMouseEnter(); void botMouseEnter();
void botMouseLeave(); void botMouseLeave();