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
277e5d40
Commit
277e5d40
authored
May 03, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/app/App): better way to register components
parent
78bf713f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
24 deletions
+31
-24
App.cpp
linphone-desktop/src/app/App.cpp
+31
-24
No files found.
linphone-desktop/src/app/App.cpp
View file @
277e5d40
...
...
@@ -278,6 +278,15 @@ bool App::hasFocus () const {
} \
)
#define registerUncreatableType(TYPE, NAME) qmlRegisterUncreatableType<TYPE>( \
"Linphone", 1, 0, NAME, NAME " is uncreatable." \
)
template
<
class
T
>
void
registerMetaType
(
const
char
*
name
)
{
qRegisterMetaType
<
T
>
(
name
);
}
template
<
class
T
>
void
registerSingletonType
(
const
char
*
name
)
{
qmlRegisterSingletonType
<
T
>
(
...
...
@@ -288,33 +297,23 @@ void registerSingletonType (const char *name) {
);
}
template
<
class
T
>
void
registerType
(
const
char
*
name
)
{
qmlRegisterType
<
T
>
(
"Linphone"
,
1
,
0
,
name
);
}
void
App
::
registerTypes
()
{
qInfo
()
<<
"Registering types..."
;
qmlRegisterType
<
AssistantModel
>
(
"Linphone"
,
1
,
0
,
"AssistantModel"
);
qmlRegisterType
<
AuthenticationNotifier
>
(
"Linphone"
,
1
,
0
,
"AuthenticationNotifier"
);
qmlRegisterType
<
Camera
>
(
"Linphone"
,
1
,
0
,
"Camera"
);
qmlRegisterType
<
CameraPreview
>
(
"Linphone"
,
1
,
0
,
"CameraPreview"
);
qmlRegisterType
<
ChatModel
>
(
"Linphone"
,
1
,
0
,
"ChatModel"
);
qmlRegisterType
<
ChatProxyModel
>
(
"Linphone"
,
1
,
0
,
"ChatProxyModel"
);
qmlRegisterType
<
ContactsListProxyModel
>
(
"Linphone"
,
1
,
0
,
"ContactsListProxyModel"
);
qmlRegisterType
<
SmartSearchBarModel
>
(
"Linphone"
,
1
,
0
,
"SmartSearchBarModel"
);
qmlRegisterType
<
SoundPlayer
>
(
"Linphone"
,
1
,
0
,
"SoundPlayer"
);
qRegisterMetaType
<
ChatModel
::
EntryType
>
(
"ChatModel::EntryType"
);
qmlRegisterUncreatableType
<
CallModel
>
(
"Linphone"
,
1
,
0
,
"CallModel"
,
"CallModel is uncreatable."
);
qmlRegisterUncreatableType
<
ContactModel
>
(
"Linphone"
,
1
,
0
,
"ContactModel"
,
"ContactModel is uncreatable."
);
qmlRegisterUncreatableType
<
SipAddressObserver
>
(
"Linphone"
,
1
,
0
,
"SipAddressObserver"
,
"SipAddressObserver is uncreatable."
);
qmlRegisterUncreatableType
<
VcardModel
>
(
"Linphone"
,
1
,
0
,
"VcardModel"
,
"VcardModel is uncreatable."
);
registerType
<
AssistantModel
>
(
"AssistantModel"
);
registerType
<
AuthenticationNotifier
>
(
"AuthenticationNotifier"
);
registerType
<
Camera
>
(
"Camera"
);
registerType
<
CameraPreview
>
(
"CameraPreview"
);
registerType
<
ChatModel
>
(
"ChatModel"
);
registerType
<
ChatProxyModel
>
(
"ChatProxyModel"
);
registerType
<
ContactsListProxyModel
>
(
"ContactsListProxyModel"
);
registerType
<
SmartSearchBarModel
>
(
"SmartSearchBarModel"
);
registerType
<
SoundPlayer
>
(
"SoundPlayer"
);
registerSingletonType
<
AudioCodecsModel
>
(
"AudioCodecsModel"
);
registerSingletonType
<
OwnPresenceModel
>
(
"OwnPresenceModel"
);
...
...
@@ -322,6 +321,13 @@ void App::registerTypes () {
registerSingletonType
<
TimelineModel
>
(
"TimelineModel"
);
registerSingletonType
<
VideoCodecsModel
>
(
"VideoCodecsModel"
);
registerMetaType
<
ChatModel
::
EntryType
>
(
"ChatModel::EntryType"
);
registerUncreatableType
(
CallModel
,
"CallModel"
);
registerUncreatableType
(
ContactModel
,
"ContactModel"
);
registerUncreatableType
(
SipAddressObserver
,
"SipAddressObserver"
);
registerUncreatableType
(
VcardModel
,
"VcardModel"
);
registerSharedSingletonType
(
App
,
"App"
,
App
::
getInstance
);
registerSharedSingletonType
(
CoreManager
,
"CoreManager"
,
CoreManager
::
getInstance
);
registerSharedSingletonType
(
SettingsModel
,
"SettingsModel"
,
CoreManager
::
getInstance
()
->
getSettingsModel
);
...
...
@@ -331,6 +337,7 @@ void App::registerTypes () {
registerSharedSingletonType
(
ContactsListModel
,
"ContactsListModel"
,
CoreManager
::
getInstance
()
->
getContactsListModel
);
}
#undef registerUncreatableType
#undef registerSharedSingletonType
// -----------------------------------------------------------------------------
...
...
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