]> sigrok.org Git - pulseview.git/commitdiff
Various minor whitespace and consistency fixes.
authorUwe Hermann <redacted>
Wed, 16 Dec 2015 21:22:01 +0000 (22:22 +0100)
committerUwe Hermann <redacted>
Sat, 26 Dec 2015 14:10:01 +0000 (15:10 +0100)
37 files changed:
main.cpp
pv/binding/binding.cpp
pv/binding/decoder.cpp
pv/binding/device.cpp
pv/binding/inputoutput.cpp
pv/data/analogsegment.cpp
pv/data/decoderstack.cpp
pv/data/logicsegment.cpp
pv/data/segment.cpp
pv/devicemanager.cpp
pv/devices/device.cpp
pv/devices/file.cpp
pv/devices/hardwaredevice.cpp
pv/devices/inputfile.cpp
pv/devices/sessionfile.cpp
pv/dialogs/connect.cpp
pv/mainwindow.cpp
pv/popups/channels.cpp
pv/prop/int.cpp
pv/session.cpp
pv/storesession.cpp
pv/toolbars/mainbar.cpp
pv/util.cpp
pv/view/cursorpair.cpp
pv/view/decodetrace.cpp
pv/view/header.cpp
pv/view/marginwidget.cpp
pv/view/ruler.cpp
pv/view/view.cpp
pv/view/viewitempaintparams.cpp
pv/view/viewport.cpp
pv/view/viewwidget.cpp
pv/widgets/colourbutton.cpp
pv/widgets/decodermenu.cpp
pv/widgets/popup.cpp
pv/widgets/sweeptimingwidget.cpp
pv/widgets/timestampspinbox.cpp

index daec62d2af09055409677d90885bc9faac5ce4af..7ac7ef36f66c713dcd9ef80f0595000d7f54d53e 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
                        // Run the application
                        ret = a.exec();
 
-               } catch(std::exception e) {
+               } catch (std::exception e) {
                        qDebug() << e.what();
                }
 
