X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgraphics%2FGraphicsConverter.cpp;h=6c3e48d93ad34a2cba1024ccbd829118f831b2d3;hb=110f8f67ac1afe9892dad5566d1c697044427cf0;hp=55ae24624b0992334b4623a6f9495b04bfb68b7b;hpb=244de5d2c10a990828eafdd72283fc87742dc133;p=lyx.git diff --git a/src/graphics/GraphicsConverter.cpp b/src/graphics/GraphicsConverter.cpp index 55ae24624b..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); } @@ -139,7 +142,7 @@ Converter::Impl::Impl(FileName const & doc_fname, // The converted image is to be stored in this file (we do not // use ChangeExtension because this is a basename which may // nevertheless contain a '.') - to_file_ = FileName(to_file_base + '.' + formats.extension(to_format)); + to_file_ = FileName(to_file_base + '.' + theFormats().extension(to_format)); // The conversion commands are stored in a stringstream ostringstream script; @@ -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))