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
9b78b2e1
Commit
9b78b2e1
authored
Sep 16, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): use system tray
parent
77f59f13
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
6 deletions
+41
-6
build_resources_file
tests/build_resources_file
+1
-1
linphone.png
tests/imgs/linphone.png
+0
-0
resources.qrc
tests/resources.qrc
+1
-0
app.cpp
tests/src/app.cpp
+5
-3
app.hpp
tests/src/app.hpp
+4
-2
main.cpp
tests/src/main.cpp
+30
-0
No files found.
tests/build_resources_file
View file @
9b78b2e1
...
...
@@ -7,7 +7,7 @@ for filename in $(find languages/ ui/ imgs/ -type f)
do
extension
=
"
${
filename
##*.
}
"
if
[[
"
${
extension
}
"
==
@
(
qml|svg|qm|js
)
]]
;
then
if
[[
"
${
extension
}
"
==
@
(
qml|svg|
png|
qm|js
)
]]
;
then
echo
" <file>
$filename
</file>"
fi
done
...
...
tests/imgs/linphone.png
0 → 100644
View file @
9b78b2e1
2.67 KB
tests/resources.qrc
View file @
9b78b2e1
...
...
@@ -39,6 +39,7 @@
<file>
imgs/led_disconnected.svg
</file>
<file>
imgs/valid.svg
</file>
<file>
imgs/incoming_call.svg
</file>
<file>
imgs/linphone.png
</file>
<file>
imgs/led_do_not_disturb.svg
</file>
<file>
imgs/lost_incoming_call.svg
</file>
<file>
imgs/conference.svg
</file>
...
...
tests/src/app.cpp
View file @
9b78b2e1
#include <cstdlib>
#include <QIcon>
#include <QtDebug>
#include "app.hpp"
#define LANGUAGES_PATH ":/languages/"
// ===================================================================
App
::
App
(
int
&
argc
,
char
**
argv
)
:
QGui
Application
(
argc
,
argv
)
{
// Try to
enable system translation by default. (else english)
App
::
App
(
int
&
argc
,
char
**
argv
)
:
Q
Application
(
argc
,
argv
)
{
// Try to
use default locale.
if
(
m_translator
.
load
(
QString
(
LANGUAGES_PATH
)
+
QLocale
::
system
().
name
())
||
m_translator
.
load
(
LANGUAGES_PATH
"en"
))
{
this
->
installTranslator
(
&
m_translator
);
}
else
{
qWarning
()
<<
"No translation found."
;
}
this
->
setWindowIcon
(
QIcon
(
":/imgs/linphone.png"
));
}
tests/src/app.hpp
View file @
9b78b2e1
#ifndef APP_H_
#define APP_H_
#include <Q
Gui
Application>
#include <QApplication>
#include <QTranslator>
// TODO: Make it Singleton.
class
App
:
public
Q
Gui
Application
{
class
App
:
public
QApplication
{
public:
App
(
int
&
argc
,
char
**
argv
);
virtual
~
App
()
{}
private
slots
:
private:
QTranslator
m_translator
;
};
...
...
tests/src/main.cpp
View file @
9b78b2e1
#include <cstdlib>
#include <QMenu>
#include <QQmlApplicationEngine>
#include <QSystemTrayIcon>
#include <QtDebug>
#include "app.hpp"
// ===================================================================
void
createSystemTrayIcon
(
QQmlApplicationEngine
&
engine
)
{
QObject
*
root
=
engine
.
rootObjects
().
at
(
0
);
QMenu
*
menu
=
new
QMenu
();
QSystemTrayIcon
*
tray_icon
=
new
QSystemTrayIcon
(
root
);
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
()));
menu
->
addAction
(
restoreAction
);
menu
->
addSeparator
();
menu
->
addAction
(
quitAction
);
tray_icon
->
setContextMenu
(
menu
);
tray_icon
->
setIcon
(
QIcon
(
":/imgs/linphone.png"
));
tray_icon
->
show
();
return
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
App
app
(
argc
,
argv
);
QQmlApplicationEngine
engine
(
QUrl
(
"qrc:/ui/views/mainWindow/mainWindow.qml"
));
...
...
@@ -13,5 +38,10 @@ 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
();
}
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