aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp47
1 files changed, 12 insertions, 35 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3394a84..e04f58a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -98,35 +98,6 @@ int main(int argc, char **argv)
return -1;
}
- QVector<QPluginLoader *> plugins;
- CommandHash_t pluginCommands;
-
- // Load plugins
- [&]() {
- Configuration conf;
- spdlog::debug("plugins.path={}", conf.value<std::string>("plugins.path").value());
-
- const PluginLoader::SignatureState state(
- conf.value<bool>("plugins.signature.ignored").value(),
- conf.value<bool>("plugins.signature.checked").value(),
- conf.value<bool>("plugins.signature.enforced").value());
-
- for(const QString &path : Util::files(conf.value<QString>("plugins.path").value(), { "*.so", "*.dll" })) {
- auto *loader = new PluginLoader(path, state);
- const bool loaded = loader->load();
- spdlog::info("{} plugin {}", loaded ? "Loaded" : "Failed to load", qUtf8Printable(path));
-
- if(loaded) {
- plugins.append(loader);
- auto *plugin = qobject_cast<PluginInterface *>(loader->instance());
- pluginCommands.unite(plugin->commands());
- } else {
- spdlog::warn("{}", qUtf8Printable(loader->errorString()));
- delete loader;
- }
- }
- }();
-
// argc, argv, allowSecondary
Browser app(argc, argv);
// set this, otherwise the webview becomes black when using a stylesheet
@@ -134,6 +105,7 @@ int main(int argc, char **argv)
{
Configuration conf;
+
if(conf.value<bool>("usebreakpad").value()) {
CrashHandler::Context ctx(
conf.value<std::string>("path.crashdump").value(),
@@ -145,6 +117,15 @@ int main(int argc, char **argv)
spdlog::warn("Failed to install breakpad crash handler: {}", ctx.dumppath);
}
}
+
+ // load plugins
+ app.loadPlugins(Util::files(conf.value<QString>("plugins.path").value(), { "*.so", "*.dll" }),
+ [](const auto *loader) {
+ if(loader->isLoaded())
+ spdlog::info("Loaded plugin [{}]", qUtf8Printable(loader->fileName()));
+ else
+ spdlog::warn("Loading plugin [{}] failed: {}", qUtf8Printable(loader->fileName()), qUtf8Printable(loader->errorString()));
+ });
}
const auto profile = []() {
@@ -152,16 +133,12 @@ int main(int argc, char **argv)
return c.value<QString>("profile.default").value();
}();
- app.setup(plugins);
+ app.setup();
QStringList urls;
for(const auto &u : args::get(cmd_args)) {
- if(pluginCommands.contains(QString::fromStdString(u))) {
- return pluginCommands.value(QString::fromStdString(u))();
- } else {
- urls.append(QString::fromStdString(u));
- }
+ urls.append(QString::fromStdString(u));
}
if(urls.isEmpty())
urls.append(QString());