Added icon to xdxf plugin and commonDictInterface
[mdictionary] / trunk / src / includes / CommonDictInterface.h
index 7ece263..fa094ce 100644 (file)
@@ -21,7 +21,6 @@
 
 // Created by Bartosz Szatkowski
 
-
 #ifndef COMMONDICTINTERFACE_H
 #define COMMONDICTINTERFACE_H
 
 #include <QObject>
 #include <QList>
 #include "translation.h"
-class Settings;
 
+class DictDialog;
+class Settings;
 
 
 //! Interface for dict engines plugins
 class CommonDictInterface : public QObject {
   Q_OBJECT
   public:
+    CommonDictInterface(QObject *parent = 0):QObject(parent) {}
+
     //! returns source language code iso 639-2
-    virtual QString langFrom() const = 0; 
+    virtual QString langFrom() const = 0;
 
     //! returns destination language code iso 639-2
     virtual QString langTo() const = 0;
@@ -48,46 +50,60 @@ class CommonDictInterface : public QObject {
     virtual QString name() const = 0;
 
     //! returns dictionary type (xdxf, google translate, etc)
-    virtual QString type() const = 0;        
+    virtual QString type() const = 0;
 
     //! returns information about dictionary in html (name, authors, etc)
-    virtual QString infoNote() const = 0; 
+    virtual QString infoNote() const = 0;
 
-    //! return dialog that creates new dictionary and fills necesary options
-    //! QDialog should returns Setting* object after being showed
-    virtual QDialog* loadDialog() = 0;  
+    /*! returns DictDialog object that creates dialogs
+        for adding new dictionary and change plugin settings*/
+    virtual DictDialog* dictDialog() = 0;
 
-    //! return dialog with dictionary settings
-    virtual QDialog* settingsDialog() = 0;
 
-    //! return new, clean copy of plugin with setting set as in Settings*
+    //! returns new, clean copy of plugin with setting set as in Settings*
     virtual CommonDictInterface* getNew(const Settings*) const = 0;
 
-    //! returns whether plugin can start searching 
+    //! returns whether plugin can start searching
     virtual bool isAvailable() const = 0;
 
+    //! returns the actual translation of a word given in key
+    virtual QString search(QString key) = 0;
+
     //! \returns unique value (unique for every dictionary not plugin
     virtual uint hash() const = 0;
 
+    //! sets unique value (unique for every dictionary not plugin)
+    virtual void setHash(uint) = 0;
+
+    //! returns current plugin settings
+    virtual Settings* settings() = 0;
+
+    //! returns plugin icon
+    virtual QIcon icon() = 0;
+
  public Q_SLOTS:
-    /*! performes search in dictionary
+    /*! performs search in dictionary
         \param  word word to search in dictionary
-        \param limit limit on number of results
+        \param  limit limit on number of results,
+                if limit=0 all matching words are returned
 
-        After finishing search it have to emit 
+        After finishing search it have to emit
         \see CommonDictInterface:finalTranslation  finalTranslation
-
     */
-    virtual void search(QString word, int limit) = 0;                         
+    virtual QList<Translation*> searchWordList(QString word, int limit=0) = 0;
 
-    //! stop current operation
-    virtual void stop() = 0;                        
+    //! stops current operation
+    virtual void stop() = 0;
 
   Q_SIGNALS:
-    //! emit list of finded Translations
-    void finalTranslation(QList<Translation*>);
 
     //! emited after dictionary is ready to use afer being loaded
     void loaded(CommonDictInterface*);
+
+    //! emited after change dictionary settings
+    void settingsChanged();
 };
+
+Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");
+
 #endif