Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-qt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-qt
Commits
76eb198b
Commit
76eb198b
authored
3 years ago
by
Ming Rui Zhang
Browse files
Options
Downloads
Patches
Plain Diff
mainapplication: use QScopedPointer and control the order of destruction
Change-Id: I48b9019acdb505cdde3da183a1022dea8eacebc0
parent
9a5afd39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mainapplication.cpp
+21
-10
21 additions, 10 deletions
src/mainapplication.cpp
src/mainapplication.h
+4
-4
4 additions, 4 deletions
src/mainapplication.h
with
25 additions
and
14 deletions
src/mainapplication.cpp
+
21
−
10
View file @
76eb198b
...
...
@@ -161,11 +161,20 @@ MainApplication::MainApplication(int& argc, char** argv)
,
engine_
(
new
QQmlApplicationEngine
())
,
connectivityMonitor_
(
new
ConnectivityMonitor
(
this
))
,
settingsManager_
(
new
AppSettingsManager
(
this
))
,
systemTray_
(
new
SystemTray
(
settingsManager_
,
this
))
,
systemTray_
(
new
SystemTray
(
settingsManager_
.
get
()
,
this
))
{
QObject
::
connect
(
this
,
&
QApplication
::
aboutToQuit
,
[
this
]
{
cleanup
();
});
}
MainApplication
::~
MainApplication
()
{
engine_
.
reset
();
systemTray_
.
reset
();
settingsManager_
.
reset
();
lrcInstance_
.
reset
();
connectivityMonitor_
.
reset
();
}
bool
MainApplication
::
init
()
{
...
...
@@ -194,7 +203,7 @@ MainApplication::init()
gnutls_global_init
();
#endif
initLrc
(
results
[
opts
::
UPDATEURL
].
toString
(),
connectivityMonitor_
);
initLrc
(
results
[
opts
::
UPDATEURL
].
toString
(),
connectivityMonitor_
.
get
()
);
#ifdef Q_OS_UNIX
GlobalInstances
::
setDBusErrorHandler
(
std
::
make_unique
<
Interfaces
::
DBusErrorHandler
>
());
...
...
@@ -223,7 +232,7 @@ MainApplication::init()
}
#endif
connect
(
connectivityMonitor_
,
&
ConnectivityMonitor
::
connectivityChanged
,
[
this
]
{
connect
(
connectivityMonitor_
.
get
()
,
&
ConnectivityMonitor
::
connectivityChanged
,
[
this
]
{
lrcInstance_
->
connectivityChanged
();
});
...
...
@@ -414,14 +423,16 @@ void
MainApplication
::
initQmlLayer
()
{
// setup the adapters (their lifetimes are that of MainApplication)
auto
callAdapter
=
new
CallAdapter
(
systemTray_
,
lrcInstance_
.
data
(),
this
);
auto
messagesAdapter
=
new
MessagesAdapter
(
settingsManager_
,
lrcInstance_
.
data
(),
this
);
auto
conversationsAdapter
=
new
ConversationsAdapter
(
systemTray_
,
lrcInstance_
.
data
(),
this
);
auto
callAdapter
=
new
CallAdapter
(
systemTray_
.
get
(),
lrcInstance_
.
data
(),
this
);
auto
messagesAdapter
=
new
MessagesAdapter
(
settingsManager_
.
get
(),
lrcInstance_
.
data
(),
this
);
auto
conversationsAdapter
=
new
ConversationsAdapter
(
systemTray_
.
get
(),
lrcInstance_
.
data
(),
this
);
auto
avAdapter
=
new
AvAdapter
(
lrcInstance_
.
data
(),
this
);
auto
contactAdapter
=
new
ContactAdapter
(
lrcInstance_
.
data
(),
this
);
auto
accountAdapter
=
new
AccountAdapter
(
settingsManager_
,
lrcInstance_
.
data
(),
this
);
auto
utilsAdapter
=
new
UtilsAdapter
(
systemTray_
,
lrcInstance_
.
data
(),
this
);
auto
settingsAdapter
=
new
SettingsAdapter
(
settingsManager_
,
lrcInstance_
.
data
(),
this
);
auto
accountAdapter
=
new
AccountAdapter
(
settingsManager_
.
get
()
,
lrcInstance_
.
data
(),
this
);
auto
utilsAdapter
=
new
UtilsAdapter
(
systemTray_
.
get
()
,
lrcInstance_
.
data
(),
this
);
auto
settingsAdapter
=
new
SettingsAdapter
(
settingsManager_
.
get
()
,
lrcInstance_
.
data
(),
this
);
auto
pluginAdapter
=
new
PluginAdapter
(
lrcInstance_
.
data
(),
this
);
// qml adapter registration
...
...
@@ -473,7 +484,7 @@ MainApplication::initSystray()
engine_
->
quit
();
cleanup
();
});
connect
(
systemTray_
,
connect
(
systemTray_
.
get
()
,
&
QSystemTrayIcon
::
activated
,
[
this
](
QSystemTrayIcon
::
ActivationReason
reason
)
{
if
(
reason
!=
QSystemTrayIcon
::
ActivationReason
::
Context
)
...
...
This diff is collapsed.
Click to expand it.
src/mainapplication.h
+
4
−
4
View file @
76eb198b
...
...
@@ -71,7 +71,7 @@ class MainApplication : public QApplication
public:
explicit
MainApplication
(
int
&
argc
,
char
**
argv
);
~
MainApplication
()
=
default
;
~
MainApplication
();
bool
init
();
void
restoreApp
();
...
...
@@ -94,9 +94,9 @@ private:
QScopedPointer
<
LRCInstance
>
lrcInstance_
;
ConnectivityMonitor
*
connectivityMonitor_
;
AppSettingsManager
*
settingsManager_
;
SystemTray
*
systemTray_
;
QScopedPointer
<
ConnectivityMonitor
>
connectivityMonitor_
;
QScopedPointer
<
AppSettingsManager
>
settingsManager_
;
QScopedPointer
<
SystemTray
>
systemTray_
;
ScreenInfo
screenInfo_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment