projects
/
mdictionary
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix bug (duplication of dictionarys in xdxf downloader)
[mdictionary]
/
src
/
plugins
/
stardict
/
StarDictPlugin.cpp
diff --git
a/src/plugins/stardict/StarDictPlugin.cpp
b/src/plugins/stardict/StarDictPlugin.cpp
index
f30dbc8
..
4c78fe3
100644
(file)
--- a/
src/plugins/stardict/StarDictPlugin.cpp
+++ b/
src/plugins/stardict/StarDictPlugin.cpp
@@
-18,8
+18,9
@@
Copyright 2010 Comarch S.A.
*******************************************************************************/
Copyright 2010 Comarch S.A.
*******************************************************************************/
-
-/*! \file stardictplugin.cpp
+/*!
+ \file StarDictPlugin.cpp
+ \author Jakub Jaszczynski
*/
#include "StarDictPlugin.h"
*/
#include "StarDictPlugin.h"
@@
-42,7
+43,10
@@
StarDictPlugin::StarDictPlugin(QObject *parent) : CommonDictInterface(parent),
_icon = QIcon("/usr/share/mdictionary/stardict.png");
stopped = false;
_icon = QIcon("/usr/share/mdictionary/stardict.png");
stopped = false;
+ _settings->setValue("strip_accents","true");
+
initAccents();
initAccents();
+
}
}
@@
-51,7
+55,7
@@
void StarDictPlugin::retranslate() {
QTranslator *translator = new QTranslator(this);
if(!translator->load(":/stardict/translations/" + locale)) {
QTranslator *translator = new QTranslator(this);
if(!translator->load(":/stardict/translations/" + locale)) {
- translator->load(":/stardicts/translations/en_US");
+ translator->load(":/stardict/translations/en_US");
}
QCoreApplication::installTranslator(translator);
}
}
QCoreApplication::installTranslator(translator);
}
@@
-98,12
+102,13
@@
QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
QString idxPath = settings()->value("idxFileName");
StarDictReader * reader = StarDictReaderFactory::createReader(idxPath);
QString fkey;
QString idxPath = settings()->value("idxFileName");
StarDictReader * reader = StarDictReaderFactory::createReader(idxPath);
QString fkey;
- qint64 offset = 0, len = 0;
- QRegExp keyword(word, Qt::CaseInsensitive, QRegExp::Wildcard);
+ qint64 offset = 0,
+ len = 0;
if( word.indexOf("*")==-1 && word.indexOf("?")==-1 &&
word.indexOf("_")==-1 && word.indexOf("%")==-1)
word+="*";
if( word.indexOf("*")==-1 && word.indexOf("?")==-1 &&
word.indexOf("_")==-1 && word.indexOf("%")==-1)
word+="*";
+ QRegExp keyword(word, Qt::CaseInsensitive, QRegExp::Wildcard);
if((settings()->value("idxoffsetbits") == "32") ||
(settings()->value("idxoffsetbits") == ""))
if((settings()->value("idxoffsetbits") == "32") ||
(settings()->value("idxoffsetbits") == ""))
@@
-122,9
+127,9
@@
QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
offset = reader->readInt64BigEndian();
len = reader->readInt32BigEndian();
offset = reader->readInt64BigEndian();
len = reader->readInt32BigEndian();
- if(keyword.exactMatch(fkey)) {
+ if(keyword.exactMatch(fkey) ) {
TranslationStarDict tran(fkey, infoNote(), this);
TranslationStarDict tran(fkey, infoNote(), this);
- qDebug() << "off/len" << offset << len;
+ // qDebug() << "off/len" << offset << len;
int id = translations.indexOf(tran);
if(id == -1) {
tran.add(offset, len);
int id = translations.indexOf(tran);
if(id == -1) {
tran.add(offset, len);
@@
-158,19
+163,18
@@
QByteArray StarDictPlugin::read(QByteArray::iterator it,
QString StarDictPlugin::interpret(QByteArray::iterator it,
QString StarDictPlugin::interpret(QByteArray::iterator it,
- QByteArray::iterator end, QChar mode,QString key, bool last) {
+ QByteArray::iterator end, QChar mode,QString key, bool) {
QString result;
QString result;
- qDebug()<<"****** mode: "<<mode;
-
- if(mode == 'm' ||
- mode == 'l' ||
- mode == 'g' ||
- mode == 't' ||
- mode == 'y' ||
- mode == 'k' ||
- mode == 'w' ||
- mode == 'h' ||
- mode == 'r' ){
+// qDebug()<<"****** mode: "<<mode;
+ if(mode == 'm'
+ || mode == 'l'
+ || mode == 'g'
+ || mode == 't'
+ || mode == 'y'
+ || mode == 'k'
+ || mode == 'w'
+ || mode == 'h'
+ || mode == 'r'){
result += "<key>" + key + "</key>";
result += "<t>" + QString::fromUtf8(read(it++, end)) + "</t>";
}
result += "<key>" + key + "</key>";
result += "<t>" + QString::fromUtf8(read(it++, end)) + "</t>";
}
@@
-196,7
+200,7
@@
QString StarDictPlugin::interpret(QByteArray::iterator it,
result+="</t>";
}
result+="</t>";
}
-// Dont know whether mDictionary would ever handle binary stardict format
+// W & P Dont know whether mDictionary would ever handle binary stardict format
// to be honest dont see any kind of adventages (can't find any binary dict)
/*
}
// to be honest dont see any kind of adventages (can't find any binary dict)
/*
}
@@
-223,8
+227,6
@@
QString StarDictPlugin::interpret(QByteArray::iterator it,
} else
result += read(it++, end);
} */
} else
result += read(it++, end);
} */
-
- qDebug()<<"wynik "<<result;
return result;
}
return result;
}
@@
-339,15
+341,4
@@
QIcon* StarDictPlugin::icon() {
return &_icon;
}
return &_icon;
}
-
-int StarDictPlugin::countWords() {
- return 0;
-}
-
-
-void StarDictPlugin::clean() {
-
-}
-
-
Q_EXPORT_PLUGIN2(stardict, StarDictPlugin)
Q_EXPORT_PLUGIN2(stardict, StarDictPlugin)