#include "support/lstrings.h"
#include "support/os.h"
-#include "support/bind.h"
#include "support/TempFile.h"
#include <sstream>
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();
/** At the end of the conversion process inform the outside world
* by emitting a signal.
*/
- typedef boost::signals2::signal<void(bool)> SignalType;
+ typedef signals2::signal<void(bool)> sig;
///
- SignalType finishedConversion;
+ sig finishedConversion;
///
- FileName const & doc_fname_;
+ FileName const doc_fname_;
///
string script_command_;
///
bool valid_process_;
///
bool finished_;
+ ///
+ Trackable tracker_;
};
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))
{}
}
-boost::signals2::connection Converter::connect(slot_type const & slot) const
+signals2::connection Converter::connect(slot_type const & slot) const
{
return pimpl_->finishedConversion.connect(slot);
}
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()));
}
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"
// 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))