45{
48
49 std::unique_ptr<KisQmicPluginInterface> plugin;
50
51
53 if (offers.isEmpty()) {
54 QMessageBox::warning(qApp->activeWindow(), i18nc("@title:window", "Krita"), i18n("The GMic plugin is not installed or could not be loaded."));
55 return;
56 }
57
58 for (const auto &loader : offers) {
59 auto *factory = qobject_cast<KPluginFactory *>(loader.instance());
60 if (!factory) {
61 warnPlugins <<
"(GMic) This is not a Krita plugin: " << loader.fileName() << loader.errorString();
62
63 continue;
64 }
65
66 auto *pluginBase = factory->create<QObject>();
67
68 plugin.reset(qobject_cast<KisQmicPluginInterface *>(pluginBase));
69
70 if (!plugin) {
71 warnPlugins <<
"(GMic) This is not a valid GMic-Qt plugin: " << loader.fileName();
72 continue;
73 }
74
75 break;
76 }
77
78 if (!plugin) {
79 QMessageBox::warning(qApp->activeWindow(), i18nc("@title:window", "Krita"), i18n("Krita cannot launch the gmic-qt plugin. No bundled library found."));
80 return;
81 }
82
84 auto image = std::make_shared<KisImageInterface>(this->
viewManager().data());
85 int status = plugin->launch(image, again);
86
88 }
89
90 plugin.reset();
91
94}
QPointer< KisViewManager > viewManager() const
static KoJsonTrader * instance()
QList< Plugin > query(const QString &servicetype, const QString &mimetype)