diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6c79b22667b094dfa3c5499ecb206be4e6cddaff..c5a17cc941e967e1d74ea738d90564eb5b12182e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,10 +40,10 @@ set( qtsflphone_LIB_SRCS credentialmodel.cpp audiocodecmodel.cpp instantmessagingmodel.cpp - configurationmanager_interface_singleton.cpp - callmanager_interface_singleton.cpp - instance_interface_singleton.cpp - video_interface_singleton.cpp + dbus/configurationmanager.cpp + dbus/callmanager.cpp + dbus/instancemanager.cpp + dbus/videomanager.cpp sflphone_const.h contactproxymodel.cpp ) @@ -134,13 +134,8 @@ set( qtsflphone_LIB_HDRS videorenderer.h credentialmodel.h audiocodecmodel.h - configurationmanager_interface_singleton.h - callmanager_interface_singleton.h - instance_interface_singleton.h - video_interface_singleton.h sflphone_const.h instantmessagingmodel.h - typedefs.h contactproxymodel.h ) diff --git a/src/account.cpp b/src/account.cpp index ff983e90e51d2461bbda1d8d065049553051f2b4..ac908acbd8cfe6e9c633c1653b86d32274174ff4 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -28,9 +28,9 @@ #include "sflphone_const.h" //SFLPhone lib -#include "configurationmanager_interface_singleton.h" -#include "callmanager_interface_singleton.h" -#include "video_interface_singleton.h" +#include "dbus/configurationmanager.h" +#include "dbus/callmanager.h" +#include "dbus/videomanager.h" #include "accountlist.h" #include "credentialmodel.h" #include "audiocodecmodel.h" @@ -86,7 +86,7 @@ const QString& account_state_name(const QString& s) Account::Account():m_pAccountId(nullptr),m_pCredentials(nullptr),m_pAudioCodecs(nullptr),m_CurrentState(READY), m_pVideoCodecs(nullptr) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); connect(&callManager,SIGNAL(registrationStateChanged(QString,QString,int)),this,SLOT(accountChanged(QString,QString,int))); } @@ -106,7 +106,7 @@ Account* Account::buildExistingAccountFromId(const QString& _accountId) Account* Account::buildNewAccountFromAlias(const QString& alias) { qDebug() << "Building an account from alias: " << alias; - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); Account* a = new Account(); a->m_hAccountDetails.clear(); MapStringString tmp = configurationManager.getAccountTemplate(); @@ -224,9 +224,9 @@ bool Account::isRegistered() const ///Return the model index of this item QModelIndex Account::getIndex() { - for (int i=0;i < AccountList::getInstance()->m_pAccounts->size();i++) { - if (this == (*AccountList::getInstance()->m_pAccounts)[i]) { - return AccountList::getInstance()->index(i,0); + for (int i=0;i < AccountList::instance()->m_pAccounts->size();i++) { + if (this == (*AccountList::instance()->m_pAccounts)[i]) { + return AccountList::instance()->index(i,0); } } return QModelIndex(); @@ -826,7 +826,7 @@ AccountEditState Account::currentState() const bool Account::updateState() { if(! isNew()) { - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface & configurationManager = DBus::ConfigurationManager::instance(); const MapStringString details = configurationManager.getAccountDetails(getAccountId()).value(); const QString status = details[ACCOUNT_REGISTRATION_STATUS]; const QString currentStatus = getAccountRegistrationStatus(); @@ -839,7 +839,7 @@ bool Account::updateState() ///Save the current account to the daemon void Account::save() { - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); if (isNew()) { MapStringString details; QMutableHashIterator<QString,QString> iter(m_hAccountDetails); @@ -880,10 +880,10 @@ void Account::save() //QString id = configurationManager.getAccountDetail(getAccountId()); if (!getAccountId().isEmpty()) { - Account* acc = AccountList::getInstance()->getAccountById(getAccountId()); + Account* acc = AccountList::instance()->getAccountById(getAccountId()); qDebug() << "Adding the new account to the account list (" << getAccountId() << ")"; if (acc != this) { - (*AccountList::getInstance()->m_pAccounts) << this; + (*AccountList::instance()->m_pAccounts) << this; } performAction(AccountEditAction::RELOAD); @@ -901,7 +901,7 @@ void Account::save() void Account::reload() { qDebug() << "Reloading" << getAccountId(); - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); QMap<QString,QString> aDetails = configurationManager.getAccountDetails(getAccountId()); if (!aDetails.count()) { @@ -929,7 +929,7 @@ void Account::reloadCredentials() } if (!isNew()) { m_pCredentials->clear(); - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); VectorMapStringString credentials = configurationManager.getCredentials(getAccountId()); for (int i=0; i < credentials.size(); i++) { QModelIndex idx = m_pCredentials->addCredentials(); @@ -943,7 +943,7 @@ void Account::reloadCredentials() ///Save all credentials void Account::saveCredentials() { if (m_pCredentials) { - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); VectorMapStringString toReturn; for (int i=0; i < m_pCredentials->rowCount();i++) { QModelIndex idx = m_pCredentials->index(i,0); @@ -974,7 +974,7 @@ void Account::reloadAudioCodecs() m_pAudioCodecs = new AudioCodecModel(this); } m_pAudioCodecs->clear(); - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); QVector<int> codecIdList = configurationManager.getAudioCodecList(); if (!isNew()) { QVector<int> activeCodecList = configurationManager.getActiveAudioCodecList(getAccountId()); @@ -1016,7 +1016,7 @@ void Account::saveAudioCodecs() { } } - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface & configurationManager = DBus::ConfigurationManager::instance(); configurationManager.setActiveAudioCodecList(_codecList, getAccountId()); } } @@ -1043,7 +1043,7 @@ bool Account::operator==(const Account& a)const void Account::setActiveVideoCodecList(const QList<VideoCodec*>& codecs) { QStringList codecs2; - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); foreach(VideoCodec* codec,codecs) { codecs2 << codecs->getName(); } @@ -1054,7 +1054,7 @@ void Account::setActiveVideoCodecList(const QList<VideoCodec*>& codecs) QList<VideoCodec*> Account::getActiveVideoCodecList() { QList<VideoCodec*> codecs; - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); const QStringList activeCodecList = interface.getActiveCodecList(m_pAccountId); foreach (const QString& codec, activeCodecList) { codecs << VideoCodec::getCodec(codec); diff --git a/src/accountlist.cpp b/src/accountlist.cpp index d8c17af491f55f58a35f49c7b7f94320c8ae1128..e284e8638b64ff04966c13db4d7c085fec11fa15 100644 --- a/src/accountlist.cpp +++ b/src/accountlist.cpp @@ -27,8 +27,8 @@ #include <QtCore/QObject> //SFLPhone library -#include "configurationmanager_interface_singleton.h" -#include "callmanager_interface_singleton.h" +#include "dbus/configurationmanager.h" +#include "dbus/callmanager.h" AccountList* AccountList::m_spAccountList = nullptr; Account* AccountList::m_spPriorAccount = nullptr ; @@ -38,19 +38,19 @@ QVariant AccountListNoCheckProxyModel::data(const QModelIndex& idx,int role ) co if (role == Qt::CheckStateRole) { return QVariant(); } - return AccountList::getInstance()->data(idx,role); + return AccountList::instance()->data(idx,role); } bool AccountListNoCheckProxyModel::setData( const QModelIndex& idx, const QVariant &value, int role) { - return AccountList::getInstance()->setData(idx,value,role); + return AccountList::instance()->setData(idx,value,role); } Qt::ItemFlags AccountListNoCheckProxyModel::flags (const QModelIndex& idx) const { - return AccountList::getInstance()->flags(idx); + return AccountList::instance()->flags(idx); } int AccountListNoCheckProxyModel::rowCount(const QModelIndex& parentIdx ) const { - return AccountList::getInstance()->rowCount(parentIdx); + return AccountList::instance()->rowCount(parentIdx); } ///Constructors @@ -63,8 +63,8 @@ AccountList::AccountList(QStringList & _accountIds) : m_pColorVisitor(nullptr),m emit dataChanged(index(size()-1,0),index(size()-1,0)); connect(a,SIGNAL(changed(Account*)),this,SLOT(accountChanged(Account*))); } - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); connect(&callManager , SIGNAL(registrationStateChanged(QString,QString,int)) ,this,SLOT(accountChanged(QString,QString,int))); connect(&configurationManager, SIGNAL(accountsChanged()) ,this,SLOT(updateAccounts()) ); @@ -77,8 +77,8 @@ AccountList::AccountList(bool fill) : m_pColorVisitor(nullptr),m_pDefaultAccount m_pAccounts = new QVector<Account *>(); if(fill) updateAccounts(); - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); connect(&callManager , SIGNAL(registrationStateChanged(QString,QString,int)),this,SLOT(accountChanged(QString,QString,int))); connect(&configurationManager, SIGNAL(accountsChanged()) ,this,SLOT(updateAccounts()) ); @@ -94,7 +94,7 @@ AccountList::~AccountList() } ///Singleton -AccountList* AccountList::getInstance() +AccountList* AccountList::instance() { if (not m_spAccountList) { m_spAccountList = new AccountList(true); @@ -117,7 +117,7 @@ void AccountList::accountChanged(const QString& account,const QString& state, in qDebug() << "Account status changed"; Account* a = getAccountById(account); if (!a) { - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); QStringList accountIds = configurationManager.getAccountList().value(); for (int i = 0; i < accountIds.size(); ++i) { if (!getAccountById(accountIds[i])) { @@ -160,7 +160,7 @@ void AccountList::accountChanged(Account* a) ///Update accounts void AccountList::update() { - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface & configurationManager = DBus::ConfigurationManager::instance(); Account* current; for (int i = 0; i < m_pAccounts->size(); i++) { current = (*m_pAccounts)[i]; @@ -181,7 +181,7 @@ void AccountList::update() void AccountList::updateAccounts() { qDebug() << "updateAccounts"; - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); QStringList accountIds = configurationManager.getAccountList().value(); //m_pAccounts->clear(); for (int i = 0; i < accountIds.size(); ++i) { @@ -203,7 +203,7 @@ void AccountList::updateAccounts() ///Save accounts details and reload it void AccountList::save() { - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); QStringList accountIds= QStringList(configurationManager.getAccountList().value()); //create or update each account from accountList @@ -254,7 +254,7 @@ bool AccountList::accountDown( int idx ) ///Try to register all enabled accounts void AccountList::registerAllAccounts() { - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); configurationManager.registerAllAccounts(); } @@ -365,10 +365,10 @@ Account* AccountList::getCurrentAccount() return priorAccount; } else { - Account* a = getInstance()->firstRegisteredAccount(); + Account* a = instance()->firstRegisteredAccount(); if (!a) - a = getInstance()->getAccountById("IP2IP"); - getInstance()->setPriorAccount(a); + a = instance()->getAccountById("IP2IP"); + instance()->setPriorAccount(a); return a; } } //getCurrentAccount @@ -433,14 +433,14 @@ Account* AccountList::getDefaultAccount() const QString AccountList::getSimilarAliasIndex(const QString& alias) { int count = 0; - foreach (Account* a, getInstance()->getAccounts()) { + foreach (Account* a, instance()->getAccounts()) { if (a->getAccountAlias().left(alias.size()) == alias) count++; } bool found = true; do { found = false; - foreach (Account* a, getInstance()->getAccounts()) { + foreach (Account* a, instance()->getAccounts()) { if (a->getAccountAlias() == alias+QString(" (%1)").arg(count)) { count++; found = false; diff --git a/src/accountlist.h b/src/accountlist.h index ced3ca04f128915ef1d9f07583bdd1d44baa1a73..1405b91ce34b5e7dde30c7751bc414e994e2f254 100644 --- a/src/accountlist.h +++ b/src/accountlist.h @@ -37,7 +37,7 @@ class LIB_EXPORT AccountList : public QAbstractListModel { public: friend class Account; //Static getter and destructor - static AccountList* getInstance(); + static AccountList* instance(); static void destroy(); //Getters diff --git a/src/call.cpp b/src/call.cpp index 4efad73018fbe88d1039d182fc805f1d80243c88..103a372ba3653f34971bfa13ac5a53699fc4a769 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -29,8 +29,8 @@ //SFLPhone library -#include "callmanager_interface_singleton.h" -#include "configurationmanager_interface_singleton.h" +#include "dbus/callmanager.h" +#include "dbus/configurationmanager.h" #include "abstractcontactbackend.h" #include "contact.h" #include "account.h" @@ -171,7 +171,7 @@ Call::Call(Call::State startState, const QString& callId, QString peerName, QStr qRegisterMetaType<Call*>(); changeCurrentState(startState); - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); connect(&callManager,SIGNAL(recordPlaybackStopped(QString)), this, SLOT(stopPlayback(QString)) ); connect(&callManager,SIGNAL(updatePlaybackScale(int,int)) , this, SLOT(updatePlayback(int,int))); @@ -201,7 +201,7 @@ Call::Call(QString confId, QString account): HistoryTreeBackend(HistoryTreeBacke m_pTimer->setInterval(1000); connect(m_pTimer,SIGNAL(timeout()),this,SLOT(updated())); m_pTimer->start(); - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); MapStringString details = callManager.getConferenceDetails(m_ConfId) ; m_CurrentState = confStatetoCallState(details["CONF_STATE"]); } @@ -216,7 +216,7 @@ Call::Call(QString confId, QString account): HistoryTreeBackend(HistoryTreeBacke ///Build a call from its ID Call* Call::buildExistingCall(QString callId) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); MapStringString details = callManager.getCallDetails(callId).value(); qDebug() << "Constructing existing call with details : " << details; @@ -257,7 +257,7 @@ Call* Call::buildDialingCall(QString callId, const QString & peerName, QString a ///Build a call from a dbus event Call* Call::buildIncomingCall(const QString & callId) { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); MapStringString details = callManager.getCallDetails(callId).value(); QString from = details[ CALL_PEER_NUMBER ]; @@ -272,7 +272,7 @@ Call* Call::buildIncomingCall(const QString & callId) ///Build a ringing call (from dbus) Call* Call::buildRingingCall(const QString & callId) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); MapStringString details = callManager.getCallDetails(callId).value(); QString from = details[ CALL_PEER_NUMBER ]; @@ -514,7 +514,7 @@ Call::State Call::getCurrentState() const ///Get the call recording bool Call::getRecording() const { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); ((Call*) this)->m_Recording = callManager.getIsRecording(m_CallId); return m_Recording; } @@ -522,7 +522,7 @@ bool Call::getRecording() const ///Get the call account id Account* Call::getAccount() const { - return AccountList::getInstance()->getAccountById(m_Account); + return AccountList::instance()->getAccountById(m_Account); } ///Is this call a conference @@ -546,7 +546,7 @@ const QString Call::getRecordingPath() const ///Get the current codec QString Call::getCurrentCodecName() const { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); return callManager.getCurrentAudioCodecName(m_CallId); } @@ -582,7 +582,7 @@ bool Call::isSecure() const { return false; } - Account* currentAccount = AccountList::getInstance()->getAccountById(m_Account); + Account* currentAccount = AccountList::instance()->getAccountById(m_Account); return currentAccount && ((currentAccount->isTlsEnable()) || (currentAccount->getTlsMethod())); } //isSecure @@ -598,7 +598,7 @@ Contact* Call::getContact() VideoRenderer* Call::getVideoRenderer() { #ifdef ENABLE_VIDEO - return VideoModel::getInstance()->getRenderer(this); + return VideoModel::instance()->getRenderer(this); #else return nullptr; #endif @@ -696,7 +696,7 @@ Call::State Call::stateChanged(const QString& newStateName) return m_CurrentState; } - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); MapStringString details = callManager.getCallDetails(m_CallId).value(); if (details[CALL_PEER_NAME] != m_PeerName) m_PeerName = details[CALL_PEER_NAME]; @@ -809,10 +809,10 @@ void Call::changeCurrentState(Call::State newState) ///Send a text message void Call::sendTextMessage(QString message) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); Q_NOREPLY callManager.sendTextMessage(isConference()?m_ConfId:m_CallId,message); if (!m_pImModel) { - m_pImModel = InstantMessagingModelManager::getInstance()->getModel(this); + m_pImModel = InstantMessagingModelManager::instance()->getModel(this); } m_pImModel->addOutgoingMessage(message); } @@ -841,7 +841,7 @@ void Call::error() ///Accept the call void Call::accept() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Accepting call. callId : " << m_CallId << "ConfId:" << m_ConfId; Q_NOREPLY callManager.accept(m_CallId); time_t curTime; @@ -859,7 +859,7 @@ void Call::accept() ///Refuse the call void Call::refuse() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Refusing call. callId : " << m_CallId << "ConfId:" << m_ConfId; Q_NOREPLY callManager.refuse(m_CallId); time_t curTime; @@ -871,7 +871,7 @@ void Call::refuse() ///Accept the transfer void Call::acceptTransf() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Accepting call and transferring it to number : " << m_TransferNumber << ". callId : " << m_CallId << "ConfId:" << m_ConfId; callManager.accept(m_CallId); Q_NOREPLY callManager.transfer(m_CallId, m_TransferNumber); @@ -880,7 +880,7 @@ void Call::acceptTransf() ///Put the call on hold void Call::acceptHold() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Accepting call and holding it. callId : " << m_CallId << "ConfId:" << m_ConfId; callManager.accept(m_CallId); Q_NOREPLY callManager.hold(m_CallId); @@ -890,7 +890,7 @@ void Call::acceptHold() ///Hang up void Call::hangUp() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); time_t curTime; ::time(&curTime); m_pStopTimeStamp = curTime; @@ -906,7 +906,7 @@ void Call::hangUp() ///Cancel this call void Call::cancel() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Canceling call. callId : " << m_CallId << "ConfId:" << m_ConfId; Q_NOREPLY callManager.hangUp(m_CallId); } @@ -914,7 +914,7 @@ void Call::cancel() ///Put on hold void Call::hold() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Holding call. callId : " << m_CallId << "ConfId:" << m_ConfId; if (!isConference()) Q_NOREPLY callManager.hold(m_CallId); @@ -925,7 +925,7 @@ void Call::hold() ///Start the call void Call::call() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "account = " << m_Account; if(m_Account.isEmpty()) { qDebug() << "Account is not set, taking the first registered."; @@ -956,7 +956,7 @@ void Call::call() void Call::transfer() { if (!m_TransferNumber.isEmpty()) { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Transferring call to number : " << m_TransferNumber << ". callId : " << m_CallId; Q_NOREPLY callManager.transfer(m_CallId, m_TransferNumber); time_t curTime; @@ -968,7 +968,7 @@ void Call::transfer() ///Unhold the call void Call::unhold() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Unholding call. callId : " << m_CallId << "ConfId:" << m_ConfId; if (!isConference()) Q_NOREPLY callManager.unhold(m_CallId); @@ -979,7 +979,7 @@ void Call::unhold() ///Record the call void Call::setRecord() { - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface & callManager = DBus::CallManager::instance(); qDebug() << "Setting record " << !m_Recording << " for call. callId : " << m_CallId << "ConfId:" << m_ConfId; Q_NOREPLY callManager.setRecording((!m_isConference)?m_CallId:m_ConfId); bool oldRecStatus = m_Recording; @@ -1134,7 +1134,7 @@ void Call::updated() ///Play the record, if any void Call::playRecording() { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); bool retval = callManager.startRecordedFilePlayback(getRecordingPath()); if (retval) emit playbackStarted(); @@ -1143,7 +1143,7 @@ void Call::playRecording() ///Stop the record, if any void Call::stopRecording() { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); Q_NOREPLY callManager.stopRecordedFilePlayback(getRecordingPath()); emit playbackStopped(); //TODO remove this, it is a workaround for bug #11942 } @@ -1151,7 +1151,7 @@ void Call::stopRecording() ///seek the record, if any void Call::seekRecording(double position) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); Q_NOREPLY callManager.recordPlaybackSeek(position); } diff --git a/src/callmodel.cpp b/src/callmodel.cpp index 5ee84c1c36234d677682b1549af20f85445b48d1..c7aa69a398a3289da98ce751db655f35ce57b94a 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -25,13 +25,13 @@ #include "call.h" #include "accountlist.h" #include "dbus/metatypes.h" -#include "callmanager_interface_singleton.h" -#include "configurationmanager_interface_singleton.h" -#include "instance_interface_singleton.h" +#include "dbus/callmanager.h" +#include "dbus/configurationmanager.h" +#include "dbus/instancemanager.h" #include "sflphone_const.h" #include "typedefs.h" #include "abstractcontactbackend.h" -#include "video_interface_singleton.h" +#include "dbus/videomanager.h" #include "historymodel.h" //Define @@ -67,9 +67,9 @@ CallModel::CallModel() : QAbstractItemModel(nullptr) { static bool dbusInit = false; if (!dbusInit) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); #ifdef ENABLE_VIDEO - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); #endif //SLOTS @@ -101,7 +101,7 @@ CallModel::CallModel() : QAbstractItemModel(nullptr) registerCommTypes(); m_sInstanceInit = true; - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); const QStringList callList = callManager.getCallList(); foreach (const QString& callId, callList) { Call* tmpCall = Call::buildExistingCall(callId); @@ -163,7 +163,7 @@ CallList CallModel::getConferenceList() CallList confList; //That way it can not be invalid - const QStringList confListS = CallManagerInterfaceSingleton::getInstance().getConferenceList(); + const QStringList confListS = DBus::CallManager::instance().getConferenceList(); foreach (const QString& confId, confListS) { InternalStruct* internalS = m_sPrivateCallList_callId[confId]; if (!internalS) @@ -176,7 +176,7 @@ CallList CallModel::getConferenceList() bool CallModel::isValid() { - return CallManagerInterfaceSingleton::getInstance().isValid(); + return DBus::CallManager::instance().isValid(); } @@ -315,7 +315,7 @@ QModelIndex CallModel::getIndex(Call* call) ///Transfer "toTransfer" to "target" and wait to see it it succeeded void CallModel::attendedTransfer(Call* toTransfer, Call* target) { - Q_NOREPLY CallManagerInterfaceSingleton::getInstance().attendedTransfer(toTransfer->getCallId(),target->getCallId()); + Q_NOREPLY DBus::CallManager::instance().attendedTransfer(toTransfer->getCallId(),target->getCallId()); //TODO [Daemon] Implement this correctly toTransfer->changeCurrentState(Call::State::OVER); @@ -342,7 +342,7 @@ void CallModel::transfer(Call* toTransfer, QString target) Call* CallModel::addConference(const QString& confID) { qDebug() << "Notified of a new conference " << confID; - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); const QStringList callList = callManager.getParticipantList(confID); qDebug() << "Paticiapants are:" << callList; @@ -397,7 +397,7 @@ bool CallModel::createConferenceFromCall(Call* call1, Call* call2) { if (!call1 || !call2) return false; qDebug() << "Joining call: " << call1->getCallId() << " and " << call2->getCallId(); - Q_NOREPLY CallManagerInterfaceSingleton::getInstance().joinParticipant(call1->getCallId(),call2->getCallId()); + Q_NOREPLY DBus::CallManager::instance().joinParticipant(call1->getCallId(),call2->getCallId()); return true; } //createConferenceFromCall @@ -405,7 +405,7 @@ bool CallModel::createConferenceFromCall(Call* call1, Call* call2) bool CallModel::addParticipant(Call* call2, Call* conference) { if (conference->isConference()) { - Q_NOREPLY CallManagerInterfaceSingleton::getInstance().addParticipant(call2->getCallId(), conference->getConfId()); + Q_NOREPLY DBus::CallManager::instance().addParticipant(call2->getCallId(), conference->getConfId()); return true; } else { @@ -417,14 +417,14 @@ bool CallModel::addParticipant(Call* call2, Call* conference) ///Remove a participant from a conference bool CallModel::detachParticipant(Call* call) { - Q_NOREPLY CallManagerInterfaceSingleton::getInstance().detachParticipant(call->getCallId()); + Q_NOREPLY DBus::CallManager::instance().detachParticipant(call->getCallId()); return true; } ///Merge two conferences bool CallModel::mergeConferences(Call* conf1, Call* conf2) { - Q_NOREPLY CallManagerInterfaceSingleton::getInstance().joinConference(conf1->getConfId(),conf2->getConfId()); + Q_NOREPLY DBus::CallManager::instance().joinConference(conf1->getConfId(),conf2->getConfId()); return true; } @@ -759,7 +759,7 @@ void CallModel::slotChangingConference(const QString &confID, const QString& sta return; } conf->stateChanged(state); - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); QStringList participants = callManager.getParticipantList(confID); foreach(InternalStruct* child,confInt->m_lChildren) { diff --git a/src/callmanager_interface_singleton.cpp b/src/dbus/callmanager.cpp similarity index 90% rename from src/callmanager_interface_singleton.cpp rename to src/dbus/callmanager.cpp index 607f67a3a4fa297aef14db1fd98a48996aff599d..93db5047b046f0626035e87943c269567722d6eb 100644 --- a/src/callmanager_interface_singleton.cpp +++ b/src/dbus/callmanager.cpp @@ -17,13 +17,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ -#include "callmanager_interface_singleton.h" +#include "callmanager.h" +CallManagerInterface * DBus::CallManager::interface = nullptr; -CallManagerInterface * CallManagerInterfaceSingleton::interface = nullptr; - - -CallManagerInterface & CallManagerInterfaceSingleton::getInstance(){ +CallManagerInterface & DBus::CallManager::instance(){ if (!dbus_metaTypeInit) registerCommTypes(); if (!interface) interface = new CallManagerInterface( "org.sflphone.SFLphone", "/org/sflphone/SFLphone/CallManager", QDBusConnection::sessionBus()); diff --git a/src/callmanager_interface_singleton.h b/src/dbus/callmanager.h similarity index 85% rename from src/callmanager_interface_singleton.h rename to src/dbus/callmanager.h index e4c6dc10595a373570804bfc50ff1859e8d07354..619926e9b12764f38a5a62d5506a00cabc595f06 100644 --- a/src/callmanager_interface_singleton.h +++ b/src/dbus/callmanager.h @@ -21,16 +21,20 @@ #define CALL_MANAGER_INTERFACE_SINGLETON_H #include "src/lib/callmanager_dbus_interface.h" -#include "typedefs.h" +#include "../typedefs.h" -///Singleton to access dbus "CallManager" interface -class LIB_EXPORT CallManagerInterfaceSingleton -{ -public: - static CallManagerInterface& getInstance(); +namespace DBus { -private: - static CallManagerInterface* interface; -}; + ///Singleton to access dbus "CallManager" interface + class LIB_EXPORT CallManager + { + public: + static CallManagerInterface& instance(); + + private: + static CallManagerInterface* interface; + }; + +} #endif diff --git a/src/configurationmanager_interface_singleton.cpp b/src/dbus/configurationmanager.cpp similarity index 90% rename from src/configurationmanager_interface_singleton.cpp rename to src/dbus/configurationmanager.cpp index 8101ba17b1e64b79265730f0688918f6df9254de..3367d9118e571022c91c83ca90ae3c99dd802c10 100644 --- a/src/configurationmanager_interface_singleton.cpp +++ b/src/dbus/configurationmanager.cpp @@ -16,11 +16,11 @@ * 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 "configurationmanager_interface_singleton.h" +#include "configurationmanager.h" -ConfigurationManagerInterface* ConfigurationManagerInterfaceSingleton::interface = nullptr; +ConfigurationManagerInterface* DBus::ConfigurationManager::interface = nullptr; -ConfigurationManagerInterface& ConfigurationManagerInterfaceSingleton::getInstance() +ConfigurationManagerInterface& DBus::ConfigurationManager::instance() { if (!dbus_metaTypeInit) registerCommTypes(); if (!interface) diff --git a/src/configurationmanager_interface_singleton.h b/src/dbus/configurationmanager.h similarity index 84% rename from src/configurationmanager_interface_singleton.h rename to src/dbus/configurationmanager.h index 544d9ce0c5cba6ffacd988d979f744315606bd57..9f55bef5b32ad9dcbd86cc7008093e3b672b12ad 100644 --- a/src/configurationmanager_interface_singleton.h +++ b/src/dbus/configurationmanager.h @@ -20,16 +20,20 @@ #define CONFIGURATION_MANAGER_INTERFACE_SINGLETON_H #include "src/lib/configurationmanager_dbus_interface.h" -#include "typedefs.h" +#include "../typedefs.h" -///Singleton to access the ConfigurationManager dbus interface -class LIB_EXPORT ConfigurationManagerInterfaceSingleton -{ -public: - static ConfigurationManagerInterface& getInstance(); +namespace DBus { -private: - static ConfigurationManagerInterface* interface; -}; + ///Singleton to access the ConfigurationManager dbus interface + class LIB_EXPORT ConfigurationManager + { + public: + static ConfigurationManagerInterface& instance(); + + private: + static ConfigurationManagerInterface* interface; + }; + +} #endif diff --git a/src/instance_interface_singleton.cpp b/src/dbus/instancemanager.cpp similarity index 91% rename from src/instance_interface_singleton.cpp rename to src/dbus/instancemanager.cpp index 0f2ab70026e0ed0fc15d381a5229358fc73574cc..f951d3fdc2bc65d2ae61577af2c4d083d3c53fca 100644 --- a/src/instance_interface_singleton.cpp +++ b/src/dbus/instancemanager.cpp @@ -17,11 +17,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ -#include "instance_interface_singleton.h" +#include "instancemanager.h" -InstanceInterface* InstanceInterfaceSingleton::interface = nullptr; +InstanceInterface* DBus::InstanceManager::interface = nullptr; -InstanceInterface& InstanceInterfaceSingleton::getInstance() +InstanceInterface& DBus::InstanceManager::instance() { if (!dbus_metaTypeInit) registerCommTypes(); if (!interface) diff --git a/src/instance_interface_singleton.h b/src/dbus/instancemanager.h similarity index 84% rename from src/instance_interface_singleton.h rename to src/dbus/instancemanager.h index fc63e5d3eb8ccdc2173005a8b7de242ecbe4fc40..07c0bcfec243ac2103f36a8ace15e6e35d3f6aba 100644 --- a/src/instance_interface_singleton.h +++ b/src/dbus/instancemanager.h @@ -21,18 +21,22 @@ #define INSTANCE_INTERFACE_SINGLETON_H #include "src/lib/instance_dbus_interface.h" -#include "typedefs.h" +#include "../typedefs.h" -/** - * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> - */ -class LIB_EXPORT InstanceInterfaceSingleton -{ -public: - static InstanceInterface& getInstance(); +namespace DBus { -private: - static InstanceInterface* interface; -}; + /** + * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> + */ + class LIB_EXPORT InstanceManager + { + public: + static InstanceInterface& instance(); + + private: + static InstanceInterface* interface; + }; + +} #endif diff --git a/src/video_interface_singleton.cpp b/src/dbus/videomanager.cpp similarity index 91% rename from src/video_interface_singleton.cpp rename to src/dbus/videomanager.cpp index 0e469b0b4f0e29bd41d89ecb499c0fc0a7b901a1..3ed7990a9ca5227246bee7cea12b13de6e71eb63 100644 --- a/src/video_interface_singleton.cpp +++ b/src/dbus/videomanager.cpp @@ -15,11 +15,11 @@ * 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 "video_interface_singleton.h" +#include "videomanager.h" -VideoInterface* VideoInterfaceSingleton::interface = nullptr; +VideoInterface* DBus::VideoManager::interface = nullptr; -VideoInterface& VideoInterfaceSingleton::getInstance() +VideoInterface& DBus::VideoManager::instance() { if (!dbus_metaTypeInit) registerCommTypes(); if (!interface) diff --git a/src/video_interface_singleton.h b/src/dbus/videomanager.h similarity index 85% rename from src/video_interface_singleton.h rename to src/dbus/videomanager.h index b9d8a94210da2f909b3323f90a1692dc6552393c..1d02f1649b009772159d5269fd26439ad02ede5d 100644 --- a/src/video_interface_singleton.h +++ b/src/dbus/videomanager.h @@ -21,18 +21,22 @@ #include "src/lib/video_dbus_interface.h" #include "typedefs.h" -/** - * @author Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> - */ -class LIB_EXPORT VideoInterfaceSingleton -{ +namespace DBus { -private: - static VideoInterface* interface; + /** + * @author Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> + */ + class LIB_EXPORT VideoManager + { -public: - static VideoInterface& getInstance(); + private: + static VideoInterface* interface; -}; + public: + static VideoInterface& instance(); + + }; + +} #endif diff --git a/src/historymodel.cpp b/src/historymodel.cpp index db952ba97a78b93c82f987f4c60b297aaa4da9c3..8930e3099d24d1ac0b0757641fe58043f1888d2f 100644 --- a/src/historymodel.cpp +++ b/src/historymodel.cpp @@ -21,8 +21,8 @@ #include <time.h> //SFLPhone lib -#include "callmanager_interface_singleton.h" -#include "configurationmanager_interface_singleton.h" +#include "dbus/callmanager.h" +#include "dbus/configurationmanager.h" #include "call.h" #include "contact.h" @@ -94,7 +94,7 @@ HistoryModel::TopLevelItem::TopLevelItem(QString name) : ///Constructor HistoryModel::HistoryModel():QAbstractItemModel(nullptr),m_HistoryInit(false),m_Role(Call::Role::FuzzyDate),m_HaveContactModel(false) { - ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); const QVector< QMap<QString, QString> > history = configurationManager.getHistory(); foreach (const MapStringString& hc, history) { Call* pastCall = Call::buildHistoryCall( diff --git a/src/instantmessagingmodel.cpp b/src/instantmessagingmodel.cpp index f6d456a363a1f2bfb80236d32b44f08dec7cabfc..314b4b0b56d8dadecfd39ff4b65978499f63033c 100644 --- a/src/instantmessagingmodel.cpp +++ b/src/instantmessagingmodel.cpp @@ -18,7 +18,7 @@ #include "instantmessagingmodel.h" #include "callmodel.h" -#include "callmanager_interface_singleton.h" +#include "dbus/callmanager.h" #include "call.h" #include "contact.h" @@ -26,7 +26,7 @@ InstantMessagingModelManager* InstantMessagingModelManager::m_spInstance = null CallModel* InstantMessagingModelManager::m_spCallModel = nullptr; ///Signleton -InstantMessagingModelManager* InstantMessagingModelManager::getInstance() +InstantMessagingModelManager* InstantMessagingModelManager::instance() { if (!m_spInstance) { m_spInstance = new InstantMessagingModelManager(); @@ -36,13 +36,13 @@ InstantMessagingModelManager* InstantMessagingModelManager::getInstance() void InstantMessagingModelManager::init(CallModel* model) { m_spCallModel = model; - getInstance(); + instance(); } ///Constructor InstantMessagingModelManager::InstantMessagingModelManager() : QObject(0) { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + CallManagerInterface& callManager = DBus::CallManager::instance(); connect(&callManager, SIGNAL(incomingMessage(QString,QString,QString)), this, SLOT(newMessage(QString,QString,QString))); } diff --git a/src/instantmessagingmodel.h b/src/instantmessagingmodel.h index d3ae39824f15d7064de94aa638142d96d3ff1dd3..01d99e5292d295e00bc10ce6e455e8d7e9bc9c4d 100644 --- a/src/instantmessagingmodel.h +++ b/src/instantmessagingmodel.h @@ -43,7 +43,7 @@ class LIB_EXPORT InstantMessagingModelManager : public QObject public: //Singleton - static InstantMessagingModelManager* getInstance(); + static InstantMessagingModelManager* instance(); static void init(CallModel* model); //Getter diff --git a/src/videocodecmodel.cpp b/src/videocodecmodel.cpp index e36883182a3cd7586acbd1d1db76e8bf86a5d40d..53d86190f369b252470f2a325ca98dc5f708abeb 100644 --- a/src/videocodecmodel.cpp +++ b/src/videocodecmodel.cpp @@ -18,7 +18,7 @@ #include "videocodecmodel.h" #include "call.h" #include "account.h" -#include "video_interface_singleton.h" +#include "dbus/videomanager.h" ///Get data from the model QVariant VideoCodecModel::data( const QModelIndex& idx, int role) const @@ -79,7 +79,7 @@ VideoCodecModel::VideoCodecModel(Account* account) : QAbstractListModel(),m_pAcc void VideoCodecModel::reload() { m_lCodecs.clear(); - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); const VectorMapStringString codecs = interface.getCodecs(m_pAccount->getAccountId()); foreach(const MapStringString& h,codecs) { VideoCodec* c = new VideoCodec(h["name"],h["bitrate"].toInt(),h["enabled"]=="true"); @@ -91,7 +91,7 @@ void VideoCodecModel::reload() ///Save the current model over dbus void VideoCodecModel::save() { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); VectorMapStringString toSave; foreach(VideoCodec* vc,m_lCodecs) { MapStringString details; diff --git a/src/videodevice.cpp b/src/videodevice.cpp index a2fb6e52b541793b29b50389ac64d1927412a525..21c1ec90eaff21172ad3f178a76aec0745e726a1 100644 --- a/src/videodevice.cpp +++ b/src/videodevice.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ #include "videodevice.h" -#include "video_interface_singleton.h" +#include "dbus/videomanager.h" QHash<QString,VideoDevice*> VideoDevice::m_slDevices; bool VideoDevice::m_sInit = false; @@ -56,7 +56,7 @@ VideoDevice::VideoDevice(QString id) : m_DeviceId(id) const QList<VideoDevice*> VideoDevice::getDeviceList() { QHash<QString,VideoDevice*> devices; - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); const QStringList deviceList = interface.getDeviceList(); foreach(const QString& device,deviceList) { if (!m_slDevices[device]) @@ -82,56 +82,56 @@ VideoDevice* VideoDevice::getDevice(QString name) ///Get the valid rates for this device const QStringList VideoDevice::getRateList(VideoChannel channel, Resolution resolution) { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); return interface.getDeviceRateList(m_DeviceId,channel,resolution.toString()); } ///Get the valid channel list const QList<VideoChannel> VideoDevice::getChannelList() { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); return interface.getDeviceChannelList(m_DeviceId); } ///Set the current device rate void VideoDevice::setRate(VideoRate rate) { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); interface.setActiveDeviceRate(rate); } ///Set the current resolution void VideoDevice::setResolution(Resolution resolution) //??? No device { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); interface.setActiveDeviceSize(resolution.toString()); } ///Set the current device channel void VideoDevice::setChannel(VideoChannel channel) //??? No device { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); interface.setActiveDeviceChannel(channel); } ///Get the current resolution const Resolution VideoDevice::getResolution() { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); return Resolution(interface.getActiveDeviceSize()); } ///Get the current channel const VideoChannel VideoDevice::getChannel() //??? No device { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); return interface.getActiveDeviceChannel(); } ///Get the current rate const VideoRate VideoDevice::getRate() { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); return interface.getActiveDeviceRate(); } @@ -139,7 +139,7 @@ const VideoRate VideoDevice::getRate() const QList<Resolution> VideoDevice::getResolutionList(VideoChannel channel) { QList<Resolution> toReturn; - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); const QStringList list = interface.getDeviceSizeList(m_DeviceId,channel); foreach(const QString& res,list) { toReturn << Resolution(res); diff --git a/src/videomodel.cpp b/src/videomodel.cpp index 8a74cdbd5250c81da476443bf411ddbcd502510f..e4c212faebba6a8fc0fd5a4e8e3b9e100be6f858 100644 --- a/src/videomodel.cpp +++ b/src/videomodel.cpp @@ -18,7 +18,7 @@ #include "videomodel.h" //SFLPhone -#include "video_interface_singleton.h" +#include "dbus/videomanager.h" #include "videodevice.h" #include "call.h" #include "callmodel.h" @@ -30,14 +30,14 @@ VideoModel* VideoModel::m_spInstance = nullptr; ///Constructor VideoModel::VideoModel():m_BufferSize(0),m_ShmKey(0),m_SemKey(0),m_PreviewState(false) { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); connect( &interface , SIGNAL(deviceEvent()) , this, SLOT(deviceEvent()) ); connect( &interface , SIGNAL(startedDecoding(QString,QString,int,int)), this, SLOT(startedDecoding(QString,QString,int,int))); connect( &interface , SIGNAL(stoppedDecoding(QString,QString)) , this, SLOT(stoppedDecoding(QString,QString)) ); } ///Singleton -VideoModel* VideoModel::getInstance() +VideoModel* VideoModel::instance() { if (!m_spInstance) { m_spInstance = new VideoModel(); @@ -56,7 +56,7 @@ VideoRenderer* VideoModel::getRenderer(Call* call) VideoRenderer* VideoModel::getPreviewRenderer() { if (!m_lRenderers["local"]) { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); m_lRenderers["local"] = new VideoRenderer("", Resolution(interface.getActiveDeviceSize())); } return m_lRenderers["local"]; @@ -65,7 +65,7 @@ VideoRenderer* VideoModel::getPreviewRenderer() ///Stop video preview void VideoModel::stopPreview() { - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); interface.stopPreview(); m_PreviewState = false; } @@ -74,7 +74,7 @@ void VideoModel::stopPreview() void VideoModel::startPreview() { if (m_PreviewState) return; - VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + VideoInterface& interface = DBus::VideoManager::instance(); interface.startPreview(); m_PreviewState = true; } diff --git a/src/videomodel.h b/src/videomodel.h index 2c48f7303bb8a791c4b206ca6d9950c51dc58ba3..542cecc8c7b3a64e4391502b217c31aacfe73afc 100644 --- a/src/videomodel.h +++ b/src/videomodel.h @@ -35,7 +35,7 @@ class LIB_EXPORT VideoModel : public QObject { Q_OBJECT public: //Singleton - static VideoModel* getInstance(); + static VideoModel* instance(); //Getters bool isPreviewing ();