Q_OBJECT
public:
CommonDictInterface(QObject *parent = 0):QObject(parent) {}
-
virtual ~CommonDictInterface() {}
- //! returns source language code iso 639-2
+ //! \returns source language code iso 639-2
virtual QString langFrom() const = 0;
- //! returns destination language code iso 639-2
+ //! \returns destination language code iso 639-2
virtual QString langTo() const = 0;
- //! returns dictionary name (like "old English" or so)
+ //! \returns dictionary name (like "old English" or so)
virtual QString name() const = 0;
- //! returns dictionary type (xdxf, google translate, etc)
+ //! \returns dictionary type (xdxf, google translate, etc)
virtual QString type() const = 0;
- //! returns information about dictionary in html (name, authors, etc)
+ //! returns information about dictionary (name, authors, etc)
virtual QString infoNote() const = 0;
- /*! returns DictDialog object that creates dialogs
- for adding new dictionary and changing plugin settings*/
+ /*! \returns DictDialog object that creates dialogs
+ for adding a new dictionary and changing plugin settings*/
virtual DictDialog* dictDialog() = 0;
-
- //! returns new, clean copy of plugin with settings set as in Settings*
+ //! \returns new, clean copy of plugin with settings 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
+ //! \returns the actual translation of a word given in a key
virtual QString search(QString key) = 0;
//! \returns unique value (unique for every dictionary, not plugin)
- virtual uint hash() const = 0;
+ virtual uint hash() const {
+ return _hash;
+ }
//! sets unique value (unique for every dictionary, not plugin)
- virtual void setHash(uint) = 0;
+ virtual void setHash(uint h) {
+ this->_hash=h;
+ }
- //! returns current plugin settings
+ //! \returns current plugin settings
virtual Settings* settings() = 0;
- //! returns plugin icon
+ //! \returns plugin icon
virtual QIcon* icon() = 0;
- //! returns empty translation object (to be fetched later) for given key
+ //! \returns empty translation object (to be fetched later) for a given key
virtual Translation* getTranslationFor(QString ) {return 0;}
/*! plugin should delete any files (eg. cache) that have been created and are ready
public Q_SLOTS:
- /*! performs search in dictionary
- \param word word to search in dictionary
+ /*! performs search in a dictionary
+ \param word word to search for in a dictionary
\param limit limit on number of results,
if limit=0 all matching words are returned
//! stops current operation
virtual void stop() = 0;
- virtual void retranslate() = 0;
+ //! loads translations for each plugin only once
+ virtual void retranslate() {}
Q_SIGNALS:
-
- //! emitted when dictionary is ready to use afer being loaded
- void loaded(CommonDictInterface*);
-
//! emitted after change in dictionary settings
void settingsChanged();
/*! emitted to backbone when it's needed to inform user about something
\param Backbone::NotifyType GUI may decide to show different types in
different ways
- \param QString text of the notification
+ \param text of the notification
*/
void notify(Notify::NotifyType, QString);
protected:
+//! removes accents from letters in a word searched for (e.g. ą -> a, ł -> l)
QString removeAccents(QString string) {
if(settings()->value("strip_accents") == "true")
return AccentsNormalizer::removeAccents(string);
return string;
}
+
+ uint _hash;
+
};
Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");