X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fconverter.C;h=8ab0ff809ba948e222a7ed4b68804d84e3ee9e35;hb=b2f4586c984226bcc945d93891f3d0736d6ffb43;hp=004e5edf3f2f888509e4078a8a1e3cdffdccb4df;hpb=3f7e3f8bef19e6fd66ae27c34de3dd90f03b0ea2;p=lyx.git diff --git a/src/converter.C b/src/converter.C index 004e5edf3f..8ab0ff809b 100644 --- a/src/converter.C +++ b/src/converter.C @@ -18,20 +18,22 @@ #include "converter.h" #include "lyxrc.h" -#include "support/syscall.h" -#include "support/path.h" -#include "support/filetools.h" #include "buffer.h" #include "bufferview_funcs.h" #include "LaTeX.h" #include "LyXView.h" -#include "lyx_gui_misc.h" #include "lyx_cb.h" // ShowMessage() -#include "support/lyxfunctional.h" #include "gettext.h" #include "BufferView.h" #include "debug.h" +#include "frontends/Alert.h" + +#include "support/filetools.h" +#include "support/lyxfunctional.h" +#include "support/path.h" +#include "support/systemcall.h" + using std::vector; using std::queue; using std::endl; @@ -168,7 +170,7 @@ bool Formats::view(Buffer const * buffer, string const & filename, format->isChildFormat()) format = getFormat(format->parentFormat()); if (!format || format->viewer().empty()) { - WriteAlert(_("Can not view file"), + Alert::alert(_("Cannot view file"), _("No information for viewing ") + prettyName(format_name)); return false; @@ -194,11 +196,11 @@ bool Formats::view(Buffer const * buffer, string const & filename, ShowMessage(buffer, _("Executing command:"), command); Path p(OnlyPath(filename)); - Systemcalls one; - int const res = one.startscript(Systemcalls::SystemDontWait, command); + Systemcall one; + int const res = one.startscript(Systemcall::DontWait, command); if (res) { - WriteAlert(_("Can not view file"), + Alert::alert(_("Cannot view file"), _("Error while executing"), command.substr(0, 50)); return false; @@ -574,7 +576,7 @@ bool Converters::convert(Buffer const * buffer, EdgePath edgepath = getPath(from_format, to_format); if (edgepath.empty()) { - WriteAlert(_("Can not convert file"), + Alert::alert(_("Cannot convert file"), _("No information for converting from ") + formats.prettyName(from_format) + _(" to ") + formats.prettyName(to_format)); @@ -643,12 +645,12 @@ bool Converters::convert(Buffer const * buffer, if (buffer) ShowMessage(buffer, _("Executing command:"), command); - Systemcalls::Starttype type = (dummy) - ? Systemcalls::SystemDontWait : Systemcalls::System; - Systemcalls one; + Systemcall::Starttype type = (dummy) + ? Systemcall::DontWait : Systemcall::Wait; + Systemcall one; int res; if (conv.original_dir && buffer) { - Path p(buffer->filepath); + Path p(buffer->filePath()); res = one.startscript(type, command); } else res = one.startscript(type, command); @@ -658,17 +660,17 @@ bool Converters::convert(Buffer const * buffer, string const command2 = conv.parselog + " < " + QuoteName(infile2 + ".out") + " > " + QuoteName(logfile); - one.startscript(Systemcalls::System, command2); + one.startscript(Systemcall::Wait, command2); if (!scanLog(buffer, command, logfile)) return false; } if (res) { if (conv.to == "program") - WriteAlert(_("There were errors during the Build process."), + Alert::alert(_("There were errors during the Build process."), _("You should try to fix them.")); else - WriteAlert(_("Can not convert file"), + Alert::alert(_("Cannot convert file"), "Error while executing", command.substr(0, 50)); return false; @@ -691,7 +693,7 @@ bool Converters::convert(Buffer const * buffer, string to = subst(conv.result_dir, token_base, to_base); if (!lyx::rename(from, to)) { - WriteAlert(_("Error while trying to move directory:"), + Alert::alert(_("Error while trying to move directory:"), from, ("to ") + to); return false; } @@ -727,7 +729,7 @@ bool Converters::move(string const & from, string const & to, bool copy) ? lyx::copy(from2, to2) : lyx::rename(from2, to2); if (!moved && no_errors) { - WriteAlert(_("Error while trying to move file:"), + Alert::alert(_("Error while trying to move file:"), from2, _("to ") + to2); no_errors = false; } @@ -818,13 +820,13 @@ bool Converters::scanLog(Buffer const * buffer, string const & command, } string head; split(command, head, ' '); - WriteAlert(_("There were errors during running of ") + head, + Alert::alert(_("There were errors during running of ") + head, s, t); return false; } else if (result & LaTeX::NO_OUTPUT) { string const s = _("The operation resulted in"); string const t = _("an empty file."); - WriteAlert(_("Resulting file is empty"), s, t); + Alert::alert(_("Resulting file is empty"), s, t); return false; } return true; @@ -850,7 +852,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) // do the LaTex run(s) TeXErrors terr; - LaTeX latex(command, name, buffer->filepath); + LaTeX latex(command, name, buffer->filePath()); int result = latex.run(terr, bv ? bv->owner()->getLyXFunc() : 0); @@ -872,7 +874,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) // check return value from latex.run(). if ((result & LaTeX::NO_LOGFILE)) { - WriteAlert(_("LaTeX did not work!"), + Alert::alert(_("LaTeX did not work!"), _("Missing log file:"), name); } else if ((result & LaTeX::ERRORS)) { int num_errors = latex.getNumErrors(); @@ -886,12 +888,12 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) s += _(" errors detected."); t = _("You should try to fix them."); } - WriteAlert(_("There were errors during the LaTeX run."), + Alert::alert(_("There were errors during the LaTeX run."), s, t); } else if (result & LaTeX::NO_OUTPUT) { string const s = _("The operation resulted in"); string const t = _("an empty file."); - WriteAlert(_("Resulting file is empty"), s, t); + Alert::alert(_("Resulting file is empty"), s, t); } if (bv)