X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Finclude%2FCommonDictInterface.h;h=0f0c415a43872bacb1854081294d17bc696b72b3;hb=14cb9cc957bcdc9c39af54ba168c6816a1910a2d;hp=f09815d01eb7d77cd1401f0d34c0b53ffcd7d557;hpb=504579054540ea1a39a7941c15dd180fa0374bbe;p=mdictionary diff --git a/src/include/CommonDictInterface.h b/src/include/CommonDictInterface.h index f09815d..0f0c415 100644 --- a/src/include/CommonDictInterface.h +++ b/src/include/CommonDictInterface.h @@ -45,51 +45,53 @@ class CommonDictInterface : public QObject, public AccentsNormalizer { 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 @@ -99,8 +101,8 @@ class CommonDictInterface : public QObject, public AccentsNormalizer { 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 @@ -112,30 +114,31 @@ class CommonDictInterface : public QObject, public AccentsNormalizer { //! 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");