1 /*******************************************************************************
3 This file is part of mDictionary.
5 mDictionary is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 mDictionary is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
21 /*! \file TranslationXdxf.cpp
22 \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
26 #include "TranslationStarDict.h"
29 TranslationStarDict::TranslationStarDict():_key(""),_dictionaryInfo("") {
33 TranslationStarDict::TranslationStarDict(QString _key, QString _dictionaryInfo,
34 StarDictPlugin *starDictPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
35 this->starDictPlugin=starDictPlugin;
37 _dictHash = starDictPlugin->hash();
42 TranslationStarDict::TranslationStarDict(const TranslationStarDict &base) {
44 _dictHash = base._dictHash;
45 _dictionaryInfo = base._dictionaryInfo;
46 lengths = base.lengths;
47 offsets = base.offsets;
48 starDictPlugin = base.starDictPlugin;
52 void TranslationStarDict::add(qint64 offset, qint32 len) {
53 offsets.append(offset);
58 QString TranslationStarDict::key() const {
62 QString TranslationStarDict::toXml() const {
68 for(int i = 0; i < offsets.size(); i++) {
69 result=result + "<dict> <info path=\"/usr/share/mdictionary/stardict.png\" ";
71 result+= " bookmark=\"true\" > \n";
73 result+= " bookmark=\"false\" > \n";
74 if(_dictionaryInfo.isEmpty())
75 result+= "starDict dictionary </info>";
77 result+= _dictionaryInfo +"</info>";
79 /*conwert returned string to XML format*/
80 result+=starDictPlugin->search(_key, offsets.at(i), lengths.at(i));
86 void TranslationStarDict::setKey(QString _key) {
90 void TranslationStarDict::setDictionaryInfo(QString _dictionaryInfo) {
91 this->_dictionaryInfo=_dictionaryInfo;