Logo Search packages:      
Sourcecode: packagesearch version File versions

void NPlugin::DebtagsPlugin::init ( IProvider pProvider  )  [virtual]

Initializes the plugin.

It does not load the debtags vocabulary if _pColl or _pPackageCollection are 0.

Implements NPlugin::Plugin.

Definition at line 62 of file debtagsplugin.cpp.

References _container, _pExcludeSelection, _pIncludeSelection, _pProvider, NPlugin::DebtagsPluginContainer::collection(), evaluateSearch(), NPlugin::DebtagsPluginContainer::facets(), NPlugin::IProvider::handleMaker(), NWidgets::SelectionInputAndDisplay::loadVocabulary(), NPlugin::IProvider::mainWindow(), setWidgetsEnabled(), showExcludeWidgets(), NWidgets::SelectionInputAndDisplay::tagSelectionListView(), and NWidgets::SelectionInputAndDisplay::tagSelectionWidget().

{
      QMainWindow* pWindow = pProvider->mainWindow();
      _pProvider = pProvider;
      _pHandleMaker = &pProvider->handleMaker();

      _pChooserWidget = new TagChooserWidget(pWindow, "TagChooserWidget");
      _pTagsDisplay = new ChoosenTagsDisplay(pWindow, "ChoosenTagsDisplay");
      
      // this will be garbage collected if the parent _pChooserWidget will be deleted
      NWidgets::TagSelectionWidget* pIncludeSelectionWidget = 
            new NWidgets::TagSelectionWidget(_pChooserWidget, "IncludeSelection");
      NWidgets::TagSelectionWidget* pExcludeSelectionWidget = 
            new NWidgets::TagSelectionWidget(_pChooserWidget, "ExcludeSelection");
      
      _pTagsDisplay->show();
      // currently disabled as the exclude tag option is not too useful and wastes some space
      _pChooserWidget->_pExcludeTagsCheck->setShown(false);
      // assume that the vocabulary is not accessible if one of the pointers is not set
      bool debtagsEnabled = (_container.collection() != 0);
      _pIncludeSelection = new NWidgets::SelectionInputAndDisplay
      (
            pWindow,
            "IncludeSelection",
            pIncludeSelectionWidget,
            _pTagsDisplay->_pIncludeTagsView,
            _pTagsDisplay->_pIncludeViewLabel
      );
      _pIncludeSelection->loadVocabulary(_container.facets());
      _pExcludeSelection = new NWidgets::SelectionInputAndDisplay
      (
            pWindow,
            "ExcludeSelection",
            pExcludeSelectionWidget,
            _pTagsDisplay->_pExcludeTagsView,
            _pTagsDisplay->_pExcludeViewLabel
      );
      _pExcludeSelection->loadVocabulary(_container.facets());
      static_cast<QVBoxLayout*>
            (_pChooserWidget->layout())->insertWidget(1, _pIncludeSelection->tagSelectionWidget());
      static_cast<QVBoxLayout*>
            (_pChooserWidget->layout())->insertWidget(4, _pExcludeSelection->tagSelectionWidget());
      connect(
            _pIncludeSelection->tagSelectionListView(), SIGNAL(tagItemsSelected(const set<TagItem*>&)),
            this, SLOT(evaluateSearch()) 
      );
      connect(
            _pExcludeSelection->tagSelectionListView(), SIGNAL(tagItemsSelected(const set<TagItem*>&)),
            this, SLOT(evaluateSearch()) 
      );
      

      _pIncludeSelection->tagSelectionListView()->setColl(_container.collection());
      showExcludeWidgets(false);    // hide the exclude selection part by default
      connect(_pChooserWidget->_pExcludeTagsCheck, SIGNAL(toggled(bool)), this, SLOT(showExcludeWidgets(bool)));
      
      if ( _container.collection()==0 )
            setWidgetsEnabled(false);
}


Generated by  Doxygen 1.6.0   Back to index