*******************************************************************************/
-//Created by Bartosz Szatkowski
+/*! /file translation.h
+\brief Interface for translation instances \see Translation
+\author Bartosz Szatkowski <bulislaw@linux.com>
+*/
+
+#ifndef TRANSLATION_H
+#define TRANSLATION_H
+
+#include <QString>
+#include <QMetaType>
+class CommonDictInterface;
+
+
+/*! Translation is kind of GoF proxy, it stores key:translation pair and
+ provide it in lazy way -> key is available always, but translation is fetched
+ as late as possible*/
class Translation {
public:
- QString key() const = 0;
- QString dictionaryInfo() const = 0;
- QString toHtml() const = 0;
-}
+ Translation () { _bookmark = 0; }
+ //! \return word to be translated
+ virtual QString key() const = 0;
+
+ bool operator==(Translation* translation) {
+ return this->key()==translation->key();
+ }
+
+ /*! \returns dictionary information (plugin name, languages, <logo> etc)\
+ to be displayed in translation table header */
+ virtual QString dictionaryInfo() const = 0;
+
+ //! \return parsed raw format into html
+ virtual QString toHtml() const = 0;
+
+ //! \retrun whether given translation is taken from bookmarks
+ virtual bool isBookmark() const {
+ return _bookmark;
+ }
+
+ //! \param b if true then translation is from bookmarks
+ void setBookmark(bool b) {
+ _bookmark = b;
+ }
+
+ //! returns coresponding dict object
+ virtual uint dict() const {return 0;}
+
+ protected:
+ bool _bookmark;
+
+};
+
+Q_DECLARE_METATYPE(Translation*);
+Q_DECLARE_METATYPE(QList<Translation*>);
+
+#endif