mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-24 07:55:35 +08:00
Ref T103, plugin directory now from CDirectoryUtils::pluginDirectory()
Hence we can use const QString & like const QString &CPluginManagerWeatherData::pluginDirectory()
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a9198e4f13
commit
3245ff4ef4
@@ -50,9 +50,9 @@ namespace BlackCore
|
||||
return m_configs.contains(identifier) ? m_configs.value(identifier) : QString();
|
||||
}
|
||||
|
||||
QString IPluginManager::pluginDirectory() const
|
||||
const QString &IPluginManager::pluginDirectory() const
|
||||
{
|
||||
return CDirectoryUtils::binDirectory() % QStringLiteral("/plugins");
|
||||
return CDirectoryUtils::pluginsDirectory();
|
||||
}
|
||||
|
||||
bool IPluginManager::isValid(const QJsonObject &metadata) const
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BlackCore
|
||||
|
||||
//! Where to look for plugins, absolute path.
|
||||
//! Default implementation returns `plugins` in the application dir.
|
||||
virtual QString pluginDirectory() const;
|
||||
virtual const QString &pluginDirectory() const;
|
||||
|
||||
//! Defines whether the given plugin is valid or not, based on its metadata.
|
||||
//! The default implementation checks if all values common for all plugins
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
@@ -88,7 +87,8 @@ namespace BlackCore
|
||||
for (const QJsonObject &json : plugins)
|
||||
{
|
||||
QString iid = json["IID"].toString();
|
||||
if (iid == QStringLiteral("org.swift-project.blackcore.simulatorinterface")) {
|
||||
if (iid == QStringLiteral("org.swift-project.blackcore.simulatorinterface"))
|
||||
{
|
||||
auto it = m_plugins.insert(pluginIdentifier(json), {});
|
||||
it->info.convertFromJson(json);
|
||||
}
|
||||
@@ -97,14 +97,16 @@ namespace BlackCore
|
||||
|
||||
BlackMisc::CSequence<QString> CPluginManagerSimulator::acceptedIids() const
|
||||
{
|
||||
return {
|
||||
return
|
||||
{
|
||||
QStringLiteral("org.swift-project.blackcore.simulatorinterface"),
|
||||
QStringLiteral("org.swift-project.blackgui.pluginconfiginterface")
|
||||
};
|
||||
}
|
||||
|
||||
QString CPluginManagerSimulator::pluginDirectory() const
|
||||
const QString &CPluginManagerSimulator::pluginDirectory() const
|
||||
{
|
||||
return CDirectoryUtils::binDirectory() % QStringLiteral("/plugins/simulator");
|
||||
static const QString d(CFileUtils::appendFilePaths(CDirectoryUtils::pluginsDirectory(), "simulator"));
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace BlackCore
|
||||
virtual BlackMisc::CSequence<QString> acceptedIids() const override;
|
||||
|
||||
//! \copydoc BlackCore::IPluginManager::pluginDirectory()
|
||||
virtual QString pluginDirectory() const override;
|
||||
virtual const QString &pluginDirectory() const override;
|
||||
|
||||
private:
|
||||
/*!
|
||||
|
||||
@@ -65,9 +65,9 @@ namespace BlackCore
|
||||
};
|
||||
}
|
||||
|
||||
QString CPluginManagerWeatherData::pluginDirectory() const
|
||||
const QString &CPluginManagerWeatherData::pluginDirectory() const
|
||||
{
|
||||
return CDirectoryUtils::binDirectory() % QStringLiteral("/plugins/weatherdata");
|
||||
static const QString d(CFileUtils::appendFilePaths(CDirectoryUtils::pluginsDirectory(), "weatherdata"));
|
||||
return d;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <QString>
|
||||
|
||||
namespace BlackMisc { class CVariant; }
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
class IWeatherDataFactory;
|
||||
@@ -33,7 +32,7 @@ namespace BlackCore
|
||||
* Manages plugins of type WeatherData.
|
||||
*/
|
||||
class BLACKCORE_EXPORT CPluginManagerWeatherData :
|
||||
public BlackCore::IPluginManager
|
||||
public BlackCore::IPluginManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -55,7 +54,7 @@ namespace BlackCore
|
||||
virtual BlackMisc::CSequence<QString> acceptedIids() const override;
|
||||
|
||||
//! \copydoc BlackCore::IPluginManager::pluginDirectory()
|
||||
virtual QString pluginDirectory() const override;
|
||||
virtual const QString &pluginDirectory() const override;
|
||||
|
||||
private:
|
||||
//! Extended data for plugin
|
||||
@@ -66,7 +65,6 @@ namespace BlackCore
|
||||
|
||||
QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -39,6 +39,12 @@ namespace BlackMisc
|
||||
return binDir;
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::pluginsDirectory()
|
||||
{
|
||||
static const QString pDir(CFileUtils::appendFilePaths(binDirectory(), "plugins"));
|
||||
return pDir;
|
||||
}
|
||||
|
||||
QString normalizedApplicationDirectoryImpl()
|
||||
{
|
||||
QString appDir = CDirectoryUtils::binDirectory();
|
||||
|
||||
@@ -31,6 +31,9 @@ namespace BlackMisc
|
||||
//! \see https://dev.swift-project.org/w/dev/swiftpc/dirstructure/
|
||||
static const QString &binDirectory();
|
||||
|
||||
//! Plugins directory
|
||||
static const QString &pluginsDirectory();
|
||||
|
||||
//! swift application data directory, contains 0..n swift installation directories
|
||||
static const QString &applicationDataDirectory();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user