diff --git a/CMakeLists.txt b/CMakeLists.txt index 3aebcfba698d8e1a68e61d7f0b0b43459d562034..d4a5ca50364ad7b30134031c6b66d93a18019e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,7 +170,6 @@ SET( libringclient_LIB_SRCS src/video/rate.cpp src/video/device.cpp src/video/renderer.cpp - src/video/codec.cpp src/certificate.cpp #Models @@ -202,14 +201,13 @@ SET( libringclient_LIB_SRCS src/certificatemodel.cpp src/ciphermodel.cpp src/accountstatusmodel.cpp + src/codecmodel.cpp src/video/devicemodel.cpp src/video/sourcesmodel.cpp - src/video/codecmodel2.cpp src/video/channel.cpp src/video/resolution.cpp src/video/manager.cpp src/audio/alsapluginmodel.cpp - src/audio/codecmodel.cpp src/audio/inputdevicemodel.cpp src/audio/managermodel.cpp src/audio/outputdevicemodel.cpp @@ -308,8 +306,6 @@ SET(libringclient_video_LIB_HDRS src/video/device.h src/video/devicemodel.h src/video/sourcesmodel.h - src/video/codec.h - src/video/codecmodel2.h src/video/manager.h src/video/renderer.h src/video/resolution.h @@ -319,7 +315,7 @@ SET(libringclient_video_LIB_HDRS SET(libringclient_audio_LIB_HDRS src/audio/alsapluginmodel.h - src/audio/codecmodel.h + src/codecmodel.h src/audio/inputdevicemodel.h src/audio/managermodel.h src/audio/outputdevicemodel.h diff --git a/src/account.cpp b/src/account.cpp index 3ce0a9cb12ebf99555524db20c4b74d8c1373b44..68d0fd559efb91eadae41d7223aa9fff0cdc31ed 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -42,8 +42,7 @@ #include "ciphermodel.h" #include "protocolmodel.h" #include "accountstatusmodel.h" -#include "audio/codecmodel.h" -#include "video/codecmodel2.h" +#include "codecmodel.h" #include "ringtonemodel.h" #include "contactmethod.h" #include "phonedirectorymodel.h" @@ -66,8 +65,8 @@ const account_function AccountPrivate::stateMachineActionsOnState[6][7] = { }; #undef AP -AccountPrivate::AccountPrivate(Account* acc) : QObject(acc),q_ptr(acc),m_pCredentials(nullptr),m_pAudioCodecs(nullptr), -m_pVideoCodecs(nullptr),m_LastErrorCode(-1),m_VoiceMailCount(0),m_pRingToneModel(nullptr), +AccountPrivate::AccountPrivate(Account* acc) : QObject(acc),q_ptr(acc),m_pCredentials(nullptr),m_pCodecModel(nullptr), +m_LastErrorCode(-1),m_VoiceMailCount(0),m_pRingToneModel(nullptr), m_CurrentState(Account::EditState::READY), m_pAccountNumber(nullptr),m_pKeyExchangeModel(nullptr),m_pSecurityValidationModel(nullptr),m_pTlsMethodModel(nullptr), m_pCaCert(nullptr),m_pTlsCert(nullptr),m_pPrivateKey(nullptr),m_isLoaded(true),m_pCipherModel(nullptr), @@ -132,7 +131,7 @@ Account::~Account() { disconnect(); if (d_ptr->m_pCredentials) delete d_ptr->m_pCredentials ; - if (d_ptr->m_pAudioCodecs) delete d_ptr->m_pAudioCodecs ; + if (d_ptr->m_pCodecModel) delete d_ptr->m_pCodecModel ; } /***************************************************************************** @@ -331,19 +330,11 @@ CredentialModel* Account::credentialsModel() const } ///Create and return the audio codec model -Audio::CodecModel* Account::audioCodecModel() const +CodecModel* Account::codecModel() const { - if (!d_ptr->m_pAudioCodecs) - const_cast<Account*>(this)->reloadAudioCodecs(); - return d_ptr->m_pAudioCodecs; -} - -///Create and return the video codec model -Video::CodecModel2* Account::videoCodecModel() const -{ - if (!d_ptr->m_pVideoCodecs) - d_ptr->m_pVideoCodecs = new Video::CodecModel2(const_cast<Account*>(this)); - return d_ptr->m_pVideoCodecs; + if (!d_ptr->m_pCodecModel) + const_cast<Account*>(this)->reloadCodecs(); + return d_ptr->m_pCodecModel; } RingToneModel* Account::ringToneModel() const @@ -1507,17 +1498,23 @@ void AccountPrivate::save() const QString currentId = configurationManager.addAccount(details); //Be sure there is audio codec enabled to avoid obscure error messages for the user - const QVector<int> codecIdList = configurationManager.getAudioCodecList(); + const QVector<uint> codecIdList = configurationManager.getCodecList(); foreach (const int aCodec, codecIdList) { - const QStringList codec = configurationManager.getAudioCodecDetails(aCodec); - const QModelIndex idx = m_pAudioCodecs->add(); - m_pAudioCodecs->setData(idx,codec[0],Audio::CodecModel::Role::NAME ); - m_pAudioCodecs->setData(idx,codec[1],Audio::CodecModel::Role::SAMPLERATE ); - m_pAudioCodecs->setData(idx,codec[2],Audio::CodecModel::Role::BITRATE ); - m_pAudioCodecs->setData(idx,aCodec ,Audio::CodecModel::Role::ID ); - m_pAudioCodecs->setData(idx, Qt::Checked ,Qt::CheckStateRole); + const QMap<QString,QString> codec = configurationManager.getCodecDetails(q_ptr->id(),aCodec); + const QModelIndex idx = m_pCodecModel->add(); + /*Ring::Account::ConfProperties::CodecInfo::NAME ; //TODO move this to CodecModel + Ring::Account::ConfProperties::CodecInfo::TYPE ; + Ring::Account::ConfProperties::CodecInfo::SAMPLE_RATE ; + Ring::Account::ConfProperties::CodecInfo::FRAME_RATE ; + Ring::Account::ConfProperties::CodecInfo::BITRATE ; + Ring::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER;*/ + m_pCodecModel->setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::NAME ] ,CodecModel::Role::NAME ); + m_pCodecModel->setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE ] ,CodecModel::Role::SAMPLERATE ); + m_pCodecModel->setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::BITRATE ] ,CodecModel::Role::BITRATE ); + m_pCodecModel->setData(idx,QString::number(aCodec) ,CodecModel::Role::ID ); + m_pCodecModel->setData(idx, Qt::Checked ,Qt::CheckStateRole); } - q_ptr->saveAudioCodecs(); + q_ptr->saveCodecs(); q_ptr->setId(currentId.toLatin1()); q_ptr->saveCredentials(); @@ -1547,7 +1544,7 @@ void AccountPrivate::save() #ifdef ENABLE_VIDEO q_ptr->videoCodecModel()->save(); #endif - q_ptr->saveAudioCodecs(); + q_ptr->saveCodecs(); emit q_ptr->changed(q_ptr); } @@ -1675,18 +1672,18 @@ void Account::saveCredentials() { } ///Reload all audio codecs -void Account::reloadAudioCodecs() +void Account::reloadCodecs() { - if (!d_ptr->m_pAudioCodecs) { - d_ptr->m_pAudioCodecs = new Audio::CodecModel(this); + if (!d_ptr->m_pCodecModel) { + d_ptr->m_pCodecModel = new CodecModel(this); } - d_ptr->m_pAudioCodecs->reload(); + d_ptr->m_pCodecModel->reload(); } ///Save audio codecs -void Account::saveAudioCodecs() { - if (d_ptr->m_pAudioCodecs) - d_ptr->m_pAudioCodecs->save(); +void Account::saveCodecs() { + if (d_ptr->m_pCodecModel) + d_ptr->m_pCodecModel->save(); } /***************************************************************************** diff --git a/src/account.h b/src/account.h index af78c492965075d3fd1a7e0903177a1263f9bff1..6a5c998a2ce6c1ba658c035270fea902e7afc309 100644 --- a/src/account.h +++ b/src/account.h @@ -27,7 +27,6 @@ class QString; //Ring -#include "video/codecmodel2.h" #include "keyexchangemodel.h" #include "tlsmethodmodel.h" #include "typedefs.h" @@ -39,13 +38,7 @@ class Certificate ; class CipherModel ; class AccountStatusModel ; class ProtocolModel ; - -namespace Audio { - class CodecModel; -} -namespace Video { - class CodecModel2; -} +class CodecModel ; //Private class AccountPrivate; @@ -237,8 +230,7 @@ class LIB_EXPORT Account : public QObject { virtual bool isLoaded () const; Q_INVOKABLE CredentialModel* credentialsModel () const; - Q_INVOKABLE Audio::CodecModel* audioCodecModel () const; - Q_INVOKABLE Video::CodecModel2* videoCodecModel () const; + Q_INVOKABLE CodecModel* codecModel () const; Q_INVOKABLE RingToneModel* ringToneModel () const; Q_INVOKABLE KeyExchangeModel* keyExchangeModel () const; Q_INVOKABLE CipherModel* cipherModel () const; @@ -363,9 +355,9 @@ class LIB_EXPORT Account : public QObject { //Mutator Q_INVOKABLE void saveCredentials (); - Q_INVOKABLE void saveAudioCodecs (); + Q_INVOKABLE void saveCodecs (); Q_INVOKABLE void reloadCredentials(); - Q_INVOKABLE void reloadAudioCodecs(); + Q_INVOKABLE void reloadCodecs (); public Q_SLOTS: diff --git a/src/audio/alsapluginmodel.h b/src/audio/alsapluginmodel.h index 5436c6002f8c481c8d369279e7a8b5106e2c3850..2a4c60379f092fff168dfc71bd68483941025e0c 100644 --- a/src/audio/alsapluginmodel.h +++ b/src/audio/alsapluginmodel.h @@ -24,7 +24,7 @@ #include <QtCore/QStringList> //Ring -#include "../typedefs.h" +#include <typedefs.h> class AlsaPluginModelPrivate; diff --git a/src/audio/inputdevicemodel.h b/src/audio/inputdevicemodel.h index f71b4fbfb1e9729c9b33823814f136901c91c495..91d3adb3a0f8d3eda41ef614ec4b4191eccd44ae 100644 --- a/src/audio/inputdevicemodel.h +++ b/src/audio/inputdevicemodel.h @@ -24,7 +24,7 @@ #include <QtCore/QStringList> //Ring -#include "../typedefs.h" +#include <typedefs.h> class InputDeviceModelPrivate; diff --git a/src/audio/managermodel.h b/src/audio/managermodel.h index df60347fe66edab9b614b46f983ee33421eae068..98a0fa6d1ee7f8058bd9a9ce54bdafc90613d6e7 100644 --- a/src/audio/managermodel.h +++ b/src/audio/managermodel.h @@ -25,7 +25,7 @@ class QItemSelectionModel; //Ring -#include "../typedefs.h" +#include <typedefs.h> class ManagerModelPrivate; diff --git a/src/audio/outputdevicemodel.h b/src/audio/outputdevicemodel.h index 3b79e1c4363fbbb6aa91666a2f356c608a084cba..61fb033d1bf85457dc66c61101e468f6763d4fd7 100644 --- a/src/audio/outputdevicemodel.h +++ b/src/audio/outputdevicemodel.h @@ -24,7 +24,7 @@ #include <QtCore/QStringList> //Ring -#include "../typedefs.h" +#include <typedefs.h> class OutputDeviceModelPrivate; diff --git a/src/audio/ringtonedevicemodel.h b/src/audio/ringtonedevicemodel.h index 750566b42534c06f485db29c97ae4caaded8ff11..3f32637c0594d3ed0666799db697e18de5c80b47 100644 --- a/src/audio/ringtonedevicemodel.h +++ b/src/audio/ringtonedevicemodel.h @@ -24,7 +24,7 @@ #include <QtCore/QStringList> //Ring -#include "../typedefs.h" +#include <typedefs.h> class RingtoneDeviceModelPrivate; diff --git a/src/audio/settings.h b/src/audio/settings.h index a19ed231da584185491ce33e5c6b652f23ffd79a..a6c7d2bcf6899f23c65ee13713e7e8dda631fd77 100644 --- a/src/audio/settings.h +++ b/src/audio/settings.h @@ -21,7 +21,7 @@ #include <QtCore/QAbstractListModel> //Ring -#include "../typedefs.h" +#include <typedefs.h> namespace Audio { diff --git a/src/audio/codecmodel.cpp b/src/codecmodel.cpp similarity index 69% rename from src/audio/codecmodel.cpp rename to src/codecmodel.cpp index a33563eb38b0aeccfc27eba4c55b6eb3e707477a..918c653c6a8363e05ec4311bfc01039e295f425b 100644 --- a/src/audio/codecmodel.cpp +++ b/src/codecmodel.cpp @@ -21,6 +21,9 @@ #include <QtCore/QDebug> #include <QtCore/QCoreApplication> +//DRing +#include <account_const.h> + //Ring #include "account.h" #include "dbus/configurationmanager.h" @@ -29,7 +32,7 @@ class CodecModelPrivate : public QObject { Q_OBJECT public: - CodecModelPrivate(Audio::CodecModel* parent); + CodecModelPrivate(CodecModel* parent); ///@struct AudioCodecData store audio codec information struct AudioCodecData { int id ; @@ -47,23 +50,23 @@ public: bool findCodec(int id); private: - Audio::CodecModel* q_ptr; + CodecModel* q_ptr; }; -CodecModelPrivate::CodecModelPrivate(Audio::CodecModel* parent) : q_ptr(parent) +CodecModelPrivate::CodecModelPrivate(CodecModel* parent) : q_ptr(parent) { } ///Constructor -Audio::CodecModel::CodecModel(Account* account) : +CodecModel::CodecModel(Account* account) : QAbstractListModel(account?(QObject*)account:(QObject*)QCoreApplication::instance()), d_ptr(new CodecModelPrivate(this)) { d_ptr->m_pAccount = account; setObjectName("CodecModel: "+(account?account->id():"Unknown")); } -Audio::CodecModel::~CodecModel() +CodecModel::~CodecModel() { while (d_ptr->m_lAudioCodecs.size()) { CodecModelPrivate::AudioCodecData* c = d_ptr->m_lAudioCodecs[0]; @@ -72,64 +75,64 @@ Audio::CodecModel::~CodecModel() } } -QHash<int,QByteArray> Audio::CodecModel::roleNames() const +QHash<int,QByteArray> CodecModel::roleNames() const { static QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); static bool initRoles = false; if (!initRoles) { initRoles = true; - roles.insert(Audio::CodecModel::Role::ID ,QByteArray("id")); - roles.insert(Audio::CodecModel::Role::NAME ,QByteArray("name")); - roles.insert(Audio::CodecModel::Role::BITRATE ,QByteArray("bitrate")); - roles.insert(Audio::CodecModel::Role::SAMPLERATE,QByteArray("samplerate")); + roles.insert(CodecModel::Role::ID ,QByteArray("id")); + roles.insert(CodecModel::Role::NAME ,QByteArray("name")); + roles.insert(CodecModel::Role::BITRATE ,QByteArray("bitrate")); + roles.insert(CodecModel::Role::SAMPLERATE,QByteArray("samplerate")); } return roles; } ///Model data -QVariant Audio::CodecModel::data(const QModelIndex& idx, int role) const { +QVariant CodecModel::data(const QModelIndex& idx, int role) const { if(idx.column() == 0 && role == Qt::DisplayRole ) { return QVariant(d_ptr->m_lAudioCodecs[idx.row()]->name); } else if(idx.column() == 0 && role == Qt::CheckStateRole ) { return QVariant(d_ptr->m_lEnabledCodecs[d_ptr->m_lAudioCodecs[idx.row()]->id] ? Qt::Checked : Qt::Unchecked); } - else if (idx.column() == 0 && role == Audio::CodecModel::Role::NAME ) { + else if (idx.column() == 0 && role == CodecModel::Role::NAME ) { return d_ptr->m_lAudioCodecs[idx.row()]->name; } - else if (idx.column() == 0 && role == Audio::CodecModel::Role::BITRATE ) { + else if (idx.column() == 0 && role == CodecModel::Role::BITRATE ) { return d_ptr->m_lAudioCodecs[idx.row()]->bitrate; } - else if (idx.column() == 0 && role == Audio::CodecModel::Role::SAMPLERATE ) { + else if (idx.column() == 0 && role == CodecModel::Role::SAMPLERATE ) { return d_ptr->m_lAudioCodecs[idx.row()]->samplerate; } - else if (idx.column() == 0 && role == Audio::CodecModel::Role::ID ) { + else if (idx.column() == 0 && role == CodecModel::Role::ID ) { return d_ptr->m_lAudioCodecs[idx.row()]->id; } return QVariant(); } ///Number of audio codecs -int Audio::CodecModel::rowCount(const QModelIndex& par) const { +int CodecModel::rowCount(const QModelIndex& par) const { Q_UNUSED(par) return d_ptr->m_lAudioCodecs.size(); } ///Model flags -Qt::ItemFlags Audio::CodecModel::flags(const QModelIndex& idx) const { +Qt::ItemFlags CodecModel::flags(const QModelIndex& idx) const { if (idx.column() == 0) return QAbstractItemModel::flags(idx) | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; return QAbstractItemModel::flags(idx); } ///Set audio codec data -bool Audio::CodecModel::setData( const QModelIndex& idx, const QVariant &value, int role) { - if (idx.column() == 0 && role == Audio::CodecModel::NAME) { +bool CodecModel::setData( const QModelIndex& idx, const QVariant &value, int role) { + if (idx.column() == 0 && role == CodecModel::NAME) { d_ptr->m_lAudioCodecs[idx.row()]->name = value.toString(); emit dataChanged(idx, idx); return true; } - else if (idx.column() == 0 && role == Audio::CodecModel::BITRATE) { + else if (idx.column() == 0 && role == CodecModel::BITRATE) { d_ptr->m_lAudioCodecs[idx.row()]->bitrate = value.toString(); emit dataChanged(idx, idx); return true; @@ -139,12 +142,12 @@ bool Audio::CodecModel::setData( const QModelIndex& idx, const QVariant &value, emit dataChanged(idx, idx); return true; } - else if (idx.column() == 0 && role == Audio::CodecModel::SAMPLERATE) { + else if (idx.column() == 0 && role == CodecModel::SAMPLERATE) { d_ptr->m_lAudioCodecs[idx.row()]->samplerate = value.toString(); emit dataChanged(idx, idx); return true; } - else if (idx.column() == 0 && role == Audio::CodecModel::ID) { + else if (idx.column() == 0 && role == CodecModel::ID) { d_ptr->m_lAudioCodecs[idx.row()]->id = value.toInt(); emit dataChanged(idx, idx); return true; @@ -153,14 +156,14 @@ bool Audio::CodecModel::setData( const QModelIndex& idx, const QVariant &value, } ///Add a new audio codec -QModelIndex Audio::CodecModel::add() { +QModelIndex CodecModel::add() { d_ptr->m_lAudioCodecs << new CodecModelPrivate::AudioCodecData; emit dataChanged(index(d_ptr->m_lAudioCodecs.size()-1,0), index(d_ptr->m_lAudioCodecs.size()-1,0)); return index(d_ptr->m_lAudioCodecs.size()-1,0); } ///Remove audio codec at 'idx' -void Audio::CodecModel::remove(const QModelIndex& idx) { +void CodecModel::remove(const QModelIndex& idx) { if (idx.isValid()) { CodecModelPrivate::AudioCodecData* d = d_ptr->m_lAudioCodecs[idx.row()]; d_ptr->m_lAudioCodecs.removeAt(idx.row()); @@ -173,7 +176,7 @@ void Audio::CodecModel::remove(const QModelIndex& idx) { } ///Remove everything -void Audio::CodecModel::clear() +void CodecModel::clear() { while(d_ptr->m_lAudioCodecs.size()) { CodecModelPrivate::AudioCodecData* d = d_ptr->m_lAudioCodecs[0]; @@ -185,7 +188,7 @@ void Audio::CodecModel::clear() } ///Increase codec priority -bool Audio::CodecModel::moveUp(const QModelIndex& idx) +bool CodecModel::moveUp(const QModelIndex& idx) { if(idx.row() > 0 && idx.row() <= rowCount()) { CodecModelPrivate::AudioCodecData* data2 = d_ptr->m_lAudioCodecs[idx.row()]; @@ -198,7 +201,7 @@ bool Audio::CodecModel::moveUp(const QModelIndex& idx) } ///Decrease codec priority -bool Audio::CodecModel::moveDown(const QModelIndex& idx) +bool CodecModel::moveDown(const QModelIndex& idx) { if(idx.row() >= 0 && idx.row() < rowCount()) { CodecModelPrivate::AudioCodecData* data2 = d_ptr->m_lAudioCodecs[idx.row()]; @@ -211,23 +214,24 @@ bool Audio::CodecModel::moveDown(const QModelIndex& idx) } ///Reload the codeclist -void Audio::CodecModel::reload() +void CodecModel::reload() { ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); - QVector<int> codecIdList = configurationManager.getAudioCodecList(); + QVector<uint> codecIdList = configurationManager.getCodecList(); if (!d_ptr->m_pAccount->isNew()) { - QVector<int> activeCodecList = configurationManager.getActiveAudioCodecList(d_ptr->m_pAccount->id()); + QVector<uint> activeCodecList = configurationManager.getActiveCodecList(d_ptr->m_pAccount->id()); QStringList tmpNameList; foreach (const int aCodec, activeCodecList) { if (!d_ptr->findCodec(aCodec)) { - const QStringList codec = configurationManager.getAudioCodecDetails(aCodec); + const QMap<QString,QString> codec = configurationManager.getCodecDetails(d_ptr->m_pAccount->id(),aCodec); QModelIndex idx = add(); - setData(idx,codec[0] ,Audio::CodecModel::Role::NAME ); - setData(idx,codec[1] ,Audio::CodecModel::Role::SAMPLERATE ); - setData(idx,codec[2] ,Audio::CodecModel::Role::BITRATE ); - setData(idx,aCodec ,Audio::CodecModel::Role::ID ); + setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::NAME ] ,CodecModel::Role::NAME ); + setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE ] ,CodecModel::Role::SAMPLERATE ); + setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::BITRATE ] ,CodecModel::Role::BITRATE ); + setData(idx,QString::number(aCodec) ,CodecModel::Role::ID ); setData(idx, Qt::Checked ,Qt::CheckStateRole ); + if (codecIdList.indexOf(aCodec)!=-1) codecIdList.remove(codecIdList.indexOf(aCodec)); } @@ -236,30 +240,30 @@ void Audio::CodecModel::reload() foreach (const int aCodec, codecIdList) { if (!d_ptr->findCodec(aCodec)) { - const QStringList codec = configurationManager.getAudioCodecDetails(aCodec); + const QMap<QString,QString> codec = configurationManager.getCodecDetails(d_ptr->m_pAccount->id(),aCodec); const QModelIndex& idx = add(); - setData(idx,codec[0],Audio::CodecModel::Role::NAME ); - setData(idx,codec[1],Audio::CodecModel::Role::SAMPLERATE ); - setData(idx,codec[2],Audio::CodecModel::Role::BITRATE ); - setData(idx,aCodec ,Audio::CodecModel::Role::ID ); + setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::NAME ] ,CodecModel::Role::NAME ); + setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE ] ,CodecModel::Role::SAMPLERATE ); + setData(idx,codec[ DRing::Account::ConfProperties::CodecInfo::BITRATE ] ,CodecModel::Role::BITRATE ); + setData(idx,QString::number(aCodec) ,CodecModel::Role::ID ); setData(idx, Qt::Unchecked ,Qt::CheckStateRole); } } } ///Save details -void Audio::CodecModel::save() +void CodecModel::save() { - QStringList _codecList; + VectorUInt _codecList; for (int i=0; i < rowCount();i++) { const QModelIndex& idx = index(i,0); if (data(idx,Qt::CheckStateRole) == Qt::Checked) { - _codecList << data(idx,Audio::CodecModel::Role::ID).toString(); + _codecList << data(idx,CodecModel::Role::ID).toInt(); } } ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); - configurationManager.setActiveAudioCodecList(_codecList, d_ptr->m_pAccount->id()); + configurationManager.setActiveCodecList(d_ptr->m_pAccount->id(), _codecList); } ///Check is a codec is already in the list diff --git a/src/audio/codecmodel.h b/src/codecmodel.h similarity index 93% rename from src/audio/codecmodel.h rename to src/codecmodel.h index 01829a07d0a640bd97904a8394ba45163bc0fed0..d243ae46a415c081a97fd8e110cb5ff8d1ff4b72 100644 --- a/src/audio/codecmodel.h +++ b/src/codecmodel.h @@ -24,13 +24,11 @@ #include <QtCore/QString> //Ring -#include "../typedefs.h" +#include <typedefs.h> class Account; class CodecModelPrivate; -namespace Audio { - ///AudioCodecModel: A model for account audio codec class LIB_EXPORT CodecModel : public QAbstractListModel { #pragma GCC diagnostic push @@ -55,7 +53,7 @@ public: 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 bool setData (const QModelIndex& index, const QVariant &value, int role ) override; virtual QHash<int,QByteArray> roleNames() const override; //Mutator @@ -72,7 +70,6 @@ private: Q_DECLARE_PRIVATE(CodecModel) }; -} -Q_DECLARE_METATYPE(Audio::CodecModel*) +Q_DECLARE_METATYPE(CodecModel*) #endif diff --git a/src/dbus/callmanager.h b/src/dbus/callmanager.h index 30bba1bfb8b80e07d0f197e0f92eeb8bb94d7157..624c67f4230dc8002b24726c496683c5f2638c74 100644 --- a/src/dbus/callmanager.h +++ b/src/dbus/callmanager.h @@ -27,7 +27,7 @@ #include <QDBusPendingReply> #endif -#include "../typedefs.h" +#include <typedefs.h> namespace DBus { diff --git a/src/dbus/configurationmanager.h b/src/dbus/configurationmanager.h index c840a2f77cb6e0532162e52f6728dc98519b0c12..0d7ff904e5ecbc89f4b31b7ff22cafd74a424298 100644 --- a/src/dbus/configurationmanager.h +++ b/src/dbus/configurationmanager.h @@ -25,7 +25,7 @@ #include "configurationmanager_dbus_interface.h" #include <QDBusPendingReply> #endif -#include "../typedefs.h" +#include <typedefs.h> namespace DBus { diff --git a/src/dbus/instancemanager.h b/src/dbus/instancemanager.h index 4db375e0cc1621ac6a3b209b9944d90aff1e9f68..1b88c5ea3247f49944089d6bab7df0a3e401419a 100644 --- a/src/dbus/instancemanager.h +++ b/src/dbus/instancemanager.h @@ -25,7 +25,7 @@ #include "instance_dbus_interface.h" #include <QDBusPendingReply> #endif -#include "../typedefs.h" +#include <typedefs.h> namespace DBus { diff --git a/src/dbus/metatypes.h b/src/dbus/metatypes.h index 86a1934943c60c588c8b793b7d44f009d12d2ba2..f49f956e70096c30ee5a6420ce1eead108faf341 100644 --- a/src/dbus/metatypes.h +++ b/src/dbus/metatypes.h @@ -32,6 +32,7 @@ typedef QMap<QString, QString> MapStringString; typedef QMap<QString, int> MapStringInt; typedef QVector<int> VectorInt; +typedef QVector<uint> VectorUInt; typedef QVector< QMap<QString, QString> > VectorMapStringString; typedef QVector< QString > VectorString; typedef QMap< QString, QMap< QString, QVector<QString> > > MapStringMapStringVectorString; @@ -42,6 +43,7 @@ Q_DECLARE_METATYPE(MapStringInt) Q_DECLARE_METATYPE(VectorMapStringString) Q_DECLARE_METATYPE(MapStringMapStringVectorString) Q_DECLARE_METATYPE(VectorInt) +Q_DECLARE_METATYPE(VectorUInt) Q_DECLARE_METATYPE(VectorString) Q_DECLARE_METATYPE(MapStringVectorString) @@ -53,6 +55,7 @@ inline void registerCommTypes() { qDBusRegisterMetaType<VectorMapStringString>(); qDBusRegisterMetaType<MapStringMapStringVectorString>(); qDBusRegisterMetaType<VectorInt>(); + qDBusRegisterMetaType<VectorUInt>(); qDBusRegisterMetaType<VectorString>(); qDBusRegisterMetaType<MapStringVectorString>(); dbus_metaTypeInit = true; diff --git a/src/dbus/presencemanager.h b/src/dbus/presencemanager.h index 4b88c32d916681fea8032207c961225232dae02d..5cf875acb366d50bb1b27ce71d95e7c6980aa342 100644 --- a/src/dbus/presencemanager.h +++ b/src/dbus/presencemanager.h @@ -25,7 +25,7 @@ #include <QDBusPendingReply> #endif -#include "../typedefs.h" +#include <typedefs.h> namespace DBus { diff --git a/src/dbus/videomanager.h b/src/dbus/videomanager.h index f1c535ceae66118656f9f362fe0e8e889be63170..2dfa48ca46a2db08cb1950e296702ca411fee291 100644 --- a/src/dbus/videomanager.h +++ b/src/dbus/videomanager.h @@ -25,7 +25,7 @@ #include <QDBusPendingReply> #endif -#include "../typedefs.h" +#include <typedefs.h> namespace DBus { diff --git a/src/delegates/accountlistcolordelegate.h b/src/delegates/accountlistcolordelegate.h index 5adbac05312371f10319539e60da2a4a83dc73f2..54a284ef666a1b375b7a41f3ff5c7db35ffc0274 100644 --- a/src/delegates/accountlistcolordelegate.h +++ b/src/delegates/accountlistcolordelegate.h @@ -19,7 +19,7 @@ #ifndef ACCOUNTLISTCOLORVISITOR_H #define ACCOUNTLISTCOLORVISITOR_H -#include "../typedefs.h" +#include <typedefs.h> class Account; ///Ringlib Qt does not link to QtGui, and does not need to, this allow to add runtime Gui support diff --git a/src/delegates/itemmodelstateserializationdelegate.h b/src/delegates/itemmodelstateserializationdelegate.h index 6a4f68575efeb267b7ef61ee95db4e9daa053d5f..2f7feabb151ba129cac19d8c2dc02f02c1f25037 100644 --- a/src/delegates/itemmodelstateserializationdelegate.h +++ b/src/delegates/itemmodelstateserializationdelegate.h @@ -19,7 +19,7 @@ #ifndef ITEMMODELSTATESERIALIZATIONVISITOR_H #define ITEMMODELSTATESERIALIZATIONVISITOR_H -#include "../typedefs.h" +#include <typedefs.h> class CollectionInterface; class Account; diff --git a/src/delegates/numbercategorydelegate.h b/src/delegates/numbercategorydelegate.h index bb5627bd10da1c45ae2609dcd53c43384a84e40a..f760b238499e6f4621ad5f1ae260d50f2a862092 100644 --- a/src/delegates/numbercategorydelegate.h +++ b/src/delegates/numbercategorydelegate.h @@ -18,7 +18,7 @@ #ifndef NUMBERCATEGORYVISITOR_H #define NUMBERCATEGORYVISITOR_H -#include "../typedefs.h" +#include <typedefs.h> class NumberCategoryModel; diff --git a/src/delegates/phonenumberselectordelegate.h b/src/delegates/phonenumberselectordelegate.h index 7fd50194f7eb80f2afc6980925e71e926f0c1671..ab0018b473fcdadf7dcb2b4b47e3b355c1f25fd4 100644 --- a/src/delegates/phonenumberselectordelegate.h +++ b/src/delegates/phonenumberselectordelegate.h @@ -19,7 +19,7 @@ #ifndef PHONENUMBERSELECTOR_H #define PHONENUMBERSELECTOR_H -#include "../typedefs.h" +#include <typedefs.h> #include "../person.h" class ContactMethod; diff --git a/src/delegates/presenceserializationdelegate.h b/src/delegates/presenceserializationdelegate.h index eb3cbda2c8931db89fb5be893cedde923f043753..e6ec4b96528da4083902a171cdbe2f58946bdf58 100644 --- a/src/delegates/presenceserializationdelegate.h +++ b/src/delegates/presenceserializationdelegate.h @@ -18,7 +18,7 @@ #ifndef PRESENCESERIALIZATIONVISITOR_H #define PRESENCESERIALIZATIONVISITOR_H -#include "../typedefs.h" +#include <typedefs.h> class AbstractBookmarkModel; class CollectionInterface; diff --git a/src/delegates/profilepersisterdelegate.h b/src/delegates/profilepersisterdelegate.h index c75e3cf065540b384dc94beb82848dc15fc3b790..193964d6d142f923ef34dad9308fe06b29ca2979 100644 --- a/src/delegates/profilepersisterdelegate.h +++ b/src/delegates/profilepersisterdelegate.h @@ -19,7 +19,7 @@ #ifndef PROFILEPERSISTERVISITOR_H #define PROFILEPERSISTERVISITOR_H -#include "../typedefs.h" +#include <typedefs.h> //Qt #include <QtCore/QVariant> diff --git a/src/private/account_p.h b/src/private/account_p.h index 98649a0f2e4e9bbbf5dc9bf7281b8199b38b6319..de9b8e06b55af13984c733ac709ee1204730ea70 100644 --- a/src/private/account_p.h +++ b/src/private/account_p.h @@ -98,8 +98,7 @@ public: void reloadMod() {reload();modify();}; CredentialModel* m_pCredentials ; - Audio::CodecModel* m_pAudioCodecs ; - Video::CodecModel2* m_pVideoCodecs ; + CodecModel* m_pCodecModel ; RingToneModel* m_pRingToneModel ; KeyExchangeModel* m_pKeyExchangeModel; CipherModel* m_pCipherModel ; diff --git a/src/private/videocodec_p.h b/src/private/videocodec_p.h deleted file mode 100644 index 0316dc4755117fc5e197f939fdd9fcda8c93acac..0000000000000000000000000000000000000000 --- a/src/private/videocodec_p.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2014 by Savoir-Faire Linux * - * 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/>. * - ***************************************************************************/ -#ifndef VIDEOCODECPRIVATE_H -#define VIDEOCODECPRIVATE_H - -typedef QHash<QString,Video::Codec*> CodecHash; - -class VideoCodecPrivate -{ -public: - VideoCodecPrivate(); - - //Consts - class CodecFields { - public: - constexpr static const char* PARAMETERS = "parameters"; - constexpr static const char* ENABLED = "enabled" ; - constexpr static const char* BITRATE = "bitrate" ; - constexpr static const char* NAME = "name" ; - }; - - //Attributes - static CodecHash m_slCodecs ; - QString m_Name ; - uint m_Bitrate ; - bool m_Enabled ; - static bool m_sInit ; - QString m_Parameters; -}; - -#endif diff --git a/src/ringtonemodel.cpp b/src/ringtonemodel.cpp index 91aa2d2675ee49b4ebe33c889f02a100602fd58a..ab2529eb21bbb29feb0f760ddf97135bfe99da94 100644 --- a/src/ringtonemodel.cpp +++ b/src/ringtonemodel.cpp @@ -30,7 +30,7 @@ RingToneModel::RingToneModel(Account* a) : QAbstractTableModel(a),m_pAccount(a), m_pCurrent(nullptr) { ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance(); - QMap<QString,QString> m_hRingtonePath = configurationManager.getRingtoneList(); + QMap<QString,QString> m_hRingtonePath ;//= configurationManager.getRingtoneList(); QMutableMapIterator<QString, QString> iter(m_hRingtonePath); while (iter.hasNext()) { iter.next(); diff --git a/src/video/channel.h b/src/video/channel.h index 3c0335c388ac8ed57db57b2413339bf60219ab26..8b61bdd81996584f0739670917d356e92dea8531 100644 --- a/src/video/channel.h +++ b/src/video/channel.h @@ -18,7 +18,7 @@ #ifndef VIDEOCHANNEL_H #define VIDEOCHANNEL_H -#include "../typedefs.h" +#include <typedefs.h> //Qt #include <QtCore/QAbstractListModel> diff --git a/src/video/codec.cpp b/src/video/codec.cpp deleted file mode 100644 index b920147678e7ca5e61ae189b0bc302a69841e539..0000000000000000000000000000000000000000 --- a/src/video/codec.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2012-2015 by Savoir-Faire Linux * - * 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 "codec.h" -#include "../private/videocodec_p.h" - -#include <account.h> - - -QHash<QString,Video::Codec*> VideoCodecPrivate::m_slCodecs; -bool VideoCodecPrivate::m_sInit = false; - -VideoCodecPrivate::VideoCodecPrivate() : m_Enabled(false),m_Bitrate(0) -{ -} - -///Private constructor -Video::Codec::Codec(const QString &codecName, uint bitRate, bool enabled) : QObject(nullptr), -d_ptr(new VideoCodecPrivate()) -{ - d_ptr->m_Name = codecName; - d_ptr->m_Bitrate = bitRate ; - d_ptr->m_Enabled = enabled ; - - setObjectName("VideoCodec"+codecName); -} - -Video::Codec::~Codec() -{ -} - -///Get the current codec name -QString Video::Codec::name() const -{ - return d_ptr->m_Name; -} - -///Get the current codec id -uint Video::Codec::bitrate() const -{ - return d_ptr->m_Bitrate; -} - -///Get the current codec id -bool Video::Codec::isEnabled() const -{ - return d_ptr->m_Enabled; -} - -///Set the codec bitrate -void Video::Codec::setBitrate(const uint bitrate) -{ - d_ptr->m_Bitrate = bitrate; -} - -///Set if the codec is enabled -void Video::Codec::setEnabled(const bool enabled) -{ - d_ptr->m_Enabled = enabled; -} - -///Set codec parameters -void Video::Codec::setParamaters(const QString& params ) -{ - d_ptr->m_Parameters = params; -} - -///Get codec parameters -QString Video::Codec::parameters() const -{ - return d_ptr->m_Parameters; -} - -///Generate a daemon compatible codec representation -QMap<QString,QString> Video::Codec::toMap() const -{ - QMap<QString,QString> ret; - ret[VideoCodecPrivate::CodecFields::ENABLED ] = isEnabled ()?"true":"false"; - ret[VideoCodecPrivate::CodecFields::BITRATE ] = QString::number(bitrate()); - ret[VideoCodecPrivate::CodecFields::NAME ] = name (); - ret[VideoCodecPrivate::CodecFields::PARAMETERS ] = parameters(); - return ret; -} diff --git a/src/video/codec.h b/src/video/codec.h deleted file mode 100644 index 7a1191659e1367604d473b168d8a310a58a669d7..0000000000000000000000000000000000000000 --- a/src/video/codec.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2012-2015 by Savoir-Faire Linux * - * 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/>. * - ***************************************************************************/ -#ifndef VIDEO_CODEC_H -#define VIDEO_CODEC_H - -#include "../typedefs.h" - -//Qt -#include <QtCore/QObject> - -//Ring -class Account; -class VideoCodecPrivate; - -namespace Video { - - -///Codec: Codecs used for video calls -class LIB_EXPORT Codec : public QObject { - Q_OBJECT - friend class CodecModel2; - public: - //Properties - Q_PROPERTY(QString name READ name ) - Q_PROPERTY(uint bitrate READ bitrate WRITE setBitrate ) - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled ) - Q_PROPERTY(QString parameters READ parameters WRITE setParamaters) - - //Static setters -// static void setActiveCodecList(Account* account, const QStringList& codecs); - - //Getters - QString name () const; - uint bitrate () const; - bool isEnabled () const; - QString parameters() const; - QMap<QString,QString> toMap() const; - - //Setters - void setBitrate (const uint bitrate ); - void setEnabled (const bool enabled ); - void setParamaters(const QString& params ); - - private: - //Constructor - Codec(const QString &codecName, uint bitRate, bool enabled); - virtual ~Codec(); - - const QScopedPointer<VideoCodecPrivate> d_ptr; -}; - -} - -#endif diff --git a/src/video/codecmodel2.cpp b/src/video/codecmodel2.cpp deleted file mode 100644 index 6f998e121a85aaa282090a47ebebcf59e30f4ee7..0000000000000000000000000000000000000000 --- a/src/video/codecmodel2.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2012-2014 by Savoir-Faire Linux * - * 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 "codecmodel2.h" -#include <call.h> -#include <account.h> -#include <video/codec.h> -#include "../private/videocodec_p.h" -#include "../dbus/videomanager.h" - -#include <QtCore/QCoreApplication> - -namespace Video { -class CodecModelPrivate -{ -public: - CodecModelPrivate(); - - //Attrbutes - QList<Video::Codec*> m_lCodecs; - Account* m_pAccount; -}; -} - -Video::CodecModelPrivate::CodecModelPrivate() : m_pAccount(nullptr) -{} - -///Constructor -Video::CodecModel2::CodecModel2(Account* account) : QAbstractListModel(QCoreApplication::instance()),d_ptr(new Video::CodecModelPrivate()) -{ - d_ptr->m_pAccount = account; - reload(); -} - -///Destructor -Video::CodecModel2::~CodecModel2() -{ - while (d_ptr->m_lCodecs.size()) { - Video::Codec* c = d_ptr->m_lCodecs[0]; - d_ptr->m_lCodecs.removeAt(0); - delete c; - } -// delete d_ptr; -} - -QHash<int,QByteArray> Video::CodecModel2::roleNames() const -{ - static QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - /*static bool initRoles = false; - if (!initRoles) { - initRoles = true; - - }*/ - return roles; -} - -///Get data from the model -QVariant Video::CodecModel2::data( const QModelIndex& idx, int role) const -{ - if(idx.column() == 0 && role == Qt::DisplayRole) - return QVariant(d_ptr->m_lCodecs[idx.row()]->name()); - else if(idx.column() == 0 && role == Qt::CheckStateRole) { - return QVariant(d_ptr->m_lCodecs[idx.row()]->isEnabled()?Qt::Checked:Qt::Unchecked); - } - else if (idx.column() == 0 && role == Video::CodecModel2::BITRATE_ROLE) - return QVariant(d_ptr->m_lCodecs[idx.row()]->bitrate()); - return QVariant(); -} - -///The number of codec -int Video::CodecModel2::rowCount( const QModelIndex& par ) const -{ - Q_UNUSED(par) - return d_ptr->m_lCodecs.size(); -} - -///Items flag -Qt::ItemFlags Video::CodecModel2::flags( const QModelIndex& idx ) const -{ - if (idx.column() == 0) - return QAbstractItemModel::flags(idx) | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; - return QAbstractItemModel::flags(idx); -} - -///Set the codec data (codecs can't be added or removed that way) -bool Video::CodecModel2::setData(const QModelIndex& idx, const QVariant &value, int role) -{ - - if (idx.column() == 0 && role == Qt::CheckStateRole) { - bool changed = d_ptr->m_lCodecs[idx.row()]->isEnabled() != (value == Qt::Checked); - d_ptr->m_lCodecs[idx.row()]->setEnabled(value == Qt::Checked); - if (changed) - emit dataChanged(idx, idx); - return true; - } - else if (idx.column() == 0 && role == Video::CodecModel2::BITRATE_ROLE) { - bool changed = d_ptr->m_lCodecs[idx.row()]->bitrate() != value.toUInt(); - d_ptr->m_lCodecs[idx.row()]->setBitrate(value.toInt()); - if (changed) - emit dataChanged(idx, idx); - return true; - } - return false; -} - -///Force a model reload from dbus -void Video::CodecModel2::reload() -{ - while (d_ptr->m_lCodecs.size()) { - Video::Codec* c = d_ptr->m_lCodecs[0]; - d_ptr->m_lCodecs.removeAt(0); - delete c; - } - VideoManagerInterface& interface = DBus::VideoManager::instance(); - const VectorMapStringString codecs = interface.getCodecs(d_ptr->m_pAccount->id()); - foreach(const MapStringString& h,codecs) { - Video::Codec* c = new Video::Codec(h[VideoCodecPrivate::CodecFields::NAME], - h[VideoCodecPrivate::CodecFields::BITRATE].toInt(), - h[VideoCodecPrivate::CodecFields::ENABLED]=="true"); - c->setParamaters(h[VideoCodecPrivate::CodecFields::PARAMETERS]); - d_ptr->m_lCodecs << c; - } - emit dataChanged(index(0,0), index(d_ptr->m_lCodecs.size()-1,0)); -} - -///Save the current model over dbus -void Video::CodecModel2::save() -{ - VideoManagerInterface& interface = DBus::VideoManager::instance(); - VectorMapStringString toSave; - foreach(Video::Codec* vc, d_ptr->m_lCodecs) { - toSave << vc->toMap(); - } - interface.setCodecs(d_ptr->m_pAccount->id(),toSave); -} - -///Increase codec priority -bool Video::CodecModel2::moveUp(const QModelIndex& idx) -{ - if(idx.row() > 0 && idx.row() <= rowCount()) { - Video::Codec* data2 = d_ptr->m_lCodecs[idx.row()]; - d_ptr->m_lCodecs.removeAt(idx.row()); - d_ptr->m_lCodecs.insert(idx.row() - 1, data2); - emit dataChanged(index(idx.row() - 1, 0, QModelIndex()), index(idx.row(), 0, QModelIndex())); - return true; - } - return false; -} - -///Decrease codec priority -bool Video::CodecModel2::moveDown(const QModelIndex& idx) -{ - if(idx.row() >= 0 && idx.row() < rowCount()) { - Video::Codec* data2 = d_ptr->m_lCodecs[idx.row()]; - d_ptr->m_lCodecs.removeAt(idx.row()); - d_ptr->m_lCodecs.insert(idx.row() + 1, data2); - emit dataChanged(index(idx.row(), 0, QModelIndex()), index(idx.row() + 1, 0, QModelIndex())); - return true; - } - return false; -} diff --git a/src/video/codecmodel2.h b/src/video/codecmodel2.h deleted file mode 100644 index 076a2fd22fd9726f2a674b111c16d213253c2ad9..0000000000000000000000000000000000000000 --- a/src/video/codecmodel2.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2012-2014 by Savoir-Faire Linux * - * 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/>. * - ***************************************************************************/ -#ifndef CODECMODEL2_H -#define CODECMODEL2_H - -#include "../typedefs.h" -#include <QtCore/QAbstractListModel> - -//Qt - -//Ring -class Account; - -//Typedef -namespace Video { - class Codec; -} - -typedef QHash<QString,Video::Codec*> CodecHash; - - -namespace Video { - -class CodecModelPrivate; - -///Abstract model for managing account video codec list -class LIB_EXPORT CodecModel2 : public QAbstractListModel { - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" - Q_OBJECT - #pragma GCC diagnostic pop - -public: - //Private constructor, can only be called by 'Account' - explicit CodecModel2(Account* account = nullptr); - virtual ~CodecModel2(); - - //Roles - static const int BITRATE_ROLE = 101; - - //Model functions - 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; - - void reload(); - void save(); - bool moveUp (const QModelIndex& idx); - bool moveDown(const QModelIndex& idx); - -private: - QScopedPointer<CodecModelPrivate> d_ptr; - -}; - -} -Q_DECLARE_METATYPE(Video::CodecModel2*) -#endif diff --git a/src/video/device.h b/src/video/device.h index e2cf6e9511f26fe7c329be287873cc058089d90d..8ebbca85fb7c8b68f69c7bd105ee22fb56bb39a6 100644 --- a/src/video/device.h +++ b/src/video/device.h @@ -18,7 +18,7 @@ #ifndef VIDEO_DEVICE_H #define VIDEO_DEVICE_H -#include "../typedefs.h" +#include <typedefs.h> #include <QtCore/QAbstractListModel> //Qt diff --git a/src/video/devicemodel.cpp b/src/video/devicemodel.cpp index 2e8b3fd8b1c55d35b78a9b49d1d9403cd3e24ef6..45e55ee4c25bc83065d856ed2d1d9d6b9a0f28c1 100644 --- a/src/video/devicemodel.cpp +++ b/src/video/devicemodel.cpp @@ -19,7 +19,6 @@ #include "device.h" #include <call.h> #include <account.h> -#include "codec.h" #include "../dbus/videomanager.h" #include <QtCore/QCoreApplication> diff --git a/src/video/devicemodel.h b/src/video/devicemodel.h index a208c6ca1a7e6616dccb8730099f8a42a6e8fc4a..13063e7182a29bf07a4e15e1021926e058262c75 100644 --- a/src/video/devicemodel.h +++ b/src/video/devicemodel.h @@ -18,7 +18,7 @@ #ifndef VIDEODEVICEMODEL_H #define VIDEODEVICEMODEL_H -#include "../typedefs.h" +#include <typedefs.h> #include <QtCore/QAbstractListModel> #include <QtCore/QUrl> #include <QtCore/QRect> diff --git a/src/video/manager.h b/src/video/manager.h index 2434a16e9ce7cae63f462b54ee5a1676a94198b8..634fc898f87c8024d8f574b39f3c1a59e918f0c8 100644 --- a/src/video/manager.h +++ b/src/video/manager.h @@ -18,7 +18,7 @@ #ifndef MANAGER_H #define MANAGER_H //Base -#include "../typedefs.h" +#include <typedefs.h> #include <QtCore/QThread> //Qt diff --git a/src/video/rate.h b/src/video/rate.h index 72a7ed6029048f7046058d26d73f09e8d04a0372..33e183c764def560afe542fbfb7d5b0b229bdee1 100644 --- a/src/video/rate.h +++ b/src/video/rate.h @@ -18,7 +18,7 @@ #ifndef VIDEORATE_H #define VIDEORATE_H -#include "../typedefs.h" +#include <typedefs.h> //Ring namespace Video { diff --git a/src/video/renderer.h b/src/video/renderer.h index ed1902f1d069f22ca5d42e8a388e45990f537a5b..ed895255b0aa9a93032d49c1eaaef90cc46dc351 100644 --- a/src/video/renderer.h +++ b/src/video/renderer.h @@ -21,7 +21,7 @@ //Base #include <QtCore/QObject> #include <QtCore/QTime> -#include "../typedefs.h" +#include <typedefs.h> #include <time.h> //Qt diff --git a/src/video/resolution.h b/src/video/resolution.h index 1dfeeee112d9fbcc48e4f4c4e21bd762042c326d..6756a232cd443d144b710b94bf146841b89c7571 100644 --- a/src/video/resolution.h +++ b/src/video/resolution.h @@ -20,7 +20,7 @@ #include <QtCore/QAbstractListModel> #include <QtCore/QSize> -#include "../typedefs.h" +#include <typedefs.h> namespace Video { class Rate; diff --git a/src/video/sourcesmodel.h b/src/video/sourcesmodel.h index 782185c4fbd8505012d414735d145400f9889324..85818aca9fe38f961a715d78052693e1650e51af 100644 --- a/src/video/sourcesmodel.h +++ b/src/video/sourcesmodel.h @@ -19,7 +19,7 @@ #define VIDEOSOURCESMODEL_H #include <QtCore/QAbstractListModel> #include <QtCore/QRect> -#include "../typedefs.h" +#include <typedefs.h> //Ring diff --git a/xml/configurationmanager-introspec.xml b/xml/configurationmanager-introspec.xml index 5e198c3c1f258ab30c889683d187ab9a0a6244a4..4720cd1c4ae5358b97d5e57cc57a02c5fe2cc0fa 100644 --- a/xml/configurationmanager-introspec.xml +++ b/xml/configurationmanager-introspec.xml @@ -368,34 +368,34 @@ <!-- Codecs-related methods --> - <method name="getAudioCodecList" tp:name-for-bindings="getAudioCodecList"> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorInt"/> - <arg type="ai" name="list" direction="out"> + <method name="getCodecList" tp:name-for-bindings="getCodecList"> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorUInt"/> + <arg type="au" name="list" direction="out"> </arg> </method> - <method name="getAudioCodecDetails" tp:name-for-bindings="getAudioCodecDetails"> - <arg type="i" name="payload" direction="in"> - </arg> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorString"/> - <arg type="as" name="details" direction="out"> + <method name="getCodecDetails" tp:name-for-bindings="getCodecDetails"> + <arg type="s" name="accountID" direction="in"></arg> + <arg type="u" name="codecId" direction="in"></arg> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="MapStringString"/> + <arg type="a{ss}" name="details" direction="out" tp:type="String_String_Map"> </arg> </method> - <method name="getActiveAudioCodecList" tp:name-for-bindings="getActiveAudioCodecList"> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorInt"/> + <method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList"> <arg type="s" name="accountID" direction="in"> </arg> - <arg type="ai" name="list" direction="out"> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorUInt"/> + <arg type="au" name="list" direction="out"> </arg> </method> - <method name="setActiveAudioCodecList" tp:name-for-bindings="setActiveAudioCodecList"> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="VectorString"/> - <arg type="as" name="list" direction="in"> - </arg> + <method name="setActiveCodecList" tp:name-for-bindings="setActiveCodecList"> <arg type="s" name="accountID" direction="in"> </arg> + <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="VectorUInt"/> + <arg type="au" name="list" direction="in"> + </arg> </method> <!-- Audio devices methods --> @@ -464,16 +464,6 @@ </arg> </method> - <method name="getRingtoneList" tp:name-for-bindings="getRingtoneList"> - <tp:added version="1.1.1"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="MapStringString"/> - <tp:docstring> - Get a map [Path,Filename] of available ringtone. Note, set the ringtone with the complete path - </tp:docstring> - <arg type="a{ss}" name="list" direction="out"> - </arg> - </method> - <!-- General Settings Panel --> <method name="getNoiseSuppressState" tp:name-for-bindings="getNoiseSuppressState"> @@ -632,7 +622,7 @@ </arg> </method> - <method name="getTlsSettingsDefault" tp:name-for-bindings="getTlsSettingsDefault"> + <method name="getTlsDefaultSettings" tp:name-for-bindings="getTlsDefaultSettings"> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="MapStringString"/> <arg type="a{ss}" name="details" direction="out"> </arg> @@ -666,7 +656,7 @@ <arg type="a{ss}" name="details" direction="out"> <tp:docstring> <p>A key-value list of all certificate validation</p> - The constants used as keys are defined in the "security_const.h" constants header file + The constants used as keys are defined in the "security.h" constants header file </tp:docstring> </arg> </method> @@ -681,7 +671,7 @@ <arg type="a{ss}" name="details" direction="out"> <tp:docstring> <p>A key-value list of all certificate details</p> - The constants used as keys are defined in the "security_const.h" constants header file + The constants used as keys are defined in the "security.h" constants header file </tp:docstring> </arg> </method> @@ -716,31 +706,5 @@ <arg type="a{ss}" name="shortcutsMap" direction="in"> </arg> </method> - - <!-- Security Methods --> - <method name="checkForPrivateKey" tp:name-for-bindings="checkForPrivateKey"> - <arg type="s" name="pemPath" direction="in"> - </arg> - <arg type="b" name="containPrivateKey" direction="out"> - </arg> - </method> - - <method name="checkCertificateValidity" tp:name-for-bindings="checkCertificateValidity"> - <arg type="s" name="caPath" direction="in"> - </arg> - <arg type="s" name="pemPath" direction="in"> - </arg> - <arg type="b" name="isValid" direction="out"> - </arg> - </method> - - <method name="checkHostnameCertificate" tp:name-for-bindings="checkHostnameCertificate"> - <arg type="s" name="host" direction="in"> - </arg> - <arg type="s" name="port" direction="in"> - </arg> - <arg type="b" name="isValid" direction="out"> - </arg> - </method> </interface> </node> diff --git a/xml/videomanager-introspec.xml b/xml/videomanager-introspec.xml index de9761b9fb7bcb5f8654076db775bc8a5400218a..4e6fcc2a9f72857ff79666692952ef09be42a026 100644 --- a/xml/videomanager-introspec.xml +++ b/xml/videomanager-introspec.xml @@ -47,26 +47,6 @@ </arg> </method> - <!-- Video Codec related methods --> - - <method name="getCodecs" tp:name-for-bindings="getCodecs"> - <tp:docstring>Gets the hashtable describing all the codecs and their parameters for a given account</tp:docstring> - <arg type="s" name="accountID" direction="in"> - </arg> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/> - <arg type="aa{ss}" name="details" direction="out"> - </arg> - </method> - - <method name="setCodecs" tp:name-for-bindings="setCodecs"> - <tp:docstring>Sets a vector of hashtables describing codecs and their parameters for a given account, one hashtable per codec</tp:docstring> - <arg type="s" name="accountID" direction="in"> - </arg> - <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="VectorMapStringString"/> - <arg type="aa{ss}" name="details" direction="in"> - </arg> - </method> - <method name="startCamera" tp:name-for-bindings="startCamera"> <tp:docstring> Starts the video camera, which renders the active v4l2 device's video to shared memory. Useful for testing/debugging camera settings</tp:docstring> </method> @@ -134,10 +114,5 @@ </arg> </signal> - <method name="getCurrentCodecName" tp:name-for-bindings="getCurrentCodecName"> - <annotation name="org.freedesktop.DBus.Deprecated" value="true"/> - <arg type="s" name="callID" direction="in"/> - <arg type="s" name="codecName" direction="out"/> - </method> </interface> </node>