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
93c4aeea
Commit
93c4aeea
authored
Sep 19, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): close main window reduce app in notifications area
parent
be082fa2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
21 deletions
+29
-21
linphone.pro
tests/linphone.pro
+1
-0
main.cpp
tests/src/main.cpp
+28
-21
No files found.
tests/linphone.pro
View file @
93c4aeea
...
...
@@ -2,6 +2,7 @@ QT = core gui quick widgets quickcontrols2
TARGET
=
linphone
TEMPLATE
=
app
CONFIG
+=
c
++
11
SOURCES
=
\
src
/
app
.
cpp
\
...
...
tests/src/main.cpp
View file @
93c4aeea
...
...
@@ -2,6 +2,7 @@
#include <QMenu>
#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QSystemTrayIcon>
#include <QtDebug>
...
...
@@ -9,16 +10,26 @@
// ===================================================================
void
createSystemTrayIcon
(
QQmlApplicationEngine
&
engine
)
{
QObject
*
root
=
engine
.
rootObjects
().
at
(
0
);
int
exec
(
App
&
app
,
QQmlApplicationEngine
&
engine
)
{
if
(
!
QSystemTrayIcon
::
isSystemTrayAvailable
())
qWarning
()
<<
"System tray not found on this system."
;
else
{
QQuickWindow
*
root
=
qobject_cast
<
QQuickWindow
*>
(
engine
.
rootObjects
().
at
(
0
));
QMenu
*
menu
=
new
QMenu
();
QSystemTrayIcon
*
tray_icon
=
new
QSystemTrayIcon
(
root
);
// Right click actions.
QAction
*
quitAction
=
new
QAction
(
QObject
::
tr
(
"Quit"
),
root
);
root
->
connect
(
quitAction
,
&
QAction
::
triggered
,
qApp
,
&
QCoreApplication
::
quit
);
QAction
*
restoreAction
=
new
QAction
(
QObject
::
tr
(
"Restore"
),
root
);
root
->
connect
(
restoreAction
,
SIGNAL
(
triggered
()),
root
,
SLOT
(
showNormal
()));
root
->
connect
(
restoreAction
,
&
QAction
::
triggered
,
root
,
&
QQuickWindow
::
showNormal
);
// Left click action.
root
->
connect
(
tray_icon
,
&
QSystemTrayIcon
::
activated
,
[
&
root
](
QSystemTrayIcon
::
ActivationReason
reason
)
{
if
(
reason
==
QSystemTrayIcon
::
DoubleClick
)
root
->
showNormal
();
});
menu
->
addAction
(
restoreAction
);
menu
->
addSeparator
();
...
...
@@ -27,8 +38,9 @@ void createSystemTrayIcon (QQmlApplicationEngine &engine) {
tray_icon
->
setContextMenu
(
menu
);
tray_icon
->
setIcon
(
QIcon
(
":/imgs/linphone.png"
));
tray_icon
->
show
();
}
return
;
return
app
.
exec
()
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -38,10 +50,5 @@ int main (int argc, char *argv[]) {
if
(
engine
.
rootObjects
().
isEmpty
())
return
EXIT_FAILURE
;
if
(
!
QSystemTrayIcon
::
isSystemTrayAvailable
())
qWarning
()
<<
"System tray not found on this system."
;
else
createSystemTrayIcon
(
engine
);
return
app
.
exec
();
return
exec
(
app
,
engine
);
}
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