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
989bbc4e
Commit
989bbc4e
authored
Dec 01, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): use new compilations flags
parent
24eb82f6
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
119 additions
and
172 deletions
+119
-172
CMakeLists.txt
tests/CMakeLists.txt
+16
-0
resources.qrc
tests/resources.qrc
+3
-1
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+16
-8
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+1
-3
ChatProxyModel.hpp
tests/src/components/chat/ChatProxyModel.hpp
+1
-1
ContactsListModel.cpp
tests/src/components/contacts/ContactsListModel.cpp
+4
-0
ContactsListModel.hpp
tests/src/components/contacts/ContactsListModel.hpp
+1
-3
ContactsListProxyModel.cpp
tests/src/components/contacts/ContactsListProxyModel.cpp
+13
-12
ContactsListProxyModel.hpp
tests/src/components/contacts/ContactsListProxyModel.hpp
+1
-1
CoreManager.cpp
tests/src/components/core/CoreManager.cpp
+1
-1
TimelineModel.cpp
tests/src/components/timeline/TimelineModel.cpp
+5
-3
utils.hpp
tests/src/utils.hpp
+3
-1
Contact.qml
tests/ui/modules/Linphone/Contact/Contact.qml
+2
-3
Calls.qml
tests/ui/views/App/Calls/Calls.qml
+50
-39
StartingCall.qml
tests/ui/views/App/Calls/StartingCall.qml
+0
-93
Conversation.qml
tests/ui/views/App/MainWindow/Conversation.qml
+2
-3
No files found.
tests/CMakeLists.txt
View file @
989bbc4e
...
...
@@ -12,6 +12,22 @@ set(CMAKE_CXX_STANDARD 11)
set
(
CMAKE_AUTOMOC ON
)
set
(
CMAKE_INCLUDE_CURRENT_DIR ON
)
# -Wold-style-cast \
set
(
CUSTOM_FLAGS
"\
-Wcast-align \
-Wconversion \
-Wextra \
-Wfloat-equal \
-Winit-self \
-Winline \
-Wlogical-op \
-Woverloaded-virtual \
-Wpointer-arith \
-Wuninitialized \
-Wunused \
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CUSTOM_FLAGS
}
"
)
# --------------------------------------------------------------------
# Define packages, libs, sources, headers, resources and languages
# --------------------------------------------------------------------
...
...
tests/resources.qrc
View file @
989bbc4e
...
...
@@ -140,11 +140,13 @@
<file>
ui/modules/Linphone/Styles/qmldir
</file>
<file>
ui/modules/Linphone/Styles/TimelineStyle.qml
</file>
<file>
ui/modules/Linphone/Timeline.qml
</file>
<file>
ui/scripts/LinphoneUtils/linphone-utils.js
</file>
<file>
ui/scripts/LinphoneUtils/qmldir
</file>
<file>
ui/scripts/Utils/qmldir
</file>
<file>
ui/scripts/Utils/uri-tools.js
</file>
<file>
ui/scripts/Utils/utils.js
</file>
<file>
ui/views/App/Calls/AbstractCall.qml
</file>
<file>
ui/views/App/Calls/Calls.qml
</file>
<file>
ui/views/App/Calls/StartingCall.qml
</file>
<file>
ui/views/App/Calls/StartingIncomingCall.qml
</file>
<file>
ui/views/App/Calls/StartingOutgoingCall.qml
</file>
<file>
ui/views/App/MainWindow/Contact.qml
</file>
...
...
tests/src/components/chat/ChatModel.cpp
View file @
989bbc4e
...
...
@@ -20,6 +20,10 @@ QHash<int, QByteArray> ChatModel::roleNames () const {
return
roles
;
}
int
ChatModel
::
rowCount
(
const
QModelIndex
&
)
const
{
return
m_entries
.
count
();
}
QVariant
ChatModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
int
row
=
index
.
row
();
...
...
@@ -88,7 +92,9 @@ void ChatModel::fillMessageEntry (
const
shared_ptr
<
linphone
::
ChatMessage
>
&
message
)
{
dest
[
"type"
]
=
EntryType
::
MessageEntry
;
dest
[
"timestamp"
]
=
QDateTime
::
fromTime_t
(
message
->
getTime
());
dest
[
"timestamp"
]
=
QDateTime
::
fromMSecsSinceEpoch
(
static_cast
<
qint64
>
(
message
->
getTime
())
*
1000
);
dest
[
"content"
]
=
Utils
::
linphoneStringToQString
(
message
->
getText
()
);
...
...
@@ -97,9 +103,11 @@ void ChatModel::fillMessageEntry (
void
ChatModel
::
fillCallStartEntry
(
QVariantMap
&
dest
,
const
s
td
::
s
hared_ptr
<
linphone
::
CallLog
>
&
call_log
const
shared_ptr
<
linphone
::
CallLog
>
&
call_log
)
{
QDateTime
timestamp
=
QDateTime
::
fromTime_t
(
call_log
->
getStartDate
());
QDateTime
timestamp
=
QDateTime
::
fromMSecsSinceEpoch
(
static_cast
<
qint64
>
(
call_log
->
getStartDate
())
*
1000
);
dest
[
"type"
]
=
EntryType
::
CallEntry
;
dest
[
"timestamp"
]
=
timestamp
;
...
...
@@ -110,10 +118,10 @@ void ChatModel::fillCallStartEntry (
void
ChatModel
::
fillCallEndEntry
(
QVariantMap
&
dest
,
const
s
td
::
s
hared_ptr
<
linphone
::
CallLog
>
&
call_log
const
shared_ptr
<
linphone
::
CallLog
>
&
call_log
)
{
QDateTime
timestamp
=
QDateTime
::
from
Time_t
(
call_log
->
getStartDate
()
+
call_log
->
getDuration
()
QDateTime
timestamp
=
QDateTime
::
from
MSecsSinceEpoch
(
static_cast
<
qint64
>
(
call_log
->
getStartDate
()
+
call_log
->
getDuration
())
*
1000
);
dest
[
"type"
]
=
EntryType
::
CallEntry
;
...
...
@@ -139,7 +147,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
// WARNING: Unable to remove symmetric call here. (start/end)
// We are between `beginRemoveRows` and `endRemoveRows`.
// A solution is to schedule a `removeEntry` call in the Qt main loop.
s
td
::
s
hared_ptr
<
void
>
linphone_ptr
=
pair
.
second
;
shared_ptr
<
void
>
linphone_ptr
=
pair
.
second
;
QTimer
::
singleShot
(
0
,
this
,
[
this
,
linphone_ptr
]()
{
auto
it
=
find_if
(
m_entries
.
begin
(),
m_entries
.
end
(),
...
...
@@ -149,7 +157,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
);
if
(
it
!=
m_entries
.
end
())
removeEntry
(
distance
(
m_entries
.
begin
(),
it
));
removeEntry
(
static_cast
<
int
>
(
distance
(
m_entries
.
begin
(),
it
)
));
});
}
...
...
tests/src/components/chat/ChatModel.hpp
View file @
989bbc4e
...
...
@@ -47,9 +47,7 @@ public:
ChatModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QAbstractListModel
(
parent
)
{}
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
{
return
m_entries
.
count
();
}
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
...
...
tests/src/components/chat/ChatProxyModel.hpp
View file @
989bbc4e
...
...
@@ -75,7 +75,7 @@ private:
ChatModelFilter
m_chat_model_filter
;
unsigned
int
m_n_max_displayed_entries
=
ENTRIES_CHUNK_SIZE
;
int
m_n_max_displayed_entries
=
ENTRIES_CHUNK_SIZE
;
static
const
unsigned
int
ENTRIES_CHUNK_SIZE
;
};
...
...
tests/src/components/contacts/ContactsListModel.cpp
View file @
989bbc4e
...
...
@@ -24,6 +24,10 @@ ContactsListModel::ContactsListModel (QObject *parent): QAbstractListModel(paren
}
}
int
ContactsListModel
::
rowCount
(
const
QModelIndex
&
)
const
{
return
m_list
.
count
();
}
QHash
<
int
,
QByteArray
>
ContactsListModel
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
roles
;
roles
[
Qt
::
DisplayRole
]
=
"$contact"
;
...
...
tests/src/components/contacts/ContactsListModel.hpp
View file @
989bbc4e
...
...
@@ -16,9 +16,7 @@ class ContactsListModel : public QAbstractListModel {
public:
ContactsListModel
(
QObject
*
parent
=
Q_NULLPTR
);
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
{
return
m_list
.
count
();
}
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
...
...
tests/src/components/contacts/ContactsListProxyModel.cpp
View file @
989bbc4e
...
...
@@ -6,14 +6,14 @@
#include "ContactsListProxyModel.hpp"
#define USERNAME_WEIGHT 50.0
#define MAIN_SIP_ADDRESS_WEIGHT 25.0
#define OTHER_SIP_ADDRESSES_WEIGHT 25.0
#define USERNAME_WEIGHT 50.0
f
#define MAIN_SIP_ADDRESS_WEIGHT 25.0
f
#define OTHER_SIP_ADDRESSES_WEIGHT 25.0
f
#define FACTOR_POS_1 0.90
#define FACTOR_POS_2 0.80
#define FACTOR_POS_3 0.70
#define FACTOR_POS_OTHER 0.60
#define FACTOR_POS_1 0.90
f
#define FACTOR_POS_2 0.80
f
#define FACTOR_POS_3 0.70
f
#define FACTOR_POS_OTHER 0.60
f
using
namespace
std
;
...
...
@@ -63,7 +63,9 @@ bool ContactsListProxyModel::filterAcceptsRow (
index
.
data
()
);
int
weight
=
m_weights
[
contact
]
=
computeContactWeight
(
*
contact
);
unsigned
int
weight
=
m_weights
[
contact
]
=
static_cast
<
unsigned
int
>
(
computeContactWeight
(
*
contact
)
);
return
weight
>
0
&&
(
!
m_use_connected_filter
||
...
...
@@ -79,8 +81,8 @@ bool ContactsListProxyModel::lessThan (const QModelIndex &left, const QModelInde
sourceModel
()
->
data
(
right
)
);
floa
t
weight_a
=
m_weights
[
contact_a
];
floa
t
weight_b
=
m_weights
[
contact_b
];
unsigned
in
t
weight_a
=
m_weights
[
contact_a
];
unsigned
in
t
weight_b
=
m_weights
[
contact_b
];
// Sort by weight and name.
return
(
...
...
@@ -139,8 +141,7 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel &contact)
);
// Compute for other addresses.
int
size
=
addresses
.
size
();
float
size
=
static_cast
<
float
>
(
addresses
.
size
());
for
(
++
it
;
it
!=
addresses
.
cend
();
++
it
)
weight
+=
computeStringWeight
(
Utils
::
linphoneStringToQString
((
*
it
)
->
asString
()),
...
...
tests/src/components/contacts/ContactsListProxyModel.hpp
View file @
989bbc4e
...
...
@@ -50,7 +50,7 @@ private:
// It's just a cache to save values computed by `filterAcceptsRow`
// and reused by `lessThan`.
mutable
QHash
<
const
ContactModel
*
,
int
>
m_weights
;
mutable
QHash
<
const
ContactModel
*
,
unsigned
int
>
m_weights
;
bool
m_use_connected_filter
;
};
...
...
tests/src/components/core/CoreManager.cpp
View file @
989bbc4e
...
...
@@ -6,7 +6,7 @@
CoreManager
*
CoreManager
::
m_instance
=
nullptr
;
CoreManager
::
CoreManager
(
QObject
*
parent
)
:
m_core
(
CoreManager
::
CoreManager
(
QObject
*
parent
)
:
QObject
(
parent
),
m_core
(
linphone
::
Factory
::
get
()
->
createCore
(
nullptr
,
""
,
""
,
nullptr
)
)
{
setDatabasesPaths
();
...
...
tests/src/components/timeline/TimelineModel.cpp
View file @
989bbc4e
...
...
@@ -81,7 +81,9 @@ void TimelineModel::init_entries () {
// Insert event message in timeline entries.
QVariantMap
map
;
map
[
"timestamp"
]
=
QDateTime
::
fromTime_t
(
message
->
getTime
());
map
[
"timestamp"
]
=
QDateTime
::
fromMSecsSinceEpoch
(
static_cast
<
qint64
>
(
message
->
getTime
())
*
1000
);
map
[
"sipAddresses"
]
=
Utils
::
linphoneStringToQString
(
chat_room
->
getPeerAddress
()
->
asString
()
);
...
...
@@ -104,8 +106,8 @@ void TimelineModel::init_entries () {
// Make a new map.
QVariantMap
map
;
map
[
"timestamp"
]
=
QDateTime
::
from
Time_t
(
call_log
->
getStartDate
()
+
call_log
->
getDuration
()
map
[
"timestamp"
]
=
QDateTime
::
from
MSecsSinceEpoch
(
static_cast
<
qint64
>
(
call_log
->
getStartDate
()
+
call_log
->
getDuration
())
*
1000
);
map
[
"sipAddresses"
]
=
address
;
...
...
tests/src/utils.hpp
View file @
989bbc4e
...
...
@@ -3,9 +3,11 @@
#include <QString>
// ===================================================================
namespace
Utils
{
inline
QString
linphoneStringToQString
(
const
std
::
string
&
string
)
{
return
QString
::
fromLocal8Bit
(
string
.
c_str
(),
st
ring
.
size
(
));
return
QString
::
fromLocal8Bit
(
string
.
c_str
(),
st
atic_cast
<
int
>
(
string
.
size
()
));
}
inline
std
::
string
qStringToLinphoneString
(
const
QString
&
string
)
{
...
...
tests/ui/modules/Linphone/Contact/Contact.qml
View file @
989bbc4e
...
...
@@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3
import
Common
1.0
import
Linphone
1.0
import
LinphoneUtils
1.0
import
Linphone
.
Styles
1.0
import
Utils
1.0
...
...
@@ -39,9 +40,7 @@ Rectangle {
Layout.preferredWidth
:
ContactStyle
.
contentHeight
image
:
contact
.
avatar
||
''
presenceLevel
:
contact
.
presenceLevel
||
Presence
.
White
username
:
Utils
.
isString
(
contact
)
?
contact
.
substring
(
4
,
contact
.
indexOf
(
'
@
'
))
// 4 = length("sip:")
:
contact
.
username
username
:
LinphoneUtils
.
getContactUsername
(
contact
)
}
ContactDescription
{
...
...
tests/ui/views/App/Calls/Calls.qml
View file @
989bbc4e
...
...
@@ -26,43 +26,48 @@ Window {
// Calls list.
// ---------------------------------------------------------------
childA
:
ColumnLayout
{
childA
:
Rectangle
{
anchors.fill
:
parent
spacing
:
0
Rectangle
{
Layout.fillWidth
:
true
Layout.preferredHeight
:
50
color
:
'
#FFFFFF
'
ActionBar
{
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.leftMargin
:
10
anchors.left
:
parent
.
left
iconSize
:
30
spacing
:
16
ActionButton
{
icon
:
'
call
'
}
ActionButton
{
icon
:
'
conference
'
}
}
}
ScrollableListView
{
Layout.fillWidth
:
true
Layout.fillHeight
:
true
spacing
:
1
delegate
:
CallControls
{
width
:
parent
.
width
}
model
:
callsList
}
}
color
:
'
yellow
'
}
/* childA: ColumnLayout { */
/* anchors.fill: parent */
/* spacing: 0 */
/* Rectangle { */
/* Layout.fillWidth: true */
/* Layout.preferredHeight: 50 */
/* color: '#FFFFFF' */
/* ActionBar { */
/* anchors.verticalCenter: parent.verticalCenter */
/* anchors.leftMargin: 10 */
/* anchors.left: parent.left */
/* iconSize: 30 */
/* spacing: 16 */
/* ActionButton { */
/* icon: 'call' */
/* } */
/* ActionButton { */
/* icon: 'conference' */
/* } */
/* } */
/* } */
/* ScrollableListView { */
/* Layout.fillWidth: true */
/* Layout.fillHeight: true */
/* spacing: 1 */
/* delegate: CallControls { */
/* width: parent.width */
/* } */
/* model: callsList */
/* } */
/* } */
// ---------------------------------------------------------------
// Content.
...
...
@@ -78,14 +83,20 @@ Window {
resizeAInPriority
:
true
// Call.
childA
:
Rectangle
{
childA
:
AbstractCall
{
anchors.fill
:
parent
callTypeLabel
:
'
INCOMING VIDEO CALL
'
}
// Chat.
childB
:
Chat
{
childB
:
Rectangle
{
anchors.fill
:
parent
color
:
'
green
'
}
// Chat.
//childB: Chat {
// anchors.fill: parent
//}
}
}
...
...
tests/ui/views/App/Calls/StartingCall.qml
deleted
100644 → 0
View file @
24eb82f6
import
QtQuick
2.7
import
QtQuick
.
Layouts
1.3
import
Common
1.0
import
Linphone
1.0
Rectangle
{
property
alias
callType
:
callType
.
text
property
alias
sipAddress
:
contactDescription
.
sipAddress
property
alias
username
:
contactDescription
.
username
property
alias
avatarImage
:
image
.
source
default
property
alias
_actionArea
:
actionArea
.
data
color
:
'
#EAEAEA
'
ColumnLayout
{
anchors
{
fill
:
parent
margins
:
20
}
spacing
:
0
// Call type.
Column
{
Layout.fillWidth
:
true
Text
{
id
:
callType
color
:
'
#8E8E8E
'
font.bold
:
true
font.pointSize
:
17
horizontalAlignment
:
Text
.
AlignHCenter
width
:
parent
.
width
}
CaterpillarAnimation
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
// Contact area.
Item
{
id
:
contactContainer
Layout.fillWidth
:
true
Layout.fillHeight
:
true
Item
{
anchors.verticalCenter
:
parent
.
verticalCenter
implicitHeight
:
contactDescription
.
height
+
image
.
height
width
:
parent
.
width
ContactDescription
{
id
:
contactDescription
height
:
60
horizontalTextAlignment
:
Text
.
AlignHCenter
width
:
parent
.
width
}
RoundedImage
{
id
:
image
function
_computeImageSize
()
{
var
height
=
contactContainer
.
height
-
contactDescription
.
height
var
width
=
contactContainer
.
width
var
size
=
height
<
400
?
height
:
400
return
size
<
width
?
size
:
width
}
anchors.top
:
contactDescription
.
bottom
anchors.horizontalCenter
:
parent
.
horizontalCenter
height
:
_computeImageSize
()
width
:
height
}
}
}
// Actions area.
Item
{
id
:
actionArea
Layout.alignment
:
Qt
.
AlignHCenter
Layout.fillWidth
:
true
Layout.preferredHeight
:
80
Layout.topMargin
:
20
}
}
}
tests/ui/views/App/MainWindow/Conversation.qml
View file @
989bbc4e
...
...
@@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3
import
Common
1.0
import
Linphone
1.0
import
LinphoneUtils
1.0
import
Utils
1.0
import
App
.
Styles
1.0
...
...
@@ -57,9 +58,7 @@ ColumnLayout {
Layout.preferredHeight
:
ConversationStyle
.
bar
.
avatarSize
Layout.preferredWidth
:
ConversationStyle
.
bar
.
avatarSize
presenceLevel
:
_contact
.
presenceLevel
||
Presence
.
White
username
:
Utils
.
isString
(
_contact
)
?
_contact
.
substring
(
4
,
_contact
.
indexOf
(
'
@
'
))
// 4 = length("sip:")
:
_contact
.
username
username
:
LinphoneUtils
.
getContactUsername
(
_contact
)
}
ContactDescription
{
...
...
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