Esempio n. 1
0
static KstDataSourcePtr findPluginFor(const QString& filename, const QString& type) {
    KstDataSourcePtr plugin;

    scanPlugins();

    if (!type.isEmpty()) {
        for (KST::PluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
            if ((*it)->provides(type)) {
                plugin = (*it)->create(filename, type);
                break;
            }
        }

        return plugin;
    }

    for (KST::PluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
        if ((*it)->understands(filename)) {
            plugin = (*it)->create(filename);
            if (plugin) {
                break;
            }
        }
    }

    return plugin;
}
Esempio n. 2
0
GroupPanelModel::GroupPanelModel(iscore::DocumentModel *model):
    iscore::PanelModel{"GroupPanelModel", model}
{
    connect(model, &iscore::DocumentModel::pluginModelsChanged,
            this, &GroupPanelModel::scanPlugins);
    scanPlugins();
}
Esempio n. 3
0
PluginCollection::PluginCollection() 
: QObject(0L, "KST Plugin Collection") {
  KGlobal::dirs()->addResourceType("kst", KStandardDirs::kde_default("data") + "kst");
  KGlobal::dirs()->addResourceType("kstplugins", KStandardDirs::kde_default("data") + "kst" + QDir::separator() + "plugins");
  // KDE3 provides no way to get the plugin directory so this will break
  // for KDE 4  ### FIXME
  KGlobal::dirs()->addResourceType("kstpluginlib", KStandardDirs::kde_default("lib") + "kde3" + QDir::separator() + "kstplugins");
  _parser = new PluginXMLParser;
  scanPlugins();
}
Esempio n. 4
0
KstPluginInfoList DataObject::pluginInfoList() {
  if (pluginInfo.isEmpty()) {
    scanPlugins();
  }

  KstPluginInfoList list;
  QMap<QString, DataObjectPtr>::ConstIterator it = pluginInfo.begin();
  for (; it != pluginInfo.end(); ++it) {
    list.insert(it.key(), it.value()->kind());
  }
  return list;
}
Esempio n. 5
0
QStringList KstDataSource::pluginList() {
  QStringList rc;

  if (pluginInfo.isEmpty()) {
    scanPlugins();
  }

  for (KST::PluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
    rc += (*it)->service->property("Name").toString();
  }

  return rc;
}
Esempio n. 6
0
bool KstDataSource::pluginHasConfigWidget(const QString& plugin) {
  if (pluginInfo.isEmpty()) {
    scanPlugins();
  }

  KST::PluginInfoList info = Q3DeepCopy<KST::PluginInfoList>(pluginInfo);

  for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) {
    if ((*it)->service->property("Name").toString() == plugin) {
      return (*it)->hasConfigWidget();
    }
  }

  return false;
}
Esempio n. 7
0
KstDataSourceConfigWidget* KstDataSource::configWidgetForPlugin(const QString& plugin) {
  if (pluginInfo.isEmpty()) {
    scanPlugins();
  }

  KST::PluginInfoList info = Q3DeepCopy<KST::PluginInfoList>(pluginInfo);

  for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) {
    if (KST::DataSourcePlugin *p = kst_cast<KST::DataSourcePlugin>(*it)) {
      if (p->service->property("Name").toString() == plugin) {
        return p->configWidget(qSettingsObject, QString::null);
      }
    }
  }

  return 0L;
}
Esempio n. 8
0
NSPluginLoader::NSPluginLoader()
   : QObject(), _mapping(7, false), _viewer(0)
{
  scanPlugins();
  _mapping.setAutoDelete( true );
  _filetype.setAutoDelete(true);

  // trap dcop register events
  kapp->dcopClient()->setNotifications(true);
  QObject::connect(kapp->dcopClient(),
                   SIGNAL(applicationRegistered(const QCString&)),
                   this, SLOT(applicationRegistered(const QCString&)));

  // load configuration
  KConfig cfg("kcmnspluginrc", false);
  cfg.setGroup("Misc");
  _useArtsdsp = cfg.readBoolEntry( "useArtsdsp", false );
}
Esempio n. 9
0
static QList<PluginSortContainer> bestPluginsForSource(const QString& filename, const QString& type) {
  QList<PluginSortContainer> bestPlugins;

  if (pluginInfo.isEmpty()) {
    scanPlugins();
  }

  KST::PluginInfoList info = Q3DeepCopy<KST::PluginInfoList>(pluginInfo);

  if (!type.isEmpty()) {
    for (KST::PluginInfoList::iterator it = info.begin(); it != info.end(); ++it) {
      if (KST::DataSourcePlugin *p = dynamic_cast<KST::DataSourcePlugin*>((*it).data())) {
        if (p && p->provides(type)) {
          PluginSortContainer psc;
          psc.match = 100;
          psc.plugin = p;
          bestPlugins.append(psc);
          
          return bestPlugins;
        }
      }
    }
  }

  for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) {
    PluginSortContainer psc;
    if (KST::DataSourcePlugin *p = kst_cast<KST::DataSourcePlugin>(*it)) {
      if ((psc.match = p->understands(qSettingsObject, filename)) > 0) {
        psc.plugin = p;
        bestPlugins.append(psc);
      }
    }
  }

  qSort(bestPlugins);

  return bestPlugins;
}
Esempio n. 10
0
    std::vector<std::string> LibraryManager::getAvailablePlugins(LibraryType libraryType)
    {
        std::vector<std::string> plugins;
        void* fct = NULL;
        boost::filesystem::directory_iterator end_iter;
        std::string fctname;

        if (libraryType == LibraryManager::CARDS_TYPE)
        {
            fctname = "getChipInfoAt";
        }
        else if (libraryType == LibraryManager::READERS_TYPE)
        {
            fctname = "getReaderInfoAt";
        }

        if (libLoaded.empty())
        {
            scanPlugins();
        }

        for (std::map<std::string, IDynLibrary*>::iterator it = libLoaded.begin(); it != libLoaded.end(); ++it)
        {
            try
            {
                if ((*it).second != NULL && (fct = (*it).second->getSymbol(fctname.c_str())) != NULL)
                {
                    getobjectinfoat objectinfoptr;
                    *(void**)(&objectinfoptr) = fct;
                    getAvailablePlugins(plugins, objectinfoptr);
                }
            }
            catch (...) {}
        }

        return plugins;
    }
Esempio n. 11
0
    void* LibraryManager::getFctFromName(const std::string &fctname, LibraryType libraryType)
    {
        void *fct;
        boost::filesystem::directory_iterator end_iter;
        std::string extension = EXTENSION_LIB;

        if (libLoaded.empty())
        {
            scanPlugins();
        }

        for (std::map<std::string, IDynLibrary*>::iterator it = libLoaded.begin(); it != libLoaded.end(); ++it)
        {
            try
            {
                if ((*it).second != NULL && hasEnding((*it).first, enumType[libraryType] + extension)
		    && (fct = (*it).second->getSymbol(fctname.c_str())) != NULL)
                    return fct;
            }
            catch (...) {}
        }

        return NULL;
    }
Esempio n. 12
0
void PluginCollection::rescan() {
  // Make me smarter
  scanPlugins();
}