projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b0ddc6b
)
SamplingBar: Show a 1-2-5 for min-max sample rate values
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 19 Jan 2014 14:36:34 +0000
(14:36 +0000)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 19 Jan 2014 14:50:34 +0000
(14:50 +0000)
pv/toolbars/samplingbar.cpp
patch
|
blob
|
history
diff --git
a/pv/toolbars/samplingbar.cpp
b/pv/toolbars/samplingbar.cpp
index 80c822e2cf14b76a8e07d988c1a874725d3fc26b..79dd7a1a37a68e4c5790171b409fdf66242e8808 100644
(file)
--- a/
pv/toolbars/samplingbar.cpp
+++ b/
pv/toolbars/samplingbar.cpp
@@
-160,9
+160,28
@@
void SamplingBar::update_sample_rate_selector()
{
elements = (const uint64_t *)g_variant_get_fixed_array(
gvar_list, &num_elements, sizeof(uint64_t));
{
elements = (const uint64_t *)g_variant_get_fixed_array(
gvar_list, &num_elements, sizeof(uint64_t));
- _sample_rate.show_min_max_step(elements[0], elements[1],
- elements[2]);
+
+ const uint64_t min = elements[0];
+ const uint64_t max = elements[1];
+ const uint64_t step = elements[2];
+
g_variant_unref(gvar_list);
g_variant_unref(gvar_list);
+
+ assert(min > 0);
+ assert(max > 0);
+ assert(max > min);
+ assert(step > 0);
+
+ if (step == 1)
+ _sample_rate.show_125_list(min, max);
+ else
+ {
+ // When the step is not 1, we cam't make a 1-2-5-10
+ // list of sample rates, because we may not be able to
+ // make round numbers. Therefore in this case, show a
+ // spin box.
+ _sample_rate.show_min_max_step(min, max, step);
+ }
}
else if ((gvar_list = g_variant_lookup_value(gvar_dict,
"samplerates", G_VARIANT_TYPE("at"))))
}
else if ((gvar_list = g_variant_lookup_value(gvar_dict,
"samplerates", G_VARIANT_TYPE("at"))))