X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgraphics%2FGraphicsConverter.cpp;h=6c3e48d93ad34a2cba1024ccbd829118f831b2d3;hb=38c2cde0d8695ac5287bae218c4a33a2acf18ef8;hp=84cbaf9b1aa1dd26de64052fb5f179ce278b8a2d;hpb=50060053e36b3e9dfe03bc33ed3abac1eacc54b0;p=lyx.git diff --git a/src/graphics/GraphicsConverter.cpp b/src/graphics/GraphicsConverter.cpp index 84cbaf9b1a..6c3e48d93a 100644 --- a/src/graphics/GraphicsConverter.cpp +++ b/src/graphics/GraphicsConverter.cpp @@ -27,7 +27,6 @@ #include "support/lstrings.h" #include "support/os.h" -#include "support/bind.h" #include "support/TempFile.h" #include @@ -40,10 +39,12 @@ namespace lyx { namespace graphics { -class Converter::Impl : public boost::signals2::trackable { +class Converter::Impl { public: /// - Impl(FileName const &, FileName const &, string const &, string const &, string const &); + Impl(FileName const & doc_fname, + FileName const & from_file, string const & to_file_base, + string const & from_format, string const & to_format); /// void startConversion(); @@ -58,12 +59,12 @@ public: /** At the end of the conversion process inform the outside world * by emitting a signal. */ - typedef boost::signals2::signal SignalType; + typedef signals2::signal sig; /// - SignalType finishedConversion; + sig finishedConversion; /// - FileName const & doc_fname_; + FileName const doc_fname_; /// string script_command_; /// @@ -74,6 +75,8 @@ public: bool valid_process_; /// bool finished_; + /// + Trackable tracker_; }; @@ -85,8 +88,8 @@ bool Converter::isReachable(string const & from_format_name, Converter::Converter(FileName const & doc_fname, - FileName const & from_file, string const & to_file_base, - string const & from_format, string const & to_format) + FileName const & from_file, string const & to_file_base, + string const & from_format, string const & to_format) : pimpl_(new Impl(doc_fname, from_file, to_file_base, from_format, to_format)) {} @@ -103,7 +106,7 @@ void Converter::startConversion() const } -boost::signals2::connection Converter::connect(slot_type const & slot) const +signals2::connection Converter::connect(slot_type const & slot) const { return pimpl_->finishedConversion.connect(slot); } @@ -188,9 +191,10 @@ void Converter::Impl::startConversion() return; } - ForkedCall::SignalTypePtr ptr = - ForkedCallQueue::add(script_command_); - ptr->connect(bind(&Impl::converted, this, _1, _2)); + ForkedCall::sigPtr ptr = ForkedCallQueue::add(script_command_); + ptr->connect(ForkedCall::slot([this](pid_t pid, int retval){ + converted(pid, retval); + }).track_foreign(tracker_.p())); } @@ -283,8 +287,7 @@ static void build_script(string const & doc_fname, LYXERR(Debug::GRAPHICS, "build_script ... "); typedef Graph::EdgePath EdgePath; - script << "#!/usr/bin/env python\n" - "# -*- coding: utf-8 -*-\n" + script << "# -*- coding: utf-8 -*-\n" "import os, shutil, sys\n\n" "def unlinkNoThrow(file):\n" " ''' remove a file, do not throw if an error occurs '''\n" @@ -377,9 +380,9 @@ static void build_script(string const & doc_fname, // If two formats share the same extension we may get identical names if (outfile == infile && conv.result_file().empty()) { - TempFile tempfile(addExtension("gconvertXXXXXX", conv.To()->extension())); - tempfile.setAutoRemove(false); - outfile = tempfile.name().toFilesystemEncoding(); + TempFile tmpfile(addExtension("gconvertXXXXXX", conv.To()->extension())); + tmpfile.setAutoRemove(false); + outfile = tmpfile.name().toFilesystemEncoding(); } if (!theConverters().checkAuth(conv, doc_fname))