]> sigrok.org Git - pulseview.git/blobdiff - pv/toolbars/samplingbar.cpp
Replaced lengthy iterator types with the auto keyword
[pulseview.git] / pv / toolbars / samplingbar.cpp
index 05c730bf528fe35efdab94acea14be9183838fd6..6d419f74dbef319905f31815956fda229d3398ee 100644 (file)
@@ -35,6 +35,7 @@
 #include <pv/device/devinst.h>
 #include <pv/popups/deviceoptions.h>
 #include <pv/popups/probes.h>
+#include <pv/util.h>
 
 using boost::shared_ptr;
 using std::map;
@@ -147,8 +148,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>();
 
@@ -456,16 +456,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;