X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fmainbar.cpp;h=9bebda80061c1d29a5216a4188f2a09c3a911ce2;hb=348f9ceca2a1e0812324348b16192a652ae06ea3;hp=65db28b72dd8e509725a644818839ea6d57a9f99;hpb=5f66b56eb6616c9c626d6f48abf1da0d8a652444;p=pulseview.git diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index 65db28b..9bebda8 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.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 . */ #include @@ -404,9 +403,12 @@ void MainBar::update_sample_count_selector() uint64_t sample_count = sample_count_.value(); uint64_t min_sample_count = 0; uint64_t max_sample_count = MaxSampleCount; + bool default_count_set = false; - if (sample_count == 0) + if (sample_count == 0) { sample_count = DefaultSampleCount; + default_count_set = true; + } if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::LIST)) { auto gvar = sr_dev->config_list(ConfigKey::LIMIT_SAMPLES); @@ -424,8 +426,10 @@ void MainBar::update_sample_count_selector() if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::GET)) { auto gvar = sr_dev->config_get(ConfigKey::LIMIT_SAMPLES); sample_count = g_variant_get_uint64(gvar.gobj()); - if (sample_count == 0) + if (sample_count == 0) { sample_count = DefaultSampleCount; + default_count_set = true; + } sample_count = min(max(sample_count, MinSampleCount), max_sample_count); } @@ -433,6 +437,10 @@ void MainBar::update_sample_count_selector() sample_count_.set_value(sample_count); updating_sample_count_ = false; + + // If we show the default rate then make sure the device uses the same + if (default_count_set) + commit_sample_count(); } void MainBar::update_device_config_widgets()