index fccb96be54b83e6770a795d219aae7ac07125bae..f2a28d3972b2b59c77f0f98142957a5888c5e5bb 100644 (file)
@@ -49,8 +49,7 @@ void Binding::add_properties_to_form(QFormLayout *layout,
 {
        assert(layout);
 
-       for (shared_ptr<pv::prop::Property> p : properties_)
-       {
+       for (shared_ptr<pv::prop::Property> p : properties_) {
                assert(p);
 
                QWidget *const widget = p->get_widget(layout->parentWidget(),
index 28cc30d668e94deddc71ca6f28b8f3645daa5cee..7d29e2fdad1b940b963251e190dfa589d77f6591 100644 (file)
@@ -59,8 +59,7 @@ Decoder::Decoder(
        const srd_decoder *const dec = decoder_->decoder();
        assert(dec);
 
-       for (GSList *l = dec->options; l; l = l->next)
-       {
+       for (GSList *l = dec->options; l; l = l->next) {
                const srd_decoder_option *const opt =
                        (srd_decoder_option*)l->data;
 
@@ -116,13 +115,11 @@ Glib::VariantBase Decoder::getter(const char *id)
 
        if (iter != options.end())
                val = (*iter).second;
-       else
-       {
+       else {
                assert(decoder_->decoder());
 
                // Get the default value if not
-               for (GSList *l = decoder_->decoder()->options; l; l = l->next)
-               {
+               for (GSList *l = decoder_->decoder()->options; l; l = l->next) {
                        const srd_decoder_option *const opt =
                                (srd_decoder_option*)l->data;
                        if (strcmp(opt->id, id) == 0) {
index 6f9788932c8dd0d4377d98771cee69ad6b6760e3..77c772c088b07dabcbba1ed782339560527dae09 100644 (file)
@@ -88,8 +88,7 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
                        config_changed();
                };
 
-               switch (key->id())
-               {
+               switch (key->id()) {
                case SR_CONF_SAMPLERATE:
                        // Sample rate values are not bound because they are shown
                        // in the MainBar
index 0dc0fc19dd5a8e6d38ac7bf79ebd89c9705cf92c..30548a82a000d5641f75a3ce0073a1e3e4589d50 100644 (file)
@@ -61,8 +61,7 @@ namespace binding {
 InputOutput::InputOutput(
        const map<string, shared_ptr<Option>> &options)
 {
-       for (pair<string, shared_ptr<Option>> o : options)
-       {
+       for (pair<string, shared_ptr<Option>> o : options) {
                const shared_ptr<Option> &opt = o.second;
                assert(opt);
 
index 3703f0d02780e13f86ffc962e93beadea1c5a1ce..cd4384ddd799cb1cdf392c7b2106ccfb6bd14bc0 100644 (file)
@@ -74,8 +74,7 @@ void AnalogSegment::append_interleaved_samples(const float *data,
 
        float *dst = (float*)data_.data() + sample_count_;
        const float *dst_end = dst + sample_count;
-       while (dst != dst_end)
-       {
+       while (dst != dst_end) {
                *dst++ = *data;
                data += stride;
        }
@@ -131,8 +130,7 @@ void AnalogSegment::reallocate_envelope(Envelope &e)
 {
        const uint64_t new_data_length = ((e.length + EnvelopeDataUnit - 1) /
                EnvelopeDataUnit) * EnvelopeDataUnit;
-       if (new_data_length > e.data_length)
-       {
+       if (new_data_length > e.data_length) {
                e.data_length = new_data_length;
                e.samples = (EnvelopeSample*)realloc(e.samples,
                        new_data_length * sizeof(EnvelopeSample));
@@ -161,9 +159,8 @@ void AnalogSegment::append_payload_to_envelope_levels()
        const float *const end_src_ptr = (float*)data_.data() +
                e0.length * EnvelopeScaleFactor;
        for (const float *src_ptr = (float*)data_.data() +
-               prev_length * EnvelopeScaleFactor;
-               src_ptr < end_src_ptr; src_ptr += EnvelopeScaleFactor)
-       {
+                       prev_length * EnvelopeScaleFactor;
+                       src_ptr < end_src_ptr; src_ptr += EnvelopeScaleFactor) {
                const EnvelopeSample sub_sample = {
                        *min_element(src_ptr, src_ptr + EnvelopeScaleFactor),
                        *max_element(src_ptr, src_ptr + EnvelopeScaleFactor),
@@ -173,8 +170,7 @@ void AnalogSegment::append_payload_to_envelope_levels()
        }
 
        // Compute higher level mipmaps
-       for (unsigned int level = 1; level < ScaleStepCount; level++)
-       {
+       for (unsigned int level = 1; level < ScaleStepCount; level++) {
                Envelope &e = envelope_levels_[level];
                const Envelope &el = envelope_levels_[level-1];
 
@@ -193,14 +189,12 @@ void AnalogSegment::append_payload_to_envelope_levels()
                        el.samples + prev_length * EnvelopeScaleFactor;
                const EnvelopeSample *const end_dest_ptr = e.samples + e.length;
                for (dest_ptr = e.samples + prev_length;
-                       dest_ptr < end_dest_ptr; dest_ptr++)
-               {
+                               dest_ptr < end_dest_ptr; dest_ptr++) {
                        const EnvelopeSample *const end_src_ptr =
                                src_ptr + EnvelopeScaleFactor;
 
                        EnvelopeSample sub_sample = *src_ptr++;
-                       while (src_ptr < end_src_ptr)
-                       {
+                       while (src_ptr < end_src_ptr) {
                                sub_sample.min = min(sub_sample.min, src_ptr->min);
                                sub_sample.max = max(sub_sample.max, src_ptr->max);
                                src_ptr++;
index 0bb875da74b68e8a30086e90124d69eea93400b5..2668df2937acb3e29035ab39ceffaf86953f1195 100644 (file)
@@ -136,8 +136,7 @@ std::vector<Row> DecoderStack::get_visible_rows() const
 
        vector<Row> rows;
 
-       for (const shared_ptr<decode::Decoder> &dec : stack_)
-       {
+       for (const shared_ptr<decode::Decoder> &dec : stack_) {
                assert(dec);
                if (!dec->shown())
                        continue;
@@ -150,8 +149,7 @@ std::vector<Row> DecoderStack::get_visible_rows() const
                        rows.push_back(Row(decc));
 
                // Add the decoder rows
-               for (const GSList *l = decc->annotation_rows; l; l = l->next)
-               {
+               for (const GSList *l = decc->annotation_rows; l; l = l->next) {
                        const srd_decoder_annotation_row *const ann_row =
                                (srd_decoder_annotation_row *)l->data;
                        assert(ann_row);
@@ -213,8 +211,7 @@ void DecoderStack::begin_decode()
                }
 
        // Add classes
-       for (const shared_ptr<decode::Decoder> &dec : stack_)
-       {
+       for (const shared_ptr<decode::Decoder> &dec : stack_) {
                assert(dec);
                const srd_decoder *const decc = dec->decoder();
                assert(dec->decoder());
@@ -224,8 +221,7 @@ void DecoderStack::begin_decode()
                        rows_[Row(decc)] = decode::RowData();
 
                // Add the decoder rows
-               for (const GSList *l = decc->annotation_rows; l; l = l->next)
-               {
+               for (const GSList *l = decc->annotation_rows; l; l = l->next) {
                        const srd_decoder_annotation_row *const ann_row =
                                (srd_decoder_annotation_row *)l->data;
                        assert(ann_row);
@@ -304,8 +300,7 @@ void DecoderStack::decode_data(
                DecodeChunkLength / segment_->unit_size();
 
        for (int64_t i = 0; !interrupt_ && i < sample_count;
-               i += chunk_sample_count)
-       {
+                       i += chunk_sample_count) {
                lock_guard<mutex> decode_lock(global_decode_mutex_);
 
                const int64_t chunk_end = min(
@@ -345,12 +340,10 @@ void DecoderStack::decode_proc()
        // Create the decoders
        const unsigned int unit_size = segment_->unit_size();
 
-       for (const shared_ptr<decode::Decoder> &dec : stack_)
-       {
+       for (const shared_ptr<decode::Decoder> &dec : stack_) {
                srd_decoder_inst *const di = dec->create_decoder_inst(session);
 
-               if (!di)
-               {
+               if (!di) {
                        error_message_ = tr("Failed to create decoder instance");
                        srd_session_destroy(session);
                        return;
@@ -409,8 +402,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
        const auto r = d->class_rows_.find(make_pair(decc, a.format()));
        if (r != d->class_rows_.end())
                row_iter = d->rows_.find((*r).second);
-       else
-       {
+       else {
                // Failing that, use the decoder as a key
                row_iter = d->rows_.find(Row(decc));    
        }
index d43f89a9c596551ba8e06a6d6710075582993565..3e18b85ef4143bb399c5dd1dcff2fb7e6375d7ed 100644 (file)
@@ -71,7 +71,7 @@ uint64_t LogicSegment::unpack_sample(const uint8_t *ptr) const
        return *(uint64_t*)ptr;
 #else
        uint64_t value = 0;
-       switch(unit_size_) {
+       switch (unit_size_) {
        default:
                value |= ((uint64_t)ptr[7]) << 56;
                /* FALLTHRU */
@@ -108,7 +108,7 @@ void LogicSegment::pack_sample(uint8_t *ptr, uint64_t value)
 #ifdef HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS
        *(uint64_t*)ptr = value;
 #else
-       switch(unit_size_) {
+       switch (unit_size_) {
        default:
                ptr[7] = value >> 56;
                /* FALLTHRU */
@@ -173,8 +173,7 @@ void LogicSegment::reallocate_mipmap_level(MipMapLevel &m)
 {
        const uint64_t new_data_length = ((m.length + MipMapDataUnit - 1) /
                MipMapDataUnit) * MipMapDataUnit;
-       if (new_data_length > m.data_length)
-       {
+       if (new_data_length > m.data_length) {
                m.data_length = new_data_length;
 
                // Padding is added to allow for the uint64_t write word
@@ -208,14 +207,12 @@ void LogicSegment::append_payload_to_mipmap()
        const uint8_t *const end_src_ptr = (uint8_t*)data_.data() +
                m0.length * unit_size_ * MipMapScaleFactor;
        for (src_ptr = (uint8_t*)data_.data() +
-               prev_length * unit_size_ * MipMapScaleFactor;
-               src_ptr < end_src_ptr;)
-       {
+                       prev_length * unit_size_ * MipMapScaleFactor;
+                       src_ptr < end_src_ptr;) {
                // Accumulate transitions which have occurred in this sample
                accumulator = 0;
                diff_counter = MipMapScaleFactor;
-               while (diff_counter-- > 0)
-               {
+               while (diff_counter-- > 0) {
                        const uint64_t sample = unpack_sample(src_ptr);
                        accumulator |= last_append_sample_ ^ sample;
                        last_append_sample_ = sample;
@@ -227,8 +224,7 @@ void LogicSegment::append_payload_to_mipmap()
        }
 
        // Compute higher level mipmaps
-       for (unsigned int level = 1; level < ScaleStepCount; level++)
-       {
+       for (unsigned int level = 1; level < ScaleStepCount; level++) {
                MipMapLevel &m = mip_map_[level];
                const MipMapLevel &ml = mip_map_[level-1];
 
@@ -248,14 +244,12 @@ void LogicSegment::append_payload_to_mipmap()
                const uint8_t *const end_dest_ptr =
                        (uint8_t*)m.data + unit_size_ * m.length;
                for (dest_ptr = (uint8_t*)m.data +
-                       unit_size_ * prev_length;
-                       dest_ptr < end_dest_ptr;
-                       dest_ptr += unit_size_)
-               {
+                               unit_size_ * prev_length;
+                               dest_ptr < end_dest_ptr;
+                               dest_ptr += unit_size_) {
                        accumulator = 0;
                        diff_counter = MipMapScaleFactor;
-                       while (diff_counter-- > 0)
-                       {
+                       while (diff_counter-- > 0) {
                                accumulator |= unpack_sample(src_ptr);
                                src_ptr += unit_size_;
                        }
@@ -299,8 +293,7 @@ void LogicSegment::get_subsampled_edges(
        last_sample = (get_sample(start) & sig_mask) != 0;
        edges.push_back(pair<int64_t, bool>(index++, last_sample));
 
-       while (index + block_length <= end)
-       {
+       while (index + block_length <= end) {
                //----- Continue to search -----//
                level = min_level;
 
@@ -308,17 +301,15 @@ void LogicSegment::get_subsampled_edges(
                // at the minimum level.
                fast_forward = (mip_map_[level].data != nullptr);
 
-               if (min_length < MipMapScaleFactor)
-               {
+               if (min_length < MipMapScaleFactor) {
                        // Search individual samples up to the beginning of
                        // the next first level mip map block
                        const uint64_t final_index = min(end,
                                pow2_ceil(index, MipMapScalePower));
 
                        for (; index < final_index &&
-                               (index & ~(~0 << MipMapScalePower)) != 0;
-                               index++)
-                       {
+                                       (index & ~(~0 << MipMapScalePower)) != 0;
+                                       index++) {
                                const bool sample =
                                        (get_sample(index) & sig_mask) != 0;
 
@@ -328,9 +319,7 @@ void LogicSegment::get_subsampled_edges(
                                        break;
                                }
                        }
-               }
-               else
-               {
+               } else {
                        // If resolution is less than a mip map block,
                        // round up to the beginning of the mip-map block
                        // for this level of detail
@@ -399,7 +388,7 @@ void LogicSegment::get_subsampled_edges(
                                // Check if we reached the last block at this
                                // level, or if there was a change in this block
                                if (offset >= mip_map_[level].length ||
-                                       (get_subsample(level, offset) &
+                                               (get_subsample(level, offset) &
                                                sig_mask)) {
                                        // Zoom in unless we reached the minimum
                                        // zoom
index 831c0acaac49cf68fd428ce7ef57fabc6f8a4576..754e300deacdab58af440dc290e4bbb7ba001dfc 100644 (file)
@@ -98,9 +98,8 @@ void Segment::append_data(void *data, uint64_t samples)
 
        // Ensure there's enough capacity to copy.
        const uint64_t free_space = capacity_ - sample_count_;
-       if (free_space < samples) {
+       if (free_space < samples)
                set_capacity(sample_count_ + samples);
-       }
 
        memcpy((uint8_t*)data_.data() + sample_count_ * unit_size_,
                data, samples * unit_size_);
index f1f4c542ca227bca236f050f9e226f30c7271422..b11e60c7705a3c89f137047d903b164de08521c1 100644 (file)
@@ -151,10 +151,12 @@ const shared_ptr<devices::HardwareDevice> DeviceManager::find_device_from_info(
 
                // If present, vendor and model always have to match.
                if (dev_info.count("vendor") > 0 && search_info.count("vendor") > 0)
-                       if (dev_info.at("vendor") != search_info.at("vendor")) continue;
+                       if (dev_info.at("vendor") != search_info.at("vendor"))
+                               continue;
 
                if (dev_info.count("model") > 0 && search_info.count("model") > 0)
-                       if (dev_info.at("model") != search_info.at("model")) continue;
+                       if (dev_info.at("model") != search_info.at("model"))
+                               continue;
 
                // Most unique match: vendor/model/serial_num (but don't match a S/N of 0)
                if ((dev_info.count("serial_num") > 0) && (dev_info.at("serial_num") != "0")
@@ -189,7 +191,8 @@ const shared_ptr<devices::HardwareDevice> DeviceManager::find_device_from_info(
 }
 
 bool DeviceManager::compare_devices(shared_ptr<devices::Device> a,
-       shared_ptr<devices::Device> b) {
+       shared_ptr<devices::Device> b)
+{
        assert(a);
        assert(b);
        return a->display_name(*this).compare(b->display_name(*this)) < 0;
index d7a78afae546c972af6cbf0a012364118bab075a..4edc1d10e11cbb3be3e1b5ae1e79760da47fc4cb 100644 (file)
@@ -36,19 +36,23 @@ using Glib::Variant;
 namespace pv {
 namespace devices {
 
-Device::Device() {
+Device::Device()
+{
 }
 
-Device::~Device() {
+Device::~Device()
+{
        if (session_)
                session_->remove_datafeed_callbacks();
 }
 
-std::shared_ptr<sigrok::Session> Device::session() const {
+std::shared_ptr<sigrok::Session> Device::session() const
+{
        return session_;
 }
 
-std::shared_ptr<sigrok::Device> Device::device() const {
+std::shared_ptr<sigrok::Device> Device::device() const
+{
        return device_;
 }
 
@@ -80,18 +84,21 @@ T Device::read_config(const ConfigKey *key, const T default_value)
                device_->config_get(ConfigKey::SAMPLERATE)).get();
 }
 
-void Device::start() {
+void Device::start()
+{
        assert(session_);
        session_->start();
 }
 
-void Device::run() {
+void Device::run()
+{
        assert(device_);
        assert(session_);
        session_->run();
 }
 
-void Device::stop() {
+void Device::stop()
+{
        assert(session_);
        session_->stop();
 }
index 91f2d5d62d20e44da4b01e82027df2a6b6ee198b..5e1cb859d45073a1c63eb33d3b97be4ef22e09e3 100644 (file)
@@ -26,14 +26,17 @@ namespace pv {
 namespace devices {
 
 File::File(const std::string &file_name) :
-       file_name_(file_name) {
+       file_name_(file_name)
+{
 }
 
-std::string File::full_name() const {
+std::string File::full_name() const
+{
        return boost::filesystem::path(file_name_).filename().string();
 }
 
-std::string File::display_name(const DeviceManager&) const {
+std::string File::display_name(const DeviceManager&) const
+{
        return File::full_name();
 }
 
index d1161aa26669a614bc36fc52e4871bdc1fb68496..318ce1cab26fa61330563fbdd075a5ab510193be 100644 (file)
@@ -44,15 +44,18 @@ namespace devices {
 HardwareDevice::HardwareDevice(const std::shared_ptr<sigrok::Context> &context,
        std::shared_ptr<sigrok::HardwareDevice> device) :
        context_(context),
-       device_open_(false) {
+       device_open_(false)
+{
        device_ = device;
 }
 
-HardwareDevice::~HardwareDevice() {
+HardwareDevice::~HardwareDevice()
+{
        close();
 }
 
-string HardwareDevice::full_name() const {
+string HardwareDevice::full_name() const
+{
        vector<string> parts = {device_->vendor(), device_->model(),
                device_->version(), device_->serial_number()};
        if (device_->connection_id().length() > 0)
@@ -60,12 +63,14 @@ string HardwareDevice::full_name() const {
        return join(parts, " ");
 }
 
-shared_ptr<sigrok::HardwareDevice> HardwareDevice::hardware_device() const {
+shared_ptr<sigrok::HardwareDevice> HardwareDevice::hardware_device() const
+{
        return static_pointer_cast<sigrok::HardwareDevice>(device_);
 }
 
 string HardwareDevice::display_name(
-       const DeviceManager &device_manager) const {
+       const DeviceManager &device_manager) const
+{
        const auto hw_dev = hardware_device();
 
        // If we can find another device with the same model/vendor then
@@ -95,13 +100,14 @@ string HardwareDevice::display_name(
        return join(parts, " ");
 }
 
-void HardwareDevice::open() {
+void HardwareDevice::open()
+{
        if (device_open_)
                close();
 
        try {
                device_->open();
-       } catch(const sigrok::Error &e) {
+       } catch (const sigrok::Error &e) {
                throw QString(e.what());
        }
 
@@ -112,7 +118,8 @@ void HardwareDevice::open() {
        session_->add_device(device_);
 }
 
-void HardwareDevice::close() {
+void HardwareDevice::close()
+{
        if (device_open_)
                device_->close();
 
index 13af3db9cd85c791935da6c80bf1a14220d492a0..3ddc8ae00db06042b97f5e10f599560b3d69b22b 100644 (file)
@@ -37,27 +37,32 @@ InputFile::InputFile(const std::shared_ptr<sigrok::Context> &context,
        File(file_name),
        context_(context),
        input_(format->create_input(options)),
-       interrupt_(false) {
+       interrupt_(false)
+{
        if (!input_)
                throw QString("Failed to create input");
 }
 
-void InputFile::open() {
+void InputFile::open()
+{
        if (session_)
                close();
 
        session_ = context_->create_session();
 }
 
-void InputFile::close() {
+void InputFile::close()
+{
        if (session_)
                session_->remove_devices();
 }
 
-void InputFile::start() {
+void InputFile::start()
+{
 }
 
-void InputFile::run() {
+void InputFile::run()
+{
        char buffer[BufferSize];
        bool need_device = true;
 
@@ -92,7 +97,8 @@ void InputFile::run() {
        input_->end();
 }
 
-void InputFile::stop() {
+void InputFile::stop()
+{
        interrupt_ = true;
 }
 
index e6920ff5e299a6a5b5e437b2768d3d020549f2e0..8a583eeba0ffb08b8015da6fd5f6890d77488c7f 100644 (file)
@@ -30,10 +30,12 @@ namespace devices {
 SessionFile::SessionFile(const std::shared_ptr<sigrok::Context> context,
        const std::string &file_name) :
        File(file_name),
-       context_(context) {
+       context_(context)
+{
 }
 
-void SessionFile::open() {
+void SessionFile::open()
+{
        if (session_)
                close();
 
@@ -41,7 +43,8 @@ void SessionFile::open() {
        device_ = session_->devices()[0];
 }
 
-void SessionFile::close() {
+void SessionFile::close()
+{
        if (session_)
                session_->remove_devices();
 }
index 5baedcbcacaa1a2e06c52050419f5c77158b906d..bf92998b9b9e65fd7cd1ecf0d1d1c1564914f347 100644 (file)
@@ -172,8 +172,7 @@ void Connect::scan_pressed()
        const list< shared_ptr<HardwareDevice> > devices =
                device_manager_.driver_scan(driver, drvopts);
 
-       for (shared_ptr<HardwareDevice> device : devices)
-       {
+       for (shared_ptr<HardwareDevice> device : devices) {
                assert(device);
 
                QString text = QString::fromStdString(
index dad9d680241ad4d59f4352c6dd80863d13b73cbd..d693ddc35e6c7b5ecc8cfc444d2cdc9754e5b937 100644 (file)
@@ -195,12 +195,11 @@ QMenu* MainWindow::menu_decoder_add() const
 
 void MainWindow::run_stop()
 {
-       switch(session_.get_capture_state()) {
+       switch (session_.get_capture_state()) {
        case Session::Stopped:
                session_.start_capture([&](QString message) {
                        session_error("Capture failed", message); });
                break;
-
        case Session::AwaitingTrigger:
        case Session::Running:
                session_.stop_capture();
@@ -215,7 +214,7 @@ void MainWindow::select_device(shared_ptr<devices::Device> device)
                        session_.set_device(device);
                else
                        session_.set_default_device();
-       } catch(const QString &e) {
+       } catch (const QString &e) {
                QMessageBox msg(this);
                msg.setText(e);
                msg.setInformativeText(tr("Failed to Select Device"));
@@ -545,7 +544,8 @@ void MainWindow::setup_ui()
 
 }
 
-void MainWindow::select_init_device() {
+void MainWindow::select_init_device()
+{
        QSettings settings;
        map<string, string> dev_info;
        list<string> key_list;
@@ -577,7 +577,8 @@ void MainWindow::select_init_device() {
 }
 
 void MainWindow::load_init_file(const std::string &file_name,
-       const std::string &format) {
+       const std::string &format)
+{
        shared_ptr<InputFormat> input_format;
 
        if (!format.empty()) {
@@ -622,7 +623,6 @@ void MainWindow::save_ui_settings()
                        session_.device());
 
                for (string key : key_list) {
-
                        if (dev_info.count(key))
                                settings.setValue(QString::fromUtf8(key.c_str()),
                                                QString::fromUtf8(dev_info.at(key).c_str()));
@@ -681,7 +681,7 @@ void MainWindow::load_file(QString file_name,
                                new devices::SessionFile(
                                        device_manager_.context(),
                                        file_name.toStdString())));
-       } catch(Error e) {
+       } catch (Error e) {
                show_session_error(tr("Failed to load ") + file_name, e.what());
                session_.set_default_device();
                update_device_list();
index bffd0dfefbb15e6182b6c4ed54ee5ae9ac3dbd27..1a042da8283c847abfec1efaab4c5441781cfab9 100644 (file)
@@ -86,14 +86,12 @@ Channels::Channels(Session &session, QWidget *parent) :
                signal_map[sig->channel()] = sig;
 
        // Populate channel groups
-       for (auto entry : device->channel_groups())
-       {
+       for (auto entry : device->channel_groups()) {
                shared_ptr<ChannelGroup> group = entry.second;
                // Make a set of signals, and removed this signals from the
                // signal map.
                vector< shared_ptr<Signal> > group_sigs;
-               for (auto channel : group->channels())
-               {
+               for (auto channel : group->channels()) {
                        const auto iter = signal_map.find(channel);
 
                        if (iter == signal_map.end())
@@ -108,8 +106,7 @@ Channels::Channels(Session &session, QWidget *parent) :
 
        // Make a vector of the remaining channels
        vector< shared_ptr<Signal> > global_sigs;
-       for (auto channel : device->channels())
-       {
+       for (auto channel : device->channels()) {
                const map<shared_ptr<Channel>, shared_ptr<Signal> >::
                        const_iterator iter = signal_map.find(channel);
                if (iter != signal_map.end())
@@ -144,9 +141,8 @@ void Channels::set_all_channels(bool set)
        updating_channels_ = true;
 
        for (map<QCheckBox*, shared_ptr<Signal> >::const_iterator i =
-               check_box_signal_map_.begin();
-               i != check_box_signal_map_.end(); i++)
-       {
+                       check_box_signal_map_.begin();
+                       i != check_box_signal_map_.end(); i++) {
                const shared_ptr<Signal> sig = (*i).second;
                assert(sig);
 
@@ -194,8 +190,7 @@ QGridLayout* Channels::create_channel_group_grid(
        int row = 0, col = 0;
        QGridLayout *const grid = new QGridLayout();
 
-       for (const shared_ptr<pv::view::Signal>& sig : sigs)
-       {
+       for (const shared_ptr<pv::view::Signal>& sig : sigs) {
                assert(sig);
 
                QCheckBox *const checkbox = new QCheckBox(sig->name());
@@ -221,9 +216,8 @@ void Channels::showEvent(QShowEvent *e)
        updating_channels_ = true;
 
        for (map<QCheckBox*, shared_ptr<Signal> >::const_iterator i =
-               check_box_signal_map_.begin();
-               i != check_box_signal_map_.end(); i++)
-       {
+                       check_box_signal_map_.begin();
+                       i != check_box_signal_map_.end(); i++) {
                const shared_ptr<Signal> sig = (*i).second;
                assert(sig);
 
index 812b751608f3c561dd4ad8d45af4dc1e79008869..e750e9fa9d8ec15757801c2809de31bbba196ef6 100644 (file)
@@ -72,43 +72,28 @@ QWidget* Int::get_widget(QWidget *parent, bool auto_commit)
        const GVariantType *const type = g_variant_get_type(value);
        assert(type);
 
-       if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTE))
-       {
+       if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTE)) {
                int_val = g_variant_get_byte(value);
                range_min = 0, range_max = UINT8_MAX;
-       }
-       else if (g_variant_type_equal(type, G_VARIANT_TYPE_INT16))
-       {
+       } else if (g_variant_type_equal(type, G_VARIANT_TYPE_INT16)) {
                int_val = g_variant_get_int16(value);
                range_min = INT16_MIN, range_max = INT16_MAX;
-       }
-       else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT16))
-       {
+       } else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT16)) {
                int_val = g_variant_get_uint16(value);
                range_min = 0, range_max = UINT16_MAX;
-       }
-       else if (g_variant_type_equal(type, G_VARIANT_TYPE_INT32))
-       {
+       } else if (g_variant_type_equal(type, G_VARIANT_TYPE_INT32)) {
                int_val = g_variant_get_int32(value);
                range_min = INT32_MIN, range_max = INT32_MAX;
-       }
-       else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT32))
-       {
+       } else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT32)) {
                int_val = g_variant_get_uint32(value);
                range_min = 0, range_max = UINT32_MAX;
-       }
-       else if (g_variant_type_equal(type, G_VARIANT_TYPE_INT64))
-       {
+       } else if (g_variant_type_equal(type, G_VARIANT_TYPE_INT64)) {
                int_val = g_variant_get_int64(value);
                range_min = INT64_MIN, range_max = INT64_MAX;
-       }
-       else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT64))
-       {
+       } else if (g_variant_type_equal(type, G_VARIANT_TYPE_UINT64)) {
                int_val = g_variant_get_uint64(value);
                range_min = 0, range_max = UINT64_MAX;
-       }
-       else
-       {
+       } else {
                // Unexpected value type.
                assert(0);
        }
index 0ac5bb7286dbe2cd6c76dbd07ca967ec2d289176..7545da3c15030a7090974f1ee65ee4f413c2e44a 100644 (file)
@@ -253,8 +253,7 @@ bool Session::add_decoder(srd_decoder *const dec)
        map<const srd_channel*, shared_ptr<view::LogicSignal> > channels;
        shared_ptr<data::DecoderStack> decoder_stack;
 
-       try
-       {
+       try {
                lock_guard<boost::shared_mutex> lock(signals_mutex_);
 
                // Create the decoder
@@ -270,8 +269,7 @@ bool Session::add_decoder(srd_decoder *const dec)
 
                // Auto select the initial channels
                for (const srd_channel *pdch : all_channels)
-                       for (shared_ptr<view::Signal> s : signals_)
-                       {
+                       for (shared_ptr<view::Signal> s : signals_) {
                                shared_ptr<view::LogicSignal> l =
                                        dynamic_pointer_cast<view::LogicSignal>(s);
                                if (l && QString::fromUtf8(pdch->name).
@@ -290,9 +288,7 @@ bool Session::add_decoder(srd_decoder *const dec)
                        new view::DecodeTrace(*this, decoder_stack,
                                decode_traces_.size()));
                decode_traces_.push_back(d);
-       }
-       catch(std::runtime_error e)
-       {
+       } catch (std::runtime_error e) {
                return false;
        }
 
@@ -313,8 +309,7 @@ vector< shared_ptr<view::DecodeTrace> > Session::get_decode_signals() const
 void Session::remove_decode_signal(view::DecodeTrace *signal)
 {
        for (auto i = decode_traces_.begin(); i != decode_traces_.end(); i++)
-               if ((*i).get() == signal)
-               {
+               if ((*i).get() == signal) {
                        decode_traces_.erase(i);
                        signals_changed();
                        return;
@@ -454,7 +449,7 @@ void Session::sample_thread_proc(shared_ptr<devices::Device> device,
 
        try {
                device_->start();
-       } catch(Error e) {
+       } catch (Error e) {
                error_handler(e.what());
                return;
        }
@@ -466,8 +461,7 @@ void Session::sample_thread_proc(shared_ptr<devices::Device> device,
        set_capture_state(Stopped);
 
        // Confirm that SR_DF_END was received
-       if (cur_logic_segment_)
-       {
+       if (cur_logic_segment_) {
                qDebug("SR_DF_END was not received.");
                assert(0);
        }
@@ -535,16 +529,14 @@ void Session::feed_in_logic(shared_ptr<Logic> logic)
 
        const size_t sample_count = logic->data_length() / logic->unit_size();
 
-       if (!logic_data_)
-       {
+       if (!logic_data_) {
                // The only reason logic_data_ would not have been created is
                // if it was not possible to determine the signals when the
                // device was created.
                update_signals();
        }
 
-       if (!cur_logic_segment_)
-       {
+       if (!cur_logic_segment_) {
                // This could be the first packet after a trigger
                set_capture_state(Running);
 
@@ -559,9 +551,7 @@ void Session::feed_in_logic(shared_ptr<Logic> logic)
                // frame_began is DecoderStack, but in future we need to signal
                // this after both analog and logic sweeps have begun.
                frame_began();
-       }
-       else
-       {
+       } else {
                // Append to the existing data segment
                cur_logic_segment_->append_payload(logic);
        }
@@ -579,12 +569,10 @@ void Session::feed_in_analog(shared_ptr<Analog> analog)
        const float *data = static_cast<const float *>(analog->data_pointer());
        bool sweep_beginning = false;
 
-       if (signals_.empty()) {
+       if (signals_.empty())
                update_signals();
-       }
 
-       for (auto channel : channels)
-       {
+       for (auto channel : channels) {
                shared_ptr<data::AnalogSegment> segment;
 
                // Try to get the segment of the channel
@@ -592,8 +580,7 @@ void Session::feed_in_analog(shared_ptr<Analog> analog)
                        iterator iter = cur_analog_segments_.find(channel);
                if (iter != cur_analog_segments_.end())
                        segment = (*iter).second;
-               else
-               {
+               else {
                        // If no segment was found, this means we havn't
                        // created one yet. i.e. this is the first packet
                        // in the sweep containing this segment.
index bdb0f27981839087fac4f01c90ee05cac4b5cb47..4642ed62314473f1bc07ad1c72c778ac6a3608ef 100644 (file)
@@ -216,8 +216,7 @@ void StoreSession::store_proc(shared_ptr<data::LogicSegment> segment)
 
        const unsigned int samples_per_block = BlockSize / unit_size;
 
-       while (!interrupt_ && sample_count_)
-       {
+       while (!interrupt_ && sample_count_) {
                progress_updated();
 
                const uint64_t packet_len =
index 06d4f409b718a77e9546d076d7ebe7b496d6debf..30cff789a3436abdd1216f94d25e4abca6668bc1 100644 (file)
@@ -278,7 +278,7 @@ void MainBar::update_sample_rate_selector()
                (*iter).second.find(sigrok::LIST) != (*iter).second.end()) {
                try {
                        gvar_dict = sr_dev->config_list(ConfigKey::SAMPLERATE);
-               } catch(const sigrok::Error &e) {
+               } catch (const sigrok::Error &e) {
                        // Failed to enunmerate samplerate
                        (void)e;
                }
@@ -291,8 +291,7 @@ void MainBar::update_sample_rate_selector()
        }
 
        if ((gvar_list = g_variant_lookup_value(gvar_dict.gobj(),
-                       "samplerate-steps", G_VARIANT_TYPE("at"))))
-       {
+                       "samplerate-steps", G_VARIANT_TYPE("at")))) {
                elements = (const uint64_t *)g_variant_get_fixed_array(
                                gvar_list, &num_elements, sizeof(uint64_t));
 
@@ -309,18 +308,15 @@ void MainBar::update_sample_rate_selector()
 
                if (step == 1)
                        sample_rate_.show_125_list(min, max);
-               else
-               {
+               else {
                        // When the step is not 1, we cam't make a 1-2-5-10
                        // list of sample rates, because we may not be able to
                        // make round numbers. Therefore in this case, show a
                        // spin box.
                        sample_rate_.show_min_max_step(min, max, step);
                }
-       }
-       else if ((gvar_list = g_variant_lookup_value(gvar_dict.gobj(),
-                       "samplerates", G_VARIANT_TYPE("at"))))
-       {
+       } else if ((gvar_list = g_variant_lookup_value(gvar_dict.gobj(),
+                       "samplerates", G_VARIANT_TYPE("at")))) {
                elements = (const uint64_t *)g_variant_get_fixed_array(
                                gvar_list, &num_elements, sizeof(uint64_t));
                sample_rate_.show_list(elements, num_elements);
@@ -370,8 +366,7 @@ void MainBar::update_sample_count_selector()
        assert(!updating_sample_count_);
        updating_sample_count_ = true;
 
-       if (!sample_count_supported_)
-       {
+       if (!sample_count_supported_) {
                sample_count_.show_none();
                updating_sample_count_ = false;
                return;
@@ -394,7 +389,7 @@ void MainBar::update_sample_count_selector()
                        if (gvar.gobj())
                                g_variant_get(gvar.gobj(), "(tt)",
                                        &min_sample_count, &max_sample_count);
-               } catch(const sigrok::Error &e) {
+               } catch (const sigrok::Error &e) {
                        // Failed to query sample limit
                        (void)e;
                }
@@ -455,8 +450,7 @@ void MainBar::update_device_config_widgets()
        sample_count_supported_ = false;
 
        try {
-               for (auto entry : sr_dev->config_keys(ConfigKey::DEVICE_OPTIONS))
-               {
+               for (auto entry : sr_dev->config_keys(ConfigKey::DEVICE_OPTIONS)) {
                        auto key = entry.first;
                        auto capabilities = entry.second;
                        switch (key->id()) {
@@ -465,8 +459,7 @@ void MainBar::update_device_config_widgets()
                                        sample_count_supported_ = true;
                                break;
                        case SR_CONF_LIMIT_FRAMES:
-                               if (capabilities.count(Capability::SET))
-                               {
+                               if (capabilities.count(Capability::SET)) {
                                        sr_dev->config_set(ConfigKey::LIMIT_FRAMES,
                                                Glib::Variant<guint64>::create(1));
                                        on_config_changed();
@@ -500,8 +493,7 @@ void MainBar::commit_sample_count()
        const shared_ptr<sigrok::Device> sr_dev = device->device();
 
        sample_count = sample_count_.value();
-       if (sample_count_supported_)
-       {
+       if (sample_count_supported_) {
                try {
                        sr_dev->config_set(ConfigKey::LIMIT_SAMPLES,
                                Glib::Variant<guint64>::create(sample_count));
@@ -586,9 +578,9 @@ void MainBar::on_config_changed()
 
 bool MainBar::eventFilter(QObject *watched, QEvent *event)
 {
-       if (sample_count_supported_ &&
-               (watched == &sample_count_ || watched == &sample_rate_) &&
-               (event->type() == QEvent::ToolTip)) {
+       if (sample_count_supported_ && (watched == &sample_count_ ||
+                       watched == &sample_rate_) &&
+                       (event->type() == QEvent::ToolTip)) {
                auto sec = pv::util::Timestamp(sample_count_.value()) / sample_rate_.value();
                QHelpEvent *help_event = static_cast<QHelpEvent*>(event);
 
index 4a32147d80d1501a5401ee52744ad2911ae661ff..f7ee77276a3cd02034293a3130502c135c47f181 100644 (file)
@@ -87,19 +87,13 @@ static QTextStream& operator<<(QTextStream& stream, const Timestamp& t)
        std::ostringstream ss;
        ss << std::fixed;
 
-       if (stream.numberFlags() & QTextStream::ForceSign) {
+       if (stream.numberFlags() & QTextStream::ForceSign)
                ss << std::showpos;
-       }
 
-       if (0 == precision) {
-               ss
-                       << std::setprecision(1)
-                       << round(t);
-       } else {
-               ss
-                       << std::setprecision(precision)
-                       << t;
-       }
+       if (0 == precision)
+               ss << std::setprecision(1) << round(t);
+       else
+               ss << std::setprecision(precision) << t;
 
        std::string str(ss.str());
        if (0 == precision) {
index 5ee90aa1357e6f2f89ce32f1cffbf14dcbdb3506..f9d3e53ddd3fec6bae38fc39dfdaa3d257ef87f8 100644 (file)
@@ -61,7 +61,8 @@ shared_ptr<Cursor> CursorPair::second() const
        return second_;
 }
 
-void CursorPair::set_time(const pv::util::Timestamp& time) {
+void CursorPair::set_time(const pv::util::Timestamp& time)
+{
        const pv::util::Timestamp delta = second_->time() - first_->time();
        first_->set_time(time);
        second_->set_time(time + delta);
@@ -119,8 +120,7 @@ void CursorPair::paint_label(QPainter &p, const QRect &rect, bool hover)
        const int radius = delta_rect.height() / 2;
        const QRectF text_rect(delta_rect.intersected(
                rect).adjusted(radius, 0, -radius, 0));
-       if (text_rect.width() >= text_size_.width())
-       {
+       if (text_rect.width() >= text_size_.width()) {
                const int highlight_radius = delta_rect.height() / 2 - 2;
 
                if (selected()) {
@@ -144,7 +144,8 @@ void CursorPair::paint_label(QPainter &p, const QRect &rect, bool hover)
        }
 }
 
-void CursorPair::paint_back(QPainter &p, const ViewItemPaintParams &pp) {
+void CursorPair::paint_back(QPainter &p, const ViewItemPaintParams &pp)
+{
        if (!enabled())
                return;
 
index 020ce77090acd4d86bc06ba49185be1282106a02..52e1c72062afa5cb63519d9da6e68c509b1b9f07 100644 (file)
@@ -182,8 +182,7 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
 
        assert(decoder_stack_);
        const QString err = decoder_stack_->error_message();
-       if (!err.isEmpty())
-       {
+       if (!err.isEmpty()) {
                draw_unresolved_period(
                        p, annotation_height, pp.left(), pp.right());
                draw_error(p, err, pp);
@@ -199,8 +198,7 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
        const vector<Row> rows(decoder_stack_->get_visible_rows());
 
        visible_rows_.clear();
-       for (size_t i = 0; i < rows.size(); i++)
-       {
+       for (size_t i = 0; i < rows.size(); i++) {
                const Row &row = rows[i];
 
                size_t base_colour = 0x13579BDF;
@@ -232,15 +230,13 @@ void DecodeTrace::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
 
        assert(row_height_);
 
-       for (size_t i = 0; i < visible_rows_.size(); i++)
-       {
+       for (size_t i = 0; i < visible_rows_.size(); i++) {
                const int y = i * row_height_ + get_visual_y();
 
                p.setPen(QPen(Qt::NoPen));
                p.setBrush(QApplication::palette().brush(QPalette::WindowText));
 
-               if (i != 0)
-               {
+               if (i != 0) {
                        const QPointF points[] = {
                                QPointF(pp.left(), y - ArrowSize),
                                QPointF(pp.left() + ArrowSize, y),
@@ -286,15 +282,12 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
 
        const list< shared_ptr<Decoder> >& stack = decoder_stack_->stack();
 
-       if (stack.empty())
-       {
+       if (stack.empty()) {
                QLabel *const l = new QLabel(
                        tr("<p><i>No decoders in the stack</i></p>"));
                l->setAlignment(Qt::AlignCenter);
                form->addRow(l);
-       }
-       else
-       {
+       } else {
                auto iter = stack.cbegin();
                for (int i = 0; i < (int)stack.size(); i++, iter++) {
                        shared_ptr<Decoder> dec(*iter);
@@ -389,8 +382,7 @@ void DecodeTrace::draw_range(const pv::data::decode::Annotation &a, QPainter &p,
        p.setBrush(fill);
 
        // If the two ends are within 1 pixel, draw a vertical line
-       if (start + 1.0 > end)
-       {
+       if (start + 1.0 > end) {
                p.drawLine(QPointF(start, top), QPointF(start, bottom));
                return;
        }
@@ -729,8 +721,7 @@ QComboBox* DecodeTrace::create_channel_selector(
 
        for (const shared_ptr<view::Signal> &s : sig_list) {
                assert(s);
-               if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled())
-               {
+               if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled()) {
                        selector->addItem(s->name(),
                                qVariantFromValue((void*)s.get()));
 
@@ -752,8 +743,7 @@ void DecodeTrace::commit_decoder_channels(shared_ptr<data::decode::Decoder> &dec
 
        const unordered_set< shared_ptr<Signal> > sigs(session_.signals());
 
-       for (const ChannelSelector &s : channel_selectors_)
-       {
+       for (const ChannelSelector &s : channel_selectors_) {
                if (s.decoder_ != dec)
                        break;
 
index 7c2dd9b0d7b17c1d698bf36bd7a8db8181ea13ec..1977d05340fb0b63db4d87340148edc3baf478c4 100644 (file)
@@ -115,8 +115,7 @@ void Header::paintEvent(QPaintEvent*)
        QPainter painter(this);
        painter.setRenderHint(QPainter::Antialiasing);
 
-       for (const shared_ptr<RowItem> r : items)
-       {
+       for (const shared_ptr<RowItem> r : items) {
                assert(r);
 
                const bool highlight = !item_dragging_ &&
index 2d663cdc18b17a18740dfc7126b11da13f99e579..0d657611021dd3fdd8e58fd0b39ef64924833c46 100644 (file)
@@ -66,8 +66,7 @@ void MarginWidget::keyPressEvent(QKeyEvent *e)
 {
        assert(e);
 
-       if (e->key() == Qt::Key_Delete)
-       {
+       if (e->key() == Qt::Key_Delete) {
                const auto items = this->items();
                for (auto &i : items)
                        if (i->selected())
index 601e73b163a6ed84683ca8b3bcf9526ab3a8e048..31ec121d074aa724bd4a67b83c2c4272d233099c 100644 (file)
@@ -128,8 +128,7 @@ shared_ptr<ViewItem> Ruler::get_mouse_over_item(const QPoint &pt)
 void Ruler::paintEvent(QPaintEvent*)
 {
        if (!tick_position_cache_) {
-               auto ffunc = [this](const pv::util::Timestamp& t)
-               {
+               auto ffunc = [this](const pv::util::Timestamp& t) {
                        return format_time_with_distance(
                                this->view_.tick_period(),
                                t,
index 6a342915972312b96e29e731fd75fed59191df6e..c6a6afd323dcccac191061bfac65c640bac36c68 100644 (file)
@@ -408,8 +408,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)
-       {
+       for (const shared_ptr<SignalData> d : visible_data) {
                const vector< shared_ptr<Segment> > segments =
                        d->segments();
                for (const shared_ptr<Segment> &s : segments) {
@@ -727,8 +726,7 @@ vector< shared_ptr<Trace> > View::extract_new_traces_for_channels(
 {
        vector< shared_ptr<Trace> > filtered_traces;
 
-       for (const auto &channel : channels)
-       {
+       for (const auto &channel : channels) {
                const auto map_iter = signal_map.find(channel);
                if (map_iter == signal_map.end())
                        continue;
@@ -793,7 +791,7 @@ bool View::eventFilter(QObject *object, QEvent *event)
 
 bool View::viewportEvent(QEvent *e)
 {
-       switch(e->type()) {
+       switch (e->type()) {
        case QEvent::Paint:
        case QEvent::MouseButtonPress:
        case QEvent::MouseButtonRelease:
@@ -804,7 +802,6 @@ bool View::viewportEvent(QEvent *e)
        case QEvent::TouchUpdate:
        case QEvent::TouchEnd:
                return false;
-
        default:
                return QAbstractScrollArea::viewportEvent(e);
        }
@@ -920,8 +917,7 @@ void View::signals_changed()
                signal_map[sig->channel()] = sig;
 
        // Populate channel groups
-       for (auto entry : sr_dev->channel_groups())
-       {
+       for (auto entry : sr_dev->channel_groups()) {
                const shared_ptr<sigrok::ChannelGroup> &group = entry.second;
 
                if (group->channels().size() <= 1)
index db44f48f308ee51c41e71c631b0435d8937bb7e5..998045c8efdca9a2c189b89e64dde3edbef0e256 100644 (file)
@@ -32,7 +32,8 @@ ViewItemPaintParams::ViewItemPaintParams(
        const QRect &rect, double scale, const pv::util::Timestamp& offset) :
        rect_(rect),
        scale_(scale),
-       offset_(offset) {
+       offset_(offset)
+{
        assert(scale > 0.0);
 }
 
@@ -41,7 +42,8 @@ QFont ViewItemPaintParams::font()
        return QApplication::font();
 }
 
-int ViewItemPaintParams::text_height() {
+int ViewItemPaintParams::text_height()
+{
        return QFontMetrics(font()).height();
 }
 
index 3811c1e8a143d70b6dc8f03115d1ead1e529c07e..5cb65079f1c98fe61242862404b15c908a6d3602 100644 (file)
@@ -203,8 +203,7 @@ void Viewport::wheelEvent(QWheelEvent *e)
 {
        assert(e);
 
-       if (e->orientation() == Qt::Vertical)
-       {
+       if (e->orientation() == Qt::Vertical) {
                if (e->modifiers() & Qt::ControlModifier) {
                        // Vertical scrolling with the control key pressed
                        // is intrepretted as vertical scrolling
@@ -214,9 +213,7 @@ void Viewport::wheelEvent(QWheelEvent *e)
                        // Vertical scrolling is interpreted as zooming in/out
                        view_.zoom(e->delta() / 120, e->x());
                }
-       }
-       else if (e->orientation() == Qt::Horizontal)
-       {
+       } else if (e->orientation() == Qt::Horizontal) {
                // Horizontal scrolling is interpreted as moving left/right
                view_.set_scale_offset(view_.scale(),
                        e->delta() * view_.scale() + view_.offset());
index a834f9c0d54eba1c236f18558cfe471bbb3f700a..30d96eb356259c9669bbfdd243f27db066d4ebfe 100644 (file)
@@ -73,8 +73,7 @@ bool ViewWidget::accept_drag() const
        const bool any_time_items_selected = any_of(items.begin(), items.end(),
                [](const shared_ptr<TimeItem> &i) { return i->selected(); });
 
-       if (any_row_items_selected && !any_time_items_selected)
-       {
+       if (any_row_items_selected && !any_time_items_selected) {
                // Check all the drag items share a common owner
                TraceTreeItemOwner *item_owner = nullptr;
                for (shared_ptr<TraceTreeItem> r : trace_tree_items)
@@ -86,9 +85,7 @@ bool ViewWidget::accept_drag() const
                        }
 
                return true;
-       }
-       else if (any_time_items_selected && !any_row_items_selected)
-       {
+       } else if (any_time_items_selected && !any_row_items_selected) {
                return true;
        }
 
@@ -212,8 +209,7 @@ void ViewWidget::mouse_left_release_event(QMouseEvent *event)
 
        if (item_dragging_)
                view_.restack_all_trace_tree_items();
-       else
-       {
+       else {
                if (!ctrl_pressed) {
                        for (shared_ptr<ViewItem> i : items)
                                if (mouse_down_item_ != i)
@@ -278,10 +274,8 @@ void ViewWidget::mouseMoveEvent(QMouseEvent *e)
 
        if (!e->buttons())
                item_hover(get_mouse_over_item(e->pos()));
-       else if (e->buttons() & Qt::LeftButton)
-       {
-               if (!item_dragging_)
-               {
+       else if (e->buttons() & Qt::LeftButton) {
+               if (!item_dragging_) {
                        if ((e->pos() - mouse_down_point_).manhattanLength() <
                                QApplication::startDragDistance())
                                return;
index 1f503462ea2f839f0f39891aeb481fa6c830b4ae..13b9673894db39274472c9882550fd055077e0e6 100644 (file)
@@ -58,9 +58,7 @@ void ColourButton::set_colour(QColor colour)
 
        for (unsigned int r = 0; r < rows; r++)
                for (unsigned int c = 0; c < cols; c++)
-                       if (popup_.well_array().cellBrush(r, c).color() ==
-                               colour)
-                       {
+                       if (popup_.well_array().cellBrush(r, c).color() == colour) {
                                popup_.well_array().setSelected(r, c);
                                popup_.well_array().setCurrent(r, c);
                                return;
index 3ea1c841d6530413b71d5ed9d077a65d66ceb2a9..7da77bd3bb08c922bd47d95e9fad480b07fab30f 100644 (file)
@@ -33,8 +33,7 @@ DecoderMenu::DecoderMenu(QWidget *parent, bool first_level_decoder) :
 {
        GSList *l = g_slist_sort(g_slist_copy(
                (GSList*)srd_decoder_list()), decoder_name_cmp);
-       for (; l; l = l->next)
-       {
+       for (; l; l = l->next) {
                const srd_decoder *const d = (srd_decoder*)l->data;
                assert(d);
 
index de2d1b57010643228bb28c5ba713eb25723c55eb..17bc719130a5ef49eb9c2acdfc60c4696593a93f 100644 (file)
@@ -65,7 +65,6 @@ void Popup::set_position(const QPoint point, Position pos)
                MarginWidth + ((pos == Bottom) ? ArrowLength : 0),
                MarginWidth + ((pos == Left) ? ArrowLength : 0),
                MarginWidth + ((pos == Top) ? ArrowLength : 0));
-
 }
 
 bool Popup::eventFilter(QObject *obj, QEvent *evt)
@@ -145,8 +144,7 @@ QPolygon Popup::arrow_polygon() const
        const QPoint p = mapFromGlobal(point_);
        const int l = ArrowLength + ArrowOverlap; 
 
-       switch (pos_)
-       {
+       switch (pos_) {
        case Right:
                poly << QPoint(p.x() + l, p.y() - l);
                break;
@@ -163,8 +161,7 @@ QPolygon Popup::arrow_polygon() const
 
        poly << p;
 
-       switch (pos_)
-       {
+       switch (pos_) {
        case Right:
        case Bottom:
                poly << QPoint(p.x() + l, p.y() + l);
index b2c0e6370d44587ce88a2063704bc14bb3a7b54d..ec404c36c96f4f251c9dcc9e5034720c907ff231 100644 (file)
@@ -88,8 +88,7 @@ void SweepTimingWidget::show_list(const uint64_t *vals, size_t count)
        value_type_ = List;
 
        list_.clear();
-       for (size_t i = 0; i < count; i++)
-       {
+       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]));
@@ -142,8 +141,7 @@ 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;
 
index 233ff6484f562b9d723a0bd74a9e587c82fc686d..463a846277d814bcebed936335e18d73a6314f55 100644 (file)
@@ -104,8 +104,7 @@ void TimestampSpinBox::on_editingFinished()
                captures.removeFirst(); // remove entire match
                QString str = captures.join("");
                setValue(pv::util::Timestamp(str.toStdString()));
-       }
-       else {
+       } else {
                // replace the malformed entered string with the old value
                updateEdit();
        }