removeAccents refactorized out to the AccentsNormalizer class
[mdictionary] / trunk / src / includes / CommonDictInterface.h
index e55be96..f3fde62 100644 (file)
 
 *******************************************************************************/
 
-// Created by Bartosz Szatkowski
+/*! /file CommonDictInterface.h
+\brief Common interface for all dicts and plugins \see CommonDictInterface
+
+\author Bartosz Szatkowski <bulislaw@linux.com>
+*/
 
 #ifndef COMMONDICTINTERFACE_H
 #define COMMONDICTINTERFACE_H
 #include <QObject>
 #include <QList>
 #include "translation.h"
+#include "Notify.h"
+#include "settings.h"
+#include "AccentsNormalizer.h"
 
 class DictDialog;
-class Settings;
 
 
 //! Interface for dict engines plugins
-class CommonDictInterface : public QObject {
+class CommonDictInterface : public QObject, public AccentsNormalizer {
   Q_OBJECT
   public:
     CommonDictInterface(QObject *parent = 0):QObject(parent) {}
 
+    virtual ~CommonDictInterface() {}
+
     //! returns source language code iso 639-2
     virtual QString langFrom() const = 0;
 
@@ -78,6 +86,9 @@ class CommonDictInterface : public QObject {
     //! returns current plugin settings
     virtual Settings* settings() = 0;
 
+    //! returns plugin icon
+    virtual QIcon* icon() = 0;
+
  public Q_SLOTS:
     /*! performs search in dictionary
         \param  word word to search in dictionary
@@ -99,6 +110,25 @@ class CommonDictInterface : public QObject {
 
     //! emited after change dictionary settings
     void settingsChanged();
+
+    /*! emmited to backbone when needed to inform user about something
+        \param Backbone::NotifyType gui my dacide to show different typet in
+            different ways
+        \param QString text of the notification
+    */
+    void notify(Notify::NotifyType, QString);
+    
+protected:
+    QString removeAccents(QString string) {
+        if(settings()->value("strip_accents") == "true")
+            return AccentsNormalizer::removeAccents(string);
+        return string;
+    }
+
+    void initAccents() { AccentsNormalizer::initAccents(); }
+
+
+
 };
 
 Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");