// Created by Bartosz Szatkowski
+
+//! Interface for dict engines plugins
class CommonDictInterface : public QObject {
public:
CommonDictInterface(const QObject *parent = 0) = 0;
+
+ //! returns source language code iso 639-2
virtual QString langFrom() const = 0;
+
+ //! returns destination language code iso 639-2
virtual QString langTo() const = 0;
+
+ //! returns dictionary name (like "old english" or so
virtual QString name() const = 0;
+
+ //! returns dictionary type (xdxf, google translate, etc)
virtual QString type() const = 0;
+
+ //! returns information about dictionary in html (name, authors, etc)
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;
+
+ //! return dialog with dictionary settings
virtual QDialog* settingsDialog() = 0;
+
+ //! return new, clean copy of plugin with setting set as in Settings*
virtual CommonDictInterface* getNew(const Settings*) const = 0;
+
+ //! returns whether plugin can start searching
virtual bool isAvailable() const = 0;
public Q_SLOTS:
- virtual void search(QString, int) = 0;
+ /*! performes search in dictionary
+ \param word word to search in dictionary
+ \param limit limit on number of results
+
+ After finishing search it have to emit
+ \see CommonDictInterface:finalTranslation finalTranslation
+
+ */
+ virtual void search(QString word, int limit) = 0;
+
+ //! stop current operation
virtual void stop() = 0;
Q_SIGNALS:
- void finalTranslation(QList<Translation*>)
- void load(CommonDictInterface*)
+ //! emit list of finded Translations
+ void finalTranslation(QList<Translation*>);
+
+ //! emited after dictionary is ready to use afer being loaded
+ void loaded(CommonDictInterface*);
}
//Created by Bartosz Szatkowski
+//! Plugin specific configuration
class Settings {
public:
- QString value(const QString) const = 0;
- void setValue(const QString, const Qstring) = 0;
+ //! \retrun value fo given key
+ //! \param key
+ QString value(const QString key) const = 0;
+
+ //! sets key to value
+ void setValue(const QString key, const Qstring value) = 0;
+
+ //! \return dict CommonDictInterface
CommonDictInterface type() const = 0;
+
+ //! sets settings type to given dictionary
void setType(const CommonDictInterface) = 0;
}
//Created by Bartosz Szatkowski
+//! Keeping raw form of translation to be parsed only when needed
class Translation {
public:
+ //! \return word to be translated
QString key() const = 0;
+
+ //! \returns dictionary information (plugin name, languages, <logo> etc)\
+ //! to be displayed in translation table header
QString dictionaryInfo() const = 0;
+
+ //! \return parsed raw format into html
QString toHtml() const = 0;
}