Logo Search packages:      
Sourcecode: packagesearch version File versions

debtagsplugin.h

#ifndef __DEBTAGSPLUGIN_H_2004_06_21
#define __DEBTAGSPLUGIN_H_2004_06_21

#include <qstring.h>
#include <string>

#include <HandleMaker.h>
#include <TagCollection.h>
#include <InputMerger.h>

#include <searchplugin.h>
#include <informationplugin.h>
#include <debtagsplugincontainer.h>


#include "tagchooserwidget.h"

class QListBoxItem;
class QPoint;

class ChoosenTagsDisplay;
namespace NWidgets 
{
      class SelectionInputAndDisplay;
}

using namespace std;

namespace NPlugin
{

/** This plugin offers search by tags  
  *
  * @author Benjamin Mesing
  */
00036 class DebtagsPlugin : public SearchPlugin, public InformationPlugin 
{
      Q_OBJECT
      TagChooserWidget* _pChooserWidget;
      ChoosenTagsDisplay* _pTagsDisplay;
      Tagcoll::HandleMaker<string>* _pHandleMaker;
      /** @brief This holds a link to the manager which manages the plugin.
        *
        * Acquaintance relation */

00046       IProvider* _pProvider;
      /** This manages the include widgets (but not the labels belonging to them. */
00048       NWidgets::SelectionInputAndDisplay* _pIncludeSelection;
      /** This manages the exclude widgets (but not the labels belonging to them. */
00050       NWidgets::SelectionInputAndDisplay* _pExcludeSelection;
      /** The container which holds this plugin. */
00052       const DebtagsPluginContainer& _container;
      /** Holds if the search is currently inactive. */
00054       bool _isInactive;
      /** This holds the search result for the current search */
00056       Tagcoll::OpSet<int> _searchResult;
public:
      /** Create this plugin as plugin in container.
        *
        * @param container the container which contains this plugin. 
        */
      DebtagsPlugin(const DebtagsPluginContainer& container);;
      virtual ~DebtagsPlugin();
      /** @name Plugin Interface
        * 
        * Implementation of the PluginInterface 
        */
      //@{
      /** @brief Initializes the plugin. 
        * 
        * It does not load the debtags vocabulary if _pColl or _pPackageCollection are 0.*/
      virtual void init(IProvider* pProvider);
      /// @todo not yet implemented
00074       virtual void setEnabled(bool enabled)     {};
      /// @todo not yet implemented
00076       virtual void setVisible(bool visible)     {};
      virtual QString title() const;
      virtual QString briefDescription() const;
      virtual QString description() const;
      //@}
      ///@todo try to remove malformed descriptions
      /** @name SearchPlugin interface
        * 
        * Implementation of the SearchPlugin interface
        */
      //@{
      virtual uint searchPriority() const { return 5; };
      /** @brief Returns a widget where you can select the debtags you want to in- and exclude. */
00089       virtual QWidget* inputWidget() const      { return _pChooserWidget; };
      /** @brief Returns &quot;Debtags&quot;.  */
00091       virtual QString inputWidgetTitle() const  { return "Debtags"; };
      virtual QWidget* shortInputAndFeedbackWidget() const;
      virtual void clearSearch();
      virtual bool usesFilterTechnique() const  { return false; };
      virtual const Tagcoll::OpSet<int>& searchResult() const;
      /** This plugin does not use the filter technique. */
00097       virtual bool filterPackage (int packageID) const      { return true; };
      virtual bool isInactive() const     { return _isInactive; };
      //@}
      
      /** @name InformationPlugin interface
        * 
        * Implementation of the InformationPlugin interface
        */
      //@{
00106       virtual uint informationPriority() const  { return 5; };
      /** This plugin does not offer a separate information widget. */
00108       virtual QWidget* informationWidget() const      { return 0; };
      /** This plugin does not offer a separate information widget. */
00110       virtual QString informationWidgetTitle() const  { return _emptyString; };
      /** This plugin does not offer a separate information widget. */
00112       virtual void updateInformationWidget(int packageID) {};
      /** This plugin does not offer a separate information widget. */
00114       virtual void clearInformationWidget() {};
      /** This plugin offers an information text. */
00116       virtual bool offersInformationText() const      { return true; };
      /** Returns a string which lists the tags for the requested package. */
      virtual QString informationText (int packageID);
      //@}
      /** @brief This can be used to notify the plugin that the debtags data in the 
        * plugin container (i.e. the tag collection and the vocabulary) has changed. 
        *
        * It behaves sound if the values are not set in the container. */
      void debtagsDataChanged();
protected slots:
      /** @brief This shows or hides the exclude widgets.
        *
        * @param display decides if to show (true) or hide (false) the elements. */
      void showExcludeWidgets(bool display);
      /** This evaluates the current search */
      void evaluateSearch();
      /** @brief This enables/ disables the visible widgets. */
      void setWidgetsEnabled(bool enabled);

      /** @brief This shows or hides the exclude display elements.
        *
        * @param display decides if to show (true) or hide (false) the elements. */
//    void showExcludeDisplay(bool display);
      /** @brief This shows or hides the exclude input elements.
        *
        * @param display decides if to show (true) or hide (false) the elements. */
//    void showExcludeInput(bool display);
private:

      /** @brief This creates a search expression which can be used as input for an ExpressionFiler.
        *
        * The expression is created from the items which are currently in the tag views.
        * @returns the filter string
        */
      std::string createSearchExpression();
};

}     // namespace NPlugin

#endif //   __DEBTAGSPLUGIN_H_2004_06_21


Generated by  Doxygen 1.6.0   Back to index