mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
Add clang-format and active utils string conversion.
This commit is contained in:
parent
23c0b9bd42
commit
52b1ce5ecf
23 changed files with 1385 additions and 1131 deletions
31
.clang-format
Normal file
31
.clang-format
Normal file
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
---
|
||||||
|
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
|
||||||
|
...
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -4,9 +4,6 @@
|
||||||
.*
|
.*
|
||||||
\#*\#
|
\#*\#
|
||||||
.#.*
|
.#.*
|
||||||
!.gitignore
|
|
||||||
!.gitlab-ci*
|
|
||||||
!.gitmodules
|
|
||||||
# Project configuration --------------------------------------------------------
|
# Project configuration --------------------------------------------------------
|
||||||
|
|
||||||
*.pro.user
|
*.pro.user
|
||||||
|
|
@ -44,3 +41,10 @@ rpm-*/
|
||||||
|
|
||||||
vgcore.*
|
vgcore.*
|
||||||
linphone.spec
|
linphone.spec
|
||||||
|
|
||||||
|
# Exceptions -------------------------------------------------------------------
|
||||||
|
|
||||||
|
!.clang-format
|
||||||
|
!.gitignore
|
||||||
|
!.gitlab-ci*
|
||||||
|
!.gitmodules
|
||||||
|
|
@ -251,3 +251,4 @@ else()
|
||||||
include(cmake/TasksMacos.cmake)
|
include(cmake/TasksMacos.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/hook/pre-commit" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/")
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
#include "tool/Constants.hpp"
|
#include "tool/Constants.hpp"
|
||||||
#include "view/Page/LoginPage.hpp"
|
#include "view/Page/LoginPage.hpp"
|
||||||
|
|
||||||
|
App::App(QObject *parent) : QObject(parent) {
|
||||||
App::App(QObject * parent) : QObject(parent) {
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,26 +14,27 @@ App::App(QObject * parent) : QObject(parent) {
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
void App::init() {
|
void App::init() {
|
||||||
// Core
|
// Core
|
||||||
mCoreModel = QSharedPointer<CoreModel>::create("", this);
|
mCoreModel = QSharedPointer<CoreModel>::create("", this);
|
||||||
mCoreModel->start();
|
mCoreModel->start();
|
||||||
// QML
|
// QML
|
||||||
mEngine = new QQmlApplicationEngine(this);
|
mEngine = new QQmlApplicationEngine(this);
|
||||||
mEngine->addImportPath(":/");
|
mEngine->addImportPath(":/");
|
||||||
|
|
||||||
initCppInterfaces();
|
initCppInterfaces();
|
||||||
|
|
||||||
const QUrl url(u"qrc:/Linphone/view/App/Main.qml"_qs);
|
const QUrl url(u"qrc:/Linphone/view/App/Main.qml"_qs);
|
||||||
QObject::connect(mEngine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(
|
||||||
this, [url](QObject *obj, const QUrl &objUrl) {
|
mEngine, &QQmlApplicationEngine::objectCreated, this,
|
||||||
if (!obj && url == objUrl)
|
[url](QObject *obj, const QUrl &objUrl) {
|
||||||
QCoreApplication::exit(-1);
|
if (!obj && url == objUrl) QCoreApplication::exit(-1);
|
||||||
}, Qt::QueuedConnection);
|
},
|
||||||
|
Qt::QueuedConnection);
|
||||||
mEngine->load(url);
|
mEngine->load(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::initCppInterfaces() {
|
void App::initCppInterfaces() {
|
||||||
qmlRegisterSingletonType<LoginPage>(Constants::MainQmlUri, 1, 0, "LoginPageCpp", [](QQmlEngine *engine, QJSEngine *) -> QObject *{
|
qmlRegisterSingletonType<LoginPage>(
|
||||||
return new LoginPage(engine);
|
Constants::MainQmlUri, 1, 0, "LoginPageCpp",
|
||||||
});
|
[](QQmlEngine *engine, QJSEngine *) -> QObject * { return new LoginPage(engine); });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
|
||||||
#include "model/core/CoreModel.hpp"
|
#include "model/core/CoreModel.hpp"
|
||||||
|
|
||||||
class App : public QObject{
|
class App : public QObject {
|
||||||
public:
|
public:
|
||||||
App(QObject * parent = nullptr);
|
App(QObject *parent = nullptr);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void initCppInterfaces();
|
void initCppInterfaces();
|
||||||
|
|
||||||
QQmlApplicationEngine * mEngine = nullptr;
|
QQmlApplicationEngine *mEngine = nullptr;
|
||||||
QSharedPointer<CoreModel> mCoreModel;
|
QSharedPointer<CoreModel> mCoreModel;
|
||||||
};
|
};
|
||||||
|
|
@ -31,50 +31,49 @@
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
static inline bool dirPathExists (const QString &path) {
|
static inline bool dirPathExists(const QString &path) {
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
return dir.exists();
|
return dir.exists();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
static inline bool filePathExists (const QString &path, const bool& isWritable) {
|
static inline bool filePathExists (const QString &path, const bool& isWritable) {
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
if (!dirPathExists(info.path()))
|
if (!dirPathExists(info.path()))
|
||||||
return false;
|
return false;
|
||||||
if( isWritable && !info.isWritable())
|
if( isWritable && !info.isWritable())
|
||||||
return false;
|
return false;
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
return file.exists();
|
return file.exists();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
static inline void ensureDirPathExists (const QString &path) {
|
static inline void ensureDirPathExists(const QString &path) {
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
if (!dir.exists() && !dir.mkpath(path))
|
if (!dir.exists() && !dir.mkpath(path)) qFatal("Unable to access at directory: `%s`", path.toStdString().c_str());
|
||||||
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);
|
QFileInfo info(path);
|
||||||
ensureDirPathExists(info.path());
|
ensureDirPathExists(info.path());
|
||||||
|
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (!file.exists() && !file.open(QIODevice::ReadWrite))
|
if (!file.exists() && !file.open(QIODevice::ReadWrite))
|
||||||
qFatal("Unable to access at path: `%s`", path.toStdString().c_str());
|
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);
|
return QDir::toNativeSeparators(dirname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getWritableDirPath (const QString &dirname) {
|
static inline QString getWritableDirPath(const QString &dirname) {
|
||||||
ensureDirPathExists(dirname);
|
ensureDirPathExists(dirname);
|
||||||
return getReadableDirPath(dirname);
|
return getReadableDirPath(dirname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getReadableFilePath (const QString &filename) {
|
static inline QString getReadableFilePath(const QString &filename) {
|
||||||
return QDir::toNativeSeparators(filename);
|
return QDir::toNativeSeparators(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getWritableFilePath (const QString &filename) {
|
static inline QString getWritableFilePath(const QString &filename) {
|
||||||
ensureFilePathExists(filename);
|
ensureFilePathExists(filename);
|
||||||
return getReadableFilePath(filename);
|
return getReadableFilePath(filename);
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +86,6 @@ static inline QString getWritableFilePath (const QString &filename) {
|
||||||
// plugins/
|
// plugins/
|
||||||
// share/
|
// share/
|
||||||
|
|
||||||
|
|
||||||
// But in some cases, it can be :
|
// But in some cases, it can be :
|
||||||
// /linphone
|
// /linphone
|
||||||
// lib/
|
// lib/
|
||||||
|
|
@ -102,14 +100,15 @@ static inline QString getWritableFilePath (const QString &filename) {
|
||||||
// Resources/
|
// Resources/
|
||||||
// share/
|
// share/
|
||||||
|
|
||||||
static inline QDir getAppPackageDir () {
|
static inline QDir getAppPackageDir() {
|
||||||
QDir dir(QCoreApplication::applicationDirPath());
|
QDir dir(QCoreApplication::applicationDirPath());
|
||||||
if (dir.dirName() == QLatin1String("MacOS")) {
|
if (dir.dirName() == QLatin1String("MacOS")) {
|
||||||
dir.cdUp();
|
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();
|
dir.cdUp();
|
||||||
if(!dir.exists("lib") && !dir.exists("lib64") && !dir.exists("plugins"))
|
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.";
|
qWarning() << "The application's location is not correct: You have to put your 'bin/' folder next to "
|
||||||
|
"'lib/' or 'plugins/' folder.";
|
||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
@ -117,175 +116,177 @@ static inline QDir getAppPackageDir () {
|
||||||
static inline QString getAppPackageDataDirPath() {
|
static inline QString getAppPackageDataDirPath() {
|
||||||
QDir dir = getAppPackageDir();
|
QDir dir = getAppPackageDir();
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (!dir.cd("Resources"))
|
if (!dir.cd("Resources")) {
|
||||||
{
|
|
||||||
dir.mkdir("Resources");
|
dir.mkdir("Resources");
|
||||||
dir.cd("Resources");
|
dir.cd("Resources");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!dir.cd("share"))
|
if (!dir.cd("share")) {
|
||||||
{
|
|
||||||
dir.mkdir("share");
|
dir.mkdir("share");
|
||||||
dir.cd("share");
|
dir.cd("share");
|
||||||
}
|
}
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppPackageMsPluginsDirPath () {
|
static inline QString getAppPackageMsPluginsDirPath() {
|
||||||
QDir dir = getAppPackageDir();
|
QDir dir = getAppPackageDir();
|
||||||
dir.cd(MSPLUGINS_DIR);
|
dir.cd(MSPLUGINS_DIR);
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppPackagePluginsDirPath () {
|
static inline QString getAppPackagePluginsDirPath() {
|
||||||
return getAppPackageDir().absolutePath() + Constants::PathPlugins;
|
return getAppPackageDir().absolutePath() + Constants::PathPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppAssistantConfigDirPath () {
|
static inline QString getAppAssistantConfigDirPath() {
|
||||||
return getAppPackageDataDirPath() + Constants::PathAssistantConfig;
|
return getAppPackageDataDirPath() + Constants::PathAssistantConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppConfigFilePath () {
|
static inline QString getAppConfigFilePath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + Constants::PathConfig;
|
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + Constants::PathConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppCallHistoryFilePath () {
|
static inline QString getAppCallHistoryFilePath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathCallHistoryList;
|
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathCallHistoryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppFactoryConfigFilePath () {
|
static inline QString getAppFactoryConfigFilePath() {
|
||||||
return getAppPackageDataDirPath() + Constants::PathFactoryConfig;
|
return getAppPackageDataDirPath() + Constants::PathFactoryConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppRootCaFilePath () {
|
static inline QString getAppRootCaFilePath() {
|
||||||
QString rootca = getAppPackageDataDirPath() + Constants::PathRootCa;
|
QString rootca = getAppPackageDataDirPath() + Constants::PathRootCa;
|
||||||
if(Paths::filePathExists(rootca)){// Packaged
|
if (Paths::filePathExists(rootca)) { // Packaged
|
||||||
return rootca;
|
return rootca;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppFriendsFilePath () {
|
static inline QString getAppFriendsFilePath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathFriendsList;
|
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathFriendsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppMessageHistoryFilePath () {
|
static inline QString getAppMessageHistoryFilePath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathMessageHistoryList;
|
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathMessageHistoryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString getAppPluginsDirPath () {
|
static inline QString getAppPluginsDirPath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+ Constants::PathPlugins;
|
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);
|
QFileInfo info(path);
|
||||||
if (!dirPathExists(info.path()))
|
if (!dirPathExists(info.path())) return false;
|
||||||
return false;
|
if (isWritable && !info.isWritable()) return false;
|
||||||
if( isWritable && !info.isWritable())
|
|
||||||
return false;
|
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
return file.exists();
|
return file.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
QString Paths::getAppLocalDirPath () {
|
QString Paths::getAppLocalDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +"/");
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getAssistantConfigDirPath () {
|
QString Paths::getAssistantConfigDirPath() {
|
||||||
return getReadableDirPath(getAppAssistantConfigDirPath());
|
return getReadableDirPath(getAppAssistantConfigDirPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getAvatarsDirPath () {
|
QString Paths::getAvatarsDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathAvatars);
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
|
||||||
|
Constants::PathAvatars);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getCallHistoryFilePath () {
|
QString Paths::getCallHistoryFilePath() {
|
||||||
return getWritableFilePath(getAppCallHistoryFilePath());
|
return getWritableFilePath(getAppCallHistoryFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getCapturesDirPath () {
|
QString Paths::getCapturesDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + Constants::PathCaptures);
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) +
|
||||||
|
Constants::PathCaptures);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getCodecsDirPath () {
|
QString Paths::getCodecsDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathCodecs);
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
|
||||||
|
Constants::PathCodecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getConfigDirPath (bool writable) {
|
QString Paths::getConfigDirPath(bool writable) {
|
||||||
return writable ? getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)+QDir::separator()) : getReadableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)+QDir::separator());
|
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;
|
QString path;
|
||||||
if( !configPath.isEmpty()){
|
if (!configPath.isEmpty()) {
|
||||||
QFileInfo file(configPath);
|
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);
|
QString defaultConfigPath = getConfigDirPath(false);
|
||||||
file = QFileInfo(defaultConfigPath+QDir::separator()+configPath);
|
file = QFileInfo(defaultConfigPath + QDir::separator() + configPath);
|
||||||
if( !file.exists() || !file.isFile())
|
if (!file.exists() || !file.isFile()) path = "";
|
||||||
path = "";
|
else path = file.absoluteFilePath();
|
||||||
else
|
} else path = file.absoluteFilePath();
|
||||||
path = file.absoluteFilePath();
|
} else path = getAppConfigFilePath();
|
||||||
}else
|
|
||||||
path = file.absoluteFilePath();
|
|
||||||
}else
|
|
||||||
path = getAppConfigFilePath();
|
|
||||||
return writable ? getWritableFilePath(path) : getReadableFilePath(path);
|
return writable ? getWritableFilePath(path) : getReadableFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getDatabaseFilePath (){
|
QString Paths::getDatabaseFilePath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) + Constants::PathDatabase;
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) +
|
||||||
|
Constants::PathDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getFactoryConfigFilePath () {
|
QString Paths::getFactoryConfigFilePath() {
|
||||||
return getReadableFilePath(getAppFactoryConfigFilePath());
|
return getReadableFilePath(getAppFactoryConfigFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getFriendsListFilePath () {
|
QString Paths::getFriendsListFilePath() {
|
||||||
return getWritableFilePath(getAppFriendsFilePath());
|
return getWritableFilePath(getAppFriendsFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getDownloadDirPath () {
|
QString Paths::getDownloadDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QDir::separator());
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QDir::separator());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getLimeDatabasePath (){
|
QString Paths::getLimeDatabasePath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) + Constants::PathLimeDatabase;
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) +
|
||||||
|
Constants::PathLimeDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getLogsDirPath () {
|
QString Paths::getLogsDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathLogs);
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
|
||||||
|
Constants::PathLogs);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getMessageHistoryFilePath () {
|
QString Paths::getMessageHistoryFilePath() {
|
||||||
return getReadableFilePath(getAppMessageHistoryFilePath());// No need to ensure that the file exists as this DB is deprecated
|
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);
|
return getReadableDirPath(getAppPackageDataDirPath() + Constants::PathData);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getPackageMsPluginsDirPath () {
|
QString Paths::getPackageMsPluginsDirPath() {
|
||||||
return getReadableDirPath(getAppPackageMsPluginsDirPath());
|
return getReadableDirPath(getAppPackageMsPluginsDirPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getPackagePluginsAppDirPath () {
|
QString Paths::getPackagePluginsAppDirPath() {
|
||||||
return getReadableDirPath(getAppPackagePluginsDirPath() + Constants::PathPluginsApp);
|
return getReadableDirPath(getAppPackagePluginsDirPath() + Constants::PathPluginsApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getPackageSoundsResourcesDirPath (){
|
QString Paths::getPackageSoundsResourcesDirPath() {
|
||||||
return getReadableDirPath(getAppPackageDataDirPath() + Constants::PathSounds);
|
return getReadableDirPath(getAppPackageDataDirPath() + Constants::PathSounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getPackageTopDirPath (){
|
QString Paths::getPackageTopDirPath() {
|
||||||
return getReadableDirPath(getAppPackageDataDirPath());
|
return getReadableDirPath(getAppPackageDataDirPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getPluginsAppDirPath () {
|
QString Paths::getPluginsAppDirPath() {
|
||||||
return getWritableDirPath(getAppPluginsDirPath() + Constants::PathPluginsApp);
|
return getWritableDirPath(getAppPluginsDirPath() + Constants::PathPluginsApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,22 +297,25 @@ QStringList Paths::getPluginsAppFolders() {
|
||||||
return pluginPaths;
|
return pluginPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getRootCaFilePath () {
|
QString Paths::getRootCaFilePath() {
|
||||||
return getReadableFilePath(getAppRootCaFilePath());
|
return getReadableFilePath(getAppRootCaFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getToolsDirPath () {
|
QString Paths::getToolsDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathTools);
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
|
||||||
|
Constants::PathTools);
|
||||||
}
|
}
|
||||||
QString Paths::getUserCertificatesDirPath () {
|
QString Paths::getUserCertificatesDirPath() {
|
||||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathUserCertificates);
|
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
|
||||||
|
Constants::PathUserCertificates);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::getZrtpSecretsFilePath () {
|
QString Paths::getZrtpSecretsFilePath() {
|
||||||
return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathZrtpSecrets);
|
return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) +
|
||||||
|
Constants::PathZrtpSecrets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Paths::migrate () {
|
void Paths::migrate() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,37 +26,37 @@
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
namespace Paths {
|
namespace Paths {
|
||||||
bool filePathExists (const QString &path, const bool isWritable = false);
|
bool filePathExists(const QString &path, const bool isWritable = false);
|
||||||
|
|
||||||
QString getAppLocalDirPath ();
|
QString getAppLocalDirPath();
|
||||||
QString getAssistantConfigDirPath ();
|
QString getAssistantConfigDirPath();
|
||||||
QString getAvatarsDirPath ();
|
QString getAvatarsDirPath();
|
||||||
QString getCallHistoryFilePath ();
|
QString getCallHistoryFilePath();
|
||||||
QString getCapturesDirPath ();
|
QString getCapturesDirPath();
|
||||||
QString getCodecsDirPath ();
|
QString getCodecsDirPath();
|
||||||
QString getConfigDirPath (bool writable = true);
|
QString getConfigDirPath(bool writable = true);
|
||||||
QString getConfigFilePath (const QString &configPath = QString(), bool writable = true);
|
QString getConfigFilePath(const QString &configPath = QString(), bool writable = true);
|
||||||
QString getDatabaseFilePath ();
|
QString getDatabaseFilePath();
|
||||||
QString getDownloadDirPath ();
|
QString getDownloadDirPath();
|
||||||
QString getFactoryConfigFilePath ();
|
QString getFactoryConfigFilePath();
|
||||||
QString getFriendsListFilePath ();
|
QString getFriendsListFilePath();
|
||||||
QString getLimeDatabasePath ();
|
QString getLimeDatabasePath();
|
||||||
QString getLogsDirPath ();
|
QString getLogsDirPath();
|
||||||
QString getMessageHistoryFilePath ();
|
QString getMessageHistoryFilePath();
|
||||||
QString getPackageDataDirPath ();
|
QString getPackageDataDirPath();
|
||||||
QString getPackageMsPluginsDirPath ();
|
QString getPackageMsPluginsDirPath();
|
||||||
QString getPackagePluginsAppDirPath ();
|
QString getPackagePluginsAppDirPath();
|
||||||
QString getPackageSoundsResourcesDirPath ();
|
QString getPackageSoundsResourcesDirPath();
|
||||||
QString getPackageTopDirPath ();
|
QString getPackageTopDirPath();
|
||||||
QString getPluginsAppDirPath ();
|
QString getPluginsAppDirPath();
|
||||||
QStringList getPluginsAppFolders();
|
QStringList getPluginsAppFolders();
|
||||||
QString getRootCaFilePath ();
|
QString getRootCaFilePath();
|
||||||
QString getToolsDirPath ();
|
QString getToolsDirPath();
|
||||||
QString getUserCertificatesDirPath ();
|
QString getUserCertificatesDirPath();
|
||||||
QString getZrtpDataFilePath ();
|
QString getZrtpDataFilePath();
|
||||||
QString getZrtpSecretsFilePath ();
|
QString getZrtpSecretsFilePath();
|
||||||
|
|
||||||
void migrate ();
|
void migrate();
|
||||||
}
|
} // namespace Paths
|
||||||
|
|
||||||
#endif // PATHS_H_
|
#endif // PATHS_H_
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,15 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Settings.hpp"
|
#include "Settings.hpp"
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "core/path/Paths.hpp"
|
#include "core/path/Paths.hpp"
|
||||||
|
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
Settings::Settings (QObject *parent) : QObject(parent) {
|
Settings::Settings(QObject *parent) : QObject(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::~Settings() {
|
Settings::~Settings() {
|
||||||
|
|
@ -37,12 +35,11 @@ Settings::~Settings() {
|
||||||
QString Settings::getConfigPath(const QCommandLineParser &parser) {
|
QString Settings::getConfigPath(const QCommandLineParser &parser) {
|
||||||
QString filePath = parser.isSet("config") ? parser.value("config") : "";
|
QString filePath = parser.isSet("config") ? parser.value("config") : "";
|
||||||
QString configPath;
|
QString configPath;
|
||||||
if(!QUrl(filePath).isRelative()){
|
if (!QUrl(filePath).isRelative()) {
|
||||||
//configPath = FileDownloader::synchronousDownload(filePath, Utils::coreStringToAppString(Paths::getConfigDirPath(false)), true));
|
// configPath = FileDownloader::synchronousDownload(filePath,
|
||||||
|
// Utils::coreStringToAppString(Paths::getConfigDirPath(false)), true));
|
||||||
}
|
}
|
||||||
if( configPath == "")
|
if (configPath == "") configPath = Paths::getConfigFilePath(filePath, false);
|
||||||
configPath = Paths::getConfigFilePath(filePath, false);
|
if (configPath == "") configPath = Paths::getConfigFilePath("", false);
|
||||||
if( configPath == "" )
|
|
||||||
configPath = Paths::getConfigFilePath("", false);
|
|
||||||
return configPath;
|
return configPath;
|
||||||
}
|
}
|
||||||
|
|
@ -21,17 +21,16 @@
|
||||||
#ifndef SETTINGS_H_
|
#ifndef SETTINGS_H_
|
||||||
#define SETTINGS_H_
|
#define SETTINGS_H_
|
||||||
|
|
||||||
|
#include <QCommandLineParser>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QCommandLineParser>
|
|
||||||
|
|
||||||
|
|
||||||
class Settings : public QObject {
|
class Settings : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Settings (QObject *parent = Q_NULLPTR);
|
Settings(QObject *parent = Q_NULLPTR);
|
||||||
virtual ~Settings ();
|
virtual ~Settings();
|
||||||
|
|
||||||
QString getConfigPath(const QCommandLineParser &parser = QCommandLineParser());
|
QString getConfigPath(const QCommandLineParser &parser = QCommandLineParser());
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
||||||
for (const QString &locale : uiLanguages) {
|
for (const QString &locale : uiLanguages) {
|
||||||
|
|
|
||||||
|
|
@ -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<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message){
|
void CoreListener::onAccountRegistrationStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit accountRegistrationStateChanged(core,account,state,message);
|
const std::shared_ptr<linphone::Account> &account,
|
||||||
|
linphone::RegistrationState state,
|
||||||
|
const std::string &message) {
|
||||||
|
emit accountRegistrationStateChanged(core, account, state, message);
|
||||||
}
|
}
|
||||||
void CoreListener::onAuthenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method){
|
void CoreListener::onAuthenticationRequested(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit authenticationRequested (core,authInfo,method);
|
const std::shared_ptr<linphone::AuthInfo> &authInfo,
|
||||||
|
linphone::AuthMethod method) {
|
||||||
|
emit authenticationRequested(core, authInfo, method);
|
||||||
}
|
}
|
||||||
void CoreListener::onCallEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken){
|
void CoreListener::onCallEncryptionChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit callEncryptionChanged (core,call,on,authenticationToken);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
bool on,
|
||||||
|
const std::string &authenticationToken) {
|
||||||
|
emit callEncryptionChanged(core, call, on, authenticationToken);
|
||||||
}
|
}
|
||||||
void CoreListener::onCallLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog){
|
void CoreListener::onCallLogUpdated(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::CallLog> &callLog) {
|
||||||
emit callLogUpdated(core, callLog);
|
emit callLogUpdated(core, callLog);
|
||||||
}
|
}
|
||||||
void CoreListener::onCallStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message){
|
void CoreListener::onCallStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit callStateChanged (core,call,state,message);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
linphone::Call::State state,
|
||||||
|
const std::string &message) {
|
||||||
|
emit callStateChanged(core, call, state, message);
|
||||||
}
|
}
|
||||||
void CoreListener::onCallStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats){
|
void CoreListener::onCallStatsUpdated(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit callStatsUpdated (core,call,stats);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
const std::shared_ptr<const linphone::CallStats> &stats) {
|
||||||
|
emit callStatsUpdated(core, call, stats);
|
||||||
}
|
}
|
||||||
void CoreListener::onCallCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call){
|
void CoreListener::onCallCreated(const std::shared_ptr<linphone::Core> &lc,
|
||||||
emit callCreated(lc,call);
|
const std::shared_ptr<linphone::Call> &call) {
|
||||||
|
emit callCreated(lc, call);
|
||||||
}
|
}
|
||||||
void CoreListener::onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom){
|
void CoreListener::onChatRoomRead(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom) {
|
||||||
emit chatRoomRead(core, chatRoom);
|
emit chatRoomRead(core, chatRoom);
|
||||||
}
|
}
|
||||||
void CoreListener::onChatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state){
|
void CoreListener::onChatRoomStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit chatRoomStateChanged(core, chatRoom,state);
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
linphone::ChatRoom::State state) {
|
||||||
|
emit chatRoomStateChanged(core, chatRoom, state);
|
||||||
}
|
}
|
||||||
void CoreListener::onConferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo){
|
void CoreListener::onConferenceInfoReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<const linphone::ConferenceInfo> &conferenceInfo) {
|
||||||
emit conferenceInfoReceived(core, conferenceInfo);
|
emit conferenceInfoReceived(core, conferenceInfo);
|
||||||
}
|
}
|
||||||
void CoreListener::onConfiguringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message){
|
void CoreListener::onConfiguringStatus(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit configuringStatus(core,status,message);
|
linphone::Config::ConfiguringState status,
|
||||||
|
const std::string &message) {
|
||||||
|
emit configuringStatus(core, status, message);
|
||||||
}
|
}
|
||||||
void CoreListener::onDtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf){
|
void CoreListener::onDtmfReceived(const std::shared_ptr<linphone::Core> &lc,
|
||||||
emit dtmfReceived(lc,call,dtmf);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
int dtmf) {
|
||||||
|
emit dtmfReceived(lc, call, dtmf);
|
||||||
}
|
}
|
||||||
void CoreListener::onEcCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs){
|
void CoreListener::onEcCalibrationResult(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit ecCalibrationResult(core,status,delayMs);
|
linphone::EcCalibratorStatus status,
|
||||||
|
int delayMs) {
|
||||||
|
emit ecCalibrationResult(core, status, delayMs);
|
||||||
}
|
}
|
||||||
void CoreListener::onGlobalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message){
|
void CoreListener::onGlobalStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit globalStateChanged (core,gstate,message);
|
linphone::GlobalState gstate,
|
||||||
|
const std::string &message) {
|
||||||
|
emit globalStateChanged(core, gstate, message);
|
||||||
}
|
}
|
||||||
void CoreListener::onIsComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room){
|
void CoreListener::onIsComposingReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit isComposingReceived (core,room);
|
const std::shared_ptr<linphone::ChatRoom> &room) {
|
||||||
|
emit isComposingReceived(core, room);
|
||||||
}
|
}
|
||||||
void CoreListener::onLogCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info){
|
void CoreListener::onLogCollectionUploadStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit logCollectionUploadStateChanged (core,state,info);
|
linphone::Core::LogCollectionUploadState state,
|
||||||
|
const std::string &info) {
|
||||||
|
emit logCollectionUploadStateChanged(core, state, info);
|
||||||
}
|
}
|
||||||
void CoreListener::onLogCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total){
|
void CoreListener::onLogCollectionUploadProgressIndication(const std::shared_ptr<linphone::Core> &lc,
|
||||||
emit logCollectionUploadProgressIndication (lc,offset,total);
|
size_t offset,
|
||||||
|
size_t total) {
|
||||||
|
emit logCollectionUploadProgressIndication(lc, offset, total);
|
||||||
}
|
}
|
||||||
void CoreListener::onMessageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message){
|
void CoreListener::onMessageReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit messageReceived (core,room,message);
|
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message) {
|
||||||
|
emit messageReceived(core, room, message);
|
||||||
}
|
}
|
||||||
void CoreListener::onMessagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages){
|
void CoreListener::onMessagesReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit messagesReceived (core,room,messages);
|
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||||
|
const std::list<std::shared_ptr<linphone::ChatMessage>> &messages) {
|
||||||
|
emit messagesReceived(core, room, messages);
|
||||||
}
|
}
|
||||||
void CoreListener::onNewMessageReaction(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ChatMessageReaction> & reaction){
|
void CoreListener::onNewMessageReaction(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit newMessageReaction (core,chatRoom,message, reaction);
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message,
|
||||||
|
const std::shared_ptr<const linphone::ChatMessageReaction> &reaction) {
|
||||||
|
emit newMessageReaction(core, chatRoom, message, reaction);
|
||||||
}
|
}
|
||||||
void CoreListener::onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel){
|
void CoreListener::onNotifyPresenceReceivedForUriOrTel(
|
||||||
emit notifyPresenceReceivedForUriOrTel (core,linphoneFriend,uriOrTel,presenceModel);
|
const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Friend> &linphoneFriend,
|
||||||
|
const std::string &uriOrTel,
|
||||||
|
const std::shared_ptr<const linphone::PresenceModel> &presenceModel) {
|
||||||
|
emit notifyPresenceReceivedForUriOrTel(core, linphoneFriend, uriOrTel, presenceModel);
|
||||||
}
|
}
|
||||||
void CoreListener::onNotifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend){
|
void CoreListener::onNotifyPresenceReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit notifyPresenceReceived (core,linphoneFriend);
|
const std::shared_ptr<linphone::Friend> &linphoneFriend) {
|
||||||
|
emit notifyPresenceReceived(core, linphoneFriend);
|
||||||
}
|
}
|
||||||
void CoreListener::onQrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result){
|
void CoreListener::onQrcodeFound(const std::shared_ptr<linphone::Core> &core, const std::string &result) {
|
||||||
emit qrcodeFound(core, result);
|
emit qrcodeFound(core, result);
|
||||||
}
|
}
|
||||||
void CoreListener::onReactionRemoved(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::Address> & address) {
|
void CoreListener::onReactionRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message,
|
||||||
|
const std::shared_ptr<const linphone::Address> &address) {
|
||||||
emit reactionRemoved(core, chatRoom, message, address);
|
emit reactionRemoved(core, chatRoom, message, address);
|
||||||
}
|
}
|
||||||
void CoreListener::onTransferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state){
|
void CoreListener::onTransferStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit transferStateChanged (core,call,state);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
linphone::Call::State state) {
|
||||||
|
emit transferStateChanged(core, call, state);
|
||||||
}
|
}
|
||||||
void CoreListener::onVersionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url){
|
void CoreListener::onVersionUpdateCheckResultReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
emit versionUpdateCheckResultReceived (core,result,version,url);
|
linphone::VersionUpdateCheckResult result,
|
||||||
|
const std::string &version,
|
||||||
|
const std::string &url) {
|
||||||
|
emit versionUpdateCheckResultReceived(core, result, version, url);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,71 +21,167 @@
|
||||||
#ifndef CORE_LISTENER_H_
|
#ifndef CORE_LISTENER_H_
|
||||||
#define CORE_LISTENER_H_
|
#define CORE_LISTENER_H_
|
||||||
|
|
||||||
#include <linphone++/linphone.hh>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <linphone++/linphone.hh>
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
class CoreListener : public QObject, public linphone::CoreListener {
|
class CoreListener : public QObject, public linphone::CoreListener {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CoreListener (QObject * parent = nullptr);
|
CoreListener(QObject *parent = nullptr);
|
||||||
virtual ~CoreListener ();
|
virtual ~CoreListener();
|
||||||
|
|
||||||
|
virtual void onAccountRegistrationStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Account> &account,
|
||||||
|
linphone::RegistrationState state,
|
||||||
|
const std::string &message) override;
|
||||||
|
virtual void onAuthenticationRequested(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::AuthInfo> &authInfo,
|
||||||
|
linphone::AuthMethod method) override;
|
||||||
|
virtual void onCallEncryptionChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
bool on,
|
||||||
|
const std::string &authenticationToken) override;
|
||||||
|
virtual void onCallLogUpdated(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::CallLog> &callLog) override;
|
||||||
|
virtual void onCallStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
linphone::Call::State state,
|
||||||
|
const std::string &message) override;
|
||||||
|
virtual void onCallStatsUpdated(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
const std::shared_ptr<const linphone::CallStats> &stats) override;
|
||||||
|
virtual void onCallCreated(const std::shared_ptr<linphone::Core> &lc,
|
||||||
|
const std::shared_ptr<linphone::Call> &call) override;
|
||||||
|
virtual void onChatRoomRead(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom) override;
|
||||||
|
virtual void onChatRoomStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
linphone::ChatRoom::State state) override;
|
||||||
|
virtual void
|
||||||
|
onConferenceInfoReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<const linphone::ConferenceInfo> &conferenceInfo) override;
|
||||||
|
virtual void onConfiguringStatus(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::Config::ConfiguringState status,
|
||||||
|
const std::string &message) override;
|
||||||
|
virtual void onDtmfReceived(const std::shared_ptr<linphone::Core> &lc,
|
||||||
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
int dtmf) override;
|
||||||
|
virtual void onEcCalibrationResult(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::EcCalibratorStatus status,
|
||||||
|
int delayMs) override;
|
||||||
|
virtual void onGlobalStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::GlobalState gstate,
|
||||||
|
const std::string &message) override;
|
||||||
|
virtual void onIsComposingReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &room) override;
|
||||||
|
virtual void onLogCollectionUploadStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::Core::LogCollectionUploadState state,
|
||||||
|
const std::string &info) override;
|
||||||
|
virtual void onLogCollectionUploadProgressIndication(const std::shared_ptr<linphone::Core> &lc,
|
||||||
|
size_t offset,
|
||||||
|
size_t total) override;
|
||||||
|
virtual void onMessageReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message) override;
|
||||||
|
virtual void onMessagesReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||||
|
const std::list<std::shared_ptr<linphone::ChatMessage>> &messages) override;
|
||||||
|
virtual void onNewMessageReaction(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message,
|
||||||
|
const std::shared_ptr<const linphone::ChatMessageReaction> &reaction) override;
|
||||||
|
virtual void
|
||||||
|
onNotifyPresenceReceivedForUriOrTel(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Friend> &linphoneFriend,
|
||||||
|
const std::string &uriOrTel,
|
||||||
|
const std::shared_ptr<const linphone::PresenceModel> &presenceModel) override;
|
||||||
|
virtual void onNotifyPresenceReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Friend> &linphoneFriend) override;
|
||||||
|
virtual void onQrcodeFound(const std::shared_ptr<linphone::Core> &core, const std::string &result) override;
|
||||||
|
virtual void onReactionRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message,
|
||||||
|
const std::shared_ptr<const linphone::Address> &address) override;
|
||||||
|
virtual void onTransferStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
linphone::Call::State state) override;
|
||||||
|
virtual void onVersionUpdateCheckResultReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::VersionUpdateCheckResult result,
|
||||||
|
const std::string &version,
|
||||||
|
const std::string &url) override;
|
||||||
|
|
||||||
virtual void onAccountRegistrationStateChanged(const std::shared_ptr<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message) override;
|
|
||||||
virtual void onAuthenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method) override;
|
|
||||||
virtual void onCallEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken) override;
|
|
||||||
virtual void onCallLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog) override;
|
|
||||||
virtual void onCallStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message) override;
|
|
||||||
virtual void onCallStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats) override;
|
|
||||||
virtual void onCallCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call) override;
|
|
||||||
virtual void onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom) override;
|
|
||||||
virtual void onChatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state) override;
|
|
||||||
virtual void onConferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo) override;
|
|
||||||
virtual void onConfiguringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message) override;
|
|
||||||
virtual void onDtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf) override;
|
|
||||||
virtual void onEcCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs) override;
|
|
||||||
virtual void onGlobalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message) override;
|
|
||||||
virtual void onIsComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room) override;
|
|
||||||
virtual void onLogCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info) override;
|
|
||||||
virtual void onLogCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total) override;
|
|
||||||
virtual void onMessageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message) override;
|
|
||||||
virtual void onMessagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages) override;
|
|
||||||
virtual void onNewMessageReaction(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ChatMessageReaction> & reaction) override;
|
|
||||||
virtual void onNotifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel) override;
|
|
||||||
virtual void onNotifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend) override;
|
|
||||||
virtual void onQrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result) override;
|
|
||||||
virtual void onReactionRemoved(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::Address> & address) override;
|
|
||||||
virtual void onTransferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state) override;
|
|
||||||
virtual void onVersionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void accountRegistrationStateChanged(const std::shared_ptr<linphone::Core> & core,const std::shared_ptr<linphone::Account> & account,linphone::RegistrationState state,const std::string & message);
|
void accountRegistrationStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
void authenticationRequested (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::AuthInfo> &authInfo,linphone::AuthMethod method);
|
const std::shared_ptr<linphone::Account> &account,
|
||||||
void callEncryptionChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,bool on,const std::string &authenticationToken);
|
linphone::RegistrationState state,
|
||||||
void callLogUpdated(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::CallLog> & callLog);
|
const std::string &message);
|
||||||
void callStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state,const std::string &message);
|
void authenticationRequested(const std::shared_ptr<linphone::Core> &core,
|
||||||
void callStatsUpdated (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,const std::shared_ptr<const linphone::CallStats> &stats);
|
const std::shared_ptr<linphone::AuthInfo> &authInfo,
|
||||||
void callCreated(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call);
|
linphone::AuthMethod method);
|
||||||
void chatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom);
|
void callEncryptionChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
void chatRoomStateChanged(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom,linphone::ChatRoom::State state);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
void conferenceInfoReceived(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<const linphone::ConferenceInfo> & conferenceInfo);
|
bool on,
|
||||||
void configuringStatus(const std::shared_ptr<linphone::Core> & core,linphone::Config::ConfiguringState status,const std::string & message);
|
const std::string &authenticationToken);
|
||||||
void dtmfReceived(const std::shared_ptr<linphone::Core> & lc,const std::shared_ptr<linphone::Call> & call,int dtmf);
|
void callLogUpdated(const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::CallLog> &callLog);
|
||||||
void ecCalibrationResult(const std::shared_ptr<linphone::Core> & core,linphone::EcCalibratorStatus status,int delayMs);
|
void callStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
void globalStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::GlobalState gstate,const std::string &message);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
void isComposingReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room);
|
linphone::Call::State state,
|
||||||
void logCollectionUploadStateChanged (const std::shared_ptr<linphone::Core> &core,linphone::Core::LogCollectionUploadState state,const std::string &info);
|
const std::string &message);
|
||||||
void logCollectionUploadProgressIndication (const std::shared_ptr<linphone::Core> &lc,size_t offset,size_t total);
|
void callStatsUpdated(const std::shared_ptr<linphone::Core> &core,
|
||||||
void messageReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::shared_ptr<linphone::ChatMessage> &message);
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
void messagesReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::ChatRoom> &room,const std::list<std::shared_ptr<linphone::ChatMessage>> &messages);
|
const std::shared_ptr<const linphone::CallStats> &stats);
|
||||||
void newMessageReaction(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ChatMessageReaction> & reaction);
|
void callCreated(const std::shared_ptr<linphone::Core> &lc, const std::shared_ptr<linphone::Call> &call);
|
||||||
void notifyPresenceReceivedForUriOrTel (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend,const std::string &uriOrTel,const std::shared_ptr<const linphone::PresenceModel> &presenceModel);
|
void chatRoomRead(const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::ChatRoom> &chatRoom);
|
||||||
void notifyPresenceReceived (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Friend> &linphoneFriend);
|
void chatRoomStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
void qrcodeFound(const std::shared_ptr<linphone::Core> & core, const std::string & result);
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
void reactionRemoved(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::Address> & address);
|
linphone::ChatRoom::State state);
|
||||||
void transferStateChanged (const std::shared_ptr<linphone::Core> &core,const std::shared_ptr<linphone::Call> &call,linphone::Call::State state);
|
void conferenceInfoReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
void versionUpdateCheckResultReceived (const std::shared_ptr<linphone::Core> & core,linphone::VersionUpdateCheckResult result,const std::string &version,const std::string &url);
|
const std::shared_ptr<const linphone::ConferenceInfo> &conferenceInfo);
|
||||||
|
void configuringStatus(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::Config::ConfiguringState status,
|
||||||
|
const std::string &message);
|
||||||
|
void dtmfReceived(const std::shared_ptr<linphone::Core> &lc, const std::shared_ptr<linphone::Call> &call, int dtmf);
|
||||||
|
void
|
||||||
|
ecCalibrationResult(const std::shared_ptr<linphone::Core> &core, linphone::EcCalibratorStatus status, int delayMs);
|
||||||
|
void globalStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::GlobalState gstate,
|
||||||
|
const std::string &message);
|
||||||
|
void isComposingReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &room);
|
||||||
|
void logCollectionUploadStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::Core::LogCollectionUploadState state,
|
||||||
|
const std::string &info);
|
||||||
|
void logCollectionUploadProgressIndication(const std::shared_ptr<linphone::Core> &lc, size_t offset, size_t total);
|
||||||
|
void messageReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message);
|
||||||
|
void messagesReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &room,
|
||||||
|
const std::list<std::shared_ptr<linphone::ChatMessage>> &messages);
|
||||||
|
void newMessageReaction(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message,
|
||||||
|
const std::shared_ptr<const linphone::ChatMessageReaction> &reaction);
|
||||||
|
void notifyPresenceReceivedForUriOrTel(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Friend> &linphoneFriend,
|
||||||
|
const std::string &uriOrTel,
|
||||||
|
const std::shared_ptr<const linphone::PresenceModel> &presenceModel);
|
||||||
|
void notifyPresenceReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Friend> &linphoneFriend);
|
||||||
|
void qrcodeFound(const std::shared_ptr<linphone::Core> &core, const std::string &result);
|
||||||
|
void reactionRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
|
const std::shared_ptr<linphone::ChatMessage> &message,
|
||||||
|
const std::shared_ptr<const linphone::Address> &address);
|
||||||
|
void transferStateChanged(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
const std::shared_ptr<linphone::Call> &call,
|
||||||
|
linphone::Call::State state);
|
||||||
|
void versionUpdateCheckResultReceived(const std::shared_ptr<linphone::Core> &core,
|
||||||
|
linphone::VersionUpdateCheckResult result,
|
||||||
|
const std::string &version,
|
||||||
|
const std::string &url);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -22,25 +22,26 @@
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFile>
|
|
||||||
|
#include "tool/Utils.hpp"
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
CoreModel::CoreModel (const QString &configPath, QObject *parent) :
|
CoreModel::CoreModel(const QString &configPath, QObject *parent) : QThread(parent) {
|
||||||
QThread(parent) {
|
|
||||||
mConfigPath = configPath;
|
mConfigPath = configPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreModel::~CoreModel(){
|
CoreModel::~CoreModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreModel::run() {
|
void CoreModel::run() {
|
||||||
mCore = linphone::Factory::get()->createCore("","",nullptr);
|
mCore = linphone::Factory::get()->createCore(Utils::appStringToCoreString(mConfigPath), "", nullptr);
|
||||||
|
|
||||||
mCore->start();
|
mCore->start();
|
||||||
while(!mEnd){
|
while (!mEnd) {
|
||||||
mCore->iterate();
|
mCore->iterate();
|
||||||
}
|
}
|
||||||
mCore->stop();
|
mCore->stop();
|
||||||
|
|
@ -49,7 +50,6 @@ void CoreModel::run() {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
std::shared_ptr<linphone::Core> CoreModel::getCore () {
|
std::shared_ptr<linphone::Core> CoreModel::getCore() {
|
||||||
return mCore;
|
return mCore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,30 +21,29 @@
|
||||||
#ifndef CORE_MODEL_H_
|
#ifndef CORE_MODEL_H_
|
||||||
#define CORE_MODEL_H_
|
#define CORE_MODEL_H_
|
||||||
|
|
||||||
#include <linphone++/linphone.hh>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QString>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <linphone++/linphone.hh>
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
|
|
||||||
class CoreModel : public QThread {
|
class CoreModel : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CoreModel(const QString &configPath, QObject *parent);
|
CoreModel(const QString &configPath, QObject *parent);
|
||||||
~CoreModel();
|
~CoreModel();
|
||||||
|
|
||||||
std::shared_ptr<linphone::Core> getCore ();
|
std::shared_ptr<linphone::Core> getCore();
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
|
||||||
static CoreModel *getInstance ();
|
static CoreModel *getInstance();
|
||||||
|
|
||||||
bool mEnd = false;
|
bool mEnd = false;
|
||||||
QString mConfigPath;
|
QString mConfigPath;
|
||||||
|
|
||||||
std::shared_ptr<linphone::Core> mCore;
|
std::shared_ptr<linphone::Core> mCore;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,25 +18,22 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "SettingsModel.hpp"
|
#include "SettingsModel.hpp"
|
||||||
|
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
const std::string SettingsModel::UiSection("ui");
|
const std::string SettingsModel::UiSection("ui");
|
||||||
|
|
||||||
SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
|
SettingsModel::SettingsModel(QObject *parent) : QObject(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsModel::~SettingsModel() {
|
SettingsModel::~SettingsModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SettingsModel::isReadOnly(const std::string §ion, const std::string &name) const {
|
||||||
bool SettingsModel::isReadOnly(const std::string& section, const std::string& name) const {
|
return mConfig->hasEntry(section, name + "/readonly");
|
||||||
return mConfig->hasEntry(section, name+"/readonly");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SettingsModel::getEntryFullName(const std::string& section, const std::string& name) const {
|
std::string SettingsModel::getEntryFullName(const std::string §ion, const std::string &name) const {
|
||||||
return isReadOnly(section, name)?name+"/readonly" : name;
|
return isReadOnly(section, name) ? name + "/readonly" : name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,23 +21,24 @@
|
||||||
#ifndef SETTINGS_MODEL_H_
|
#ifndef SETTINGS_MODEL_H_
|
||||||
#define SETTINGS_MODEL_H_
|
#define SETTINGS_MODEL_H_
|
||||||
|
|
||||||
#include <linphone++/linphone.hh>
|
#include <QFont>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QFont>
|
#include <linphone++/linphone.hh>
|
||||||
|
|
||||||
|
|
||||||
class SettingsModel : public QObject {
|
class SettingsModel : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SettingsModel (QObject *parent = Q_NULLPTR);
|
SettingsModel(QObject *parent = Q_NULLPTR);
|
||||||
virtual ~SettingsModel ();
|
virtual ~SettingsModel();
|
||||||
|
|
||||||
bool isReadOnly(const std::string& section, const std::string& name) const;
|
bool isReadOnly(const std::string §ion, const std::string &name) const;
|
||||||
std::string getEntryFullName(const std::string& section, const std::string& name) const; // Return the full name of the entry : 'name/readonly' or 'name'
|
std::string
|
||||||
|
getEntryFullName(const std::string §ion,
|
||||||
|
const std::string &name) const; // Return the full name of the entry : 'name/readonly' or 'name'
|
||||||
|
|
||||||
static const std::string UiSection;
|
static const std::string UiSection;
|
||||||
|
|
||||||
std::shared_ptr<linphone::Config> mConfig;
|
std::shared_ptr<linphone::Config> mConfig;
|
||||||
};
|
};
|
||||||
#endif // SETTINGS_MODEL_H_
|
#endif // SETTINGS_MODEL_H_
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ constexpr char Constants::DefaultFont[];
|
||||||
constexpr int Constants::DefaultFontPointSize;
|
constexpr int Constants::DefaultFontPointSize;
|
||||||
constexpr char Constants::DefaultEmojiFont[];
|
constexpr char Constants::DefaultEmojiFont[];
|
||||||
constexpr int Constants::DefaultEmojiFontPointSize;
|
constexpr int Constants::DefaultEmojiFontPointSize;
|
||||||
QStringList Constants::getReactionsList(){
|
QStringList Constants::getReactionsList() {
|
||||||
return {"❤️", "👍", "😂", "😮", "😢"};
|
return {"❤️", "👍", "😂", "😮", "😢"};
|
||||||
}
|
}
|
||||||
constexpr char Constants::QtDomain[];
|
constexpr char Constants::QtDomain[];
|
||||||
|
|
@ -88,8 +88,6 @@ constexpr char Constants::OAuth2Password[];
|
||||||
constexpr char Constants::OAuth2Scope[];
|
constexpr char Constants::OAuth2Scope[];
|
||||||
constexpr char Constants::DefaultOAuth2RemoteProvisioningHeader[];
|
constexpr char Constants::DefaultOAuth2RemoteProvisioningHeader[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
||||||
constexpr char Constants::H264Description[];
|
constexpr char Constants::H264Description[];
|
||||||
#endif // if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
#endif // if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
||||||
|
|
@ -143,4 +141,3 @@ constexpr char Constants::LinphoneBZip2_exe[];
|
||||||
constexpr char Constants::LinphoneBZip2_dll[];
|
constexpr char Constants::LinphoneBZip2_dll[];
|
||||||
constexpr char Constants::DefaultRlsUri[];
|
constexpr char Constants::DefaultRlsUri[];
|
||||||
constexpr char Constants::DefaultLogsEmail[];
|
constexpr char Constants::DefaultLogsEmail[];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,21 +21,22 @@
|
||||||
#ifndef CONSTANTS_H_
|
#ifndef CONSTANTS_H_
|
||||||
#define CONSTANTS_H_
|
#define CONSTANTS_H_
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
class Constants : public QObject{
|
class Constants : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Constants(QObject * parent = nullptr) : QObject(parent){}
|
Constants(QObject *parent = nullptr) : QObject(parent) {
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
static constexpr char DefaultLocale[] = "en";
|
static constexpr char DefaultLocale[] = "en";
|
||||||
static constexpr char DefaultFont[] = "Noto Sans";
|
static constexpr char DefaultFont[] = "Noto Sans";
|
||||||
static constexpr int DefaultFontPointSize = 10;
|
static constexpr int DefaultFontPointSize = 10;
|
||||||
|
|
@ -46,13 +47,13 @@ public:
|
||||||
#endif
|
#endif
|
||||||
static constexpr int DefaultEmojiFontPointSize = 10;
|
static constexpr int DefaultEmojiFontPointSize = 10;
|
||||||
static QStringList getReactionsList();
|
static QStringList getReactionsList();
|
||||||
|
|
||||||
static constexpr size_t MaxLogsCollectionSize = 10485760*5; // 50MB.
|
static constexpr size_t MaxLogsCollectionSize = 10485760 * 5; // 50MB.
|
||||||
|
|
||||||
#ifdef ENABLE_UPDATE_CHECK
|
#ifdef ENABLE_UPDATE_CHECK
|
||||||
static constexpr int VersionUpdateCheckInterval = 86400000; // 24 hours in milliseconds.
|
static constexpr int VersionUpdateCheckInterval = 86400000; // 24 hours in milliseconds.
|
||||||
#endif // ifdef ENABLE_UPDATE_CHECK
|
#endif // ifdef ENABLE_UPDATE_CHECK
|
||||||
|
|
||||||
static constexpr char DefaultXmlrpcUri[] = "https://subscribe.linphone.org:444/wizard.php";
|
static constexpr char DefaultXmlrpcUri[] = "https://subscribe.linphone.org:444/wizard.php";
|
||||||
static constexpr char DefaultUploadLogsServer[] = "https://www.linphone.org:444/lft.php";
|
static constexpr char DefaultUploadLogsServer[] = "https://www.linphone.org:444/lft.php";
|
||||||
static constexpr char DefaultContactParameters[] = "message-expires=2419200";
|
static constexpr char DefaultContactParameters[] = "message-expires=2419200";
|
||||||
|
|
@ -67,18 +68,19 @@ public:
|
||||||
static constexpr char PrivatePolicyUrl[] = "https://www.linphone.org/privacy-policy";
|
static constexpr char PrivatePolicyUrl[] = "https://www.linphone.org/privacy-policy";
|
||||||
static constexpr char ContactUrl[] = "https://www.linphone.org/contact";
|
static constexpr char ContactUrl[] = "https://www.linphone.org/contact";
|
||||||
static constexpr char TranslationUrl[] = "https://weblate.linphone.org/projects/linphone-desktop/";
|
static constexpr char TranslationUrl[] = "https://weblate.linphone.org/projects/linphone-desktop/";
|
||||||
|
|
||||||
static constexpr int MaxMosaicParticipants = 6;// From 7, the mosaic quality will be limited to avoid useless computations
|
static constexpr int MaxMosaicParticipants =
|
||||||
|
6; // From 7, the mosaic quality will be limited to avoid useless computations
|
||||||
|
|
||||||
static constexpr char LinphoneBZip2_exe[] = "https://www.linphone.org/releases/windows/tools/bzip2/bzip2.exe";
|
static constexpr char LinphoneBZip2_exe[] = "https://www.linphone.org/releases/windows/tools/bzip2/bzip2.exe";
|
||||||
static constexpr char LinphoneBZip2_dll[] = "https://www.linphone.org/releases/windows/tools/bzip2/bzip2.dll";
|
static constexpr char LinphoneBZip2_dll[] = "https://www.linphone.org/releases/windows/tools/bzip2/bzip2.dll";
|
||||||
static constexpr char DefaultRlsUri[] = "sips:rls@sip.linphone.org";
|
static constexpr char DefaultRlsUri[] = "sips:rls@sip.linphone.org";
|
||||||
static constexpr char DefaultLogsEmail[] = "linphone-desktop@belledonne-communications.com";
|
static constexpr char DefaultLogsEmail[] = "linphone-desktop@belledonne-communications.com";
|
||||||
|
|
||||||
static constexpr char DefaultFlexiAPIURL[] = "https://subscribe.linphone.org/api/";// Need "/" at the end
|
static constexpr char DefaultFlexiAPIURL[] = "https://subscribe.linphone.org/api/"; // Need "/" at the end
|
||||||
static constexpr char RemoteProvisioningURL[] = "https://subscribe.linphone.org/api/provisioning";
|
static constexpr char RemoteProvisioningURL[] = "https://subscribe.linphone.org/api/provisioning";
|
||||||
static constexpr char RemoteProvisioningBasicAuth[] = "";
|
static constexpr char RemoteProvisioningBasicAuth[] = "";
|
||||||
// OAuth2 settings
|
// OAuth2 settings
|
||||||
static constexpr char OAuth2AuthorizationUrl[] = "";
|
static constexpr char OAuth2AuthorizationUrl[] = "";
|
||||||
static constexpr char OAuth2AccessTokenUrl[] = "";
|
static constexpr char OAuth2AccessTokenUrl[] = "";
|
||||||
static constexpr char OAuth2RedirectUri[] = "";
|
static constexpr char OAuth2RedirectUri[] = "";
|
||||||
|
|
@ -86,8 +88,7 @@ public:
|
||||||
static constexpr char OAuth2Password[] = "";
|
static constexpr char OAuth2Password[] = "";
|
||||||
static constexpr char OAuth2Scope[] = "";
|
static constexpr char OAuth2Scope[] = "";
|
||||||
static constexpr char DefaultOAuth2RemoteProvisioningHeader[] = "x-linphone-oauth2-token";
|
static constexpr char DefaultOAuth2RemoteProvisioningHeader[] = "x-linphone-oauth2-token";
|
||||||
|
|
||||||
|
|
||||||
Q_PROPERTY(QString PasswordRecoveryUrl MEMBER PasswordRecoveryUrl CONSTANT)
|
Q_PROPERTY(QString PasswordRecoveryUrl MEMBER PasswordRecoveryUrl CONSTANT)
|
||||||
Q_PROPERTY(QString CguUrl MEMBER CguUrl CONSTANT)
|
Q_PROPERTY(QString CguUrl MEMBER CguUrl CONSTANT)
|
||||||
Q_PROPERTY(QString PrivatePolicyUrl MEMBER PrivatePolicyUrl CONSTANT)
|
Q_PROPERTY(QString PrivatePolicyUrl MEMBER PrivatePolicyUrl CONSTANT)
|
||||||
|
|
@ -96,35 +97,38 @@ public:
|
||||||
Q_PROPERTY(int maxMosaicParticipants MEMBER MaxMosaicParticipants CONSTANT)
|
Q_PROPERTY(int maxMosaicParticipants MEMBER MaxMosaicParticipants CONSTANT)
|
||||||
Q_PROPERTY(QStringList reactionsList READ getReactionsList CONSTANT)
|
Q_PROPERTY(QStringList reactionsList READ getReactionsList CONSTANT)
|
||||||
|
|
||||||
// For Webviews
|
// For Webviews
|
||||||
static constexpr char DefaultAssistantRegistrationUrl[] = "https://subscribe.linphone.org/register";
|
static constexpr char DefaultAssistantRegistrationUrl[] = "https://subscribe.linphone.org/register";
|
||||||
static constexpr char DefaultAssistantLoginUrl[] = "https://subscribe.linphone.org/login";
|
static constexpr char DefaultAssistantLoginUrl[] = "https://subscribe.linphone.org/login";
|
||||||
static constexpr char DefaultAssistantLogoutUrl[] = "https://subscribe.linphone.org/logout";
|
static constexpr char DefaultAssistantLogoutUrl[] = "https://subscribe.linphone.org/logout";
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
// Max image size in bytes. (1Mb)
|
// Max image size in bytes. (1Mb)
|
||||||
static constexpr qint64 MaxImageSize = 1024000;// In Bytes.
|
static constexpr qint64 MaxImageSize = 1024000; // In Bytes.
|
||||||
static constexpr qint64 FileSizeLimit = 524288000;// In Bytes.
|
static constexpr qint64 FileSizeLimit = 524288000; // In Bytes.
|
||||||
static constexpr int ThumbnailImageFileWidth = 100;
|
static constexpr int ThumbnailImageFileWidth = 100;
|
||||||
static constexpr int ThumbnailImageFileHeight = 100;
|
static constexpr int ThumbnailImageFileHeight = 100;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// LINPHONE
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static constexpr char LinphoneDomain[] = "sip.linphone.org"; // Use for checking if config are a Linphone
|
//--------------------------------------------------------------------------------
|
||||||
|
// LINPHONE
|
||||||
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static constexpr char LinphoneDomain[] = "sip.linphone.org"; // Use for checking if config are a Linphone
|
||||||
static constexpr char WindowIconPath[] = ":/assets/images/linphone_logo.svg";
|
static constexpr char WindowIconPath[] = ":/assets/images/linphone_logo.svg";
|
||||||
static constexpr char ApplicationMinimalQtVersion[] = "5.10.0";
|
static constexpr char ApplicationMinimalQtVersion[] = "5.10.0";
|
||||||
static constexpr char DefaultConferenceURI[] = "sip:conference-factory@sip.linphone.org"; // Default for a Linphone account
|
static constexpr char DefaultConferenceURI[] =
|
||||||
static constexpr char DefaultVideoConferenceURI[] = "sip:videoconference-factory@sip.linphone.org"; // Default for a Linphone account
|
"sip:conference-factory@sip.linphone.org"; // Default for a Linphone account
|
||||||
static constexpr char DefaultLimeServerURL[] = "https://lime.linphone.org/lime-server/lime-server.php"; // Default for a Linphone account
|
static constexpr char DefaultVideoConferenceURI[] =
|
||||||
|
"sip:videoconference-factory@sip.linphone.org"; // Default for a Linphone account
|
||||||
|
static constexpr char DefaultLimeServerURL[] =
|
||||||
|
"https://lime.linphone.org/lime-server/lime-server.php"; // Default for a Linphone account
|
||||||
|
|
||||||
static constexpr char PathAssistantConfig[] = "/" EXECUTABLE_NAME "/assistant/";
|
static constexpr char PathAssistantConfig[] = "/" EXECUTABLE_NAME "/assistant/";
|
||||||
static constexpr char PathAvatars[] = "/avatars/";
|
static constexpr char PathAvatars[] = "/avatars/";
|
||||||
static constexpr char PathCaptures[] = "/" EXECUTABLE_NAME "/captures/";
|
static constexpr char PathCaptures[] = "/" EXECUTABLE_NAME "/captures/";
|
||||||
static constexpr char PathCodecs[] = "/codecs/";
|
static constexpr char PathCodecs[] = "/codecs/";
|
||||||
static constexpr char PathData[] = "/" EXECUTABLE_NAME;
|
static constexpr char PathData[] = "/" EXECUTABLE_NAME;
|
||||||
static constexpr char PathTools[] = "/tools/";
|
static constexpr char PathTools[] = "/tools/";
|
||||||
static constexpr char PathLogs[] = "/logs/";
|
static constexpr char PathLogs[] = "/logs/";
|
||||||
#ifdef APPLE
|
#ifdef APPLE
|
||||||
static constexpr char PathPlugins[] = "/Plugins/";
|
static constexpr char PathPlugins[] = "/Plugins/";
|
||||||
|
|
@ -134,7 +138,7 @@ public:
|
||||||
static constexpr char PathPluginsApp[] = "app/";
|
static constexpr char PathPluginsApp[] = "app/";
|
||||||
static constexpr char PathSounds[] = "/sounds/" EXECUTABLE_NAME;
|
static constexpr char PathSounds[] = "/sounds/" EXECUTABLE_NAME;
|
||||||
static constexpr char PathUserCertificates[] = "/usr-crt/";
|
static constexpr char PathUserCertificates[] = "/usr-crt/";
|
||||||
|
|
||||||
static constexpr char PathCallHistoryList[] = "/call-history.db";
|
static constexpr char PathCallHistoryList[] = "/call-history.db";
|
||||||
static constexpr char PathConfig[] = "/linphonerc";
|
static constexpr char PathConfig[] = "/linphonerc";
|
||||||
static constexpr char PathDatabase[] = "/linphone.db";
|
static constexpr char PathDatabase[] = "/linphone.db";
|
||||||
|
|
@ -144,39 +148,39 @@ public:
|
||||||
static constexpr char PathLimeDatabase[] = "/x3dh.c25519.sqlite3";
|
static constexpr char PathLimeDatabase[] = "/x3dh.c25519.sqlite3";
|
||||||
static constexpr char PathMessageHistoryList[] = "/message-history.db";
|
static constexpr char PathMessageHistoryList[] = "/message-history.db";
|
||||||
static constexpr char PathZrtpSecrets[] = "/zidcache";
|
static constexpr char PathZrtpSecrets[] = "/zidcache";
|
||||||
|
|
||||||
static constexpr char LanguagePath[] = ":/languages/";
|
static constexpr char LanguagePath[] = ":/languages/";
|
||||||
|
|
||||||
// The main windows of Linphone desktop.
|
// The main windows of Linphone desktop.
|
||||||
static constexpr char QmlViewMainWindow[] = "qrc:/ui/views/App/Main/MainWindow.qml";
|
static constexpr char QmlViewMainWindow[] = "qrc:/ui/views/App/Main/MainWindow.qml";
|
||||||
static constexpr char QmlViewCallsWindow[] = "qrc:/ui/views/App/Calls/CallsWindow.qml";
|
static constexpr char QmlViewCallsWindow[] = "qrc:/ui/views/App/Calls/CallsWindow.qml";
|
||||||
static constexpr char QmlViewSettingsWindow[] = "qrc:/ui/views/App/Settings/SettingsWindow.qml";
|
static constexpr char QmlViewSettingsWindow[] = "qrc:/ui/views/App/Settings/SettingsWindow.qml";
|
||||||
|
|
||||||
static constexpr char MainQmlUri[] = "Linphone";
|
static constexpr char MainQmlUri[] = "Linphone";
|
||||||
|
|
||||||
static constexpr char AttachVirtualWindowMethodName[] = "attachVirtualWindow";
|
static constexpr char AttachVirtualWindowMethodName[] = "attachVirtualWindow";
|
||||||
static constexpr char AboutPath[] = "qrc:/ui/views/App/Main/Dialogs/About.qml";
|
static constexpr char AboutPath[] = "qrc:/ui/views/App/Main/Dialogs/About.qml";
|
||||||
|
|
||||||
static constexpr char AssistantViewName[] = "Assistant";
|
static constexpr char AssistantViewName[] = "Assistant";
|
||||||
|
|
||||||
static constexpr char QtDomain[] = "qt";
|
static constexpr char QtDomain[] = "qt";
|
||||||
static constexpr char SrcPattern[] = "/src/";
|
static constexpr char SrcPattern[] = "/src/";
|
||||||
static constexpr char LinphoneLocaleEncoding[] = "UTF-8";// Alternative is to use "locale"
|
static constexpr char LinphoneLocaleEncoding[] = "UTF-8"; // Alternative is to use "locale"
|
||||||
static constexpr char VcardScheme[] = EXECUTABLE_NAME "-desktop:/";
|
static constexpr char VcardScheme[] = EXECUTABLE_NAME "-desktop:/";
|
||||||
static constexpr int CbsCallInterval = 20;
|
static constexpr int CbsCallInterval = 20;
|
||||||
static constexpr char RcVersionName[] = "rc_version";
|
static constexpr char RcVersionName[] = "rc_version";
|
||||||
static constexpr int RcVersionCurrent = 6; // 2 = Conference URI
|
static constexpr int RcVersionCurrent = 6; // 2 = Conference URI
|
||||||
// 3 = CPIM on basic chat rooms
|
// 3 = CPIM on basic chat rooms
|
||||||
// 4 = RTP bundle mode
|
// 4 = RTP bundle mode
|
||||||
// 5 = Video Conference URI
|
// 5 = Video Conference URI
|
||||||
// 6 = Publish expires
|
// 6 = Publish expires
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
// CISCO
|
// CISCO
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
||||||
static constexpr char H264Description[] = "Provided by CISCO SYSTEM,INC";
|
static constexpr char H264Description[] = "Provided by CISCO SYSTEM,INC";
|
||||||
#endif // if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
#endif // if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
static constexpr char LibraryExtension[] = "so";
|
static constexpr char LibraryExtension[] = "so";
|
||||||
static constexpr char H264InstallName[] = "libopenh264.so";
|
static constexpr char H264InstallName[] = "libopenh264.so";
|
||||||
|
|
@ -199,7 +203,7 @@ public:
|
||||||
#endif // ifdef Q_OS_WIN64
|
#endif // ifdef Q_OS_WIN64
|
||||||
#endif // ifdef Q_OS_LINUX
|
#endif // ifdef Q_OS_LINUX
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -21,11 +21,11 @@
|
||||||
#ifndef UTILS_H_
|
#ifndef UTILS_H_
|
||||||
#define UTILS_H_
|
#define UTILS_H_
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QLocale>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QLocale>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
#include "Constants.hpp"
|
#include "Constants.hpp"
|
||||||
|
|
||||||
|
|
@ -49,84 +49,86 @@ class DateModel;
|
||||||
|
|
||||||
class ContentModel;
|
class ContentModel;
|
||||||
|
|
||||||
class Utils : public QObject{
|
class Utils : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Utils(QObject * parent = nullptr) : QObject(parent){}
|
Utils(QObject *parent = nullptr) : QObject(parent) {
|
||||||
/*
|
|
||||||
typedef enum{
|
|
||||||
SIP_DISPLAY_USERNAME = 0,
|
|
||||||
SIP_DISPLAY_ALL = -1
|
|
||||||
}SipDisplayMode;
|
|
||||||
Q_ENUM(SipDisplayMode)
|
|
||||||
|
|
||||||
// Qt interfaces
|
|
||||||
Q_INVOKABLE static bool hasCapability(const QString& address, const LinphoneEnums::FriendCapability& capability, bool defaultCapability = true);
|
|
||||||
// ***** DATE TIME
|
|
||||||
Q_INVOKABLE static QDateTime addMinutes(QDateTime date, const int& min);
|
|
||||||
static QDateTime getOffsettedUTC(const QDateTime& date);
|
|
||||||
Q_INVOKABLE static QString toDateTimeString(QDateTime date, const QString& format = "yyyy/MM/dd hh:mm:ss");
|
|
||||||
Q_INVOKABLE static QString toTimeString(QDateTime date, const QString& format = "hh:mm:ss");
|
|
||||||
Q_INVOKABLE static QString toDateString(QDateTime date, const QString& format = "");
|
|
||||||
Q_INVOKABLE static QString toDateString(QDate date, const QString& format = "");
|
|
||||||
Q_INVOKABLE static QString toDisplayString(const QString& str, SipDisplayMode displayMode = SIP_DISPLAY_ALL);
|
|
||||||
Q_INVOKABLE static QDate getCurrentDate();
|
|
||||||
Q_INVOKABLE static DateModel* getCurrentDateModel();
|
|
||||||
Q_INVOKABLE static QDate getMinDate();
|
|
||||||
Q_INVOKABLE static DateModel* getMinDateModel();
|
|
||||||
Q_INVOKABLE static QDate toDate(const QString& str, const QString& format = "yyyy/MM/dd");
|
|
||||||
Q_INVOKABLE static QDate getDate(int year, int month, int day);
|
|
||||||
Q_INVOKABLE static DateModel* toDateModel(const QString& str, const QString& format = "yyyy/MM/dd");
|
|
||||||
Q_INVOKABLE static DateModel* getDateModel(int year, int month, int day);
|
|
||||||
Q_INVOKABLE static int getFullYear(const QDate& date);
|
|
||||||
Q_INVOKABLE static int getMonth(const QDate& date);
|
|
||||||
Q_INVOKABLE static int getDay(const QDate& date);
|
|
||||||
Q_INVOKABLE static int getDayOfWeek(const QDate& date);
|
|
||||||
Q_INVOKABLE static bool equals(const QDate& d1, const QDate& d2); // Override JS '==' operator
|
|
||||||
Q_INVOKABLE static bool isGreatherThan(const QDate& d1, const QDate& d2); // Override JS '>=' operator
|
|
||||||
//*****
|
|
||||||
static void cleanDisplayNameCache(const QString& address = "");// if "", clean all cache
|
|
||||||
Q_INVOKABLE static QString getDisplayName(const QString& address);
|
|
||||||
Q_INVOKABLE static QString getInitials(const QString& username); // Support UTF32
|
|
||||||
Q_INVOKABLE static QString toString(const LinphoneEnums::TunnelMode& mode);
|
|
||||||
Q_INVOKABLE static bool isMe(const QString& address);
|
|
||||||
Q_INVOKABLE static bool isAnimatedImage(const QString& path);
|
|
||||||
Q_INVOKABLE static bool isImage(const QString& path);
|
|
||||||
Q_INVOKABLE static bool isVideo(const QString& path);
|
|
||||||
Q_INVOKABLE static bool isPdf(const QString& path);
|
|
||||||
Q_INVOKABLE static bool isSupportedForDisplay(const QString& path);
|
|
||||||
Q_INVOKABLE static bool canHaveThumbnail(const QString& path);
|
|
||||||
Q_INVOKABLE static bool isPhoneNumber(const QString& txt);
|
|
||||||
Q_INVOKABLE static bool isUsername(const QString& txt); // Check with Regex
|
|
||||||
Q_INVOKABLE static bool isValidUrl(const QString& url);
|
|
||||||
Q_INVOKABLE QSize getImageSize(const QString& url);
|
|
||||||
Q_INVOKABLE static QPoint getCursorPosition();
|
|
||||||
Q_INVOKABLE static QString getFileChecksum(const QString& filePath);
|
|
||||||
static bool codepointIsEmoji(uint code);
|
|
||||||
static bool codepointIsVisible(uint code);
|
|
||||||
Q_INVOKABLE static bool isOnlyEmojis(const QString& text);
|
|
||||||
Q_INVOKABLE static QString encodeEmojiToQmlRichFormat(const QString &body);
|
|
||||||
Q_INVOKABLE static QString encodeTextToQmlRichFormat(const QString& text, const QVariantMap& options = QVariantMap());
|
|
||||||
Q_INVOKABLE static QString getFileContent(const QString& filePath);
|
|
||||||
|
|
||||||
Q_INVOKABLE static bool openWithPdfViewer(ContentModel *contentModel, const QString& filePath, const int& width, const int& height); // return true if PDF is enabled
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static inline QString coreStringToAppString (const std::string &str) {
|
|
||||||
if(Constants::LinphoneLocaleEncoding == QString("UTF-8"))
|
|
||||||
return QString::fromStdString(str);
|
|
||||||
else
|
|
||||||
return QString::fromLocal8Bit(str.c_str(), int(str.size()));// When using Locale. Be careful about conversion bijection with UTF-8, you may loss characters
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static inline std::string appStringToCoreString (const QString &str) {
|
typedef enum{
|
||||||
if(Constants::LinphoneLocaleEncoding == QString("UTF-8"))
|
SIP_DISPLAY_USERNAME = 0,
|
||||||
return str.toStdString();
|
SIP_DISPLAY_ALL = -1
|
||||||
|
}SipDisplayMode;
|
||||||
|
Q_ENUM(SipDisplayMode)
|
||||||
|
|
||||||
|
// Qt interfaces
|
||||||
|
Q_INVOKABLE static bool hasCapability(const QString& address, const LinphoneEnums::FriendCapability& capability,
|
||||||
|
bool defaultCapability = true);
|
||||||
|
// ***** DATE TIME
|
||||||
|
Q_INVOKABLE static QDateTime addMinutes(QDateTime date, const int& min);
|
||||||
|
static QDateTime getOffsettedUTC(const QDateTime& date);
|
||||||
|
Q_INVOKABLE static QString toDateTimeString(QDateTime date, const QString& format = "yyyy/MM/dd hh:mm:ss");
|
||||||
|
Q_INVOKABLE static QString toTimeString(QDateTime date, const QString& format = "hh:mm:ss");
|
||||||
|
Q_INVOKABLE static QString toDateString(QDateTime date, const QString& format = "");
|
||||||
|
Q_INVOKABLE static QString toDateString(QDate date, const QString& format = "");
|
||||||
|
Q_INVOKABLE static QString toDisplayString(const QString& str, SipDisplayMode displayMode = SIP_DISPLAY_ALL);
|
||||||
|
Q_INVOKABLE static QDate getCurrentDate();
|
||||||
|
Q_INVOKABLE static DateModel* getCurrentDateModel();
|
||||||
|
Q_INVOKABLE static QDate getMinDate();
|
||||||
|
Q_INVOKABLE static DateModel* getMinDateModel();
|
||||||
|
Q_INVOKABLE static QDate toDate(const QString& str, const QString& format = "yyyy/MM/dd");
|
||||||
|
Q_INVOKABLE static QDate getDate(int year, int month, int day);
|
||||||
|
Q_INVOKABLE static DateModel* toDateModel(const QString& str, const QString& format = "yyyy/MM/dd");
|
||||||
|
Q_INVOKABLE static DateModel* getDateModel(int year, int month, int day);
|
||||||
|
Q_INVOKABLE static int getFullYear(const QDate& date);
|
||||||
|
Q_INVOKABLE static int getMonth(const QDate& date);
|
||||||
|
Q_INVOKABLE static int getDay(const QDate& date);
|
||||||
|
Q_INVOKABLE static int getDayOfWeek(const QDate& date);
|
||||||
|
Q_INVOKABLE static bool equals(const QDate& d1, const QDate& d2); // Override JS '==' operator
|
||||||
|
Q_INVOKABLE static bool isGreatherThan(const QDate& d1, const QDate& d2); // Override JS '>=' operator
|
||||||
|
//*****
|
||||||
|
static void cleanDisplayNameCache(const QString& address = "");// if "", clean all cache
|
||||||
|
Q_INVOKABLE static QString getDisplayName(const QString& address);
|
||||||
|
Q_INVOKABLE static QString getInitials(const QString& username); // Support UTF32
|
||||||
|
Q_INVOKABLE static QString toString(const LinphoneEnums::TunnelMode& mode);
|
||||||
|
Q_INVOKABLE static bool isMe(const QString& address);
|
||||||
|
Q_INVOKABLE static bool isAnimatedImage(const QString& path);
|
||||||
|
Q_INVOKABLE static bool isImage(const QString& path);
|
||||||
|
Q_INVOKABLE static bool isVideo(const QString& path);
|
||||||
|
Q_INVOKABLE static bool isPdf(const QString& path);
|
||||||
|
Q_INVOKABLE static bool isSupportedForDisplay(const QString& path);
|
||||||
|
Q_INVOKABLE static bool canHaveThumbnail(const QString& path);
|
||||||
|
Q_INVOKABLE static bool isPhoneNumber(const QString& txt);
|
||||||
|
Q_INVOKABLE static bool isUsername(const QString& txt); // Check with Regex
|
||||||
|
Q_INVOKABLE static bool isValidUrl(const QString& url);
|
||||||
|
Q_INVOKABLE QSize getImageSize(const QString& url);
|
||||||
|
Q_INVOKABLE static QPoint getCursorPosition();
|
||||||
|
Q_INVOKABLE static QString getFileChecksum(const QString& filePath);
|
||||||
|
static bool codepointIsEmoji(uint code);
|
||||||
|
static bool codepointIsVisible(uint code);
|
||||||
|
Q_INVOKABLE static bool isOnlyEmojis(const QString& text);
|
||||||
|
Q_INVOKABLE static QString encodeEmojiToQmlRichFormat(const QString &body);
|
||||||
|
Q_INVOKABLE static QString encodeTextToQmlRichFormat(const QString& text, const QVariantMap& options =
|
||||||
|
QVariantMap()); Q_INVOKABLE static QString getFileContent(const QString& filePath);
|
||||||
|
|
||||||
|
Q_INVOKABLE static bool openWithPdfViewer(ContentModel *contentModel, const QString& filePath, const int& width,
|
||||||
|
const int& height); // return true if PDF is enabled
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static inline QString coreStringToAppString(const std::string &str) {
|
||||||
|
if (Constants::LinphoneLocaleEncoding == QString("UTF-8")) return QString::fromStdString(str);
|
||||||
else
|
else
|
||||||
return qPrintable(str);
|
return QString::fromLocal8Bit(str.c_str(),
|
||||||
|
int(str.size())); // When using Locale. Be careful about conversion bijection
|
||||||
|
// with UTF-8, you may loss characters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline std::string appStringToCoreString(const QString &str) {
|
||||||
|
if (Constants::LinphoneLocaleEncoding == QString("UTF-8")) return str.toStdString();
|
||||||
|
else return qPrintable(str);
|
||||||
|
}
|
||||||
|
/*
|
||||||
// Reverse function of strstr.
|
// Reverse function of strstr.
|
||||||
static char *rstrstr (const char *a, const char *b);
|
static char *rstrstr (const char *a, const char *b);
|
||||||
// Return the path if it is an image else an empty path.
|
// Return the path if it is an image else an empty path.
|
||||||
|
|
@ -134,66 +136,65 @@ public:
|
||||||
// Returns the same path given in parameter if `filePath` exists.
|
// Returns the same path given in parameter if `filePath` exists.
|
||||||
// Otherwise returns a safe path with a unique number before the extension.
|
// Otherwise returns a safe path with a unique number before the extension.
|
||||||
static QString getSafeFilePath (const QString &filePath, bool *soFarSoGood = nullptr);
|
static QString getSafeFilePath (const QString &filePath, bool *soFarSoGood = nullptr);
|
||||||
static std::shared_ptr<linphone::Address> getMatchingLocalAddress(std::shared_ptr<linphone::Address> p_localAddress);
|
static std::shared_ptr<linphone::Address> getMatchingLocalAddress(std::shared_ptr<linphone::Address>
|
||||||
static QString cleanSipAddress (const QString &sipAddress);// Return at most : sip:username@domain
|
p_localAddress); static QString cleanSipAddress (const QString &sipAddress);// Return at most : sip:username@domain
|
||||||
// Test if the process exists
|
// Test if the process exists
|
||||||
static bool processExists(const quint64& p_processId);
|
static bool processExists(const quint64& p_processId);
|
||||||
|
|
||||||
// Connect once to a member function.
|
// Connect once to a member function.
|
||||||
template<typename Func1, typename Func2>
|
template<typename Func1, typename Func2>
|
||||||
static inline QMetaObject::Connection connectOnce (
|
static inline QMetaObject::Connection connectOnce (
|
||||||
typename QtPrivate::FunctionPointer<Func1>::Object *sender,
|
typename QtPrivate::FunctionPointer<Func1>::Object *sender,
|
||||||
Func1 signal,
|
Func1 signal,
|
||||||
typename QtPrivate::FunctionPointer<Func2>::Object *receiver,
|
typename QtPrivate::FunctionPointer<Func2>::Object *receiver,
|
||||||
Func2 slot
|
Func2 slot
|
||||||
) {
|
) {
|
||||||
QMetaObject::Connection connection = QObject::connect(sender, signal, receiver, slot);
|
QMetaObject::Connection connection = QObject::connect(sender, signal, receiver, slot);
|
||||||
QMetaObject::Connection *deleter = new QMetaObject::Connection();
|
QMetaObject::Connection *deleter = new QMetaObject::Connection();
|
||||||
|
|
||||||
*deleter = QObject::connect(sender, signal, [connection, deleter] {
|
*deleter = QObject::connect(sender, signal, [connection, deleter] {
|
||||||
QObject::disconnect(connection);
|
QObject::disconnect(connection);
|
||||||
QObject::disconnect(*deleter);
|
QObject::disconnect(*deleter);
|
||||||
delete deleter;
|
delete deleter;
|
||||||
});
|
});
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect once to a function.
|
// Connect once to a function.
|
||||||
template<typename Func1, typename Func2>
|
template<typename Func1, typename Func2>
|
||||||
static inline QMetaObject::Connection connectOnce (
|
static inline QMetaObject::Connection connectOnce (
|
||||||
typename QtPrivate::FunctionPointer<Func1>::Object *sender,
|
typename QtPrivate::FunctionPointer<Func1>::Object *sender,
|
||||||
Func1 signal,
|
Func1 signal,
|
||||||
const QObject *receiver,
|
const QObject *receiver,
|
||||||
Func2 slot
|
Func2 slot
|
||||||
) {
|
) {
|
||||||
QMetaObject::Connection connection = QObject::connect(sender, signal, receiver, slot);
|
QMetaObject::Connection connection = QObject::connect(sender, signal, receiver, slot);
|
||||||
QMetaObject::Connection *deleter = new QMetaObject::Connection();
|
QMetaObject::Connection *deleter = new QMetaObject::Connection();
|
||||||
|
|
||||||
*deleter = QObject::connect(sender, signal, [connection, deleter] {
|
*deleter = QObject::connect(sender, signal, [connection, deleter] {
|
||||||
QObject::disconnect(connection);
|
QObject::disconnect(connection);
|
||||||
QObject::disconnect(*deleter);
|
QObject::disconnect(*deleter);
|
||||||
delete deleter;
|
delete deleter;
|
||||||
});
|
});
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
static std::shared_ptr<linphone::Address> interpretUrl(const QString& address);
|
static std::shared_ptr<linphone::Address> interpretUrl(const QString& address);
|
||||||
|
|
||||||
|
|
||||||
static QString getCountryName(const QLocale::Country& country);
|
static QString getCountryName(const QLocale::Country& country);
|
||||||
static void copyDir(QString from, QString to);// Copy a folder recursively without erasing old file
|
static void copyDir(QString from, QString to);// Copy a folder recursively without erasing old file
|
||||||
static QString getDisplayName(const std::shared_ptr<const linphone::Address>& address); // Get the displayname from addres in this order : Friends, Contact, Display address, Username address
|
static QString getDisplayName(const std::shared_ptr<const linphone::Address>& address); // Get the displayname from
|
||||||
static std::shared_ptr<linphone::Config> getConfigIfExists (const QString& configPath);
|
addres in this order : Friends, Contact, Display address, Username address static std::shared_ptr<linphone::Config>
|
||||||
static QString getApplicationProduct();
|
getConfigIfExists (const QString& configPath); static QString getApplicationProduct(); static QString
|
||||||
static QString getOsProduct();
|
getOsProduct(); static QString computeUserAgent(const std::shared_ptr<linphone::Config>& config);
|
||||||
static QString computeUserAgent(const std::shared_ptr<linphone::Config>& config);
|
|
||||||
|
|
||||||
static bool isMe(const std::shared_ptr<const linphone::Address>& address);
|
static bool isMe(const std::shared_ptr<const linphone::Address>& address);
|
||||||
|
|
||||||
static void deleteAllUserData();
|
static void deleteAllUserData();
|
||||||
static void deleteAllUserDataOffline();// When we are out of all events and core is not running (aka in main())
|
static void deleteAllUserDataOffline();// When we are out of all events and core is not running (aka in main())
|
||||||
|
|
||||||
static void setFamilyFont(QAction * dest, const QString& family);
|
static void setFamilyFont(QAction * dest, const QString& family);
|
||||||
static void setFamilyFont(QWidget * dest, const QString& family);
|
static void setFamilyFont(QWidget * dest, const QString& family);
|
||||||
static QPixmap getMaskedPixmap(const QString& name, const QColor& color);
|
static QPixmap getMaskedPixmap(const QString& name, const QColor& color);
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
#include "LoginPage.hpp"
|
#include "LoginPage.hpp"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
LoginPage::LoginPage(QObject *parent) : QObject(parent) {
|
||||||
LoginPage::LoginPage(QObject * parent) : QObject(parent){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoginPage::isLogged() {
|
bool LoginPage::isLogged() {
|
||||||
static bool testLog = false;
|
static bool testLog = false;
|
||||||
QTimer::singleShot(2000, [&]() mutable{
|
QTimer::singleShot(2000, [&]() mutable {
|
||||||
testLog = true;
|
testLog = true;
|
||||||
emit isLoggedChanged();
|
emit isLoggedChanged();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class LoginPage : public QObject{
|
class LoginPage : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LoginPage(QObject * parent = nullptr);
|
LoginPage(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_PROPERTY(bool isLogged READ isLogged NOTIFY isLoggedChanged)
|
Q_PROPERTY(bool isLogged READ isLogged NOTIFY isLoggedChanged)
|
||||||
|
|
||||||
bool isLogged();
|
bool isLogged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void isLoggedChanged();
|
void isLoggedChanged();
|
||||||
};
|
};
|
||||||
27
cmake/hook/pre-commit
Executable file
27
cmake/hook/pre-commit
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This hook verifies that the changes are formatted using clang-format.
|
||||||
|
# It has to be installed in:
|
||||||
|
# - .git/hooks/pre-commit for a root project
|
||||||
|
# - .git/modules/<submodule-name>/hooks/pre-commit for a submodule
|
||||||
|
|
||||||
|
if ! [ -x "$(command -v clang-format)" ]; then
|
||||||
|
echo "Pre commit hook: Please install clang-format (coding style checker) - could not find clang-format in PATH."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHANGED_FILES="$(git diff --name-only --cached --diff-filter=ACMR | grep -E '\.(c|cc|cpp|h|hh)$')"
|
||||||
|
|
||||||
|
if [[ -n "$CHANGED_FILES" ]]; then
|
||||||
|
if ! clang-format --style=file -Werror -n $CHANGED_FILES > /dev/null 2>&1; then
|
||||||
|
echo "*****************"
|
||||||
|
echo ""
|
||||||
|
echo "Pre commit hook: Staged file(s) contains non correctly formatted code. Please correct it using one of the following:"
|
||||||
|
echo "1) Configure your IDE to format automatically on save (entire file)"
|
||||||
|
echo "2) Use clang-format to correctly format source code using:"
|
||||||
|
echo " clang-format --style=file -i <file-to-format>"
|
||||||
|
echo ""
|
||||||
|
echo "*** Aborting commit.***"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Loading…
Add table
Reference in a new issue