diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index 3c228dd78..e77b6b600 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -275,6 +275,8 @@ ui/modules/Linphone/Chat/Message.js ui/modules/Linphone/Chat/Message.qml ui/modules/Linphone/Chat/OutgoingMessage.qml + ui/modules/Linphone/Codecs/CodecAttribute.qml + ui/modules/Linphone/Codecs/CodecLegend.qml ui/modules/Linphone/Codecs/CodecsViewer.qml ui/modules/Linphone/Contact/Avatar.qml ui/modules/Linphone/Contact/ContactDescription.qml @@ -293,6 +295,7 @@ ui/modules/Linphone/Styles/Calls/CallsStyle.qml ui/modules/Linphone/Styles/CardBlockStyle.qml ui/modules/Linphone/Styles/ChatStyle.qml + ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml ui/modules/Linphone/Styles/Contact/AvatarStyle.qml ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml ui/modules/Linphone/Styles/Contact/ContactStyle.qml diff --git a/linphone-desktop/src/components/codecs/CodecsModel.cpp b/linphone-desktop/src/components/codecs/CodecsModel.cpp index 34fd9e51d..36e9bd855 100644 --- a/linphone-desktop/src/components/codecs/CodecsModel.cpp +++ b/linphone-desktop/src/components/codecs/CodecsModel.cpp @@ -42,6 +42,7 @@ inline void addCodecToList (QVariantList &list, const T &codec, CodecsModel::Cod map["mime"] = ::Utils::linphoneStringToQString(codec->getMimeType()); map["number"] = codec->getNumber(); map["type"] = type; + map["recvFmtp"] = ::Utils::linphoneStringToQString(codec->getRecvFmtp()); list << map; } @@ -49,13 +50,15 @@ inline void addCodecToList (QVariantList &list, const T &codec, CodecsModel::Cod // ----------------------------------------------------------------------------- CodecsModel::CodecsModel (QObject *parent) : QAbstractListModel(parent) { - for (const auto &codec : CoreManager::getInstance()->getCore()->getAudioPayloadTypes()) + shared_ptr core = CoreManager::getInstance()->getCore(); + + for (const auto &codec : core->getAudioPayloadTypes()) addCodecToList(m_codecs, codec, AudioCodec); - for (const auto &codec : CoreManager::getInstance()->getCore()->getVideoPayloadTypes()) + for (const auto &codec : core->getVideoPayloadTypes()) addCodecToList(m_codecs, codec, VideoCodec); - for (const auto &codec : CoreManager::getInstance()->getCore()->getTextPayloadTypes()) + for (const auto &codec : core->getTextPayloadTypes()) addCodecToList(m_codecs, codec, TextCodec); } diff --git a/linphone-desktop/ui/modules/Linphone/Codecs/CodecAttribute.qml b/linphone-desktop/ui/modules/Linphone/Codecs/CodecAttribute.qml new file mode 100644 index 000000000..80644a861 --- /dev/null +++ b/linphone-desktop/ui/modules/Linphone/Codecs/CodecAttribute.qml @@ -0,0 +1,11 @@ +import QtQuick 2.7 + +import Linphone.Styles 1.0 + +// ============================================================================= + +Text { + color: CodecsViewerStyle.attribute.color + elide: Text.ElideRight + font.pointSize: CodecsViewerStyle.attribute.fontSize +} diff --git a/linphone-desktop/ui/modules/Linphone/Codecs/CodecLegend.qml b/linphone-desktop/ui/modules/Linphone/Codecs/CodecLegend.qml new file mode 100644 index 000000000..a8a2a2d4b --- /dev/null +++ b/linphone-desktop/ui/modules/Linphone/Codecs/CodecLegend.qml @@ -0,0 +1,15 @@ +import QtQuick 2.7 + +import Linphone.Styles 1.0 + +// ============================================================================= + +Text { + color: CodecsViewerStyle.legend.color + elide: Text.ElideRight + + font { + bold: true + pointSize: CodecsViewerStyle.legend.fontSize + } +} diff --git a/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml b/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml index 01098327d..fb9531c35 100644 --- a/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml +++ b/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml @@ -2,58 +2,90 @@ import QtQuick 2.7 import QtQuick.Layouts 1.3 import Common 1.0 +import Linphone.Styles 1.0 // ============================================================================= -ColumnLayout { +Column { property alias model: view.model - // --------------------------------------------------------------------------- - - height: 350 - // --------------------------------------------------------------------------- // Header. // --------------------------------------------------------------------------- Row { - Layout.fillWidth: true - height: 50 + anchors { + left: parent.left + leftMargin: CodecsViewerStyle.leftMargin + right: parent.right + } + + height: CodecsViewerStyle.legend.height } // --------------------------------------------------------------------------- // Codecs. // --------------------------------------------------------------------------- - ScrollableListView { + ListView { id: view - Layout.fillWidth: true - Layout.fillHeight: true + boundsBehavior: Flickable.StopAtBounds + clip: true + spacing: 0 + + anchors { + left: parent.left + leftMargin: CodecsViewerStyle.leftMargin + right: parent.right + } + + height: count * CodecsViewerStyle.attribute.height delegate: Rectangle { - color: 'red' - height: 30 - width: view.width + color: 'transparent' - Row { + height: CodecsViewerStyle.attribute.height + width: parent.width + + RowLayout { anchors.fill: parent + spacing: CodecsViewerStyle.column.spacing - Text { + CodecAttribute { + Layout.preferredWidth: CodecsViewerStyle.column.mimeWidth text: $codec.mime } - Text { - text: $codec.description + CodecAttribute { + Layout.preferredWidth: CodecsViewerStyle.column.encoderDescriptionWidth + text: $codec.encoderDescription } - Text { - text: $codec.channels + CodecAttribute { + Layout.preferredWidth: CodecsViewerStyle.column.clockRateWidth + text: $codec.clockRate } - Text { + CodecAttribute { + Layout.preferredWidth: CodecsViewerStyle.column.bitrateWidth text: $codec.bitrate } + + TextField { + Layout.preferredWidth: CodecsViewerStyle.column.recvFmtpWidth + text: $codec.recvFmtp + } + + Switch { + + } + } + + MouseArea { + id: mouseArea + + anchors.fill: parent } } } diff --git a/linphone-desktop/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml b/linphone-desktop/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml new file mode 100644 index 000000000..144b30b77 --- /dev/null +++ b/linphone-desktop/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml @@ -0,0 +1,32 @@ +pragma Singleton +import QtQuick 2.7 + +import Common 1.0 + +// ============================================================================= + +QtObject { + property int leftMargin: 10 + + property QtObject attribute: QtObject { + property color color: Colors.j + property int fontSize: 10 + property int height: 40 + } + + property QtObject column: QtObject { + property int spacing: 5 + + property int bitrateWidth: 100 + property int clockRateWidth: 100 + property int recvFmtpWidth: 200 + property int encoderDescriptionWidth: 300 + property int mimeWidth: 100 + } + + property QtObject legend: QtObject { + property color color: Colors.k + property int fontSize: 10 + property int height: 50 + } +} diff --git a/linphone-desktop/ui/modules/Linphone/Styles/qmldir b/linphone-desktop/ui/modules/Linphone/Styles/qmldir index 39058d533..3e691cb5f 100644 --- a/linphone-desktop/ui/modules/Linphone/Styles/qmldir +++ b/linphone-desktop/ui/modules/Linphone/Styles/qmldir @@ -13,6 +13,8 @@ singleton ChatStyle 1.0 ChatStyle.qml singleton CallsStyle 1.0 Calls/CallsStyle.qml singleton CallControlsStyle 1.0 Calls/CallControlsStyle.qml +singleton CodecsViewerStyle 1.0 Codecs/CodecsViewerStyle.qml + singleton AvatarStyle 1.0 Contact/AvatarStyle.qml singleton ContactDescriptionStyle 1.0 Contact/ContactDescriptionStyle.qml singleton ContactStyle 1.0 Contact/ContactStyle.qml