]> sigrok.org Git - pulseview.git/blobdiff - pv/session.cpp
Only show sampling points when zoomed in far enough.
[pulseview.git] / pv / session.cpp
index ef2f39bb8ed3ddb88ded541959042ad531a5096a..0077ccfd00d0d36d6de0a401d8f71347e24a4d08 100644 (file)
@@ -193,11 +193,11 @@ void Session::save_settings(QSettings &settings) const
                        settings.setValue("device_type", "hardware");
                        settings.beginGroup("device");
 
-                       key_list.push_back("vendor");
-                       key_list.push_back("model");
-                       key_list.push_back("version");
-                       key_list.push_back("serial_num");
-                       key_list.push_back("connection_id");
+                       key_list.emplace_back("vendor");
+                       key_list.emplace_back("model");
+                       key_list.emplace_back("version");
+                       key_list.emplace_back("serial_num");
+                       key_list.emplace_back("connection_id");
 
                        dev_info = device_manager_.get_device_info(device_);
 
@@ -277,11 +277,11 @@ void Session::restore_settings(QSettings &settings)
 
                // Re-select last used device if possible but only if it's not demo
                settings.beginGroup("device");
-               key_list.push_back("vendor");
-               key_list.push_back("model");
-               key_list.push_back("version");
-               key_list.push_back("serial_num");
-               key_list.push_back("connection_id");
+               key_list.emplace_back("vendor");
+               key_list.emplace_back("model");
+               key_list.emplace_back("version");
+               key_list.emplace_back("serial_num");
+               key_list.emplace_back("connection_id");
 
                for (string key : key_list) {
                        const QString k = QString::fromStdString(key);
@@ -534,9 +534,15 @@ void Session::start_capture(function<void (const QString)> error_handler)
        for (const shared_ptr<data::SignalData> d : all_signal_data_)
                d->clear();
 
-       // Revert name back to default name (e.g. "Session 1") as the data is gone
-       name_ = default_name_;
-       name_changed();
+       // Revert name back to default name (e.g. "Session 1") for real devices
+       // as the (possibly saved) data is gone. File devices keep their name.
+       shared_ptr<devices::HardwareDevice> hw_device =
+               dynamic_pointer_cast< devices::HardwareDevice >(device_);
+
+       if (hw_device) {
+               name_ = default_name_;
+               name_changed();
+       }
 
        // Begin the session
        sampling_thread_ = std::thread(