X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.cpp;h=fcd0e135b5a190972613e85ac79ada3f067b7023;hp=773cf8047956d9cd062d5e3d65b3c2e11ecd0c7e;hb=5ccfc97e20bbea19b9bc37905dd4cf63ee1f6303;hpb=fd22c71c1a9cc470b53c71c0ee131a4b2d645f80 diff --git a/pv/session.cpp b/pv/session.cpp index 773cf804..fcd0e135 100644 --- 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 - * 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 . */ #ifdef _WIN32 @@ -106,7 +105,8 @@ Session::Session(DeviceManager &device_manager, QString name) : default_name_(name), name_(name), capture_state_(Stopped), - cur_samplerate_(0) + cur_samplerate_(0), + data_saved_(true) { } @@ -173,6 +173,11 @@ shared_ptr Session::main_bar() const return main_bar_; } +bool Session::data_saved() const +{ + return data_saved_; +} + void Session::save_settings(QSettings &settings) const { map dev_info; @@ -852,6 +857,13 @@ void Session::sample_thread_proc(function error_handler) assert(0); } + // We now have unsaved data unless we just "captured" from a file + shared_ptr file_device = + dynamic_pointer_cast(device_); + + if (!file_device) + data_saved_ = false; + if (out_of_memory_) error_handler(tr("Out of memory, acquisition stopped.")); } @@ -1065,4 +1077,9 @@ void Session::data_feed_in(shared_ptr device, } } +void Session::on_data_saved() +{ + data_saved_ = true; +} + } // namespace pv