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
0db134c8
Commit
0db134c8
authored
Nov 28, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(components/chat): supports proxy
parent
b97b823f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
17 deletions
+34
-17
App.cpp
tests/src/app/App.cpp
+1
-0
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+1
-1
ChatProxyModel.cpp
tests/src/components/chat/ChatProxyModel.cpp
+10
-4
ChatProxyModel.hpp
tests/src/components/chat/ChatProxyModel.hpp
+9
-3
Chat.qml
tests/ui/modules/Linphone/Chat/Chat.qml
+2
-8
Conversation.qml
tests/ui/views/App/MainWindow/Conversation.qml
+11
-1
No files found.
tests/src/app/App.cpp
View file @
0db134c8
...
@@ -78,6 +78,7 @@ void App::registerTypes () {
...
@@ -78,6 +78,7 @@ void App::registerTypes () {
qmlRegisterUncreatableType
<
Presence
>
(
qmlRegisterUncreatableType
<
Presence
>
(
"Linphone"
,
1
,
0
,
"Presence"
,
"Presence is uncreatable"
"Linphone"
,
1
,
0
,
"Presence"
,
"Presence is uncreatable"
);
);
qRegisterMetaType
<
ChatModel
::
EntryType
>
(
"ChatModel::EntryType"
);
// Register Application/Core.
// Register Application/Core.
qmlRegisterSingletonType
<
App
>
(
qmlRegisterSingletonType
<
App
>
(
...
...
tests/src/components/chat/ChatModel.hpp
View file @
0db134c8
...
@@ -30,7 +30,7 @@ public:
...
@@ -30,7 +30,7 @@ public:
};
};
enum
EntryType
{
enum
EntryType
{
Base
Entry
,
Generic
Entry
,
MessageEntry
,
MessageEntry
,
CallEntry
CallEntry
};
};
...
...
tests/src/components/chat/ChatProxyModel.cpp
View file @
0db134c8
#include "ChatProxyModel.hpp"
#include "ChatProxyModel.hpp"
#include <QtDebug>
// ===================================================================
// ===================================================================
ChatProxyModel
::
ChatProxyModel
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
ChatProxyModel
::
ChatProxyModel
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
...
@@ -9,13 +8,20 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent)
...
@@ -9,13 +8,20 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent)
setFilterCaseSensitivity
(
Qt
::
CaseInsensitive
);
setFilterCaseSensitivity
(
Qt
::
CaseInsensitive
);
}
}
void
ChatProxyModel
::
removeEntry
(
int
id
)
{
m_chat_model
.
removeEntry
(
mapToSource
(
index
(
id
,
0
)).
row
()
);
}
bool
ChatProxyModel
::
filterAcceptsRow
(
int
source_row
,
const
QModelIndex
&
source_parent
)
const
{
bool
ChatProxyModel
::
filterAcceptsRow
(
int
source_row
,
const
QModelIndex
&
source_parent
)
const
{
if
(
m_entry_type_filter
==
ChatModel
::
EntryType
::
GenericEntry
)
return
true
;
QModelIndex
index
=
sourceModel
()
->
index
(
source_row
,
0
,
source_parent
);
QModelIndex
index
=
sourceModel
()
->
index
(
source_row
,
0
,
source_parent
);
const
QVariantMap
&
data
=
qvariant_cast
<
QVariantMap
>
(
const
QVariantMap
&
data
=
qvariant_cast
<
QVariantMap
>
(
index
.
data
()
index
.
data
()
);
);
qDebug
()
<<
data
[
"type"
];
return
(
data
[
"type"
].
toInt
()
==
m_entry_type_filter
);
return
true
;
// TODO.
}
}
tests/src/components/chat/ChatProxyModel.hpp
View file @
0db134c8
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include "ChatModel.hpp"
#include "ChatModel.hpp"
// ===================================================================
class
ChatProxyModel
:
public
QSortFilterProxyModel
{
class
ChatProxyModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -22,12 +24,15 @@ public:
...
@@ -22,12 +24,15 @@ public:
ChatProxyModel
(
QObject
*
parent
=
Q_NULLPTR
);
ChatProxyModel
(
QObject
*
parent
=
Q_NULLPTR
);
public
slots
:
public
slots
:
ChatModel
*
getChatModel
()
{
void
removeEntry
(
int
id
);
return
&
m_chat_model
;
void
removeAllEntries
()
{
m_chat_model
.
removeAllEntries
();
}
}
void
setEntryTypeFilter
(
ChatModel
::
EntryType
type
)
{
void
setEntryTypeFilter
(
ChatModel
::
EntryType
type
)
{
// TODO.
m_entry_type_filter
=
type
;
invalidateFilter
();
}
}
protected:
protected:
...
@@ -43,6 +48,7 @@ private:
...
@@ -43,6 +48,7 @@ private:
}
}
ChatModel
m_chat_model
;
ChatModel
m_chat_model
;
ChatModel
::
EntryType
m_entry_type_filter
=
ChatModel
::
EntryType
::
GenericEntry
;
};
};
#endif // CHAT_PROXY_MODEL_H_
#endif // CHAT_PROXY_MODEL_H_
tests/ui/modules/Linphone/Chat/Chat.qml
View file @
0db134c8
...
@@ -12,7 +12,7 @@ ColumnLayout {
...
@@ -12,7 +12,7 @@ ColumnLayout {
property
var
contact
property
var
contact
// Can be a model or a proxy chat model.
// Can be a model or a proxy chat model.
property
alias
m
odel
:
chat
.
model
property
alias
proxyM
odel
:
chat
.
model
// -----------------------------------------------------------------
// -----------------------------------------------------------------
...
@@ -81,18 +81,12 @@ ColumnLayout {
...
@@ -81,18 +81,12 @@ ColumnLayout {
delegate
:
Rectangle
{
delegate
:
Rectangle
{
id
:
entry
id
:
entry
// Chat supports model and proxy model.
function
getModel
()
{
var
model
=
chat
.
model
return
model
.
getChatModel
?
model
.
getChatModel
()
:
model
}
function
isHoverEntry
()
{
function
isHoverEntry
()
{
return
mouseArea
.
containsMouse
return
mouseArea
.
containsMouse
}
}
function
removeEntry
()
{
function
removeEntry
()
{
getModel
()
.
removeEntry
(
index
)
proxyModel
.
removeEntry
(
index
)
}
}
anchors
{
anchors
{
...
...
tests/ui/views/App/MainWindow/Conversation.qml
View file @
0db134c8
...
@@ -134,6 +134,16 @@ ColumnLayout {
...
@@ -134,6 +134,16 @@ ColumnLayout {
qsTr
(
'
displayCalls
'
),
qsTr
(
'
displayCalls
'
),
qsTr
(
'
displayMessages
'
)
qsTr
(
'
displayMessages
'
)
]
]
onClicked
:
{
if
(
button
===
0
)
{
chatProxyModel
.
setEntryTypeFilter
(
ChatModel
.
GenericEntry
)
}
else
if
(
button
===
1
)
{
chatProxyModel
.
setEntryTypeFilter
(
ChatModel
.
CallEntry
)
}
else
{
chatProxyModel
.
setEntryTypeFilter
(
ChatModel
.
MessageEntry
)
}
}
}
}
}
}
...
@@ -145,7 +155,7 @@ ColumnLayout {
...
@@ -145,7 +155,7 @@ ColumnLayout {
Layout.fillHeight
:
true
Layout.fillHeight
:
true
Layout.fillWidth
:
true
Layout.fillWidth
:
true
contact
:
parent
.
_contact
contact
:
parent
.
_contact
m
odel
:
ChatProxyModel
{
proxyM
odel
:
ChatProxyModel
{
id
:
chatProxyModel
id
:
chatProxyModel
sipAddress
:
conversation
.
sipAddress
sipAddress
:
conversation
.
sipAddress
...
...
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