Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 11377 → Rev 11381

/branches/Version133x/Scribus/scribus/plugins/gettext/txtim/txtim.cpp
14,6 → 14,7
 
#include "txtim.h"
#include "scribusstructs.h"
#include "util.h"
 
QString FileFormatName()
{
39,7 → 40,6
writer = w;
textOnly = textO;
loadText();
toUnicode();
}
 
void TxtIm::write()
49,23 → 49,12
 
void TxtIm::loadText()
{
text = "";
QFile f(filename);
QFileInfo fi(f);
if (!fi.exists())
return;
uint posi;
QByteArray bb(f.size());
if (f.open(IO_ReadOnly))
{
f.readBlock(bb.data(), f.size());
f.close();
for (posi = 0; posi < bb.size(); ++posi)
text += QChar(bb[posi]);
}
QCString rawText;
if (loadRawText(filename, rawText))
text = toUnicode(rawText);
}
 
void TxtIm::toUnicode()
QString TxtIm::toUnicode(const QCString& rawText)
{
QTextCodec *codec;
if (encoding.isEmpty())
72,8 → 61,8
codec = QTextCodec::codecForLocale();
else
codec = QTextCodec::codecForName(encoding);
QString dec = codec->toUnicode( text );
text = dec;
QString unistr = codec->toUnicode( rawText );
return unistr;
}
 
TxtIm::~TxtIm()
/branches/Version133x/Scribus/scribus/plugins/gettext/txtim/txtim.h
16,6 → 16,8
 
extern "C" PLUGIN_API QStringList FileExtensions();
 
class QCString;
 
class TxtIm
{
public:
29,7 → 31,7
gtWriter *writer;
bool textOnly;
void loadText();
void toUnicode();
QString toUnicode(const QCString& rawText);
};
 
#endif // TXTIM_H