X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Ftoolbars%2Fsamplingbar.cpp;h=af5afb0c27774b980ae843c68e73a81b6e135217;hp=05c730bf528fe35efdab94acea14be9183838fd6;hb=f9abf97e78bc4825d80926b0ebc6cbaef40768b1;hpb=40065ab65c4f347ac5c3731fcea628ab26b49c1e diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 05c730bf..af5afb0c 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -22,8 +22,6 @@ #include -#include - #include #include #include @@ -35,11 +33,12 @@ #include #include #include +#include -using boost::shared_ptr; using std::map; using std::max; using std::min; +using std::shared_ptr; using std::string; namespace pv { @@ -113,7 +112,7 @@ void SamplingBar::set_device_list( _device_selector.clear(); _device_selector_map.clear(); - BOOST_FOREACH (shared_ptr dev_inst, devices) { + for (shared_ptr 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 SamplingBar::get_selected_device() const index).value(); assert(sdi); - map >:: - 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(); @@ -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(event); + + QString str = tr("Total sampling time: %1").arg(pv::util::format_second(sec)); QToolTip::showText(help_event->globalPos(), str); return true;