]> sigrok.org Git - pulseview.git/commitdiff
SamplingBar: Reduced indentation in update_sample_count_selector
authorJoel Holdsworth <redacted>
Sat, 22 Nov 2014 12:40:25 +0000 (12:40 +0000)
committerJoel Holdsworth <redacted>
Sat, 22 Nov 2014 14:38:17 +0000 (14:38 +0000)
pv/toolbars/samplingbar.cpp

index 2749e0ee73f1d55f4632282a56d2b7af868963b1..4a69265258f3e3b83678a6a0e3ef026401e49daf 100644 (file)
@@ -261,40 +261,42 @@ void SamplingBar::update_sample_count_selector()
        assert(!updating_sample_count_);
        updating_sample_count_ = true;
 
-       if (sample_count_supported_)
+       if (!sample_count_supported_)
        {
-               uint64_t sample_count = sample_count_.value();
-               uint64_t min_sample_count = 0;
-               uint64_t max_sample_count = MaxSampleCount;
+               sample_count_.show_none();
+               updating_sample_count_ = false;
+               return;
+       }
 
-               if (sample_count == 0)
-                       sample_count = DefaultSampleCount;
+       uint64_t sample_count = sample_count_.value();
+       uint64_t min_sample_count = 0;
+       uint64_t max_sample_count = MaxSampleCount;
 
-               try {
-                       auto gvar = device->config_list(ConfigKey::LIMIT_SAMPLES);
-                       g_variant_get(gvar.gobj(), "(tt)",
-                               &min_sample_count, &max_sample_count);
-               } catch (Error error) {}
+       if (sample_count == 0)
+               sample_count = DefaultSampleCount;
 
-               min_sample_count = min(max(min_sample_count, MinSampleCount),
-                       max_sample_count);
+       try {
+               auto gvar = device->config_list(ConfigKey::LIMIT_SAMPLES);
+               g_variant_get(gvar.gobj(), "(tt)",
+                       &min_sample_count, &max_sample_count);
+       } catch (Error error) {}
 
-               sample_count_.show_125_list(
-                       min_sample_count, max_sample_count);
+       min_sample_count = min(max(min_sample_count, MinSampleCount),
+               max_sample_count);
 
-               try {
-                       auto gvar = device->config_get(ConfigKey::LIMIT_SAMPLES);
-                       sample_count = g_variant_get_uint64(gvar.gobj());
-                       if (sample_count == 0)
-                               sample_count = DefaultSampleCount;
-                       sample_count = min(max(sample_count, MinSampleCount),
-                               max_sample_count);
-               } catch (Error error) {}
-
-               sample_count_.set_value(sample_count);
-       }
-       else
-               sample_count_.show_none();
+       sample_count_.show_125_list(
+               min_sample_count, max_sample_count);
+
+       try {
+               auto gvar = device->config_get(ConfigKey::LIMIT_SAMPLES);
+               sample_count = g_variant_get_uint64(gvar.gobj());
+               if (sample_count == 0)
+                       sample_count = DefaultSampleCount;
+               sample_count = min(max(sample_count, MinSampleCount),
+                       max_sample_count);
+       } catch (Error error) {}
+
+       sample_count_.set_value(sample_count);
 
        updating_sample_count_ = false;
 }