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
63174734
Commit
63174734
authored
Nov 22, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(components/contacts/ContactsListModel): `mapSipAddressToContact` working
parent
e6c45503
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
14 deletions
+26
-14
linphone
submodules/linphone
+1
-1
Logger.cpp
tests/src/app/Logger.cpp
+13
-7
Logger.hpp
tests/src/app/Logger.hpp
+1
-1
ContactsListModel.cpp
tests/src/components/contacts/ContactsListModel.cpp
+8
-2
ContactsListModel.hpp
tests/src/components/contacts/ContactsListModel.hpp
+2
-2
main.cpp
tests/src/main.cpp
+1
-1
No files found.
linphone
@
797eea2a
Subproject commit
8544d5033e56d755c4acedc402983d1c89d8e53f
Subproject commit
797eea2a56bc4bfaa0df76884b7f4e5228e80de8
tests/src/app/Logger.cpp
View file @
63174734
...
@@ -18,33 +18,39 @@
...
@@ -18,33 +18,39 @@
// ===================================================================
// ===================================================================
void
qmlL
ogger
(
QtMsgType
type
,
const
QMessageLogContext
&
context
,
const
QString
&
msg
)
{
void
l
ogger
(
QtMsgType
type
,
const
QMessageLogContext
&
context
,
const
QString
&
msg
)
{
QByteArray
local_msg
=
msg
.
toLocal8Bit
();
QByteArray
local_msg
=
msg
.
toLocal8Bit
();
QByteArray
date_time
=
QDateTime
::
currentDateTime
()
QByteArray
date_time
=
QDateTime
::
currentDateTime
()
.
toString
(
"HH:mm:ss"
).
toLocal8Bit
();
.
toString
(
"HH:mm:ss"
).
toLocal8Bit
();
const
char
*
context_file
=
context
.
file
?:
"cpp"
;
const
char
*
context_file
=
"cpp"
;
int
context_line
=
0
;
if
(
context
.
file
&&
!
context
.
function
)
{
context_file
=
context
.
file
;
context_line
=
context
.
line
;
}
switch
(
type
)
{
switch
(
type
)
{
case
QtDebugMsg
:
case
QtDebugMsg
:
fprintf
(
stderr
,
GREEN
"[%s][Debug]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
fprintf
(
stderr
,
GREEN
"[%s][Debug]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
date_time
.
constData
(),
context_file
,
context
.
line
,
local_msg
.
constData
());
date_time
.
constData
(),
context_file
,
context
_
line
,
local_msg
.
constData
());
break
;
break
;
case
QtInfoMsg
:
case
QtInfoMsg
:
fprintf
(
stderr
,
BLUE
"[%s][Info]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
fprintf
(
stderr
,
BLUE
"[%s][Info]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
date_time
.
constData
(),
context_file
,
context
.
line
,
local_msg
.
constData
());
date_time
.
constData
(),
context_file
,
context
_
line
,
local_msg
.
constData
());
break
;
break
;
case
QtWarningMsg
:
case
QtWarningMsg
:
fprintf
(
stderr
,
RED
"[%s][Warning]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
fprintf
(
stderr
,
RED
"[%s][Warning]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
date_time
.
constData
(),
context_file
,
context
.
line
,
local_msg
.
constData
());
date_time
.
constData
(),
context_file
,
context
_
line
,
local_msg
.
constData
());
break
;
break
;
case
QtCriticalMsg
:
case
QtCriticalMsg
:
fprintf
(
stderr
,
RED
"[%s][Critical]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
fprintf
(
stderr
,
RED
"[%s][Critical]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
date_time
.
constData
(),
context_file
,
context
.
line
,
local_msg
.
constData
());
date_time
.
constData
(),
context_file
,
context
_
line
,
local_msg
.
constData
());
break
;
break
;
case
QtFatalMsg
:
case
QtFatalMsg
:
fprintf
(
stderr
,
RED
"[%s][Fatal]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
fprintf
(
stderr
,
RED
"[%s][Fatal]"
PURPLE
"%s:%u: "
RESET
"%s
\n
"
,
date_time
.
constData
(),
context_file
,
context
.
line
,
local_msg
.
constData
());
date_time
.
constData
(),
context_file
,
context
_
line
,
local_msg
.
constData
());
abort
();
abort
();
}
}
}
}
tests/src/app/Logger.hpp
View file @
63174734
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
#include <QtGlobal>
#include <QtGlobal>
void
qmlL
ogger
(
QtMsgType
type
,
const
QMessageLogContext
&
context
,
const
QString
&
msg
);
void
l
ogger
(
QtMsgType
type
,
const
QMessageLogContext
&
context
,
const
QString
&
msg
);
#endif // LOGGER_H_
#endif // LOGGER_H_
tests/src/components/contacts/ContactsListModel.cpp
View file @
63174734
#include <QtDebug>
#include "../core/CoreManager.hpp"
#include "../core/CoreManager.hpp"
#include "ContactsListProxyModel.hpp"
#include "ContactsListProxyModel.hpp"
...
@@ -38,10 +40,14 @@ QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
...
@@ -38,10 +40,14 @@ QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
ContactModel
*
ContactsListModel
::
mapSipAddressToContact
(
const
QString
&
sipAddress
)
{
ContactModel
*
ContactsListModel
::
mapSipAddressToContact
(
const
QString
&
sipAddress
)
const
{
return
m_friend_to_contact
[
ContactModel
*
contact
=
m_friend_to_contact
[
CoreManager
::
getInstance
()
->
getCore
()
->
getFriendsLists
().
front
()
->
findFriendByUri
(
CoreManager
::
getInstance
()
->
getCore
()
->
getFriendsLists
().
front
()
->
findFriendByUri
(
sipAddress
.
toStdString
()
sipAddress
.
toStdString
()
).
get
()
).
get
()
];
];
qInfo
()
<<
"Map sip address to contact:"
<<
sipAddress
<<
"->"
<<
contact
;
return
contact
;
}
}
tests/src/components/contacts/ContactsListModel.hpp
View file @
63174734
...
@@ -23,11 +23,11 @@ public:
...
@@ -23,11 +23,11 @@ public:
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
public
slots
:
public
slots
:
ContactModel
*
mapSipAddressToContact
(
const
QString
&
sipAddress
);
ContactModel
*
mapSipAddressToContact
(
const
QString
&
sipAddress
)
const
;
private:
private:
QList
<
ContactModel
*>
m_list
;
QList
<
ContactModel
*>
m_list
;
QHash
<
linphone
::
Friend
*
,
ContactModel
*
>
m_friend_to_contact
;
QHash
<
const
linphone
::
Friend
*
,
ContactModel
*
>
m_friend_to_contact
;
};
};
#endif // CONTACTS_LIST_MODEL_H
#endif // CONTACTS_LIST_MODEL_H
tests/src/main.cpp
View file @
63174734
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
// ===================================================================
// ===================================================================
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
qInstallMessageHandler
(
qmlL
ogger
);
qInstallMessageHandler
(
l
ogger
);
QGuiApplication
::
setAttribute
(
Qt
::
AA_EnableHighDpiScaling
);
QGuiApplication
::
setAttribute
(
Qt
::
AA_EnableHighDpiScaling
);
App
::
init
(
argc
,
argv
);
App
::
init
(
argc
,
argv
);
...
...
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