Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
57a84010
Commit
57a84010
authored
Apr 05, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/Codecs): supports fields edition
parent
39a8ee9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
3 deletions
+42
-3
AbstractCodecsModel.cpp
...one-desktop/src/components/codecs/AbstractCodecsModel.cpp
+34
-2
AbstractCodecsModel.hpp
...one-desktop/src/components/codecs/AbstractCodecsModel.hpp
+3
-0
CodecsViewer.qml
linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml
+5
-1
No files found.
linphone-desktop/src/components/codecs/AbstractCodecsModel.cpp
View file @
57a84010
...
@@ -27,8 +27,16 @@
...
@@ -27,8 +27,16 @@
#include "AbstractCodecsModel.hpp"
#include "AbstractCodecsModel.hpp"
using
namespace
std
;
// =============================================================================
// =============================================================================
inline
shared_ptr
<
linphone
::
PayloadType
>
getCodecFromMap
(
const
QVariantMap
&
map
)
{
return
map
.
value
(
"__codec"
).
value
<
shared_ptr
<
linphone
::
PayloadType
>
>
();
}
// -----------------------------------------------------------------------------
AbstractCodecsModel
::
AbstractCodecsModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{}
AbstractCodecsModel
::
AbstractCodecsModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{}
int
AbstractCodecsModel
::
rowCount
(
const
QModelIndex
&
)
const
{
int
AbstractCodecsModel
::
rowCount
(
const
QModelIndex
&
)
const
{
...
@@ -59,10 +67,10 @@ void AbstractCodecsModel::enableCodec (int id, bool status) {
...
@@ -59,10 +67,10 @@ void AbstractCodecsModel::enableCodec (int id, bool status) {
Q_ASSERT
(
id
>=
0
&&
id
<
m_codecs
.
count
());
Q_ASSERT
(
id
>=
0
&&
id
<
m_codecs
.
count
());
QVariantMap
&
map
=
m_codecs
[
id
];
QVariantMap
&
map
=
m_codecs
[
id
];
shared_ptr
<
linphone
::
PayloadType
>
codec
=
map
.
value
(
"__codec"
).
value
<
shared_ptr
<
linphone
::
PayloadType
>
>
(
);
shared_ptr
<
linphone
::
PayloadType
>
codec
=
getCodecFromMap
(
map
);
codec
->
enable
(
status
);
codec
->
enable
(
status
);
map
[
"enabled"
]
=
status
;
map
[
"enabled"
]
=
codec
->
enabled
()
;
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
}
}
...
@@ -71,6 +79,30 @@ void AbstractCodecsModel::moveCodec (int source, int destination) {
...
@@ -71,6 +79,30 @@ void AbstractCodecsModel::moveCodec (int source, int destination) {
moveRow
(
QModelIndex
(),
source
,
QModelIndex
(),
destination
);
moveRow
(
QModelIndex
(),
source
,
QModelIndex
(),
destination
);
}
}
void
AbstractCodecsModel
::
setBitrate
(
int
id
,
int
bitrate
)
{
Q_ASSERT
(
id
>=
0
&&
id
<
m_codecs
.
count
());
QVariantMap
&
map
=
m_codecs
[
id
];
shared_ptr
<
linphone
::
PayloadType
>
codec
=
getCodecFromMap
(
map
);
codec
->
setNormalBitrate
(
bitrate
);
map
[
"bitrate"
]
=
codec
->
getNormalBitrate
();
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
}
void
AbstractCodecsModel
::
setRecvFmtp
(
int
id
,
const
QString
&
recv_fmtp
)
{
Q_ASSERT
(
id
>=
0
&&
id
<
m_codecs
.
count
());
QVariantMap
&
map
=
m_codecs
[
id
];
shared_ptr
<
linphone
::
PayloadType
>
codec
=
getCodecFromMap
(
map
);
codec
->
setRecvFmtp
(
::
Utils
::
qStringToLinphoneString
(
recv_fmtp
));
map
[
"recvFmtp"
]
=
::
Utils
::
linphoneStringToQString
(
codec
->
getRecvFmtp
());
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
AbstractCodecsModel
::
moveRows
(
bool
AbstractCodecsModel
::
moveRows
(
...
...
linphone-desktop/src/components/codecs/AbstractCodecsModel.hpp
View file @
57a84010
...
@@ -48,6 +48,9 @@ public:
...
@@ -48,6 +48,9 @@ public:
Q_INVOKABLE
void
enableCodec
(
int
id
,
bool
status
);
Q_INVOKABLE
void
enableCodec
(
int
id
,
bool
status
);
Q_INVOKABLE
void
moveCodec
(
int
source
,
int
destination
);
Q_INVOKABLE
void
moveCodec
(
int
source
,
int
destination
);
Q_INVOKABLE
void
setBitrate
(
int
id
,
int
bitrate
);
Q_INVOKABLE
void
setRecvFmtp
(
int
id
,
const
QString
&
recv_fmtp
);
protected:
protected:
bool
moveRows
(
bool
moveRows
(
const
QModelIndex
&
source_parent
,
const
QModelIndex
&
source_parent
,
...
...
linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml
View file @
57a84010
...
@@ -147,14 +147,18 @@ Column {
...
@@ -147,14 +147,18 @@ Column {
text
:
$codec
.
clockRate
text
:
$codec
.
clockRate
}
}
Text
Field
{
Numeric
Field
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
bitrateWidth
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
bitrateWidth
text
:
$codec
.
bitrate
text
:
$codec
.
bitrate
onEditingFinished
:
view
.
model
.
setBitrate
(
index
,
text
)
}
}
TextField
{
TextField
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
recvFmtpWidth
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
recvFmtpWidth
text
:
$codec
.
recvFmtp
text
:
$codec
.
recvFmtp
onEditingFinished
:
view
.
model
.
setRecvFmtp
(
index
,
text
)
}
}
Switch
{
Switch
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment