]> sigrok.org Git - pulseview.git/blobdiff - pv/samplingbar.cpp
Fixed LongPulses test packet setup
[pulseview.git] / pv / samplingbar.cpp
index 5f9e4371bd691fa98acb52ffb2ac88aa915a0c5d..60d7b4c8aec6cdcb2841a383ee5e8922b4fcc7be 100644 (file)
@@ -30,6 +30,8 @@ extern "C" {
 
 #include "samplingbar.h"
 
+#include <pv/dialogs/hwcap.h>
+
 namespace pv {
 
 const uint64_t SamplingBar::RecordLengths[11] = {
@@ -49,13 +51,19 @@ const uint64_t SamplingBar::RecordLengths[11] = {
 SamplingBar::SamplingBar(QWidget *parent) :
        QToolBar("Sampling Bar", parent),
        _device_selector(this),
+       _configure_button(this),
        _record_length_selector(this),
        _sample_rate_list(this),
+       _icon_green(":/icons/status-green.svg"),
+       _icon_grey(":/icons/status-grey.svg"),
        _run_stop_button(this)
 {
-       connect(&_run_stop_button, SIGNAL(clicked()), this, SIGNAL(run_stop()));
+       connect(&_run_stop_button, SIGNAL(clicked()),
+               this, SIGNAL(run_stop()));
        connect(&_device_selector, SIGNAL(currentIndexChanged (int)),
                this, SLOT(on_device_selected()));
+       connect(&_configure_button, SIGNAL(clicked()),
+               this, SLOT(configure()));
 
        _sample_rate_value.setDecimals(0);
        _sample_rate_value.setSuffix("Hz");
@@ -70,7 +78,13 @@ SamplingBar::SamplingBar(QWidget *parent) :
 
        set_sampling(false);
 
+       _configure_button.setIcon(QIcon::fromTheme("configure",
+               QIcon(":/icons/configure.png")));
+
+       _run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+
        addWidget(&_device_selector);
+       addWidget(&_configure_button);
        addWidget(&_record_length_selector);
        _sample_rate_list_action = addWidget(&_sample_rate_list);
        _sample_rate_value_action = addWidget(&_sample_rate_value);
@@ -120,6 +134,7 @@ uint64_t SamplingBar::get_sample_rate() const
 
 void SamplingBar::set_sampling(bool sampling)
 {
+       _run_stop_button.setIcon(sampling ? _icon_green : _icon_grey);
        _run_stop_button.setText(sampling ? "Stop" : "Run");
 }
 
@@ -194,4 +209,13 @@ void SamplingBar::on_device_selected()
        update_sample_rate_selector();
 }
 
+void SamplingBar::configure()
+{
+       sr_dev_inst *const sdi = get_selected_device();
+       assert(sdi);
+
+       pv::dialogs::HwCap dlg(this, sdi);
+       dlg.exec();
+}
+
 } // namespace pv