mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +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) {
|
||||
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
|
||||
// --allowMultipleInstances
|
||||
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),
|
||||
_window(new MainWindow(desktop())),
|
||||
_sessionRunTimer(startupTimer),
|
||||
_logger(new FileLogger(this)),
|
||||
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
|
||||
_entitySimulation(new PhysicalEntitySimulation()),
|
||||
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
||||
|
@ -1063,9 +1066,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||
#endif
|
||||
|
||||
_logger = new FileLogger(this);
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/fontawesome-webfont.ttf");
|
||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/hifi-glyphs.ttf");
|
||||
|
|
|
@ -594,6 +594,8 @@ private:
|
|||
|
||||
bool _aboutToQuit { false };
|
||||
|
||||
FileLogger* _logger { nullptr };
|
||||
|
||||
bool _previousSessionCrashed;
|
||||
|
||||
DisplayPluginPointer _displayPlugin;
|
||||
|
@ -674,8 +676,6 @@ private:
|
|||
QPointer<EntityScriptServerLogDialog> _entityScriptServerLogDialog;
|
||||
QDir _defaultScriptsLocation;
|
||||
|
||||
FileLogger* _logger;
|
||||
|
||||
TouchEvent _lastTouchEvent;
|
||||
|
||||
quint64 _lastNackTime;
|
||||
|
|
|
@ -44,33 +44,24 @@ PluginManagerPointer PluginManager::getInstance() {
|
|||
return DependencyManager::get<PluginManager>();
|
||||
}
|
||||
|
||||
QString getPluginNameFromMetaData(QJsonObject object) {
|
||||
QString getPluginNameFromMetaData(const QJsonObject& object) {
|
||||
static const char* METADATA_KEY = "MetaData";
|
||||
static const char* NAME_KEY = "name";
|
||||
|
||||
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();
|
||||
return object[METADATA_KEY][NAME_KEY].toString("");
|
||||
}
|
||||
|
||||
QString getPluginIIDFromMetaData(QJsonObject object) {
|
||||
QString getPluginIIDFromMetaData(const QJsonObject& object) {
|
||||
static const char* IID_KEY = "IID";
|
||||
|
||||
if (!object.contains(IID_KEY) || !object[IID_KEY].isString()) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
return object[IID_KEY].toString();
|
||||
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 disabledDisplays;
|
||||
QStringList disabledInputs;
|
||||
|
@ -117,10 +108,16 @@ const LoaderList& getLoadedPlugins() {
|
|||
QSharedPointer<QPluginLoader> loader(new QPluginLoader(pluginPath + plugin));
|
||||
|
||||
if (isDisabled(loader->metaData())) {
|
||||
qWarning() << "Plugin" << qPrintable(plugin) << "is disabled";
|
||||
qCWarning(plugins) << "Plugin" << qPrintable(plugin) << "is disabled";
|
||||
// Skip this one, it's disabled
|
||||
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()) {
|
||||
qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "loaded successfully";
|
||||
|
|
|
@ -61,3 +61,12 @@ private:
|
|||
DisplayPluginList _displayPlugins;
|
||||
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