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
93371b87
Commit
93371b87
authored
Feb 21, 2017
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some command line options.
parent
0840a90b
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
149 additions
and
46 deletions
+149
-46
en.ts
linphone-desktop/assets/languages/en.ts
+23
-0
fr.ts
linphone-desktop/assets/languages/fr.ts
+23
-0
App.cpp
linphone-desktop/src/app/App.cpp
+56
-20
App.hpp
linphone-desktop/src/app/App.hpp
+10
-4
Logger.cpp
linphone-desktop/src/app/Logger.cpp
+1
-1
Logger.hpp
linphone-desktop/src/app/Logger.hpp
+5
-1
Paths.cpp
linphone-desktop/src/app/Paths.cpp
+4
-1
Paths.hpp
linphone-desktop/src/app/Paths.hpp
+2
-1
CoreManager.cpp
linphone-desktop/src/components/core/CoreManager.cpp
+19
-15
CoreManager.hpp
linphone-desktop/src/components/core/CoreManager.hpp
+3
-2
main.cpp
linphone-desktop/src/main.cpp
+3
-1
No files found.
linphone-desktop/assets/languages/en.ts
View file @
93371b87
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
>
<
context
>
<
name
>
App
<
/name
>
<
message
>
<
source
>
Linphone
seems
to
be
running
correctly
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Log
to
stdout
some
debug
information
while
running
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Specify
the
linphone
configuration
file
to
use
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Run
self
test
and
exit
0
if
it
succeeded
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
A
free
SIP
video
-
phone
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
CallControls
<
/name
>
<
message
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
93371b87
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
>
<
context
>
<
name
>
App
<
/name
>
<
message
>
<
source
>
Linphone
seems
to
be
running
correctly
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Log
to
stdout
some
debug
information
while
running
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Specify
the
linphone
configuration
file
to
use
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Run
self
test
and
exit
0
if
it
succeeded
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
A
free
SIP
video
-
phone
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
CallControls
<
/name
>
<
message
>
...
...
linphone-desktop/src/app/App.cpp
View file @
93371b87
...
...
@@ -31,12 +31,14 @@
#include "../components/timeline/TimelineModel.hpp"
#include "App.hpp"
#include "Logger.hpp"
#include <QFileSelector>
#include <QMenu>
#include <QQmlComponent>
#include <QQmlContext>
#include <QQuickView>
#include <QTimer>
#include <QtDebug>
#define LANGUAGES_PATH ":/languages/"
...
...
@@ -52,6 +54,8 @@
App
*
App
::
m_instance
=
nullptr
;
App
::
App
(
int
&
argc
,
char
**
argv
)
:
QApplication
(
argc
,
argv
)
{
this
->
setApplicationVersion
(
"4.0"
);
if
(
m_english_translator
.
load
(
QLocale
(
QLocale
::
English
),
LANGUAGES_PATH
))
installTranslator
(
&
m_english_translator
);
else
...
...
@@ -67,24 +71,6 @@ App::App (int &argc, char **argv) : QApplication(argc, argv) {
qWarning
()
<<
QStringLiteral
(
"Unable to found translations for locale: %1."
)
.
arg
(
current_locale
.
name
());
}
// Provide avatars/thumbnails providers.
m_engine
.
addImageProvider
(
AvatarProvider
::
PROVIDER_ID
,
&
m_avatar_provider
);
m_engine
.
addImageProvider
(
ThumbnailProvider
::
PROVIDER_ID
,
&
m_thumbnail_provider
);
setWindowIcon
(
QIcon
(
WINDOW_ICON_PATH
));
// Provide `+custom` folders for custom components.
m_file_selector
=
new
QQmlFileSelector
(
&
m_engine
);
m_file_selector
->
setExtraSelectors
(
QStringList
(
"custom"
));
// Set modules paths.
m_engine
.
addImportPath
(
":/ui/modules"
);
m_engine
.
addImportPath
(
":/ui/scripts"
);
m_engine
.
addImportPath
(
":/ui/views"
);
// Don't quit if last window is closed!!!
setQuitOnLastWindowClosed
(
false
);
}
// -----------------------------------------------------------------------------
...
...
@@ -111,8 +97,26 @@ bool App::hasFocus () const {
// -----------------------------------------------------------------------------
void
App
::
initContentApp
()
{
// Provide avatars/thumbnails providers.
m_engine
.
addImageProvider
(
AvatarProvider
::
PROVIDER_ID
,
&
m_avatar_provider
);
m_engine
.
addImageProvider
(
ThumbnailProvider
::
PROVIDER_ID
,
&
m_thumbnail_provider
);
setWindowIcon
(
QIcon
(
WINDOW_ICON_PATH
));
// Provide `+custom` folders for custom components.
m_file_selector
=
new
QQmlFileSelector
(
&
m_engine
);
m_file_selector
->
setExtraSelectors
(
QStringList
(
"custom"
));
// Set modules paths.
m_engine
.
addImportPath
(
":/ui/modules"
);
m_engine
.
addImportPath
(
":/ui/scripts"
);
m_engine
.
addImportPath
(
":/ui/views"
);
// Don't quit if last window is closed!!!
setQuitOnLastWindowClosed
(
false
);
// Init core.
CoreManager
::
init
();
CoreManager
::
init
(
m_parser
.
value
(
"config"
)
);
qInfo
()
<<
"Core manager initialized."
;
qInfo
()
<<
"Activated selectors:"
<<
QQmlFileSelector
::
get
(
&
m_engine
)
->
selector
()
->
allSelectors
();
...
...
@@ -141,6 +145,29 @@ void App::initContentApp () {
setTrayIcon
();
#endif // ifndef __APPLE__
if
(
m_parser
.
isSet
(
"selftest"
))
{
QTimer
::
singleShot
(
300
,
this
,
&
App
::
quit
);
}
}
// -----------------------------------------------------------------------------
void
App
::
parseArgs
()
{
m_parser
.
setApplicationDescription
(
tr
(
"A free SIP video-phone"
));
m_parser
.
addHelpOption
();
m_parser
.
addVersionOption
();
m_parser
.
addOptions
({
{
"config"
,
tr
(
"Specify the linphone configuration file to use."
),
"file"
},
{
"selftest"
,
tr
(
"Run self test and exit 0 if it succeeded."
)
},
{
{
"V"
,
"verbose"
},
tr
(
"Log to stdout some debug information while running."
)
}
});
m_parser
.
process
(
*
this
);
if
(
m_parser
.
isSet
(
"verbose"
))
{
Logger
::
instance
()
->
setVerbose
(
true
);
}
}
// -----------------------------------------------------------------------------
...
...
@@ -259,7 +286,7 @@ void App::setTrayIcon () {
// trayIcon: Right click actions.
QAction
*
quit_action
=
new
QAction
(
"Quit"
,
root
);
root
->
connect
(
quit_action
,
&
QAction
::
triggered
,
qApp
,
&
QCoreApplication
::
quit
);
root
->
connect
(
quit_action
,
&
QAction
::
triggered
,
this
,
&
App
::
quit
);
QAction
*
restore_action
=
new
QAction
(
"Restore"
,
root
);
root
->
connect
(
restore_action
,
&
QAction
::
triggered
,
root
,
&
QQuickWindow
::
showNormal
);
...
...
@@ -288,3 +315,12 @@ void App::setTrayIcon () {
m_system_tray_icon
->
setToolTip
(
"Linphone"
);
m_system_tray_icon
->
show
();
}
// -----------------------------------------------------------------------------
void
App
::
quit
()
{
if
(
m_parser
.
isSet
(
"selftest"
))
{
cout
<<
tr
(
"Linphone seems to be running correctly"
).
toStdString
()
<<
endl
;
}
QCoreApplication
::
quit
();
}
linphone-desktop/src/app/App.hpp
View file @
93371b87
...
...
@@ -29,6 +29,7 @@
#include "ThumbnailProvider.hpp"
#include <QApplication>
#include <QCommandLineParser>
#include <QQmlApplicationEngine>
#include <QQmlFileSelector>
#include <QQuickWindow>
...
...
@@ -55,15 +56,18 @@ public:
Q_INVOKABLE
QQuickWindow
*
getSettingsWindow
()
const
;
void
initContentApp
();
Q_INVOKABLE
QString
locale
()
const
{
return
m_locale
;
}
static
void
init
(
int
&
argc
,
char
**
argv
)
{
void
parseArgs
();
static
void
create
(
int
&
argc
,
char
**
argv
)
{
if
(
!
m_instance
)
{
// Instance must be exists before content.
m_instance
=
new
App
(
argc
,
argv
);
m_instance
->
initContentApp
();
}
}
...
...
@@ -71,16 +75,18 @@ public:
return
m_instance
;
}
public
slots
:
void
quit
();
private:
App
(
int
&
argc
,
char
**
argv
);
~
App
()
=
default
;
void
initContentApp
();
void
registerTypes
();
void
createSubWindows
();
void
setTrayIcon
();
QCommandLineParser
m_parser
;
QQmlApplicationEngine
m_engine
;
QQmlFileSelector
*
m_file_selector
=
nullptr
;
QSystemTrayIcon
*
m_system_tray_icon
=
nullptr
;
...
...
linphone-desktop/src/app/Logger.cpp
View file @
93371b87
...
...
@@ -136,7 +136,7 @@ void Logger::init () {
linphone_core_set_log_level
(
ORTP_MESSAGE
);
linphone_core_set_log_handler
(
[](
const
char
*
domain
,
OrtpLogLevel
type
,
const
char
*
fmt
,
va_list
args
)
{
if
(
m_instance
->
m_display_core_logs
)
if
(
m_instance
->
isVerbose
()
)
linphoneLogger
(
domain
,
type
,
fmt
,
args
);
}
);
...
...
linphone-desktop/src/app/Logger.hpp
View file @
93371b87
...
...
@@ -30,11 +30,15 @@
class
Logger
{
public:
static
void
init
();
static
Logger
*
instance
()
{
return
m_instance
;
};
bool
isVerbose
()
const
{
return
m_verbose
;
};
void
setVerbose
(
bool
verbose
)
{
m_verbose
=
verbose
;
};
private:
Logger
()
=
default
;
bool
m_
display_core_logs
=
false
;
bool
m_
verbose
=
false
;
static
Logger
*
m_instance
;
};
...
...
linphone-desktop/src/app/Paths.cpp
View file @
93371b87
...
...
@@ -96,7 +96,10 @@ string Paths::getCallHistoryFilepath () {
return
getFilePath
(
MAIN_PATH
+
PATH_CALL_HISTORY_LIST
);
}
string
Paths
::
getConfigFilepath
()
{
string
Paths
::
getConfigFilepath
(
const
QString
&
configPath
)
{
if
(
!
configPath
.
isEmpty
())
{
return
getFilePath
(
QFileInfo
(
configPath
).
absoluteFilePath
());
}
return
getFilePath
(
MAIN_PATH
+
PATH_CONFIG
);
}
...
...
linphone-desktop/src/app/Paths.hpp
View file @
93371b87
...
...
@@ -24,13 +24,14 @@
#define PATHS_H_
#include <string>
#include <QString>
// =============================================================================
namespace
Paths
{
std
::
string
getAvatarsDirpath
();
std
::
string
getCallHistoryFilepath
();
std
::
string
getConfigFilepath
();
std
::
string
getConfigFilepath
(
const
QString
&
configPath
);
std
::
string
getFriendsListFilepath
();
std
::
string
getCapturesDirPath
();
std
::
string
getLogsDirpath
();
...
...
linphone-desktop/src/components/core/CoreManager.cpp
View file @
93371b87
...
...
@@ -35,20 +35,10 @@ using namespace std;
CoreManager
*
CoreManager
::
m_instance
=
nullptr
;
CoreManager
::
CoreManager
(
QObject
*
parent
)
:
QObject
(
parent
),
m_handlers
(
make_shared
<
CoreHandlers
>
())
{
QDir
dir
(
QCoreApplication
::
applicationDirPath
());
if
(
dir
.
dirName
()
==
"MacOS"
)
{
dir
.
cdUp
();
dir
.
cd
(
"Resources"
);
QDir
mspluginsdir
(
dir
);
mspluginsdir
.
cd
(
"lib/mediastreamer/plugins"
);
QDir
datadir
(
dir
);
datadir
.
cd
(
"share"
);
linphone
::
Factory
::
get
()
->
setMspluginsDir
(
::
Utils
::
qStringToLinphoneString
(
mspluginsdir
.
absolutePath
()));
linphone
::
Factory
::
get
()
->
setTopResourcesDir
(
::
Utils
::
qStringToLinphoneString
(
datadir
.
absolutePath
()));
}
CoreManager
::
CoreManager
(
const
QString
&
configPath
,
QObject
*
parent
)
:
QObject
(
parent
),
m_handlers
(
make_shared
<
CoreHandlers
>
())
{
setResourcesPaths
();
m_core
=
linphone
::
Factory
::
get
()
->
createCore
(
m_handlers
,
Paths
::
getConfigFilepath
(),
""
);
m_core
=
linphone
::
Factory
::
get
()
->
createCore
(
m_handlers
,
Paths
::
getConfigFilepath
(
configPath
),
""
);
m_core
->
setVideoDisplayFilter
(
"MSOGL"
);
m_core
->
usePreviewWindow
(
true
);
...
...
@@ -60,9 +50,9 @@ void CoreManager::enableHandlers () {
m_cbs_timer
->
start
();
}
void
CoreManager
::
init
()
{
void
CoreManager
::
init
(
const
QString
&
configPath
)
{
if
(
!
m_instance
)
{
m_instance
=
new
CoreManager
();
m_instance
=
new
CoreManager
(
configPath
);
m_instance
->
m_calls_list_model
=
new
CallsListModel
(
m_instance
);
m_instance
->
m_contacts_list_model
=
new
ContactsListModel
(
m_instance
);
...
...
@@ -88,3 +78,17 @@ void CoreManager::setDatabasesPaths () {
m_core
->
setCallLogsDatabasePath
(
Paths
::
getCallHistoryFilepath
());
m_core
->
setChatDatabasePath
(
Paths
::
getMessageHistoryFilepath
());
}
void
CoreManager
::
setResourcesPaths
()
{
QDir
dir
(
QCoreApplication
::
applicationDirPath
());
if
(
dir
.
dirName
()
==
"MacOS"
)
{
dir
.
cdUp
();
dir
.
cd
(
"Resources"
);
QDir
mspluginsdir
(
dir
);
mspluginsdir
.
cd
(
"lib/mediastreamer/plugins"
);
QDir
datadir
(
dir
);
datadir
.
cd
(
"share"
);
linphone
::
Factory
::
get
()
->
setMspluginsDir
(
::
Utils
::
qStringToLinphoneString
(
mspluginsdir
.
absolutePath
()));
linphone
::
Factory
::
get
()
->
setTopResourcesDir
(
::
Utils
::
qStringToLinphoneString
(
datadir
.
absolutePath
()));
}
}
linphone-desktop/src/components/core/CoreManager.hpp
View file @
93371b87
...
...
@@ -68,7 +68,7 @@ public:
// Initialization.
// ---------------------------------------------------------------------------
static
void
init
();
static
void
init
(
const
QString
&
configPath
);
static
CoreManager
*
getInstance
()
{
return
m_instance
;
...
...
@@ -81,9 +81,10 @@ public:
Q_INVOKABLE
VcardModel
*
createDetachedVcardModel
();
private:
CoreManager
(
QObject
*
parent
=
Q_NULLPTR
);
CoreManager
(
const
QString
&
configPath
,
QObject
*
parent
=
Q_NULLPTR
);
void
setDatabasesPaths
();
void
setResourcesPaths
();
std
::
shared_ptr
<
linphone
::
Core
>
m_core
;
std
::
shared_ptr
<
CoreHandlers
>
m_handlers
;
...
...
linphone-desktop/src/main.cpp
View file @
93371b87
...
...
@@ -42,7 +42,9 @@ int main (int argc, char *argv[]) {
* QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
*/
App
::
init
(
argc
,
argv
);
App
::
create
(
argc
,
argv
);
App
::
getInstance
()
->
parseArgs
();
App
::
getInstance
()
->
initContentApp
();
// Run!
return
App
::
getInstance
()
->
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