mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Update enums to SDK master's wrapper.
This commit is contained in:
parent
ea5ef9276a
commit
de9f2fe6cb
17 changed files with 313 additions and 171 deletions
|
|
@ -54,7 +54,7 @@ project(linphoneqt)
|
|||
include(GNUInstallDirs)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Prepare gobal CMAKE configuration specific to the current project
|
||||
set(SDK_BUILD_DIR "${CMAKE_BINARY_DIR}/WORK") # SDK build in WORK. Keep all in it.
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ set(SOURCES
|
|||
src/components/content/ContentListModel.cpp
|
||||
src/components/content/ContentProxyModel.cpp
|
||||
src/components/core/CoreHandlers.cpp
|
||||
src/components/core/CoreListener.cpp
|
||||
src/components/core/CoreManager.cpp
|
||||
src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp
|
||||
src/components/file/FileDownloader.cpp
|
||||
|
|
@ -382,6 +383,7 @@ set(HEADERS
|
|||
src/components/content/ContentListModel.hpp
|
||||
src/components/content/ContentProxyModel.hpp
|
||||
src/components/core/CoreHandlers.hpp
|
||||
src/components/core/CoreListener.hpp
|
||||
src/components/core/CoreManager.hpp
|
||||
src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp
|
||||
src/components/file/FileDownloader.hpp
|
||||
|
|
|
|||
|
|
@ -517,11 +517,12 @@ static void joinConference (const shared_ptr<linphone::Call> &call) {
|
|||
|
||||
ConferenceHelperModel helperModel;
|
||||
ConferenceHelperModel::ConferenceAddModel *addModel = helperModel.getConferenceAddModel();
|
||||
|
||||
CallModel *callModel = &call->getData<CallModel>("call-model");
|
||||
callModel->accept();
|
||||
addModel->addToConference(call->getRemoteAddress());
|
||||
addModel->update();
|
||||
if(call->dataExists("call-model")){
|
||||
CallModel *callModel = &call->getData<CallModel>("call-model");
|
||||
callModel->accept();
|
||||
addModel->addToConference(call->getRemoteAddress());
|
||||
addModel->update();
|
||||
}
|
||||
}
|
||||
|
||||
// Global handler on core (is call before call model receive it). Used for model creation.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ private:
|
|||
void removeCall (const std::shared_ptr<linphone::Call> &call);
|
||||
void removeCallCb (CallModel *callModel);
|
||||
|
||||
std::shared_ptr<CoreHandlers> mCoreHandlers;
|
||||
QSharedPointer<CoreHandlers> mCoreHandlers;
|
||||
};
|
||||
|
||||
#endif // CALLS_LIST_MODEL_H_
|
||||
|
|
|
|||
|
|
@ -594,7 +594,8 @@ void ChatRoomModel::addMissedCallsCount(std::shared_ptr<linphone::Call> call){
|
|||
auto timeline = CoreManager::getInstance()->getTimelineListModel()->getTimeline(mChatRoom, false);
|
||||
if(!timeline || !timeline->mSelected){
|
||||
setMissedCallsCount(mMissedCallsCount+1);
|
||||
CoreManager::getInstance()->getEventCountNotifier()->handleCallMissed(&call->getData<CallModel>("call-model"));
|
||||
if(call->dataExists("call-model"))
|
||||
CoreManager::getInstance()->getEventCountNotifier()->handleCallMissed(&call->getData<CallModel>("call-model"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ private:
|
|||
|
||||
std::shared_ptr<linphone::ChatRoom> mChatRoom;
|
||||
std::shared_ptr<ChatRoomListener> mChatRoomListener; // This need to be a shared_ptr because of adding it to linphone
|
||||
std::shared_ptr<CoreHandlers> mCoreHandlers; // This need to be a shared_ptr because of adding it to linphone
|
||||
QSharedPointer<CoreHandlers> mCoreHandlers;
|
||||
|
||||
QMap<std::shared_ptr<const linphone::Address>, QString> mComposers; // Store all addresses that are composing with its username
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "CoreHandlers.hpp"
|
||||
#include "CoreListener.hpp"
|
||||
#include "CoreManager.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -42,14 +43,51 @@
|
|||
using namespace std;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CoreHandlers::connectTo(CoreListener * listener){
|
||||
connect(listener, &CoreListener::accountRegistrationStateChanged, this, &CoreHandlers::onAccountRegistrationStateChanged);
|
||||
connect(listener, &CoreListener::authenticationRequested, this, &CoreHandlers::onAuthenticationRequested);
|
||||
connect(listener, &CoreListener::callEncryptionChanged, this, &CoreHandlers::onCallEncryptionChanged);
|
||||
connect(listener, &CoreListener::callLogUpdated, this, &CoreHandlers::onCallLogUpdated);
|
||||
connect(listener, &CoreListener::callStateChanged, this, &CoreHandlers::onCallStateChanged);
|
||||
connect(listener, &CoreListener::callStatsUpdated, this, &CoreHandlers::onCallStatsUpdated);
|
||||
connect(listener, &CoreListener::callCreated, this, &CoreHandlers::onCallCreated);
|
||||
connect(listener, &CoreListener::chatRoomRead, this, &CoreHandlers::onChatRoomRead);
|
||||
connect(listener, &CoreListener::chatRoomStateChanged, this, &CoreHandlers::onChatRoomStateChanged);
|
||||
connect(listener, &CoreListener::configuringStatus, this, &CoreHandlers::onConfiguringStatus);
|
||||
connect(listener, &CoreListener::dtmfReceived, this, &CoreHandlers::onDtmfReceived);
|
||||
connect(listener, &CoreListener::globalStateChanged, this, &CoreHandlers::onGlobalStateChanged);
|
||||
connect(listener, &CoreListener::isComposingReceived, this, &CoreHandlers::onIsComposingReceived);
|
||||
connect(listener, &CoreListener::logCollectionUploadStateChanged, this, &CoreHandlers::onLogCollectionUploadStateChanged);
|
||||
connect(listener, &CoreListener::logCollectionUploadProgressIndication, this, &CoreHandlers::onLogCollectionUploadProgressIndication);
|
||||
connect(listener, &CoreListener::messageReceived, this, &CoreHandlers::onMessageReceived);
|
||||
connect(listener, &CoreListener::messagesReceived, this, &CoreHandlers::onMessagesReceived);
|
||||
connect(listener, &CoreListener::notifyPresenceReceivedForUriOrTel, this, &CoreHandlers::onNotifyPresenceReceivedForUriOrTel);
|
||||
connect(listener, &CoreListener::notifyPresenceReceived, this, &CoreHandlers::onNotifyPresenceReceived);
|
||||
connect(listener, &CoreListener::qrcodeFound, this, &CoreHandlers::onQrcodeFound);
|
||||
connect(listener, &CoreListener::transferStateChanged, this, &CoreHandlers::onTransferStateChanged);
|
||||
connect(listener, &CoreListener::versionUpdateCheckResultReceived, this, &CoreHandlers::onVersionUpdateCheckResultReceived);
|
||||
connect(listener, &CoreListener::ecCalibrationResult, this, &CoreHandlers::onEcCalibrationResult);
|
||||
connect(listener, &CoreListener::conferenceInfoReceived, this, &CoreHandlers::onConferenceInfoReceived);
|
||||
|
||||
}
|
||||
|
||||
|
||||
CoreHandlers::CoreHandlers (CoreManager *coreManager) {
|
||||
Q_UNUSED(coreManager)
|
||||
mCoreListener = std::make_shared<CoreListener>();
|
||||
connectTo(mCoreListener.get());
|
||||
}
|
||||
|
||||
CoreHandlers::~CoreHandlers () {
|
||||
}
|
||||
|
||||
void CoreHandlers::setListener(std::shared_ptr<linphone::Core> core){
|
||||
core->addListener(mCoreListener);
|
||||
}
|
||||
void CoreHandlers::removeListener(std::shared_ptr<linphone::Core> core){
|
||||
core->removeListener(mCoreListener);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void CoreHandlers::onAccountRegistrationStateChanged (
|
||||
const shared_ptr<linphone::Core> &,
|
||||
|
|
@ -118,7 +156,8 @@ void CoreHandlers::onCallStatsUpdated (
|
|||
const shared_ptr<linphone::Call> &call,
|
||||
const shared_ptr<const linphone::CallStats> &stats
|
||||
) {
|
||||
call->getData<CallModel>("call-model").updateStats(stats);
|
||||
if(call->dataExists("call-model"))
|
||||
call->getData<CallModel>("call-model").updateStats(stats);
|
||||
}
|
||||
|
||||
void CoreHandlers::onCallCreated(const shared_ptr<linphone::Core> &,
|
||||
|
|
|
|||
|
|
@ -26,12 +26,11 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
class CoreListener;
|
||||
class CoreManager;
|
||||
class QMutex;
|
||||
|
||||
class CoreHandlers :
|
||||
public QObject,
|
||||
public linphone::CoreListener {
|
||||
class CoreHandlers : public QObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
|
@ -61,138 +60,42 @@ signals:
|
|||
void setLastRemoteProvisioningState(const linphone::Config::ConfiguringState &state);
|
||||
void conferenceInfoReceived(const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo);
|
||||
void foundQRCode(const std::string & result);
|
||||
|
||||
//-------------------- CORE HANDLER
|
||||
|
||||
public slots:
|
||||
|
||||
void onAccountRegistrationStateChanged(const std::shared_ptr<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message);
|
||||
void onAuthenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method);
|
||||
void onCallEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken);
|
||||
void onCallLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog);
|
||||
void onCallStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message);
|
||||
void onCallStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats);
|
||||
void onCallCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call);
|
||||
void onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom);
|
||||
void onChatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state);
|
||||
void onConfiguringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message);
|
||||
void onDtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf);
|
||||
void onGlobalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message);
|
||||
void onIsComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room);
|
||||
void onLogCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info);
|
||||
void onLogCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total);
|
||||
void onMessageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
void onMessagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages);
|
||||
void onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel);
|
||||
void onNotifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend);
|
||||
void onQrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result);
|
||||
void onTransferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state);
|
||||
void onVersionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url);
|
||||
void onEcCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs);
|
||||
void onConferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo);
|
||||
|
||||
void setListener(std::shared_ptr<linphone::Core> core);
|
||||
void removeListener(std::shared_ptr<linphone::Core> core);
|
||||
|
||||
private:
|
||||
// ---------------------------------------------------------------------------
|
||||
// Linphone callbacks.
|
||||
// ---------------------------------------------------------------------------
|
||||
void onAccountRegistrationStateChanged(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
const std::shared_ptr<linphone::Account> & account,
|
||||
linphone::RegistrationState state,
|
||||
const std::string & message) override;
|
||||
|
||||
void onAuthenticationRequested (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::AuthInfo> &authInfo,
|
||||
linphone::AuthMethod method
|
||||
) override;
|
||||
|
||||
void onCallEncryptionChanged (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Call> &call,
|
||||
bool on,
|
||||
const std::string &authenticationToken
|
||||
) override;
|
||||
|
||||
void onCallLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog) override;
|
||||
|
||||
void onCallStateChanged (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Call> &call,
|
||||
linphone::Call::State state,
|
||||
const std::string &message
|
||||
) override;
|
||||
|
||||
void onCallStatsUpdated (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Call> &call,
|
||||
const std::shared_ptr<const linphone::CallStats> &stats
|
||||
) override;
|
||||
|
||||
void onCallCreated(
|
||||
const std::shared_ptr<linphone::Core> & lc,
|
||||
const std::shared_ptr<linphone::Call> & call
|
||||
) override;
|
||||
|
||||
void onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom) override;
|
||||
|
||||
void onChatRoomStateChanged(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
const std::shared_ptr<linphone::ChatRoom> & chatRoom,
|
||||
linphone::ChatRoom::State state
|
||||
) override;
|
||||
|
||||
void onConfiguringStatus(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
linphone::Config::ConfiguringState status,
|
||||
const std::string & message) override;
|
||||
|
||||
void onDtmfReceived(
|
||||
const std::shared_ptr<linphone::Core> & lc,
|
||||
const std::shared_ptr<linphone::Call> & call,
|
||||
int dtmf)override;
|
||||
|
||||
void onGlobalStateChanged (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
linphone::GlobalState gstate,
|
||||
const std::string &message
|
||||
) override;
|
||||
|
||||
void onIsComposingReceived (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::ChatRoom> &room
|
||||
) override;
|
||||
|
||||
void onLogCollectionUploadStateChanged (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
linphone::Core::LogCollectionUploadState state,
|
||||
const std::string &info
|
||||
) override;
|
||||
|
||||
void onLogCollectionUploadProgressIndication (
|
||||
const std::shared_ptr<linphone::Core> &lc,
|
||||
size_t offset,
|
||||
size_t total
|
||||
) override;
|
||||
|
||||
void onMessageReceived (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||
const std::shared_ptr<linphone::ChatMessage> &message
|
||||
) override;
|
||||
|
||||
void onMessagesReceived (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||
const std::list<std::shared_ptr<linphone::ChatMessage>> &messages
|
||||
) override;
|
||||
|
||||
void onNotifyPresenceReceivedForUriOrTel (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Friend> &linphoneFriend,
|
||||
const std::string &uriOrTel,
|
||||
const std::shared_ptr<const linphone::PresenceModel> &presenceModel
|
||||
) override;
|
||||
|
||||
void onNotifyPresenceReceived (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Friend> &linphoneFriend
|
||||
) override;
|
||||
|
||||
void onQrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result) override;
|
||||
|
||||
void onTransferStateChanged (
|
||||
const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Call> &call,
|
||||
linphone::Call::State state
|
||||
) override;
|
||||
|
||||
void onVersionUpdateCheckResultReceived (
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
linphone::VersionUpdateCheckResult result,
|
||||
const std::string &version,
|
||||
const std::string &url
|
||||
) override;
|
||||
|
||||
void onEcCalibrationResult(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
linphone::EcCalibratorStatus status,
|
||||
int delayMs
|
||||
) override;
|
||||
|
||||
// Conference Info
|
||||
virtual void onConferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo) override;
|
||||
void connectTo(CoreListener * listener);
|
||||
std::shared_ptr<CoreListener> mCoreListener; // This need to be a shared_ptr because of adding it to linphone
|
||||
};
|
||||
|
||||
#endif // CORE_HANDLERS_H_
|
||||
|
|
|
|||
104
linphone-app/src/components/core/CoreListener.cpp
Normal file
104
linphone-app/src/components/core/CoreListener.cpp
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2020 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CoreListener.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
CoreListener::CoreListener(QObject * parent): QObject(parent){
|
||||
}
|
||||
CoreListener::~CoreListener(){
|
||||
}
|
||||
|
||||
void CoreListener::onAccountRegistrationStateChanged(const std::shared_ptr<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message){
|
||||
emit accountRegistrationStateChanged(core,account,state,message);
|
||||
}
|
||||
void CoreListener::onAuthenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method){
|
||||
emit authenticationRequested (core,authInfo,method);
|
||||
}
|
||||
void CoreListener::onCallEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken){
|
||||
emit callEncryptionChanged (core,call,on,authenticationToken);
|
||||
}
|
||||
void CoreListener::onCallLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog){
|
||||
emit callLogUpdated(core, callLog);
|
||||
}
|
||||
void CoreListener::onCallStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message){
|
||||
emit callStateChanged (core,call,state,message);
|
||||
}
|
||||
void CoreListener::onCallStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats){
|
||||
emit callStatsUpdated (core,call,stats);
|
||||
}
|
||||
void CoreListener::onCallCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call){
|
||||
emit callCreated(lc,call);
|
||||
}
|
||||
void CoreListener::onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom){
|
||||
emit chatRoomRead(core, chatRoom);
|
||||
}
|
||||
void CoreListener::onChatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state){
|
||||
emit chatRoomStateChanged(core, chatRoom,state);
|
||||
}
|
||||
void CoreListener::onConfiguringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message){
|
||||
emit configuringStatus(core,status,message);
|
||||
}
|
||||
void CoreListener::onDtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf){
|
||||
emit dtmfReceived(lc,call,dtmf);
|
||||
}
|
||||
void CoreListener::onGlobalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message){
|
||||
emit globalStateChanged (core,gstate,message);
|
||||
}
|
||||
void CoreListener::onIsComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room){
|
||||
emit isComposingReceived (core,room);
|
||||
}
|
||||
void CoreListener::onLogCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info){
|
||||
emit logCollectionUploadStateChanged (core,state,info);
|
||||
}
|
||||
void CoreListener::onLogCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total){
|
||||
emit logCollectionUploadProgressIndication (lc,offset,total);
|
||||
}
|
||||
void CoreListener::onMessageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message){
|
||||
emit messageReceived (core,room,message);
|
||||
}
|
||||
void CoreListener::onMessagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages){
|
||||
emit messagesReceived (core,room,messages);
|
||||
}
|
||||
void CoreListener::onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel){
|
||||
emit notifyPresenceReceivedForUriOrTel (core,linphoneFriend,uriOrTel,presenceModel);
|
||||
}
|
||||
void CoreListener::onNotifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend){
|
||||
emit notifyPresenceReceived (core,linphoneFriend);
|
||||
}
|
||||
void CoreListener::onQrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result){
|
||||
emit qrcodeFound(core, result);
|
||||
}
|
||||
void CoreListener::onTransferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state){
|
||||
emit transferStateChanged (core,call,state);
|
||||
}
|
||||
void CoreListener::onVersionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url){
|
||||
emit versionUpdateCheckResultReceived (core,result,version,url);
|
||||
}
|
||||
void CoreListener::onEcCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs){
|
||||
emit ecCalibrationResult(core,status,delayMs);
|
||||
}
|
||||
void CoreListener::onConferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo){
|
||||
emit conferenceInfoReceived(core, conferenceInfo);
|
||||
}
|
||||
90
linphone-app/src/components/core/CoreListener.hpp
Normal file
90
linphone-app/src/components/core/CoreListener.hpp
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CORE_LISTENER_H_
|
||||
#define CORE_LISTENER_H_
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QObject>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
class CoreManager;
|
||||
class QMutex;
|
||||
|
||||
class CoreListener : public QObject, public linphone::CoreListener {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CoreListener (QObject * parent = nullptr);
|
||||
virtual ~CoreListener ();
|
||||
|
||||
virtual void onAccountRegistrationStateChanged(const std::shared_ptr<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message) override;
|
||||
virtual void onAuthenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method) override;
|
||||
virtual void onCallEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken) override;
|
||||
virtual void onCallLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog) override;
|
||||
virtual void onCallStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message) override;
|
||||
virtual void onCallStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats) override;
|
||||
virtual void onCallCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call) override;
|
||||
virtual void onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom) override;
|
||||
virtual void onChatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state) override;
|
||||
virtual void onConfiguringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message) override;
|
||||
virtual void onDtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf) override;
|
||||
virtual void onGlobalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message) override;
|
||||
virtual void onIsComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room) override;
|
||||
virtual void onLogCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info) override;
|
||||
virtual void onLogCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total) override;
|
||||
virtual void onMessageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message) override;
|
||||
virtual void onMessagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages) override;
|
||||
virtual void onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel) override;
|
||||
virtual void onNotifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend) override;
|
||||
virtual void onQrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result) override;
|
||||
virtual void onTransferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state) override;
|
||||
virtual void onVersionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url) override;
|
||||
virtual void onEcCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs) override;
|
||||
virtual void onConferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo) override;
|
||||
|
||||
signals:
|
||||
void accountRegistrationStateChanged(const std::shared_ptr<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message);
|
||||
void authenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method);
|
||||
void callEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken);
|
||||
void callLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog);
|
||||
void callStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message);
|
||||
void callStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats);
|
||||
void callCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call);
|
||||
void chatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom);
|
||||
void chatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state);
|
||||
void configuringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message);
|
||||
void dtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf);
|
||||
void globalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message);
|
||||
void isComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room);
|
||||
void logCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info);
|
||||
void logCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total);
|
||||
void messageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
void messagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages);
|
||||
void notifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel);
|
||||
void notifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend);
|
||||
void qrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result);
|
||||
void transferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state);
|
||||
void versionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url);
|
||||
void ecCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs);
|
||||
void conferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -67,7 +67,8 @@ using namespace std;
|
|||
CoreManager *CoreManager::mInstance=nullptr;
|
||||
|
||||
CoreManager::CoreManager (QObject *parent, const QString &configPath) :
|
||||
QObject(parent), mHandlers(make_shared<CoreHandlers>(this)) {
|
||||
QObject(parent) {
|
||||
mHandlers = QSharedPointer<CoreHandlers>::create(this);
|
||||
mCore = nullptr;
|
||||
mLastRemoteProvisioningState = linphone::Config::ConfiguringState::Skipped;
|
||||
CoreHandlers *coreHandlers = mHandlers.get();
|
||||
|
|
@ -84,7 +85,7 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) :
|
|||
}
|
||||
|
||||
CoreManager::~CoreManager(){
|
||||
mCore->removeListener(mHandlers);
|
||||
mHandlers->removeListener(mCore);
|
||||
mHandlers = nullptr;// Ordering Call destructor just to be sure (removeListener should be enough)
|
||||
mCore = nullptr;
|
||||
}
|
||||
|
|
@ -270,8 +271,7 @@ void CoreManager::createLinphoneCore (const QString &configPath) {
|
|||
// Enable LIME on your core to use encryption.
|
||||
mCore->enableLimeX3Dh(mCore->limeX3DhAvailable());
|
||||
// Now see the CoreService.CreateGroupChatRoom to see how to create a secure chat room
|
||||
|
||||
mCore->addListener(mHandlers);
|
||||
mHandlers->setListener(mCore);
|
||||
mCore->setVideoDisplayFilter("MSQOGL");
|
||||
mCore->usePreviewWindow(true);
|
||||
// Force capture/display.
|
||||
|
|
@ -433,10 +433,10 @@ void CoreManager::stopIterate(){
|
|||
}
|
||||
|
||||
void CoreManager::iterate () {
|
||||
lockVideoRender();
|
||||
//lockVideoRender();
|
||||
if(mCore)
|
||||
mCore->iterate();
|
||||
unlockVideoRender();
|
||||
//unlockVideoRender();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <QString>
|
||||
#include <QHash>
|
||||
#include <QMutex>
|
||||
#include <QSharedPointer>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ public:
|
|||
return mCore;
|
||||
}
|
||||
|
||||
std::shared_ptr<CoreHandlers> getHandlers () {
|
||||
QSharedPointer<CoreHandlers> getHandlers () {
|
||||
Q_CHECK_PTR(mHandlers);
|
||||
return mHandlers;
|
||||
}
|
||||
|
|
@ -215,7 +216,7 @@ private:
|
|||
static QString getDownloadUrl ();
|
||||
|
||||
std::shared_ptr<linphone::Core> mCore;
|
||||
std::shared_ptr<CoreHandlers> mHandlers; // It is used for handling linphone. Keep it to shared_ptr.
|
||||
QSharedPointer<CoreHandlers> mHandlers;
|
||||
|
||||
bool mStarted = false;
|
||||
linphone::Config::ConfiguringState mLastRemoteProvisioningState;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QAbstractListModel>
|
||||
#include <QSharedPointer>
|
||||
|
||||
// =============================================================================
|
||||
// Fetch all N messages of the History.
|
||||
|
|
@ -92,7 +93,7 @@ private:
|
|||
|
||||
mutable QList<HistoryEntryData> mEntries;
|
||||
|
||||
std::shared_ptr<CoreHandlers> mCoreHandlers;
|
||||
QSharedPointer<CoreHandlers> mCoreHandlers;
|
||||
};
|
||||
|
||||
#endif // HISTORY_MODEL_H_
|
||||
|
|
|
|||
|
|
@ -326,19 +326,20 @@ void Notifier::notifyReceivedFileMessage (const shared_ptr<linphone::ChatMessage
|
|||
}
|
||||
|
||||
void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) {
|
||||
CallModel *callModel = &call->getData<CallModel>("call-model");
|
||||
QVariantMap map;
|
||||
map["call"].setValue(callModel);
|
||||
CREATE_NOTIFICATION(Notifier::ReceivedCall, map)
|
||||
|
||||
QObject::connect(callModel, &CallModel::statusChanged, notification, [this, notification](CallModel::CallStatus status) {
|
||||
if (status == CallModel::CallStatusEnded || status == CallModel::CallStatusConnected)
|
||||
deleteNotification(QVariant::fromValue(notification));
|
||||
});
|
||||
QObject::connect(callModel, &CallModel::destroyed, notification, [this, notification]() {
|
||||
deleteNotification(QVariant::fromValue(notification));
|
||||
});
|
||||
|
||||
if(call->dataExists("call-model")){
|
||||
CallModel *callModel = &call->getData<CallModel>("call-model");
|
||||
QVariantMap map;
|
||||
map["call"].setValue(callModel);
|
||||
CREATE_NOTIFICATION(Notifier::ReceivedCall, map)
|
||||
|
||||
QObject::connect(callModel, &CallModel::statusChanged, notification, [this, notification](CallModel::CallStatus status) {
|
||||
if (status == CallModel::CallStatusEnded || status == CallModel::CallStatusConnected)
|
||||
deleteNotification(QVariant::fromValue(notification));
|
||||
});
|
||||
QObject::connect(callModel, &CallModel::destroyed, notification, [this, notification]() {
|
||||
deleteNotification(QVariant::fromValue(notification));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Notifier::notifyNewVersionAvailable (const QString &version, const QString &url) {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ private:
|
|||
|
||||
QMultiHash<QString, SipAddressObserver *> mObservers;
|
||||
|
||||
std::shared_ptr<CoreHandlers> mCoreHandlers;
|
||||
QSharedPointer<CoreHandlers> mCoreHandlers;
|
||||
};
|
||||
|
||||
using LocalAddressToConferenceEntry = QHash<QString, SipAddressesModel::ConferenceEntry>;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void LinphoneEnums::registerMetaTypes(){
|
|||
qRegisterMetaType<std::shared_ptr<linphone::Call>>();
|
||||
qRegisterMetaType<linphone::Call::State>();
|
||||
qRegisterMetaType<std::shared_ptr<linphone::Core>>();
|
||||
qRegisterMetaType<linphone::ConfiguringState>();
|
||||
qRegisterMetaType<linphone::Config::ConfiguringState>();
|
||||
qRegisterMetaType<std::string>();
|
||||
qRegisterMetaType<linphone::GlobalState>();
|
||||
qRegisterMetaType<std::shared_ptr<linphone::ChatRoom>>();
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ Q_DECLARE_METATYPE(LinphoneEnums::TransportType)
|
|||
Q_DECLARE_METATYPE(std::shared_ptr<linphone::Call>)
|
||||
Q_DECLARE_METATYPE(linphone::Call::State)
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<linphone::Core>)
|
||||
Q_DECLARE_METATYPE(linphone::ConfiguringState)
|
||||
Q_DECLARE_METATYPE(linphone::Config::ConfiguringState)
|
||||
Q_DECLARE_METATYPE(std::string)
|
||||
Q_DECLARE_METATYPE(linphone::GlobalState)
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<linphone::ChatRoom>)
|
||||
|
|
@ -246,5 +246,4 @@ Q_DECLARE_METATYPE(std::shared_ptr<const linphone::CallStats>)
|
|||
Q_DECLARE_METATYPE(std::shared_ptr<linphone::EventLog>)
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<linphone::ChatMessage>)
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue