refaktoring
[mdictionary] / src / plugins / xdxf / xdxfplugin.h
index e825772..76ac714 100644 (file)
@@ -37,8 +37,8 @@
 #include <QXmlStreamReader>
 #include <QtPlugin>
 
-#include "../../common/CommonDictInterface.h"
-#include "../../common/settings.h"
+#include "../../include/CommonDictInterface.h"
+#include "../../include/settings.h"
 #include "XdxfDictDialog.h"
 #include "XdxfCachingDialog.h"
 #include "TranslationXdxf.h"
@@ -74,7 +74,7 @@ public:
       */
     DictDialog* dictDialog();
 
-    //! returns new, clean copy of plugin with setting set as in Settings*
+    //! returns new, clean copy of plugin with settings set as in Settings*
     CommonDictInterface* getNew(const Settings*) const;
 
     //! returns whether plugin can start searching
@@ -83,12 +83,6 @@ public:
     //! returns a description of a word given by a QString
     QString search(QString key);
 
-    //! returns a unique hash for a dictionary
-    uint hash() const;
-
-    //! sets unique value (unique for every dictionary not plugin)
-    void setHash(uint);
-
     //! returns current plugin settings
     Settings* settings();
 
@@ -96,12 +90,12 @@ public:
     long wordsCount();
 
     //! Sets new settings
-    void setSettings(const Settings*);
+    bool setSettings(const Settings*);
 
     //! returns plugin icon
     QIcon* icon();
 
-    /*! plugin should delete any files (eg. cache) that has created and be ready
+    /*! plugin should delete any files (eg. cache) that have been created and are ready
         to be deleted
         */
     void clean();
@@ -121,6 +115,9 @@ public Q_SLOTS:
     //! stop current operation
     void stop();
 
+    //! loads translations for each plugin only once
+    void retranslate();
+
 
 
 Q_SIGNALS:
@@ -131,27 +128,43 @@ Q_SIGNALS:
 
 
 private:
-/*! returns true or false depending on whether the dictionary is cached
-    or not, not implemented yet
- */
-    bool isCached();
-
-//! sets the path to dictionary file and adds it to settings
- //   void setPath(QString);
 
+    /*! returns true or false depending on whether the dictionary is cached
+        or not, not implemented yet
+     */
+    bool isCached();
+    /*! searches for a list of words similar to a word in a database file
+    \param word key compared with keys in a database
+    \param limit limits the number of translations in returned list,
+           0 means unlimited
+    \returns list of translations
+    */
     QList<Translation*> searchWordListCache(QString word, int limit=0);
 
+    /*! searches for a list of words similar to a word in a xdxf file
+    \param word key compared with keys in a xdxf file
+    \param limit limits the number of translations in returned list,
+           0 means unlimited
+    \returns list of translations
+    */
     QList<Translation*> searchWordListFile(QString word, int limit=0);
 
+    /*! searches for a translation of a word which is exactly like a key
+        in xdxf file */
     QString searchFile(QString key);
 
+    /*! searches for a translation of a word which is exactly like a key
+        in database file */
     QString searchCache(QString key);
 
-    //! scan dictionary file to get information about it
-    void getDictionaryInfo();
+    //! scans dictionary file to get information about it
+    bool getDictionaryInfo();
 
+    //! counts the keys in xdxf file
     int countWords();
 
+    /*! transforms xdxf files to database files (caching operation)
+        \returns true on success, false on failure */
     bool makeCache(QString dir);
 
     //! language from which we translate
@@ -162,19 +175,22 @@ private:
     QString _name;
     //! information about dictionary
     QString _infoNote;
-    //! path to dictionary file
- //   QString path;
+
+    QString _dictionaryInfo;
+
+    //! unique number of a dictionary assigned to it by backbone
     uint _hash;
+    //! icon displayed during translations and when the dictionary is chosen
     QIcon _icon;
     QSqlDatabase db;
     QString db_name;
     //! number of words in dictionary
     long _wordsCount;
+    //! indicates if search is stopped
     volatile bool stopped;
     Settings *_settings;
     XdxfDictDialog* _dictDialog;
     XdxfCachingDialog* cachingDialog;
-
 };
 
 #endif // XDXFPLUGIN_H