]> sigrok.org Git - pulseview.git/commitdiff
Added shorter record lengths
authorJoel Holdsworth <redacted>
Sat, 2 Mar 2013 09:10:32 +0000 (09:10 +0000)
committerJoel Holdsworth <redacted>
Sun, 3 Mar 2013 09:45:37 +0000 (09:45 +0000)
pv/samplingbar.cpp
pv/samplingbar.h

index 41e98be2653e67602a9eede6888d8662106edb0c..b406790988e86bd3106d3a4b55ac582e8a34d1e8 100644 (file)
@@ -18,9 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#include <assert.h>
+#include <extdef.h>
 
-#include <boost/foreach.hpp>
+#include <assert.h>
 
 #include <libsigrok/libsigrok.h>
 
 
 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);
index 0bf5c449e754ec23eb956b3d684671868cdac0b8..446d98ed495fcf23e017f44c1ab98c3d7cf5706c 100644 (file)
@@ -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);