]> sigrok.org Git - pulseview.git/commitdiff
Random simplifications, cosmetics/whitespace/consistency fixes.
authorUwe Hermann <redacted>
Sat, 18 Mar 2017 23:20:26 +0000 (00:20 +0100)
committerUwe Hermann <redacted>
Thu, 23 Mar 2017 18:42:18 +0000 (19:42 +0100)
45 files changed:
main.cpp
pv/binding/decoder.cpp
pv/data/analogsegment.cpp
pv/data/decode/decoder.hpp
pv/data/decoderstack.cpp
pv/data/decoderstack.hpp
pv/data/logic.cpp
pv/data/logicsegment.cpp
pv/data/logicsegment.hpp
pv/data/segment.cpp
pv/data/signalbase.cpp
pv/dialogs/inputoutputoptions.hpp
pv/dialogs/settings.cpp
pv/dialogs/storeprogress.hpp
pv/mainwindow.cpp
pv/popups/channels.cpp
pv/prop/int.cpp
pv/session.cpp
pv/session.hpp
pv/storesession.cpp
pv/toolbars/mainbar.cpp
pv/util.cpp
pv/util.hpp
pv/view/analogsignal.cpp
pv/view/decodetrace.cpp
pv/view/decodetrace.hpp
pv/view/header.cpp
pv/view/logicsignal.cpp
pv/view/logicsignal.hpp
pv/view/ruler.hpp
pv/view/trace.cpp
pv/view/tracetreeitem.cpp
pv/view/tracetreeitemowner.hpp
pv/view/view.cpp
pv/view/view.hpp
pv/view/viewport.cpp
pv/views/trace/standardbar.hpp
pv/views/viewbase.hpp
pv/widgets/decodergroupbox.cpp
pv/widgets/decodermenu.cpp
pv/widgets/decodermenu.hpp
pv/widgets/popup.cpp
pv/widgets/sweeptimingwidget.cpp
pv/widgets/wellarray.cpp
signalhandler.cpp

index 2119b81e50d778daf1ca3e2b6ba4fc09bd8b3f97..690a559c29e9a8952b74e2a840475b227650d5b3 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -136,10 +136,11 @@ int main(int argc, char *argv[])
        if (argc - optind > 1) {
                fprintf(stderr, "Only one file can be opened.\n");
                return 1;
-       } else if (argc - optind == 1) {
-               open_file = argv[argc - 1];
        }
 
+       if (argc - optind == 1)
+               open_file = argv[argc - 1];
+
        // Initialise libsigrok
        context = sigrok::Context::create();
 #ifdef ANDROID
index c5d014879f51d9580ab249328e387356fe6e4a09..b968ab7995e31227780169b65d4bb2a95b1397ff 100644 (file)
@@ -128,10 +128,7 @@ Glib::VariantBase Decoder::getter(const char *id)
                }
        }
 
-       if (val)
-               return Glib::VariantBase(val, true);
-       else
-               return Glib::VariantBase();
+       return (val) ? Glib::VariantBase(val, true) : Glib::VariantBase();
 }
 
 void Decoder::setter(const char *id, Glib::VariantBase value)
