From 8cfd569cdf13f245bcb3d8b374c5977a726ac61e Mon Sep 17 00:00:00 2001 From: marian Date: Tue, 25 Jun 2013 15:04:42 +0000 Subject: [PATCH] Added incoming call notification window. git-svn-id: http://yate.null.ro/svn/yate/trunk@5556 acf43c95-373e-0410-b603-e72c3f656dc1 --- engine/ClientLogic.cpp | 47 ++- share/skins/default/close_16.png | Bin 0 -> 405 bytes share/skins/default/close_16_hover.png | Bin 0 -> 401 bytes share/skins/default/close_16_pressed.png | Bin 0 -> 341 bytes share/skins/default/notification.ui | 393 +++++++++++++++++++++++ share/skins/default/qt4client.rc | 5 + yatecbase.h | 12 + 7 files changed, 455 insertions(+), 2 deletions(-) create mode 100644 share/skins/default/close_16.png create mode 100644 share/skins/default/close_16_hover.png create mode 100644 share/skins/default/close_16_pressed.png create mode 100644 share/skins/default/notification.ui diff --git a/engine/ClientLogic.cpp b/engine/ClientLogic.cpp index 8eed00a3..0dc0eb93 100644 --- a/engine/ClientLogic.cpp +++ b/engine/ClientLogic.cpp @@ -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) { diff --git a/share/skins/default/close_16.png b/share/skins/default/close_16.png new file mode 100644 index 0000000000000000000000000000000000000000..f6f932ee9722b8d47745a40e4f9e7591be49f6dd GIT binary patch literal 405 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4BsX?Dj#QwH@!_9a8O# w3LH)Px3`J!S{MKRdB5JrkiUPm=kxwxW37)+@a}DT01QF~Pgg&ebxsLQ0Be1tga7~l literal 0 HcmV?d00001 diff --git a/share/skins/default/close_16_hover.png b/share/skins/default/close_16_hover.png new file mode 100644 index 0000000000000000000000000000000000000000..5af273efd40416606c5da041e9277886ccf4dec4 GIT binary patch literal 401 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4{%K8t!GS)UKCoR4nvyflGQ#nf8 zscTB(1osWGGeX3k-(@|hBst^R`7`-;oJxmejMGy8a~~+uaS7aF#`9R1VcwJ={bsr2 zg$xY)g1Y|PYRtWTzh|TH(k~NKPVzA*_+D-ZdS!gs sQg1GLz3Xel{+&lwe*3=OM*0JDE>lBchTE}lVDK?`y85}Sb4q9e0B0hfmjD0& literal 0 HcmV?d00001 diff --git a/share/skins/default/close_16_pressed.png b/share/skins/default/close_16_pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..1ebfac0b3ebec6530cdd92b9d720aa79cb6316e7 GIT binary patch literal 341 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4awHm~*>M=%TBOAKRfb zh7HUOOKvS+7S3__f>zff9i?ccU7aVS92QOKs$%4E$*yI8Ab8RA^d{fn^`VQd{o**l z{6S!1=v7bk1vQ&r?>fC|vLA!7|JhAJT3(mGytO!Y&Y_O!lTAJ2jH#`X9jTGsS^Gni g?)QAq{y$rPes;9$iRbB=K;JQVy85}Sb4q9e0AZJdQUCw| literal 0 HcmV?d00001 diff --git a/share/skins/default/notification.ui b/share/skins/default/notification.ui new file mode 100644 index 00000000..5a7d5c50 --- /dev/null +++ b/share/skins/default/notification.ui @@ -0,0 +1,393 @@ + + notification + + + + 0 + 0 + 320 + 125 + + + + + 0 + 0 + + + + + 320 + 120 + + + + + 320 + 125 + + + + Yate Client Notification + + + null_team-32.png + + + true + + + notificationtype,stayontop,frameless + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame#frame_window { + border: 1px solid #717fa0; +} + + + + 4 + + + 4 + + + 4 + + + 10 + + + + + + 0 + 0 + + + + + 16 + 26 + + + + + 16777215 + 26 + + + + QFrame#frame_title { + border: 0px; + border-bottom: 1px solid #717fa0; +} + + + QFrame::StyledPanel + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 24 + 0 + + + + + 24 + 16777215 + + + + null_team-16.png + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 10 + + + + Yate Client + + + + + + + + 20 + 20 + + + + + 20 + 20 + + + + Qt::NoFocus + + + Close + + + close_16.png + + + true + + + close_16.png + + + close_16_pressed.png + + + close_16_hover.png + + + + + + + + + + + 0 + 0 + + + + + 10 + + + + Qt::AlignCenter + + + true + + + Qt::TextSelectableByMouse + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 26 + + + + + 16777215 + 26 + + + + Answer the call + + + Accept + + + answer_20.png + + + + 20 + 20 + + + + Qt::ToolButtonTextBesideIcon + + + answer + + + answer_20.png + + + answer_20_pressed.png + + + answer_20_hover.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 26 + + + + + 16777215 + 26 + + + + Hangup/reject the call + + + Decline + + + hangup_20.png + + + + 20 + 20 + + + + Qt::ToolButtonTextBesideIcon + + + hangup + + + hangup_20.png + + + hangup_20_pressed.png + + + hangup_20_hover.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + diff --git a/share/skins/default/qt4client.rc b/share/skins/default/qt4client.rc index f5c0a87b..c1f94ccd 100644 --- a/share/skins/default/qt4client.rc +++ b/share/skins/default/qt4client.rc @@ -163,3 +163,8 @@ description=archive.ui [busy] enabled=no description=busy.ui + +[notification] +enabled=yes +save=false +description=notification.ui diff --git a/yatecbase.h b/yatecbase.h index c8f0eeef..0d505464 100644 --- a/yatecbase.h +++ b/yatecbase.h @@ -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