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
f90b8b5b
Commit
f90b8b5b
authored
May 10, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/components/core/CoreHandlers): create a emitApp macro to emit a signal in the app context
parent
3647ed9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
CoreHandlers.cpp
linphone-desktop/src/components/core/CoreHandlers.cpp
+20
-12
No files found.
linphone-desktop/src/components/core/CoreHandlers.cpp
View file @
f90b8b5b
...
...
@@ -21,6 +21,7 @@
*/
#include <QtDebug>
#include <QThread>
#include <QTimer>
#include "../../app/App.hpp"
...
...
@@ -33,9 +34,21 @@ using namespace std;
// =============================================================================
inline
void
logGlobalState
(
linphone
::
GlobalState
gstate
)
{
qInfo
()
<<
QStringLiteral
(
"Global state: %1."
).
arg
(
gstate
);
}
// Emit a signal in the app context.
#define emitApp(EMIT) \
do { \
App *app = App::getInstance(); \
if (QThread::currentThread() != app->thread()) { \
QTimer::singleShot( \
0, app, [this]() { \
(EMIT); \
} \
); \
} else \
(EMIT); \
} while (0)
// -----------------------------------------------------------------------------
void
CoreHandlers
::
onAuthenticationRequested
(
const
shared_ptr
<
linphone
::
Core
>
&
,
...
...
@@ -62,15 +75,10 @@ void CoreHandlers::onGlobalStateChanged (
linphone
::
GlobalState
gstate
,
const
string
&
)
{
if
(
gstate
==
linphone
::
GlobalStateOn
)
{
QTimer
::
singleShot
(
0
,
App
::
getInstance
(),
[
this
,
gstate
]()
{
logGlobalState
(
gstate
);
emit
coreStarted
();
}
);
}
else
logGlobalState
(
gstate
);
qInfo
()
<<
QStringLiteral
(
"Global state: %1."
).
arg
(
gstate
);
if
(
gstate
==
linphone
::
GlobalStateOn
)
emitApp
(
coreStarted
());
}
void
CoreHandlers
::
onCallStatsUpdated
(
...
...
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