index 6719340c5e9e06eb58698de193c3dfd7927d238c..45db047e179e3477de9ef5a09f91455e27f613e1 100644 (file)
@@ -43,8 +43,7 @@ namespace data {
 
 const int AnalogSegment::EnvelopeScalePower = 4;
 const int AnalogSegment::EnvelopeScaleFactor = 1 << EnvelopeScalePower;
-const float AnalogSegment::LogEnvelopeScaleFactor =
-       logf(EnvelopeScaleFactor);
+const float AnalogSegment::LogEnvelopeScaleFactor = logf(EnvelopeScaleFactor);
 const uint64_t AnalogSegment::EnvelopeDataUnit = 64*1024;      // bytes
 
 AnalogSegment::AnalogSegment(Analog& owner, uint64_t samplerate) :
@@ -73,7 +72,7 @@ void AnalogSegment::append_interleaved_samples(const float *data,
 
        uint64_t prev_sample_count = sample_count_;
 
-       for (uint32_t i=0; i < sample_count; i++) {
+       for (uint32_t i = 0; i < sample_count; i++) {
                append_single_sample((void*)data);
                data += stride;
        }
@@ -174,8 +173,10 @@ void AnalogSegment::append_payload_to_envelope_levels()
                it = begin_raw_sample_iteration(0);
                for (uint64_t i = 0; i < sample_count_; i++) {
                        const float sample = *((float*)it->value);
-                       if (sample < min_value_) min_value_ = sample;
-                       if (sample > max_value_) max_value_ = sample;
+                       if (sample < min_value_)
+                               min_value_ = sample;
+                       if (sample > max_value_)
+                               max_value_ = sample;
                        continue_raw_sample_iteration(it, 1);
                }
                end_raw_sample_iteration(it);
@@ -191,7 +192,7 @@ void AnalogSegment::append_payload_to_envelope_levels()
 
        // Iterate through the samples to populate the first level mipmap
        uint64_t start_sample = prev_length * EnvelopeScaleFactor;
-       uint64_t end_sample   = e0.length * EnvelopeScaleFactor;
+       uint64_t end_sample = e0.length * EnvelopeScaleFactor;
 
        it = begin_raw_sample_iteration(start_sample);
        for (uint64_t i = start_sample; i < end_sample; i += EnvelopeScaleFactor) {
@@ -202,8 +203,10 @@ void AnalogSegment::append_payload_to_envelope_levels()
                        *max_element(samples, samples + EnvelopeScaleFactor),
                };
 
-               if (sub_sample.min < min_value_) min_value_ = sub_sample.min;
-               if (sub_sample.max > max_value_) max_value_ = sub_sample.max;
+               if (sub_sample.min < min_value_)
+                       min_value_ = sub_sample.min;
+               if (sub_sample.max > max_value_)
+                       max_value_ = sub_sample.max;
 
                continue_raw_sample_iteration(it, EnvelopeScaleFactor);
                *dest_ptr++ = sub_sample;
@@ -213,7 +216,7 @@ void AnalogSegment::append_payload_to_envelope_levels()
        // Compute higher level mipmaps
        for (unsigned int level = 1; level < ScaleStepCount; level++) {
                Envelope &e = envelope_levels_[level];
-               const Envelope &el = envelope_levels_[level-1];
+               const Envelope &el = envelope_levels_[level - 1];
 
                // Expand the data buffer to fit the new samples
                prev_length = e.length;
index 1b323f0b74dc0b7b8de2d1b87605b6f0d39ca851..1b655662bcb707dfe5fd83dbc847164e81bc04a2 100644 (file)
@@ -68,8 +68,7 @@ public:
 
        bool have_required_channels() const;
 
-       srd_decoder_inst* create_decoder_inst(
-               srd_session *session) const;
+       srd_decoder_inst* create_decoder_inst(srd_session *session) const;
 
        set< shared_ptr<pv::data::Logic> > get_data();
 
index d3e1f4acd25de681fd147253ddc8d423ce5cd2bc..8fc3242392bd2642f36a2e093010d8a8c146df38 100644 (file)
@@ -416,7 +416,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
                row_iter = d->rows_.find((*r).second);
        else {
                // Failing that, use the decoder as a key
-               row_iter = d->rows_.find(Row(decc));    
+               row_iter = d->rows_.find(Row(decc));
        }
 
        assert(row_iter != d->rows_.end());
index 8a9e0e45c9116cee863b8e245044de78923016bf..5216006ef4b5567a543fe36b4afa46721ea535de 100644 (file)
@@ -127,8 +127,7 @@ private:
 
        void decode_proc();
 
-       static void annotation_callback(srd_proto_data *pdata,
-               void *decoder);
+       static void annotation_callback(srd_proto_data *pdata, void *decoder);
 
 private Q_SLOTS:
        void on_new_frame();
index 399c81349c3087ceea417a0e75a610f436e49c59..ac47c29d6ac12d004f44c23ccc80b6678e44e78b 100644 (file)
@@ -42,8 +42,7 @@ unsigned int Logic::num_channels() const
        return num_channels_;
 }
 
-void Logic::push_segment(
-       shared_ptr<LogicSegment> &segment)
+void Logic::push_segment(shared_ptr<LogicSegment> &segment)
 {
        segments_.push_front(segment);
 }
@@ -55,8 +54,7 @@ const deque< shared_ptr<LogicSegment> >& Logic::logic_segments() const
 
 vector< shared_ptr<Segment> > Logic::segments() const
 {
-       return vector< shared_ptr<Segment> >(
-               segments_.begin(), segments_.end());
+       return vector< shared_ptr<Segment> >(segments_.begin(), segments_.end());
 }
 
 void Logic::clear()
index db2ce0548fcbedcd4023e7532bc4e999bf3b35a7..cbaf54a47c132a3d192e530e59e5ee1f6efda586 100644 (file)
@@ -44,7 +44,7 @@ namespace data {
 const int LogicSegment::MipMapScalePower = 4;
 const int LogicSegment::MipMapScaleFactor = 1 << MipMapScalePower;
 const float LogicSegment::LogMipMapScaleFactor = logf(MipMapScaleFactor);
-const uint64_t LogicSegment::MipMapDataUnit = 64*1024; // bytes
+const uint64_t LogicSegment::MipMapDataUnit = 64 * 1024; // bytes
 
 LogicSegment::LogicSegment(pv::data::Logic& owner, unsigned int unit_size,
        uint64_t samplerate) :
@@ -177,7 +177,7 @@ const uint8_t* LogicSegment::get_samples(int64_t start_sample,
 
        lock_guard<recursive_mutex> lock(mutex_);
 
-       return get_raw_samples(start_sample, (end_sample-start_sample));
+       return get_raw_samples(start_sample, (end_sample - start_sample));
 }
 
 SegmentLogicDataIterator* LogicSegment::begin_sample_iteration(uint64_t start)
@@ -257,7 +257,7 @@ void LogicSegment::append_payload_to_mipmap()
        // Compute higher level mipmaps
        for (unsigned int level = 1; level < ScaleStepCount; level++) {
                MipMapLevel &m = mip_map_[level];
-               const MipMapLevel &ml = mip_map_[level-1];
+               const MipMapLevel &ml = mip_map_[level - 1];
 
                // Expand the data buffer to fit the new samples
                prev_length = m.length;
index bc9c77d0f4c7b6923287967f3b189648c0c65459..3c012a45c3257bcf4c20be27256b3a243ba0cf2b 100644 (file)
@@ -93,7 +93,7 @@ public:
 private:
        uint64_t unpack_sample(const uint8_t *ptr) const;
        void pack_sample(uint8_t *ptr, uint64_t value);
-       
+
        void reallocate_mipmap_level(MipMapLevel &m);
 
        void append_payload_to_mipmap();
index ceaf0a056ef84a2c8f473f1d664559b4e583ce1e..88015c3639860597accf8bf23eb21ed98d499e53 100644 (file)
@@ -117,8 +117,7 @@ void Segment::append_single_sample(void *data)
        // There will always be space for at least one sample in
        // the current chunk, so we do not need to test for space
 
-       memcpy(current_chunk_ + (used_samples_ * unit_size_),
-               data, unit_size_);
+       memcpy(current_chunk_ + (used_samples_ * unit_size_), data, unit_size_);
        used_samples_++;
        unused_samples_--;
 
@@ -222,14 +221,12 @@ void Segment::continue_raw_sample_iteration(SegmentRawDataIterator* it, uint64_t
 {
        lock_guard<recursive_mutex> lock(mutex_);
 
+       // Fail gracefully if we are asked to deliver data we don't have
        if (it->sample_index > sample_count_)
-       {
-               // Fail gracefully if we are asked to deliver data we don't have
                return;
-       } else {
-               it->sample_index += increase;
-               it->chunk_offs += (increase * unit_size_);
-       }
+
+       it->sample_index += increase;
+       it->chunk_offs += (increase * unit_size_);
 
        if (it->chunk_offs > (chunk_size_ - 1)) {
                it->chunk_num++;
@@ -252,6 +249,5 @@ void Segment::end_raw_sample_iteration(SegmentRawDataIterator* it)
        }
 }
 
-
 } // namespace data
 } // namespace pv
index 949c8237572de2f09dfb0c9dbd162ba51bf1e735..ff66100718d38cdb7d8e30f8e5814f9d0cb0e089 100644 (file)
@@ -37,7 +37,7 @@ using std::tie;
 namespace pv {
 namespace data {
 
-const int SignalBase::ColourBGAlpha = 8*256/100;
+const int SignalBase::ColourBGAlpha = 8 * 256 / 100;
 
 SignalBase::SignalBase(shared_ptr<sigrok::Channel> channel, ChannelType channel_type) :
        channel_(channel),
@@ -398,6 +398,5 @@ void SignalBase::on_capture_state_changed(int state)
        }
 }
 
-
 } // namespace data
 } // namespace pv
index 5d5ab55a1a967af98494534c949814b49efd6782..be6d33080f699a245355ebc92ee7b493aade746d 100644 (file)
@@ -47,7 +47,7 @@ public:
         * @param title the title of the dialog.
         * @param options the map of options to use as a template.
         * @param parent the parent widget of the dialog.
-        */ 
+        */
        InputOutputOptions(const QString &title,
                const map<string, shared_ptr<sigrok::Option>> &options,
                QWidget *parent);
index b8150b7bfaa4dadd187eec8eb7b233c660e2f2ad..b8f9bf9fa5910ec906f4b4a84e1487a5cb3374a0 100644 (file)
@@ -57,7 +57,7 @@ Settings::Settings(DeviceManager &device_manager, QWidget *parent) :
        page_list->setViewMode(QListView::IconMode);
        page_list->setIconSize(QSize(icon_size, icon_size));
        page_list->setMovement(QListView::Static);
-       page_list->setMaximumWidth(icon_size + icon_size/2);
+       page_list->setMaximumWidth(icon_size + (icon_size / 2));
        page_list->setSpacing(12);
 
        pages = new QStackedWidget;
@@ -168,15 +168,13 @@ QWidget *Settings::get_about_page(QWidget *parent) const
 
        /* Library info */
        s.append("<tr><td colspan=\"2\"><b>" +
-                       tr("Used libraries:") +
-                       "</b></td></tr>");
+                       tr("Used libraries:") + "</b></td></tr>");
        s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
                        .arg(QString("Qt"), qVersion()));
 
        /* Set up the supported field */
        s.append("<tr><td colspan=\"2\"><b>" +
-               tr("Supported hardware drivers:") +
-               "</b></td></tr>");
+               tr("Supported hardware drivers:") + "</b></td></tr>");
        for (auto entry : context->drivers()) {
                s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
                        .arg(QString::fromUtf8(entry.first.c_str()),
@@ -184,8 +182,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
        }
 
        s.append("<tr><td colspan=\"2\"><b>" +
-               tr("Supported input formats:") +
-               "</b></td></tr>");
+               tr("Supported input formats:") + "</b></td></tr>");
        for (auto entry : context->input_formats()) {
                s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
                        .arg(QString::fromUtf8(entry.first.c_str()),
@@ -193,8 +190,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
        }
 
        s.append("<tr><td colspan=\"2\"><b>" +
-               tr("Supported output formats:") +
-               "</b></td></tr>");
+               tr("Supported output formats:") + "</b></td></tr>");
        for (auto entry : context->output_formats()) {
                s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
                        .arg(QString::fromUtf8(entry.first.c_str()),
@@ -203,8 +199,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
 
 #ifdef ENABLE_DECODE
        s.append("<tr><td colspan=\"2\"><b>" +
-               tr("Supported protocol decoders:") +
-               "</b></td></tr>");
+               tr("Supported protocol decoders:") + "</b></td></tr>");
        for (const GSList *l = srd_decoder_list(); l; l = l->next) {
                dec = (struct srd_decoder *)l->data;
                s.append(QString("<tr><td><i>%1</i></td><td>%2</td></tr>")
index 48e1239dd033ba648a8caaa2f2280668f7e5cf56..b57ad25e501c18307587fe0ce96567b827693543 100644 (file)
@@ -47,8 +47,7 @@ public:
                const shared_ptr<sigrok::OutputFormat> output_format,
                const map<string, Glib::VariantBase> &options,
                const pair<uint64_t, uint64_t> sample_range,
-               const Session &session,
-               QWidget *parent = nullptr);
+               const Session &session, QWidget *parent = nullptr);
 
        virtual ~StoreProgress();
 
index dd8be229e97acc9b29065124d6431b103c145b84..7e48e5a9f96a21f7c64cd9fe5a6d049d826ad70f 100644 (file)
@@ -134,10 +134,10 @@ shared_ptr<views::ViewBase> MainWindow::get_active_view() const
        QDockWidget *dock = nullptr;
 
        while (w) {
-           dock = qobject_cast<QDockWidget*>(w);
-           if (dock)
-               break;
-           w = w->parent();
+               dock = qobject_cast<QDockWidget*>(w);
+               if (dock)
+                       break;
+               w = w->parent();
        }
 
        // Get the view contained in the dock widget
index 0251a9d17a0d6604a666afc02c40b4f80c58c5be..4a5e396c2e08e685d81205caa642608d3be73a13 100644 (file)
@@ -168,13 +168,11 @@ void Channels::populate_group(shared_ptr<ChannelGroup> group,
                        QString("<h3>%1</h3>").arg(group->name().c_str())));
 
        // Create the channel group grid
