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
71d2c9aa
Commit
71d2c9aa
authored
Apr 05, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/components/codecs/AbstractCodecsModel): in progress
parent
9200f973
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
51 deletions
+79
-51
AbstractCodecsModel.cpp
...one-desktop/src/components/codecs/AbstractCodecsModel.cpp
+36
-27
AbstractCodecsModel.hpp
...one-desktop/src/components/codecs/AbstractCodecsModel.hpp
+3
-9
CodecsViewer.qml
linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml
+39
-14
CodecsViewerStyle.qml
...p/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml
+1
-1
No files found.
linphone-desktop/src/components/codecs/AbstractCodecsModel.cpp
View file @
71d2c9aa
...
...
@@ -52,15 +52,26 @@ QVariant AbstractCodecsModel::data (const QModelIndex &index, int role) const {
return
QVariant
();
}
bool
AbstractCodecsModel
::
moveRow
(
const
QModelIndex
&
source_parent
,
int
source_row
,
const
QModelIndex
&
destination_parent
,
int
destination_child
)
{
return
moveRows
(
source_parent
,
source_row
,
1
,
destination_parent
,
destination_child
);
// -----------------------------------------------------------------------------
void
AbstractCodecsModel
::
enableCodec
(
int
id
,
bool
status
)
{
Q_ASSERT
(
id
>=
0
&&
id
<
m_codecs
.
count
());
QVariantMap
&
map
=
m_codecs
[
id
];
shared_ptr
<
linphone
::
PayloadType
>
codec
=
map
.
value
(
"__codec"
).
value
<
shared_ptr
<
linphone
::
PayloadType
>
>
();
codec
->
enable
(
status
);
map
[
"enabled"
]
=
status
;
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
}
void
AbstractCodecsModel
::
moveCodec
(
int
source
,
int
destination
)
{
moveRow
(
QModelIndex
(),
source
,
QModelIndex
(),
destination
);
}
// -----------------------------------------------------------------------------
bool
AbstractCodecsModel
::
moveRows
(
const
QModelIndex
&
source_parent
,
int
source_row
,
...
...
@@ -70,40 +81,38 @@ bool AbstractCodecsModel::moveRows (
)
{
int
limit
=
source_row
+
count
-
1
;
if
(
source_row
<
0
||
count
<
0
||
limit
>=
m_codecs
.
count
())
{
int
n_codecs
=
m_codecs
.
count
();
if
(
source_row
<
0
||
destination_child
<
0
||
count
<
0
||
destination_child
>
n_codecs
||
limit
>=
n_codecs
||
(
source_row
<=
destination_child
&&
source_row
+
count
>=
destination_child
)
)
return
false
;
}
beginMoveRows
(
source_parent
,
source_row
,
limit
,
destination_parent
,
destination_child
);
if
(
destination_child
<
source_row
)
{
for
(
int
i
=
source_row
;
i
<=
limit
;
++
i
)
if
(
destination_child
>
source_row
)
{
--
destination_child
;
for
(
int
i
=
source_row
;
i
<=
limit
;
++
i
)
{
m_codecs
.
move
(
source_row
,
destination_child
+
i
-
source_row
);
}
}
else
{
for
(
int
i
=
source_row
;
i
<=
limit
;
++
i
)
m_codecs
.
move
(
source_row
,
destination_child
+
i
);
m_codecs
.
move
(
source_row
+
i
-
source_row
,
destination_child
+
i
-
source_row
);
}
end
Rem
oveRows
();
end
M
oveRows
();
return
true
;
}
// -----------------------------------------------------------------------------
void
AbstractCodecsModel
::
enableCodec
(
int
id
,
bool
status
)
{
Q_ASSERT
(
id
>=
0
&&
id
<
m_codecs
.
count
());
QVariantMap
&
map
=
m_codecs
[
id
];
shared_ptr
<
linphone
::
PayloadType
>
codec
=
map
.
value
(
"__codec"
).
value
<
shared_ptr
<
linphone
::
PayloadType
>
>
();
codec
->
enable
(
status
);
map
[
"enabled"
]
=
status
;
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
}
// -----------------------------------------------------------------------------
void
AbstractCodecsModel
::
addCodec
(
std
::
shared_ptr
<
linphone
::
PayloadType
>
&
codec
)
{
QVariantMap
map
;
...
...
linphone-desktop/src/components/codecs/AbstractCodecsModel.hpp
View file @
71d2c9aa
...
...
@@ -45,13 +45,10 @@ public:
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
bool
moveRow
(
const
QModelIndex
&
source_parent
,
int
source_row
,
const
QModelIndex
&
destination_parent
,
int
destination_child
);
Q_INVOKABLE
void
enableCodec
(
int
id
,
bool
status
);
Q_INVOKABLE
void
moveCodec
(
int
source
,
int
destination
);
protected:
bool
moveRows
(
const
QModelIndex
&
source_parent
,
int
source_row
,
...
...
@@ -60,9 +57,6 @@ public:
int
destination_child
)
override
;
void
enableCodec
(
int
id
,
bool
status
);
protected:
void
addCodec
(
std
::
shared_ptr
<
linphone
::
PayloadType
>
&
codec
);
private:
...
...
linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml
View file @
71d2c9aa
...
...
@@ -70,7 +70,6 @@ Column {
anchors
{
left
:
parent
.
left
leftMargin
:
CodecsViewerStyle
.
leftMargin
right
:
parent
.
right
}
...
...
@@ -93,8 +92,8 @@ Column {
drag
{
axis
:
Drag
.
YAxis
maximumY
:
(
view
.
count
-
index
)
*
height
-
height
minimumY
:
-
index
*
height
maximumY
:
(
view
.
count
-
index
)
*
height
-
height
/
2
minimumY
:
-
index
*
height
-
height
/
2
target
:
held
?
content
:
undefined
}
...
...
@@ -104,7 +103,7 @@ Column {
onPressed
:
held
=
true
onReleased
:
{
held
=
false
console
.
log
(
'
toto
'
,
content
.
y
)
view
.
model
.
moveCodec
(
index
,
index
+
1
+
content
.
y
/
height
)
content
.
y
=
0
}
...
...
@@ -116,13 +115,20 @@ Column {
Drag.hotSpot.x
:
width
/
2
Drag.hotSpot.y
:
height
/
2
anchors
{
left
:
parent
.
left
right
:
parent
.
right
}
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
normal
height
:
dragArea
.
height
width
:
dragArea
.
width
RowLayout
{
anchors.fill
:
parent
anchors
{
fill
:
parent
leftMargin
:
CodecsViewerStyle
.
leftMargin
}
spacing
:
CodecsViewerStyle
.
column
.
spacing
...
...
@@ -141,7 +147,7 @@ Column {
text
:
$codec
.
clockRate
}
CodecAttribute
{
TextField
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
bitrateWidth
text
:
$codec
.
bitrate
}
...
...
@@ -153,7 +159,6 @@ Column {
Switch
{
Layout.fillWidth
:
true
Layout.leftMargin
:
10
checked
:
$codec
.
enabled
...
...
@@ -175,14 +180,34 @@ Column {
// Animations/States codec.
// ---------------------------------------------------------------------
states
:
State
{
when
:
mouseArea
.
containsMouse
states
:
[
State
{
when
:
mouseArea
.
containsMouse
&&
!
dragArea
.
held
PropertyChanges
{
target
:
content
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
hovered
}
},
State
{
when
:
dragArea
.
held
PropertyChanges
{
target
:
content
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
hovered
}
PropertyChanges
{
target
:
dragArea
opacity
:
0.5
z
:
Constants
.
zMax
}
}
]
}
}
}
linphone-desktop/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml
View file @
71d2c9aa
...
...
@@ -34,7 +34,7 @@ QtObject {
property
int
encoderDescriptionWidth
:
280
property
int
mimeWidth
:
100
property
int
recvFmtpWidth
:
200
property
int
spacing
:
5
property
int
spacing
:
10
}
property
QtObject
legend
:
QtObject
{
...
...
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