コード例 #1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int main (int argc, char  *argv[])
{
  QApplication app(argc, argv);

  FilterWidgetsLib::RegisterKnownQFilterWidgets();




  FilterWidgetManager::Pointer wm = FilterWidgetManager::Instance();

  FilterWidgetManager::Collection allFactories = wm->getFactories();


  for(FilterWidgetManager::Collection::iterator iter = allFactories.begin(); iter != allFactories.end(); ++iter)
  {
    QString filterName = QString::fromStdString((*iter).first);
    std::cout << "Writing " << filterName.toStdString() << std::endl;
    IFilterWidgetFactory::Pointer wf = (*iter).second;
    if (NULL == wf) { return EXIT_FAILURE;}
    QFilterWidget* w = wf->createWidget();
    QString filePath = QString("/tmp/") + filterName + QString(".ini");
    QSettings prefs(filePath, QSettings::IniFormat, NULL);
    prefs.beginGroup(QString("FILTER_NUMBER"));
    w->writeOptions(prefs);
    prefs.endGroup();

  }


  return EXIT_SUCCESS;
}
コード例 #2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QWidget* FilterWidgetManager::createWidget(FilterParameter* parameter, AbstractFilter* filter)
{
  IFilterWidgetFactory::Pointer factory = m_Factories.value(parameter->getWidgetType());
  if(NULL != factory.get())
  {
    return factory->createWidget(parameter, filter, NULL);
  }
  UnknownWidget* unknownWidget = new UnknownWidget(parameter, filter, NULL);
  return unknownWidget;
}
コード例 #3
0
ファイル: FilterWidgetManager.cpp プロジェクト: leavy/DREAM3D
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
FilterWidgetManager::Collection FilterWidgetManager::getFactories(const std::string &groupName)
{
    FilterWidgetManager::Collection groupFactories;


    for (FilterWidgetManager::Collection::iterator factory = m_Factories.begin(); factory != m_Factories.end(); ++factory)
    {
        IFilterWidgetFactory::Pointer filterFactory = (*factory).second;
        if ( NULL != filterFactory.get() && (*factory).second->getFilterGroup().compare(groupName) == 0)
        {
            groupFactories[(*factory).first] = (*factory).second;
        }
    }
    return groupFactories;
}
コード例 #4
0
ファイル: FilterWidgetManager.cpp プロジェクト: leavy/DREAM3D
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
IFilterWidgetFactory::Pointer FilterWidgetManager::getFactoryForFilterHumanName(const std::string &humanName)
{
    IFilterWidgetFactory::Pointer widgetFactory;

    for (FilterWidgetManager::Collection::iterator factory = m_Factories.begin(); factory != m_Factories.end(); ++factory)
    {
        IFilterWidgetFactory::Pointer filterFactory = (*factory).second;
        if ( NULL != filterFactory.get() && filterFactory->getFilterHumanLabel().compare(humanName) == 0)
        {
            widgetFactory = filterFactory;
            break;
        }
    }
    return widgetFactory;
}
コード例 #5
0
ファイル: FilterWidgetManager.cpp プロジェクト: leavy/DREAM3D
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
std::set<std::string> FilterWidgetManager::getSubGroupNames(const std::string &groupName)
{
// std::cout << "FilterWidgetManager::getGroupNames" << std::endl;
    // Get all the Widget Factories and loop over each one we know about and instantiate a new one
    FilterWidgetManager::Pointer fm = FilterWidgetManager::Instance();
    FilterWidgetManager::Collection factories = fm->getFactories();
    std::set<std::string> subGroupNames;
    for (FilterWidgetManager::Collection::iterator factory = factories.begin(); factory != factories.end(); ++factory)
    {
        IFilterWidgetFactory::Pointer filterFactory = (*factory).second;
        if ( NULL != filterFactory.get() && (*factory).second->getFilterGroup().compare(groupName) == 0)
        {
            subGroupNames.insert((*factory).second->getFilterSubGroup());
        }
    }
    return subGroupNames;
}
コード例 #6
0
ファイル: FilterWidgetManager.cpp プロジェクト: leavy/DREAM3D
// -----------------------------------------------------------------------------
//  Static Method
// -----------------------------------------------------------------------------
void FilterWidgetManager::RegisterFilterWidgetFactory(const std::string &name, IFilterWidgetFactory::Pointer factory)
{
    if (NULL != factory.get() )
    {
        // Instantiate the Instance Manager for IFilterWidgetFactory
        FilterWidgetManager::Pointer idManager = FilterWidgetManager::Instance();
        idManager->addFilterWidgetFactory( name, factory );
    }
}