-       QGridLayout *const channel_grid =
-               create_channel_group_grid(sigs);
+       QGridLayout *const channel_grid = create_channel_group_grid(sigs);
        layout_.addRow(channel_grid);
 
        // Create the channel group options
-       if (binding)
-       {
+       if (binding) {
                binding->add_properties_to_form(&layout_, true);
                group_bindings_.push_back(binding);
        }
index d791bd96b05d0846b40d52dc476fdddec135420d..ce77b9592d3f66778ab6247b88b20cca32b9ca74 100644 (file)
@@ -140,8 +140,7 @@ void Int::commit()
                new_value = g_variant_new_int64(spin_box_->value());
        else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT64))
                new_value = g_variant_new_uint64(spin_box_->value());
-       else
-       {
+       else {
                // Unexpected value type.
                assert(false);
        }
index f65b05a1588cad8ea001d31fdcdd3df7e6e94eca..d00ff97a0bbe78ae7a9e55a82e2913b36c602807 100644 (file)
@@ -1035,7 +1035,7 @@ void Session::feed_in_analog(shared_ptr<Analog> analog)
 void Session::data_feed_in(shared_ptr<sigrok::Device> device,
        shared_ptr<Packet> packet)
 {
-       static bool frame_began=false;
+       static bool frame_began = false;
 
        (void)device;
 
index 7229c7e337f3ec71efa1041d9799b3c3e4fe2c42..faf1396da6bd79f793b56b7bbbca5a715bf2e38f 100644 (file)
@@ -169,8 +169,7 @@ public:
 
        bool has_view(shared_ptr<views::ViewBase> view);
 
-       const unordered_set< shared_ptr<data::SignalBase> >
-               signalbases() const;
+       const unordered_set< shared_ptr<data::SignalBase> > signalbases() const;
 
 #ifdef ENABLE_DECODE
        bool add_decoder(srd_decoder *const dec);
index 8916cb8cd154e078837cef5174813e8e4bd38d1c..8b638de8246da898b8212ee4d1c841781524e990 100644 (file)
@@ -226,7 +226,7 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_li
        // Qt needs the progress values to fit inside an int. If they would
        // not, scale the current and max values down until they do.
        while ((sample_count_ >> progress_scale) > INT_MAX)
-               progress_scale ++;
+               progress_scale++;
 
        unit_count_ = sample_count_ >> progress_scale;
 
index f3bbcee1b90490af234be2db0bc9e1bac2759173..838fefcaaa101f5612f6d57ee1170a0f6d5b5f2d 100644 (file)
@@ -420,8 +420,7 @@ void MainBar::update_sample_count_selector()
        min_sample_count = min(max(min_sample_count, MinSampleCount),
                max_sample_count);
 
-       sample_count_.show_125_list(
-               min_sample_count, max_sample_count);
+       sample_count_.show_125_list(min_sample_count, max_sample_count);
 
        if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::GET)) {
                auto gvar = sr_dev->config_get(ConfigKey::LIMIT_SAMPLES);
@@ -581,8 +580,7 @@ void MainBar::add_decoder(srd_decoder *decoder)
 #endif
 }
 
