projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Switch segment storage from single vector to vector of arrays
[pulseview.git]
/
pv
/
session.cpp
diff --git
a/pv/session.cpp
b/pv/session.cpp
index 773cf8047956d9cd062d5e3d65b3c2e11ecd0c7e..97741ebf7b944a4c6507bd1a4e64c1d8128a5d5b 100644
(file)
--- a/
pv/session.cpp
+++ b/
pv/session.cpp
@@
-14,8
+14,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _WIN32
*/
#ifdef _WIN32
@@
-106,7
+105,8
@@
Session::Session(DeviceManager &device_manager, QString name) :
default_name_(name),
name_(name),
capture_state_(Stopped),
default_name_(name),
name_(name),
capture_state_(Stopped),
- cur_samplerate_(0)
+ cur_samplerate_(0),
+ data_saved_(true)
{
}
{
}
@@
-173,6
+173,11
@@
shared_ptr<pv::toolbars::MainBar> Session::main_bar() const
return main_bar_;
}
return main_bar_;
}
+bool Session::data_saved() const
+{
+ return data_saved_;
+}
+
void Session::save_settings(QSettings &settings) const
{
map<string, string> dev_info;
void Session::save_settings(QSettings &settings) const
{
map<string, string> dev_info;
@@
-852,6
+857,13
@@
void Session::sample_thread_proc(function<void (const QString)> error_handler)
assert(0);
}
assert(0);
}
+ // We now have unsaved data unless we just "captured" from a file
+ shared_ptr<devices::File> file_device =
+ dynamic_pointer_cast<devices::File>(device_);
+
+ if (!file_device)
+ data_saved_ = false;
+
if (out_of_memory_)
error_handler(tr("Out of memory, acquisition stopped."));
}
if (out_of_memory_)
error_handler(tr("Out of memory, acquisition stopped."));
}
@@
-915,8
+927,6
@@
void Session::feed_in_logic(shared_ptr<Logic> logic)
{
lock_guard<recursive_mutex> lock(data_mutex_);
{
lock_guard<recursive_mutex> lock(data_mutex_);
- const size_t sample_count = logic->data_length() / logic->unit_size();
-
if (!logic_data_) {
// The only reason logic_data_ would not have been created is
// if it was not possible to determine the signals when the
if (!logic_data_) {
// The only reason logic_data_ would not have been created is
// if it was not possible to determine the signals when the
@@
-930,8
+940,7
@@
void Session::feed_in_logic(shared_ptr<Logic> logic)
// Create a new data segment
cur_logic_segment_ = shared_ptr<data::LogicSegment>(
// Create a new data segment
cur_logic_segment_ = shared_ptr<data::LogicSegment>(
- new data::LogicSegment(
- logic, cur_samplerate_, sample_count));
+ new data::LogicSegment(logic, cur_samplerate_));
logic_data_->push_segment(cur_logic_segment_);
// @todo Putting this here means that only listeners querying
logic_data_->push_segment(cur_logic_segment_);
// @todo Putting this here means that only listeners querying
@@
-976,8
+985,7
@@
void Session::feed_in_analog(shared_ptr<Analog> analog)
// Create a segment, keep it in the maps of channels
segment = shared_ptr<data::AnalogSegment>(
// Create a segment, keep it in the maps of channels
segment = shared_ptr<data::AnalogSegment>(
- new data::AnalogSegment(
- cur_samplerate_, sample_count));
+ new data::AnalogSegment(cur_samplerate_));
cur_analog_segments_[channel] = segment;
// Find the analog data associated with the channel
cur_analog_segments_[channel] = segment;
// Find the analog data associated with the channel
@@
-1065,4
+1073,9
@@
void Session::data_feed_in(shared_ptr<sigrok::Device> device,
}
}
}
}
+void Session::on_data_saved()
+{
+ data_saved_ = true;
+}
+
} // namespace pv
} // namespace pv