Added incoming call notification window.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5556 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2013-06-25 15:04:42 +00:00
parent 8cec1717df
commit 8cfd569cdf
7 changed files with 455 additions and 2 deletions

View File

@ -701,6 +701,7 @@ static const String s_wndChatContact = "chatcontact"; // Chat contact edit/add
static const String s_wndMucInvite = "mucinvite"; // MUC invite
static const String s_wndAcountList = "accountlist"; // Accounts list
static const String s_wndFileTransfer = "fileprogress"; // File transfer
static const String s_wndNotification = "notification"; // Notifications
// Some UI widgets
static const String s_mainwindowTabs = "mainwindowTabs";
static const String s_channelList = "channels";
@ -8971,7 +8972,8 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
if (notif == ClientChannel::Destroyed) {
if (!Client::valid())
return false;
String id = msg.getValue(YSTRING("id"));
const String& id = msg[YSTRING("id")];
closeInCallNotification(id);
int slave = ClientChannel::lookupSlaveType(msg.getValue("channel_slave_type"));
if (slave) {
bool conf = (slave == ClientChannel::SlaveConference);
@ -9104,6 +9106,7 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
if (outgoing) {
if (noticed)
Client::self()->ringer(true,false);
closeInCallNotification(CHANUPD_ID);
}
else {
Client::self()->ringer(true,false);
@ -9127,6 +9130,7 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
if (outgoing) {
if (noticed)
Client::self()->ringer(true,false);
closeInCallNotification(CHANUPD_ID);
}
else {
Client::self()->ringer(true,false);
@ -9140,6 +9144,7 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
// Stop incoming ringer
Client::self()->ringer(true,false);
buildStatus(status,"Call noticed",CHANUPD_ADDR,CHANUPD_ID);
closeInCallNotification(CHANUPD_ID);
break;
case ClientChannel::Progressing:
buildStatus(status,"Call progressing",CHANUPD_ADDR,CHANUPD_ID);
@ -9159,6 +9164,7 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
if (outgoing) {
addTrayIcon(YSTRING("incomingcall"));
Client::self()->setUrgent(s_wndMain,true,Client::self()->getWindow(s_wndMain));
showInCallNotification(chan);
}
p.addParam("active:answer",String::boolText(outgoing));
p.addParam("party",chan ? chan->party() : "");
@ -9180,8 +9186,10 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
buildStatus(status,"Calling target",0,0);
break;
case ClientChannel::Answered:
if (outgoing)
if (outgoing) {
removeTrayIcon(YSTRING("incomingcall"));
closeInCallNotification(CHANUPD_ID);
}
buildStatus(status,"Call answered",CHANUPD_ADDR,CHANUPD_ID);
// Stop incoming ringer
Client::self()->ringer(true,false);
@ -9775,6 +9783,41 @@ void DefaultLogic::engineStart(Message& msg)
}
}
// Show incoming call notification for a given channel
void DefaultLogic::showInCallNotification(ClientChannel* chan)
{
if (!(chan && Client::valid()))
return;
Window* w = Client::self()->getWindow(s_wndNotification);
if (!w)
return;
Client::self()->setVisible(s_wndNotification,false);
NamedList p("");
p.addParam("context",chan->id());
p.addParam("property:answeraction:_yate_identity","answer:" + chan->id());
p.addParam("property:hangupaction:_yate_identity","hangup:" + chan->id());
String text = "Incoming call";
if (chan->party())
text << " from " << chan->party();
p.addParam("text",text);
Client::self()->setParams(&p,w);
Client::self()->setVisible(s_wndNotification);
}
// Close incoming call notification for a given id
void DefaultLogic::closeInCallNotification(const String& id)
{
if (!(id && Client::valid()))
return;
Window* w = Client::self()->getWindow(s_wndNotification);
if (w && w->context() == id) {
NamedList p("");
p.addParam("context","");
Client::self()->setParams(&p,w);
Client::self()->closeWindow(s_wndNotification);
}
}
// Method called by the client when idle
void DefaultLogic::idleTimerTick(Time& time)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

View File

@ -0,0 +1,393 @@
<ui version="4.0" >
<class>notification</class>
<widget class="QWidget" name="notification" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>125</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>320</width>
<height>120</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>320</width>
<height>125</height>
</size>
</property>
<property name="windowTitle" >
<string>Yate Client Notification</string>
</property>
<property name="windowIcon" >
<iconset>null_team-32.png</iconset>
</property>
<property name="_yate_window" stdset="0" >
<bool>true</bool>
</property>
<property name="_yate_windowflags" stdset="0" >
<string>notificationtype,stayontop,frameless</string>
</property>
<property name="_yate_notificationwindow" stdset="0" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
</property>
<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>
<widget class="QFrame" name="frame_window" >
<property name="styleSheet" >
<string>QFrame#frame_window {
border: 1px solid #717fa0;
}</string>
</property>
<layout class="QVBoxLayout" >
<property name="leftMargin" >
<number>4</number>
</property>
<property name="topMargin" >
<number>4</number>
</property>
<property name="rightMargin" >
<number>4</number>
</property>
<property name="bottomMargin" >
<number>10</number>
</property>
<item>
<widget class="QFrame" name="frame_title" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="styleSheet" >
<string>QFrame#frame_title {
border: 0px;
border-bottom: 1px solid #717fa0;
}</string>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QHBoxLayout" >
<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>
<widget class="QLabel" name="image" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="pixmap" >
<pixmap>null_team-16.png</pixmap>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="title" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" >
<string>Yate Client</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_hide" >
<property name="minimumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="focusPolicy" >
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip" >
<string>Close</string>
</property>
<property name="icon" >
<iconset>close_16.png</iconset>
</property>
<property name="autoRaise" >
<bool>true</bool>
</property>
<property name="_yate_normal_icon" stdset="0" >
<string>close_16.png</string>
</property>
<property name="_yate_pressed_icon" stdset="0" >
<string>close_16_pressed.png</string>
</property>
<property name="_yate_hover_icon" stdset="0" >
<string>close_16_hover.png</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="text" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
<property name="textInteractionFlags" >
<set>Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="answeraction" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="toolTip" >
<string>Answer the call</string>
</property>
<property name="text" >
<string>Accept</string>
</property>
<property name="icon" >
<iconset>answer_20.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="toolButtonStyle" >
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="_yate_identity" stdset="0" >
<string>answer</string>
</property>
<property name="_yate_normal_icon" stdset="0" >
<string>answer_20.png</string>
</property>
<property name="_yate_pressed_icon" stdset="0" >
<string>answer_20_pressed.png</string>
</property>
<property name="_yate_hover_icon" stdset="0" >
<string>answer_20_hover.png</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="hangupaction" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="toolTip" >
<string>Hangup/reject the call</string>
</property>
<property name="text" >
<string>Decline</string>
</property>
<property name="icon" >
<iconset>hangup_20.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="toolButtonStyle" >
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="_yate_identity" stdset="0" >
<string>hangup</string>
</property>
<property name="_yate_normal_icon" stdset="0" >
<string>hangup_20.png</string>
</property>
<property name="_yate_pressed_icon" stdset="0" >
<string>hangup_20_pressed.png</string>
</property>
<property name="_yate_hover_icon" stdset="0" >
<string>hangup_20_hover.png</string>
</property>
<property name="_yate_filterevents" stdset="0" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -163,3 +163,8 @@ description=archive.ui
[busy]
enabled=no
description=busy.ui
[notification]
enabled=yes
save=false
description=notification.ui

View File

@ -3612,6 +3612,18 @@ public:
*/
virtual void engineStart(Message& msg);
/**
* Show incoming call notification for a given channel
* @param chan The channel
*/
virtual void showInCallNotification(ClientChannel* chan);
/**
* Close incoming call notification for a given id
* @param id The notification id to close
*/
virtual void closeInCallNotification(const String& id);
/**
* Build an account id from protocol, username, host
* @param accId Destination string