-void MainBar::export_file(shared_ptr<OutputFormat> format,
-       bool selection_only)
+void MainBar::export_file(shared_ptr<OutputFormat> format, bool selection_only)
 {
        using pv::dialogs::StoreProgress;
 
@@ -741,7 +739,7 @@ void MainBar::on_sample_rate_changed()
 void MainBar::on_config_changed()
 {
        commit_sample_count();
-       commit_sample_rate();   
+       commit_sample_rate();
 }
 
 void MainBar::on_actionNewView_triggered()
index c5f9c832ef44be87034826df96fa7d79f42e9e03..7d711f197013e65dcccca8172e14b9b29239bca6 100644 (file)
@@ -110,12 +110,8 @@ static QTextStream& operator<<(QTextStream& stream, const Timestamp& t)
        return stream << QString::fromStdString(str);
 }
 
-QString format_time_si(
-       const Timestamp& v,
-       SIPrefix prefix,
-       unsigned int precision,
-       QString unit,
-       bool sign)
+QString format_time_si(const Timestamp& v, SIPrefix prefix,
+       unsigned int precision, QString unit, bool sign)
 {
        if (prefix == SIPrefix::unspecified) {
                // No prefix given, calculate it
@@ -142,22 +138,14 @@ QString format_time_si(
        QTextStream ts(&s);
        if (sign && !v.is_zero())
                ts << forcesign;
-       ts
-               << qSetRealNumberPrecision(precision)
-               << (v * multiplier)
-               << ' '
-               << prefix
-               << unit;
+       ts << qSetRealNumberPrecision(precision) << (v * multiplier) << ' '
+               << prefix << unit;
 
        return s;
 }
 
-QString format_time_si_adjusted(
-       const Timestamp& t,
-       SIPrefix prefix,
-       unsigned precision,
-       QString unit,
-       bool sign)
+QString format_time_si_adjusted(const Timestamp& t, SIPrefix prefix,
+       unsigned precision, QString unit, bool sign)
 {
        // The precision is always given without taking the prefix into account
        // so we need to deduct the number of decimals the prefix might imply
@@ -170,7 +158,6 @@ QString format_time_si_adjusted(
        return format_time_si(t, prefix, relative_prec, unit, sign);
 }
 
-
 // Helper for 'format_time_minutes()'.
 static QString pad_number(unsigned int number, int length)
 {
index 1c78b89f1831b802f16531a90bed7a489905d92f..bc71624bf3109fc2cb498778e943ac7acb3480f0 100644 (file)
@@ -74,12 +74,9 @@ typedef boost::multiprecision::number<
  *
  * @return The formatted value.
  */
-QString format_time_si(
-       const Timestamp& v,
-       SIPrefix prefix = SIPrefix::unspecified,
-       unsigned precision = 0,
-       QString unit = "s",
-       bool sign = true);
+QString format_time_si(const Timestamp& v,
+       SIPrefix prefix = SIPrefix::unspecified, unsigned precision = 0,
+       QString unit = "s", bool sign = true);
 
 /**
  * Wrapper around 'format_time_si()' that interprets the given 'precision'
@@ -96,12 +93,8 @@ QString format_time_si(
  *
  * @return The formatted value.
  */
-QString format_time_si_adjusted(
-       const Timestamp& t,
-       SIPrefix prefix,
-       unsigned precision = 0,
-       QString unit = "s",
-       bool sign = true);
+QString format_time_si_adjusted(const Timestamp& t, SIPrefix prefix,
+       unsigned precision = 0, QString unit = "s", bool sign = true);
 
 /**
  * Formats the given timestamp using "[+-]DD:HH:MM:SS.mmm uuu nnn ppp..." format.
@@ -116,9 +109,7 @@ QString format_time_si_adjusted(
  *
  * @return The formatted value.
  */
-QString format_time_minutes(
-       const Timestamp& t,
-       signed precision = 0,
+QString format_time_minutes(const Timestamp& t, signed precision = 0,
        bool sign = true);
 
 } // namespace util
index 8f79f919eaad3f7e67618378cb6405af9b4f193c..af979c0c2d8a6500358538138e2e89cc9adeccf6 100644 (file)
@@ -68,8 +68,8 @@ const QColor AnalogSignal::SignalColours[4] = {
        QColor(0x4E, 0x9A, 0x06)        // Green
 };
 
-const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40*256/100);
-const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20*256/100);
+const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40 * 256 / 100);
+const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20 * 256 / 100);
 
 const QColor AnalogSignal::SamplingPointColour(0x77, 0x77, 0x77);
 
