#include <QDebug>
#include <QFile>
#include <QXmlStreamReader>
+#include <QtPlugin>
+ #include "TranslationXdxf.h"
XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
_langFrom(tr("")), _langTo(tr("")),_name(tr("")),
_type(tr("xdxf")), _infoNote(tr("")) {
path="dict.xdxf";
+ stopped = false;
}
QString XdxfPlugin::langFrom() const {
}
QList<Translation*> XdxfPlugin::searchWordList(QString word, int limit) {
+ stopped = false;
QRegExp regWord(word);
- QList<Translation*> translations;
+ regWord.setCaseSensitivity(Qt::CaseInsensitive);
regWord.setPatternSyntax(QRegExp::Wildcard);
+
+ QList<Translation*> translations;
QFile dictionaryFile(path);
if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
qDebug()<<"Error: could not open file";
if(dictionaryReader.name()=="ar"){
while(dictionaryReader.name()!="k" && !dictionaryReader.atEnd())
dictionaryReader.readNextStartElement();
- a = dictionaryReader.readElementText();
- if(regWord.exactMatch(a) && i<limit) {
+ a = dictionaryReader.readElementText();
+ if(regWord.exactMatch(a) && i<limit) {
translations.append(new TranslationXdxf(a,_infoNote,this));
- qDebug()<<a;
i++;
if(i>=limit)
break;
QString XdxfPlugin::search(QString key) {
QFile dictionaryFile(path);
if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
- return ""; //blad otwarcia pliku
+ qDebug()<<"Error: could not open file";
+ return "";
}
QXmlStreamReader dictionaryReader(&dictionaryFile);
match = true;
}
}
- else if(dictionaryReader.tokenType() == QXmlStreamReader::Characters)
+ else if(dictionaryReader.tokenType() == QXmlStreamReader::Characters) {
if(match) {
- dictionaryFile.close();
- qDebug()<<dictionaryReader.text().toString().replace("\n","");
- return dictionaryReader.text().toString().replace("\n","");
+ QString temp(dictionaryReader.text().toString().replace("\n",""));
+ dictionaryFile.close();
+ return temp;
}
+ }
}
return "";
}
}
QDialog* XdxfPlugin::settingsDialog() {
- ;
+ path="dict.xdxf";
}
CommonDictInterface* XdxfPlugin::getNew(const Settings*) const {
+ // CommonDictInterface *commonDictInterface= new
;
}
return true;
}
+void XdxfPlugin::setHash(uint _hash)
+{
+ this->_hash=_hash;
+}
+
uint XdxfPlugin::hash() const
{
- return 1;
+ return _hash;
}
+
+Q_EXPORT_PLUGIN2(xdxf, XdxfPlugin)