X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fstoresession.cpp;h=f024a36cb8a8c49792eb5d8bd14d424429f42d2c;hb=dd86facc33e7b52d48e3671b4a98167a106b455d;hp=3d7b058a87034b6c02cc4109347e798b94702b40;hpb=30677c1392b54604b01558cf29b44572731659fc;p=pulseview.git diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 3d7b058a..f024a36c 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -21,6 +21,8 @@ #include "storesession.hpp" +#include + #include #include #include @@ -28,6 +30,7 @@ #include #include #include +#include #include #include @@ -97,7 +100,7 @@ bool StoreSession::start() vector< shared_ptr > achannel_list; vector< shared_ptr > asegment_list; - for (shared_ptr signal : sigs) { + for (const shared_ptr& signal : sigs) { if (!signal->enabled()) continue; @@ -189,6 +192,20 @@ bool StoreSession::start() thread_ = std::thread(&StoreSession::store_proc, this, achannel_list, asegment_list, lsegment); + + // Save session setup if we're saving to srzip and the user wants it + GlobalSettings settings; + bool save_with_setup = settings.value(GlobalSettings::Key_General_SaveWithSetup).toBool(); + + if ((output_format_->name() == "srzip") && (save_with_setup)) { + QString setup_file_name = QString::fromStdString(file_name_); + setup_file_name.truncate(setup_file_name.lastIndexOf('.')); + setup_file_name.append(".pvs"); + + QSettings settings_storage(setup_file_name, QSettings::IniFormat); + session_.save_setup(settings_storage); + } + return true; } @@ -234,6 +251,7 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li const unsigned int samples_per_block = min(asamples_per_block, lsamples_per_block); + const auto context = session_.device_manager().context(); while (!interrupt_ && sample_count_) { progress_updated(); @@ -241,8 +259,6 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li min((uint64_t)samples_per_block, sample_count_); try { - const auto context = session_.device_manager().context(); - for (unsigned int i = 0; i < achannel_list.size(); i++) { shared_ptr achannel = (achannel_list.at(i))->channel(); shared_ptr asegment = asegment_list.at(i); @@ -286,6 +302,11 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li units_stored_ = unit_count_ - (sample_count_ >> progress_scale); } + auto dfend = context->create_end_packet(); + const string ldata_str = output_->receive(dfend); + if (output_stream_.is_open()) + output_stream_ << ldata_str; + // Zeroing the progress variables indicates completion units_stored_ = unit_count_ = 0;