QChar CompressedReader::readChar() {
- char c[1];
+ char c[2]={0};
gzread(_file, c, 1);
- return QChar(c[0]);
+ QString cha(QString::fromUtf8(c));
+ if(!cha.at(0).isLetter() && c[0]!=0){
+ gzread(_file, c, 1);
+ cha=QString::fromUtf8(c);
+ }
+ return cha.at(0);
}
qint32 CompressedReader::readInt32BigEndian() {
int counter = 0;
int counterLimit = 0;
- while(counter < wordcount && (counterLimit<limit || limit==0)) {
+ stopped=false;
+ while(counter < wordcount && (counterLimit<limit || limit==0) && !stopped) {
counter++;
fkey = reader->readKeyword();
if(is32b)
QString StarDictPlugin::interpret(QByteArray::iterator it,
QByteArray::iterator end, QChar mode,QString key, bool last) {
QString result;
+ qDebug()<<"****** mode: "<<mode;
if(mode == 'm'){
result += "<key>" + key + "</key>";
result += QString::fromUtf8(read(it++, end));
/* delete "small" tag from translation*/
int indexOfSmall=result.indexOf("<small>");
while(indexOfSmall!=-1){
- qDebug()<<"przed"<<result;
int indexOfEndSmall= result.indexOf("</small>");
if(indexOfEndSmall!=-1)
result.remove(indexOfSmall,indexOfEndSmall-indexOfSmall+8);
indexOfSmall=result.indexOf("<small>");
- qDebug()<<"po"<<result;
}
}
else if(mode == 't'){
void StarDictPlugin::stop() {
+ qDebug()<<"zatrzymanie programu";
stopped=true;
}
#include "UncompressedReader.h"
-
+#include "QDebug"
UncompressedReader::UncompressedReader(QObject *parent) :
StarDictReader(parent) {
}
QChar UncompressedReader::readChar() {
- char c[1];
-
- _stream.readRawData(c, 1);
- return QChar(c[0]);
+ char c[2]={0};
+ _stream.readRawData(c,1);
+ QString cha(QString::fromUtf8(c));
+ if(!cha.at(0).isLetter() && c[0]!=0){
+ _stream.readRawData(c+1,1);
+ cha=QString::fromUtf8(c);
+ }
+ return cha.at(0);
}
QString UncompressedReader::readKeyword() {