Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 4676 → Rev 4677

/branches/Version13x/Scribus/scribus/plugins/gettext/docim/docim.h
11,6 → 11,7
 
#include "pluginapi.h"
#include <qobject.h>
#include <qstringlist.h>
 
class gtWriter;
class QProcess;
43,7 → 44,6
private slots:
void slotReadOutput();
void slotReadErr();
void slotLaunchFinished();
};
 
#endif // DOCIM_H
/branches/Version13x/Scribus/scribus/plugins/gettext/docim/docim.cpp
8,6 → 8,7
#include "docim.h"
#include "docim.moc"
#include "gtwriter.h"
#include "scpaths.h"
#include "scribusstructs.h"
#include <qobject.h>
#include <qcstring.h>
17,6 → 18,10
#include <qstringlist.h>
#include <qtextcodec.h>
 
#if defined(_WIN32)
#include <windows.h>
#endif
 
bool hasAntiword()
{
static bool searched = false, found = false;
24,7 → 29,11
return found;
 
QProcess *test = new QProcess();
#if defined(_WIN32)
test->addArgument( ScPaths::instance().libDir() + "tools/antiword/antiword.exe" );
#else
test->addArgument("antiword");
#endif
if (test->start())
{
found = true;
35,8 → 44,8
Sleep(5);
#endif
test->kill();
}
delete test;
}
searched = true;
return found;
}
90,18 → 99,52
text = "";
error = "";
proc = new QProcess();
#if defined(_WIN32)
proc->addArgument( ScPaths::instance().libDir() + "tools/antiword/antiword.exe" );
proc->setWorkingDirectory( ScPaths::instance().libDir() + "tools/antiword/" );
#else
proc->addArgument("antiword");
#endif
proc->addArgument("-t");
proc->addArgument("-w 0");
proc->addArgument(filename);
connect(proc, SIGNAL(readyReadStdout()), this, SLOT(slotReadOutput()));
connect(proc, SIGNAL(readyReadStderr()), this, SLOT(slotReadErr()));
connect(proc, SIGNAL(processExited()), this, SLOT(slotLaunchFinished()));
if (!proc->start()) {
#if defined(_WIN32)
QStringList envVar;
QString homeDir = QDir::convertSeparators(ScPaths::instance().libDir() + "tools");
envVar.append( QString("HOME=%1").arg(homeDir) );
if (!proc->start(&envVar))
{
failed = true;
return;
}
#else
if (proc->start())
{
failed = true;
return;
}
#endif
 
while(proc->isRunning())
{
#ifndef _WIN32
usleep(5000);
#else
Sleep(5);
#endif
}
 
if (proc->normalExit())
{
toUnicode();
write();
}
else
failed = true;
}
 
bool DocIm::isRunning()
{
return proc->isRunning();
142,15 → 185,6
error += QString(bb);
}
 
void DocIm::slotLaunchFinished()
{
if (proc->normalExit()) {
toUnicode();
write();
} else
failed = true; // some info to the user too
}
 
DocIm::~DocIm()
{
delete proc;