Commit 336abb50 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/codecs/CodecsModel): in progress

parent f91aaf01
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// ============================================================================ // ============================================================================
template<typename T> template<typename T>
inline void addCodecToList (QVariantList &list, const T &codec, CodecsModel::CodecType type) { inline void addCodecToList (QList<QVariantMap> &list, const T &codec, CodecsModel::CodecType type) {
QVariantMap map; QVariantMap map;
map["bitrate"] = codec->getNormalBitrate(); map["bitrate"] = codec->getNormalBitrate();
...@@ -89,6 +89,12 @@ QVariant CodecsModel::data (const QModelIndex &index, int role) const { ...@@ -89,6 +89,12 @@ QVariant CodecsModel::data (const QModelIndex &index, int role) const {
void CodecsModel::enableCodec (int id, bool status) { void CodecsModel::enableCodec (int id, bool status) {
Q_ASSERT(id >= 0 && id < m_codecs.count()); Q_ASSERT(id >= 0 && id < m_codecs.count());
shared_ptr<linphone::PayloadType> codec = m_codecs[id].toMap().value("__codec").value<shared_ptr<linphone::PayloadType> >();
QVariantMap &map = m_codecs[id];
shared_ptr<linphone::PayloadType> codec = map.value("__codec").value<shared_ptr<linphone::PayloadType> >();
codec->enable(status); codec->enable(status);
map["enabled"] = status;
emit dataChanged(index(id, 0), index(id, 0));
} }
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
void enableCodec (int id, bool status); void enableCodec (int id, bool status);
private: private:
QVariantList m_codecs; QList<QVariantMap> m_codecs;
}; };
Q_DECLARE_METATYPE(std::shared_ptr<linphone::PayloadType> ); Q_DECLARE_METATYPE(std::shared_ptr<linphone::PayloadType> );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment