diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..fe663f18f
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,31 @@
+# Copyright (c) 2010-2023 Belledonne Communications SARL.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+---
+Language: Cpp
+BasedOnStyle: LLVM
+AccessModifierOffset: -4
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: AllIfsAndElse
+AlwaysBreakTemplateDeclarations: Yes
+BinPackParameters: false
+ColumnLimit: 120
+PointerAlignment: Right
+IndentCaseLabels: true
+IndentWidth: 4
+Standard: c++14
+TabWidth: 4
+UseTab: ForIndentation
+...
diff --git a/.gitignore b/.gitignore
index 2ff15b576..a4251bc93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,9 +4,6 @@
.*
\#*\#
.#.*
-!.gitignore
-!.gitlab-ci*
-!.gitmodules
# Project configuration --------------------------------------------------------
*.pro.user
@@ -44,3 +41,10 @@ rpm-*/
vgcore.*
linphone.spec
+
+# Exceptions -------------------------------------------------------------------
+
+!.clang-format
+!.gitignore
+!.gitlab-ci*
+!.gitmodules
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4e5edd0c..b1185914e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,3 +251,4 @@ else()
include(cmake/TasksMacos.cmake)
endif()
+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/hook/pre-commit" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/")
\ No newline at end of file
diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp
index 357f6afd8..ecbdffaa1 100644
--- a/Linphone/core/App.cpp
+++ b/Linphone/core/App.cpp
@@ -5,8 +5,7 @@
#include "tool/Constants.hpp"
#include "view/Page/LoginPage.hpp"
-
-App::App(QObject * parent) : QObject(parent) {
+App::App(QObject *parent) : QObject(parent) {
init();
}
@@ -15,26 +14,27 @@ App::App(QObject * parent) : QObject(parent) {
//-----------------------------------------------------------
void App::init() {
-// Core
+ // Core
mCoreModel = QSharedPointer::create("", this);
mCoreModel->start();
-// QML
+ // QML
mEngine = new QQmlApplicationEngine(this);
mEngine->addImportPath(":/");
-
+
initCppInterfaces();
-
+
const QUrl url(u"qrc:/Linphone/view/App/Main.qml"_qs);
- QObject::connect(mEngine, &QQmlApplicationEngine::objectCreated,
- this, [url](QObject *obj, const QUrl &objUrl) {
- if (!obj && url == objUrl)
- QCoreApplication::exit(-1);
- }, Qt::QueuedConnection);
+ QObject::connect(
+ mEngine, &QQmlApplicationEngine::objectCreated, this,
+ [url](QObject *obj, const QUrl &objUrl) {
+ if (!obj && url == objUrl) QCoreApplication::exit(-1);
+ },
+ Qt::QueuedConnection);
mEngine->load(url);
}
void App::initCppInterfaces() {
- qmlRegisterSingletonType(Constants::MainQmlUri, 1, 0, "LoginPageCpp", [](QQmlEngine *engine, QJSEngine *) -> QObject *{
- return new LoginPage(engine);
- });
-}
\ No newline at end of file
+ qmlRegisterSingletonType(
+ Constants::MainQmlUri, 1, 0, "LoginPageCpp",
+ [](QQmlEngine *engine, QJSEngine *) -> QObject * { return new LoginPage(engine); });
+}
diff --git a/Linphone/core/App.hpp b/Linphone/core/App.hpp
index 5a1603d02..8b169fa40 100644
--- a/Linphone/core/App.hpp
+++ b/Linphone/core/App.hpp
@@ -1,16 +1,16 @@
-#include
#include
+#include
#include "model/core/CoreModel.hpp"
-class App : public QObject{
+class App : public QObject {
public:
- App(QObject * parent = nullptr);
-
+ App(QObject *parent = nullptr);
+
void init();
void initCppInterfaces();
-
- QQmlApplicationEngine * mEngine = nullptr;
+
+ QQmlApplicationEngine *mEngine = nullptr;
QSharedPointer mCoreModel;
};
\ No newline at end of file
diff --git a/Linphone/core/path/Paths.cpp b/Linphone/core/path/Paths.cpp
index 3c83cd906..17810dec5 100644
--- a/Linphone/core/path/Paths.cpp
+++ b/Linphone/core/path/Paths.cpp
@@ -31,50 +31,49 @@
// =============================================================================
-static inline bool dirPathExists (const QString &path) {
+static inline bool dirPathExists(const QString &path) {
QDir dir(path);
return dir.exists();
}
/*
static inline bool filePathExists (const QString &path, const bool& isWritable) {
- QFileInfo info(path);
- if (!dirPathExists(info.path()))
- return false;
- if( isWritable && !info.isWritable())
- return false;
- QFile file(path);
- return file.exists();
+ QFileInfo info(path);
+ if (!dirPathExists(info.path()))
+ return false;
+ if( isWritable && !info.isWritable())
+ return false;
+ QFile file(path);
+ return file.exists();
}
*/
-static inline void ensureDirPathExists (const QString &path) {
+static inline void ensureDirPathExists(const QString &path) {
QDir dir(path);
- if (!dir.exists() && !dir.mkpath(path))
- qFatal("Unable to access at directory: `%s`", path.toStdString().c_str());
+ if (!dir.exists() && !dir.mkpath(path)) qFatal("Unable to access at directory: `%s`", path.toStdString().c_str());
}
-static inline void ensureFilePathExists (const QString &path) {
+static inline void ensureFilePathExists(const QString &path) {
QFileInfo info(path);
ensureDirPathExists(info.path());
-
+
QFile file(path);
if (!file.exists() && !file.open(QIODevice::ReadWrite))
qFatal("Unable to access at path: `%s`", path.toStdString().c_str());
}
-static inline QString getReadableDirPath (const QString &dirname) {
+static inline QString getReadableDirPath(const QString &dirname) {
return QDir::toNativeSeparators(dirname);
}
-static inline QString getWritableDirPath (const QString &dirname) {
+static inline QString getWritableDirPath(const QString &dirname) {
ensureDirPathExists(dirname);
return getReadableDirPath(dirname);
}
-static inline QString getReadableFilePath (const QString &filename) {
+static inline QString getReadableFilePath(const QString &filename) {
return QDir::toNativeSeparators(filename);
}
-static inline QString getWritableFilePath (const QString &filename) {
+static inline QString getWritableFilePath(const QString &filename) {
ensureFilePathExists(filename);
return getReadableFilePath(filename);
}
@@ -87,7 +86,6 @@ static inline QString getWritableFilePath (const QString &filename) {
// plugins/
// share/
-
// But in some cases, it can be :
// /linphone
// lib/
@@ -102,14 +100,15 @@ static inline QString getWritableFilePath (const QString &filename) {
// Resources/
// share/
-static inline QDir getAppPackageDir () {
+static inline QDir getAppPackageDir() {
QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == QLatin1String("MacOS")) {
dir.cdUp();
- } else if( !dir.exists("lib") && !dir.exists("lib64")){// Check if these folders are in the current path
+ } else if (!dir.exists("lib") && !dir.exists("lib64")) { // Check if these folders are in the current path
dir.cdUp();
- if(!dir.exists("lib") && !dir.exists("lib64") && !dir.exists("plugins"))
- qWarning() <<"The application's location is not correct: You have to put your 'bin/' folder next to 'lib/' or 'plugins/' folder.";
+ if (!dir.exists("lib") && !dir.exists("lib64") && !dir.exists("plugins"))
+ qWarning() << "The application's location is not correct: You have to put your 'bin/' folder next to "
+ "'lib/' or 'plugins/' folder.";
}
return dir;
}
@@ -117,175 +116,177 @@ static inline QDir getAppPackageDir () {
static inline QString getAppPackageDataDirPath() {
QDir dir = getAppPackageDir();
#ifdef __APPLE__
- if (!dir.cd("Resources"))
- {
+ if (!dir.cd("Resources")) {
dir.mkdir("Resources");
dir.cd("Resources");
}
#endif
- if (!dir.cd("share"))
- {
+ if (!dir.cd("share")) {
dir.mkdir("share");
dir.cd("share");
}
return dir.absolutePath();
}
-static inline QString getAppPackageMsPluginsDirPath () {
+static inline QString getAppPackageMsPluginsDirPath() {
QDir dir = getAppPackageDir();
dir.cd(MSPLUGINS_DIR);
return dir.absolutePath();
}
-static inline QString getAppPackagePluginsDirPath () {
+static inline QString getAppPackagePluginsDirPath() {
return getAppPackageDir().absolutePath() + Constants::PathPlugins;
}
-static inline QString getAppAssistantConfigDirPath () {
+static inline QString getAppAssistantConfigDirPath() {
return getAppPackageDataDirPath() + Constants::PathAssistantConfig;
}
-static inline QString getAppConfigFilePath () {
+static inline QString getAppConfigFilePath() {
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + Constants::PathConfig;
}
-static inline QString getAppCallHistoryFilePath () {
+static inline QString getAppCallHistoryFilePath() {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathCallHistoryList;
}
-static inline QString getAppFactoryConfigFilePath () {
+static inline QString getAppFactoryConfigFilePath() {
return getAppPackageDataDirPath() + Constants::PathFactoryConfig;
}
-static inline QString getAppRootCaFilePath () {
+static inline QString getAppRootCaFilePath() {
QString rootca = getAppPackageDataDirPath() + Constants::PathRootCa;
- if(Paths::filePathExists(rootca)){// Packaged
+ if (Paths::filePathExists(rootca)) { // Packaged
return rootca;
}
return "";
}
-static inline QString getAppFriendsFilePath () {
+static inline QString getAppFriendsFilePath() {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathFriendsList;
}
-static inline QString getAppMessageHistoryFilePath () {
+static inline QString getAppMessageHistoryFilePath() {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathMessageHistoryList;
}
-static inline QString getAppPluginsDirPath () {
- return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+ Constants::PathPlugins;
+static inline QString getAppPluginsDirPath() {
+ return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathPlugins;
}
// -----------------------------------------------------------------------------
-bool Paths::filePathExists (const QString &path, const bool isWritable) {
+bool Paths::filePathExists(const QString &path, const bool isWritable) {
QFileInfo info(path);
- if (!dirPathExists(info.path()))
- return false;
- if( isWritable && !info.isWritable())
- return false;
+ if (!dirPathExists(info.path())) return false;
+ if (isWritable && !info.isWritable()) return false;
QFile file(path);
return file.exists();
}
-
// -----------------------------------------------------------------------------
-QString Paths::getAppLocalDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +"/");
+QString Paths::getAppLocalDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/");
}
-QString Paths::getAssistantConfigDirPath () {
+QString Paths::getAssistantConfigDirPath() {
return getReadableDirPath(getAppAssistantConfigDirPath());
}
-QString Paths::getAvatarsDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathAvatars);
+QString Paths::getAvatarsDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
+ Constants::PathAvatars);
}
-QString Paths::getCallHistoryFilePath () {
+QString Paths::getCallHistoryFilePath() {
return getWritableFilePath(getAppCallHistoryFilePath());
}
-QString Paths::getCapturesDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + Constants::PathCaptures);
+QString Paths::getCapturesDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) +
+ Constants::PathCaptures);
}
-QString Paths::getCodecsDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathCodecs);
+QString Paths::getCodecsDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
+ Constants::PathCodecs);
}
-QString Paths::getConfigDirPath (bool writable) {
- return writable ? getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)+QDir::separator()) : getReadableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)+QDir::separator());
+QString Paths::getConfigDirPath(bool writable) {
+ return writable ? getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) +
+ QDir::separator())
+ : getReadableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) +
+ QDir::separator());
}
-QString Paths::getConfigFilePath (const QString &configPath, bool writable) {
+QString Paths::getConfigFilePath(const QString &configPath, bool writable) {
QString path;
- if( !configPath.isEmpty()){
+ if (!configPath.isEmpty()) {
QFileInfo file(configPath);
- if( !writable && (!file.exists() || !file.isFile())){// This file cannot be found. Check if it exists in standard folder
+ if (!writable &&
+ (!file.exists() || !file.isFile())) { // This file cannot be found. Check if it exists in standard folder
QString defaultConfigPath = getConfigDirPath(false);
- file = QFileInfo(defaultConfigPath+QDir::separator()+configPath);
- if( !file.exists() || !file.isFile())
- path = "";
- else
- path = file.absoluteFilePath();
- }else
- path = file.absoluteFilePath();
- }else
- path = getAppConfigFilePath();
+ file = QFileInfo(defaultConfigPath + QDir::separator() + configPath);
+ if (!file.exists() || !file.isFile()) path = "";
+ else path = file.absoluteFilePath();
+ } else path = file.absoluteFilePath();
+ } else path = getAppConfigFilePath();
return writable ? getWritableFilePath(path) : getReadableFilePath(path);
}
-QString Paths::getDatabaseFilePath (){
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) + Constants::PathDatabase;
+QString Paths::getDatabaseFilePath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) +
+ Constants::PathDatabase;
}
-QString Paths::getFactoryConfigFilePath () {
+QString Paths::getFactoryConfigFilePath() {
return getReadableFilePath(getAppFactoryConfigFilePath());
}
-QString Paths::getFriendsListFilePath () {
+QString Paths::getFriendsListFilePath() {
return getWritableFilePath(getAppFriendsFilePath());
}
-QString Paths::getDownloadDirPath () {
+QString Paths::getDownloadDirPath() {
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QDir::separator());
}
-QString Paths::getLimeDatabasePath (){
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) + Constants::PathLimeDatabase;
+QString Paths::getLimeDatabasePath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) +
+ Constants::PathLimeDatabase;
}
-QString Paths::getLogsDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathLogs);
+QString Paths::getLogsDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
+ Constants::PathLogs);
}
-QString Paths::getMessageHistoryFilePath () {
- return getReadableFilePath(getAppMessageHistoryFilePath());// No need to ensure that the file exists as this DB is deprecated
+QString Paths::getMessageHistoryFilePath() {
+ return getReadableFilePath(
+ getAppMessageHistoryFilePath()); // No need to ensure that the file exists as this DB is deprecated
}
-QString Paths::getPackageDataDirPath () {
+QString Paths::getPackageDataDirPath() {
return getReadableDirPath(getAppPackageDataDirPath() + Constants::PathData);
}
-QString Paths::getPackageMsPluginsDirPath () {
+QString Paths::getPackageMsPluginsDirPath() {
return getReadableDirPath(getAppPackageMsPluginsDirPath());
}
-QString Paths::getPackagePluginsAppDirPath () {
+QString Paths::getPackagePluginsAppDirPath() {
return getReadableDirPath(getAppPackagePluginsDirPath() + Constants::PathPluginsApp);
}
-QString Paths::getPackageSoundsResourcesDirPath (){
+QString Paths::getPackageSoundsResourcesDirPath() {
return getReadableDirPath(getAppPackageDataDirPath() + Constants::PathSounds);
}
-QString Paths::getPackageTopDirPath (){
+QString Paths::getPackageTopDirPath() {
return getReadableDirPath(getAppPackageDataDirPath());
}
-QString Paths::getPluginsAppDirPath () {
+QString Paths::getPluginsAppDirPath() {
return getWritableDirPath(getAppPluginsDirPath() + Constants::PathPluginsApp);
}
@@ -296,22 +297,25 @@ QStringList Paths::getPluginsAppFolders() {
return pluginPaths;
}
-QString Paths::getRootCaFilePath () {
+QString Paths::getRootCaFilePath() {
return getReadableFilePath(getAppRootCaFilePath());
}
-QString Paths::getToolsDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathTools);
+QString Paths::getToolsDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
+ Constants::PathTools);
}
-QString Paths::getUserCertificatesDirPath () {
- return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathUserCertificates);
+QString Paths::getUserCertificatesDirPath() {
+ return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
+ Constants::PathUserCertificates);
}
-QString Paths::getZrtpSecretsFilePath () {
- return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathZrtpSecrets);
+QString Paths::getZrtpSecretsFilePath() {
+ return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
+ Constants::PathZrtpSecrets);
}
// -----------------------------------------------------------------------------
-void Paths::migrate () {
+void Paths::migrate() {
}
diff --git a/Linphone/core/path/Paths.hpp b/Linphone/core/path/Paths.hpp
index 42fb9842f..1af71671a 100644
--- a/Linphone/core/path/Paths.hpp
+++ b/Linphone/core/path/Paths.hpp
@@ -26,37 +26,37 @@
// =============================================================================
namespace Paths {
- bool filePathExists (const QString &path, const bool isWritable = false);
-
- QString getAppLocalDirPath ();
- QString getAssistantConfigDirPath ();
- QString getAvatarsDirPath ();
- QString getCallHistoryFilePath ();
- QString getCapturesDirPath ();
- QString getCodecsDirPath ();
- QString getConfigDirPath (bool writable = true);
- QString getConfigFilePath (const QString &configPath = QString(), bool writable = true);
- QString getDatabaseFilePath ();
- QString getDownloadDirPath ();
- QString getFactoryConfigFilePath ();
- QString getFriendsListFilePath ();
- QString getLimeDatabasePath ();
- QString getLogsDirPath ();
- QString getMessageHistoryFilePath ();
- QString getPackageDataDirPath ();
- QString getPackageMsPluginsDirPath ();
- QString getPackagePluginsAppDirPath ();
- QString getPackageSoundsResourcesDirPath ();
- QString getPackageTopDirPath ();
- QString getPluginsAppDirPath ();
- QStringList getPluginsAppFolders();
- QString getRootCaFilePath ();
- QString getToolsDirPath ();
- QString getUserCertificatesDirPath ();
- QString getZrtpDataFilePath ();
- QString getZrtpSecretsFilePath ();
-
- void migrate ();
-}
+bool filePathExists(const QString &path, const bool isWritable = false);
+
+QString getAppLocalDirPath();
+QString getAssistantConfigDirPath();
+QString getAvatarsDirPath();
+QString getCallHistoryFilePath();
+QString getCapturesDirPath();
+QString getCodecsDirPath();
+QString getConfigDirPath(bool writable = true);
+QString getConfigFilePath(const QString &configPath = QString(), bool writable = true);
+QString getDatabaseFilePath();
+QString getDownloadDirPath();
+QString getFactoryConfigFilePath();
+QString getFriendsListFilePath();
+QString getLimeDatabasePath();
+QString getLogsDirPath();
+QString getMessageHistoryFilePath();
+QString getPackageDataDirPath();
+QString getPackageMsPluginsDirPath();
+QString getPackagePluginsAppDirPath();
+QString getPackageSoundsResourcesDirPath();
+QString getPackageTopDirPath();
+QString getPluginsAppDirPath();
+QStringList getPluginsAppFolders();
+QString getRootCaFilePath();
+QString getToolsDirPath();
+QString getUserCertificatesDirPath();
+QString getZrtpDataFilePath();
+QString getZrtpSecretsFilePath();
+
+void migrate();
+} // namespace Paths
#endif // PATHS_H_
diff --git a/Linphone/core/setting/Settings.cpp b/Linphone/core/setting/Settings.cpp
index 7826aee8c..99c69273e 100644
--- a/Linphone/core/setting/Settings.cpp
+++ b/Linphone/core/setting/Settings.cpp
@@ -18,17 +18,15 @@
* along with this program. If not, see .
*/
-
#include "Settings.hpp"
#include
#include "core/path/Paths.hpp"
-
// =============================================================================
-Settings::Settings (QObject *parent) : QObject(parent) {
+Settings::Settings(QObject *parent) : QObject(parent) {
}
Settings::~Settings() {
@@ -37,12 +35,11 @@ Settings::~Settings() {
QString Settings::getConfigPath(const QCommandLineParser &parser) {
QString filePath = parser.isSet("config") ? parser.value("config") : "";
QString configPath;
- if(!QUrl(filePath).isRelative()){
- //configPath = FileDownloader::synchronousDownload(filePath, Utils::coreStringToAppString(Paths::getConfigDirPath(false)), true));
+ if (!QUrl(filePath).isRelative()) {
+ // configPath = FileDownloader::synchronousDownload(filePath,
+ // Utils::coreStringToAppString(Paths::getConfigDirPath(false)), true));
}
- if( configPath == "")
- configPath = Paths::getConfigFilePath(filePath, false);
- if( configPath == "" )
- configPath = Paths::getConfigFilePath("", false);
+ if (configPath == "") configPath = Paths::getConfigFilePath(filePath, false);
+ if (configPath == "") configPath = Paths::getConfigFilePath("", false);
return configPath;
}
\ No newline at end of file
diff --git a/Linphone/core/setting/Settings.hpp b/Linphone/core/setting/Settings.hpp
index 9570ce4bb..5e5985f2e 100644
--- a/Linphone/core/setting/Settings.hpp
+++ b/Linphone/core/setting/Settings.hpp
@@ -21,17 +21,16 @@
#ifndef SETTINGS_H_
#define SETTINGS_H_
+#include
#include
#include
-#include
-
class Settings : public QObject {
Q_OBJECT
public:
- Settings (QObject *parent = Q_NULLPTR);
- virtual ~Settings ();
-
+ Settings(QObject *parent = Q_NULLPTR);
+ virtual ~Settings();
+
QString getConfigPath(const QCommandLineParser &parser = QCommandLineParser());
};
#endif
diff --git a/Linphone/main.cpp b/Linphone/main.cpp
index f00f4f0be..2a5f39e3d 100644
--- a/Linphone/main.cpp
+++ b/Linphone/main.cpp
@@ -8,7 +8,7 @@
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
-
+
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
diff --git a/Linphone/model/core/CoreListener.cpp b/Linphone/model/core/CoreListener.cpp
index d65d90d99..545242c44 100644
--- a/Linphone/model/core/CoreListener.cpp
+++ b/Linphone/model/core/CoreListener.cpp
@@ -22,89 +22,140 @@
// =============================================================================
-
// -----------------------------------------------------------------------------
-CoreListener::CoreListener(QObject * parent): QObject(parent){
+CoreListener::CoreListener(QObject *parent) : QObject(parent) {
}
-CoreListener::~CoreListener(){
+CoreListener::~CoreListener() {
}
-void CoreListener::onAccountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message){
- emit accountRegistrationStateChanged(core,account,state,message);
+void CoreListener::onAccountRegistrationStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &account,
+ linphone::RegistrationState state,
+ const std::string &message) {
+ emit accountRegistrationStateChanged(core, account, state, message);
}
-void CoreListener::onAuthenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method){
- emit authenticationRequested (core,authInfo,method);
+void CoreListener::onAuthenticationRequested(const std::shared_ptr &core,
+ const std::shared_ptr &authInfo,
+ linphone::AuthMethod method) {
+ emit authenticationRequested(core, authInfo, method);
}
-void CoreListener::onCallEncryptionChanged (const std::shared_ptr &core,const std::shared_ptr &call,bool on,const std::string &authenticationToken){
- emit callEncryptionChanged (core,call,on,authenticationToken);
+void CoreListener::onCallEncryptionChanged(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ bool on,
+ const std::string &authenticationToken) {
+ emit callEncryptionChanged(core, call, on, authenticationToken);
}
-void CoreListener::onCallLogUpdated(const std::shared_ptr & core, const std::shared_ptr & callLog){
+void CoreListener::onCallLogUpdated(const std::shared_ptr &core,
+ const std::shared_ptr &callLog) {
emit callLogUpdated(core, callLog);
}
-void CoreListener::onCallStateChanged (const std::shared_ptr &core,const std::shared_ptr &call,linphone::Call::State state,const std::string &message){
- emit callStateChanged (core,call,state,message);
+void CoreListener::onCallStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ linphone::Call::State state,
+ const std::string &message) {
+ emit callStateChanged(core, call, state, message);
}
-void CoreListener::onCallStatsUpdated (const std::shared_ptr &core,const std::shared_ptr &call,const std::shared_ptr &stats){
- emit callStatsUpdated (core,call,stats);
+void CoreListener::onCallStatsUpdated(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ const std::shared_ptr &stats) {
+ emit callStatsUpdated(core, call, stats);
}
-void CoreListener::onCallCreated(const std::shared_ptr & lc,const std::shared_ptr & call){
- emit callCreated(lc,call);
+void CoreListener::onCallCreated(const std::shared_ptr &lc,
+ const std::shared_ptr &call) {
+ emit callCreated(lc, call);
}
-void CoreListener::onChatRoomRead(const std::shared_ptr & core, const std::shared_ptr & chatRoom){
+void CoreListener::onChatRoomRead(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom) {
emit chatRoomRead(core, chatRoom);
}
-void CoreListener::onChatRoomStateChanged(const std::shared_ptr & core, const std::shared_ptr & chatRoom,linphone::ChatRoom::State state){
- emit chatRoomStateChanged(core, chatRoom,state);
+void CoreListener::onChatRoomStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom,
+ linphone::ChatRoom::State state) {
+ emit chatRoomStateChanged(core, chatRoom, state);
}
-void CoreListener::onConferenceInfoReceived(const std::shared_ptr & core, const std::shared_ptr & conferenceInfo){
+void CoreListener::onConferenceInfoReceived(const std::shared_ptr &core,
+ const std::shared_ptr &conferenceInfo) {
emit conferenceInfoReceived(core, conferenceInfo);
}
-void CoreListener::onConfiguringStatus(const std::shared_ptr & core,linphone::Config::ConfiguringState status,const std::string & message){
- emit configuringStatus(core,status,message);
+void CoreListener::onConfiguringStatus(const std::shared_ptr &core,
+ linphone::Config::ConfiguringState status,
+ const std::string &message) {
+ emit configuringStatus(core, status, message);
}
-void CoreListener::onDtmfReceived(const std::shared_ptr & lc,const std::shared_ptr & call,int dtmf){
- emit dtmfReceived(lc,call,dtmf);
+void CoreListener::onDtmfReceived(const std::shared_ptr &lc,
+ const std::shared_ptr &call,
+ int dtmf) {
+ emit dtmfReceived(lc, call, dtmf);
}
-void CoreListener::onEcCalibrationResult(const std::shared_ptr & core,linphone::EcCalibratorStatus status,int delayMs){
- emit ecCalibrationResult(core,status,delayMs);
+void CoreListener::onEcCalibrationResult(const std::shared_ptr &core,
+ linphone::EcCalibratorStatus status,
+ int delayMs) {
+ emit ecCalibrationResult(core, status, delayMs);
}
-void CoreListener::onGlobalStateChanged (const std::shared_ptr &core,linphone::GlobalState gstate,const std::string &message){
- emit globalStateChanged (core,gstate,message);
+void CoreListener::onGlobalStateChanged(const std::shared_ptr &core,
+ linphone::GlobalState gstate,
+ const std::string &message) {
+ emit globalStateChanged(core, gstate, message);
}
-void CoreListener::onIsComposingReceived (const std::shared_ptr &core,const std::shared_ptr &room){
- emit isComposingReceived (core,room);
+void CoreListener::onIsComposingReceived(const std::shared_ptr &core,
+ const std::shared_ptr &room) {
+ emit isComposingReceived(core, room);
}
-void CoreListener::onLogCollectionUploadStateChanged (const std::shared_ptr &core,linphone::Core::LogCollectionUploadState state,const std::string &info){
- emit logCollectionUploadStateChanged (core,state,info);
+void CoreListener::onLogCollectionUploadStateChanged(const std::shared_ptr &core,
+ linphone::Core::LogCollectionUploadState state,
+ const std::string &info) {
+ emit logCollectionUploadStateChanged(core, state, info);
}
-void CoreListener::onLogCollectionUploadProgressIndication (const std::shared_ptr &lc,size_t offset,size_t total){
- emit logCollectionUploadProgressIndication (lc,offset,total);
+void CoreListener::onLogCollectionUploadProgressIndication(const std::shared_ptr &lc,
+ size_t offset,
+ size_t total) {
+ emit logCollectionUploadProgressIndication(lc, offset, total);
}
-void CoreListener::onMessageReceived (const std::shared_ptr &core,const std::shared_ptr &room,const std::shared_ptr &message){
- emit messageReceived (core,room,message);
+void CoreListener::onMessageReceived(const std::shared_ptr &core,
+ const std::shared_ptr &room,
+ const std::shared_ptr &message) {
+ emit messageReceived(core, room, message);
}
-void CoreListener::onMessagesReceived (const std::shared_ptr &core,const std::shared_ptr &room,const std::list> &messages){
- emit messagesReceived (core,room,messages);
+void CoreListener::onMessagesReceived(const std::shared_ptr &core,
+ const std::shared_ptr &room,
+ const std::list> &messages) {
+ emit messagesReceived(core, room, messages);
}
-void CoreListener::onNewMessageReaction(const std::shared_ptr & core, const std::shared_ptr & chatRoom, const std::shared_ptr & message, const std::shared_ptr & reaction){
- emit newMessageReaction (core,chatRoom,message, reaction);
+void CoreListener::onNewMessageReaction(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom,
+ const std::shared_ptr &message,
+ const std::shared_ptr &reaction) {
+ emit newMessageReaction(core, chatRoom, message, reaction);
}
-void CoreListener::onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr &core,const std::shared_ptr &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr &presenceModel){
- emit notifyPresenceReceivedForUriOrTel (core,linphoneFriend,uriOrTel,presenceModel);
+void CoreListener::onNotifyPresenceReceivedForUriOrTel(
+ const std::shared_ptr &core,
+ const std::shared_ptr &linphoneFriend,
+ const std::string &uriOrTel,
+ const std::shared_ptr &presenceModel) {
+ emit notifyPresenceReceivedForUriOrTel(core, linphoneFriend, uriOrTel, presenceModel);
}
-void CoreListener::onNotifyPresenceReceived (const std::shared_ptr &core,const std::shared_ptr &linphoneFriend){
- emit notifyPresenceReceived (core,linphoneFriend);
+void CoreListener::onNotifyPresenceReceived(const std::shared_ptr &core,
+ const std::shared_ptr &linphoneFriend) {
+ emit notifyPresenceReceived(core, linphoneFriend);
}
-void CoreListener::onQrcodeFound(const std::shared_ptr & core, const std::string & result){
+void CoreListener::onQrcodeFound(const std::shared_ptr &core, const std::string &result) {
emit qrcodeFound(core, result);
}
-void CoreListener::onReactionRemoved(const std::shared_ptr & core, const std::shared_ptr & chatRoom, const std::shared_ptr & message, const std::shared_ptr & address) {
+void CoreListener::onReactionRemoved(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom,
+ const std::shared_ptr &message,
+ const std::shared_ptr &address) {
emit reactionRemoved(core, chatRoom, message, address);
}
-void CoreListener::onTransferStateChanged (const std::shared_ptr &core,const std::shared_ptr &call,linphone::Call::State state){
- emit transferStateChanged (core,call,state);
+void CoreListener::onTransferStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ linphone::Call::State state) {
+ emit transferStateChanged(core, call, state);
}
-void CoreListener::onVersionUpdateCheckResultReceived (const std::shared_ptr & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url){
- emit versionUpdateCheckResultReceived (core,result,version,url);
+void CoreListener::onVersionUpdateCheckResultReceived(const std::shared_ptr &core,
+ linphone::VersionUpdateCheckResult result,
+ const std::string &version,
+ const std::string &url) {
+ emit versionUpdateCheckResultReceived(core, result, version, url);
}
diff --git a/Linphone/model/core/CoreListener.hpp b/Linphone/model/core/CoreListener.hpp
index a156b9245..4a6aaf883 100644
--- a/Linphone/model/core/CoreListener.hpp
+++ b/Linphone/model/core/CoreListener.hpp
@@ -21,71 +21,167 @@
#ifndef CORE_LISTENER_H_
#define CORE_LISTENER_H_
-#include
#include
+#include
// =============================================================================
class CoreListener : public QObject, public linphone::CoreListener {
Q_OBJECT
public:
- CoreListener (QObject * parent = nullptr);
- virtual ~CoreListener ();
+ CoreListener(QObject *parent = nullptr);
+ virtual ~CoreListener();
+
+ virtual void onAccountRegistrationStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &account,
+ linphone::RegistrationState state,
+ const std::string &message) override;
+ virtual void onAuthenticationRequested(const std::shared_ptr &core,
+ const std::shared_ptr &authInfo,
+ linphone::AuthMethod method) override;
+ virtual void onCallEncryptionChanged(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ bool on,
+ const std::string &authenticationToken) override;
+ virtual void onCallLogUpdated(const std::shared_ptr &core,
+ const std::shared_ptr &callLog) override;
+ virtual void onCallStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ linphone::Call::State state,
+ const std::string &message) override;
+ virtual void onCallStatsUpdated(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ const std::shared_ptr &stats) override;
+ virtual void onCallCreated(const std::shared_ptr &lc,
+ const std::shared_ptr &call) override;
+ virtual void onChatRoomRead(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom) override;
+ virtual void onChatRoomStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom,
+ linphone::ChatRoom::State state) override;
+ virtual void
+ onConferenceInfoReceived(const std::shared_ptr &core,
+ const std::shared_ptr &conferenceInfo) override;
+ virtual void onConfiguringStatus(const std::shared_ptr &core,
+ linphone::Config::ConfiguringState status,
+ const std::string &message) override;
+ virtual void onDtmfReceived(const std::shared_ptr &lc,
+ const std::shared_ptr &call,
+ int dtmf) override;
+ virtual void onEcCalibrationResult(const std::shared_ptr &core,
+ linphone::EcCalibratorStatus status,
+ int delayMs) override;
+ virtual void onGlobalStateChanged(const std::shared_ptr &core,
+ linphone::GlobalState gstate,
+ const std::string &message) override;
+ virtual void onIsComposingReceived(const std::shared_ptr &core,
+ const std::shared_ptr &room) override;
+ virtual void onLogCollectionUploadStateChanged(const std::shared_ptr &core,
+ linphone::Core::LogCollectionUploadState state,
+ const std::string &info) override;
+ virtual void onLogCollectionUploadProgressIndication(const std::shared_ptr &lc,
+ size_t offset,
+ size_t total) override;
+ virtual void onMessageReceived(const std::shared_ptr &core,
+ const std::shared_ptr &room,
+ const std::shared_ptr &message) override;
+ virtual void onMessagesReceived(const std::shared_ptr &core,
+ const std::shared_ptr &room,
+ const std::list> &messages) override;
+ virtual void onNewMessageReaction(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom,
+ const std::shared_ptr &message,
+ const std::shared_ptr &reaction) override;
+ virtual void
+ onNotifyPresenceReceivedForUriOrTel(const std::shared_ptr &core,
+ const std::shared_ptr &linphoneFriend,
+ const std::string &uriOrTel,
+ const std::shared_ptr &presenceModel) override;
+ virtual void onNotifyPresenceReceived(const std::shared_ptr &core,
+ const std::shared_ptr &linphoneFriend) override;
+ virtual void onQrcodeFound(const std::shared_ptr &core, const std::string &result) override;
+ virtual void onReactionRemoved(const std::shared_ptr &core,
+ const std::shared_ptr &chatRoom,
+ const std::shared_ptr &message,
+ const std::shared_ptr &address) override;
+ virtual void onTransferStateChanged(const std::shared_ptr &core,
+ const std::shared_ptr &call,
+ linphone::Call::State state) override;
+ virtual void onVersionUpdateCheckResultReceived(const std::shared_ptr &core,
+ linphone::VersionUpdateCheckResult result,
+ const std::string &version,
+ const std::string &url) override;
- virtual void onAccountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message) override;
- virtual void onAuthenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method) override;
- virtual void onCallEncryptionChanged (const std::shared_ptr &core,const std::shared_ptr &call,bool on,const std::string &authenticationToken) override;
- virtual void onCallLogUpdated(const std::shared_ptr & core, const std::shared_ptr & callLog) override;
- virtual void onCallStateChanged (const std::shared_ptr &core,const std::shared_ptr &call,linphone::Call::State state,const std::string &message) override;
- virtual void onCallStatsUpdated (const std::shared_ptr &core,const std::shared_ptr &call,const std::shared_ptr &stats) override;
- virtual void onCallCreated(const std::shared_ptr & lc,const std::shared_ptr & call) override;
- virtual void onChatRoomRead(const std::shared_ptr & core, const std::shared_ptr & chatRoom) override;
- virtual void onChatRoomStateChanged(const std::shared_ptr & core, const std::shared_ptr & chatRoom,linphone::ChatRoom::State state) override;
- virtual void onConferenceInfoReceived(const std::shared_ptr & core, const std::shared_ptr & conferenceInfo) override;
- virtual void onConfiguringStatus(const std::shared_ptr & core,linphone::Config::ConfiguringState status,const std::string & message) override;
- virtual void onDtmfReceived(const std::shared_ptr & lc,const std::shared_ptr & call,int dtmf) override;
- virtual void onEcCalibrationResult(const std::shared_ptr & core,linphone::EcCalibratorStatus status,int delayMs) override;
- virtual void onGlobalStateChanged (const std::shared_ptr &core,linphone::GlobalState gstate,const std::string &message) override;
- virtual void onIsComposingReceived (const std::shared_ptr &core,const std::shared_ptr &room) override;
- virtual void onLogCollectionUploadStateChanged (const std::shared_ptr &core,linphone::Core::LogCollectionUploadState state,const std::string &info) override;
- virtual void onLogCollectionUploadProgressIndication (const std::shared_ptr &lc,size_t offset,size_t total) override;
- virtual void onMessageReceived (const std::shared_ptr &core,const std::shared_ptr &room,const std::shared_ptr &message) override;
- virtual void onMessagesReceived (const std::shared_ptr &core,const std::shared_ptr &room,const std::list> &messages) override;
- virtual void onNewMessageReaction(const std::shared_ptr & core, const std::shared_ptr & chatRoom, const std::shared_ptr & message, const std::shared_ptr & reaction) override;
- virtual void onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr &core,const std::shared_ptr &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr &presenceModel) override;
- virtual void onNotifyPresenceReceived (const std::shared_ptr &core,const std::shared_ptr &linphoneFriend) override;
- virtual void onQrcodeFound(const std::shared_ptr & core, const std::string & result) override;
- virtual void onReactionRemoved(const std::shared_ptr & core, const std::shared_ptr & chatRoom, const std::shared_ptr & message, const std::shared_ptr & address) override;
- virtual void onTransferStateChanged (const std::shared_ptr &core,const std::shared_ptr &call,linphone::Call::State state) override;
- virtual void onVersionUpdateCheckResultReceived (const std::shared_ptr & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url) override;
-
signals:
- void accountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message);
- void authenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method);
- void callEncryptionChanged (const std::shared_ptr &core,const std::shared_ptr &call,bool on,const std::string &authenticationToken);
- void callLogUpdated(const std::shared_ptr & core, const std::shared_ptr & callLog);
- void callStateChanged (const std::shared_ptr &core,const std::shared_ptr &call,linphone::Call::State state,const std::string &message);
- void callStatsUpdated (const std::shared_ptr &core,const std::shared_ptr &call,const std::shared_ptr &stats);
- void callCreated(const std::shared_ptr & lc,const std::shared_ptr & call);
- void chatRoomRead(const std::shared_ptr & core, const std::shared_ptr & chatRoom);
- void chatRoomStateChanged(const std::shared_ptr & core, const std::shared_ptr & chatRoom,linphone::ChatRoom::State state);
- void conferenceInfoReceived(const std::shared_ptr & core, const std::shared_ptr & conferenceInfo);
- void configuringStatus(const std::shared_ptr & core,linphone::Config::ConfiguringState status,const std::string & message);
- void dtmfReceived(const std::shared_ptr & lc,const std::shared_ptr & call,int dtmf);
- void ecCalibrationResult(const std::shared_ptr & core,linphone::EcCalibratorStatus status,int delayMs);
- void globalStateChanged (const std::shared_ptr &core,linphone::GlobalState gstate,const std::string &message);
- void isComposingReceived (const std::shared_ptr &core,const std::shared_ptr