From 7e1021f8a54eb022f79c5b3eb10e578ce1d5cf5f Mon Sep 17 00:00:00 2001 From: Bartosz Szatkowski Date: Mon, 16 Aug 2010 12:36:25 +0200 Subject: [PATCH] Added BookmarkTranslation Translation implementation for searching in bookmarks --- trunk/src/base/backbone/BookmarkTranslations.h | 82 +++++++++++++++++++++++ trunk/src/base/backbone/HistoryTranslation.h | 85 ------------------------ trunk/src/base/base.pro | 3 +- 3 files changed, 84 insertions(+), 86 deletions(-) create mode 100644 trunk/src/base/backbone/BookmarkTranslations.h delete mode 100644 trunk/src/base/backbone/HistoryTranslation.h diff --git a/trunk/src/base/backbone/BookmarkTranslations.h b/trunk/src/base/backbone/BookmarkTranslations.h new file mode 100644 index 0000000..0226f6a --- /dev/null +++ b/trunk/src/base/backbone/BookmarkTranslations.h @@ -0,0 +1,82 @@ +/******************************************************************************* + + This file is part of mDictionary. + + mDictionary is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + mDictionary is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with mDictionary. If not, see . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! /file BookmarkTranslation.h +\brief Bookmarks functionality needs its own translation object - becouse + Translation object should use slighty different api of Bookmarks objects + +\author Bartosz Szatkowski +*/ +#ifndef BOOKMARKTRANSLATIONS_H +#define BOOKMARKTRANSLATIONS_H + +#include "../../includes/settings.h" +#include "../../includes/translation.h" + +class Bookmarks; + + +class BookmarkTranslation : public Translation +{ +public: + TranslationXdxf(); + TranslationXdxf(QString key, Bookmarks* bookmarks) { + _key = key; + _dictionaryInfo = "Bookmarks"; + _bookmarks = bookmarks; + } + + //! \return word to be translated + QString key() const { + return _key; + } + + /*! \returns dictionary information (plugin name, languages, etc)\ + to be displayed in translation table header*/ + QString dictionaryInfo() const { + return _dictionaryInfo; + } + + //! \return parsed raw format into html + QString toHtml() const { + return _bookmarks->search(_key); + } + + /*! sets the word for which we want to find a translation + \param word for which we want to find a translation */ + void setKey(QString key) { + _key = key; + }; + + //! sets information about dictionary + void setDictionaryInfo(QString dictionaryInfo) { + _dictionaryInfo = dictionaryInfo; + } + + +private: + QString _key; + QString _dictionaryInfo; + Bookmarks* _bookmarks; + +}; + +#endif // HISTORYTRANSLATION_H diff --git a/trunk/src/base/backbone/HistoryTranslation.h b/trunk/src/base/backbone/HistoryTranslation.h deleted file mode 100644 index c1add44..0000000 --- a/trunk/src/base/backbone/HistoryTranslation.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - - This file is part of mDictionary. - - mDictionary is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - mDictionary is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with mDictionary. If not, see . - - Copyright 2010 Comarch S.A. - -*******************************************************************************/ - -/*! /file HistoryTranslation.h -\brief Bookmarks functionality needs its own translation object - becouse - Translation object should use slighty different api of Bookmarks objects - -\author Bartosz Szatkowski -*/ -#ifndef HISTORYTRANSLATION_H -#define HISTORYTRANSLATION_H - -#ifndef BOOKMARKS_H -#define BOOKMARKS_H - -#include "../../includes/settings.h" -#include "../../includes/translation.h" - -class Bookmarks; - - -class HistoryTranslation : public Translation -{ -public: - TranslationXdxf(); - TranslationXdxf(QString key, Bookmarks* bookmarks) { - _key = key; - _dictionaryInfo = "Bookmarks"; - _bookmarks = bookmarks; - } - - //! \return word to be translated - QString key() const { - return _key; - } - - /*! \returns dictionary information (plugin name, languages, etc)\ - to be displayed in translation table header*/ - QString dictionaryInfo() const { - return _dictionaryInfo; - } - - //! \return parsed raw format into html - QString toHtml() const { - return _bookmarks->search(_key); - } - - /*! sets the word for which we want to find a translation - \param word for which we want to find a translation */ - void setKey(QString key) { - _key = key; - }; - - //! sets information about dictionary - void setDictionaryInfo(QString dictionaryInfo) { - _dictionaryInfo = dictionaryInfo; - } - - -private: - QString _key; - QString _dictionaryInfo; - Bookmarks* _bookmarks; - -}; - -#endif // HISTORYTRANSLATION_H diff --git a/trunk/src/base/base.pro b/trunk/src/base/base.pro index 3fe70ac..02bd90d 100644 --- a/trunk/src/base/base.pro +++ b/trunk/src/base/base.pro @@ -51,7 +51,8 @@ HEADERS += gui/MainWindow.h \ ../includes/History.h \ gui/HistoryListDialog.h \ ../includes/GUIInterface.h \ - backbone/Bookmarks.h + backbone/Bookmarks.h \ + backbone/BookmarkTranslations.h FORMS += gui/MainWindow.ui -- 1.7.9.5