Fixed dictionary hashing
[mdictionary] / src / include / CommonDictInterface.h
index 899843a..19266e7 100644 (file)
@@ -45,7 +45,6 @@ class CommonDictInterface : public QObject, public AccentsNormalizer {
   Q_OBJECT
   public:
     CommonDictInterface(QObject *parent = 0):QObject(parent) {}
-
     virtual ~CommonDictInterface() {}
 
     //! returns source language code iso 639-2
@@ -67,7 +66,6 @@ class CommonDictInterface : public QObject, public AccentsNormalizer {
         for adding new dictionary and changing plugin settings*/
     virtual DictDialog* dictDialog() = 0;
 
-
     //! returns new, clean copy of plugin with settings set as in Settings*
     virtual CommonDictInterface* getNew(const Settings*) const = 0;
 
@@ -78,10 +76,14 @@ class CommonDictInterface : public QObject, public AccentsNormalizer {
     virtual QString search(QString key) = 0;
 
     //! \returns unique value (unique for every dictionary, not plugin)
-    virtual uint hash() const = 0;
+    virtual uint hash() const {
+        return _hash;
+    }
 
     //! sets unique value (unique for every dictionary, not plugin)
-    virtual void setHash(uint) = 0;
+    virtual void setHash(uint h) {
+        this->_hash=h;
+    }
 
     //! returns current plugin settings
     virtual Settings* settings() = 0;
@@ -112,11 +114,10 @@ class CommonDictInterface : public QObject, public AccentsNormalizer {
     //! stops current operation
     virtual void stop() = 0;
 
-  Q_SIGNALS:
-
-    //! emitted when dictionary is ready to use afer being loaded
-    void loaded(CommonDictInterface*);
+    //! loads translations for each plugin only once
+    virtual void retranslate() {}
 
+  Q_SIGNALS:
     //! emitted after change in dictionary settings
     void settingsChanged();
 
@@ -129,11 +130,15 @@ class CommonDictInterface : public QObject, public AccentsNormalizer {
     
 
 protected:
+//! removes accents from letters in searched word (e.g. ą -> a, ł -> l)
     QString removeAccents(QString string) {
         if(settings()->value("strip_accents") == "true")
             return AccentsNormalizer::removeAccents(string);
         return string;
     }
+
+    uint _hash;
+
 };
 
 Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");