]> sigrok.org Git - pulseview.git/commitdiff
Added Enable/Disable All Buttons
authorJoel Holdsworth <redacted>
Fri, 15 Mar 2013 18:11:15 +0000 (18:11 +0000)
committerJoel Holdsworth <redacted>
Wed, 20 Mar 2013 20:36:35 +0000 (20:36 +0000)
CMakeLists.txt
pv/dialogs/deviceoptions.cpp
pv/dialogs/deviceoptions.h

index 7db89f81effeee987aa915b75a1e5e6f0b792dff..8c18ad7e254e526fb470a2621cba6be7b7d39f41 100644 (file)
@@ -124,6 +124,7 @@ set(pulseview_HEADERS
        pv/sigsession.h
        pv/dialogs/about.h
        pv/dialogs/connect.h
+       pv/dialogs/deviceoptions.h
        pv/view/cursor.h
        pv/view/header.h
        pv/view/ruler.h
index 232e6f6f834e90aac50aad4824c150c77597f9d4..e6b2f847d12969f15d78ffa01cbd89e0a8ef337b 100644 (file)
@@ -31,6 +31,9 @@ DeviceOptions::DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi) :
        _layout(this),
        _probes_box(tr("Probes"), this),
        _probes(this),
+       _probes_bar(this),
+       _enable_all_probes(this),
+       _disable_all_probes(this),
        _props_box(tr("Configuration"), this),
        _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
                Qt::Horizontal, this),
@@ -38,6 +41,11 @@ DeviceOptions::DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi) :
 {
        setWindowTitle(tr("Configure Device"));
 
+       connect(&_enable_all_probes, SIGNAL(clicked()),
+               this, SLOT(enable_all_probes()));
+       connect(&_disable_all_probes, SIGNAL(clicked()),
+               this, SLOT(disable_all_probes()));
+
        connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept()));
        connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject()));
 
@@ -46,8 +54,17 @@ DeviceOptions::DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi) :
        setup_probes();
        _probes_box.setLayout(&_probes_box_layout);
        _probes_box_layout.addWidget(&_probes);
+
+       _enable_all_probes.setText(tr("Enable All"));
+       _probes_bar.addWidget(&_enable_all_probes);
+
+       _disable_all_probes.setText(tr("Disable All"));
+       _probes_bar.addWidget(&_disable_all_probes);
+
+       _probes_box_layout.addWidget(&_probes_bar);
        _layout.addWidget(&_probes_box);
 
+
        _props_box.setLayout(&_props_box_layout);
        _props_box_layout.addWidget(_device_options_binding.get_form(this));
        _layout.addWidget(&_props_box);
@@ -93,5 +110,24 @@ void DeviceOptions::setup_probes()
        }
 }
 
+void DeviceOptions::set_all_probes(bool set)
+{
+       for (int i = 0; i < _probes.count(); i++) {
+               QListWidgetItem *const item = _probes.item(i);
+               assert(item);
+               item->setCheckState(set ? Qt::Checked : Qt::Unchecked);
+       }
+}
+
+void DeviceOptions::enable_all_probes()
+{
+       set_all_probes(true);
+}
+
+void DeviceOptions::disable_all_probes()
+{
+       set_all_probes(false);
+}
+
 } // namespace dialogs
 } // namespace pv
index 2e1b7bfb23c9c3999873c00995461266b49ade2c..059d336e78e246328c933ad8f0e762fe592fe155 100644 (file)
@@ -25,6 +25,8 @@
 #include <QDialogButtonBox>
 #include <QGroupBox>
 #include <QListWidget>
+#include <QToolBar>
+#include <QToolButton>
 #include <QVBoxLayout>
 
 #include <pv/prop/binding/deviceoptions.h>
@@ -34,6 +36,8 @@ namespace dialogs {
 
 class DeviceOptions : public QDialog
 {
+       Q_OBJECT
+
 public:
        DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi);
 
@@ -43,6 +47,12 @@ protected:
 private:
        void setup_probes();
 
+       void set_all_probes(bool set);
+
+private slots:
+       void enable_all_probes();
+       void disable_all_probes();
+
 private:
        struct sr_dev_inst *const _sdi;
 
@@ -51,6 +61,9 @@ private:
        QGroupBox _probes_box;
        QVBoxLayout _probes_box_layout;
        QListWidget _probes;
+       QToolBar _probes_bar;
+       QToolButton _enable_all_probes;
+       QToolButton _disable_all_probes;
 
        QGroupBox _props_box;
        QVBoxLayout _props_box_layout;