removeAccents refactorized out to the AccentsNormalizer class
[mdictionary] / trunk / src / plugins / xdxf / src / xdxfplugin.h
index 7d0cd93..f3cabe6 100644 (file)
 
 *******************************************************************************/
 
+
+/*! \file xdxfplugin.h
+*/
 #ifndef XDXFPLUGIN_H
 #define XDXFPLUGIN_H
 
-#include "../../../includes/CommonDictInterface.h"
+
 #include <QObject>
 #include <QDialog>
 #include <QRegExp>
 #include <QTime>
+#include <QSqlQuery>
+#include <QSqlDatabase>
+#include <QSqlError>
+#include <QFile>
+#include <QXmlStreamReader>
+#include <QtPlugin>
+
+#include "../../../includes/CommonDictInterface.h"
+#include "../../../includes/settings.h"
 #include "XdxfDictDialog.h"
+#include "XdxfCachingDialog.h"
+#include "TranslationXdxf.h"
 
 class TranslationXdxf;
 
@@ -37,6 +51,7 @@ class XdxfPlugin : public CommonDictInterface
     Q_INTERFACES(CommonDictInterface)
 public:
     XdxfPlugin(QObject *parent=0);
+    ~XdxfPlugin();
 
     //! returns source language code iso 639-2
     QString langFrom() const;
@@ -54,11 +69,10 @@ public:
     QString infoNote() const;
 
     /*! returns DictDialog object that creates dialogs
-        for adding new dictionary and change plugin settings
+        for adding new dictionary and change plugin tings
       */
     DictDialog* dictDialog();
 
-
     //! returns new, clean copy of plugin with setting set as in Settings*
     CommonDictInterface* getNew(const Settings*) const;
 
@@ -84,7 +98,7 @@ public:
     void setSettings(Settings*);
 
     //! returns plugin icon
-    virtual QIcon icon();
+    virtual QIcon* icon();
 
 public Q_SLOTS:
     /*! performs search in dictionary
@@ -99,9 +113,12 @@ public Q_SLOTS:
     //! stop current operation
     void stop();
 
+Q_SIGNALS:
+    //! emited with percent count of caching progress, and time elapsed from
+    //! last signal emit
+    void updateCachingProgress(int, int);
+
 
-protected:
-    QString removeAccents(QString);
 
 private:
 /*! returns true or false depending on whether the dictionary is cached
@@ -112,6 +129,16 @@ private:
 //! sets the path to dictionary file and adds it to settings
     void setPath(QString);
 
+    QList<Translation*> searchWordListCache(QString word, int limit=0);
+    QList<Translation*> searchWordListFile(QString word, int limit=0);
+    QString searchFile(QString key);
+    QString searchCache(QString key);
+    //! scan dictionary file to get information about it
+    void getDictionaryInfo();
+
+    int countWords();
+    bool makeCache(QString dir);
+
     //! language from which we translate
     QString _langFrom;
     //! language to which we translate
@@ -122,22 +149,24 @@ private:
     QString _type;
     //! information about dictionary
     QString _infoNote;
-    QDialog *_loadDialog;
-    QDialog *_settingsDialog;
     //! path to dictionary file
     QString path;
     uint _hash;
     QIcon _icon;
+    QSqlDatabase db;
+    QString db_name;
 
     //! number of words in dicrionary
     long _wordsCount;
 
-    //! scan dictionary file to get information about it
-    void getDictionaryInfo();
 
     volatile bool stopped;
     Settings *_settings;
     XdxfDictDialog* _dictDialog;
+    XdxfCachingDialog* cachingDialog;
+//    extern void initAccents();
+ //   extern QString removeAccents(QString string);
+
 };
 
 #endif // XDXFPLUGIN_H