projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Confirm with user when trying to close sessions with unsaved data
[pulseview.git]
/
pv
/
session.cpp
diff --git
a/pv/session.cpp
b/pv/session.cpp
index 2e98c8f73f40c08a70f451c60716824a1b348bbb..fcd0e135b5a190972613e85ac79ada3f067b7023 100644
(file)
--- a/
pv/session.cpp
+++ b/
pv/session.cpp
@@
-105,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)
{
}
{
}
@@
-172,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;
@@
-851,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."));
}
@@
-1064,4
+1077,9
@@
void Session::data_feed_in(shared_ptr<sigrok::Device> device,
}
}
}
}
+void Session::on_data_saved()
+{
+ data_saved_ = true;
+}
+
} // namespace pv
} // namespace pv