Rename 'probe' to 'channel' everywhere.
[pulseview.git] / pv / toolbars / samplingbar.cpp
index 05c730bf528fe35efdab94acea14be9183838fd6..550fc8482d1c7891a586adc8734dac3d684ac352 100644 (file)
@@ -22,8 +22,6 @@
 
 #include <assert.h>
 
-#include <boost/foreach.hpp>
-
 #include <QAction>
 #include <QDebug>
 #include <QHelpEvent>
 #include <pv/devicemanager.h>
 #include <pv/device/devinst.h>
 #include <pv/popups/deviceoptions.h>
-#include <pv/popups/probes.h>
+#include <pv/popups/channels.h>
+#include <pv/util.h>
 
-using boost::shared_ptr;
 using std::map;
 using std::max;
 using std::min;
+using std::shared_ptr;
 using std::string;
 
 namespace pv {
@@ -56,7 +55,7 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
        _updating_device_selector(false),
        _configure_button(this),
        _configure_button_action(NULL),
-       _probes_button(this),
+       _channels_button(this),
        _sample_count(" samples", this),
        _sample_rate("Hz", this),
        _updating_sample_rate(false),
@@ -83,14 +82,14 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
        _configure_button.setIcon(QIcon::fromTheme("configure",
                QIcon(":/icons/configure.png")));
 
-       _probes_button.setIcon(QIcon::fromTheme("probes",
-               QIcon(":/icons/probes.svg")));
+       _channels_button.setIcon(QIcon::fromTheme("channels",
+               QIcon(":/icons/channels.svg")));
 
        _run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
 
        addWidget(&_device_selector);
        _configure_button_action = addWidget(&_configure_button);
-       addWidget(&_probes_button);
+       addWidget(&_channels_button);
        addWidget(&_sample_count);
        addWidget(&_sample_rate);
 
@@ -113,7 +112,7 @@ void SamplingBar::set_device_list(
        _device_selector.clear();
        _device_selector_map.clear();
 
-       BOOST_FOREACH (shared_ptr<pv::device::DevInst> dev_inst, devices) {
+       for (shared_ptr<pv::device::DevInst> dev_inst : devices) {
                assert(dev_inst);
                const string title = dev_inst->format_device_title();
                const sr_dev_inst *sdi = dev_inst->dev_inst();
@@ -147,8 +146,7 @@ shared_ptr<pv::device::DevInst> SamplingBar::get_selected_device() const
                        index).value<void*>();
        assert(sdi);
 
-       map<const sr_dev_inst*, boost::weak_ptr<device::DevInst> >::
-               const_iterator iter = _device_selector_map.find(sdi);
+       const auto iter = _device_selector_map.find(sdi);
        if (iter == _device_selector_map.end())
                return shared_ptr<pv::device::DevInst>();
 
@@ -324,9 +322,9 @@ void SamplingBar::update_device_config_widgets()
                !opts->binding().properties().empty());
        _configure_button.set_popup(opts);
 
-       // Update the probes popup
-       Probes *const probes = new Probes(_session, this);
-       _probes_button.set_popup(probes);
+       // Update the channels popup
+       Channels *const channels = new Channels(_session, this);
+       _channels_button.set_popup(channels);
 
        // Update supported options.
        _sample_count_supported = false;
@@ -456,16 +454,9 @@ bool SamplingBar::eventFilter(QObject *watched, QEvent *event)
        if ((watched == &_sample_count || watched == &_sample_rate) &&
                (event->type() == QEvent::ToolTip)) {
                double sec = (double)_sample_count.value() / _sample_rate.value();
-
-               QString str;
-               QTextStream(&str)
-                       << tr("Total sampling time: ")
-                       << fixed
-                       << qSetRealNumberPrecision(1)
-                       << sec
-                       << "s";
-
                QHelpEvent *help_event = static_cast<QHelpEvent*>(event);
+
+               QString str = tr("Total sampling time: %1").arg(pv::util::format_second(sec));
                QToolTip::showText(help_event->globalPos(), str);
 
                return true;