1
/***************************************************************************
2
* Copyright (C) 2009-2012 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >*
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. *
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. *
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
**************************************************************************/
21
#include <CallModel.h>
23
bool CallModelBase::dbusInit = false;
25
CallModelBase::CallModelBase(QObject* parent) : QObject(parent)
28
CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
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 ) ) );
44
void CallModelBase::on1_callStateChanged(const QString &callID, const QString &state)
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);
50
qDebug() << "Call not found";
51
if(state == CALL_STATE_CHANGE_RINGING) {
52
call = addRingingCall(callID);
55
qDebug() << "Call doesn't exist in this client. Might have been initialized by another client instance before this one started.";
60
qDebug() << "Call found" << call;
61
call->stateChanged(state);
63
//updateWindowCallState(); //NEED_PORT
64
emit callStateChanged(call);
68
void CallModelBase::on1_incomingCall(const QString & accountID, const QString & callID)
71
qDebug() << "Signal : Incoming Call ! ID = " << callID;
72
Call* call = addIncomingCall(callID);
75
// SFLPhone::app()->activateWindow();
76
// SFLPhone::app()->raise();
77
// SFLPhone::app()->setVisible(true);
79
//emit incomingCall(call);
80
emit incomingCall(call);
83
void CallModelBase::on1_incomingConference(const QString &confID)
85
Call* conf = addConference(confID);
86
qDebug() << "---------------Adding conference" << conf << confID << "---------------";
87
emit conferenceCreated(conf);
90
void CallModelBase::on1_changingConference(const QString &confID, const QString &state)
92
Call* conf = getCall(confID);
93
qDebug() << "Changing conference state" << conf << confID;
95
changeConference(confID, state);
96
emit conferenceChanged(conf);
99
qDebug() << "Trying to affect a conference that does not exist (anymore)";
103
void CallModelBase::on1_conferenceRemoved(const QString &confId)
105
Call* conf = getCall(confId);
106
emit aboutToRemoveConference(conf);
107
removeConference(confId);
108
emit conferenceRemoved(confId);
111
void CallModelBase::on1_voiceMailNotify(const QString &accountID, int count)
113
qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID;
114
emit voiceMailNotify(accountID,count);
117
void CallModelBase::on1_volumeChanged(const QString & device, double value)
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);
127
Call* CallModelBase::addCall(Call* call, Call* parent)
129
emit callAdded(call,parent);
133
//More code in CallModel.hpp
b'\\ No newline at end of file'