MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / loadPlugin

Method loadPlugin

lib/extensionsystem/pluginmanager.cpp:1125–1186  ·  view source on GitHub ↗

! \internal */

Source from the content-addressed store, hash-verified

1123 \internal
1124*/
1125void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destState)
1126{
1127 if (spec->hasError() || spec->state() != destState-1)
1128 return;
1129
1130 // don't load disabled plugins.
1131 if (!spec->isEffectivelyEnabled() && destState == PluginSpec::Loaded)
1132 return;
1133
1134 switch (destState) {
1135 case PluginSpec::Running:
1136 profilingReport(">initializeExtensions", spec);
1137 spec->d->initializeExtensions();
1138 profilingReport("<initializeExtensions", spec);
1139 return;
1140 case PluginSpec::Deleted:
1141 profilingReport(">delete", spec);
1142 spec->d->kill();
1143 profilingReport("<delete", spec);
1144 return;
1145 default:
1146 break;
1147 }
1148 // check if dependencies have loaded without error
1149 QHashIterator<PluginDependency, PluginSpec *> it(spec->dependencySpecs());
1150 while (it.hasNext()) {
1151 it.next();
1152 if (it.key().type == PluginDependency::Optional)
1153 continue;
1154 PluginSpec *depSpec = it.value();
1155 if (depSpec->state() != destState) {
1156 spec->d->hasError = true;
1157 spec->d->errorString =
1158 PluginManager::tr("Cannot load plugin because dependency failed to load: %1(%2)\nReason: %3")
1159 .arg(depSpec->name()).arg(depSpec->version()).arg(depSpec->errorString());
1160 return;
1161 }
1162 }
1163 switch (destState) {
1164 case PluginSpec::Loaded:
1165 profilingReport(">loadLibrary", spec);
1166 spec->d->loadLibrary();
1167 profilingReport("<loadLibrary", spec);
1168 break;
1169 case PluginSpec::Initialized:
1170 profilingReport(">initializePlugin", spec);
1171 spec->d->initializePlugin();
1172 profilingReport("<initializePlugin", spec);
1173 break;
1174 case PluginSpec::Stopped:
1175 profilingReport(">stop", spec);
1176 if (spec->d->stop() == IPlugin::AsynchronousShutdown) {
1177 asynchronousPlugins << spec;
1178 connect(spec->plugin(), SIGNAL(asynchronousShutdownFinished()),
1179 this, SLOT(asyncShutdownFinished()));
1180 }
1181 profilingReport("<stop", spec);
1182 break;

Callers

nothing calls this directly

Calls 15

connectFunction · 0.85
isEffectivelyEnabledMethod · 0.80
initializeExtensionsMethod · 0.80
killMethod · 0.80
dependencySpecsMethod · 0.80
versionMethod · 0.80
loadLibraryMethod · 0.80
initializePluginMethod · 0.80
pluginMethod · 0.80
hasErrorMethod · 0.45
stateMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected