namespace dialogs {
StoreProgress::StoreProgress(const QString &file_name,
+ const std::shared_ptr<sigrok::OutputFormat> output_format,
const Session &session, QWidget *parent) :
QProgressDialog(tr("Saving..."), tr("Cancel"), 0, 0, parent),
- session_(file_name.toStdString(), session)
+ session_(file_name.toStdString(), output_format, session)
{
connect(&session_, SIGNAL(progress_updated()),
this, SLOT(on_progress_updated()));
Q_OBJECT
public:
- StoreProgress(const QString &file_name, const Session &session,
- QWidget *parent = 0);
+ StoreProgress(const QString &file_name,
+ const std::shared_ptr<sigrok::OutputFormat> output_format,
+ const Session &session, QWidget *parent = 0);
virtual ~StoreProgress();
const QString abs_path = QFileInfo(file_name).absolutePath();
settings.setValue(SettingSaveDirectory, abs_path);
- StoreProgress *dlg = new StoreProgress(file_name, session_, this);
+ StoreProgress *dlg = new StoreProgress(file_name,
+ device_manager_.context()->output_formats()["srzip"],
+ session_, this);
dlg->run();
}
using sigrok::ConfigKey;
using sigrok::Error;
+using sigrok::OutputFormat;
namespace pv {
const size_t StoreSession::BlockSize = 1024 * 1024;
StoreSession::StoreSession(const std::string &file_name,
- const Session &session) :
+ const shared_ptr<OutputFormat> &output_format, const Session &session) :
file_name_(file_name),
+ output_format_(output_format),
session_(session),
interrupt_(false),
units_stored_(0),
// Begin storing
try {
auto context = session_.session()->context();
- auto output_format = context->output_formats()["srzip"];
auto device = session_.device();
- output_ = output_format->create_output(device,
+ output_ = output_format_->create_output(device,
{{"filename",
Glib::Variant<Glib::ustring>::create(file_name_)}});
auto meta = context->create_meta_packet(
#include <stdint.h>
#include <atomic>
+#include <memory>
#include <mutex>
#include <string>
#include <thread>
namespace sigrok {
class Output;
+class OutputFormat;
}
namespace pv {
public:
StoreSession(const std::string &file_name,
+ const std::shared_ptr<sigrok::OutputFormat> &output_format,
const Session &session);
~StoreSession();
private:
const std::string file_name_;
+ const std::shared_ptr<sigrok::OutputFormat> output_format_;
const Session &session_;
std::shared_ptr<sigrok::Output> output_;