Commit 9594e158 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/Codecs): in progress

parent dad9c3fc
......@@ -92,8 +92,9 @@ set(SOURCES
src/components/camera/MSFunctions.cpp
src/components/chat/ChatModel.cpp
src/components/chat/ChatProxyModel.cpp
src/components/codecs/CodecsModel.cpp
src/components/codecs/AbstractCodecsModel.cpp
src/components/codecs/AudioCodecsModel.cpp
src/components/codecs/CodecsModel.cpp
src/components/codecs/VideoCodecsModel.cpp
src/components/contact/ContactModel.cpp
src/components/contact/VcardModel.cpp
......@@ -129,9 +130,10 @@ set(HEADERS
src/components/calls/CallsListModel.hpp
src/components/chat/ChatModel.hpp
src/components/chat/ChatProxyModel.hpp
src/components/codecs/CodecsModel.cpp
src/components/codecs/AudioCodecsModel.cpp
src/components/codecs/VideoCodecsModel.cpp
src/components/codecs/CodecsModel.hpp
src/components/codecs/AbstractCodecsModel.hpp
src/components/codecs/AudioCodecsModel.hpp
src/components/codecs/VideoCodecsModel.hpp
src/components/contact/ContactModel.hpp
src/components/contact/VcardModel.hpp
src/components/contacts/ContactsListModel.hpp
......
......@@ -236,6 +236,33 @@
Server url not configured.</translation>
</message>
</context>
<context>
<name>CodecsViewer</name>
<message>
<source>codecMime</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecEncoderDescription</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecEncoderClockRate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecBitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecRecvFmtp</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecStatus</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfirmDialog</name>
<message>
......
......@@ -236,6 +236,33 @@
Url du serveur non configurée.</translation>
</message>
</context>
<context>
<name>CodecsViewer</name>
<message>
<source>codecMime</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecEncoderDescription</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecEncoderClockRate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecBitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecRecvFmtp</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>codecStatus</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfirmDialog</name>
<message>
......
/*
* AbstractCodecsModel.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: April 4, 2017
* Author: Ronan Abhamon
*/
#include "CodecsModel.hpp"
#include "AbstractCodecsModel.hpp"
// =============================================================================
AbstractCodecsModel::AbstractCodecsModel (QObject *parent) : QSortFilterProxyModel(parent) {}
void AbstractCodecsModel::enableCodec (int id, bool status) {
QModelIndex source_index = mapToSource(index(id, 0));
static_cast<CodecsModel *>(sourceModel())->enableCodec(source_index.row(), status);
}
/*
* AbstractCodecsModel.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: April 4, 2017
* Author: Ronan Abhamon
*/
#ifndef ABSTRACT_CODECS_MODEL_H_
#define ABSTRACT_CODECS_MODEL_H_
#include <QSortFilterProxyModel>
// =============================================================================
class AbstractCodecsModel : public QSortFilterProxyModel {
Q_OBJECT;
public:
AbstractCodecsModel (QObject *parent = Q_NULLPTR);
virtual ~AbstractCodecsModel () = default;
Q_INVOKABLE void enableCodec (int id, bool status);
protected:
virtual bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override = 0;
};
#endif // ABSTRACT_CODECS_MODEL_H_
......@@ -26,7 +26,7 @@
// =============================================================================
AudioCodecsModel::AudioCodecsModel (QObject *parent) : QSortFilterProxyModel(parent) {
AudioCodecsModel::AudioCodecsModel (QObject *parent) : AbstractCodecsModel(parent) {
setSourceModel(CoreManager::getInstance()->getCodecsModel());
}
......
......@@ -23,11 +23,11 @@
#ifndef AUDIO_CODECS_MODEL_H_
#define AUDIO_CODECS_MODEL_H_
#include <QSortFilterProxyModel>
#include "AbstractCodecsModel.hpp"
// =============================================================================
class AudioCodecsModel : public QSortFilterProxyModel {
class AudioCodecsModel : public AbstractCodecsModel {
Q_OBJECT;
public:
......
......@@ -83,3 +83,9 @@ QVariant CodecsModel::data (const QModelIndex &index, int role) const {
return QVariant();
}
// -----------------------------------------------------------------------------
void CodecsModel::enableCodec (int id, bool status) {
// TODO.
}
......@@ -47,6 +47,8 @@ public:
QHash<int, QByteArray> roleNames () const override;
QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
void enableCodec (int id, bool status);
private:
QVariantList m_codecs;
};
......
......@@ -26,7 +26,7 @@
// =============================================================================
VideoCodecsModel::VideoCodecsModel (QObject *parent) : QSortFilterProxyModel(parent) {
VideoCodecsModel::VideoCodecsModel (QObject *parent) : AbstractCodecsModel(parent) {
setSourceModel(CoreManager::getInstance()->getCodecsModel());
}
......
......@@ -23,11 +23,11 @@
#ifndef VIDEO_CODECS_MODEL_H_
#define VIDEO_CODECS_MODEL_H_
#include <QSortFilterProxyModel>
#include "AbstractCodecsModel.hpp"
// =============================================================================
class VideoCodecsModel : public QSortFilterProxyModel {
class VideoCodecsModel : public AbstractCodecsModel {
Q_OBJECT;
public:
......
......@@ -21,6 +21,36 @@ Column {
}
height: CodecsViewerStyle.legend.height
spacing: CodecsViewerStyle.column.spacing
CodecLegend {
Layout.preferredWidth: CodecsViewerStyle.column.mimeWidth
text: qsTr('codecMime')
}
CodecLegend {
Layout.preferredWidth: CodecsViewerStyle.column.encoderDescriptionWidth
text: qsTr('codecEncoderDescription')
}
CodecLegend {
Layout.preferredWidth: CodecsViewerStyle.column.clockRateWidth
text: qsTr('codecEncoderClockRate')
}
CodecLegend {
Layout.preferredWidth: CodecsViewerStyle.column.bitrateWidth
text: qsTr('codecBitrate')
}
CodecLegend {
Layout.preferredWidth: CodecsViewerStyle.column.recvFmtpWidth
text: qsTr('codecRecvFmtp')
}
CodecLegend {
text: qsTr('codecStatus')
}
}
// ---------------------------------------------------------------------------
......@@ -78,7 +108,9 @@ Column {
}
Switch {
checked: $codec.enabled
onClicked: view.model.enableCodec(index, !checked)
}
}
......
cmake-builder @ bc6df3cf
Subproject commit adfd9bf2811f94337364642d2115c93c8ef5d05f
Subproject commit bc6df3cfa2c2f8cc54fb225735374c246b68721b
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