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
a14c2657
Commit
a14c2657
authored
Mar 24, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/app/App): do not delete explicitly calls/settings windows, set parent to tray icon
parent
206f31c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
15 deletions
+10
-15
App.cpp
linphone-desktop/src/app/App.cpp
+10
-12
App.hpp
linphone-desktop/src/app/App.hpp
+0
-3
No files found.
linphone-desktop/src/app/App.cpp
View file @
a14c2657
...
@@ -88,9 +88,6 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
...
@@ -88,9 +88,6 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
App
::~
App
()
{
App
::~
App
()
{
qInfo
()
<<
"Destroying app..."
;
qInfo
()
<<
"Destroying app..."
;
delete
m_calls_window
;
delete
m_settings_window
;
delete
m_system_tray_icon
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -221,10 +218,11 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) {
...
@@ -221,10 +218,11 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) {
abort
();
abort
();
}
}
QQuickWindow
*
window
=
qobject_cast
<
QQuickWindow
*>
(
component
.
create
());
QObject
*
object
=
component
.
create
();
QQmlEngine
::
setObjectOwnership
(
window
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
object
,
QQmlEngine
::
CppOwnership
);
object
->
setParent
(
app
->
getMainWindow
());
return
window
;
return
qobject_cast
<
QQuickWindow
*>
(
object
)
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -329,8 +327,8 @@ void App::registerTypes () {
...
@@ -329,8 +327,8 @@ void App::registerTypes () {
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
App
::
setTrayIcon
()
{
void
App
::
setTrayIcon
()
{
QSystemTrayIcon
*
m_system_tray_icon
=
new
QSystemTrayIcon
();
QQuickWindow
*
root
=
getMainWindow
();
QQuickWindow
*
root
=
getMainWindow
();
QSystemTrayIcon
*
system_tray_icon
=
new
QSystemTrayIcon
(
root
);
// trayIcon: Right click actions.
// trayIcon: Right click actions.
QAction
*
quit_action
=
new
QAction
(
"Quit"
,
root
);
QAction
*
quit_action
=
new
QAction
(
"Quit"
,
root
);
...
@@ -342,7 +340,7 @@ void App::setTrayIcon () {
...
@@ -342,7 +340,7 @@ void App::setTrayIcon () {
// trayIcon: Left click actions.
// trayIcon: Left click actions.
QMenu
*
menu
=
new
QMenu
();
QMenu
*
menu
=
new
QMenu
();
root
->
connect
(
root
->
connect
(
m_
system_tray_icon
,
&
QSystemTrayIcon
::
activated
,
[
root
](
system_tray_icon
,
&
QSystemTrayIcon
::
activated
,
[
root
](
QSystemTrayIcon
::
ActivationReason
reason
QSystemTrayIcon
::
ActivationReason
reason
)
{
)
{
if
(
reason
==
QSystemTrayIcon
::
Trigger
)
{
if
(
reason
==
QSystemTrayIcon
::
Trigger
)
{
...
@@ -359,10 +357,10 @@ void App::setTrayIcon () {
...
@@ -359,10 +357,10 @@ void App::setTrayIcon () {
menu
->
addSeparator
();
menu
->
addSeparator
();
menu
->
addAction
(
quit_action
);
menu
->
addAction
(
quit_action
);
m_
system_tray_icon
->
setContextMenu
(
menu
);
system_tray_icon
->
setContextMenu
(
menu
);
m_
system_tray_icon
->
setIcon
(
QIcon
(
WINDOW_ICON_PATH
));
system_tray_icon
->
setIcon
(
QIcon
(
WINDOW_ICON_PATH
));
m_
system_tray_icon
->
setToolTip
(
"Linphone"
);
system_tray_icon
->
setToolTip
(
"Linphone"
);
m_
system_tray_icon
->
show
();
system_tray_icon
->
show
();
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
linphone-desktop/src/app/App.hpp
View file @
a14c2657
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
// =============================================================================
// =============================================================================
class
DefaultTranslator
;
class
DefaultTranslator
;
class
QSystemTrayIcon
;
class
App
:
public
SingleApplication
{
class
App
:
public
SingleApplication
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -101,8 +100,6 @@ private:
...
@@ -101,8 +100,6 @@ private:
QQuickWindow
*
m_calls_window
=
nullptr
;
QQuickWindow
*
m_calls_window
=
nullptr
;
QQuickWindow
*
m_settings_window
=
nullptr
;
QQuickWindow
*
m_settings_window
=
nullptr
;
QSystemTrayIcon
*
m_system_tray_icon
=
nullptr
;
};
};
#endif // APP_H_
#endif // APP_H_
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