~ubuntu-branches/ubuntu/raring/sflphone/raring

« back to all changes in this revision

Viewing changes to kde/src/lib/CallModel.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-27 08:22:22 UTC
  • mfrom: (4.1.15 sid)
  • Revision ID: package-import@ubuntu.com-20120527082222-fs3ojksqvt0ol6rl
Tags: 1.1.0-2
* Drop unsupported CELT codec (Build-Depends)
  - Fixes "Spurious build dependency on libcelt-dev" (Closes: #674644)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2009-2012 by Savoir-Faire Linux                         *
3
 
 *   Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >*
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 3 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
10
 
 *   This program is distributed in the hope that it will be useful,       *
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 
 *   GNU General Public License for more details.                          *
14
 
 *                                                                         *
15
 
 *   You should have received a copy of the GNU General Public License     *
16
 
 *   along with this program; if not, write to the                         *
17
 
 *   Free Software Foundation, Inc.,                                       *
18
 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 
 **************************************************************************/
20
 
//Parent
21
 
#include <CallModel.h>
22
 
 
23
 
bool CallModelBase::dbusInit = false;
24
 
 
25
 
CallModelBase::CallModelBase(QObject* parent) : QObject(parent)
26
 
{
27
 
   if (!dbusInit) {
28
 
      CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
29
 
 
30
 
      //SLOTS
31
 
      //             SENDER                                        SIGNAL                                      RECEIVER                             SLOT                                    /
32
 
      /**/connect(&callManager, SIGNAL( callStateChanged  (const QString &, const QString &                  ) ), this , SLOT( on1_callStateChanged  ( const QString &, const QString & ) ) );
33
 
      /**/connect(&callManager, SIGNAL( incomingCall      (const QString &, const QString &, const QString & ) ), this , SLOT( on1_incomingCall      ( const QString &, const QString & ) ) );
34
 
      /**/connect(&callManager, SIGNAL( conferenceCreated (const QString &                                   ) ), this , SLOT( on1_incomingConference( const QString &                  ) ) );
35
 
      /**/connect(&callManager, SIGNAL( conferenceChanged (const QString &, const QString &                  ) ), this , SLOT( on1_changingConference( const QString &, const QString & ) ) );
36
 
      /**/connect(&callManager, SIGNAL( conferenceRemoved (const QString &                                   ) ), this , SLOT( on1_conferenceRemoved ( const QString &                  ) ) );
37
 
      /**/connect(&callManager, SIGNAL( voiceMailNotify   (const QString &, int                              ) ), this , SLOT( on1_voiceMailNotify   ( const QString &, int             ) ) );
38
 
      /**/connect(&callManager, SIGNAL( volumeChanged     (const QString &, double                           ) ), this , SLOT( on1_volumeChanged     ( const QString &, double          ) ) );
39
 
      /*                                                                                                                                                                                    */
40
 
      dbusInit = true;
41
 
   }
42
 
}
43
 
 
44
 
void CallModelBase::on1_callStateChanged(const QString &callID, const QString &state)
45
 
{
46
 
   //This code is part of the CallModel iterface too
47
 
   qDebug() << "Signal : Call State Changed for call  " << callID << " . New state : " << state;
48
 
   Call* call = findCallByCallId(callID);
49
 
   if(!call) {
50
 
      qDebug() << "Call not found";
51
 
      if(state == CALL_STATE_CHANGE_RINGING) {
52
 
         call = addRingingCall(callID);
53
 
      }
54
 
      else {
55
 
         qDebug() << "Call doesn't exist in this client. Might have been initialized by another client instance before this one started.";
56
 
         return;
57
 
      }
58
 
   }
59
 
   else {
60
 
      qDebug() << "Call found" << call;
61
 
      call->stateChanged(state);
62
 
   }
63
 
   //updateWindowCallState(); //NEED_PORT
64
 
   emit callStateChanged(call);
65
 
   
66
 
}
67
 
 
68
 
void CallModelBase::on1_incomingCall(const QString & accountID, const QString & callID)
69
 
{
70
 
   Q_UNUSED(accountID)
71
 
   qDebug() << "Signal : Incoming Call ! ID = " << callID;
72
 
   Call* call = addIncomingCall(callID);
73
 
 
74
 
   //NEED_PORT
75
 
//    SFLPhone::app()->activateWindow();
76
 
//    SFLPhone::app()->raise();
77
 
//    SFLPhone::app()->setVisible(true);
78
 
 
79
 
   //emit incomingCall(call);
80
 
   emit incomingCall(call);
81
 
}
82
 
 
83
 
void CallModelBase::on1_incomingConference(const QString &confID)
84
 
{
85
 
   Call* conf = addConference(confID);
86
 
   qDebug() << "---------------Adding conference" << conf << confID << "---------------";
87
 
   emit conferenceCreated(conf);
88
 
}
89
 
 
90
 
void CallModelBase::on1_changingConference(const QString &confID, const QString &state)
91
 
{
92
 
   Call* conf = getCall(confID);
93
 
   qDebug() << "Changing conference state" << conf << confID;
94
 
   if (conf) {
95
 
      changeConference(confID, state);
96
 
      emit conferenceChanged(conf);
97
 
   }
98
 
   else {
99
 
      qDebug() << "Trying to affect a conference that does not exist (anymore)";
100
 
   }
101
 
}
102
 
 
103
 
void CallModelBase::on1_conferenceRemoved(const QString &confId)
104
 
{
105
 
   Call* conf = getCall(confId);
106
 
   emit aboutToRemoveConference(conf);
107
 
   removeConference(confId);
108
 
   emit conferenceRemoved(confId);
109
 
}
110
 
 
111
 
void CallModelBase::on1_voiceMailNotify(const QString &accountID, int count)
112
 
{
113
 
   qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID;
114
 
   emit voiceMailNotify(accountID,count);
115
 
}
116
 
 
117
 
void CallModelBase::on1_volumeChanged(const QString & device, double value)
118
 
{
119
 
//    qDebug() << "Signal : Volume Changed !";
120
 
//    if(! (toolButton_recVol->isChecked() && value == 0.0))
121
 
//       updateRecordBar();
122
 
//    if(! (toolButton_sndVol->isChecked() && value == 0.0))
123
 
//       updateVolumeBar();
124
 
   emit volumeChanged(device,value);
125
 
}
126
 
 
127
 
Call* CallModelBase::addCall(Call* call, Call* parent)
128
 
{
129
 
   emit callAdded(call,parent);
130
 
   return call;
131
 
}
132
 
 
133
 
//More code in CallModel.hpp
 
 
b'\\ No newline at end of file'