Commit 73e0f0b7 authored by Wescoeur's avatar Wescoeur

feat(App): add an app directory for plugins

parent 8c2943d6
......@@ -158,13 +158,17 @@ void App::initContentApp () {
// Don't quit if last window is closed!!!
setQuitOnLastWindowClosed(false);
// Deal with received messages and CLI.
mCli = new Cli(this);
QObject::connect(this, &App::receivedMessage, this, [this](int, const QByteArray &byteArray) {
QString command(byteArray);
qInfo() << QStringLiteral("Received command from other application: `%1`.").arg(command);
executeCommand(command);
mCli->executeCommand(command);
});
mCli = new Cli(this);
// Add plugins directory.
addLibraryPath(::Utils::coreStringToAppString(Paths::getPluginsDirPath()));
qInfo() << QStringLiteral("Library paths:") << libraryPaths();
}
// Init core.
......@@ -236,12 +240,6 @@ QString App::getCommandArgument () {
// -----------------------------------------------------------------------------
void App::executeCommand (const QString &command) {
mCli->executeCommand(command);
}
// -----------------------------------------------------------------------------
QQuickWindow *App::getCallsWindow () {
if (!mCallsWindow)
mCallsWindow = ::createSubWindow(mEngine, QML_VIEW_CALLS_WINDOW);
......@@ -551,7 +549,7 @@ void App::openAppAfterInit () {
{
const QString commandArgument = getCommandArgument();
if (!commandArgument.isEmpty())
executeCommand(commandArgument);
mCli->executeCommand(commandArgument);
}
#ifdef ENABLE_UPDATE_CHECK
......
......@@ -54,7 +54,6 @@ public:
void initContentApp ();
QString getCommandArgument ();
void executeCommand (const QString &command);
QQmlEngine *getEngine () {
return mEngine;
......
......@@ -37,6 +37,7 @@
#define PATH_AVATARS "/avatars/"
#define PATH_CAPTURES "/Linphone/captures/"
#define PATH_LOGS "/logs/"
#define PATH_PLUGINS "/plugins/"
#define PATH_THUMBNAILS "/thumbnails/"
#define PATH_USER_CERTIFICATES "/usr-crt/"
......@@ -139,6 +140,10 @@ inline QString getAppFactoryConfigFilePath () {
return ::getAppPackageDataDirPath() + PATH_FACTORY_CONFIG;
}
inline QString getAppPluginsDirPath () {
return ::getAppPackageDataDirPath() + PATH_PLUGINS;
}
inline QString getAppRootCaFilePath () {
return ::getAppPackageDataDirPath() + PATH_ROOT_CA;
}
......@@ -211,6 +216,10 @@ string Paths::getPackageMsPluginsDirPath () {
return ::getReadableDirPath(::getAppPackageMsPluginsDirPath());
}
string Paths::getPluginsDirPath () {
return ::getWritableDirPath(::getAppPluginsDirPath());
}
string Paths::getRootCaFilePath () {
return ::getReadableFilePath(::getAppRootCaFilePath());
}
......
......@@ -30,27 +30,28 @@
// =============================================================================
namespace Paths {
bool filePathExists (const std::string &path);
std::string getAssistantConfigDirPath ();
std::string getAvatarsDirPath ();
std::string getCallHistoryFilePath ();
std::string getCapturesDirPath ();
std::string getConfigFilePath (const QString &configPath = QString(), bool writable = true);
std::string getFactoryConfigFilePath ();
std::string getFriendsListFilePath ();
std::string getDownloadDirPath ();
std::string getLogsDirPath ();
std::string getMessageHistoryFilePath ();
std::string getPackageDataDirPath ();
std::string getPackageMsPluginsDirPath ();
std::string getRootCaFilePath ();
std::string getThumbnailsDirPath ();
std::string getUserCertificatesDirPath ();
std::string getZrtpDataFilePath ();
std::string getZrtpSecretsFilePath ();
void migrate ();
bool filePathExists (const std::string &path);
std::string getAssistantConfigDirPath ();
std::string getAvatarsDirPath ();
std::string getCallHistoryFilePath ();
std::string getCapturesDirPath ();
std::string getConfigFilePath (const QString &configPath = QString(), bool writable = true);
std::string getFactoryConfigFilePath ();
std::string getFriendsListFilePath ();
std::string getDownloadDirPath ();
std::string getLogsDirPath ();
std::string getMessageHistoryFilePath ();
std::string getPackageDataDirPath ();
std::string getPackageMsPluginsDirPath ();
std::string getPluginsDirPath ();
std::string getRootCaFilePath ();
std::string getThumbnailsDirPath ();
std::string getUserCertificatesDirPath ();
std::string getZrtpDataFilePath ();
std::string getZrtpSecretsFilePath ();
void migrate ();
}
#endif // PATHS_H_
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