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
e61c6cd8
Commit
e61c6cd8
authored
Dec 15, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): many coding style changes
parent
d308d0a3
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
60 deletions
+61
-60
VcardModel.hpp
tests/src/components/contact/VcardModel.hpp
+2
-2
ContactsListModel.hpp
tests/src/components/contacts/ContactsListModel.hpp
+1
-0
ContactsListProxyModel.cpp
tests/src/components/contacts/ContactsListProxyModel.cpp
+1
-3
ContactsListProxyModel.hpp
tests/src/components/contacts/ContactsListProxyModel.hpp
+10
-9
CoreManager.cpp
tests/src/components/core/CoreManager.cpp
+4
-2
CoreManager.hpp
tests/src/components/core/CoreManager.hpp
+9
-5
Notifier.cpp
tests/src/components/notifier/Notifier.cpp
+26
-35
Notifier.hpp
tests/src/components/notifier/Notifier.hpp
+2
-2
Presence.hpp
tests/src/components/presence/Presence.hpp
+6
-2
No files found.
tests/src/components/contact/VcardModel.hpp
View file @
e61c6cd8
...
...
@@ -22,10 +22,10 @@ class VcardModel : public QObject {
public:
VcardModel
(
std
::
shared_ptr
<
linphone
::
Vcard
>
vcard
)
:
m_vcard
(
vcard
)
{}
QString
getUsername
()
const
;
~
VcardModel
()
=
default
;
QString
getUsername
()
const
;
public
slots
:
bool
addSipAddress
(
const
QString
&
sip_address
);
void
removeSipAddress
(
const
QString
&
sip_address
);
...
...
tests/src/components/contacts/ContactsListModel.hpp
View file @
e61c6cd8
...
...
@@ -15,6 +15,7 @@ class ContactsListModel : public QAbstractListModel {
public:
ContactsListModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
ContactsListModel
()
=
default
;
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
override
;
...
...
tests/src/components/contacts/ContactsListProxyModel.cpp
View file @
e61c6cd8
#include <QDebug>
#include "../../utils.hpp"
#include "../contact/ContactModel.hpp"
#include "ContactsListModel.hpp"
#include "ContactsListProxyModel.hpp"
...
...
@@ -131,7 +129,7 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel &contact)
return
weight
;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
void
ContactsListProxyModel
::
setConnectedFilter
(
bool
use_connected_filter
)
{
if
(
use_connected_filter
!=
m_use_connected_filter
)
{
...
...
tests/src/components/contacts/ContactsListProxyModel.hpp
View file @
e61c6cd8
...
...
@@ -3,10 +3,9 @@
#include <QSortFilterProxyModel>
class
ContactModel
;
class
ContactsListModel
;
#include "ContactsListModel.hpp"
// ===================================================================
// ===================================================================
==========
class
ContactsListProxyModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
;
...
...
@@ -19,6 +18,8 @@ class ContactsListProxyModel : public QSortFilterProxyModel {
public:
ContactsListProxyModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
ContactsListProxyModel
()
=
default
;
static
void
initContactsListModel
(
ContactsListModel
*
list
);
static
ContactsListModel
*
getContactsListModel
()
{
return
m_list
;
...
...
@@ -44,17 +45,17 @@ private:
void
setConnectedFilter
(
bool
use_connected_filter
);
static
const
QRegExp
m_search_separators
;
// The contacts list is shared between `ContactsListProxyModel`
// it's necessary to initialize it with `initContactsListModel`.
static
ContactsListModel
*
m_list
;
// It's just a cache to save values computed by `filterAcceptsRow`
// and reused by `lessThan`.
mutable
QHash
<
const
ContactModel
*
,
unsigned
int
>
m_weights
;
bool
m_use_connected_filter
;
static
const
QRegExp
m_search_separators
;
// The contacts list is shared between `ContactsListProxyModel`
// it's necessary to initialize it with `initContactsListModel`.
static
ContactsListModel
*
m_list
;
};
#endif // CONTACTS_LIST_PROXY_MODEL_H_
tests/src/components/core/CoreManager.cpp
View file @
e61c6cd8
...
...
@@ -2,7 +2,9 @@
#include "CoreManager.hpp"
// ===================================================================
using
namespace
std
;
// =============================================================================
CoreManager
*
CoreManager
::
m_instance
=
nullptr
;
...
...
@@ -16,7 +18,7 @@ VcardModel *CoreManager::createDetachedVcardModel () {
}
void
CoreManager
::
setDatabasesPaths
()
{
st
d
::
st
ring
database_path
;
string
database_path
;
database_path
=
Database
::
getFriendsListPath
();
if
(
database_path
.
length
()
==
0
)
...
...
tests/src/components/core/CoreManager.hpp
View file @
e61c6cd8
...
...
@@ -6,12 +6,18 @@
#include "../contact/VcardModel.hpp"
// ===================================================================
// ===================================================================
==========
class
CoreManager
:
public
QObject
{
Q_OBJECT
;
public:
~
CoreManager
()
=
default
;
std
::
shared_ptr
<
linphone
::
Core
>
getCore
()
{
return
m_core
;
}
static
void
init
()
{
if
(
!
m_instance
)
{
m_instance
=
new
CoreManager
();
...
...
@@ -22,11 +28,9 @@ public:
return
m_instance
;
}
std
::
shared_ptr
<
linphone
::
Core
>
getCore
()
{
return
m_core
;
}
public
slots
:
// Must be used in a qml scene.
// The ownership of `VcardModel` is `QQmlEngine::JavaScriptOwnership` by default.
VcardModel
*
createDetachedVcardModel
();
private:
...
...
tests/src/components/notifier/Notifier.cpp
View file @
e61c6cd8
#include <QQuickWindow>
#include <QTimer>
#include <QtDebug>
#include <QTimer>
#include "../../app/App.hpp"
...
...
@@ -12,14 +12,15 @@
#define NOTIFICATION_HEIGHT_PROPERTY "notificationHeight"
#define NOTIFICATION_OFFSET_PROPERTY_NAME "notificationOffset"
#define QML_NOTIFICATION_PATH "qrc:/ui/modules/Linphone/Notifications/CallNotification.qml"
// Arbitrary hardcoded values.
#define NOTIFICATION_SPACING 10
#define N_MAX_NOTIFICATIONS 15
#define MAX_TIMEOUT 60000
// ===================================================================
// ===================================================================
==========
// Helpers.
inline
int
getNotificationSize
(
const
QObject
&
object
,
const
char
*
property
)
{
QVariant
variant
(
object
.
property
(
property
));
bool
so_far_so_good
;
...
...
@@ -38,30 +39,28 @@ bool setProperty (QObject &object, const char *property, const T &value) {
QVariant
qvariant
(
value
);
if
(
!
object
.
setProperty
(
property
,
qvariant
))
{
qWarning
()
<<
"Unable to set property `"
<<
property
<<
"`."
;
qWarning
()
<<
QStringLiteral
(
"Unable to set property: `%1`."
).
arg
(
property
)
;
return
false
;
}
return
true
;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
Notifier
::
Notifier
(
QObject
*
parent
)
:
QObject
(
parent
)
{
QQmlEngine
*
engine
=
App
::
getInstance
()
->
getEngine
();
// Build components.
m_components
[
Notifier
::
Call
]
=
new
QQmlComponent
(
engine
,
QUrl
(
"qrc:/ui/modules/Linphone/Notifications/CallNotification.qml"
)
);
m_components
[
Notifier
::
Call
]
=
new
QQmlComponent
(
engine
,
QUrl
(
QML_NOTIFICATION_PATH
));
// Check errors.
for
(
int
i
=
0
;
i
<
Notifier
::
MaxNbTypes
;
i
++
)
{
QQmlComponent
&
component
=
*
m_components
[
i
];
if
(
component
.
isError
())
{
qWarning
()
<<
"Errors found in `Notification` component "
<<
i
<<
":"
<<
component
.
errors
();
QQmlComponent
*
component
=
m_components
[
i
];
if
(
component
->
isError
())
{
qWarning
()
<<
QStringLiteral
(
"Errors found in `Notification` component %1:"
).
arg
(
i
)
<<
component
->
errors
();
abort
();
}
}
...
...
@@ -72,7 +71,7 @@ Notifier::~Notifier () {
delete
m_components
[
i
];
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
QObject
*
Notifier
::
createNotification
(
Notifier
::
NotificationType
type
)
{
m_mutex
.
lock
();
...
...
@@ -88,10 +87,7 @@ QObject *Notifier::createNotification (Notifier::NotificationType type) {
QObject
*
object
=
m_components
[
type
]
->
create
();
int
offset
=
getNotificationSize
(
*
object
,
NOTIFICATION_HEIGHT_PROPERTY
);
if
(
offset
==
-
1
||
!::
setProperty
(
*
object
,
NOTIFICATION_OFFSET_PROPERTY_NAME
,
m_offset
)
)
{
if
(
offset
==
-
1
||
!::
setProperty
(
*
object
,
NOTIFICATION_OFFSET_PROPERTY_NAME
,
m_offset
))
{
delete
object
;
m_mutex
.
unlock
();
return
nullptr
;
...
...
@@ -123,10 +119,11 @@ void Notifier::showNotification (QObject *notification, int timeout) {
// Called explicitly (by a click on notification for example)
// or when single shot happen and if notification is visible.
QObject
::
connect
(
window
,
&
QQuickWindow
::
visibleChanged
,
[
this
](
const
bool
&
value
)
{
qDebug
()
<<
"Update notifications counter, hidden notification detected."
;
QObject
::
connect
(
window
,
&
QQuickWindow
::
visibleChanged
,
[
this
](
const
bool
&
visible
)
{
qInfo
()
<<
"Update notifications counter, hidden notification detected."
;
if
(
v
alu
e
)
if
(
v
isibl
e
)
qFatal
(
"A notification cannot be visible twice!"
);
m_mutex
.
lock
();
...
...
@@ -141,24 +138,18 @@ void Notifier::showNotification (QObject *notification, int timeout) {
);
// Destroy it after timeout.
QTimer
::
singleShot
(
timeout
,
this
,
[
notification
]()
{
QTimer
::
singleShot
(
timeout
,
this
,
[
notification
]()
{
delete
notification
;
});
}
);
}
// -------------------------------------------------------------------
void
Notifier
::
showCallMessage
(
int
timeout
,
const
QString
&
sip_address
)
{
qDebug
()
<<
"Show call notification message. (addr="
<<
sip_address
<<
")"
;
// -----------------------------------------------------------------------------
void
Notifier
::
showCallMessage
(
int
timeout
,
const
QString
&
)
{
QObject
*
object
=
createNotification
(
Notifier
::
Call
);
if
(
!
object
)
return
;
if
(
object
)
showNotification
(
object
,
timeout
);
}
tests/src/components/notifier/Notifier.hpp
View file @
e61c6cd8
...
...
@@ -5,14 +5,14 @@
#include <QObject>
#include <QQmlComponent>
// ===================================================================
// ===================================================================
==========
class
Notifier
:
public
QObject
{
Q_OBJECT
;
public:
Notifier
(
QObject
*
parent
=
Q_NULLPTR
);
virtual
~
Notifier
();
~
Notifier
();
enum
NotificationType
{
Call
,
...
...
tests/src/components/presence/Presence.hpp
View file @
e61c6cd8
...
...
@@ -3,7 +3,7 @@
#include <QObject>
// ===================================================================
// ===================================================================
==========
class
Presence
:
public
QObject
{
Q_OBJECT
;
...
...
@@ -20,6 +20,7 @@ public:
UsingAnotherMessagingService
,
Offline
};
Q_ENUM
(
PresenceStatus
);
enum
PresenceLevel
{
...
...
@@ -28,9 +29,12 @@ public:
Red
,
White
};
Q_ENUM
(
PresenceLevel
);
Presence
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{
}
Presence
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{}
~
Presence
()
=
default
;
static
PresenceLevel
getPresenceLevel
(
const
PresenceStatus
&
presenceStatus
)
{
if
(
presenceStatus
==
Online
)
...
...
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