mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 12:54:30 +02:00
Separate plugin initialization, allow dumping plugin info
This commit is contained in:
parent
57e1c99fff
commit
b9662e5af8
3 changed files with 69 additions and 8 deletions
|
@ -764,14 +764,12 @@ bool setupEssentials(const QCommandLineParser& parser, bool runningMarkerExisted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the plugin manager about our statically linked plugins
|
|
||||||
|
|
||||||
DependencyManager::set<ScriptInitializers>();
|
DependencyManager::set<ScriptInitializers>();
|
||||||
DependencyManager::set<PluginManager>();
|
|
||||||
|
// Tell the plugin manager about our statically linked plugins
|
||||||
auto pluginManager = PluginManager::getInstance();
|
auto pluginManager = PluginManager::getInstance();
|
||||||
pluginManager->setInputPluginProvider([] { return getInputPlugins(); });
|
|
||||||
pluginManager->setDisplayPluginProvider([] { return getDisplayPlugins(); });
|
|
||||||
pluginManager->setInputPluginSettingsPersister([](const InputPluginList& plugins) { saveInputPluginSettings(plugins); });
|
|
||||||
if (auto steamClient = pluginManager->getSteamClientPlugin()) {
|
if (auto steamClient = pluginManager->getSteamClientPlugin()) {
|
||||||
steamClient->init();
|
steamClient->init();
|
||||||
}
|
}
|
||||||
|
@ -1040,8 +1038,12 @@ Application::Application(
|
||||||
DependencyManager::set<PathUtils>();
|
DependencyManager::set<PathUtils>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initializePlugins() {
|
void Application::initializePluginManager() {
|
||||||
|
DependencyManager::set<PluginManager>();
|
||||||
|
auto pluginManager = PluginManager::getInstance();
|
||||||
|
pluginManager->setInputPluginProvider([] { return getInputPlugins(); });
|
||||||
|
pluginManager->setDisplayPluginProvider([] { return getDisplayPlugins(); });
|
||||||
|
pluginManager->setInputPluginSettingsPersister([](const InputPluginList& plugins) { saveInputPluginSettings(plugins); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initialize(const QCommandLineParser &parser) {
|
void Application::initialize(const QCommandLineParser &parser) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Application : public QApplication,
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void initializePlugins();
|
void initializePluginManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize everything
|
* @brief Initialize everything
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <NetworkAccessManager.h>
|
#include <NetworkAccessManager.h>
|
||||||
#include <gl/GLHelpers.h>
|
#include <gl/GLHelpers.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -33,6 +34,9 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Profile.h"
|
#include "Profile.h"
|
||||||
#include "LogHandler.h"
|
#include "LogHandler.h"
|
||||||
|
#include <plugins/PluginManager.h>
|
||||||
|
#include <plugins/DisplayPlugin.h>
|
||||||
|
#include <plugins/CodecPlugin.h>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -63,6 +67,7 @@ int main(int argc, const char* argv[]) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Setup QCoreApplication settings, install log message handler
|
||||||
setupHifiApplication(BuildInfo::INTERFACE_NAME);
|
setupHifiApplication(BuildInfo::INTERFACE_NAME);
|
||||||
|
|
||||||
// Journald by default in user applications is probably a bit too modern still.
|
// Journald by default in user applications is probably a bit too modern still.
|
||||||
|
@ -258,6 +263,10 @@ int main(int argc, const char* argv[]) {
|
||||||
"Logging options, comma separated: color,nocolor,process_id,thread_id,milliseconds,keep_repeats,journald,nojournald",
|
"Logging options, comma separated: color,nocolor,process_id,thread_id,milliseconds,keep_repeats,journald,nojournald",
|
||||||
"options"
|
"options"
|
||||||
);
|
);
|
||||||
|
QCommandLineOption getPluginsOption(
|
||||||
|
"getPlugins",
|
||||||
|
"Print out a list of plugins in JSON"
|
||||||
|
);
|
||||||
QCommandLineOption abortAfterStartupOption(
|
QCommandLineOption abortAfterStartupOption(
|
||||||
"abortAfterStartup",
|
"abortAfterStartup",
|
||||||
"Debug option. Aborts right after startup."
|
"Debug option. Aborts right after startup."
|
||||||
|
@ -311,6 +320,7 @@ int main(int argc, const char* argv[]) {
|
||||||
parser.addOption(logOption);
|
parser.addOption(logOption);
|
||||||
parser.addOption(abortAfterStartupOption);
|
parser.addOption(abortAfterStartupOption);
|
||||||
parser.addOption(abortAfterInitOption);
|
parser.addOption(abortAfterInitOption);
|
||||||
|
parser.addOption(getPluginsOption);
|
||||||
|
|
||||||
|
|
||||||
QString applicationPath;
|
QString applicationPath;
|
||||||
|
@ -355,6 +365,55 @@ int main(int argc, const char* argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.initializePluginManager();
|
||||||
|
|
||||||
|
if (parser.isSet(getPluginsOption)) {
|
||||||
|
auto pluginManager = PluginManager::getInstance();
|
||||||
|
|
||||||
|
QJsonObject inputJson;
|
||||||
|
for (const auto &plugin : pluginManager->getInputPlugins()) {
|
||||||
|
QJsonObject data;
|
||||||
|
data["subdeviceNames"] = QJsonArray::fromStringList(plugin->getSubdeviceNames());
|
||||||
|
data["deviceName"] = plugin->getDeviceName();
|
||||||
|
data["configurable"] = plugin->configurable();
|
||||||
|
data["isHandController"] = plugin->isHandController();
|
||||||
|
data["isHeadController"] = plugin->isHeadController();
|
||||||
|
|
||||||
|
inputJson[plugin->getName()] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject displayJson;
|
||||||
|
for (const auto &plugin : pluginManager->getDisplayPlugins()) {
|
||||||
|
QJsonObject data;
|
||||||
|
data["isHmd"] = plugin->isHmd();
|
||||||
|
data["isStereo"] = plugin->isStereo();
|
||||||
|
data["targetFramerate"] = plugin->getTargetFrameRate();
|
||||||
|
data["hasAsyncReprojection"] = plugin->hasAsyncReprojection();
|
||||||
|
|
||||||
|
displayJson[plugin->getName()] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonArray codecsArray;
|
||||||
|
for (const auto &plugin : pluginManager->getCodecPlugins()) {
|
||||||
|
codecsArray.append(plugin->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject staticJson;
|
||||||
|
staticJson["steamAvailable"] = (pluginManager->getSteamClientPlugin() == nullptr);
|
||||||
|
staticJson["oculusAvailable"] = (pluginManager->getOculusPlatformPlugin() == nullptr);
|
||||||
|
|
||||||
|
QJsonObject root;
|
||||||
|
root["input"] = inputJson;
|
||||||
|
root["display"] = displayJson;
|
||||||
|
root["codec"] = codecsArray;
|
||||||
|
root["staticPlugins"] = staticJson;
|
||||||
|
|
||||||
|
std::cout << QJsonDocument(root).toJson().toStdString() << "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Act on arguments for early termination.
|
// Act on arguments for early termination.
|
||||||
if (parser.isSet(versionOption)) {
|
if (parser.isSet(versionOption)) {
|
||||||
parser.showVersion();
|
parser.showVersion();
|
||||||
|
|
Loading…
Reference in a new issue