Remove wxWidgets zipper.

This commit is contained in:
tamasmeszaros 2019-03-15 12:34:58 +01:00
parent 0343b82534
commit c91d21f7c1

View File

@ -92,65 +92,13 @@ void BackgroundSlicingProcess::process_fff()
} }
} }
// Pseudo type for specializing LayerWriter trait class
struct SLAwxZipper {};
// The implementation of creating zipped archives with wxWidgets
template<> class LayerWriter<SLAwxZipper> {
wxFileName fpath;
wxFFileOutputStream zipfile;
wxZipOutputStream zipstream;
wxStdOutputStream pngstream;
public:
inline LayerWriter(const std::string& zipfile_path):
fpath(zipfile_path),
zipfile(zipfile_path),
zipstream(zipfile),
pngstream(zipstream)
{
if(!is_ok())
throw std::runtime_error("Cannot create zip file.");
}
~LayerWriter() {
// In case of an error (disk space full) zipstream destructor would
// crash.
pngstream.clear();
zipstream.CloseEntry();
}
inline void next_entry(const std::string& fname) {
zipstream.PutNextEntry(fname);
}
inline std::string get_name() const {
return fpath.GetName().ToUTF8().data();
}
template<class T> inline LayerWriter& operator<<(T&& arg) {
pngstream << std::forward<T>(arg); return *this;
}
bool is_ok() const {
return pngstream.good() && zipstream.IsOk() && zipfile.IsOk();
}
inline void close() {
zipstream.Close();
zipfile.Close();
}
};
void BackgroundSlicingProcess::process_sla() void BackgroundSlicingProcess::process_sla()
{ {
assert(m_print == m_sla_print); assert(m_print == m_sla_print);
m_print->process(); m_print->process();
if (this->set_step_started(bspsGCodeFinalize)) { if (this->set_step_started(bspsGCodeFinalize)) {
if (! m_export_path.empty()) { if (! m_export_path.empty()) {
// m_sla_print->export_raster<SLAZipFmt>(m_export_path); m_sla_print->export_raster(m_export_path);
m_sla_print->export_raster<SLAminzZipper>(m_export_path);
m_print->set_status(100, "Masked SLA file exported to " + m_export_path); m_print->set_status(100, "Masked SLA file exported to " + m_export_path);
} else if (! m_upload_job.empty()) { } else if (! m_upload_job.empty()) {
prepare_upload(); prepare_upload();
@ -450,9 +398,8 @@ void BackgroundSlicingProcess::prepare_upload()
} }
run_post_process_scripts(source_path.string(), m_fff_print->config()); run_post_process_scripts(source_path.string(), m_fff_print->config());
m_upload_job.upload_data.upload_path = m_fff_print->print_statistics().finalize_output_path(m_upload_job.upload_data.upload_path.string()); m_upload_job.upload_data.upload_path = m_fff_print->print_statistics().finalize_output_path(m_upload_job.upload_data.upload_path.string());
} else { } else {
// m_sla_print->export_raster<SLAZipFmt>(source_path.string()); m_sla_print->export_raster(source_path.string());
m_sla_print->export_raster<SLAminzZipper>(source_path.string());
// TODO: Also finalize upload path like with FFF when there are statistics for SLA print // TODO: Also finalize upload path like with FFF when there are statistics for SLA print
} }