void QmitkDiffusionImagingAppApplicationPlugin::start(ctkPluginContext* context)
{
    berry::AbstractUICTKPlugin::start(context);

    this->context = context;

    BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppApplication, context)
    BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppIntroPart, context)
    BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppPerspective, context)
    BERRY_REGISTER_EXTENSION_CLASS(QmitkWelcomePerspective, context)

//  QString collectionFile = GetQtHelpCollectionFile();

//  berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
//  berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://org.mitk.gui.qt.diffusionimagingapp/bundle/index.html");

    delete pluginListener;
    pluginListener = new berry::QCHPluginListener(context);
    context->connectPluginListener(pluginListener, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);

    // register all QCH files from all the currently installed plugins
    pluginListener->processPlugins();


}
void KstPluginDialogI::fillFieldsForEdit() {
    KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
    if (!pp) {
        return;
    }
    pp->readLock();
    if (!pp->plugin()) { // plugin() can be null if the kst file is invalid
        pp->unlock();
        return;
    }
    const QString pluginName(pp->tagName());
    const QString pluginObjectName(pp->plugin()->data()._name);
    const int usage = pp->getUsage();
    KstSharedPtr<Plugin> plug = pp->plugin();
    pp->unlock();

    _tagName->setText(pluginName);
    updatePluginList();

    int i = _pluginList.findIndex(pluginObjectName);
    _w->PluginCombo->setCurrentItem(i);
    pluginChanged(_w->PluginCombo->currentItem());

    fillVectorScalarCombos(plug);
    _w->PluginCombo->setEnabled(usage < 3);

    fixupLayout();
}
void ctkMetaTypeActivator::start(ctkPluginContext* context)
{
  delete metaTypeProviderTracker;
  delete metaTypeService;
  delete logTracker;

  ctkMTLogTracker* lsTracker = 0;
  logFileFallback.open(stdout, QIODevice::WriteOnly);
  ctkLDAPSearchFilter filter(FILTER());
  ctkServiceTracker<>* mtpTracker = 0;

  {
    QMutexLocker l(&mutex);
    lsTracker = logTracker = new ctkMTLogTracker(context, &logFileFallback);
    mtpTracker = metaTypeProviderTracker = new ctkServiceTracker<>(context, filter);
  }
  // Do this first to make logging available as early as possible.
  lsTracker->open();
  CTK_DEBUG(lsTracker) << "====== Meta Type Service starting ! =====";
  // Do this next to make ctkMetaTypeProviders available as early as possible.
  mtpTracker->open();

  // Register the Meta Type service
  ctkDictionary properties;
  properties.insert(ctkPluginConstants::SERVICE_VENDOR, "CommonTK");
  properties.insert(ctkPluginConstants::SERVICE_DESCRIPTION, ctkMTMsg::SERVICE_DESCRIPTION);
  properties.insert(ctkPluginConstants::SERVICE_PID, SERVICE_PID);
  metaTypeService = new ctkMetaTypeServiceImpl(lsTracker, mtpTracker);
  context->connectPluginListener(metaTypeService, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);
  metaTypeServiceRegistration = context->registerService<ctkMetaTypeService>(metaTypeService, properties);
}
void KstPluginDialogI::fillFieldsForNew() {
    updatePluginList();
    int i = _pluginList.findIndex(_pluginName);
    _w->PluginCombo->setCurrentItem(i);
    pluginChanged(_w->PluginCombo->currentItem());
    _tagName->setText(plugin_defaultTag);
}
Exemple #5
0
void mitkPluginActivator::start(ctkPluginContext* context)
{
  berry::AbstractUICTKPlugin::start(context);

  this->context = context;

  BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppApplication, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppIntroPart, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkWelcomePerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppConnectomicsPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppDicomImportPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppFiberTractographyPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppIVIMPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppPreprocessingReconstructionPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppQuantificationPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppScreenshotsMoviesPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppTBSSPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppVolumeVisualizationPerspective, context)
  BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppTrackingEvaluationPerspective, context)

  delete pluginListener;
  pluginListener = new berry::QCHPluginListener(context);
  context->connectPluginListener(pluginListener, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);

  // register all QCH files from all the currently installed plugins
  pluginListener->processPlugins();


}
Exemple #6
0
void QDeclarativeGeoRoutingModel::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (plugin_ || !plugin)
        return;

    plugin_ = plugin;

    emit pluginChanged(plugin_);

    serviceProvider_ = new QGeoServiceProvider(plugin_->name(),
                                               plugin_->parameterMap());

    // check for error

    routingManager_ = serviceProvider_->routingManager();

    connect(routingManager_,
            SIGNAL(finished(QGeoRoutReply*)),
            this,
            SLOT(routingFinished(QGeoRouteReply*)));

    connect(routingManager_,
            SIGNAL(error(QGeoRouteReply*, QGeoRouteReply::Error, QString)),
            this,
            SLOT(routingError(QGeoRouteReply*, QGeoRouteReply::Error, QString)));

}
Exemple #7
0
void KstFilterDialogI::updatePluginList() {
  PluginCollection *pc = PluginCollection::self();
  const QMap<QString,Plugin::Data>& _pluginMap = pc->pluginList();
  QString previous = _pluginList[_w->PluginCombo->currentItem()];
  int newFocus = -1;
  int cnt = 0;

  _w->PluginCombo->clear();
  _pluginList.clear();
  for (QMap<QString,Plugin::Data>::ConstIterator it = _pluginMap.begin(); it != _pluginMap.end(); ++it) {
    if (it.data()._isFilter) {
      _pluginList += it.data()._name;
      _w->PluginCombo->insertItem(i18n("%1 (v%2) - %3").arg(it.data()._readableName)
                              .arg(it.data()._version)
                              .arg(it.data()._description));
      if (it.data()._name == previous) {
        newFocus = cnt;
      }
      ++cnt;
    }
  }

  if (newFocus != -1) {
    _w->PluginCombo->setCurrentItem(newFocus);
  } else {
    _w->PluginCombo->setCurrentItem(0);
    pluginChanged(0);
  }
}
Exemple #8
0
void TestItem::setPlugin(const QString &plugin){
    if (plugin.compare(plugin) != 0 ) {
        m_plugin = plugin;
        emit pluginChanged();
        emit dataChanged();
    }
}
void ctkQtMobilityServiceRuntime::stop()
{
  this->disconnect(this, SLOT(pluginChanged(ctkPluginEvent)));
//  Bundle [] b = (Bundle [])bundleComponents.keySet().toArray(new Bundle[bundleComponents.size()]);
//      for (int i = 0; i < b.length; i++) {
//        removeBundle(b[i], ComponentConstants.DEACTIVATION_REASON_DISABLED);
//      }
}
Exemple #10
0
void PreviewBridge::setPlugin(const QString &plugin)
{
    if (m_plugin == plugin) {
        return;
    }
    m_plugin = plugin;
    qDebug() << "Plugin changed to: " << m_plugin;
    emit pluginChanged();
}
/*!
    \internal
*/
void QDeclarativeSearchModelBase::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (m_plugin == plugin)
        return;

    initializePlugin(plugin);

    if (m_complete)
        emit pluginChanged();
}
void ctkQtMobilityServiceRuntime::start()
{
  pc->connectPluginListener(this, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);
  QList<QSharedPointer<ctkPlugin> > plugins = pc->getPlugins();
  foreach(QSharedPointer<ctkPlugin> plugin, plugins)
  {
    if ((plugin->getState() & (ctkPlugin::ACTIVE | ctkPlugin::STARTING)) != 0)
    {
      processPlugin(plugin);
    }
  }
}
void ctkConfigurationAdminActivator::start(ctkPluginContext* context)
{
  logFileFallback.open(stdout, QIODevice::WriteOnly);
  logTracker = new ctkCMLogTracker(context, &logFileFallback);
  logTracker->open();
  eventAdapter = new ctkConfigurationEventAdapter(context);
  eventAdapter->start();
  factory = new ctkConfigurationAdminFactory(context, logTracker);
  factory->start();
  context->connectPluginListener(factory, SLOT(pluginChanged(ctkPluginEvent)));
  registration = context->registerService<ctkConfigurationAdmin>(factory);
}
Exemple #14
0
FilterFitTab::FilterFitTab(QString& pluginName, QWidget *parent)
    : DataTab(parent), _configWidget(0), _layout(0), _store(0), _vectorX(0), _vectorY(0), _lockVectors(false) {

    setupUi(this);
    setTabTitle(tr("Plugin"));

    _type = (DataObjectPluginInterface::PluginTypeID)DataObject::pluginType(pluginName);
    if (_type == DataObjectPluginInterface::Filter) {
        _pluginCombo->addItems(DataObject::filterPluginList());
    } else if (_type == DataObjectPluginInterface::Fit) {
        _pluginCombo->addItems(DataObject::fitsPluginList());
    }

    _curveAppearance->setVisible(false);
    _curvePlacement->setVisible(false);
    _ignoreAutoScale->setVisible(false);
    _curvePlacement->setPlace(CurvePlacement::NoPlot);

    pluginChanged(pluginName);
    connect(_pluginCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(pluginChanged(QString)));
    connect(_curvePlacement->_noPlot, SIGNAL(toggled(bool)), _curveAppearance, SLOT(setDisabled(bool)));
}
void KstPluginDialogI::updatePluginList() {
    PluginCollection *pc = PluginCollection::self();
    QString previous = _pluginList[_w->PluginCombo->currentItem()];
    int newFocus = -1;

    const QMap<QString,Plugin::Data>& pluginMap = pc->pluginList();

    QMap<QString,QString> oldIEntries, oldOEntries;

    _w->PluginCombo->clear();
    _pluginList.clear();
    int cnt = 0;
    Plugin::Data restoreEntry;
    for (QMap<QString,Plugin::Data>::ConstIterator it = pluginMap.begin();
            it != pluginMap.end();
            ++it) {
        _pluginList += it.data()._name;
        _w->PluginCombo->insertItem(i18n("%1 (v%2)").arg(it.data()._readableName).arg(it.data()._version));
        if (it.data()._name == previous) {
            newFocus = cnt;
            oldIEntries = cacheInputs(it.data()._inputs);
            oldOEntries = cacheInputs(it.data()._outputs);
            restoreEntry = it.data();
        }
        ++cnt;
    }

    if (newFocus != -1) {
        _w->PluginCombo->setCurrentItem(newFocus);
        pluginChanged(_w->PluginCombo->currentItem());
        restoreInputs(restoreEntry._inputs, oldIEntries);
        restoreInputs(restoreEntry._outputs, oldOEntries);
    } else {
        _w->PluginCombo->setCurrentItem(0);
        pluginChanged(0);
    }
}
void QDeclarativeGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (m_plugin) {
        qmlInfo(this) << QStringLiteral("Plugin is a write-once property, and cannot be set again.");
        return;
    }
    m_plugin = plugin;
    emit pluginChanged(m_plugin);

    if (m_plugin->isAttached()) {
        pluginReady();
    } else {
        connect(m_plugin, SIGNAL(attached()),
                this, SLOT(pluginReady()));
    }
}
/*!
    \qmlproperty Plugin Place::plugin

    This property holds the \l Plugin that provided this place which can be used to retrieve more information about the service.
*/
void QDeclarativePlace::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (m_plugin == plugin)
        return;

    m_plugin = plugin;
    if (m_complete)
        emit pluginChanged();

    if (m_plugin->isAttached()) {
        pluginReady();
    } else {
        connect(m_plugin, SIGNAL(attached()),
                this, SLOT(pluginReady()));
    }
}
void ExampleAppPluginActivator::start(ctkPluginContext* context)
{
  berry::AbstractUICTKPlugin::start(context);
  
  this->context = context;
  
  BERRY_REGISTER_EXTENSION_CLASS(QmitkAwesomeApplication, context);
  BERRY_REGISTER_EXTENSION_CLASS(QmitkAwesomePerspective, context);

  QString collectionFile = GetQtHelpCollectionFile();

  berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
  berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://my.awesomeproject.exampleapp/bundle/index.html");

  delete pluginListener;
  pluginListener = new berry::QCHPluginListener(context);
  context->connectPluginListener(pluginListener, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);

  // register all QCH files from all the currently installed plugins
  pluginListener->processPlugins();
}
/*!
    \qmlproperty Plugin Category::plugin

    This property holds the location based service to which the category belongs.
*/
void QDeclarativeCategory::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (m_plugin == plugin)
        return;

    m_plugin = plugin;
    if (m_complete)
        emit pluginChanged();

    if (m_icon && m_icon->parent() == this && !m_icon->plugin())
        m_icon->setPlugin(m_plugin);

    if (!m_plugin)
        return;

    if (m_plugin->isAttached()) {
        pluginReady();
    } else {
        connect(m_plugin, SIGNAL(attached()),
                this, SLOT(pluginReady()));
    }
}
Exemple #20
0
KWMailMergeChoosePluginDialog::KWMailMergeChoosePluginDialog( KTrader::OfferList offers )
    : KDialogBase( Plain, i18n( "Mail Merge Setup" ), Ok | Cancel, Ok,
      /*parent*/ 0, "", true ), pluginOffers( offers )
{
  QWidget *back = plainPage();
  QVBoxLayout *layout = new QVBoxLayout( back, 0, spacingHint() );

  QLabel *label = new QLabel( i18n( "&Available sources:" ), back );
  chooser = new QComboBox( false, back );
  label->setBuddy( chooser );
  descriptionLabel = new QLabel( back );
  descriptionLabel->hide();
  descriptionLabel->setAlignment( WordBreak );
  descriptionLabel->setFrameShape( QFrame::Box );
  descriptionLabel->setFrameShadow( QFrame::Sunken );

  QSize old_sizeHint;
  for ( KTrader::OfferList::Iterator it = pluginOffers.begin(); *it; ++it )
  {
    chooser->insertItem( (*it)->name() );
    old_sizeHint = descriptionLabel->sizeHint();
    descriptionLabel->setText( (*it)->comment() );
    if (descriptionLabel->sizeHint().width()*descriptionLabel->sizeHint().height() > old_sizeHint.width()*old_sizeHint.height())
        descriptionLabel->setMinimumSize(descriptionLabel->sizeHint() );
  }
  descriptionLabel->show();

  connect( chooser, SIGNAL( activated( int ) ),
           this, SLOT( pluginChanged( int ) ) );

  layout->addWidget( label );
  layout->addWidget( chooser );
  layout->addWidget( descriptionLabel );
  layout->addStretch( 1 );

  pluginChanged( 0 );
}
void QDeclarativeGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (plugin_) {
        qmlInfo(this) << tr("Plugin is a write-once property, and cannot be set again.");
        return;
    }

    plugin_ = plugin;

    emit pluginChanged(plugin_);

    serviceProvider_ = new QGeoServiceProvider(plugin_->name(),
            plugin_->parameterMap());

    if (serviceProvider_->error() != QGeoServiceProvider::NoError) {
        qWarning() << serviceProvider_->errorString();
        delete serviceProvider_;
        serviceProvider_ = 0;
        return;
    }

    mappingManager_ = serviceProvider_->mappingManager();
    if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) {
        qWarning() << serviceProvider_->errorString();
        delete serviceProvider_;
        serviceProvider_ = 0;
        delete mappingManager_;
        mappingManager_ = 0;
        return;
    }

    mapData_ = mappingManager_->createMapData();
    mapData_->init();
    //mapData_->setParentItem(this);

    // setters
    mapData_->setWindowSize(size_);
    mapData_->setZoomLevel(zoomLevel_);

    if (center_)
        mapData_->setCenter(center_->coordinate());
    else
        mapData_->setCenter(*initialCoordinate);

    mapData_->setMapType(QGraphicsGeoMap::MapType(mapType_));
    mapData_->setConnectivityMode(QGraphicsGeoMap::ConnectivityMode(connectivityMode_));

    // Populate the map objects.
    populateMap();
    // setup signals
    connect(mapData_,
            SIGNAL(updateMapDisplay(QRectF)),
            this,
            SLOT(updateMapDisplay(QRectF)));

    connect(mapData_,
            SIGNAL(centerChanged(QGeoCoordinate)),
            this,
            SLOT(internalCenterChanged(QGeoCoordinate)));

    connect(mapData_,
            SIGNAL(mapTypeChanged(QGraphicsGeoMap::MapType)),
            this,
            SLOT(internalMapTypeChanged(QGraphicsGeoMap::MapType)));

    connect(mapData_,
            SIGNAL(connectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)),
            this,
            SLOT(internalConnectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)));

    connect(mapData_,
            SIGNAL(windowSizeChanged(QSizeF)),
            this,
            SIGNAL(sizeChanged(QSizeF)));

    connect(mapData_,
            SIGNAL(zoomLevelChanged(qreal)),
            this,
            SIGNAL(zoomLevelChanged(qreal)));
}
Exemple #22
0
void KstPluginDialogI::updatePlugin(int new_index) {
  QString selectedVector;
  QString selectedScalar;
  int oldSelect = Select->currentItem();
  int oldCount = Select->count();

  KstPluginList pl = kstObjectSubList<KstDataObject, KstPlugin>(KST::dataObjectList);

  Select->clear();

  for (KstPluginList::iterator it = pl.begin(); it != pl.end(); ++it) {
    Select->insertItem((*it)->tagName());
  }

  if (new_index == -2 || Select->count() == 0) {
    Select->insertItem(i18n("P%1-%2").arg(Select->count()+1).arg(newPluginString));
    Select->setCurrentItem(Select->count()-1);
  } else if (new_index >= 0 && new_index < Select->count()) {
    Select->setCurrentItem(new_index);
  } else if (oldCount != Select->count()) {
    Select->setCurrentItem(Select->count()-1);
  } else {
    Select->setCurrentItem(oldSelect < Select->count() ? oldSelect : Select->count()-1);
  }

  if (_pluginList.isEmpty()) {
    updatePluginList();
  }

  KstPluginPtr plugin = pl[Select->currentItem()];
  if (!plugin) {
    kdWarning() << "Couldn't find plugin in list: " << Select->currentItem() << endl;
    return;
  }

  int oldPluginIndex = PluginCombo->currentItem();
  int newPluginIndex = _pluginList.findIndex(plugin->plugin()->data()._name);
  bool updateCombos = (newPluginIndex != oldPluginIndex);

  if (updateCombos) {
    PluginCombo->setCurrentItem(newPluginIndex);
    pluginChanged(PluginCombo->currentItem());
  }
  
  KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[PluginCombo->currentItem()]);
  if( pPtr != 0 ) {
    // Update input vector and scalar combos
    const QValueList<Plugin::Data::IOValue>& itable = pPtr->data()._inputs;
    for (QValueList<Plugin::Data::IOValue>::ConstIterator it = itable.begin(); it != itable.end(); ++it) {
      if ((*it)._type == Plugin::Data::IOValue::TableType) { // vector
        QObject *field = _frameWidget->child((*it)._name.latin1(), "VectorSelector");
        assert(field);
        if (field) {
          VectorSelector *vs = static_cast<VectorSelector*>(field);
          selectedVector = vs->selectedVector();
          if (!updateCombos) {
            vs->update();
          }
          if (plugin.data() && plugin->isValid()) {
            vs->setSelection(plugin->inputVectors()[(*it)._name]->tagName());
          } else {
            vs->setSelection(selectedVector);
          }
        }
      } else {
        QObject *field = _frameWidget->child((*it)._name.latin1(), "ScalarSelector");
        assert(field);
        if (field) {
          ScalarSelector *ss = static_cast<ScalarSelector*>(field);
          selectedScalar = ss->selectedScalar( );
          if (!updateCombos) {
            ss->update();
          }
          if (plugin.data() && plugin->isValid()) {
            ss->setSelection(plugin->inputScalars()[(*it)._name]->tagName());
          } else {
            ss->setSelection(selectedScalar);
          }
        }
      }
    }
    
    // Update output vector and scalar lineedits
    //    const QValueList<Plugin::Data::IOValue>& otable = plugin->plugin()->data()._outputs;
    if (plugin.data() && plugin->isValid()) {
      const QValueList<Plugin::Data::IOValue>& otable = pPtr->data()._outputs;
      for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin(); it != otable.end(); ++it) {
        QObject *field = _frameWidget->child((*it)._name.latin1(), "QLineEdit");
        assert(field);
        if (field) {
          QLineEdit *li = static_cast<QLineEdit*>(field);
          QString ts;
          if ((*it)._type == Plugin::Data::IOValue::TableType) { // vector
            ts = plugin->outputVectors()[(*it)._name]->tagName();
          } else { // scalar
            ts = plugin->outputScalars()[(*it)._name]->tagName();
          }
          li->setText(ts);
        }
      }
    }
  } else { // invalid plugin
    PluginCollection *pc = PluginCollection::self();
    QString cur = _pluginList[PluginCombo->currentItem()];
    Plugin::Data pdata = pc->pluginList()[pc->pluginNameList()[cur]];
    for (QValueList<Plugin::Data::IOValue>::ConstIterator it = pdata._outputs.begin(); it != pdata._outputs.end(); ++it) {
      QObject *field = _frameWidget->child((*it)._name.latin1(), "QLineEdit");
      if (field) {
        static_cast<QLineEdit*>(field)->setText(QString::null);
      }
    }
  }

  QTimer::singleShot(0, this, SLOT(fixupLayout()));
}
ctkEAPluginEventAdapter::ctkEAPluginEventAdapter(ctkPluginContext* context, ctkEventAdmin* admin)
  : ctkEAAbstractAdapter(admin)
{
  context->connectPluginListener(this, SLOT(pluginChanged(ctkPluginEvent)));
}
  void ctkPluginFrameworkListeners::emitPluginChanged(const ctkPluginEvent& event)
  {
    emit pluginChanged(event);

}