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
dc1cce15
Commit
dc1cce15
authored
Apr 14, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): replace `broghammerus_reticulatus` variables by `camelusBactrianus`
parent
48b5aff6
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
141 additions
and
141 deletions
+141
-141
App.cpp
linphone-desktop/src/app/App.cpp
+58
-58
App.hpp
linphone-desktop/src/app/App.hpp
+11
-11
Logger.cpp
linphone-desktop/src/app/logger/Logger.cpp
+13
-13
Logger.hpp
linphone-desktop/src/app/logger/Logger.hpp
+6
-6
Paths.cpp
linphone-desktop/src/app/paths/Paths.cpp
+36
-36
Paths.hpp
linphone-desktop/src/app/paths/Paths.hpp
+1
-1
AvatarProvider.cpp
linphone-desktop/src/app/providers/AvatarProvider.cpp
+2
-2
AvatarProvider.hpp
linphone-desktop/src/app/providers/AvatarProvider.hpp
+2
-2
ThumbnailProvider.cpp
linphone-desktop/src/app/providers/ThumbnailProvider.cpp
+2
-2
ThumbnailProvider.hpp
linphone-desktop/src/app/providers/ThumbnailProvider.hpp
+2
-2
DefaultTranslator.cpp
linphone-desktop/src/app/translator/DefaultTranslator.cpp
+6
-6
DefaultTranslator.hpp
linphone-desktop/src/app/translator/DefaultTranslator.hpp
+2
-2
No files found.
linphone-desktop/src/app/App.cpp
View file @
dc1cce15
...
...
@@ -64,23 +64,23 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
// List available locales.
for
(
const
auto
&
locale
:
QDir
(
LANGUAGES_PATH
).
entryList
())
m
_available_l
ocales
<<
QLocale
(
locale
);
m
AvailableL
ocales
<<
QLocale
(
locale
);
m
_t
ranslator
=
new
DefaultTranslator
(
this
);
m
T
ranslator
=
new
DefaultTranslator
(
this
);
// Try to use system locale.
QLocale
sys
_l
ocale
=
QLocale
::
system
();
if
(
installLocale
(
*
this
,
*
m
_translator
,
sys_l
ocale
))
{
m
_locale
=
sys_l
ocale
.
name
();
qInfo
()
<<
QStringLiteral
(
"Use system locale: %1"
).
arg
(
m
_l
ocale
);
QLocale
sys
L
ocale
=
QLocale
::
system
();
if
(
installLocale
(
*
this
,
*
m
Translator
,
sysL
ocale
))
{
m
Locale
=
sysL
ocale
.
name
();
qInfo
()
<<
QStringLiteral
(
"Use system locale: %1"
).
arg
(
m
L
ocale
);
return
;
}
// Use english.
m
_l
ocale
=
DEFAULT_LOCALE
;
if
(
!
installLocale
(
*
this
,
*
m
_translator
,
QLocale
(
m_l
ocale
)))
m
L
ocale
=
DEFAULT_LOCALE
;
if
(
!
installLocale
(
*
this
,
*
m
Translator
,
QLocale
(
mL
ocale
)))
qFatal
(
"Unable to install default translator."
);
qInfo
()
<<
QStringLiteral
(
"Use default locale: %1"
).
arg
(
m
_l
ocale
);
qInfo
()
<<
QStringLiteral
(
"Use default locale: %1"
).
arg
(
m
L
ocale
);
}
App
::~
App
()
{
...
...
@@ -108,29 +108,29 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) {
// -----------------------------------------------------------------------------
inline
void
activeSplashScreen
(
App
*
app
)
{
QQuickWindow
*
splash
_s
creen
=
createSubWindow
(
app
,
QML_VIEW_SPLASH_SCREEN
);
QObject
::
connect
(
CoreManager
::
getInstance
(),
&
CoreManager
::
linphoneCoreCreated
,
splash
_screen
,
[
splash_s
creen
]
{
splash
_s
creen
->
close
();
splash
_s
creen
->
deleteLater
();
QQuickWindow
*
splash
S
creen
=
createSubWindow
(
app
,
QML_VIEW_SPLASH_SCREEN
);
QObject
::
connect
(
CoreManager
::
getInstance
(),
&
CoreManager
::
linphoneCoreCreated
,
splash
Screen
,
[
splashS
creen
]
{
splash
S
creen
->
close
();
splash
S
creen
->
deleteLater
();
});
}
void
App
::
initContentApp
()
{
// Init core.
CoreManager
::
init
(
this
,
m
_p
arser
.
value
(
"config"
));
qInfo
()
<<
"Activated selectors:"
<<
QQmlFileSelector
::
get
(
&
m
_e
ngine
)
->
selector
()
->
allSelectors
();
CoreManager
::
init
(
this
,
m
P
arser
.
value
(
"config"
));
qInfo
()
<<
"Activated selectors:"
<<
QQmlFileSelector
::
get
(
&
m
E
ngine
)
->
selector
()
->
allSelectors
();
// Provide `+custom` folders for custom components.
(
new
QQmlFileSelector
(
&
m
_e
ngine
,
this
))
->
setExtraSelectors
(
QStringList
(
"custom"
));
(
new
QQmlFileSelector
(
&
m
E
ngine
,
this
))
->
setExtraSelectors
(
QStringList
(
"custom"
));
// Set modules paths.
m
_e
ngine
.
addImportPath
(
":/ui/modules"
);
m
_e
ngine
.
addImportPath
(
":/ui/scripts"
);
m
_e
ngine
.
addImportPath
(
":/ui/views"
);
m
E
ngine
.
addImportPath
(
":/ui/modules"
);
m
E
ngine
.
addImportPath
(
":/ui/scripts"
);
m
E
ngine
.
addImportPath
(
":/ui/views"
);
// Provide avatars/thumbnails providers.
m
_e
ngine
.
addImageProvider
(
AvatarProvider
::
PROVIDER_ID
,
new
AvatarProvider
());
m
_e
ngine
.
addImageProvider
(
ThumbnailProvider
::
PROVIDER_ID
,
new
ThumbnailProvider
());
m
E
ngine
.
addImageProvider
(
AvatarProvider
::
PROVIDER_ID
,
new
AvatarProvider
());
m
E
ngine
.
addImageProvider
(
ThumbnailProvider
::
PROVIDER_ID
,
new
ThumbnailProvider
());
// Don't quit if last window is closed!!!
setQuitOnLastWindowClosed
(
false
);
...
...
@@ -139,12 +139,12 @@ void App::initContentApp () {
registerTypes
();
// Enable notifications.
m
_n
otifier
=
new
Notifier
(
this
);
m
N
otifier
=
new
Notifier
(
this
);
// Load main view.
qInfo
()
<<
"Loading main view..."
;
m
_e
ngine
.
load
(
QUrl
(
QML_VIEW_MAIN_WINDOW
));
if
(
m
_e
ngine
.
rootObjects
().
isEmpty
())
m
E
ngine
.
load
(
QUrl
(
QML_VIEW_MAIN_WINDOW
));
if
(
m
E
ngine
.
rootObjects
().
isEmpty
())
qFatal
(
"Unable to open main window."
);
// Load splashscreen.
...
...
@@ -153,7 +153,7 @@ void App::initContentApp () {
QObject
::
connect
(
CoreManager
::
getInstance
(),
&
CoreManager
::
linphoneCoreCreated
,
this
,
m
_p
arser
.
isSet
(
"selftest"
)
?
&
App
::
quit
:
&
App
::
openAppAfterInit
this
,
m
P
arser
.
isSet
(
"selftest"
)
?
&
App
::
quit
:
&
App
::
openAppAfterInit
);
QObject
::
connect
(
...
...
@@ -167,10 +167,10 @@ void App::initContentApp () {
// -----------------------------------------------------------------------------
void
App
::
parseArgs
()
{
m
_p
arser
.
setApplicationDescription
(
tr
(
"applicationDescription"
));
m
_p
arser
.
addHelpOption
();
m
_p
arser
.
addVersionOption
();
m
_p
arser
.
addOptions
({
m
P
arser
.
setApplicationDescription
(
tr
(
"applicationDescription"
));
m
P
arser
.
addHelpOption
();
m
P
arser
.
addVersionOption
();
m
P
arser
.
addOptions
({
{
"config"
,
tr
(
"commandLineOptionConfig"
),
"file"
},
#ifndef __APPLE__
{
"iconified"
,
tr
(
"commandLineOptionIconified"
)
},
...
...
@@ -179,13 +179,13 @@ void App::parseArgs () {
{
{
"V"
,
"verbose"
},
tr
(
"commandLineOptionVerbose"
)
}
});
m
_p
arser
.
process
(
*
this
);
m
P
arser
.
process
(
*
this
);
// Initialize logger. (Do not do this before this point because the
// application has to be created for the logs to be put in the correct
// directory.)
Logger
::
init
();
if
(
m
_p
arser
.
isSet
(
"verbose"
))
{
if
(
m
P
arser
.
isSet
(
"verbose"
))
{
Logger
::
getInstance
()
->
setVerbose
(
true
);
}
}
...
...
@@ -200,9 +200,9 @@ void App::tryToUsePreferredLocale () {
if
(
installLocale
(
*
this
,
*
translator
,
QLocale
(
locale
)))
{
// Use config.
m
_t
ranslator
->
deleteLater
();
m
_t
ranslator
=
translator
;
m
_l
ocale
=
locale
;
m
T
ranslator
->
deleteLater
();
m
T
ranslator
=
translator
;
m
L
ocale
=
locale
;
qInfo
()
<<
QStringLiteral
(
"Use preferred locale: %1"
).
arg
(
locale
);
}
else
{
...
...
@@ -216,23 +216,23 @@ void App::tryToUsePreferredLocale () {
// -----------------------------------------------------------------------------
QQuickWindow
*
App
::
getCallsWindow
()
{
if
(
!
m
_calls_w
indow
)
m
_calls_w
indow
=
createSubWindow
(
this
,
QML_VIEW_CALLS_WINDOW
);
if
(
!
m
CallsW
indow
)
m
CallsW
indow
=
createSubWindow
(
this
,
QML_VIEW_CALLS_WINDOW
);
return
m
_calls_w
indow
;
return
m
CallsW
indow
;
}
QQuickWindow
*
App
::
getMainWindow
()
const
{
return
qobject_cast
<
QQuickWindow
*>
(
const_cast
<
QQmlApplicationEngine
*>
(
&
m
_e
ngine
)
->
rootObjects
().
at
(
0
)
const_cast
<
QQmlApplicationEngine
*>
(
&
m
E
ngine
)
->
rootObjects
().
at
(
0
)
);
}
QQuickWindow
*
App
::
getSettingsWindow
()
{
if
(
!
m
_settings_w
indow
)
{
m
_settings_w
indow
=
createSubWindow
(
this
,
QML_VIEW_SETTINGS_WINDOW
);
if
(
!
m
SettingsW
indow
)
{
m
SettingsW
indow
=
createSubWindow
(
this
,
QML_VIEW_SETTINGS_WINDOW
);
QObject
::
connect
(
m
_settings_w
indow
,
&
QWindow
::
visibilityChanged
,
this
,
[](
QWindow
::
Visibility
visibility
)
{
m
SettingsW
indow
,
&
QWindow
::
visibilityChanged
,
this
,
[](
QWindow
::
Visibility
visibility
)
{
if
(
visibility
==
QWindow
::
Hidden
)
{
qInfo
()
<<
"Update nat policy."
;
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
...
...
@@ -242,13 +242,13 @@ QQuickWindow *App::getSettingsWindow () {
);
}
return
m
_settings_w
indow
;
return
m
SettingsW
indow
;
}
// -----------------------------------------------------------------------------
bool
App
::
hasFocus
()
const
{
return
getMainWindow
()
->
isActive
()
||
(
m
_calls_window
&&
m_calls_w
indow
->
isActive
());
return
getMainWindow
()
->
isActive
()
||
(
m
CallsWindow
&&
mCallsW
indow
->
isActive
());
}
// -----------------------------------------------------------------------------
...
...
@@ -319,19 +319,19 @@ void App::registerTypes () {
void
App
::
setTrayIcon
()
{
QQuickWindow
*
root
=
getMainWindow
();
QSystemTrayIcon
*
system
_tray_i
con
=
new
QSystemTrayIcon
(
root
);
QSystemTrayIcon
*
system
TrayI
con
=
new
QSystemTrayIcon
(
root
);
// trayIcon: Right click actions.
QAction
*
quit
_a
ction
=
new
QAction
(
"Quit"
,
root
);
root
->
connect
(
quit
_a
ction
,
&
QAction
::
triggered
,
this
,
&
App
::
quit
);
QAction
*
quit
A
ction
=
new
QAction
(
"Quit"
,
root
);
root
->
connect
(
quit
A
ction
,
&
QAction
::
triggered
,
this
,
&
App
::
quit
);
QAction
*
restore
_a
ction
=
new
QAction
(
"Restore"
,
root
);
root
->
connect
(
restore
_a
ction
,
&
QAction
::
triggered
,
root
,
&
QQuickWindow
::
showNormal
);
QAction
*
restore
A
ction
=
new
QAction
(
"Restore"
,
root
);
root
->
connect
(
restore
A
ction
,
&
QAction
::
triggered
,
root
,
&
QQuickWindow
::
showNormal
);
// trayIcon: Left click actions.
QMenu
*
menu
=
new
QMenu
();
root
->
connect
(
system
_tray_i
con
,
&
QSystemTrayIcon
::
activated
,
[
root
](
system
TrayI
con
,
&
QSystemTrayIcon
::
activated
,
[
root
](
QSystemTrayIcon
::
ActivationReason
reason
)
{
if
(
reason
==
QSystemTrayIcon
::
Trigger
)
{
...
...
@@ -344,14 +344,14 @@ void App::setTrayIcon () {
);
// Build trayIcon menu.
menu
->
addAction
(
restore
_a
ction
);
menu
->
addAction
(
restore
A
ction
);
menu
->
addSeparator
();
menu
->
addAction
(
quit
_a
ction
);
menu
->
addAction
(
quit
A
ction
);
system
_tray_i
con
->
setContextMenu
(
menu
);
system
_tray_i
con
->
setIcon
(
QIcon
(
WINDOW_ICON_PATH
));
system
_tray_i
con
->
setToolTip
(
"Linphone"
);
system
_tray_i
con
->
show
();
system
TrayI
con
->
setContextMenu
(
menu
);
system
TrayI
con
->
setIcon
(
QIcon
(
WINDOW_ICON_PATH
));
system
TrayI
con
->
setToolTip
(
"Linphone"
);
system
TrayI
con
->
show
();
}
// -----------------------------------------------------------------------------
...
...
@@ -373,7 +373,7 @@ void App::setConfigLocale (const QString &locale) {
}
QString
App
::
getLocale
()
const
{
return
m
_l
ocale
;
return
m
L
ocale
;
}
// -----------------------------------------------------------------------------
...
...
@@ -391,7 +391,7 @@ void App::openAppAfterInit () {
else
setTrayIcon
();
if
(
!
m
_p
arser
.
isSet
(
"iconified"
))
if
(
!
m
P
arser
.
isSet
(
"iconified"
))
getMainWindow
()
->
showNormal
();
#else
getMainWindow
()
->
showNormal
();
...
...
@@ -401,7 +401,7 @@ void App::openAppAfterInit () {
// -----------------------------------------------------------------------------
void
App
::
quit
()
{
if
(
m
_p
arser
.
isSet
(
"selftest"
))
if
(
m
P
arser
.
isSet
(
"selftest"
))
cout
<<
tr
(
"selftestResult"
).
toStdString
()
<<
endl
;
QApplication
::
quit
();
...
...
linphone-desktop/src/app/App.hpp
View file @
dc1cce15
...
...
@@ -51,11 +51,11 @@ public:
void
tryToUsePreferredLocale
();
QQmlEngine
*
getEngine
()
{
return
&
m
_e
ngine
;
return
&
m
E
ngine
;
}
Notifier
*
getNotifier
()
const
{
return
m
_n
otifier
;
return
m
N
otifier
;
}
QQuickWindow
*
getCallsWindow
();
...
...
@@ -85,23 +85,23 @@ private:
QString
getLocale
()
const
;
QVariantList
getAvailableLocales
()
const
{
return
m
_available_l
ocales
;
return
m
AvailableL
ocales
;
}
void
openAppAfterInit
();
QCommandLineParser
m
_p
arser
;
QCommandLineParser
m
P
arser
;
QVariantList
m
_available_l
ocales
;
QString
m
_l
ocale
;
QVariantList
m
AvailableL
ocales
;
QString
m
L
ocale
;
QQmlApplicationEngine
m
_e
ngine
;
QQmlApplicationEngine
m
E
ngine
;
DefaultTranslator
*
m
_t
ranslator
=
nullptr
;
Notifier
*
m
_n
otifier
=
nullptr
;
DefaultTranslator
*
m
T
ranslator
=
nullptr
;
Notifier
*
m
N
otifier
=
nullptr
;
QQuickWindow
*
m
_calls_w
indow
=
nullptr
;
QQuickWindow
*
m
_settings_w
indow
=
nullptr
;
QQuickWindow
*
m
CallsW
indow
=
nullptr
;
QQuickWindow
*
m
SettingsW
indow
=
nullptr
;
};
#endif // APP_H_
linphone-desktop/src/app/logger/Logger.cpp
View file @
dc1cce15
...
...
@@ -55,9 +55,9 @@ using namespace std;
// =============================================================================
QMutex
Logger
::
m
_m
utex
;
QMutex
Logger
::
m
M
utex
;
Logger
*
Logger
::
m
_i
nstance
=
nullptr
;
Logger
*
Logger
::
m
I
nstance
=
nullptr
;
// -----------------------------------------------------------------------------
...
...
@@ -79,10 +79,10 @@ static void linphoneLog (const char *domain, OrtpLogLevel type, const char *fmt,
else
return
;
QByteArray
date
_t
ime
=
QDateTime
::
currentDateTime
().
toString
(
"HH:mm:ss"
).
toLocal8Bit
();
QByteArray
date
T
ime
=
QDateTime
::
currentDateTime
().
toString
(
"HH:mm:ss"
).
toLocal8Bit
();
char
*
msg
=
bctbx_strdup_vprintf
(
fmt
,
args
);
fprintf
(
stderr
,
format
,
date
_t
ime
.
constData
(),
domain
,
msg
);
fprintf
(
stderr
,
format
,
date
T
ime
.
constData
(),
domain
,
msg
);
bctbx_free
(
msg
);
...
...
@@ -133,15 +133,15 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
#endif // ifdef QT_MESSAGELOGCONTEXT
QByteArray
local
_m
sg
=
msg
.
toLocal8Bit
();
QByteArray
date
_t
ime
=
QDateTime
::
currentDateTime
().
toString
(
"HH:mm:ss"
).
toLocal8Bit
();
QByteArray
local
M
sg
=
msg
.
toLocal8Bit
();
QByteArray
date
T
ime
=
QDateTime
::
currentDateTime
().
toString
(
"HH:mm:ss"
).
toLocal8Bit
();
m
_m
utex
.
lock
();
m
M
utex
.
lock
();
fprintf
(
stderr
,
format
,
date
_time
.
constData
(),
context_str
,
local_m
sg
.
constData
());
bctbx_log
(
QT_DOMAIN
,
level
,
"QT: %s%s"
,
context_str
,
local
_m
sg
.
constData
());
fprintf
(
stderr
,
format
,
date
Time
.
constData
(),
context_str
,
localM
sg
.
constData
());
bctbx_log
(
QT_DOMAIN
,
level
,
"QT: %s%s"
,
context_str
,
local
M
sg
.
constData
());
m
_m
utex
.
unlock
();
m
M
utex
.
unlock
();
if
(
type
==
QtFatalMsg
)
abort
();
...
...
@@ -150,16 +150,16 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
// -----------------------------------------------------------------------------
void
Logger
::
init
()
{
if
(
m
_i
nstance
)
if
(
m
I
nstance
)
return
;
m
_i
nstance
=
new
Logger
();
m
I
nstance
=
new
Logger
();
qInstallMessageHandler
(
Logger
::
log
);
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
_i
nstance
->
isVerbose
())
if
(
m
I
nstance
->
isVerbose
())
linphoneLog
(
domain
,
type
,
fmt
,
args
);
}
);
...
...
linphone-desktop/src/app/logger/Logger.hpp
View file @
dc1cce15
...
...
@@ -32,17 +32,17 @@ public:
~
Logger
()
=
default
;
bool
isVerbose
()
const
{
return
m
_v
erbose
;
return
m
V
erbose
;
}
void
setVerbose
(
bool
verbose
)
{
m
_v
erbose
=
verbose
;
m
V
erbose
=
verbose
;
}
static
void
init
();
static
Logger
*
getInstance
()
{
return
m
_i
nstance
;
return
m
I
nstance
;
}
private:
...
...
@@ -50,10 +50,10 @@ private:
static
void
log
(
QtMsgType
type
,
const
QMessageLogContext
&
context
,
const
QString
&
msg
);
bool
m
_v
erbose
=
false
;
bool
m
V
erbose
=
false
;
static
QMutex
m
_m
utex
;
static
Logger
*
m
_i
nstance
;
static
QMutex
m
M
utex
;
static
Logger
*
m
I
nstance
;
};
#endif // LOGGER_H_
linphone-desktop/src/app/paths/Paths.cpp
View file @
dc1cce15
...
...
@@ -168,9 +168,9 @@ string Paths::getCapturesDirpath () {
return
getWritableDirectoryPath
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppLocalDataLocation
)
+
PATH_CAPTURES
);
}
string
Paths
::
getConfigFilepath
(
const
QString
&
config
_p
ath
)
{
if
(
!
config
_p
ath
.
isEmpty
())
return
getWritableFilePath
(
QFileInfo
(
config
_p
ath
).
absoluteFilePath
());
string
Paths
::
getConfigFilepath
(
const
QString
&
config
P
ath
)
{
if
(
!
config
P
ath
.
isEmpty
())
return
getWritableFilePath
(
QFileInfo
(
config
P
ath
).
absoluteFilePath
());
return
getWritableFilePath
(
getAppConfigFilepath
());
}
...
...
@@ -221,61 +221,61 @@ string Paths::getZrtpSecretsFilepath () {
// -----------------------------------------------------------------------------
static
void
migrateFile
(
const
QString
&
old
_path
,
const
QString
&
new_p
ath
)
{
QFileInfo
info
(
new
_p
ath
);
static
void
migrateFile
(
const
QString
&
old
Path
,
const
QString
&
newP
ath
)
{
QFileInfo
info
(
new
P
ath
);
ensureDirectoryPathExists
(
info
.
path
());
if
(
QFile
::
copy
(
old
_path
,
new_p
ath
))
{
QFile
::
remove
(
old
_p
ath
);
qInfo
()
<<
"Migrated"
<<
old
_path
<<
"to"
<<
new_p
ath
;
if
(
QFile
::
copy
(
old
Path
,
newP
ath
))
{
QFile
::
remove
(
old
P
ath
);
qInfo
()
<<
"Migrated"
<<
old
Path
<<
"to"
<<
newP
ath
;
}
else
{
qWarning
()
<<
"Failed migration of"
<<
old
_path
<<
"to"
<<
new_p
ath
;
qWarning
()
<<
"Failed migration of"
<<
old
Path
<<
"to"
<<
newP
ath
;
}
}
static
void
migrateConfigurationFile
(
const
QString
&
old
_path
,
const
QString
&
new_p
ath
)
{
QFileInfo
info
(
new
_p
ath
);
static
void
migrateConfigurationFile
(
const
QString
&
old
Path
,
const
QString
&
newP
ath
)
{
QFileInfo
info
(
new
P
ath
);
ensureDirectoryPathExists
(
info
.
path
());
if
(
QFile
::
copy
(
old
_path
,
new_p
ath
))
{
QFile
old
_file
(
old_p
ath
);
if
(
old
_f
ile
.
open
(
QIODevice
::
WriteOnly
))
{
QTextStream
stream
(
&
old
_f
ile
);
stream
<<
"This file has been migrated to "
<<
new
_p
ath
;
if
(
QFile
::
copy
(
old
Path
,
newP
ath
))
{
QFile
old
File
(
oldP
ath
);
if
(
old
F
ile
.
open
(
QIODevice
::
WriteOnly
))
{
QTextStream
stream
(
&
old
F
ile
);
stream
<<
"This file has been migrated to "
<<
new
P
ath
;
}
QFile
::
setPermissions
(
old
_p
ath
,
QFileDevice
::
ReadOwner
);
qInfo
()
<<
"Migrated"
<<
old
_path
<<
"to"
<<
new_p
ath
;
QFile
::
setPermissions
(
old
P
ath
,
QFileDevice
::
ReadOwner
);
qInfo
()
<<
"Migrated"
<<
old
Path
<<
"to"
<<
newP
ath
;
}
else
{
qWarning
()
<<
"Failed migration of"
<<
old
_path
<<
"to"
<<
new_p
ath
;
qWarning
()
<<
"Failed migration of"
<<
old
Path
<<
"to"
<<
newP
ath
;
}
}
void
Paths
::
migrate
()
{
QString
new
_p
ath
=
getAppConfigFilepath
();
QString
old
_base_d
ir
=
QSysInfo
::
productType
()
==
"windows"
QString
new
P
ath
=
getAppConfigFilepath
();
QString
old
BaseD
ir
=
QSysInfo
::
productType
()
==
"windows"
?
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppLocalDataLocation
)
:
QStandardPaths
::
writableLocation
(
QStandardPaths
::
HomeLocation
);
QString
old
_path
=
old_base_d
ir
+
"/.linphonerc"
;
QString
old
Path
=
oldBaseD
ir
+
"/.linphonerc"
;
if
(
!
filePathExists
(
new
_path
)
&&
filePathExists
(
old_p
ath
))
migrateConfigurationFile
(
old
_path
,
new_p
ath
);
if
(
!
filePathExists
(
new
Path
)
&&
filePathExists
(
oldP
ath
))
migrateConfigurationFile
(
old
Path
,
newP
ath
);
new
_p
ath
=
getAppCallHistoryFilepath
();
old
_path
=
old_base_d
ir
+
"/.linphone-call-history.db"
;
new
P
ath
=
getAppCallHistoryFilepath
();
old
Path
=
oldBaseD
ir
+
"/.linphone-call-history.db"
;
if
(
!
filePathExists
(
new
_path
)
&&
filePathExists
(
old_p
ath
))
migrateFile
(
old
_path
,
new_p
ath
);
if
(
!
filePathExists
(
new
Path
)
&&
filePathExists
(
oldP
ath
))
migrateFile
(
old
Path
,
newP
ath
);
new
_p
ath
=
getAppFriendsFilepath
();
old
_path
=
old_base_d
ir
+
"/.linphone-friends.db"
;
new
P
ath
=
getAppFriendsFilepath
();
old
Path
=
oldBaseD
ir
+
"/.linphone-friends.db"
;
if
(
!
filePathExists
(
new
_path
)
&&
filePathExists
(
old_p
ath
))
migrateFile
(
old
_path
,
new_p
ath
);
if
(
!
filePathExists
(
new
Path
)
&&
filePathExists
(
oldP
ath
))
migrateFile
(
old
Path
,
newP
ath
);
new
_p
ath
=
getAppMessageHistoryFilepath
();
old
_path
=
old_base_d
ir
+
"/.linphone-history.db"
;
new
P
ath
=
getAppMessageHistoryFilepath
();
old
Path
=
oldBaseD
ir
+
"/.linphone-history.db"
;
if
(
!
filePathExists
(
new
_path
)
&&
filePathExists
(
old_p
ath
))
migrateFile
(
old
_path
,
new_p
ath
);
if
(
!
filePathExists
(
new
Path
)
&&
filePathExists
(
oldP
ath
))
migrateFile
(
old
Path
,
newP
ath
);
}
linphone-desktop/src/app/paths/Paths.hpp
View file @
dc1cce15
...
...
@@ -33,7 +33,7 @@ namespace Paths {
std
::
string
getAvatarsDirpath
();
std
::
string
getCallHistoryFilepath
();
std
::
string
getCapturesDirpath
();
std
::
string
getConfigFilepath
(
const
QString
&
config
_p
ath
=
QString
());
std
::
string
getConfigFilepath
(
const
QString
&
config
P
ath
=
QString
());
std
::
string
getFactoryConfigFilepath
();
std
::
string
getFriendsListFilepath
();
std
::
string
getLogsDirpath
();
...
...
linphone-desktop/src/app/providers/AvatarProvider.cpp
View file @
dc1cce15
...
...
@@ -33,9 +33,9 @@ AvatarProvider::AvatarProvider () : QQuickImageProvider(
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
m
_avatars_p
ath
=
Utils
::
linphoneStringToQString
(
Paths
::
getAvatarsDirpath
());
m
AvatarsP
ath
=
Utils
::
linphoneStringToQString
(
Paths
::
getAvatarsDirpath
());
}
QImage
AvatarProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
,
const
QSize
&
)
{
return
QImage
(
m
_avatars_p
ath
+
id
);
return
QImage
(
m
AvatarsP
ath
+
id
);
}
linphone-desktop/src/app/providers/AvatarProvider.hpp
View file @
dc1cce15
...
...
@@ -32,12 +32,12 @@ public:
AvatarProvider
();
~
AvatarProvider
()
=
default
;
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requested
_s
ize
)
override
;
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requested
S
ize
)
override
;
static
const
QString
PROVIDER_ID
;
private:
QString
m
_avatars_p
ath
;
QString
m
AvatarsP
ath
;
};
#endif // AVATAR_PROVIDER_H_
linphone-desktop/src/app/providers/ThumbnailProvider.cpp
View file @
dc1cce15
...
...
@@ -33,9 +33,9 @@ ThumbnailProvider::ThumbnailProvider () : QQuickImageProvider(
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
m
_thumbnails_p
ath
=
Utils
::
linphoneStringToQString
(
Paths
::
getThumbnailsDirpath
());
m
ThumbnailsP
ath
=
Utils
::
linphoneStringToQString
(
Paths
::
getThumbnailsDirpath
());
}
QImage
ThumbnailProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
,
const
QSize
&
)
{
return
QImage
(
m
_thumbnails_p
ath
+
id
);
return
QImage
(
m
ThumbnailsP
ath
+
id
);
}
linphone-desktop/src/app/providers/ThumbnailProvider.hpp
View file @
dc1cce15
...
...
@@ -32,12 +32,12 @@ public:
ThumbnailProvider
();
~
ThumbnailProvider
()
=
default
;
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requested
_s
ize
)
override
;
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requested
S
ize
)
override
;
static
const
QString
PROVIDER_ID
;
private:
QString
m
_thumbnails_p
ath
;
QString
m
ThumbnailsP
ath
;
};
#endif // THUMBNAIL_PROVIDER_H_
linphone-desktop/src/app/translator/DefaultTranslator.cpp
View file @
dc1cce15
...
...
@@ -43,28 +43,28 @@ DefaultTranslator::DefaultTranslator (QObject *parent) : QTranslator(parent) {
continue
;
QString
basename
=
info
.
baseName
();
if
(
m
_c
ontexts
.
contains
(
basename
))
if
(
m
C
ontexts
.
contains
(
basename
))
qWarning
()
<<
QStringLiteral
(
"QML context `%1` already exists in contexts list."
).
arg
(
basename
);
else
m
_c
ontexts
<<
basename
;
m
C
ontexts
<<
basename
;
}
}
}
QString
DefaultTranslator
::
translate
(
const
char
*
context
,
const
char
*
source
_t
ext
,
const
char
*
source
T
ext
,
const
char
*
disambiguation
,
int
n
)
const
{
if
(
!
context
)
return
QStringLiteral
(
""
);
QString
translation
=
QTranslator
::
translate
(
context
,
source
_t
ext
,
disambiguation
,
n
);
QString
translation
=
QTranslator
::
translate
(
context
,
source
T
ext
,
disambiguation
,
n
);
if
(
translation
.
length
()
==
0
&&
m
_c
ontexts
.
contains
(
context
))
if
(
translation
.
length
()
==
0
&&
m
C
ontexts
.
contains
(
context
))
qWarning
()
<<
QStringLiteral
(
"Unable to find a translation. (context=%1, label=%2)"
)
.
arg
(
context
).
arg
(
source
_t
ext
);
.
arg
(
context
).
arg
(
source
T
ext
);
return
translation
;
}
linphone-desktop/src/app/translator/DefaultTranslator.hpp
View file @
dc1cce15
...
...
@@ -35,13 +35,13 @@ public:
QString
translate
(
const
char
*
context
,
const
char
*
source
_t
ext
,
const
char
*
source
T
ext
,
const
char
*
disambiguation
=
Q_NULLPTR
,
int
n
=
-
1
)
const
override
;
private:
QSet
<
QString
>
m
_c
ontexts
;
QSet
<
QString
>
m
C
ontexts
;
};
#endif // DEFAULT_TRANSLATOR_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