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
c27e33a1
Commit
c27e33a1
authored
Dec 22, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/views/App/MainWindow/MainWindow): it uses a `SmartSearchBarProxyModel` component (unstable)
parent
e6276c62
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
46 additions
and
17 deletions
+46
-17
CMakeLists.txt
tests/CMakeLists.txt
+2
-0
App.cpp
tests/src/app/App.cpp
+2
-7
ContactsListModel.hpp
tests/src/components/contacts/ContactsListModel.hpp
+2
-2
UnregisteredSipAddressesProxyModel.cpp
...ents/sip-addresses/UnregisteredSipAddressesProxyModel.cpp
+8
-4
SmartSearchBarModel.hpp
...s/src/components/smart-search-bar/SmartSearchBarModel.hpp
+2
-2
SmartSearchBarProxyModel.cpp
.../components/smart-search-bar/SmartSearchBarProxyModel.cpp
+8
-0
SmartSearchBarProxyModel.hpp
.../components/smart-search-bar/SmartSearchBarProxyModel.hpp
+20
-0
SearchBox.qml
tests/ui/modules/Common/SearchBox.qml
+1
-1
MainWindow.qml
tests/ui/views/App/MainWindow/MainWindow.qml
+1
-1
No files found.
tests/CMakeLists.txt
View file @
c27e33a1
...
...
@@ -70,6 +70,7 @@ set(SOURCES
src/components/sip-addresses/UnregisteredSipAddressesModel.cpp
src/components/sip-addresses/UnregisteredSipAddressesProxyModel.cpp
src/components/smart-search-bar/SmartSearchBarModel.cpp
src/components/smart-search-bar/SmartSearchBarProxyModel.cpp
src/components/timeline/TimelineModel.cpp
src/main.cpp
)
...
...
@@ -96,6 +97,7 @@ set(HEADERS
src/components/sip-addresses/UnregisteredSipAddressesModel.hpp
src/components/sip-addresses/UnregisteredSipAddressesProxyModel.hpp
src/components/smart-search-bar/SmartSearchBarModel.hpp
src/components/smart-search-bar/SmartSearchBarProxyModel.hpp
src/components/timeline/TimelineModel.hpp
src/utils.hpp
)
...
...
tests/src/app/App.cpp
View file @
c27e33a1
...
...
@@ -12,7 +12,7 @@
#include "../components/settings/AccountSettingsModel.hpp"
#include "../components/sip-addresses/UnregisteredSipAddressesProxyModel.hpp"
#include "../components/timeline/TimelineModel.hpp"
#include "../components/smart-search-bar/SmartSearchBarModel.hpp"
#include "../components/smart-search-bar/SmartSearchBar
Proxy
Model.hpp"
#include "App.hpp"
...
...
@@ -139,17 +139,12 @@ void App::registerTypes () {
}
);
qmlRegisterSingletonType
<
SmartSearchBarModel
>
(
"Linphone"
,
1
,
0
,
"SmartSearchBarModel"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
return
new
SmartSearchBarModel
();
}
);
qmlRegisterType
<
Camera
>
(
"Linphone"
,
1
,
0
,
"Camera"
);
qmlRegisterType
<
ContactsListProxyModel
>
(
"Linphone"
,
1
,
0
,
"ContactsListProxyModel"
);
qmlRegisterType
<
ChatModel
>
(
"Linphone"
,
1
,
0
,
"ChatModel"
);
qmlRegisterType
<
ChatProxyModel
>
(
"Linphone"
,
1
,
0
,
"ChatProxyModel"
);
qmlRegisterType
<
UnregisteredSipAddressesProxyModel
>
(
"Linphone"
,
1
,
0
,
"UnregisteredSipAddressesProxyModel"
);
qmlRegisterType
<
SmartSearchBarProxyModel
>
(
"Linphone"
,
1
,
0
,
"SmartSearchBarProxyModel"
);
qRegisterMetaType
<
ChatModel
::
EntryType
>
(
"ChatModel::EntryType"
);
}
...
...
tests/src/components/contacts/ContactsListModel.hpp
View file @
c27e33a1
...
...
@@ -9,11 +9,11 @@
// =============================================================================
class
ContactsListModel
:
public
QAbstractListModel
{
Q_OBJECT
;
friend
class
ContactsListProxyModel
;
friend
class
SipAddressesModel
;
Q_OBJECT
;
public:
ContactsListModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
ContactsListModel
()
=
default
;
...
...
tests/src/components/sip-addresses/UnregisteredSipAddressesProxyModel.cpp
View file @
c27e33a1
...
...
@@ -27,10 +27,14 @@ bool UnregisteredSipAddressesProxyModel::filterAcceptsRow (int source_row, const
}
bool
UnregisteredSipAddressesProxyModel
::
lessThan
(
const
QModelIndex
&
left
,
const
QModelIndex
&
right
)
const
{
return
computeStringWeight
(
sourceModel
()
->
data
(
left
).
toMap
()[
"sipAddress"
].
toString
()
)
>
computeStringWeight
(
sourceModel
()
->
data
(
right
).
toMap
()[
"sipAddress"
].
toString
()
QString
sip_address_a
=
sourceModel
()
->
data
(
left
).
toMap
()[
"sipAddress"
].
toString
();
QString
sip_address_b
=
sourceModel
()
->
data
(
right
).
toMap
()[
"sipAddress"
].
toString
();
int
weight_a
=
computeStringWeight
(
sip_address_a
);
int
weight_b
=
computeStringWeight
(
sip_address_b
);
return
weight_a
>
weight_b
||
(
weight_a
==
weight_b
&&
sip_address_a
>=
sip_address_b
);
}
...
...
tests/src/components/smart-search-bar/SmartSearchBarModel.hpp
View file @
c27e33a1
...
...
@@ -14,14 +14,14 @@ class SmartSearchBarModel : public QAbstractListModel {
public:
SmartSearchBarModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QAbstractListModel
(
parent
)
{}
~
SmartSearchBarModel
()
=
default
;
virtual
~
SmartSearchBarModel
()
=
default
;
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
override
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
override
;
pr
ivate
:
pr
otected
:
ContactsListProxyModel
m_contacts
;
UnregisteredSipAddressesProxyModel
m_sip_addresses
;
};
...
...
tests/src/components/smart-search-bar/SmartSearchBarProxyModel.cpp
0 → 100644
View file @
c27e33a1
#include "SmartSearchBarProxyModel.hpp"
// =============================================================================
void
SmartSearchBarProxyModel
::
setFilter
(
const
QString
&
pattern
)
{
m_contacts
.
setFilter
(
pattern
);
m_sip_addresses
.
setFilter
(
pattern
);
}
tests/src/components/smart-search-bar/SmartSearchBarProxyModel.hpp
0 → 100644
View file @
c27e33a1
#ifndef SMART_SEARCH_BAR_PROXY_MODEL_H_
#define SMART_SEARCH_BAR_PROXY_MODEL_H_
#include "SmartSearchBarModel.hpp"
// =============================================================================
class
SmartSearchBarProxyModel
:
public
SmartSearchBarModel
{
Q_OBJECT
;
public:
SmartSearchBarProxyModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
SmartSearchBarModel
(
parent
)
{}
~
SmartSearchBarProxyModel
()
=
default
;
public
slots
:
void
setFilter
(
const
QString
&
pattern
);
};
#endif // SMART_SEARCH_BAR_PROXY_MODEL_H_
tests/ui/modules/Common/SearchBox.qml
View file @
c27e33a1
...
...
@@ -70,7 +70,7 @@ Item {
Keys.onEscapePressed
:
searchBox
.
hideMenu
()
onActiveFocusChanged
:
activeFocus
&&
searchBox
.
showMenu
()
onTextChanged
:
_filter
()
onTextChanged
:
_filter
(
text
)
}
// Wrap the search box menu in a window.
...
...
tests/ui/views/App/MainWindow/MainWindow.qml
View file @
c27e33a1
...
...
@@ -145,7 +145,7 @@ ApplicationWindow {
maxMenuHeight
:
MainWindowStyle
.
searchBox
.
maxHeight
placeholderText
:
qsTr
(
'
mainSearchBarPlaceholder
'
)
model
:
SmartSearchBar
Model
model
:
SmartSearchBar
ProxyModel
{}
}
}
}
...
...
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