Ejemplo n.º 1
0
PluginDialog::PluginDialog(const QString &path, const QStringList &fileNames,
                           QWidget *parent) :
    QDialog(parent),
    label(new QLabel),
    treeWidget(new QTreeWidget),
    okButton(new QPushButton(tr("OK")))    
{
    treeWidget->setAlternatingRowColors(false);
    treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
    treeWidget->setColumnCount(1);
    treeWidget->header()->hide();

    okButton->setDefault(true);

    connect(okButton, SIGNAL(clicked()), this, SLOT(close()));

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setColumnStretch(0, 1);
    mainLayout->setColumnStretch(2, 1);
    mainLayout->addWidget(label, 0, 0, 1, 3);
    mainLayout->addWidget(treeWidget, 1, 0, 1, 3);
    mainLayout->addWidget(okButton, 2, 1);
    setLayout(mainLayout);

    interfaceIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirOpenIcon),
                            QIcon::Normal, QIcon::On);
    interfaceIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirClosedIcon),
                            QIcon::Normal, QIcon::Off);
    featureIcon.addPixmap(style()->standardPixmap(QStyle::SP_FileIcon));

    setWindowTitle(tr("Plugin Information"));
    findPlugins(path, fileNames);
}
Ejemplo n.º 2
0
void TopicDisplayWidget::fill( DisplayFactory *factory )
{
  findPlugins( factory );

  QList<PluginGroup> groups;
  QList<ros::master::TopicInfo> unvisualizable;
  getPluginGroups( datatype_plugins_, &groups, &unvisualizable );

  // Insert visualizable topics along with their plugins
  QList<PluginGroup>::const_iterator pg_it;
  for( pg_it = groups.begin(); pg_it < groups.end(); ++pg_it)
  {
    const PluginGroup &pg = *pg_it;

    QTreeWidgetItem *item = insertItem( pg.base_topic, false );
    item->setData( 0, Qt::UserRole, pg.base_topic );

    QMap<QString, PluginGroup::Info>::const_iterator it;
    for (it = pg.plugins.begin(); it != pg.plugins.end(); ++it)
    {
      const QString plugin_name = it.key();
      const PluginGroup::Info &info = it.value();
      QTreeWidgetItem *row = new QTreeWidgetItem( item );

      row->setText( 0, factory->getClassName( plugin_name ) );
      row->setIcon( 0, factory->getIcon( plugin_name ) );
      row->setWhatsThis( 0, factory->getClassDescription( plugin_name ) );
      row->setData( 0, Qt::UserRole, plugin_name );
      row->setData( 1, Qt::UserRole, info.datatypes[0] );

      if ( info.topic_suffixes.size() > 1 )
      {
        EmbeddableComboBox *box = new EmbeddableComboBox( row, 1 );
        connect( box, SIGNAL( itemClicked( QTreeWidgetItem*, int )),
                 this, SLOT( onComboBoxClicked( QTreeWidgetItem* )));
        for ( int i = 0; i < info.topic_suffixes.size(); ++i)
        {
          box->addItem( info.topic_suffixes[i], info.datatypes[i] );
        }
        tree_->setItemWidget( row, 1, box );
        tree_->setColumnWidth( 1, std::max( tree_->columnWidth( 1 ), box->width() ));
      }
    }
  }
Ejemplo n.º 3
0
void
Plugins::PluginManager::checkPluginEnabledStates()
{
    // re-create all the member infos.
    m_pluginInfos.clear();
    m_pluginInfosByType.clear();
    m_factoriesByType.clear();

    m_pluginInfos = findPlugins(); // reload all the plugins plus their enabled state
    if( m_pluginInfos.isEmpty() ) // try it a second time with syscoca
        handleNoPluginsFound();

    QList<PluginFactory*> allFactories;

    // sort the plugin infos by type
    foreach( const KPluginInfo &pluginInfo, m_pluginInfos )
    {
        Type type;
        if( pluginInfo.category() == QLatin1String("Storage") )
            type = Storage;
        else if( pluginInfo.category() == QLatin1String("Collection") )
            type = Collection;
        else if( pluginInfo.category() == QLatin1String("Service") )
            type = Service;
        else if( pluginInfo.category() == QLatin1String("Importer") )
            type = Importer;
        else {
            warning() << pluginInfo.pluginName() << " has unknown category";
            continue;
        }
        m_pluginInfosByType[ type ] << pluginInfo;

        // create the factories and sort them by type
        PluginFactory *factory = createFactory( pluginInfo );
        if( factory )
        {
            m_factoriesByType[ type ] << factory;
            allFactories << factory;
        }
    }