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
37797ea0
Commit
37797ea0
authored
Apr 05, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/components/codecs/CodecsModel): in progress
parent
cf938262
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
94 deletions
+127
-94
CodecsModel.cpp
linphone-desktop/src/components/codecs/CodecsModel.cpp
+36
-0
CodecsModel.hpp
linphone-desktop/src/components/codecs/CodecsModel.hpp
+15
-0
CodecsViewer.qml
linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml
+76
-94
No files found.
linphone-desktop/src/components/codecs/CodecsModel.cpp
View file @
37797ea0
...
@@ -85,6 +85,42 @@ QVariant CodecsModel::data (const QModelIndex &index, int role) const {
...
@@ -85,6 +85,42 @@ QVariant CodecsModel::data (const QModelIndex &index, int role) const {
return
QVariant
();
return
QVariant
();
}
}
bool
CodecsModel
::
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
);
}
bool
CodecsModel
::
moveRows
(
const
QModelIndex
&
source_parent
,
int
source_row
,
int
count
,
const
QModelIndex
&
destination_parent
,
int
destination_child
)
{
int
limit
=
source_row
+
count
-
1
;
if
(
source_row
<
0
||
count
<
0
||
limit
>=
m_codecs
.
count
())
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
)
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
);
}
endRemoveRows
();
return
true
;
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
CodecsModel
::
enableCodec
(
int
id
,
bool
status
)
{
void
CodecsModel
::
enableCodec
(
int
id
,
bool
status
)
{
...
...
linphone-desktop/src/components/codecs/CodecsModel.hpp
View file @
37797ea0
...
@@ -53,6 +53,21 @@ public:
...
@@ -53,6 +53,21 @@ public:
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
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
);
bool
moveRows
(
const
QModelIndex
&
source_parent
,
int
source_row
,
int
count
,
const
QModelIndex
&
destination_parent
,
int
destination_child
)
override
;
void
enableCodec
(
int
id
,
bool
status
);
void
enableCodec
(
int
id
,
bool
status
);
private:
private:
...
...
linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml
View file @
37797ea0
...
@@ -8,7 +8,7 @@ import Linphone.Styles 1.0
...
@@ -8,7 +8,7 @@ import Linphone.Styles 1.0
// =============================================================================
// =============================================================================
Column
{
Column
{
property
alias
model
:
vi
sualModel
.
model
property
alias
model
:
vi
ew
.
model
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Header.
// Header.
...
@@ -76,129 +76,111 @@ Column {
...
@@ -76,129 +76,111 @@ Column {
height
:
count
*
CodecsViewerStyle
.
attribute
.
height
height
:
count
*
CodecsViewerStyle
.
attribute
.
height
model
:
DelegateModel
{
// -----------------------------------------------------------------------
id
:
visualModel
// One codec.
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
delegate
:
MouseArea
{
// One codec.
id
:
dragArea
// -----------------------------------------------------------------------
delegate
:
MouseArea
{
property
bool
held
:
false
id
:
dragArea
property
bool
held
:
false
anchors
{
left
:
parent
.
left
anchors
{
right
:
parent
.
right
left
:
parent
.
left
}
right
:
parent
.
right
}
drag
{
axis
:
Drag
.
YAxis
maximumY
:
(
view
.
count
-
DelegateModel
.
itemsIndex
)
*
height
-
height
minimumY
:
-
DelegateModel
.
itemsIndex
*
height
target
:
held
?
content
:
undefined
}
height
:
CodecsViewerStyle
.
attribute
.
height
onPressed
:
held
=
true
onReleased
:
{
held
=
false
content
.
y
=
0
drag
{
}
axis
:
Drag
.
YAxis
Rectangle
{
maximumY
:
(
view
.
count
-
index
)
*
height
-
height
id
:
conten
t
minimumY
:
-
index
*
heigh
t
Drag.active
:
dragArea
.
held
target
:
held
?
content
:
undefined
Drag.source
:
dragArea
}
Drag.hotSpot.x
:
width
/
2
Drag.hotSpot.y
:
height
/
2
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
normal
height
:
CodecsViewerStyle
.
attribute
.
height
height
:
dragArea
.
height
onPressed
:
held
=
true
width
:
dragArea
.
width
onReleased
:
{
held
=
false
console
.
log
(
'
toto
'
,
content
.
y
)
content
.
y
=
0
}
RowLayout
{
Rectangle
{
anchors.fill
:
par
ent
id
:
cont
ent
spacing
:
CodecsViewerStyle
.
column
.
spacing
Drag.active
:
dragArea
.
held
Drag.source
:
dragArea
Drag.hotSpot.x
:
width
/
2
Drag.hotSpot.y
:
height
/
2
CodecAttribute
{
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
normal
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
mimeWidth
text
:
$codec
.
mime
}
CodecAttribute
{
height
:
dragArea
.
height
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
encoderDescriptionWidth
width
:
dragArea
.
width
text
:
$codec
.
encoderDescription
}
CodecAttribute
{
RowLayout
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
clockRateWidth
anchors.fill
:
parent
text
:
$codec
.
clockRate
}
CodecAttribute
{
spacing
:
CodecsViewerStyle
.
column
.
spacing
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
bitrateWidth
text
:
$codec
.
bitrate
}
TextField
{
CodecAttribute
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
recvFmtp
Width
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
mime
Width
text
:
$codec
.
recvFmtp
text
:
$codec
.
mime
}
}
Switch
{
CodecAttribute
{
Layout.fillWidth
:
true
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
encoderDescriptionWidth
Layout.leftMargin
:
10
text
:
$codec
.
encoderDescription
}
checked
:
$codec
.
enabled
CodecAttribute
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
clockRateWidth
text
:
$codec
.
clockRate
}
onClicked
:
visualModel
.
model
.
enableCodec
(
index
,
!
checked
)
CodecAttribute
{
}
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
bitrateWidth
text
:
$codec
.
bitrate
}
}
}
DropArea
{
TextField
{
anchors
{
Layout.preferredWidth
:
CodecsViewerStyle
.
column
.
recvFmtpWidth
fill
:
parent
text
:
$codec
.
recvFmtp
margins
:
CodecsViewerStyle
.
attribute
.
dropArea
.
margins
}
}
onEntered
:
{
Switch
{
visualModel
.
items
.
move
(
Layout.fillWidth
:
true
drag
.
source
.
DelegateModel
.
itemsIndex
,
Layout.leftMargin
:
10
dragArea
.
DelegateModel
.
itemsIndex
)
checked
:
$codec
.
enabled
onClicked
:
view
.
model
.
enableCodec
(
index
,
!
checked
)
}
}
}
}
}
MouseArea
{
MouseArea
{
id
:
mouseArea
id
:
mouseArea
anchors.fill
:
parent
anchors.fill
:
parent
hoverEnabled
:
true
hoverEnabled
:
true
onPressed
:
mouse
.
accepted
=
false
onPressed
:
mouse
.
accepted
=
false
}
}
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Animations/States codec.
// Animations/States codec.
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
states
:
State
{
states
:
State
{
when
:
mouseArea
.
containsMouse
when
:
mouseArea
.
containsMouse
PropertyChanges
{
PropertyChanges
{
target
:
content
target
:
content
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
hovered
color
:
CodecsViewerStyle
.
attribute
.
background
.
color
.
hovered
}
}
}
}
}
}
}
...
...
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