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