Commit a3d9396f authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk

refacto: remove unused LRC models

A lot of old models is now migrated to another part of the code.
This patch removes a lot of unused models.

Change-Id: I245f3c793571076ae0e5f838a672e15008152470
Gitlab: #358
parent 44133044
......@@ -269,52 +269,10 @@ ENDIF()
#File to compile
SET( libringclient_LIB_SRCS
#Data objects
src/call.cpp
src/uri.cpp
src/account.cpp
src/person.cpp
src/contactmethod.cpp
src/numbercategory.cpp
src/macro.cpp
src/collectionextensioninterface.cpp
src/video/rate.cpp
src/video/device.cpp
src/video/renderer.cpp
src/certificate.cpp
src/securityflaw.cpp
src/media/media.cpp
src/media/audio.cpp
src/media/video.cpp
src/media/text.cpp
src/media/file.cpp
src/media/recording.cpp
src/media/avrecording.cpp
#Models
src/accountmodel.cpp
src/phonedirectorymodel.cpp
src/numbercategorymodel.cpp
src/macromodel.cpp
src/keyexchangemodel.cpp
src/securityevaluationmodel.cpp
src/personmodel.cpp
src/collectionmodel.cpp
src/collectionextensionmodel.cpp
src/collectionmanagerinterface.cpp
src/certificatemodel.cpp
src/chainoftrustmodel.cpp
src/video/devicemodel.cpp
src/video/sourcemodel.cpp
src/video/channel.cpp
src/video/resolution.cpp
src/video/configurationproxy.cpp
src/audio/alsapluginmodel.cpp
src/audio/inputdevicemodel.cpp
src/audio/managermodel.cpp
src/audio/outputdevicemodel.cpp
src/audio/ringtonedevicemodel.cpp
src/audio/settings.cpp
src/media/recordingmodel.cpp
src/contactmodel.cpp
src/newcallmodel.cpp
src/newdevicemodel.cpp
......@@ -333,10 +291,6 @@ SET( libringclient_LIB_SRCS
src/shmrenderer.cpp
src/directrenderer.cpp
#Data collections
src/collectioninterface.cpp
src/collectioneditor.cpp
#Communication
src/dbus/configurationmanager.cpp
src/dbus/callmanager.cpp
......@@ -347,75 +301,23 @@ SET( libringclient_LIB_SRCS
#Default interface implementations
src/globalinstances.cpp
src/pixmapmanipulatordefault.cpp
src/shortcutcreatordefault.cpp
src/dbuserrorhandlerdefault.cpp
#Other
src/avmodel.cpp
src/hookmanager.cpp
src/namedirectory.cpp
src/itembase.cpp
src/private/vcardutils.cpp
src/private/videorenderermanager.cpp
src/video/previewmanager.cpp
src/private/sortproxies.cpp
src/private/threadworker.cpp
src/mime.cpp
src/smartinfohub.cpp
src/usage_statistics.cpp
#Extension
src/extensions/securityevaluationextension.cpp
)
# Public API
SET( libringclient_LIB_HDRS
src/account.h
src/accountmodel.h
src/call.h
src/call.hpp
src/person.h
src/collectioninterface.h
src/collectioninterface.hpp
src/contactmethod.h
src/phonedirectorymodel.h
src/numbercategorymodel.h
src/keyexchangemodel.h
src/numbercategory.h
src/securityevaluationmodel.h
src/certificate.h
src/personmodel.h
src/collectionmodel.h
src/collectionextensionmodel.h
src/collectionextensionmodel.hpp
src/macromodel.h
src/hookmanager.h
src/namedirectory.h
src/uri.h
src/macro.h
src/itembase.h
src/itembase.hpp
src/mime.h
src/collectionextensioninterface.h
src/collectionmanagerinterface.h
src/collectionmanagerinterface.hpp
src/certificatemodel.h
src/collectionmediator.h
src/collectionmediator.hpp
src/collectioneditor.h
src/collectioneditor.hpp
src/securityflaw.h
src/collectioncreationinterface.h
src/collectionconfigurationinterface.h
src/chainoftrustmodel.h
src/globalinstances.h
src/pixmapmanipulatordefault.h
src/shortcutcreatordefault.h
src/dbuserrorhandlerdefault.h
src/itemdataroles.h
src/smartinfohub.h
src/usage_statistics.h
src/vcard.h
src/namedirectory.h
src/shmrenderer.h
src/directrenderer.h
)
......@@ -444,47 +346,12 @@ SET(libringclient_api_LIB_HDRS
SET(libringclient_video_LIB_HDRS
src/video/device.h
src/video/devicemodel.h
src/video/sourcemodel.h
src/video/renderer.h
src/video/resolution.h
src/video/channel.h
src/video/rate.h
src/video/previewmanager.h
src/video/configurationproxy.h
#The renderer implementations are not exported on purpose
)
SET(libringclient_audio_LIB_HDRS
src/audio/alsapluginmodel.h
src/audio/inputdevicemodel.h
src/audio/managermodel.h
src/audio/outputdevicemodel.h
src/audio/ringtonedevicemodel.h
src/audio/settings.h
)
SET(libringclient_extensions_LIB_HDRS
src/extensions/securityevaluationextension.h
)
SET(libringclient_media_LIB_HDRS
src/media/media.h
src/media/audio.h
src/media/video.h
src/media/text.h
src/media/file.h
src/media/recording.h
src/media/avrecording.h
src/media/recordingmodel.h
)
SET(libringclient_interface_LIB_HDRS
src/interfaces/contactmethodselectori.h
src/interfaces/itemmodelstateserializeri.h
src/interfaces/pixmapmanipulatori.h
src/interfaces/shortcutcreatori.h
src/interfaces/dbuserrorhandleri.h
)
......@@ -582,24 +449,9 @@ ENDIF()
# Manually wrap private files and interfaces
SET(libringclient_PRIVATE_HDRS
src/private/call_p.h
src/private/namedirectory_p.h
src/private/account_p.h
src/private/sortproxies.h
src/private/accountmodel_p.h
src/private/phonedirectorymodel_p.h
src/private/videorenderer_p.h
src/private/videodevice_p.h
src/private/collectionmodel_p.h
src/private/securityflaw_p.h
src/private/macromodel_p.h
src/private/person_p.h
src/collectioncreationinterface.h
src/private/securityevaluationmodel_p.h
src/collectionconfigurationinterface.h
src/private/imconversationmanagerprivate.h
src/private/smartInfoHub_p.h
src/private/certificatemodel_p.h
src/private/videorenderer_p.h
)
......@@ -728,16 +580,6 @@ INSTALL( FILES ${libringclient_video_LIB_HDRS}
COMPONENT Devel
)
INSTALL( FILES ${libringclient_audio_LIB_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/libringclient/audio
COMPONENT Devel
)
INSTALL( FILES ${libringclient_media_LIB_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/libringclient/media
COMPONENT Devel
)
INSTALL( FILES ${libringclient_extensions_LIB_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/libringclient/extensions
COMPONENT Devel
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/****************************************************************************
* Copyright (C) 2009-2019 Savoir-faire Linux Inc. *
* Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> *
* Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Lesser 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/>. *
***************************************************************************/
#pragma once
#include <functional>
#include <QtCore/QVector>
#include <QtCore/QStringList>
#include <QtCore/QAbstractListModel>
#include "account.h"
#include "typedefs.h"
//Private
class AccountModelPrivate;
///AccountList: List of all daemon accounts
class LIB_EXPORT AccountModel : public QAbstractListModel {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
Q_OBJECT
#pragma GCC diagnostic pop
public:
Q_PROPERTY(Account* ip2ip READ ip2ip )
Q_PROPERTY(bool presenceEnabled READ isPresenceEnabled )
Q_PROPERTY(bool presencePublishSupported READ isPresencePublishSupported )
Q_PROPERTY(bool presenceSubscribeSupported READ isPresenceSubscribeSupported )
Q_PROPERTY(bool isSipSupported READ isSipSupported NOTIFY supportedProtocolsChanged)
Q_PROPERTY(bool isIP2IPSupported READ isIP2IPSupported NOTIFY supportedProtocolsChanged)
Q_PROPERTY(bool isRingSupported READ isRingSupported NOTIFY supportedProtocolsChanged)
Q_PROPERTY(Account* selectedAccount READ selectedAccount )
Q_PROPERTY(Account* userChosenAccount READ userChosenAccount WRITE setUserChosenAccount)
friend class AccountPrivate;
/// @enum Global saving state to be used when using a single saving mechanism for all accounts at once
enum class EditState {
SAVED = 0, /*!< Everything is ok, nothing has changed */
UNSAVED = 1, /*!< There is changes ready to be saved */
INVALID = 2, /*!< There is changes, but they would create an invalid state */
COUNT__
};
//Singleton
static AccountModel& instance();
//Getters
Q_INVOKABLE Account* getById ( const QByteArray& id, bool ph = false) const;
int size ( ) const;
Account* getAccountByModelIndex ( const QModelIndex& item ) const;
Q_INVOKABLE static QString getSimilarAliasIndex ( const QString& alias ) ;
Account* ip2ip ( ) const;
QList<Account*> getAccountsByProtocol ( const Account::Protocol protocol ) const;
bool isPresenceEnabled ( ) const;
bool isPresencePublishSupported ( ) const;
bool isPresenceSubscribeSupported( ) const;
bool isSipSupported ( ) const;
bool isIP2IPSupported ( ) const;
bool isRingSupported ( ) const;
EditState editState ( ) const;
void subscribeToBuddies (const QString &accountID ) ;
Account* selectedAccount ( ) const;
QList<Account*> accountsToMigrate ( ) const;
QVector<QMap<QString, QString>> getContacts (const Account* account ) const;
QItemSelectionModel* selectionModel ( ) const;
Account* userChosenAccount ( ) const;
QItemSelectionModel* userSelectionModel ( ) const;
//Abstract model accessors
virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
virtual int rowCount ( const QModelIndex& parent = QModelIndex() ) const override;
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const override;
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role ) override;
virtual QHash<int,QByteArray> roleNames ( ) const override;
virtual QMimeData* mimeData ( const QModelIndexList &indexes ) const override;
virtual QStringList mimeTypes ( ) const override;
virtual bool dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
virtual Qt::DropActions supportedDragActions() const override;
virtual Qt::DropActions supportedDropActions() const override;
//Mutators
Q_INVOKABLE Account* add ( const QString& alias, const Account::Protocol protocol = Account::Protocol::SIP);
Q_INVOKABLE void remove ( Account* account );
void remove ( const QModelIndex& index );
void save ( );
Q_INVOKABLE void cancel ( );
int exportAccounts(const QStringList& accountIDs, const QString& filePath, const QString& password);
int importAccounts(const QString& filePath, const QString& password);
void setUserChosenAccount(Account* account);
//Operators
Account* operator[] (int i) ;
Account* operator[] (const QByteArray& i) ;
const Account* operator[] (int i) const;
//Helpers
Account* findPlaceHolder(const QByteArray& accountId) const;
Account* findAccountIf(const std::function<bool(const Account&)>& pred) const;
private:
//Constructors & Destructors
explicit AccountModel ();
virtual ~AccountModel();
//Helpers
void add(Account* acc);
AccountModelPrivate* d_ptr;
Q_DECLARE_PRIVATE(AccountModel)
public Q_SLOTS:
void update ();
void updateAccounts ();
void registerAllAccounts();
bool moveUp ();
bool moveDown ();
///Notifies the Ring daemon that the connectivity (network status) has changed
void slotConnectivityChanged();
Q_SIGNALS:
///The account list changed
void accountListUpdated( );
///Emitted when an account enable attribute change
void accountEnabledChanged( Account* source );
///Emitted when the default account change
void defaultAccountChanged( Account* a );
///Emitted when one account registration state change
void registrationChanged(Account* a, bool registration );
///Emitted when the network is down
void badGateway( );
///Emitted when a new voice mail is available
void voiceMailNotify(Account* account, int count );
///Propagate Account::presenceEnabledChanged
void presenceEnabledChanged(bool isPresent );
///An account has been removed
void accountRemoved(Account* account );
///An account has been added
void accountAdded(Account* account );
///Emitted when an account using a previously unsupported protocol is added
void supportedProtocolsChanged( );
///Emitted when an account state change
void accountStateChanged ( Account* account, const Account::RegistrationState state);
///Emitted when an account edit state change
void accountEditStateChanged(Account* account, const Account::EditState state, const Account::EditState prev);
///The global AccountModel edit state changed
void editStateChanged(const EditState state, const EditState previous) const;
/// A list of contacts has been obtained.
void contactsList(Account *account);
};
Q_DECLARE_METATYPE(AccountModel*)
......@@ -196,6 +196,16 @@ public:
* @param audioOnly
*/
std::string startLocalRecorder(const bool& audioOnly) const;
/**
* Get the current recording path
* @return recording path
*/
std::string getRecordPath() const;
/**
* Sets the recording path
* @param recording path
*/
void setRecordPath(const std::string& path) const;
/**
* Start preview renderer. This will start the camera
......@@ -240,8 +250,6 @@ public:
*/
video::RenderedDevice getCurrentRenderedDevice(const std::string& call_id) const;
// TODO remove this, this is just to avoid dual rendering.
void deactivateOldVideoModels();
/**
* set to true to receive AVFrames from render
*/
......
......@@ -174,11 +174,6 @@ public:
* Not implemented yet
*/
void removeParticipant(const std::string& callId, const std::string& participant) const;
/**
* @param callId
* @return the renderer linked to a call
*/
Video::Renderer* getRenderer(const std::string& callId) const;
/**
* @param callId
* @return a human readable call duration (M:ss)
......
/****************************************************************************
* Copyright (C) 2012-2019 Savoir-faire Linux Inc. *
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Lesser 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 "alsapluginmodel.h"
//Qt
#include <QtCore/QItemSelectionModel>
//Ring
#include "dbus/configurationmanager.h"
class AlsaPluginModelPrivate final : public QObject
{
Q_OBJECT
public:
AlsaPluginModelPrivate(Audio::AlsaPluginModel* parent);
QStringList m_lDeviceList;
mutable QItemSelectionModel* m_pSelectionModel;
private:
Audio::AlsaPluginModel* q_ptr;
public Q_SLOTS:
void setCurrentPlugin(const QModelIndex& idx);
};
AlsaPluginModelPrivate::AlsaPluginModelPrivate(Audio::AlsaPluginModel* parent) : q_ptr(parent),
m_pSelectionModel(nullptr)
{
}
///Constructor
Audio::AlsaPluginModel::AlsaPluginModel(const QObject* parent) : QAbstractListModel(const_cast<QObject*>(parent)),
d_ptr(new AlsaPluginModelPrivate(this))
{
ConfigurationManagerInterface& configurationManager = ConfigurationManager::instance();
d_ptr->m_lDeviceList = configurationManager.getAudioPluginList();
}
///Destructor
Audio::AlsaPluginModel::~AlsaPluginModel()
{
}
QHash<int,QByteArray> Audio::AlsaPluginModel::roleNames() const
{
static QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
/*static bool initRoles = false;
if (!initRoles) {
initRoles = true;
}*/
return roles;
}
///Re-implement QAbstractListModel data
QVariant Audio::AlsaPluginModel::data( const QModelIndex& index, int role) const
{
if (!index.isValid())
return QVariant();
switch(role) {
case Qt::DisplayRole:
return d_ptr->m_lDeviceList[index.row()];
};
return QVariant();
}
///Re-implement QAbstractListModel rowCount
int Audio::AlsaPluginModel::rowCount( const QModelIndex& parent ) const
{
if (parent.isValid())
return 0;
return d_ptr->m_lDeviceList.size();
}
///Re-implement QAbstractListModel flags
Qt::ItemFlags Audio::AlsaPluginModel::flags( const QModelIndex& index ) const
{
Q_UNUSED(index)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
///Setting data is disabled
bool Audio::AlsaPluginModel::setData( const QModelIndex& index, const QVariant &value, int role)
{
Q_UNUSED(index)
Q_UNUSED(value)
Q_UNUSED(role)
return false;
}
QItemSelectionModel* Audio::AlsaPluginModel::selectionModel() const
{
if (!d_ptr->m_pSelectionModel) {
d_ptr->m_pSelectionModel = new QItemSelectionModel(const_cast<Audio::AlsaPluginModel*>(this));
d_ptr->m_pSelectionModel->setCurrentIndex(currentPlugin(), QItemSelectionModel::ClearAndSelect);
connect(d_ptr->m_pSelectionModel, &QItemSelectionModel::currentChanged, d_ptr.data(), &AlsaPluginModelPrivate::setCurrentPlugin);
}
return d_ptr->m_pSelectionModel;
}
///Return the current index
QModelIndex Audio::AlsaPluginModel::currentPlugin() const
{
ConfigurationManagerInterface& configurationManager = ConfigurationManager::instance();
const int idx = d_ptr->m_lDeviceList.indexOf(configurationManager.getCurrentAudioOutputPlugin());
qDebug() << "Invalid current audio plugin";
if (idx == -1)
return QModelIndex();
else
return index(idx,0,QModelIndex());
}
///Set the current index
void AlsaPluginModelPrivate::setCurrentPlugin(const QModelIndex& idx)