mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-06 08:51:22 +02:00
Merge pull request #14690 from sethalves/plugin-versioning
Plugin versioning
This commit is contained in:
commit
6cd5770505
16 changed files with 80 additions and 38 deletions
|
@ -724,6 +724,8 @@ const QString TEST_RESULTS_LOCATION_COMMAND{ "--testResultsLocation" };
|
||||||
bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
const char** constArgv = const_cast<const char**>(argv);
|
const char** constArgv = const_cast<const char**>(argv);
|
||||||
|
|
||||||
|
qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
// HRS: I could not figure out how to move these any earlier in startup, so when using this option, be sure to also supply
|
// HRS: I could not figure out how to move these any earlier in startup, so when using this option, be sure to also supply
|
||||||
// --allowMultipleInstances
|
// --allowMultipleInstances
|
||||||
auto reportAndQuit = [&](const char* commandSwitch, std::function<void(FILE* fp)> report) {
|
auto reportAndQuit = [&](const char* commandSwitch, std::function<void(FILE* fp)> report) {
|
||||||
|
@ -974,6 +976,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new MainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
_sessionRunTimer(startupTimer),
|
_sessionRunTimer(startupTimer),
|
||||||
|
_logger(new FileLogger(this)),
|
||||||
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
|
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
|
||||||
_entitySimulation(new PhysicalEntitySimulation()),
|
_entitySimulation(new PhysicalEntitySimulation()),
|
||||||
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
||||||
|
@ -1063,9 +1066,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_logger = new FileLogger(this);
|
|
||||||
qInstallMessageHandler(messageHandler);
|
|
||||||
|
|
||||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
||||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/fontawesome-webfont.ttf");
|
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/fontawesome-webfont.ttf");
|
||||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/hifi-glyphs.ttf");
|
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/hifi-glyphs.ttf");
|
||||||
|
|
|
@ -594,6 +594,8 @@ private:
|
||||||
|
|
||||||
bool _aboutToQuit { false };
|
bool _aboutToQuit { false };
|
||||||
|
|
||||||
|
FileLogger* _logger { nullptr };
|
||||||
|
|
||||||
bool _previousSessionCrashed;
|
bool _previousSessionCrashed;
|
||||||
|
|
||||||
DisplayPluginPointer _displayPlugin;
|
DisplayPluginPointer _displayPlugin;
|
||||||
|
@ -674,8 +676,6 @@ private:
|
||||||
QPointer<EntityScriptServerLogDialog> _entityScriptServerLogDialog;
|
QPointer<EntityScriptServerLogDialog> _entityScriptServerLogDialog;
|
||||||
QDir _defaultScriptsLocation;
|
QDir _defaultScriptsLocation;
|
||||||
|
|
||||||
FileLogger* _logger;
|
|
||||||
|
|
||||||
TouchEvent _lastTouchEvent;
|
TouchEvent _lastTouchEvent;
|
||||||
|
|
||||||
quint64 _lastNackTime;
|
quint64 _lastNackTime;
|
||||||
|
|
|
@ -44,33 +44,24 @@ PluginManagerPointer PluginManager::getInstance() {
|
||||||
return DependencyManager::get<PluginManager>();
|
return DependencyManager::get<PluginManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getPluginNameFromMetaData(QJsonObject object) {
|
QString getPluginNameFromMetaData(const QJsonObject& object) {
|
||||||
static const char* METADATA_KEY = "MetaData";
|
static const char* METADATA_KEY = "MetaData";
|
||||||
static const char* NAME_KEY = "name";
|
static const char* NAME_KEY = "name";
|
||||||
|
return object[METADATA_KEY][NAME_KEY].toString("");
|
||||||
if (!object.contains(METADATA_KEY) || !object[METADATA_KEY].isObject()) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto metaDataObject = object[METADATA_KEY].toObject();
|
|
||||||
|
|
||||||
if (!metaDataObject.contains(NAME_KEY) || !metaDataObject[NAME_KEY].isString()) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return metaDataObject[NAME_KEY].toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getPluginIIDFromMetaData(QJsonObject object) {
|
QString getPluginIIDFromMetaData(const QJsonObject& object) {
|
||||||
static const char* IID_KEY = "IID";
|
static const char* IID_KEY = "IID";
|
||||||
|
return object[IID_KEY].toString("");
|
||||||
if (!object.contains(IID_KEY) || !object[IID_KEY].isString()) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return object[IID_KEY].toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getPluginInterfaceVersionFromMetaData(const QJsonObject& object) {
|
||||||
|
static const QString METADATA_KEY = "MetaData";
|
||||||
|
static const QString NAME_KEY = "version";
|
||||||
|
return object[METADATA_KEY][NAME_KEY].toInt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList preferredDisplayPlugins;
|
QStringList preferredDisplayPlugins;
|
||||||
QStringList disabledDisplays;
|
QStringList disabledDisplays;
|
||||||
QStringList disabledInputs;
|
QStringList disabledInputs;
|
||||||
|
@ -117,10 +108,16 @@ const LoaderList& getLoadedPlugins() {
|
||||||
QSharedPointer<QPluginLoader> loader(new QPluginLoader(pluginPath + plugin));
|
QSharedPointer<QPluginLoader> loader(new QPluginLoader(pluginPath + plugin));
|
||||||
|
|
||||||
if (isDisabled(loader->metaData())) {
|
if (isDisabled(loader->metaData())) {
|
||||||
qWarning() << "Plugin" << qPrintable(plugin) << "is disabled";
|
qCWarning(plugins) << "Plugin" << qPrintable(plugin) << "is disabled";
|
||||||
// Skip this one, it's disabled
|
// Skip this one, it's disabled
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (getPluginInterfaceVersionFromMetaData(loader->metaData()) != HIFI_PLUGIN_INTERFACE_VERSION) {
|
||||||
|
qCWarning(plugins) << "Plugin" << qPrintable(plugin) << "interface version doesn't match, not loading:"
|
||||||
|
<< getPluginInterfaceVersionFromMetaData(loader->metaData())
|
||||||
|
<< "doesn't match" << HIFI_PLUGIN_INTERFACE_VERSION;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (loader->load()) {
|
if (loader->load()) {
|
||||||
qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "loaded successfully";
|
qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "loaded successfully";
|
||||||
|
|
|
@ -61,3 +61,12 @@ private:
|
||||||
DisplayPluginList _displayPlugins;
|
DisplayPluginList _displayPlugins;
|
||||||
InputPluginList _inputPlugins;
|
InputPluginList _inputPlugins;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: we should define this value in CMake, and then use CMake
|
||||||
|
// templating to generate the individual plugin.json files, so that we
|
||||||
|
// don't have to update every plugin.json file whenever we update this
|
||||||
|
// value. The value should match "version" in
|
||||||
|
// plugins/*/src/plugin.json
|
||||||
|
// plugins/oculus/src/oculus.json
|
||||||
|
// etc
|
||||||
|
static const int HIFI_PLUGIN_INTERFACE_VERSION = 1;
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"HiFi 4:1 Audio Codec"}
|
{
|
||||||
|
"name":"HiFi 4:1 Audio Codec",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Kinect"}
|
{
|
||||||
|
"name":"Kinect",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Leap Motion"}
|
{
|
||||||
|
"name":"Leap Motion",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Neuron"}
|
{
|
||||||
|
"name":"Neuron",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"SDL2"}
|
{
|
||||||
|
"name":"SDL2",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Sixense"}
|
{
|
||||||
|
"name":"Sixense",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Spacemouse"}
|
{
|
||||||
|
"name":"Spacemouse",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Oculus Rift"}
|
{
|
||||||
|
"name":"Oculus Rift",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Oculus Rift"}
|
{
|
||||||
|
"name":"Oculus Rift",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"OpenVR (Vive)"}
|
{
|
||||||
|
"name":"OpenVR (Vive)",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"PCM Codec"}
|
{
|
||||||
|
"name":"PCM Codec",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{"name":"Steam Client"}
|
{
|
||||||
|
"name":"Steam Client",
|
||||||
|
"version":1
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue