* src/support/SystemcallPrivate{cpp,h}:

- provide some more information about the processes result.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22080 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-12-11 10:34:53 +00:00
parent a546950935
commit 0c8e63f887
2 changed files with 48 additions and 7 deletions

View File

@ -46,12 +46,12 @@ SystemcallPrivate::SystemcallPrivate()
}
int SystemcallPrivate::start(const std::string& cmd, bool waitForFinished)
int SystemcallPrivate::start(const std::string & cmd, bool waitForFinished)
{
ProgressInterface* progress = Systemcall::progress();
if (progress) {
progress->clearMessages();
progress->appendMessage(qt_("Starting LaTeX with command "));
progress->appendMessage(qt_("Starting process with command "));
progress->appendMessage(cmd.c_str());
}
@ -89,22 +89,63 @@ void SystemcallPrivate::processStarted()
{
ProgressInterface* progress = Systemcall::progress();
if (progress) {
progress->appendMessage(qt_("LaTeX started\n"));
progress->appendMessage(qt_("Process started\n"));
}
}
void SystemcallPrivate::processError(QProcess::ProcessError)
void SystemcallPrivate::processError(QProcess::ProcessError err)
{
ProgressInterface* progress = Systemcall::progress();
if (progress) {
progress->appendMessage(qt_("LaTeX error\n"));
QString message;
switch (err) {
case QProcess::FailedToStart:
message = qt_("The process failed to start. Either the invoked program is missing, "
"or you may have insufficient permissions to invoke the program.");
break;
case QProcess::Crashed:
message = qt_("The process crashed some time after starting successfully.");
break;
case QProcess::Timedout:
message = qt_("The process timed out. It might be restarted automatically.");
break;
case QProcess::WriteError:
message = qt_("An error occurred when attempting to write to the process. For example, "
"the process may not be running, or it may have closed its input channel.");
break;
case QProcess::ReadError:
message = qt_("An error occurred when attempting to read from the process. For example, "
"the process may not be running.");
break;
case QProcess::UnknownError:
default:
message = qt_("An unknown error occured.");
break;
}
progress->appendMessage(qt_("The process failed: ") + message + '\n');
}
}
void SystemcallPrivate::processFinished(int, QProcess::ExitStatus)
void SystemcallPrivate::processFinished(int, QProcess::ExitStatus status)
{
ProgressInterface* progress = Systemcall::progress();
if (progress) {
QString message;
switch (status) {
case QProcess::NormalExit:
message = qt_("The process exited normally.");
break;
case QProcess::CrashExit:
message = qt_("The process crashed.");
break;
default:
message = qt_("Unknown exit state.");
break;
}
progress->appendMessage(qt_("Process finished: ") + message + '\n');
}
deleteLater();
}

View File

@ -32,7 +32,7 @@ public:
// When waitForFinished == true : returns the exit code of the process
// When waitForFinished == false: returns 0 if the process could be started
int start(const std::string& cmd, bool waitForFinished);
int start(const std::string & cmd, bool waitForFinished);
public Q_SLOTS:
void newProcessOutput();