@@ -157,16 +157,14 @@ int AnalogSignal::scale_handle_offset() const
 {
        const int h = (pos_vdivs_ + neg_vdivs_) * div_height_;
 
-       return ((scale_index_drag_offset_ - scale_index_) *
-               h / 4) - h / 2;
+       return ((scale_index_drag_offset_ - scale_index_) * h / 4) - h / 2;
 }
 
 void AnalogSignal::scale_handle_dragged(int offset)
 {
        const int h = (pos_vdivs_ + neg_vdivs_) * div_height_;
 
-       scale_index_ = scale_index_drag_offset_ -
-               (offset + h / 2) / (h / 4);
+       scale_index_ = scale_index_drag_offset_ - (offset + h / 2) / (h / 4);
 
        update_scale();
 }
@@ -371,7 +369,7 @@ void AnalogSignal::paint_envelope(QPainter &p,
        QRectF *const rects = new QRectF[e.length];
        QRectF *rect = rects;
 
-       for (uint64_t sample = 0; sample < e.length-1; sample++) {
+       for (uint64_t sample = 0; sample < e.length - 1; sample++) {
                const float x = ((e.scale * sample + e.start) /
                        samples_per_pixel - pixels_offset) + left;
                const AnalogSegment::EnvelopeSample *const s =
@@ -379,8 +377,8 @@ void AnalogSignal::paint_envelope(QPainter &p,
 
                // We overlap this sample with the next so that vertical
                // gaps do not appear during steep rising or falling edges
-               const float b = y - max(s->max, (s+1)->min) * scale_;
-               const float t = y - min(s->min, (s+1)->max) * scale_;
+               const float b = y - max(s->max, (s + 1)->min) * scale_;
+               const float t = y - min(s->min, (s + 1)->max) * scale_;
 
                float h = b - t;
                if (h >= 0.0f && h <= 1.0f)
index 670d6ef1dcb3b5b8b66c79516c93b2be8d322815..55b5f5754ab52edcf179978e4babd6ac185dd83e 100644 (file)
@@ -52,7 +52,6 @@ extern "C" {
 #include <pv/widgets/decodergroupbox.hpp>
 #include <pv/widgets/decodermenu.hpp>
 
-
 using std::all_of;
 using std::list;
 using std::make_pair;
@@ -438,8 +437,7 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a,
 
        const double start = a.start_sample() / samples_per_pixel -
                pixels_offset;
-       const double end = a.end_sample() / samples_per_pixel -
-               pixels_offset;
+       const double end = a.end_sample() / samples_per_pixel - pixels_offset;
 
        const size_t colour = (base_colour + a.format()) % countof(Colours);
        p.setPen(OutlineColours[colour]);
@@ -451,8 +449,7 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a,
        if (a.start_sample() == a.end_sample())
                draw_instant(a, p, h, start, y);
        else
-               draw_range(a, p, h, start, end, y, pp,
-                       row_title_width);
+               draw_range(a, p, h, start, end, y, pp, row_title_width);
 }
 
 void DecodeTrace::draw_annotation_block(
@@ -490,7 +487,7 @@ void DecodeTrace::draw_annotation_block(
        p.setBrush(QBrush((single_format ? Colours[colour] : Qt::gray),
                Qt::Dense4Pattern));
        p.drawRoundedRect(
-               QRectF(start, top, end - start, bottom - top), h/4, h/4);
+               QRectF(start, top, end - start, bottom - top), h / 4, h / 4);
 }
 
 void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter &p,
@@ -619,8 +616,7 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left,
        if (!data || data->logic_segments().empty())
                return;
 
-       const shared_ptr<LogicSegment> segment =
-               data->logic_segments().front();
+       const shared_ptr<LogicSegment> segment = data->logic_segments().front();
        assert(segment);
        const int64_t sample_count = (int64_t)segment->get_sample_count();
        if (sample_count == 0)
@@ -639,7 +635,7 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left,
                samples_per_pixel - pixels_offset, left - 1.0);
        const double end = min(sample_count / samples_per_pixel -
                pixels_offset, right + 1.0);
-       const QRectF no_decode_rect(start, y - h/2 + 0.5, end - start, h);
+       const QRectF no_decode_rect(start, y - (h / 2) + 0.5, end - start, h);
 
        p.setPen(QPen(Qt::NoPen));
        p.setBrush(Qt::white);
@@ -963,7 +959,7 @@ void DecodeTrace::on_delete_decoder(int index)
        decoder_stack->remove(index);
 
        // Update the popup
-       create_popup_form();    
+       create_popup_form();
 
        decoder_stack->begin_decode();
 }
index 3103a3c02ce4910556a68c1d28c96b976d797b47..9f5755244bd61cc738a5930734f41a15b22b168d 100644 (file)
@@ -182,8 +182,7 @@ private:
                const shared_ptr<pv::data::decode::Decoder> &dec,
                const srd_channel *const pdch);
 
-       void commit_decoder_channels(
-               shared_ptr<data::decode::Decoder> &dec);
+       void commit_decoder_channels(shared_ptr<data::decode::Decoder> &dec);
 
        void commit_channels();
 
index 28f8130d16d562a586e8d18765518d98cc840f4c..0e9445ea239e7a9879e1b88f24e1610b6a09b591 100644 (file)
@@ -103,8 +103,7 @@ void Header::paintEvent(QPaintEvent*)
        // would be clipped away.
        const QRect rect(0, 0, width() - BaselineOffset, height());
 
-       vector< shared_ptr<RowItem> > items(
-               view_.list_by_type<RowItem>());
+       vector< shared_ptr<RowItem> > items(view_.list_by_type<RowItem>());
 
        stable_sort(items.begin(), items.end(),
                [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {
index 2f4ac22cf50083a789d662c94fdc3ef0e4da2f45..9c8f6b319cf7fbd1699b0810dea5ba17fe3bc753 100644 (file)
@@ -176,8 +176,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
        if (segments.empty())
                return;
 
-       const shared_ptr<pv::data::LogicSegment> &segment =
-               segments.front();
+       const shared_ptr<pv::data::LogicSegment> &segment = segments.front();
 
        double samplerate = segment->samplerate();
 
index 274fd6cd23437d95d8d0f0ce6ee470e4ea80a6bd..273120230d0b25f02af6b95d366f8ac633b31ed0 100644 (file)
@@ -118,8 +118,7 @@ private:
        void init_trigger_actions(QWidget *parent);
 
        const vector<int32_t> get_trigger_types() const;
-       QAction* action_from_trigger_type(
-               const sigrok::TriggerMatchType *type);
+       QAction* action_from_trigger_type(const sigrok::TriggerMatchType *type);
        const sigrok::TriggerMatchType* trigger_type_from_action(
                QAction *action);
        void populate_popup_form(QWidget *parent, QFormLayout *form);
index 192de791fcb79ad86c9a37eb09b3f48128eeec89..1efd8737c9c938fb568bdf0948a8b9f5c0bc62d8 100644 (file)
@@ -55,7 +55,6 @@ class Ruler : public MarginWidget
        friend struct RulerTest::tick_position_test_2;
 
 private:
-
        /// Height of the ruler in multipes of the text height
        static const float RulerHeight;
 
index 0d4a4536171aacd99082465740deabe66f957793..985c295059a5da42c1390323de9396296712bfea 100644 (file)
@@ -42,11 +42,11 @@ namespace pv {
 namespace views {
 namespace TraceView {
 
-const QPen Trace::AxisPen(QColor(0, 0, 0, 30*256/100));
+const QPen Trace::AxisPen(QColor(0, 0, 0, 30 * 256 / 100));
 const int Trace::LabelHitPadding = 2;
 
-const QColor Trace::BrightGrayBGColour = QColor(0, 0, 0, 10*255/100);
-const QColor Trace::DarkGrayBGColour = QColor(0, 0, 0, 15*255/100);
+const QColor Trace::BrightGrayBGColour = QColor(0, 0, 0, 10 * 255 / 100);
+const QColor Trace::DarkGrayBGColour = QColor(0, 0, 0, 15 * 255 / 100);
 
 Trace::Trace(shared_ptr<data::SignalBase> channel) :
        base_(channel),
@@ -138,8 +138,7 @@ pv::widgets::Popup* Trace::create_popup(QWidget *parent)
 
        create_popup_form();
 
-       connect(popup_, SIGNAL(closed()),
-               this, SLOT(on_popup_closed()));
+       connect(popup_, SIGNAL(closed()), this, SLOT(on_popup_closed()));
 
        return popup_;
 }
index 1cc3dd6d95e1a5d20acf62d385254bf791edfc75..97c31dc43d462057c95f2979730ef2e7291a3dee 100644 (file)
@@ -140,7 +140,7 @@ QPoint TraceTreeItem::point(const QRect &rect) const
 
 void TraceTreeItem::set_bgcolour_state(bool state)
 {
-       bgcolour_state_ = state;
+       bgcolour_state_ = state;
 }
 
 } // namespace TraceView
index 92aae37f5590b12a5080083c2f3dbba73815106a..58a656d084d0259fa73c29c1d2d46b49dfa05191 100644 (file)
@@ -75,8 +75,7 @@ public:
        /**
         * Returns a list of row items owned by this object.
         */
-       vector< shared_ptr<TraceTreeItem> >
-       trace_tree_child_items() const;
+       vector< shared_ptr<TraceTreeItem> > trace_tree_child_items() const;
 
        /**
         * Clears the list of child items.
index 9e2aeaa87af8c4319447e564009cd4332915aca8..dc545babf4d0147f87d6519498c6ea314339dfe1 100644 (file)
@@ -65,7 +65,6 @@
 #include "decodetrace.hpp"
 #endif
 
-
 using pv::data::SignalData;
 using pv::data::Segment;
 using pv::util::TimeUnit;
@@ -444,7 +443,7 @@ void View::zoom(double steps)
 
 void View::zoom(double steps, int offset)
 {
-       set_zoom(scale_ * pow(3.0/2.0, -steps), offset);
+       set_zoom(scale_ * pow(3.0 / 2.0, -steps), offset);
 }
 
 void View::zoom_fit(bool gui_state)
@@ -533,8 +532,7 @@ pair<Timestamp, Timestamp> View::get_time_extents() const
        boost::optional<Timestamp> left_time, right_time;
        const set< shared_ptr<SignalData> > visible_data = get_visible_data();
        for (const shared_ptr<SignalData> d : visible_data) {
-               const vector< shared_ptr<Segment> > segments =
-                       d->segments();
+               const vector< shared_ptr<Segment> > segments = d->segments();
                for (const shared_ptr<Segment> &s : segments) {
                        double samplerate = s->samplerate();
                        samplerate = (samplerate <= 0.0) ? 1.0 : samplerate;
index aebc25401bb85d34cad008e28c99fa0104c8dce3..ee62d11369b373ddd60d5b26820944ed7012f0b2 100644 (file)
@@ -67,7 +67,8 @@ class Trace;
 class Viewport;
 class TriggerMarker;
 
-class CustomAbstractScrollArea : public QAbstractScrollArea {
+class CustomAbstractScrollArea : public QAbstractScrollArea
+{
        Q_OBJECT
 
 public:
@@ -76,7 +77,8 @@ public:
        bool viewportEvent(QEvent *event);
 };
 
-class View : public ViewBase, public TraceTreeItemOwner {
+class View : public ViewBase, public TraceTreeItemOwner
+{
        Q_OBJECT
 
 private:
index d3f25aa6ba2bb82e07aa0afd1a389f6a13f9c6f9..4b5fe245e0c11a9c6af77fdd038201d4427e997e 100644 (file)
@@ -59,8 +59,7 @@ shared_ptr<ViewItem> Viewport::get_mouse_over_item(const QPoint &pt)
        const ViewItemPaintParams pp(rect(), view_.scale(), view_.offset());
        const vector< shared_ptr<ViewItem> > items(this->items());
        for (auto i = items.rbegin(); i != items.rend(); i++)
-               if ((*i)->enabled() &&
-                       (*i)->hit_box_rect(pp).contains(pt))
+               if ((*i)->enabled() && (*i)->hit_box_rect(pp).contains(pt))
                        return *i;
        return nullptr;
 }
index c00c218d82f3eb2a484cb029129c8da9bf6ff8c0..7a76a639289aebf70c4a15a8b8bdb49485a52c11 100644 (file)
@@ -48,7 +48,7 @@ class StandardBar : public QToolBar
 
 public:
        StandardBar(Session &session, QWidget *parent,
-               TraceView::View *view, bool add_default_widgets=true);
+               TraceView::View *view, bool add_default_widgets = true);
 
        Session &session() const;
 
index 95f3ff758ca52555d67de6f5b28955f48afddd8f..45aae7f1021f7797e0dc11cf5e53484a81d80f7e 100644 (file)
@@ -49,11 +49,12 @@ enum ViewType {
        ViewTypeTabularDecode
 };
 
-class ViewBase : public QWidget {
+class ViewBase : public QWidget
+{
        Q_OBJECT
 
 public:
-       explicit ViewBase(Session &session, bool is_main_view=false, QWidget *parent = nullptr);
+       explicit ViewBase(Session &session, bool is_main_view = false, QWidget *parent = nullptr);
 
        Session& session();
        const Session& session() const;
index 623ebddef6d4992102d50571c47c35be451df921..f5b9f2533378e938f0a918510229e4da204f5526 100644 (file)
@@ -37,8 +37,7 @@ DecoderGroupBox::DecoderGroupBox(QString title, QWidget *parent, bool isDeletabl
        layout_->setContentsMargins(0, 0, 0, 0);
        setLayout(layout_);
 
-       layout_->addWidget(new QLabel(QString("<h3>%1</h3>").arg(title)),
-               0, 0);
+       layout_->addWidget(new QLabel(QString("<h3>%1</h3>").arg(title)), 0, 0);
        layout_->setColumnStretch(0, 1);
 
        QHBoxLayout *const toolbar = new QHBoxLayout;
index e3a953338a43d930350c67b3e4cbd3ce50c7cdd9..994aad1b4e5669f244edb9e4ba2c690c2cfa55be 100644 (file)
@@ -65,7 +65,7 @@ void DecoderMenu::on_action(QObject *action)
                (srd_decoder*)((QAction*)action)->data().value<void*>();
        assert(dec);
 
-       decoder_selected(dec);  
+       decoder_selected(dec);
 }
 
 } // widgets
index 3a7dde4bff6cd7256532609e2eea292dfe3dc1d3..cec4b574e3c7a0ca9674980e7552beefbcdaefb5 100644 (file)
@@ -38,7 +38,6 @@ public:
 private:
        static int decoder_name_cmp(const void *a, const void *b);
 
-
 private Q_SLOTS:
        void on_action(QObject *action);
 
index f60e643a794e3b0f5493ca1802c046afe2b8dea9..6d211c9887e2d3c4d20b794d97ec91ec53bd0da6 100644 (file)
@@ -119,7 +119,7 @@ bool Popup::space_for_arrow() const
        case Bottom:
                if (point_.y() > y())
                        return false;
-               return true;            
+               return true;
 
        case Left:
                if (point_.x() < (x() + width()))
@@ -168,7 +168,7 @@ QPolygon Popup::arrow_polygon() const
        case Left:
                poly << QPoint(p.x() - l, p.y() + l);
                break;
-               
+
        case Top:
                poly << QPoint(p.x() + l, p.y() - l);
                break;
index 6e24d94839429ec961e19c99dbe65d1e9047930b..d768620248003b14662a82d3f4dbde0ae5ba04a2 100644 (file)
@@ -87,8 +87,7 @@ void SweepTimingWidget::show_list(const uint64_t *vals, size_t count)
        list_.clear();
        for (size_t i = 0; i < count; i++) {
                char *const s = sr_si_string_u64(vals[i], suffix_);
-               list_.addItem(QString::fromUtf8(s),
-                       qVariantFromValue(vals[i]));
+               list_.addItem(QString::fromUtf8(s), qVariantFromValue(vals[i]));
                g_free(s);
        }
 
@@ -138,20 +137,17 @@ void SweepTimingWidget::show_125_list(uint64_t min, uint64_t max)
 
 uint64_t SweepTimingWidget::value() const
 {
-       switch(value_type_) {
+       switch (value_type_) {
        case None:
                return 0;
-
        case MinMaxStep:
                return (uint64_t)value_.value();
-
        case List:
        {
                const int index = list_.currentIndex();
                return (index >= 0) ? list_.itemData(
                        index).value<uint64_t>() : 0;
        }
-
        default:
                // Unexpected value type
                assert(false);
index 3ae6eec6305b1eb696bb55affcf070a71d5790dc..7617552731f0280b4544c68b7f9832171af57dcf 100644 (file)
@@ -265,7 +265,7 @@ void WellArray::focusOutEvent(QFocusEvent*)
 */
 void WellArray::keyPressEvent(QKeyEvent* event)
 {
-    switch(event->key()) {                        // Look at the key code
+    switch (event->key()) {                        // Look at the key code
     case Qt::Key_Left:                                // If 'left arrow'-key,
         if (curCol > 0)                        // and cr't not in leftmost col
             setCurrent(curRow, curCol - 1);        // set cr't to next left column
index f262d6639fe6dc6582de6f7251c4cad58cc69e6b..14706261b7d483bc0a031be43f82104549b6f5ca 100644 (file)
@@ -71,8 +71,7 @@ void SignalHandler::on_socket_notifier_activated()
                abort();
        }
 
-       switch(sig_number)
-       {
+       switch (sig_number) {
        case SIGINT:
                Q_EMIT int_received();
                break;