projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use <cmath> in favor of <math.h> everywhere.
[pulseview.git]
/
pv
/
storesession.cpp
diff --git
a/pv/storesession.cpp
b/pv/storesession.cpp
index dbe04b2c00953897bf63ad5d1f8b2a0480836980..6ecde13aff92a5594eb3a0f931687e5fa7170d9d 100644
(file)
--- a/
pv/storesession.cpp
+++ b/
pv/storesession.cpp
@@
-20,12
+20,12
@@
#include <cassert>
#include <cassert>
-#include "storesession.h"
+#include "storesession.h
pp
"
-#include <pv/s
igsession.h
>
-#include <pv/data/logic.h>
-#include <pv/data/logics
napshot.h
>
-#include <pv/view/signal.h>
+#include <pv/s
ession.hpp
>
+#include <pv/data/logic.h
pp
>
+#include <pv/data/logics
egment.hpp
>
+#include <pv/view/signal.h
pp
>
#include <libsigrok/libsigrok.hpp>
#include <libsigrok/libsigrok.hpp>
@@
-53,7
+53,7
@@
namespace pv {
const size_t StoreSession::BlockSize = 1024 * 1024;
StoreSession::StoreSession(const std::string &file_name,
const size_t StoreSession::BlockSize = 1024 * 1024;
StoreSession::StoreSession(const std::string &file_name,
- const S
igS
ession &session) :
+ const Session &session) :
file_name_(file_name),
session_(session),
interrupt_(false),
file_name_(file_name),
session_(session),
interrupt_(false),
@@
-106,17
+106,17
@@
bool StoreSession::start()
return false;
}
return false;
}
- // Get the s
napsho
t
- const deque< shared_ptr<data::LogicS
napshot> > &snapsho
ts =
- data->
get_snapsho
ts();
+ // Get the s
egmen
t
+ const deque< shared_ptr<data::LogicS
egment> > &segmen
ts =
+ data->
logic_segmen
ts();
- if (s
napsho
ts.empty()) {
- error_ = tr("No s
napsho
ts to save.");
+ if (s
egmen
ts.empty()) {
+ error_ = tr("No s
egmen
ts to save.");
return false;
}
return false;
}
- const shared_ptr<data::LogicS
napshot> snapshot(snapsho
ts.front());
- assert(s
napsho
t);
+ const shared_ptr<data::LogicS
egment> segment(segmen
ts.front());
+ assert(s
egmen
t);
// Begin storing
try {
// Begin storing
try {
@@
-127,15
+127,15
@@
bool StoreSession::start()
{{"filename",
Glib::Variant<Glib::ustring>::create(file_name_)}});
auto meta = context->create_meta_packet(
{{"filename",
Glib::Variant<Glib::ustring>::create(file_name_)}});
auto meta = context->create_meta_packet(
- {{ConfigKey::SAMPLERATE,
-
Glib::Variant<guint64>::create(data
->samplerate())}});
+ {{ConfigKey::SAMPLERATE,
Glib::Variant<guint64>::create(
+
segment
->samplerate())}});
output_->receive(meta);
} catch (Error error) {
error_ = tr("Error while saving.");
return false;
}
output_->receive(meta);
} catch (Error error) {
error_ = tr("Error while saving.");
return false;
}
- thread_ = std::thread(&StoreSession::store_proc, this, s
napsho
t);
+ thread_ = std::thread(&StoreSession::store_proc, this, s
egmen
t);
return true;
}
return true;
}
@@
-150,9
+150,9
@@
void StoreSession::cancel()
interrupt_ = true;
}
interrupt_ = true;
}
-void StoreSession::store_proc(shared_ptr<data::LogicS
napshot> snapsho
t)
+void StoreSession::store_proc(shared_ptr<data::LogicS
egment> segmen
t)
{
{
- assert(s
napsho
t);
+ assert(s
egmen
t);
uint64_t start_sample = 0, sample_count;
unsigned progress_scale = 0;
uint64_t start_sample = 0, sample_count;
unsigned progress_scale = 0;
@@
-161,10
+161,10
@@
void StoreSession::store_proc(shared_ptr<data::LogicSnapshot> snapshot)
uint8_t *const data = new uint8_t[BlockSize];
assert(data);
uint8_t *const data = new uint8_t[BlockSize];
assert(data);
- const int unit_size = s
napsho
t->unit_size();
+ const int unit_size = s
egmen
t->unit_size();
assert(unit_size != 0);
assert(unit_size != 0);
- sample_count = s
napsho
t->get_sample_count();
+ sample_count = s
egmen
t->get_sample_count();
// Qt needs the progress values to fit inside an int. If they would
// not, scale the current and max values down until they do.
// Qt needs the progress values to fit inside an int. If they would
// not, scale the current and max values down until they do.
@@
-181,7
+181,7
@@
void StoreSession::store_proc(shared_ptr<data::LogicSnapshot> snapshot)
const uint64_t end_sample = min(
start_sample + samples_per_block, sample_count);
const uint64_t end_sample = min(
start_sample + samples_per_block, sample_count);
- s
napsho
t->get_samples(data, start_sample, end_sample);
+ s
egmen
t->get_samples(data, start_sample, end_sample);
size_t length = end_sample - start_sample;
size_t length = end_sample - start_sample;
@@
-198,6
+198,9
@@
void StoreSession::store_proc(shared_ptr<data::LogicSnapshot> snapshot)
units_stored_ = start_sample >> progress_scale;
}
units_stored_ = start_sample >> progress_scale;
}
+ // Zeroing the progress variables indicates completion
+ units_stored_ = unit_count_ = 0;
+
progress_updated();
output_.reset();
progress_updated();
output_.reset();