Commit 3ff2508f authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/assistant/AssistantModel): supports a `configFilename` property

parent 9d056093
...@@ -164,7 +164,7 @@ void Logger::init () { ...@@ -164,7 +164,7 @@ void Logger::init () {
} }
); );
linphone_core_set_log_collection_path(Paths::getLogsDirpath().c_str()); linphone_core_set_log_collection_path(Paths::getLogsDirPath().c_str());
linphone_core_set_log_collection_max_file_size(MAX_LOGS_COLLECTION_SIZE); linphone_core_set_log_collection_max_file_size(MAX_LOGS_COLLECTION_SIZE);
linphone_core_enable_log_collection(LinphoneLogCollectionEnabled); linphone_core_enable_log_collection(LinphoneLogCollectionEnabled);
} }
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "Paths.hpp" #include "Paths.hpp"
#include "config.h" #include "config.h"
#define PATH_ASSISTANT_CONFIG "/assistant/"
#define PATH_AVATARS "/avatars/" #define PATH_AVATARS "/avatars/"
#define PATH_CAPTURES "/captures/" #define PATH_CAPTURES "/captures/"
#define PATH_LOGS "/logs/" #define PATH_LOGS "/logs/"
...@@ -49,14 +50,14 @@ using namespace std; ...@@ -49,14 +50,14 @@ using namespace std;
// ============================================================================= // =============================================================================
inline bool directoryPathExists (const QString &path) { inline bool dirPathExists (const QString &path) {
QDir dir(path); QDir dir(path);
return dir.exists(); return dir.exists();
} }
inline bool filePathExists (const QString &path) { inline bool filePathExists (const QString &path) {
QFileInfo info(path); QFileInfo info(path);
if (!directoryPathExists(info.path())) if (!dirPathExists(info.path()))
return false; return false;
QFile file(path); QFile file(path);
...@@ -67,7 +68,7 @@ inline bool filePathExists (const string &path) { ...@@ -67,7 +68,7 @@ inline bool filePathExists (const string &path) {
return filePathExists(Utils::linphoneStringToQString(path)); return filePathExists(Utils::linphoneStringToQString(path));
} }
inline void ensureDirectoryPathExists (const QString &path) { 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());
...@@ -75,20 +76,20 @@ inline void ensureDirectoryPathExists (const QString &path) { ...@@ -75,20 +76,20 @@ inline void ensureDirectoryPathExists (const QString &path) {
inline void ensureFilePathExists (const QString &path) { inline void ensureFilePathExists (const QString &path) {
QFileInfo info(path); QFileInfo info(path);
ensureDirectoryPathExists(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());
} }
inline string getReadableDirectoryPath (const QString &dirname) { inline string getReadableDirPath (const QString &dirname) {
return Utils::qStringToLinphoneString(QDir::toNativeSeparators(dirname)); return Utils::qStringToLinphoneString(QDir::toNativeSeparators(dirname));
} }
inline string getWritableDirectoryPath (const QString &dirname) { inline string getWritableDirPath (const QString &dirname) {
ensureDirectoryPathExists(dirname); ensureDirPathExists(dirname);
return getReadableDirectoryPath(dirname); return getReadableDirPath(dirname);
} }
inline string getReadableFilePath (const QString &filename) { inline string getReadableFilePath (const QString &filename) {
...@@ -102,7 +103,7 @@ inline string getWritableFilePath (const QString &filename) { ...@@ -102,7 +103,7 @@ inline string getWritableFilePath (const QString &filename) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
inline QString getAppPackageDataDirpath () { inline QString getAppPackageDataDirPath () {
QDir dir(QCoreApplication::applicationDirPath()); QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") { if (dir.dirName() == "MacOS") {
dir.cdUp(); dir.cdUp();
...@@ -114,7 +115,7 @@ inline QString getAppPackageDataDirpath () { ...@@ -114,7 +115,7 @@ inline QString getAppPackageDataDirpath () {
return dir.absolutePath(); return dir.absolutePath();
} }
inline QString getAppPackageMsPluginsDirpath () { inline QString getAppPackageMsPluginsDirPath () {
QDir dir(QCoreApplication::applicationDirPath()); QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") { if (dir.dirName() == "MacOS") {
dir.cdUp(); dir.cdUp();
...@@ -126,91 +127,99 @@ inline QString getAppPackageMsPluginsDirpath () { ...@@ -126,91 +127,99 @@ inline QString getAppPackageMsPluginsDirpath () {
return dir.absolutePath(); return dir.absolutePath();
} }
inline QString getAppConfigFilepath () { inline QString getAppAssistantConfigDirPath () {
return getAppPackageDataDirPath() + PATH_ASSISTANT_CONFIG;
}
inline QString getAppConfigFilePath () {
if (QSysInfo::productType() == "macos") if (QSysInfo::productType() == "macos")
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG;
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + PATH_CONFIG; return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + PATH_CONFIG;
} }
inline QString getAppCallHistoryFilepath () { inline QString getAppCallHistoryFilePath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST;
} }
inline QString getAppFactoryConfigFilepath () { inline QString getAppFactoryConfigFilePath () {
return getAppPackageDataDirpath() + PATH_FACTORY_CONFIG; return getAppPackageDataDirPath() + PATH_FACTORY_CONFIG;
} }
inline QString getAppRootCaFilepath () { inline QString getAppRootCaFilePath () {
return getAppPackageDataDirpath() + PATH_ROOT_CA; return getAppPackageDataDirPath() + PATH_ROOT_CA;
} }
inline QString getAppFriendsFilepath () { inline QString getAppFriendsFilePath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_FRIENDS_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_FRIENDS_LIST;
} }
inline QString getAppMessageHistoryFilepath () { inline QString getAppMessageHistoryFilePath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_MESSAGE_HISTORY_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_MESSAGE_HISTORY_LIST;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
string Paths::getAvatarsDirpath () { string Paths::getAssistantConfigDirPath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_AVATARS); return getReadableDirPath(getAppAssistantConfigDirPath());
}
string Paths::getAvatarsDirPath () {
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_AVATARS);
} }
string Paths::getCallHistoryFilepath () { string Paths::getCallHistoryFilePath () {
return getWritableFilePath(getAppCallHistoryFilepath()); return getWritableFilePath(getAppCallHistoryFilePath());
} }
string Paths::getCapturesDirpath () { string Paths::getCapturesDirPath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES); return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
} }
string Paths::getConfigFilepath (const QString &configPath) { string Paths::getConfigFilePath (const QString &configPath) {
if (!configPath.isEmpty()) if (!configPath.isEmpty())
return getWritableFilePath(QFileInfo(configPath).absoluteFilePath()); return getWritableFilePath(QFileInfo(configPath).absoluteFilePath());
return getWritableFilePath(getAppConfigFilepath()); return getWritableFilePath(getAppConfigFilePath());
} }
string Paths::getFactoryConfigFilepath () { string Paths::getFactoryConfigFilePath () {
return getReadableFilePath(getAppFactoryConfigFilepath()); return getReadableFilePath(getAppFactoryConfigFilePath());
} }
string Paths::getFriendsListFilepath () { string Paths::getFriendsListFilePath () {
return getWritableFilePath(getAppFriendsFilepath()); return getWritableFilePath(getAppFriendsFilePath());
} }
string Paths::getLogsDirpath () { string Paths::getLogsDirPath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_LOGS); return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_LOGS);
} }
string Paths::getMessageHistoryFilepath () { string Paths::getMessageHistoryFilePath () {
return getWritableFilePath(getAppMessageHistoryFilepath()); return getWritableFilePath(getAppMessageHistoryFilePath());
} }
string Paths::getPackageDataDirpath () { string Paths::getPackageDataDirPath () {
return getReadableDirectoryPath(getAppPackageDataDirpath()); return getReadableDirPath(getAppPackageDataDirPath());
} }
string Paths::getPackageMsPluginsDirpath () { string Paths::getPackageMsPluginsDirPath () {
return getReadableDirectoryPath(getAppPackageMsPluginsDirpath()); return getReadableDirPath(getAppPackageMsPluginsDirPath());
} }
string Paths::getRootCaFilepath () { string Paths::getRootCaFilePath () {
return getReadableFilePath(getAppRootCaFilepath()); return getReadableFilePath(getAppRootCaFilePath());
} }
string Paths::getThumbnailsDirpath () { string Paths::getThumbnailsDirPath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS); return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS);
} }
string Paths::getUserCertificatesDirpath () { string Paths::getUserCertificatesDirPath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES); return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
} }
string Paths::getZrtpSecretsFilepath () { string Paths::getZrtpSecretsFilePath () {
return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_ZRTP_SECRETS); return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_ZRTP_SECRETS);
} }
...@@ -218,7 +227,7 @@ string Paths::getZrtpSecretsFilepath () { ...@@ -218,7 +227,7 @@ string Paths::getZrtpSecretsFilepath () {
static void migrateFile (const QString &oldPath, const QString &newPath) { static void migrateFile (const QString &oldPath, const QString &newPath) {
QFileInfo info(newPath); QFileInfo info(newPath);
ensureDirectoryPathExists(info.path()); ensureDirPathExists(info.path());
if (QFile::copy(oldPath, newPath)) { if (QFile::copy(oldPath, newPath)) {
QFile::remove(oldPath); QFile::remove(oldPath);
...@@ -230,7 +239,7 @@ static void migrateFile (const QString &oldPath, const QString &newPath) { ...@@ -230,7 +239,7 @@ static void migrateFile (const QString &oldPath, const QString &newPath) {
static void migrateConfigurationFile (const QString &oldPath, const QString &newPath) { static void migrateConfigurationFile (const QString &oldPath, const QString &newPath) {
QFileInfo info(newPath); QFileInfo info(newPath);
ensureDirectoryPathExists(info.path()); ensureDirPathExists(info.path());
if (QFile::copy(oldPath, newPath)) { if (QFile::copy(oldPath, newPath)) {
QFile oldFile(oldPath); QFile oldFile(oldPath);
...@@ -247,7 +256,7 @@ static void migrateConfigurationFile (const QString &oldPath, const QString &new ...@@ -247,7 +256,7 @@ static void migrateConfigurationFile (const QString &oldPath, const QString &new
} }
void Paths::migrate () { void Paths::migrate () {
QString newPath = getAppConfigFilepath(); QString newPath = getAppConfigFilePath();
QString oldBaseDir = QSysInfo::productType() == "windows" QString oldBaseDir = QSysInfo::productType() == "windows"
? QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) ? QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
: QStandardPaths::writableLocation(QStandardPaths::HomeLocation); : QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
...@@ -256,19 +265,19 @@ void Paths::migrate () { ...@@ -256,19 +265,19 @@ void Paths::migrate () {
if (!filePathExists(newPath) && filePathExists(oldPath)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateConfigurationFile(oldPath, newPath); migrateConfigurationFile(oldPath, newPath);
newPath = getAppCallHistoryFilepath(); newPath = getAppCallHistoryFilePath();
oldPath = oldBaseDir + "/.linphone-call-history.db"; oldPath = oldBaseDir + "/.linphone-call-history.db";
if (!filePathExists(newPath) && filePathExists(oldPath)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateFile(oldPath, newPath); migrateFile(oldPath, newPath);
newPath = getAppFriendsFilepath(); newPath = getAppFriendsFilePath();
oldPath = oldBaseDir + "/.linphone-friends.db"; oldPath = oldBaseDir + "/.linphone-friends.db";
if (!filePathExists(newPath) && filePathExists(oldPath)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateFile(oldPath, newPath); migrateFile(oldPath, newPath);
newPath = getAppMessageHistoryFilepath(); newPath = getAppMessageHistoryFilePath();
oldPath = oldBaseDir + "/.linphone-history.db"; oldPath = oldBaseDir + "/.linphone-history.db";
if (!filePathExists(newPath) && filePathExists(oldPath)) if (!filePathExists(newPath) && filePathExists(oldPath))
......
...@@ -30,21 +30,22 @@ ...@@ -30,21 +30,22 @@
// ============================================================================= // =============================================================================
namespace Paths { namespace Paths {
std::string getAvatarsDirpath (); std::string getAssistantConfigDirPath ();
std::string getCallHistoryFilepath (); std::string getAvatarsDirPath ();
std::string getCapturesDirpath (); std::string getCallHistoryFilePath ();
std::string getConfigFilepath (const QString &configPath = QString()); std::string getCapturesDirPath ();
std::string getFactoryConfigFilepath (); std::string getConfigFilePath (const QString &configPath = QString());
std::string getFriendsListFilepath (); std::string getFactoryConfigFilePath ();
std::string getLogsDirpath (); std::string getFriendsListFilePath ();
std::string getMessageHistoryFilepath (); std::string getLogsDirPath ();
std::string getPackageDataDirpath (); std::string getMessageHistoryFilePath ();
std::string getPackageMsPluginsDirpath (); std::string getPackageDataDirPath ();
std::string getRootCaFilepath (); std::string getPackageMsPluginsDirPath ();
std::string getThumbnailsDirpath (); std::string getRootCaFilePath ();
std::string getUserCertificatesDirpath (); std::string getThumbnailsDirPath ();
std::string getZrtpDataFilepath (); std::string getUserCertificatesDirPath ();
std::string getZrtpSecretsFilepath (); std::string getZrtpDataFilePath ();
std::string getZrtpSecretsFilePath ();
void migrate (); void migrate ();
} }
......
...@@ -33,7 +33,7 @@ AvatarProvider::AvatarProvider () : QQuickImageProvider( ...@@ -33,7 +33,7 @@ AvatarProvider::AvatarProvider () : QQuickImageProvider(
QQmlImageProviderBase::Image, QQmlImageProviderBase::Image,
QQmlImageProviderBase::ForceAsynchronousImageLoading QQmlImageProviderBase::ForceAsynchronousImageLoading
) { ) {
mAvatarsPath = Utils::linphoneStringToQString(Paths::getAvatarsDirpath()); mAvatarsPath = Utils::linphoneStringToQString(Paths::getAvatarsDirPath());
} }
QImage AvatarProvider::requestImage (const QString &id, QSize *, const QSize &) { QImage AvatarProvider::requestImage (const QString &id, QSize *, const QSize &) {
......
...@@ -33,7 +33,7 @@ ThumbnailProvider::ThumbnailProvider () : QQuickImageProvider( ...@@ -33,7 +33,7 @@ ThumbnailProvider::ThumbnailProvider () : QQuickImageProvider(
QQmlImageProviderBase::Image, QQmlImageProviderBase::Image,
QQmlImageProviderBase::ForceAsynchronousImageLoading QQmlImageProviderBase::ForceAsynchronousImageLoading
) { ) {
mThumbnailsPath = Utils::linphoneStringToQString(Paths::getThumbnailsDirpath()); mThumbnailsPath = Utils::linphoneStringToQString(Paths::getThumbnailsDirPath());
} }
QImage ThumbnailProvider::requestImage (const QString &id, QSize *, const QSize &) { QImage ThumbnailProvider::requestImage (const QString &id, QSize *, const QSize &) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* Author: Ronan Abhamon * Author: Ronan Abhamon
*/ */
#include "../../app/paths/Paths.hpp"
#include "../../Utils.hpp" #include "../../Utils.hpp"
#include "../core/CoreManager.hpp" #include "../core/CoreManager.hpp"
...@@ -287,6 +288,27 @@ void AssistantModel::setDisplayName (const QString &displayName) { ...@@ -287,6 +288,27 @@ void AssistantModel::setDisplayName (const QString &displayName) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
QString AssistantModel::getConfigFilename () const {
return mConfigFilename;
}
void AssistantModel::setConfigFilename (const QString &configFilename) {
mConfigFilename = configFilename;
QString configPath = ::Utils::linphoneStringToQString(Paths::getAssistantConfigDirPath()) + configFilename;
qInfo() << QStringLiteral("Set config on assistant: `%1`.").arg(configPath);
CoreManager::getInstance()->getCore()->getConfig()->loadFromXmlFile(
::Utils::qStringToLinphoneString(configPath),
nullptr,
nullptr
);
emit configFilenameChanged(configFilename);
}
// -----------------------------------------------------------------------------
QString AssistantModel::mapAccountCreatorUsernameStatusToString (linphone::AccountCreatorUsernameStatus status) const { QString AssistantModel::mapAccountCreatorUsernameStatusToString (linphone::AccountCreatorUsernameStatus status) const {
shared_ptr<linphone::Config> config = CoreManager::getInstance()->getCore()->getConfig(); shared_ptr<linphone::Config> config = CoreManager::getInstance()->getCore()->getConfig();
QString error; QString error;
......
...@@ -38,6 +38,7 @@ class AssistantModel : public QObject { ...@@ -38,6 +38,7 @@ class AssistantModel : public QObject {
Q_PROPERTY(QString phoneNumber READ getPhoneNumber WRITE setPhoneNumber NOTIFY phoneNumberChanged); Q_PROPERTY(QString phoneNumber READ getPhoneNumber WRITE setPhoneNumber NOTIFY phoneNumberChanged);
Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY usernameChanged); Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY usernameChanged);
Q_PROPERTY(QString displayName READ getDisplayName WRITE setDisplayName NOTIFY displayNameChanged); Q_PROPERTY(QString displayName READ getDisplayName WRITE setDisplayName NOTIFY displayNameChanged);
Q_PROPERTY(QString configFilename READ getConfigFilename WRITE setConfigFilename NOTIFY configFilenameChanged);
public: public:
AssistantModel (QObject *parent = Q_NULLPTR); AssistantModel (QObject *parent = Q_NULLPTR);
...@@ -59,6 +60,8 @@ signals: ...@@ -59,6 +60,8 @@ signals:
void createStatusChanged (const QString &error); void createStatusChanged (const QString &error);
void loginStatusChanged (const QString &error); void loginStatusChanged (const QString &error);
void configFilenameChanged (const QString &configFilename);
private: private:
QString getEmail () const; QString getEmail () const;
void setEmail (const QString &email); void setEmail (const QString &email);
...@@ -75,8 +78,13 @@ private: ...@@ -75,8 +78,13 @@ private:
QString getDisplayName () const; QString getDisplayName () const;
void setDisplayName (const QString &displayName); void setDisplayName (const QString &displayName);
QString getConfigFilename () const;
void setConfigFilename (const QString &configFilename);
QString mapAccountCreatorUsernameStatusToString (linphone::AccountCreatorUsernameStatus status) const; QString mapAccountCreatorUsernameStatusToString (linphone::AccountCreatorUsernameStatus status) const;
QString mConfigFilename;
std::shared_ptr<linphone::AccountCreator> mAccountCreator; std::shared_ptr<linphone::AccountCreator> mAccountCreator;
std::shared_ptr<Handlers> mHandlers; std::shared_ptr<Handlers> mHandlers;
}; };
......
...@@ -73,7 +73,7 @@ inline void createThumbnail (const shared_ptr<linphone::ChatMessage> &message) { ...@@ -73,7 +73,7 @@ inline void createThumbnail (const shared_ptr<linphone::ChatMessage> &message) {
QString uuid = QUuid::createUuid().toString(); QString uuid = QUuid::createUuid().toString();
QString fileId = QStringLiteral("%1.jpg").arg(uuid.mid(1, uuid.length() - 2)); QString fileId = QStringLiteral("%1.jpg").arg(uuid.mid(1, uuid.length() - 2));
if (!thumbnail.save(::Utils::linphoneStringToQString(Paths::getThumbnailsDirpath()) + fileId, "jpg", 100)) { if (!thumbnail.save(::Utils::linphoneStringToQString(Paths::getThumbnailsDirPath()) + fileId, "jpg", 100)) {
qWarning() << QStringLiteral("Unable to create thumbnail of: `%1`.").arg(thumbnailPath); qWarning() << QStringLiteral("Unable to create thumbnail of: `%1`.").arg(thumbnailPath);
return; return;
} }
...@@ -87,7 +87,7 @@ inline void removeFileMessageThumbnail (const shared_ptr<linphone::ChatMessage> ...@@ -87,7 +87,7 @@ inline void removeFileMessageThumbnail (const shared_ptr<linphone::ChatMessage>
string fileId = message->getAppdata(); string fileId = message->getAppdata();
if (!fileId.empty()) { if (!fileId.empty()) {
QString thumbnailPath = ::Utils::linphoneStringToQString(Paths::getThumbnailsDirpath() + fileId); QString thumbnailPath = ::Utils::linphoneStringToQString(Paths::getThumbnailsDirPath() + fileId);
if (!QFile::remove(thumbnailPath)) if (!QFile::remove(thumbnailPath))
qWarning() << QStringLiteral("Unable to remove `%1`.").arg(thumbnailPath); qWarning() << QStringLiteral("Unable to remove `%1`.").arg(thumbnailPath);
} }
......
...@@ -80,7 +80,7 @@ VcardModel::~VcardModel () { ...@@ -80,7 +80,7 @@ VcardModel::~VcardModel () {
QString imagePath( QString imagePath(
::Utils::linphoneStringToQString( ::Utils::linphoneStringToQString(
Paths::getAvatarsDirpath() + Paths::getAvatarsDirPath() +
photo->getValue().substr(sizeof(VCARD_SCHEME) - 1) photo->getValue().substr(sizeof(VCARD_SCHEME) - 1)
) )
); );
...@@ -134,7 +134,7 @@ bool VcardModel::setAvatar (const QString &path) { ...@@ -134,7 +134,7 @@ bool VcardModel::setAvatar (const QString &path) {
.arg(uuid.mid(1, uuid.length() - 2)) // Remove `{}`. .arg(uuid.mid(1, uuid.length() - 2)) // Remove `{}`.
.arg(info.suffix()); .arg(info.suffix());
QString dest = ::Utils::linphoneStringToQString(Paths::getAvatarsDirpath()) + fileId; QString dest = ::Utils::linphoneStringToQString(Paths::getAvatarsDirPath()) + fileId;
if (!file.copy(dest)) if (!file.copy(dest))
return false; return false;
...@@ -150,7 +150,7 @@ bool VcardModel::setAvatar (const QString &path) { ...@@ -150,7 +150,7 @@ bool VcardModel::setAvatar (const QString &path) {
if (oldPhoto) { if (oldPhoto) {
QString imagePath( QString imagePath(
::Utils::linphoneStringToQString( ::Utils::linphoneStringToQString(
Paths::getAvatarsDirpath() + oldPhoto->getValue().substr(sizeof(VCARD_SCHEME) - 1) Paths::getAvatarsDirPath() + oldPhoto->getValue().substr(sizeof(VCARD_SCHEME) - 1)
) )
); );
......
...@@ -87,26 +87,26 @@ void CoreManager::forceRefreshRegisters () { ...@@ -87,26 +87,26 @@ void CoreManager::forceRefreshRegisters () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CoreManager::setDatabasesPaths () { void CoreManager::setDatabasesPaths () {
mCore->setFriendsDatabasePath(Paths::getFriendsListFilepath()); mCore->setFriendsDatabasePath(Paths::getFriendsListFilePath());
mCore->setCallLogsDatabasePath(Paths::getCallHistoryFilepath()); mCore->setCallLogsDatabasePath(Paths::getCallHistoryFilePath());
mCore->setChatDatabasePath(Paths::getMessageHistoryFilepath()); mCore->setChatDatabasePath(Paths::getMessageHistoryFilePath());
} }
void CoreManager::setOtherPaths () { void CoreManager::setOtherPaths () {
if (mCore->getZrtpSecretsFile().empty()) if (mCore->getZrtpSecretsFile().empty())
mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilepath()); mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath());
if (mCore->getUserCertificatesPath().empty()) if (mCore->getUserCertificatesPath().empty())
mCore->setUserCertificatesPath(Paths::getUserCertificatesDirpath()); mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath());
if (mCore->getRootCa().empty()) if (mCore->getRootCa().empty())
mCore->setRootCa(Paths::getRootCaFilepath()); mCore->setRootCa(Paths::getRootCaFilePath());
} }
void CoreManager::setResourcesPaths () { void CoreManager::setResourcesPaths () {
shared_ptr<linphone::Factory> factory = linphone::Factory::get(); shared_ptr<linphone::Factory> factory = linphone::Factory::get();
factory->setMspluginsDir(Paths::getPackageMsPluginsDirpath()); factory->setMspluginsDir(Paths::getPackageMsPluginsDirPath());
factory->setTopResourcesDir(Paths::getPackageDataDirpath()); factory->setTopResourcesDir(Paths::getPackageDataDirPath());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -119,7 +119,7 @@ void CoreManager::createLinphoneCore (const QString &configPath) { ...@@ -119,7 +119,7 @@ void CoreManager::createLinphoneCore (const QString &configPath) {
setResourcesPaths(); setResourcesPaths();
mCore = linphone::Factory::get()->createCore(mHandlers, Paths::getConfigFilepath(configPath), Paths::getFactoryConfigFilepath()); mCore = linphone::Factory::get()->createCore(mHandlers, Paths::getConfigFilePath(configPath), Paths::getFactoryConfigFilePath());
mCore->setVideoDisplayFilter("MSOGL"); mCore->setVideoDisplayFilter("MSOGL");
mCore->usePreviewWindow(true); mCore->usePreviewWindow(true);
......
...@@ -617,7 +617,7 @@ void SettingsModel::setDscpVideo (int dscp) { ...@@ -617,7 +617,7 @@ void SettingsModel::setDscpVideo (int dscp) {
QString SettingsModel::getSavedScreenshotsFolder () const { QString SettingsModel::getSavedScreenshotsFolder () const {
return QDir::cleanPath( return QDir::cleanPath(
::Utils::linphoneStringToQString( ::Utils::linphoneStringToQString(
mConfig->getString(UI_SECTION, "saved_screenshots_folder", Paths::getCapturesDirpath()) mConfig->getString(UI_SECTION, "saved_screenshots_folder", Paths::getCapturesDirPath())
) )
) + QDir::separator(); ) + QDir::separator();
} }
...@@ -634,7 +634,7 @@ void SettingsModel::setSavedScreenshotsFolder (const QString &folder) { ...@@ -634,7 +634,7 @@ void SettingsModel::setSavedScreenshotsFolder (const QString &folder) {
QString SettingsModel::getSavedVideosFolder () const { QString SettingsModel::getSavedVideosFolder () const {
return QDir::cleanPath( return QDir::cleanPath(
::Utils::linphoneStringToQString( ::Utils::linphoneStringToQString(
mConfig->getString(UI_SECTION, "saved_videos_folder", Paths::getCapturesDirpath()) mConfig->getString(UI_SECTION, "saved_videos_folder", Paths::getCapturesDirPath())
) )
) + QDir::separator(); ) + QDir::separator();
} }
......
linphone @ fa2dad63
Subproject commit b3df86baf28d846a98b19983a6b28cb93ad9bdb7 Subproject commit fa2dad63d40078b423bfd9c2a56c59a606e81ed5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment