From: Joel Holdsworth Date: Sat, 2 Mar 2013 09:10:32 +0000 (+0000) Subject: Added shorter record lengths X-Git-Tag: pulseview-0.1.0~120 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=09f5d12376a4a9b1b1646fa79b53c81f33c1b862;p=pulseview.git Added shorter record lengths --- diff --git a/pv/samplingbar.cpp b/pv/samplingbar.cpp index 41e98be2..b4067909 100644 --- a/pv/samplingbar.cpp +++ b/pv/samplingbar.cpp @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include -#include +#include #include @@ -32,7 +32,16 @@ namespace pv { -const uint64_t SamplingBar::RecordLengths[11] = { +const uint64_t SamplingBar::RecordLengths[20] = { + 1000, + 2500, + 5000, + 10000, + 25000, + 50000, + 100000, + 250000, + 500000, 1000000, 2000000, 5000000, @@ -46,6 +55,8 @@ const uint64_t SamplingBar::RecordLengths[11] = { 10000000000ULL, }; +const uint64_t SamplingBar::DefaultRecordLength = 1000000; + SamplingBar::SamplingBar(QWidget *parent) : QToolBar("Sampling Bar", parent), _device_selector(this), @@ -66,12 +77,16 @@ SamplingBar::SamplingBar(QWidget *parent) : _sample_rate_value.setDecimals(0); _sample_rate_value.setSuffix("Hz"); - BOOST_FOREACH(uint64_t l, RecordLengths) + for(size_t i = 0; i < countof(RecordLengths); i++) { + const uint64_t &l = RecordLengths[i]; char *const text = sr_si_string_u64(l, " samples"); _record_length_selector.addItem(QString(text), qVariantFromValue(l)); g_free(text); + + if(l == DefaultRecordLength) + _record_length_selector.setCurrentIndex(i); } set_sampling(false); diff --git a/pv/samplingbar.h b/pv/samplingbar.h index 0bf5c449..446d98ed 100644 --- a/pv/samplingbar.h +++ b/pv/samplingbar.h @@ -37,7 +37,8 @@ class SamplingBar : public QToolBar Q_OBJECT private: - static const uint64_t RecordLengths[11]; + static const uint64_t RecordLengths[20]; + static const uint64_t DefaultRecordLength; public: SamplingBar(QWidget *parent);