QDebug operator<<(QDebug debug, const ctkPluginEvent& event) { if (event.isNull()) return debug << "NONE"; QSharedPointer<ctkPlugin> p = event.getPlugin(); debug.nospace() << event.getType() << " #" << p->getPluginId() << " (" << p->getLocation() << ")"; return debug.maybeSpace(); }
void ctkEAPluginEventAdapter::pluginChanged(const ctkPluginEvent& event) { ctkDictionary properties; properties.insert(ctkEventConstants::EVENT, QVariant::fromValue(event)); properties.insert("plugin.id", QVariant::fromValue<long>(event.getPlugin()->getPluginId())); const QString symbolicName = event.getPlugin()->getSymbolicName(); if (!symbolicName.isEmpty()) { properties.insert(ctkEventConstants::PLUGIN_SYMBOLICNAME, symbolicName); } properties.insert("plugin", QVariant::fromValue(event.getPlugin())); QString topic("org/commontk/PluginEvent/"); switch (event.getType()) { case ctkPluginEvent::INSTALLED: topic.append("INSTALLED"); break; case ctkPluginEvent::STARTED: topic.append("STARTED"); break; case ctkPluginEvent::STOPPED: topic.append("STOPPED"); break; case ctkPluginEvent::UPDATED: topic.append("UPDATED"); break; case ctkPluginEvent::UNINSTALLED: topic.append("UNINSTALLED"); break; case ctkPluginEvent::RESOLVED: topic.append("RESOLVED"); break; case ctkPluginEvent::UNRESOLVED: topic.append("UNRESOLVED"); break; default: return; // IGNORE EVENT }; try { getEventAdmin()->postEvent(ctkEvent(topic, properties)); } catch (const std::logic_error& ) { // This is o.k. - indicates that we are stopped. } }
void ctkQtMobilityServiceRuntime::pluginChanged(const ctkPluginEvent& pe) { QSharedPointer<ctkPlugin> plugin = pe.getPlugin(); ctkPluginEvent::Type eventType = pe.getType(); if (eventType == ctkPluginEvent::LAZY_ACTIVATION) { lazy.insert(plugin); processPlugin(plugin); } else if (eventType == ctkPluginEvent::STARTED) { if (!lazy.remove(plugin)) { processPlugin(plugin); } } else if (eventType == ctkPluginEvent::STOPPING) { lazy.remove(plugin); removePlugin(plugin); } }
void ctkPluginBrowser::pluginEvent(const ctkPluginEvent& event) { qDebug() << "PluginEvent: [" << event.getPlugin()->getSymbolicName() << "]" << pluginEventTypeToString[event.getType()]; QSharedPointer<ctkPlugin> plugin = event.getPlugin(); QModelIndexList selection = ui.pluginsTableView->selectionModel()->selectedIndexes(); if (!selection.isEmpty() && selection.first().data(Qt::UserRole).toLongLong() == plugin->getPluginId()) { updatePluginToolbar(plugin); } }