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
6c25f7e6
Commit
6c25f7e6
authored
May 17, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): rename `SmartSearchBarModel` to `SipAddressesProxyModel`
parent
c1275cab
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
38 deletions
+30
-38
CMakeLists.txt
linphone-desktop/CMakeLists.txt
+2
-2
App.cpp
linphone-desktop/src/app/App.cpp
+1
-1
Components.hpp
linphone-desktop/src/components/Components.hpp
+1
-1
ConferenceHelperModel.cpp
...sktop/src/components/conference/ConferenceHelperModel.cpp
+3
-3
ContactModel.hpp
linphone-desktop/src/components/contact/ContactModel.hpp
+1
-1
SipAddressesProxyModel.cpp
...p/src/components/sip-addresses/SipAddressesProxyModel.cpp
+9
-15
SipAddressesProxyModel.hpp
...p/src/components/sip-addresses/SipAddressesProxyModel.hpp
+7
-9
SmartSearchBar.qml
...top/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml
+5
-5
MainWindow.qml
linphone-desktop/ui/views/App/Main/MainWindow.qml
+1
-1
No files found.
linphone-desktop/CMakeLists.txt
View file @
6c25f7e6
...
...
@@ -119,8 +119,8 @@ set(SOURCES
src/components/settings/AccountSettingsModel.cpp
src/components/settings/SettingsModel.cpp
src/components/sip-addresses/SipAddressesModel.cpp
src/components/sip-addresses/SipAddressesProxyModel.cpp
src/components/sip-addresses/SipAddressObserver.cpp
src/components/smart-search-bar/SmartSearchBarModel.cpp
src/components/sound-player/SoundPlayer.cpp
src/components/timeline/TimelineModel.cpp
src/externals/single-application/SingleApplication.cpp
...
...
@@ -161,8 +161,8 @@ set(HEADERS
src/components/settings/AccountSettingsModel.hpp
src/components/settings/SettingsModel.hpp
src/components/sip-addresses/SipAddressesModel.hpp
src/components/sip-addresses/SipAddressesProxyModel.hpp
src/components/sip-addresses/SipAddressObserver.hpp
src/components/smart-search-bar/SmartSearchBarModel.hpp
src/components/sound-player/SoundPlayer.hpp
src/components/timeline/TimelineModel.hpp
src/externals/single-application/SingleApplication.hpp
...
...
linphone-desktop/src/app/App.cpp
View file @
6c25f7e6
...
...
@@ -347,7 +347,7 @@ void App::registerTypes () {
registerType
<
ChatProxyModel
>
(
"ChatProxyModel"
);
registerType
<
ConferenceHelperModel
>
(
"ConferenceHelperModel"
);
registerType
<
ContactsListProxyModel
>
(
"ContactsListProxyModel"
);
registerType
<
S
martSearchBarModel
>
(
"SmartSearchBar
Model"
);
registerType
<
S
ipAddressesProxyModel
>
(
"SipAddressesProxy
Model"
);
registerType
<
SoundPlayer
>
(
"SoundPlayer"
);
registerSingletonType
<
AudioCodecsModel
>
(
"AudioCodecsModel"
);
...
...
linphone-desktop/src/components/Components.hpp
View file @
6c25f7e6
...
...
@@ -36,7 +36,7 @@
#include "core/CoreManager.hpp"
#include "presence/OwnPresenceModel.hpp"
#include "settings/AccountSettingsModel.hpp"
#include "s
mart-search-bar/SmartSearchBar
Model.hpp"
#include "s
ip-addresses/SipAddressesProxy
Model.hpp"
#include "sound-player/SoundPlayer.hpp"
#include "timeline/TimelineModel.hpp"
...
...
linphone-desktop/src/components/conference/ConferenceHelperModel.cpp
View file @
6c25f7e6
...
...
@@ -22,7 +22,7 @@
#include "../../Utils.hpp"
#include "../core/CoreManager.hpp"
#include "../s
mart-search-bar/SmartSearchBar
Model.hpp"
#include "../s
ip-addresses/SipAddressesProxy
Model.hpp"
#include "ConferenceHelperModel.hpp"
...
...
@@ -39,7 +39,7 @@ ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProx
QObject
::
connect
(
calls
,
&
CallsListModel
::
rowsAboutToBeRemoved
,
this
,
&
ConferenceHelperModel
::
handleCallsAboutToBeRemoved
);
QObject
::
connect
(
calls
,
&
CallsListModel
::
callRunning
,
this
,
&
ConferenceHelperModel
::
handleCallRunning
);
setSourceModel
(
new
S
martSearchBar
Model
(
this
));
setSourceModel
(
new
S
ipAddressesProxy
Model
(
this
));
}
QHash
<
int
,
QByteArray
>
ConferenceHelperModel
::
roleNames
()
const
{
...
...
@@ -51,7 +51,7 @@ QHash<int, QByteArray> ConferenceHelperModel::roleNames () const {
// -----------------------------------------------------------------------------
void
ConferenceHelperModel
::
setFilter
(
const
QString
&
pattern
)
{
static_cast
<
S
martSearchBar
Model
*>
(
sourceModel
())
->
setFilter
(
pattern
);
static_cast
<
S
ipAddressesProxy
Model
*>
(
sourceModel
())
->
setFilter
(
pattern
);
}
// -----------------------------------------------------------------------------
...
...
linphone-desktop/src/components/contact/ContactModel.hpp
View file @
6c25f7e6
...
...
@@ -38,7 +38,7 @@ class ContactModel : public QObject {
// Grant access to `mLinphoneFriend`.
friend
class
ContactsListModel
;
friend
class
ContactsListProxyModel
;
friend
class
S
martSearchBar
Model
;
friend
class
S
ipAddressesProxy
Model
;
public:
ContactModel
(
QObject
*
parent
,
std
::
shared_ptr
<
linphone
::
Friend
>
linphoneFriend
);
...
...
linphone-desktop/src/components/s
mart-search-bar/SmartSearchBar
Model.cpp
→
linphone-desktop/src/components/s
ip-addresses/SipAddressesProxy
Model.cpp
View file @
6c25f7e6
/*
* S
martSearchBar
Model.cpp
* S
ipAddressesProxy
Model.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
...
...
@@ -22,7 +22,7 @@
#include "../core/CoreManager.hpp"
#include "S
martSearchBar
Model.hpp"
#include "S
ipAddressesProxy
Model.hpp"
#define WEIGHT_POS_0 5
#define WEIGHT_POS_1 4
...
...
@@ -32,36 +32,30 @@
// =============================================================================
const
QRegExp
S
martSearchBar
Model
::
mSearchSeparators
(
"^[^_.-;@ ][_.-;@ ]"
);
const
QRegExp
S
ipAddressesProxy
Model
::
mSearchSeparators
(
"^[^_.-;@ ][_.-;@ ]"
);
// -----------------------------------------------------------------------------
S
martSearchBarModel
::
SmartSearchBar
Model
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
S
ipAddressesProxyModel
::
SipAddressesProxy
Model
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
setSourceModel
(
CoreManager
::
getInstance
()
->
getSipAddressesModel
());
sort
(
0
);
}
QHash
<
int
,
QByteArray
>
SmartSearchBarModel
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
roles
;
roles
[
Qt
::
DisplayRole
]
=
"$entry"
;
return
roles
;
}
// -----------------------------------------------------------------------------
void
S
martSearchBar
Model
::
setFilter
(
const
QString
&
pattern
)
{
void
S
ipAddressesProxy
Model
::
setFilter
(
const
QString
&
pattern
)
{
mFilter
=
pattern
;
invalidate
();
}
// -----------------------------------------------------------------------------
bool
S
martSearchBar
Model
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
{
bool
S
ipAddressesProxy
Model
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
{
const
QModelIndex
&
index
=
sourceModel
()
->
index
(
sourceRow
,
0
,
sourceParent
);
return
computeEntryWeight
(
index
.
data
().
toMap
())
>
0
;
}
bool
S
martSearchBar
Model
::
lessThan
(
const
QModelIndex
&
left
,
const
QModelIndex
&
right
)
const
{
bool
S
ipAddressesProxy
Model
::
lessThan
(
const
QModelIndex
&
left
,
const
QModelIndex
&
right
)
const
{
const
QVariantMap
&
mapA
=
sourceModel
()
->
data
(
left
).
toMap
();
const
QVariantMap
&
mapB
=
sourceModel
()
->
data
(
right
).
toMap
();
...
...
@@ -100,7 +94,7 @@ bool SmartSearchBarModel::lessThan (const QModelIndex &left, const QModelIndex &
return
sipAddressA
<=
sipAddressB
;
}
int
S
martSearchBar
Model
::
computeEntryWeight
(
const
QVariantMap
&
entry
)
const
{
int
S
ipAddressesProxy
Model
::
computeEntryWeight
(
const
QVariantMap
&
entry
)
const
{
int
weight
=
computeStringWeight
(
entry
[
"sipAddress"
].
toString
().
mid
(
4
));
const
ContactModel
*
contact
=
entry
.
value
(
"contact"
).
value
<
ContactModel
*>
();
...
...
@@ -110,7 +104,7 @@ int SmartSearchBarModel::computeEntryWeight (const QVariantMap &entry) const {
return
weight
;
}
int
S
martSearchBar
Model
::
computeStringWeight
(
const
QString
&
string
)
const
{
int
S
ipAddressesProxy
Model
::
computeStringWeight
(
const
QString
&
string
)
const
{
int
index
=
-
1
;
int
offset
=
-
1
;
...
...
linphone-desktop/src/components/s
mart-search-bar/SmartSearchBar
Model.hpp
→
linphone-desktop/src/components/s
ip-addresses/SipAddressesProxy
Model.hpp
View file @
6c25f7e6
/*
* S
martSearchBar
Model.hpp
* S
ipAddressesProxy
Model.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
...
...
@@ -20,21 +20,19 @@
* Author: Ronan Abhamon
*/
#ifndef S
MART_SEARCH_BAR
_MODEL_H_
#define S
MART_SEARCH_BAR
_MODEL_H_
#ifndef S
IP_ADDRESSES_PROXY
_MODEL_H_
#define S
IP_ADDRESSES_PROXY
_MODEL_H_
#include <QSortFilterProxyModel>
// =============================================================================
class
S
martSearchBar
Model
:
public
QSortFilterProxyModel
{
class
S
ipAddressesProxy
Model
:
public
QSortFilterProxyModel
{
Q_OBJECT
;
public:
SmartSearchBarModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
SmartSearchBarModel
()
=
default
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
SipAddressesProxyModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
SipAddressesProxyModel
()
=
default
;
Q_INVOKABLE
void
setFilter
(
const
QString
&
pattern
);
...
...
@@ -51,4 +49,4 @@ private:
static
const
QRegExp
mSearchSeparators
;
};
#endif // S
MART_SEARCH_BAR
_MODEL_H_
#endif // S
IP_ADDRESSES_PROXY
_MODEL_H_
linphone-desktop/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml
View file @
6c25f7e6
...
...
@@ -207,7 +207,7 @@ SearchBox {
Contact
{
Layout.fillHeight
:
true
Layout.fillWidth
:
true
entry
:
$
entry
entry
:
$
sipAddress
MouseArea
{
anchors.fill
:
parent
...
...
@@ -219,7 +219,7 @@ SearchBox {
onClicked
:
{
searchBox
.
closeMenu
()
searchBox
.
entryClicked
(
$
entry
)
searchBox
.
entryClicked
(
$
sipAddress
)
}
}
}
...
...
@@ -235,7 +235,7 @@ SearchBox {
icon
:
'
video_call
'
onClicked
:
{
searchBox
.
closeMenu
()
searchBox
.
launchVideoCall
(
$
entry
.
sipAddress
)
searchBox
.
launchVideoCall
(
$
sipAddress
.
sipAddress
)
}
}
...
...
@@ -243,7 +243,7 @@ SearchBox {
icon
:
'
call
'
onClicked
:
{
searchBox
.
closeMenu
()
searchBox
.
launchCall
(
$
entry
.
sipAddress
)
searchBox
.
launchCall
(
$
sipAddress
.
sipAddress
)
}
}
...
...
@@ -251,7 +251,7 @@ SearchBox {
icon
:
'
chat
'
onClicked
:
{
searchBox
.
closeMenu
()
searchBox
.
launchChat
(
$
entry
.
sipAddress
)
searchBox
.
launchChat
(
$
sipAddress
.
sipAddress
)
}
}
}
...
...
linphone-desktop/ui/views/App/Main/MainWindow.qml
View file @
6c25f7e6
...
...
@@ -154,7 +154,7 @@ ApplicationWindow {
maxMenuHeight
:
MainWindowStyle
.
searchBox
.
maxHeight
placeholderText
:
qsTr
(
'
mainSearchBarPlaceholder
'
)
model
:
S
martSearchBar
Model
{}
model
:
S
ipAddressesProxy
Model
{}
onAddContact
:
window
.
setView
(
'
ContactEdit
'
,
{
sipAddress
:
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