From 1d3b8accfd1a95d8b6c982d8f03818a05b42334b Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Thu, 4 Nov 2021 15:38:42 +0800 Subject: [PATCH] remove all shared_ptr, remove all boost foreach --- DSView/mystyle.h | 2 +- DSView/pv/ZipMaker.cpp | 2 +- DSView/pv/config/appconfig.cpp | 10 +- DSView/pv/config/appconfig.h | 15 +- DSView/pv/data/analog.cpp | 5 +- DSView/pv/data/analog.h | 12 +- DSView/pv/data/analogsnapshot.cpp | 6 +- DSView/pv/data/analogsnapshot.h | 6 +- DSView/pv/data/decode/annotation.cpp | 22 +- DSView/pv/data/decode/annotation.h | 19 +- DSView/pv/data/decode/decoder.cpp | 67 +--- DSView/pv/data/decode/decoder.h | 44 ++- DSView/pv/data/decode/row.cpp | 9 +- DSView/pv/data/decode/row.h | 6 +- DSView/pv/data/decode/rowdata.cpp | 12 +- DSView/pv/data/decode/rowdata.h | 14 +- DSView/pv/data/decodermodel.cpp | 9 +- DSView/pv/data/decodermodel.h | 16 +- DSView/pv/data/decoderstack.cpp | 67 ++-- DSView/pv/data/decoderstack.h | 41 +- DSView/pv/data/dso.cpp | 5 +- DSView/pv/data/dso.h | 11 +- DSView/pv/data/dsosnapshot.cpp | 6 +- DSView/pv/data/dsosnapshot.h | 6 +- DSView/pv/data/group.cpp | 5 +- DSView/pv/data/group.h | 11 +- DSView/pv/data/groupsnapshot.cpp | 16 +- DSView/pv/data/groupsnapshot.h | 11 +- DSView/pv/data/logic.cpp | 8 +- DSView/pv/data/logic.h | 11 +- DSView/pv/data/mathstack.cpp | 20 +- DSView/pv/data/mathstack.h | 23 +- DSView/pv/data/snapshot.cpp | 20 +- DSView/pv/data/snapshot.h | 22 +- DSView/pv/data/spectrumstack.cpp | 26 +- DSView/pv/data/spectrumstack.h | 21 +- DSView/pv/device/device.cpp | 6 +- DSView/pv/device/device.h | 6 +- DSView/pv/device/devinst.cpp | 8 +- DSView/pv/device/devinst.h | 12 +- DSView/pv/device/file.cpp | 2 +- DSView/pv/device/file.h | 2 +- DSView/pv/device/inputfile.cpp | 2 +- DSView/pv/device/inputfile.h | 2 +- DSView/pv/device/sessionfile.cpp | 2 +- DSView/pv/device/sessionfile.h | 2 +- DSView/pv/dialogs/calibration.cpp | 2 +- DSView/pv/dialogs/calibration.h | 3 +- DSView/pv/dialogs/deviceoptions.cpp | 14 +- DSView/pv/dialogs/deviceoptions.h | 4 +- DSView/pv/dialogs/dsomeasure.cpp | 14 +- DSView/pv/dialogs/dsomeasure.h | 5 +- DSView/pv/dialogs/fftoptions.cpp | 16 +- DSView/pv/dialogs/fftoptions.h | 3 +- DSView/pv/dialogs/lissajousoptions.cpp | 12 +- DSView/pv/dialogs/lissajousoptions.h | 3 +- DSView/pv/dialogs/mathoptions.cpp | 14 +- DSView/pv/dialogs/mathoptions.h | 3 +- DSView/pv/dialogs/protocolexp.cpp | 13 +- DSView/pv/dialogs/protocolexp.h | 4 +- DSView/pv/dialogs/protocollist.cpp | 19 +- DSView/pv/dialogs/protocollist.h | 3 +- DSView/pv/dialogs/regionoptions.h | 4 +- DSView/pv/dialogs/search.cpp | 8 +- DSView/pv/dialogs/search.h | 4 +- DSView/pv/dialogs/shadow.cpp | 2 +- DSView/pv/dialogs/shadow.h | 8 +- DSView/pv/dialogs/storeprogress.h | 5 +- DSView/pv/dialogs/waitingdialog.cpp | 4 +- DSView/pv/dialogs/waitingdialog.h | 4 +- DSView/pv/dock/dsotriggerdock.cpp | 6 +- DSView/pv/dock/measuredock.cpp | 18 +- DSView/pv/dock/protocoldock.cpp | 40 +- DSView/pv/dock/searchdock.cpp | 11 +- DSView/pv/dsvdef.cpp | 7 + DSView/pv/dsvdef.h | 12 + DSView/pv/mainwindow.cpp | 69 ++-- DSView/pv/minizip/mztools.c | 4 +- DSView/pv/prop/binding/binding.cpp | 15 +- DSView/pv/prop/binding/binding.h | 14 +- DSView/pv/prop/binding/decoderoptions.cpp | 35 +- DSView/pv/prop/binding/decoderoptions.h | 12 +- DSView/pv/prop/binding/deviceoptions.cpp | 28 +- DSView/pv/prop/binding/probeoptions.cpp | 18 +- DSView/pv/prop/bool.cpp | 4 +- DSView/pv/prop/bool.h | 4 +- DSView/pv/prop/enum.cpp | 4 +- DSView/pv/prop/property.cpp | 12 +- DSView/pv/prop/property.h | 10 +- DSView/pv/sigsession.cpp | 439 ++++++++++------------ DSView/pv/sigsession.h | 110 +++--- DSView/pv/storesession.cpp | 91 ++--- DSView/pv/storesession.h | 13 +- DSView/pv/toolbars/filebar.cpp | 4 +- DSView/pv/toolbars/samplingbar.cpp | 18 +- DSView/pv/toolbars/samplingbar.h | 10 +- DSView/pv/toolbars/titlebar.cpp | 12 +- DSView/pv/toolbars/titlebar.h | 2 +- DSView/pv/view/analogsignal.cpp | 91 +++-- DSView/pv/view/analogsignal.h | 57 ++- DSView/pv/view/cursor.cpp | 4 +- DSView/pv/view/cursor.h | 4 +- DSView/pv/view/decodetrace.cpp | 87 +++-- DSView/pv/view/decodetrace.h | 60 +-- DSView/pv/view/devmode.cpp | 4 +- DSView/pv/view/devmode.h | 5 +- DSView/pv/view/dsldial.cpp | 14 +- DSView/pv/view/dsldial.h | 14 +- DSView/pv/view/dsosignal.cpp | 90 +++-- DSView/pv/view/dsosignal.h | 56 ++- DSView/pv/view/groupsignal.cpp | 24 +- DSView/pv/view/groupsignal.h | 15 +- DSView/pv/view/header.cpp | 61 ++- DSView/pv/view/header.h | 12 +- DSView/pv/view/lissajoustrace.cpp | 21 +- DSView/pv/view/lissajoustrace.h | 21 +- DSView/pv/view/logicsignal.cpp | 54 ++- DSView/pv/view/logicsignal.h | 30 +- DSView/pv/view/mathtrace.cpp | 28 +- DSView/pv/view/mathtrace.h | 34 +- DSView/pv/view/ruler.cpp | 17 +- DSView/pv/view/ruler.h | 2 +- DSView/pv/view/selectableitem.cpp | 2 +- DSView/pv/view/selectableitem.h | 4 +- DSView/pv/view/signal.cpp | 4 +- DSView/pv/view/signal.h | 9 +- DSView/pv/view/spectrumtrace.cpp | 26 +- DSView/pv/view/spectrumtrace.h | 24 +- DSView/pv/view/timemarker.cpp | 6 +- DSView/pv/view/timemarker.h | 10 +- DSView/pv/view/trace.cpp | 38 +- DSView/pv/view/trace.h | 41 +- DSView/pv/view/view.cpp | 99 ++--- DSView/pv/view/view.h | 37 +- DSView/pv/view/viewport.cpp | 126 ++++--- DSView/pv/view/viewport.h | 13 +- DSView/pv/view/viewstatus.cpp | 6 +- DSView/pv/view/viewstatus.h | 2 - DSView/pv/view/xcursor.cpp | 20 +- DSView/pv/view/xcursor.h | 23 +- DSView/pv/widgets/decodergroupbox.cpp | 4 +- DSView/pv/widgets/decodergroupbox.h | 13 +- 142 files changed, 1484 insertions(+), 1671 deletions(-) diff --git a/DSView/mystyle.h b/DSView/mystyle.h index c53bda52..e2cc768f 100644 --- a/DSView/mystyle.h +++ b/DSView/mystyle.h @@ -7,7 +7,7 @@ class MyStyle : public QProxyStyle { Q_OBJECT public: - int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const { + int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) { int s = QProxyStyle::pixelMetric(metric, option, widget); if (metric == QStyle::PM_SmallIconSize) { s = 24; diff --git a/DSView/pv/ZipMaker.cpp b/DSView/pv/ZipMaker.cpp index add6a080..bf57dd14 100644 --- a/DSView/pv/ZipMaker.cpp +++ b/DSView/pv/ZipMaker.cpp @@ -262,7 +262,7 @@ const char *ZipMaker::GetError() break; } rdlen += dlen; - buf = buf + dlen; //move pointer + buf += dlen; //move pointer buflen = inf.dataLen - rdlen; } diff --git a/DSView/pv/config/appconfig.cpp b/DSView/pv/config/appconfig.cpp index 269b261f..3901c7bf 100644 --- a/DSView/pv/config/appconfig.cpp +++ b/DSView/pv/config/appconfig.cpp @@ -27,14 +27,14 @@ #define MAX_PROTOCOL_FORMAT_LIST 15 -StringPair::StringPair(const string &key, const string &value) +StringPair::StringPair(const std::string &key, const std::string &value) { m_key = key; m_value = value; } //------------function -QString FormatArrayToString(vector &protocolFormats){ +QString FormatArrayToString(std::vector &protocolFormats){ QString str; for (StringPair &o : protocolFormats){ @@ -49,7 +49,7 @@ QString FormatArrayToString(vector &protocolFormats){ return str; } -void StringToFormatArray(const QString &str, vector &protocolFormats){ +void StringToFormatArray(const QString &str, std::vector &protocolFormats){ QStringList arr = str.split(";"); for (int i=0; i #include -using namespace std; - + //--------------------api--- QString GetDirectoryName(QString path); @@ -40,9 +39,9 @@ QString GetIconPath(); class StringPair { public: - StringPair(const string &key, const string &value); - string m_key; - string m_value; + StringPair(const std::string &key, const std::string &value); + std::string m_key; + std::string m_value; }; @@ -52,7 +51,7 @@ struct AppOptions bool warnofMultiTrig; bool originalData; - vector m_protocolFormats; + std::vector m_protocolFormats; }; struct FrameOptions @@ -91,8 +90,8 @@ public: void SaveHistory(); void SaveFrame(); - void SetProtocolFormat(const string &protocolName, const string &value); - string GetProtocolFormat(const string &protocolName); + void SetProtocolFormat(const std::string &protocolName, const std::string &value); + std::string GetProtocolFormat(const std::string &protocolName); public: AppOptions _appOptions; diff --git a/DSView/pv/data/analog.cpp b/DSView/pv/data/analog.cpp index 85046322..4dfcc8c4 100755 --- a/DSView/pv/data/analog.cpp +++ b/DSView/pv/data/analog.cpp @@ -24,7 +24,6 @@ #include "analogsnapshot.h" -using namespace boost; using namespace std; namespace pv { @@ -35,12 +34,12 @@ Analog::Analog() : { } -void Analog::push_snapshot(boost::shared_ptr &snapshot) +void Analog::push_snapshot(AnalogSnapshot *snapshot) { _snapshots.push_front(snapshot); } -deque< boost::shared_ptr >& Analog::get_snapshots() +std::deque& Analog::get_snapshots() { return _snapshots; } diff --git a/DSView/pv/data/analog.h b/DSView/pv/data/analog.h index c28b649f..dbba04df 100755 --- a/DSView/pv/data/analog.h +++ b/DSView/pv/data/analog.h @@ -26,7 +26,7 @@ #include "signaldata.h" -#include + #include namespace pv { @@ -39,17 +39,13 @@ class Analog : public SignalData public: Analog(); - void push_snapshot( - boost::shared_ptr &snapshot); - - std::deque< boost::shared_ptr >& - get_snapshots(); - + void push_snapshot(AnalogSnapshot *snapshot); + std::deque& get_snapshots(); void clear(); void init(); private: - std::deque< boost::shared_ptr > _snapshots; + std::deque _snapshots; }; } // namespace data diff --git a/DSView/pv/data/analogsnapshot.cpp b/DSView/pv/data/analogsnapshot.cpp index 7da95a1a..0fb067f3 100755 --- a/DSView/pv/data/analogsnapshot.cpp +++ b/DSView/pv/data/analogsnapshot.cpp @@ -214,7 +214,7 @@ void AnalogSnapshot::append_data(void *data, uint64_t samples, uint16_t pitch) } } -const uint8_t* AnalogSnapshot::get_samples(int64_t start_sample) const +const uint8_t* AnalogSnapshot::get_samples(int64_t start_sample) { assert(start_sample >= 0); assert(start_sample < (int64_t)get_sample_count()); @@ -227,7 +227,7 @@ const uint8_t* AnalogSnapshot::get_samples(int64_t start_sample) const } void AnalogSnapshot::get_envelope_section(EnvelopeSection &s, - uint64_t start, int64_t count, float min_length, int probe_index) const + uint64_t start, int64_t count, float min_length, int probe_index) { assert(count >= 0); assert(min_length > 0); @@ -371,7 +371,7 @@ int AnalogSnapshot::get_ch_order(int sig_index) return order; } -int AnalogSnapshot::get_scale_factor() const +int AnalogSnapshot::get_scale_factor() { return EnvelopeScaleFactor; } diff --git a/DSView/pv/data/analogsnapshot.h b/DSView/pv/data/analogsnapshot.h index 0d6c1473..e9716a45 100755 --- a/DSView/pv/data/analogsnapshot.h +++ b/DSView/pv/data/analogsnapshot.h @@ -95,14 +95,14 @@ public: void append_payload(const sr_datafeed_analog &analog); - const uint8_t *get_samples(int64_t start_sample) const; + const uint8_t *get_samples(int64_t start_sample); void get_envelope_section(EnvelopeSection &s, - uint64_t start, int64_t count, float min_length, int probe_index) const; + uint64_t start, int64_t count, float min_length, int probe_index); int get_ch_order(int sig_index); - int get_scale_factor() const; + int get_scale_factor(); bool has_data(int index); int get_block_num(); diff --git a/DSView/pv/data/decode/annotation.cpp b/DSView/pv/data/decode/annotation.cpp index c0838d04..1949e0ec 100755 --- a/DSView/pv/data/decode/annotation.cpp +++ b/DSView/pv/data/decode/annotation.cpp @@ -172,26 +172,8 @@ Annotation::~Annotation() { } - -uint64_t Annotation::start_sample() const -{ - return _start_sample; -} - -uint64_t Annotation::end_sample() const -{ - return _end_sample; -} - -int Annotation::format() const -{ - return _format; -} - -int Annotation::type() const -{ - return _type; -} + + const std::vector& Annotation::annotations() const { diff --git a/DSView/pv/data/decode/annotation.h b/DSView/pv/data/decode/annotation.h index 46d3e2eb..2e8d359e 100755 --- a/DSView/pv/data/decode/annotation.h +++ b/DSView/pv/data/decode/annotation.h @@ -46,10 +46,21 @@ public: ~Annotation(); - uint64_t start_sample() const; - uint64_t end_sample() const; - int format() const; - int type() const; + inline uint64_t start_sample() const{ + return _start_sample; + } + + inline uint64_t end_sample() const{ + return _end_sample; + } + + inline int format() const{ + return _format; + } + + inline int type() const{ + return _type; + } public: const std::vector& annotations() const; diff --git a/DSView/pv/data/decode/decoder.cpp b/DSView/pv/data/decode/decoder.cpp index 94d1efe3..a9e4c66e 100755 --- a/DSView/pv/data/decode/decoder.cpp +++ b/DSView/pv/data/decode/decoder.cpp @@ -22,12 +22,9 @@ #include #include "decoder.h" +#include -using boost::shared_ptr; -using std::set; -using std::map; -using std::string; - + namespace pv { namespace data { namespace decode { @@ -41,44 +38,18 @@ Decoder::Decoder(const srd_decoder *const dec) : Decoder::~Decoder() { - for (map::const_iterator i = _options_back.begin(); + for (auto i = _options_back.begin(); i != _options_back.end(); i++) if ((*i).second) g_variant_unref((*i).second); } - -const srd_decoder* Decoder::decoder() const -{ - return _decoder; -} - -bool Decoder::shown() const -{ - return _shown; -} - -void Decoder::show(bool show) -{ - _shown = show; -} - -const map& -Decoder::channels() const -{ - return _probes; -} - -void Decoder::set_probes(std::map probes) + +void Decoder::set_probes(std::map probes) { _probes_back = probes; _setted = true; } - -const std::map& Decoder::options() const -{ - return _options; -} - + void Decoder::set_option(const char *id, GVariant *value) { assert(value); @@ -98,17 +69,7 @@ void Decoder::set_decode_region(uint64_t start, uint64_t end) _decode_end != end) _setted = true; } - -uint64_t Decoder::decode_start() const -{ - return _decode_start; -} - -uint64_t Decoder::decode_end() const -{ - return _decode_end; -} - + //apply setting bool Decoder::commit() { @@ -124,7 +85,7 @@ bool Decoder::commit() } } -bool Decoder::have_required_probes() const +bool Decoder::have_required_probes() { for (GSList *l = _decoder->channels; l; l = l->next) { const srd_channel *const pdch = (const srd_channel*)l->data; @@ -136,12 +97,12 @@ bool Decoder::have_required_probes() const return true; } -srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const +srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) { GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - for (map::const_iterator i = _options.begin(); + for (auto i = _options.begin(); i != _options.end(); i++) { GVariant *const value = (*i).second; @@ -161,7 +122,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const GHashTable *const probes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - for(map:: + for(std::map:: const_iterator i = _probes.begin(); i != _probes.end(); i++) { @@ -174,11 +135,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const return decoder_inst; } - -int Decoder::get_channel_type(const srd_channel *ch) -{ - return ch->type; -} + } // decode } // data diff --git a/DSView/pv/data/decode/decoder.h b/DSView/pv/data/decode/decoder.h index 0309ae47..3d723bdb 100755 --- a/DSView/pv/data/decode/decoder.h +++ b/DSView/pv/data/decode/decoder.h @@ -27,9 +27,7 @@ #include #include #include - -#include - + #include struct srd_decoder; @@ -48,29 +46,49 @@ public: virtual ~Decoder(); - const srd_decoder* decoder() const; + inline const srd_decoder* decoder(){ + return _decoder; + } - bool shown() const; - void show(bool show = true); + inline bool shown(){ + return _shown; + } + + inline void show(bool show = true){ + _shown = show; + } + + inline std::map& channels(){ + return _probes; + } - const std::map& channels() const; void set_probes(std::map probes); - const std::map& options() const; + inline std::map& options(){ + return _options; + } void set_option(const char *id, GVariant *value); - bool have_required_probes() const; + bool have_required_probes(); - srd_decoder_inst* create_decoder_inst(srd_session *session) const; + srd_decoder_inst* create_decoder_inst(srd_session *session); void set_decode_region(uint64_t start, uint64_t end); - uint64_t decode_start() const; - uint64_t decode_end() const; + + inline uint64_t decode_start(){ + return _decode_start; + } + + inline uint64_t decode_end(){ + return _decode_end; + } bool commit(); - int get_channel_type(const srd_channel* ch); + inline int get_channel_type(const srd_channel* ch){ + return ch->type; + } private: const srd_decoder *const _decoder; diff --git a/DSView/pv/data/decode/row.cpp b/DSView/pv/data/decode/row.cpp index 63fef7c3..abe1633b 100755 --- a/DSView/pv/data/decode/row.cpp +++ b/DSView/pv/data/decode/row.cpp @@ -40,7 +40,14 @@ Row::Row(const srd_decoder *decoder, const srd_decoder_annotation_row *row, cons { } -const QString Row::title() const +Row::Row(const Row &o) +{ + _decoder = o._decoder; + _row = o._row; + _order = o._order; +} + +QString Row::title() const { if (_decoder && _decoder->name && _row && _row->desc) return QString("%1: %2") diff --git a/DSView/pv/data/decode/row.h b/DSView/pv/data/decode/row.h index b21f8093..b5c6cdd9 100755 --- a/DSView/pv/data/decode/row.h +++ b/DSView/pv/data/decode/row.h @@ -42,6 +42,8 @@ public: const srd_decoder_annotation_row *row = NULL, const int order = -1); + Row(const Row &o); + public: inline const srd_decoder* decoder() const{ @@ -52,9 +54,9 @@ public: return _row; } - const QString title() const; + QString title() const; - bool operator<(const Row &other) const; + bool operator<(const Row &other)const; private: const srd_decoder *_decoder; diff --git a/DSView/pv/data/decode/rowdata.cpp b/DSView/pv/data/decode/rowdata.cpp index 9ac049e9..e8ac9278 100755 --- a/DSView/pv/data/decode/rowdata.cpp +++ b/DSView/pv/data/decode/rowdata.cpp @@ -57,7 +57,7 @@ void RowData::clear() _item_count = 0; } -uint64_t RowData::get_max_sample() const +uint64_t RowData::get_max_sample() { std::lock_guard lock(_global_visitor_mutex); @@ -66,12 +66,12 @@ uint64_t RowData::get_max_sample() const return _annotations.back()->end_sample(); } -uint64_t RowData::get_max_annotation() const +uint64_t RowData::get_max_annotation() { return _max_annotation; } -uint64_t RowData::get_min_annotation() const +uint64_t RowData::get_min_annotation() { if (_min_annotation == UINT64_MAX) return 10; @@ -80,7 +80,7 @@ uint64_t RowData::get_min_annotation() const } void RowData::get_annotation_subset(std::vector &dest, - uint64_t start_sample, uint64_t end_sample) const + uint64_t start_sample, uint64_t end_sample) { std::lock_guard lock(_global_visitor_mutex); @@ -93,7 +93,7 @@ void RowData::get_annotation_subset(std::vector &d } } -uint64_t RowData::get_annotation_index(uint64_t start_sample) const +uint64_t RowData::get_annotation_index(uint64_t start_sample) { std::lock_guard lock(_global_visitor_mutex); uint64_t index = 0; @@ -131,7 +131,7 @@ bool RowData::push_annotation(Annotation *a) } -bool RowData::get_annotation(Annotation &ann, uint64_t index) const +bool RowData::get_annotation(Annotation &ann, uint64_t index) { std::lock_guard lock(_global_visitor_mutex); diff --git a/DSView/pv/data/decode/rowdata.h b/DSView/pv/data/decode/rowdata.h index 0059567f..e04af7a6 100755 --- a/DSView/pv/data/decode/rowdata.h +++ b/DSView/pv/data/decode/rowdata.h @@ -38,26 +38,26 @@ public: ~RowData(); public: - uint64_t get_max_sample() const; + uint64_t get_max_sample(); - uint64_t get_max_annotation() const; - uint64_t get_min_annotation() const; + uint64_t get_max_annotation(); + uint64_t get_min_annotation(); - uint64_t get_annotation_index(uint64_t start_sample) const; + uint64_t get_annotation_index(uint64_t start_sample); bool push_annotation(Annotation *a); - inline uint64_t get_annotation_size() const{ + inline uint64_t get_annotation_size(){ return _item_count; } - bool get_annotation(pv::data::decode::Annotation &ann, uint64_t index) const; + bool get_annotation(pv::data::decode::Annotation &ann, uint64_t index); /** * Extracts sorted annotations between two period into a vector. */ void get_annotation_subset(std::vector &dest, - uint64_t start_sample, uint64_t end_sample) const; + uint64_t start_sample, uint64_t end_sample); void clear(); diff --git a/DSView/pv/data/decodermodel.cpp b/DSView/pv/data/decodermodel.cpp index c42bab6a..dbf7f121 100755 --- a/DSView/pv/data/decodermodel.cpp +++ b/DSView/pv/data/decodermodel.cpp @@ -37,18 +37,13 @@ DecoderModel::DecoderModel(QObject *parent) { } -void DecoderModel::setDecoderStack(boost::shared_ptr decoder_stack) +void DecoderModel::setDecoderStack(DecoderStack *decoder_stack) { beginResetModel(); _decoder_stack = decoder_stack; endResetModel(); } - -const boost::shared_ptr& DecoderModel::getDecoderStack() const -{ - return _decoder_stack; -} - + int DecoderModel::rowCount(const QModelIndex & /* parent */) const { if (_decoder_stack) diff --git a/DSView/pv/data/decodermodel.h b/DSView/pv/data/decodermodel.h index 09032729..3a9d1760 100755 --- a/DSView/pv/data/decodermodel.h +++ b/DSView/pv/data/decodermodel.h @@ -22,9 +22,7 @@ #define DSVIEW_PV_DATA_DECODERMODEL_H #include - -#include - + #include namespace pv { @@ -46,14 +44,16 @@ public: int rowCount(const QModelIndex & /*parent*/) const; int columnCount(const QModelIndex & /*parent*/) const; QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, - int role) const; + QVariant headerData(int section, Qt::Orientation orientation,int role) const; - void setDecoderStack(boost::shared_ptr decoder_stack); - const boost::shared_ptr& getDecoderStack() const; + void setDecoderStack(DecoderStack *decoder_stack); + + inline DecoderStack* getDecoderStack(){ + return _decoder_stack; + } private: - boost::shared_ptr _decoder_stack; + DecoderStack *_decoder_stack; }; } // namespace data diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 72d094ce..09d3dcf4 100755 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -35,12 +35,11 @@ #include "../sigsession.h" #include "../view/logicsignal.h" #include "../dsvdef.h" - - -using namespace boost; -using namespace std; +#include using namespace pv::data::decode; +using namespace std; +using namespace boost; namespace pv { namespace data { @@ -57,6 +56,10 @@ DecoderStack::DecoderStack(pv::SigSession *session, const srd_decoder *const dec, DecoderStatus *decoder_status) : _session(session) { + assert(session); + assert(dec); + assert(decoder_status); + _samples_decoded = 0; _sample_count = 0; _frame_complete = false; @@ -75,8 +78,7 @@ DecoderStack::DecoderStack(pv::SigSession *session, connect(_session, SIGNAL(frame_ended()), this, SLOT(on_frame_ended())); - _stack.push_back(boost::shared_ptr( - new decode::Decoder(dec))); + _stack.push_back(new decode::Decoder(dec)); build_row(); } @@ -97,7 +99,7 @@ DecoderStack::~DecoderStack() _class_rows.clear(); } -void DecoderStack::push(boost::shared_ptr decoder) +void DecoderStack::push(decode::Decoder *decoder) { assert(decoder); _stack.push_back(decoder); @@ -105,10 +107,10 @@ void DecoderStack::push(boost::shared_ptr decoder) _options_changed = true; } -void DecoderStack::remove(boost::shared_ptr &decoder) +void DecoderStack::remove(Decoder *decoder) { // Find the decoder in the stack - list< boost::shared_ptr >::iterator iter = _stack.begin(); + auto iter = _stack.begin(); for(unsigned int i = 0; i < _stack.size(); i++, iter++) if ((*iter) == decoder) break; @@ -187,7 +189,7 @@ void DecoderStack::build_row() } } -int64_t DecoderStack::samples_decoded() const +int64_t DecoderStack::samples_decoded() { std::lock_guard decode_lock(_output_mutex); return _samples_decoded; @@ -196,7 +198,7 @@ int64_t DecoderStack::samples_decoded() const void DecoderStack::get_annotation_subset( std::vector &dest, const Row &row, uint64_t start_sample, - uint64_t end_sample) const + uint64_t end_sample) { auto iter = _rows.find(row); if (iter != _rows.end()) @@ -206,7 +208,7 @@ void DecoderStack::get_annotation_subset( uint64_t DecoderStack::get_annotation_index( - const Row &row, uint64_t start_sample) const + const Row &row, uint64_t start_sample) { uint64_t index = 0; auto iter = _rows.find(row); @@ -270,7 +272,7 @@ void DecoderStack::set_rows_lshow(const decode::Row row, bool show) } } -bool DecoderStack::has_annotations(const Row &row) const +bool DecoderStack::has_annotations(const Row &row) { auto iter = _rows.find(row); @@ -283,13 +285,13 @@ bool DecoderStack::has_annotations(const Row &row) const return false; } -uint64_t DecoderStack::list_annotation_size() const +uint64_t DecoderStack::list_annotation_size() { std::lock_guard lock(_output_mutex); uint64_t max_annotation_size = 0; for (auto i = _rows.begin(); i != _rows.end(); i++) { - map::const_iterator iter = _rows_lshow.find((*i).first); + auto iter = _rows_lshow.find((*i).first); if (iter != _rows_lshow.end() && (*iter).second) max_annotation_size = max(max_annotation_size, (*i).second->get_annotation_size()); @@ -298,11 +300,11 @@ uint64_t DecoderStack::list_annotation_size() const return max_annotation_size; } -uint64_t DecoderStack::list_annotation_size(uint16_t row_index) const +uint64_t DecoderStack::list_annotation_size(uint16_t row_index) { for (auto i = _rows.begin(); i != _rows.end(); i++) { - map::const_iterator iter = _rows_lshow.find((*i).first); + auto iter = _rows_lshow.find((*i).first); if (iter != _rows_lshow.end() && (*iter).second) if (row_index-- == 0) { return (*i).second->get_annotation_size(); @@ -312,11 +314,11 @@ uint64_t DecoderStack::list_annotation_size(uint16_t row_index) const } bool DecoderStack::list_annotation(pv::data::decode::Annotation &ann, - uint16_t row_index, uint64_t col_index) const + uint16_t row_index, uint64_t col_index) { for (auto i = _rows.begin(); i != _rows.end(); i++) { - map::const_iterator iter = _rows_lshow.find((*i).first); + auto iter = _rows_lshow.find((*i).first); if (iter != _rows_lshow.end() && (*iter).second) { if (row_index-- == 0) { return (*i).second->get_annotation(ann, col_index); @@ -328,11 +330,11 @@ bool DecoderStack::list_annotation(pv::data::decode::Annotation &ann, } -bool DecoderStack::list_row_title(int row, QString &title) const +bool DecoderStack::list_row_title(int row, QString &title) { for (auto i = _rows.begin(); i != _rows.end(); i++) { - map::const_iterator iter = _rows_lshow.find((*i).first); + auto iter = _rows_lshow.find((*i).first); if (iter != _rows_lshow.end() && (*iter).second) { if (row-- == 0) { title = (*i).first.title(); @@ -385,8 +387,8 @@ void DecoderStack::stop_decode() void DecoderStack::begin_decode() { - boost::shared_ptr logic_signal; - boost::shared_ptr data; + pv::view::LogicSignal *logic_signal = NULL; + pv::data::Logic *data = NULL; if (!_options_changed) return; @@ -409,7 +411,7 @@ void DecoderStack::begin_decode() if (dec && !dec->channels().empty()) { for(auto &sig : _session->get_signals()) { if((sig->get_index() == (*dec->channels().begin()).second) && - (logic_signal = dynamic_pointer_cast(sig)) && + (logic_signal = dynamic_cast(sig)) && (data = logic_signal->logic_data())) break; } @@ -422,8 +424,7 @@ void DecoderStack::begin_decode() return; // Check we have a snapshot of data - const deque< boost::shared_ptr > &snapshots = - data->get_snapshots(); + const auto &snapshots = data->get_snapshots(); if (snapshots.empty()) return; _snapshot = snapshots.front(); @@ -445,7 +446,7 @@ void DecoderStack::begin_decode() _decode_thread = new std::thread(&DecoderStack::decode_proc, this); } -uint64_t DecoderStack::get_max_sample_count() const +uint64_t DecoderStack::get_max_sample_count() { uint64_t max_sample_count = 0; @@ -596,7 +597,7 @@ void DecoderStack::decode_proc() _decode_state = Stopped; } -uint64_t DecoderStack::sample_count() const +uint64_t DecoderStack::sample_count() { if (_snapshot) return _snapshot->get_sample_count(); @@ -604,7 +605,7 @@ uint64_t DecoderStack::sample_count() const return 0; } -uint64_t DecoderStack::sample_rate() const +uint64_t DecoderStack::sample_rate() { return _samplerate; } @@ -679,14 +680,14 @@ int DecoderStack::list_rows_size() { int rows_size = 0; for (auto i = _rows.begin(); i != _rows.end(); i++) { - map::const_iterator iter = _rows_lshow.find((*i).first); + auto iter = _rows_lshow.find((*i).first); if (iter != _rows_lshow.end() && (*iter).second) rows_size++; } return rows_size; } -bool DecoderStack::options_changed() const +bool DecoderStack::options_changed() { return _options_changed; } @@ -696,7 +697,7 @@ void DecoderStack::set_options_changed(bool changed) _options_changed = changed; } -bool DecoderStack::out_of_memory() const +bool DecoderStack::out_of_memory() { return _no_memory; } @@ -706,7 +707,7 @@ void DecoderStack::set_mark_index(int64_t index) _mark_index = index; } -int64_t DecoderStack::get_mark_index() const +int64_t DecoderStack::get_mark_index() { return _mark_index; } diff --git a/DSView/pv/data/decoderstack.h b/DSView/pv/data/decoderstack.h index d7f89bf1..c30455b7 100755 --- a/DSView/pv/data/decoderstack.h +++ b/DSView/pv/data/decoderstack.h @@ -25,8 +25,7 @@ #include -#include -#include +#include #include @@ -88,17 +87,17 @@ public: virtual ~DecoderStack(); - inline std::list< boost::shared_ptr >& stack(){ + inline std::list& stack(){ return _stack; } - void push(boost::shared_ptr decoder); + void push(decode::Decoder *decoder); - void remove(boost::shared_ptr& decoder); + void remove(decode::Decoder *decoder); void build_row(); - int64_t samples_decoded() const; + int64_t samples_decoded(); /** * Extracts sorted annotations between two period into a vector. @@ -106,10 +105,10 @@ public: void get_annotation_subset( std::vector &dest, const decode::Row &row, uint64_t start_sample, - uint64_t end_sample) const; + uint64_t end_sample); uint64_t get_annotation_index( - const decode::Row &row, uint64_t start_sample) const; + const decode::Row &row, uint64_t start_sample); uint64_t get_max_annotation(const decode::Row &row); uint64_t get_min_annotation(const decode::Row &row); // except instant(end=start) annotation @@ -119,24 +118,24 @@ public: void set_rows_gshow(const decode::Row row, bool show); void set_rows_lshow(const decode::Row row, bool show); - bool has_annotations(const decode::Row &row) const; + bool has_annotations(const decode::Row &row); - uint64_t list_annotation_size() const; - uint64_t list_annotation_size(uint16_t row_index) const; + uint64_t list_annotation_size(); + uint64_t list_annotation_size(uint16_t row_index); bool list_annotation(decode::Annotation &ann, - uint16_t row_index, uint64_t col_index) const; + uint16_t row_index, uint64_t col_index); - bool list_row_title(int row, QString &title) const; + bool list_row_title(int row, QString &title); QString error_message(); void clear(); void init(); - uint64_t get_max_sample_count() const; + uint64_t get_max_sample_count(); void begin_decode(); @@ -144,16 +143,16 @@ public: int list_rows_size(); - bool options_changed() const; + bool options_changed(); void set_options_changed(bool changed); - uint64_t sample_count() const; - uint64_t sample_rate() const; + uint64_t sample_count(); + uint64_t sample_rate(); - bool out_of_memory() const; + bool out_of_memory(); void set_mark_index(int64_t index); - int64_t get_mark_index() const; + int64_t get_mark_index(); private: void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session); @@ -174,9 +173,9 @@ signals: void decode_done(); private: - std::list< boost::shared_ptr > _stack; + std::list _stack; - boost::shared_ptr _snapshot; + pv::data::LogicSnapshot *_snapshot; std::map _rows; std::map _rows_gshow; diff --git a/DSView/pv/data/dso.cpp b/DSView/pv/data/dso.cpp index b88e77d7..acbd6c62 100755 --- a/DSView/pv/data/dso.cpp +++ b/DSView/pv/data/dso.cpp @@ -23,7 +23,6 @@ #include "dsosnapshot.h" -using namespace boost; using namespace std; namespace pv { @@ -34,12 +33,12 @@ Dso::Dso() : { } -void Dso::push_snapshot(boost::shared_ptr &snapshot) +void Dso::push_snapshot(DsoSnapshot *snapshot) { _snapshots.push_front(snapshot); } -deque< boost::shared_ptr >& Dso::get_snapshots() +std::deque& Dso::get_snapshots() { return _snapshots; } diff --git a/DSView/pv/data/dso.h b/DSView/pv/data/dso.h index 0902972a..1ef87645 100755 --- a/DSView/pv/data/dso.h +++ b/DSView/pv/data/dso.h @@ -24,8 +24,7 @@ #define DSVIEW_PV_DATA_DSO_H #include "signaldata.h" - -#include + #include namespace pv { @@ -38,17 +37,15 @@ class Dso : public SignalData public: Dso(); - void push_snapshot( - boost::shared_ptr &snapshot); + void push_snapshot(DsoSnapshot *snapshot); - std::deque< boost::shared_ptr >& - get_snapshots(); + std::deque& get_snapshots(); void clear(); void init(); private: - std::deque< boost::shared_ptr > _snapshots; + std::deque _snapshots; }; } // namespace data diff --git a/DSView/pv/data/dsosnapshot.cpp b/DSView/pv/data/dsosnapshot.cpp index 60a98a8c..db56da10 100755 --- a/DSView/pv/data/dsosnapshot.cpp +++ b/DSView/pv/data/dsosnapshot.cpp @@ -210,7 +210,7 @@ const uint8_t *DsoSnapshot::get_samples( } void DsoSnapshot::get_envelope_section(EnvelopeSection &s, - uint64_t start, uint64_t end, float min_length, int probe_index) const + uint64_t start, uint64_t end, float min_length, int probe_index) { assert(end <= get_sample_count()); assert(start <= end); @@ -348,7 +348,7 @@ void DsoSnapshot::append_payload_to_envelope_levels(bool header) _envelope_done = true; } -double DsoSnapshot::cal_vrms(double zero_off, int index) const +double DsoSnapshot::cal_vrms(double zero_off, int index) { assert(index >= 0); //assert(index < _channel_num); @@ -383,7 +383,7 @@ double DsoSnapshot::cal_vrms(double zero_off, int index) const return vrms; } -double DsoSnapshot::cal_vmean(int index) const +double DsoSnapshot::cal_vmean(int index) { assert(index >= 0); //assert(index < _channel_num); diff --git a/DSView/pv/data/dsosnapshot.h b/DSView/pv/data/dsosnapshot.h index f9586efe..b32eb78f 100755 --- a/DSView/pv/data/dsosnapshot.h +++ b/DSView/pv/data/dsosnapshot.h @@ -95,12 +95,12 @@ public: int64_t end_sample, uint16_t index); void get_envelope_section(EnvelopeSection &s, - uint64_t start, uint64_t end, float min_length, int probe_index) const; + uint64_t start, uint64_t end, float min_length, int probe_index); void enable_envelope(bool enable); - double cal_vrms(double zero_off, int index) const; - double cal_vmean(int index) const; + double cal_vrms(double zero_off, int index); + double cal_vmean(int index); bool has_data(int index); int get_block_num(); diff --git a/DSView/pv/data/group.cpp b/DSView/pv/data/group.cpp index 41329f82..04f699a1 100755 --- a/DSView/pv/data/group.cpp +++ b/DSView/pv/data/group.cpp @@ -23,7 +23,6 @@ #include "groupsnapshot.h" -using namespace boost; using namespace std; namespace pv { @@ -34,12 +33,12 @@ Group::Group() : { } -void Group::push_snapshot(boost::shared_ptr &snapshot) +void Group::push_snapshot(GroupSnapshot *snapshot) { _snapshots.push_back(snapshot); } -deque< boost::shared_ptr >& Group::get_snapshots() +std::deque& Group::get_snapshots() { return _snapshots; } diff --git a/DSView/pv/data/group.h b/DSView/pv/data/group.h index 1312c6ee..bc6e4e53 100755 --- a/DSView/pv/data/group.h +++ b/DSView/pv/data/group.h @@ -24,8 +24,7 @@ #define DSVIEW_PV_DATA_GROUP_H #include "signaldata.h" - -#include + #include namespace pv { @@ -38,17 +37,15 @@ class Group : public SignalData public: Group(); - void push_snapshot( - boost::shared_ptr &snapshot); + void push_snapshot(GroupSnapshot *snapshot); - std::deque< boost::shared_ptr >& - get_snapshots(); + std::deque& get_snapshots(); void clear(); void init(); private: - std::deque< boost::shared_ptr > _snapshots; + std::deque _snapshots; }; } // namespace data diff --git a/DSView/pv/data/groupsnapshot.cpp b/DSView/pv/data/groupsnapshot.cpp index 3c5f25ee..3eae0efb 100755 --- a/DSView/pv/data/groupsnapshot.cpp +++ b/DSView/pv/data/groupsnapshot.cpp @@ -27,12 +27,10 @@ #include #include - #include "logicsnapshot.h" #include "groupsnapshot.h" -using namespace boost; using namespace std; namespace pv { @@ -48,15 +46,17 @@ const uint16_t GroupSnapshot::value_mask[16] = {0x1, 0x2, 0x4, 0x8, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000}; -GroupSnapshot::GroupSnapshot(const boost::shared_ptr &_logic_snapshot, std::list index_list) +GroupSnapshot::GroupSnapshot(const LogicSnapshot *_logic_snapshot, std::list index_list) { assert(_logic_snapshot); + LogicSnapshot *logic_snapshot = const_cast(_logic_snapshot); + memset(_envelope_levels, 0, sizeof(_envelope_levels)); - _data = _logic_snapshot->get_data(); - _sample_count = _logic_snapshot->get_sample_count(); - _unit_size = _logic_snapshot->unit_size(); + _data = logic_snapshot->get_data(); + _sample_count = logic_snapshot->get_sample_count(); + _unit_size = logic_snapshot->unit_size(); _index_list = index_list; _mask = 0; @@ -108,7 +108,7 @@ void GroupSnapshot::clear() } -uint64_t GroupSnapshot::get_sample_count() const +uint64_t GroupSnapshot::get_sample_count() { return _sample_count; } @@ -150,7 +150,7 @@ const uint16_t* GroupSnapshot::get_samples( } void GroupSnapshot::get_envelope_section(EnvelopeSection &s, - uint64_t start, uint64_t end, float min_length) const + uint64_t start, uint64_t end, float min_length) { assert(end <= _sample_count); assert(start <= end); diff --git a/DSView/pv/data/groupsnapshot.h b/DSView/pv/data/groupsnapshot.h index fbd7095e..683e4f96 100755 --- a/DSView/pv/data/groupsnapshot.h +++ b/DSView/pv/data/groupsnapshot.h @@ -22,10 +22,7 @@ #ifndef DSVIEW_PV_DATA_GROUPSNAPSHOT_H #define DSVIEW_PV_DATA_GROUPSNAPSHOT_H - -#include - #include "../view/signal.h" #include @@ -75,7 +72,7 @@ private: static const uint16_t value_mask[16]; public: - GroupSnapshot(const boost::shared_ptr &_logic_snapshot, std::list index_list); + GroupSnapshot(const LogicSnapshot *_logic_snapshot, std::list index_list); virtual ~GroupSnapshot(); @@ -84,13 +81,13 @@ public: void append_payload(); - uint64_t get_sample_count() const; + uint64_t get_sample_count(); const uint16_t* get_samples(int64_t start_sample, int64_t end_sample); void get_envelope_section(EnvelopeSection &s, - uint64_t start, uint64_t end, float min_length) const; + uint64_t start, uint64_t end, float min_length); private: void reallocate_envelope(Envelope &l); @@ -103,7 +100,7 @@ private: const void *_data; uint64_t _sample_count; int _unit_size; - boost::shared_ptr _signal; + view::Signal *_signal; std::list _index_list; uint16_t _mask; int _bubble_start[32]; diff --git a/DSView/pv/data/logic.cpp b/DSView/pv/data/logic.cpp index d2597125..71055656 100755 --- a/DSView/pv/data/logic.cpp +++ b/DSView/pv/data/logic.cpp @@ -22,8 +22,7 @@ #include "logic.h" #include "logicsnapshot.h" - -using namespace boost; + using namespace std; namespace pv { @@ -34,13 +33,12 @@ Logic::Logic() : { } -void Logic::push_snapshot( - boost::shared_ptr &snapshot) +void Logic::push_snapshot(LogicSnapshot *snapshot) { _snapshots.push_front(snapshot); } -deque< boost::shared_ptr >& Logic::get_snapshots() +std::deque& Logic::get_snapshots() { return _snapshots; } diff --git a/DSView/pv/data/logic.h b/DSView/pv/data/logic.h index f163b35c..2eb76aed 100755 --- a/DSView/pv/data/logic.h +++ b/DSView/pv/data/logic.h @@ -25,8 +25,7 @@ #define DSVIEW_PV_DATA_LOGIC_H #include "signaldata.h" - -#include + #include namespace pv { @@ -39,18 +38,16 @@ class Logic : public SignalData public: Logic(); - void push_snapshot( - boost::shared_ptr &snapshot); + void push_snapshot(LogicSnapshot *snapshot); - std::deque< boost::shared_ptr >& - get_snapshots(); + std::deque& get_snapshots(); void clear(); void init(); private: - std::deque< boost::shared_ptr > _snapshots; + std::deque _snapshots; }; } // namespace data diff --git a/DSView/pv/data/mathstack.cpp b/DSView/pv/data/mathstack.cpp index e584d392..87dd08cd 100755 --- a/DSView/pv/data/mathstack.cpp +++ b/DSView/pv/data/mathstack.cpp @@ -73,8 +73,8 @@ const QString MathStack::vDialDivUnit[MathStack::vDialUnitCount] = { }; MathStack::MathStack(pv::SigSession *session, - boost::shared_ptr dsoSig1, - boost::shared_ptr dsoSig2, + view::DsoSignal* dsoSig1, + view::DsoSignal* dsoSig2, MathType type) : _session(session), _dsoSig1(dsoSig1), @@ -117,12 +117,12 @@ void MathStack::init() _envelope_done = false; } -MathStack::MathType MathStack::get_type() const +MathStack::MathType MathStack::get_type() { return _type; } -uint64_t MathStack::get_sample_num() const +uint64_t MathStack::get_sample_num() { return _sample_num; } @@ -276,13 +276,13 @@ double MathStack::get_math_scale() return scale; } -const double* MathStack::get_math(uint64_t start) const +const double* MathStack::get_math(uint64_t start) { return _math.data() + start; } void MathStack::get_math_envelope_section(EnvelopeSection &s, - uint64_t start, uint64_t end, float min_length) const + uint64_t start, uint64_t end, float min_length) { assert(end <= get_sample_num()); assert(start <= end); @@ -316,14 +316,12 @@ void MathStack::calc_math() _math_state = Running; - const boost::shared_ptr data = _dsoSig1->dso_data(); - const deque< boost::shared_ptr > &snapshots = - data->get_snapshots(); + const auto data = _dsoSig1->dso_data(); + const auto &snapshots = data->get_snapshots(); if (snapshots.empty()) return; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty()) return; diff --git a/DSView/pv/data/mathstack.h b/DSView/pv/data/mathstack.h index e0c1a97c..2fb72fbc 100755 --- a/DSView/pv/data/mathstack.h +++ b/DSView/pv/data/mathstack.h @@ -25,9 +25,8 @@ #include -#include -#include - +#include + #include #include @@ -103,16 +102,16 @@ private: public: MathStack(pv::SigSession *_session, - boost::shared_ptr dsoSig1, - boost::shared_ptr dsoSig2, MathType type); + view::DsoSignal *dsoSig1, + view::DsoSignal *dsoSig2, MathType type); virtual ~MathStack(); void clear(); void init(); void free_envelop(); void realloc(uint64_t num); - MathType get_type() const; - uint64_t get_sample_num() const; + MathType get_type(); + uint64_t get_sample_num(); void enable_envelope(bool enable); @@ -121,9 +120,9 @@ public: QString get_unit(int level); double get_math_scale(); - const double *get_math(uint64_t start) const; + const double *get_math(uint64_t start); void get_math_envelope_section(EnvelopeSection &s, - uint64_t start, uint64_t end, float min_length) const; + uint64_t start, uint64_t end, float min_length); void calc_math(); void reallocate_envelope(Envelope &e); @@ -132,9 +131,9 @@ public: signals: private: - pv::SigSession *_session; - boost::shared_ptr _dsoSig1; - boost::shared_ptr _dsoSig2; + pv::SigSession *_session; + view::DsoSignal *_dsoSig1; + view::DsoSignal *_dsoSig2; MathType _type; uint64_t _sample_num; diff --git a/DSView/pv/data/snapshot.cpp b/DSView/pv/data/snapshot.cpp index 2e50fc2c..773ea130 100755 --- a/DSView/pv/data/snapshot.cpp +++ b/DSView/pv/data/snapshot.cpp @@ -64,12 +64,12 @@ void Snapshot::free_data() _ch_index.clear(); } -bool Snapshot::memory_failed() const +bool Snapshot::memory_failed() { return _memory_failed; } -bool Snapshot::empty() const +bool Snapshot::empty() { if (get_sample_count() == 0) return true; @@ -77,7 +77,7 @@ bool Snapshot::empty() const return false; } -bool Snapshot::last_ended() const +bool Snapshot::last_ended() { return _last_ended; } @@ -87,13 +87,13 @@ void Snapshot::set_last_ended(bool ended) _last_ended = ended; } -uint64_t Snapshot::get_sample_count() const +uint64_t Snapshot::get_sample_count() { std::lock_guard lock(_mutex); return _sample_count; } -uint64_t Snapshot::get_ring_start() const +uint64_t Snapshot::get_ring_start() { std::lock_guard lock(_mutex); if (_sample_count < _total_sample_count) @@ -102,7 +102,7 @@ uint64_t Snapshot::get_ring_start() const return _ring_sample_count; } -uint64_t Snapshot::get_ring_end() const +uint64_t Snapshot::get_ring_end() { std::lock_guard lock(_mutex); if (_sample_count == 0) @@ -113,22 +113,22 @@ uint64_t Snapshot::get_ring_end() const return _ring_sample_count - 1; } -const void* Snapshot::get_data() const +const void* Snapshot::get_data() { return _data; } -int Snapshot::unit_size() const +int Snapshot::unit_size() { return _unit_size; } -uint8_t Snapshot::get_unit_bytes() const +uint8_t Snapshot::get_unit_bytes() { return _unit_bytes; } -unsigned int Snapshot::get_channel_num() const +unsigned int Snapshot::get_channel_num() { return _channel_num; } diff --git a/DSView/pv/data/snapshot.h b/DSView/pv/data/snapshot.h index e8a43588..79de9589 100755 --- a/DSView/pv/data/snapshot.h +++ b/DSView/pv/data/snapshot.h @@ -39,22 +39,22 @@ public: virtual void clear() = 0; virtual void init() = 0; - uint64_t get_sample_count() const; - uint64_t get_ring_start() const; - uint64_t get_ring_end() const; + uint64_t get_sample_count(); + uint64_t get_ring_start(); + uint64_t get_ring_end(); - const void * get_data() const; + const void * get_data(); - int unit_size() const; - uint8_t get_unit_bytes() const; + int unit_size(); + uint8_t get_unit_bytes(); - bool memory_failed() const; - bool empty() const; + bool memory_failed(); + bool empty(); - bool last_ended() const; + bool last_ended(); void set_last_ended(bool ended); - unsigned int get_channel_num() const; + unsigned int get_channel_num(); virtual void capture_ended(); virtual bool has_data(int index) = 0; @@ -67,7 +67,7 @@ protected: protected: mutable std::mutex _mutex; - //std::vector _data; + void* _data; mutable std::vector _ch_index; diff --git a/DSView/pv/data/spectrumstack.cpp b/DSView/pv/data/spectrumstack.cpp index 7a96f308..c5c48301 100755 --- a/DSView/pv/data/spectrumstack.cpp +++ b/DSView/pv/data/spectrumstack.cpp @@ -76,12 +76,12 @@ void SpectrumStack::init() { } -int SpectrumStack::get_index() const +int SpectrumStack::get_index() { return _index; } -uint64_t SpectrumStack::get_sample_num() const +uint64_t SpectrumStack::get_sample_num() { return _sample_num; } @@ -96,7 +96,7 @@ void SpectrumStack::set_sample_num(uint64_t num) FFTW_R2HC, FFTW_ESTIMATE); } -int SpectrumStack::get_windows_index() const +int SpectrumStack::get_windows_index() { return _windows_index; } @@ -106,7 +106,7 @@ void SpectrumStack::set_windows_index(int index) _windows_index = index; } -bool SpectrumStack::dc_ignored() const +bool SpectrumStack::dc_ignored() { return _dc_ignore; } @@ -116,7 +116,7 @@ void SpectrumStack::set_dc_ignore(bool ignore) _dc_ignore = ignore; } -int SpectrumStack::get_sample_interval() const +int SpectrumStack::get_sample_interval() { return _sample_interval; } @@ -126,7 +126,7 @@ void SpectrumStack::set_sample_interval(int interval) _sample_interval = interval; } -const std::vector SpectrumStack::get_windows_support() const +const std::vector SpectrumStack::get_windows_support() { std::vector windows; for (size_t i = 0; i < sizeof(windows_support)/sizeof(windows_support[0]); i++) @@ -136,7 +136,7 @@ const std::vector SpectrumStack::get_windows_support() const return windows; } -const std::vector SpectrumStack::get_length_support() const +const std::vector SpectrumStack::get_length_support() { std::vector length; for (size_t i = 0; i < sizeof(length_support)/sizeof(length_support[0]); i++) @@ -146,7 +146,7 @@ const std::vector SpectrumStack::get_length_support() const return length; } -const std::vector SpectrumStack::get_fft_spectrum() const +const std::vector SpectrumStack::get_fft_spectrum() { std::vector empty; if (_spectrum_state == Stopped) @@ -168,11 +168,11 @@ void SpectrumStack::calc_fft() { _spectrum_state = Running; // Get the dso data - boost::shared_ptr data; - boost::shared_ptr dsoSig; + pv::data::Dso *data = NULL; + pv::view::DsoSignal *dsoSig = NULL; for(auto &s : _session->get_signals()) { - if ((dsoSig = dynamic_pointer_cast(s))) { + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_index() == _index && dsoSig->enabled()) { data = dsoSig->dso_data(); break; @@ -184,10 +184,10 @@ void SpectrumStack::calc_fft() return; // Check we have a snapshot of data - const deque< boost::shared_ptr > &snapshots = - data->get_snapshots(); + const auto &snapshots = data->get_snapshots(); if (snapshots.empty()) return; + _snapshot = snapshots.front(); if (_snapshot->get_sample_count() < _sample_num*_sample_interval) diff --git a/DSView/pv/data/spectrumstack.h b/DSView/pv/data/spectrumstack.h index aff91060..146742ed 100755 --- a/DSView/pv/data/spectrumstack.h +++ b/DSView/pv/data/spectrumstack.h @@ -25,8 +25,7 @@ #include -#include -#include +#include #include @@ -67,24 +66,24 @@ public: void clear(); void init(); - int get_index() const; + int get_index(); - uint64_t get_sample_num() const; + uint64_t get_sample_num(); void set_sample_num(uint64_t num); - int get_windows_index() const; + int get_windows_index(); void set_windows_index(int index); - const std::vector get_windows_support() const; - const std::vector get_length_support() const; + const std::vector get_windows_support(); + const std::vector get_length_support(); - bool dc_ignored() const; + bool dc_ignored(); void set_dc_ignore(bool ignore); - int get_sample_interval() const; + int get_sample_interval(); void set_sample_interval(int interval); - const std::vector get_fft_spectrum() const; + const std::vector get_fft_spectrum(); double get_fft_spectrum(uint64_t index); void calc_fft(); @@ -102,7 +101,7 @@ private: bool _dc_ignore; int _sample_interval; - boost::shared_ptr _snapshot; + pv::data::DsoSnapshot *_snapshot; spectrum_state _spectrum_state; fftw_plan _fft_plan; diff --git a/DSView/pv/device/device.cpp b/DSView/pv/device/device.cpp index ab60d5a8..1f6c0bdb 100755 --- a/DSView/pv/device/device.cpp +++ b/DSView/pv/device/device.cpp @@ -42,7 +42,7 @@ Device::~Device() } -sr_dev_inst* Device::dev_inst() const +sr_dev_inst* Device::dev_inst() { return _sdi; } @@ -70,7 +70,7 @@ void Device::release() sr_dev_close(_sdi); } -QString Device::format_device_title() const +QString Device::format_device_title() { ostringstream s; @@ -95,7 +95,7 @@ QString Device::format_device_title() const return QString::fromStdString(s.str()); } -bool Device::is_trigger_enabled() const +bool Device::is_trigger_enabled() { assert(_sdi); for (const GSList *l = _sdi->channels; l; l = l->next) { diff --git a/DSView/pv/device/device.h b/DSView/pv/device/device.h index 77ed9abe..0290f5a2 100755 --- a/DSView/pv/device/device.h +++ b/DSView/pv/device/device.h @@ -34,15 +34,15 @@ public: ~Device(); - sr_dev_inst* dev_inst() const; + sr_dev_inst* dev_inst(); void use(SigSession *owner); void release(); - QString format_device_title() const; + QString format_device_title(); - bool is_trigger_enabled() const; + bool is_trigger_enabled(); private: sr_dev_inst *const _sdi; diff --git a/DSView/pv/device/devinst.cpp b/DSView/pv/device/devinst.cpp index d06858cb..124ab2ef 100755 --- a/DSView/pv/device/devinst.cpp +++ b/DSView/pv/device/devinst.cpp @@ -43,7 +43,7 @@ DevInst::~DevInst() free(_id); } -void* DevInst::get_id() const +void* DevInst::get_id() { assert(_id); @@ -64,7 +64,7 @@ void DevInst::release() } } -SigSession* DevInst::owner() const +SigSession* DevInst::owner() { return _owner; } @@ -188,7 +188,7 @@ QString DevInst::name() return QString::fromLocal8Bit(sdi->driver->name); } -bool DevInst::is_trigger_enabled() const +bool DevInst::is_trigger_enabled() { return false; } @@ -204,7 +204,7 @@ void DevInst::run() sr_session_run(); } -bool DevInst::is_usable() const +bool DevInst::is_usable() { return _usable; } diff --git a/DSView/pv/device/devinst.h b/DSView/pv/device/devinst.h index 8039fddd..5ad51bf0 100755 --- a/DSView/pv/device/devinst.h +++ b/DSView/pv/device/devinst.h @@ -50,7 +50,7 @@ protected: virtual ~DevInst(); public: - SigSession* owner() const; + SigSession* owner(); GVariant* get_config(const sr_channel *ch, const sr_channel_group *group, int key); @@ -108,7 +108,7 @@ public: QString name(); - bool is_usable() const; + bool is_usable(); void destroy(); @@ -117,17 +117,17 @@ public: virtual void run(); - virtual void* get_id() const; + virtual void* get_id(); - virtual sr_dev_inst* dev_inst() const = 0; + virtual sr_dev_inst* dev_inst() = 0; virtual void use(SigSession *owner); virtual void release(); - virtual bool is_trigger_enabled() const; + virtual bool is_trigger_enabled(); - virtual QString format_device_title() const = 0; + virtual QString format_device_title() = 0; signals: void device_updated(); diff --git a/DSView/pv/device/file.cpp b/DSView/pv/device/file.cpp index eb494b04..88dd0cb5 100755 --- a/DSView/pv/device/file.cpp +++ b/DSView/pv/device/file.cpp @@ -43,7 +43,7 @@ File::~File(){ } -QString File::format_device_title() const +QString File::format_device_title() { QFileInfo fi(_path); return fi.fileName(); diff --git a/DSView/pv/device/file.h b/DSView/pv/device/file.h index a4984170..569d2ef9 100755 --- a/DSView/pv/device/file.h +++ b/DSView/pv/device/file.h @@ -49,7 +49,7 @@ public: QJsonDocument get_session(); public: - QString format_device_title() const; + QString format_device_title(); protected: const QString _path; diff --git a/DSView/pv/device/inputfile.cpp b/DSView/pv/device/inputfile.cpp index bd2feef7..33b346bf 100755 --- a/DSView/pv/device/inputfile.cpp +++ b/DSView/pv/device/inputfile.cpp @@ -37,7 +37,7 @@ InputFile::InputFile(QString path) : { } -sr_dev_inst* InputFile::dev_inst() const +sr_dev_inst* InputFile::dev_inst() { assert(_input); return _input->sdi; diff --git a/DSView/pv/device/inputfile.h b/DSView/pv/device/inputfile.h index e1c1e179..c7e6a50d 100755 --- a/DSView/pv/device/inputfile.h +++ b/DSView/pv/device/inputfile.h @@ -37,7 +37,7 @@ class InputFile : public File public: InputFile(QString path); - sr_dev_inst* dev_inst() const; + sr_dev_inst* dev_inst(); virtual void use(SigSession *owner); diff --git a/DSView/pv/device/sessionfile.cpp b/DSView/pv/device/sessionfile.cpp index 7f879565..6d3f53d2 100755 --- a/DSView/pv/device/sessionfile.cpp +++ b/DSView/pv/device/sessionfile.cpp @@ -30,7 +30,7 @@ SessionFile::SessionFile(QString path) : { } -sr_dev_inst* SessionFile::dev_inst() const +sr_dev_inst* SessionFile::dev_inst() { return _sdi; } diff --git a/DSView/pv/device/sessionfile.h b/DSView/pv/device/sessionfile.h index 08783bdd..cf50ddaa 100755 --- a/DSView/pv/device/sessionfile.h +++ b/DSView/pv/device/sessionfile.h @@ -32,7 +32,7 @@ class SessionFile : public File public: SessionFile(QString path); - sr_dev_inst* dev_inst() const; + sr_dev_inst* dev_inst(); virtual void use(SigSession *owner); diff --git a/DSView/pv/dialogs/calibration.cpp b/DSView/pv/dialogs/calibration.cpp index 7bc0771a..76648789 100755 --- a/DSView/pv/dialogs/calibration.cpp +++ b/DSView/pv/dialogs/calibration.cpp @@ -31,7 +31,7 @@ #include "../dialogs/dsmessagebox.h" #include "../dsvdef.h" -using namespace boost; + using namespace std; namespace pv { diff --git a/DSView/pv/dialogs/calibration.h b/DSView/pv/dialogs/calibration.h index 5764ce14..b5c71e27 100755 --- a/DSView/pv/dialogs/calibration.h +++ b/DSView/pv/dialogs/calibration.h @@ -29,8 +29,7 @@ #include #include -#include -#include +#include #include #include "../toolbars/titlebar.h" diff --git a/DSView/pv/dialogs/deviceoptions.cpp b/DSView/pv/dialogs/deviceoptions.cpp index d8a4b392..96436f78 100755 --- a/DSView/pv/dialogs/deviceoptions.cpp +++ b/DSView/pv/dialogs/deviceoptions.cpp @@ -90,8 +90,7 @@ void DeviceOptions::accept() bool hasEnabled = false; // Commit the properties - const vector< boost::shared_ptr > &dev_props = - _device_options_binding.properties(); + const auto &dev_props = _device_options_binding.properties(); for(auto &p : dev_props) { assert(p); p->commit(); @@ -116,8 +115,8 @@ void DeviceOptions::accept() if (hasEnabled) { QVector::iterator i = _probe_options_binding_list.begin(); while(i != _probe_options_binding_list.end()) { - const vector< boost::shared_ptr > &probe_props = - (*i)->properties(); + const auto &probe_props = (*i)->properties(); + for(auto &p :probe_props) { assert(p); p->commit(); @@ -148,8 +147,8 @@ QGridLayout * DeviceOptions::get_property_form(QWidget * parent) QGridLayout *const layout = new QGridLayout(parent); layout->setVerticalSpacing(5); - const vector< boost::shared_ptr > &properties = - _device_options_binding.properties(); + const auto &properties =_device_options_binding.properties(); + int i = 0; for(auto &p : properties) { @@ -522,8 +521,7 @@ void DeviceOptions::analog_probes(QGridLayout &layout) pv::prop::binding::ProbeOptions *probe_options_binding = new pv::prop::binding::ProbeOptions(_dev_inst->dev_inst(), probe); - const vector< boost::shared_ptr > &properties = - probe_options_binding->properties(); + const auto &properties = probe_options_binding->properties(); int i = 1; for(auto &p : properties) diff --git a/DSView/pv/dialogs/deviceoptions.h b/DSView/pv/dialogs/deviceoptions.h index 38ee0798..c09f83aa 100755 --- a/DSView/pv/dialogs/deviceoptions.h +++ b/DSView/pv/dialogs/deviceoptions.h @@ -36,9 +36,7 @@ #include #include #include -#include - -#include +#include #include #include "../device/devinst.h" diff --git a/DSView/pv/dialogs/dsomeasure.cpp b/DSView/pv/dialogs/dsomeasure.cpp index 46ef2896..a25e7307 100755 --- a/DSView/pv/dialogs/dsomeasure.cpp +++ b/DSView/pv/dialogs/dsomeasure.cpp @@ -57,8 +57,8 @@ DsoMeasure::DsoMeasure(SigSession *session, View &parent, _measure_tab->setUsesScrollButtons(false); for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s)) && dsoSig->enabled()) { + view::DsoSignal *dsoSig; + if ((dsoSig = dynamic_cast(s)) && dsoSig->enabled()) { QWidget *measure_widget = new QWidget(this); this->add_measure(measure_widget, dsoSig); _measure_tab->addTab(measure_widget, QString::number(dsoSig->get_index())); @@ -85,13 +85,15 @@ DsoMeasure::~DsoMeasure(){ DESTROY_QT_OBJECT(_measure_tab); } -void DsoMeasure::add_measure(QWidget *widget, const boost::shared_ptr dsoSig) +void DsoMeasure::add_measure(QWidget *widget, const view::DsoSignal *dsoSig) { const int Column = 5; const int IconSizeForText = 5; QGridLayout *layout = new QGridLayout(widget); layout->setMargin(0); layout->setSpacing(0); + + pv::view::DsoSignal *psig = const_cast(dsoSig); for (int i=DSO_MS_BEGIN+1; isetIconSize(QSize(48, 48)); QPixmap msPix(get_ms_icon(i)); QBitmap msMask = msPix.createMaskFromColor(QColor("black"), Qt::MaskOutColor); - msPix.fill(dsoSig->get_colour()); + msPix.fill(psig->get_colour()); msPix.setMask(msMask); button->setIcon(QIcon(msPix)); layout->addWidget(button, @@ -159,8 +161,8 @@ void DsoMeasure::accept() enum DSO_MEASURE_TYPE ms_type = DSO_MEASURE_TYPE(id.toInt()); for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (_measure_tab->currentWidget()->property("index").toInt() == dsoSig->get_index()) { _view.get_viewstatus()->set_measure(_position, false, dsoSig->get_index(), ms_type); break; diff --git a/DSView/pv/dialogs/dsomeasure.h b/DSView/pv/dialogs/dsomeasure.h index 11efed12..ca541ef1 100755 --- a/DSView/pv/dialogs/dsomeasure.h +++ b/DSView/pv/dialogs/dsomeasure.h @@ -27,8 +27,7 @@ #include #include #include - -#include + #include "../view/dsosignal.h" #include "../toolbars/titlebar.h" @@ -57,7 +56,7 @@ public: static QString get_ms_text(int ms_type); private: - void add_measure(QWidget *widget, const boost::shared_ptr dsoSig); + void add_measure(QWidget *widget, const view::DsoSignal *dsoSig); private slots: void set_measure(bool en); diff --git a/DSView/pv/dialogs/fftoptions.cpp b/DSView/pv/dialogs/fftoptions.cpp index fe53c54f..425854c0 100755 --- a/DSView/pv/dialogs/fftoptions.cpp +++ b/DSView/pv/dialogs/fftoptions.cpp @@ -67,8 +67,8 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) : // setup _ch_combobox for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { _ch_combobox->addItem(dsoSig->get_name(), QVariant::fromValue(dsoSig->get_index())); } } @@ -88,8 +88,8 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) : std::vector dbv_ranges; for(auto &t : _session->get_spectrum_traces()) { - boost::shared_ptr spectrumTraces; - if ((spectrumTraces = dynamic_pointer_cast(t))) { + view::SpectrumTrace *spectrumTraces = NULL; + if ((spectrumTraces = dynamic_cast(t))) { windows = spectrumTraces->get_spectrum_stack()->get_windows_support(); length = spectrumTraces->get_spectrum_stack()->get_length_support(); view_modes = spectrumTraces->get_view_modes_support(); @@ -138,8 +138,8 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) : // load current settings for(auto &t : _session->get_spectrum_traces()) { - boost::shared_ptr spectrumTraces; - if ((spectrumTraces = dynamic_pointer_cast(t))) { + view::SpectrumTrace *spectrumTraces = NULL; + if ((spectrumTraces = dynamic_cast(t))) { if (spectrumTraces->enabled()) { _en_checkbox->setChecked(true); for (int i = 0; i < _ch_combobox->count(); i++) { @@ -231,8 +231,8 @@ void FftOptions::accept() QDialog::accept(); for(auto &t : _session->get_spectrum_traces()) { - boost::shared_ptr spectrumTraces; - if ((spectrumTraces = dynamic_pointer_cast(t))) { + view::SpectrumTrace *spectrumTraces = NULL; + if ((spectrumTraces = dynamic_cast(t))) { spectrumTraces->set_enable(false); if (spectrumTraces->get_index() == _ch_combobox->currentData().toInt()) { spectrumTraces->get_spectrum_stack()->set_dc_ignore(_dc_checkbox->isChecked()); diff --git a/DSView/pv/dialogs/fftoptions.h b/DSView/pv/dialogs/fftoptions.h index dcca5e11..b863d6d5 100755 --- a/DSView/pv/dialogs/fftoptions.h +++ b/DSView/pv/dialogs/fftoptions.h @@ -29,8 +29,7 @@ #include #include #include - -#include + #include "../device/devinst.h" #include "../toolbars/titlebar.h" diff --git a/DSView/pv/dialogs/lissajousoptions.cpp b/DSView/pv/dialogs/lissajousoptions.cpp index 589ec4d4..4ab1d3c2 100755 --- a/DSView/pv/dialogs/lissajousoptions.cpp +++ b/DSView/pv/dialogs/lissajousoptions.cpp @@ -74,8 +74,8 @@ LissajousOptions::LissajousOptions(SigSession *session, QWidget *parent) : QHBoxLayout *ylayout = new QHBoxLayout(); for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { QString index_str = QString::number(dsoSig->get_index()); QRadioButton *xradio = new QRadioButton(index_str, _x_group); xradio->setProperty("index", dsoSig->get_index()); @@ -91,7 +91,7 @@ LissajousOptions::LissajousOptions(SigSession *session, QWidget *parent) : _y_group->setLayout(ylayout); - boost::shared_ptr lissajous = _session->get_lissajous_trace(); + auto lissajous = _session->get_lissajous_trace(); if (lissajous) { _enable->setChecked(lissajous->enabled()); _percent->setValue(lissajous->percent()); @@ -182,12 +182,12 @@ void LissajousOptions::accept() _session->lissajous_rebuild(enable, xindex, yindex, _percent->value()); for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->set_show(!enable); } } - boost::shared_ptr mathTrace = _session->get_math_trace(); + auto mathTrace = _session->get_math_trace(); if (mathTrace && mathTrace->enabled()) { mathTrace->set_show(!enable); } diff --git a/DSView/pv/dialogs/lissajousoptions.h b/DSView/pv/dialogs/lissajousoptions.h index 9a7e7168..edb6ce68 100755 --- a/DSView/pv/dialogs/lissajousoptions.h +++ b/DSView/pv/dialogs/lissajousoptions.h @@ -31,8 +31,7 @@ #include #include #include - -#include + #include "../view/dsosignal.h" #include "../toolbars/titlebar.h" diff --git a/DSView/pv/dialogs/mathoptions.cpp b/DSView/pv/dialogs/mathoptions.cpp index d7c9e4bb..21e2d6ab 100755 --- a/DSView/pv/dialogs/mathoptions.cpp +++ b/DSView/pv/dialogs/mathoptions.cpp @@ -79,8 +79,8 @@ MathOptions::MathOptions(SigSession *session, QWidget *parent) : QHBoxLayout *src2_layout = new QHBoxLayout(); for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL;; + if ((dsoSig = dynamic_cast(s))) { QString index_str = QString::number(dsoSig->get_index()); QRadioButton *xradio = new QRadioButton(index_str, _src1_group); xradio->setProperty("index", dsoSig->get_index()); @@ -96,7 +96,7 @@ MathOptions::MathOptions(SigSession *session, QWidget *parent) : _src2_group->setLayout(src2_layout); - boost::shared_ptr math = _session->get_math_trace(); + auto math = _session->get_math_trace(); if (math) { _enable->setChecked(math->enabled()); for (QVector::const_iterator i = _src1_radio.begin(); @@ -204,12 +204,12 @@ void MathOptions::accept() } } bool enable = (src1 != -1 && src2 != -1 && _enable->isChecked()); - boost::shared_ptr dsoSig1; - boost::shared_ptr dsoSig2; + view::DsoSignal *dsoSig1 = NULL; + view::DsoSignal *dsoSig2 = NULL; for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL;; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_index() == src1) dsoSig1 = dsoSig; if (dsoSig->get_index() == src2) diff --git a/DSView/pv/dialogs/mathoptions.h b/DSView/pv/dialogs/mathoptions.h index ae50e7b4..ed6aa2fb 100755 --- a/DSView/pv/dialogs/mathoptions.h +++ b/DSView/pv/dialogs/mathoptions.h @@ -31,8 +31,7 @@ #include #include #include - -#include + #include "../view/dsosignal.h" #include "../toolbars/titlebar.h" diff --git a/DSView/pv/dialogs/protocolexp.cpp b/DSView/pv/dialogs/protocolexp.cpp index f594c6a9..b9445c60 100755 --- a/DSView/pv/dialogs/protocolexp.cpp +++ b/DSView/pv/dialogs/protocolexp.cpp @@ -63,12 +63,13 @@ ProtocolExp::ProtocolExp(QWidget *parent, SigSession *session) : _flayout->addRow(new QLabel(tr("Export Format: "), this), _format_combobox); pv::data::DecoderModel* decoder_model = _session->get_decoder_model(); - const boost::shared_ptr& decoder_stack = decoder_model->getDecoderStack(); + + const auto decoder_stack = decoder_model->getDecoderStack(); if (decoder_stack) { int row_index = 0; - const std::map rows = decoder_stack->get_rows_lshow(); - for (std::map::const_iterator i = rows.begin(); - i != rows.end(); i++) { + auto rows = decoder_stack->get_rows_lshow(); + + for (auto i = rows.begin();i != rows.end(); i++) { if ((*i).second) { QLabel *row_label = new QLabel((*i).first.title(), this); QRadioButton *row_sel = new QRadioButton(this); @@ -169,7 +170,7 @@ void ProtocolExp::accept() .arg(title); pv::data::DecoderModel* decoder_model = _session->get_decoder_model(); - const boost::shared_ptr& decoder_stack = decoder_model->getDecoderStack(); + const auto decoder_stack = decoder_model->getDecoderStack(); int row_index = 0; Row row; const std::map rows_lshow = decoder_stack->get_rows_lshow(); @@ -186,7 +187,7 @@ void ProtocolExp::accept() uint64_t exported = 0; double ns_per_sample = SR_SEC(1) * 1.0 / decoder_stack->samplerate(); - vector annotations; + std::vector annotations; decoder_stack->get_annotation_subset(annotations, row, 0, decoder_stack->sample_count()-1); if (!annotations.empty()) { diff --git a/DSView/pv/dialogs/protocolexp.h b/DSView/pv/dialogs/protocolexp.h index e888eedf..8688fd96 100755 --- a/DSView/pv/dialogs/protocolexp.h +++ b/DSView/pv/dialogs/protocolexp.h @@ -29,9 +29,7 @@ #include #include #include - -#include - + #include "../device/devinst.h" #include "../prop/binding/deviceoptions.h" #include "../toolbars/titlebar.h" diff --git a/DSView/pv/dialogs/protocollist.cpp b/DSView/pv/dialogs/protocollist.cpp index 53b46b30..9f474fa8 100755 --- a/DSView/pv/dialogs/protocollist.cpp +++ b/DSView/pv/dialogs/protocollist.cpp @@ -56,8 +56,7 @@ ProtocolList::ProtocolList(QWidget *parent, SigSession *session) : connect(_map_zoom_combobox, SIGNAL(currentIndexChanged(int)), _session, SLOT(set_map_zoom(int))); _protocol_combobox = new QComboBox(this); - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + auto &decode_sigs = _session->get_decode_signals(); int index = 0; for(auto &d : decode_sigs) { @@ -126,9 +125,8 @@ void ProtocolList::set_protocol(int index) } _show_label_list.clear(); - boost::shared_ptr decoder_stack; - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + pv::data::DecoderStack *decoder_stack = NULL; + const auto &decode_sigs = _session->get_decode_signals(); int cur_index = 0; for(auto &d : decode_sigs) { @@ -146,9 +144,9 @@ void ProtocolList::set_protocol(int index) _session->get_decoder_model()->setDecoderStack(decoder_stack); int row_index = 0; - const std::map rows = decoder_stack->get_rows_lshow(); - for (std::map::const_iterator i = rows.begin(); - i != rows.end(); i++) { + const auto rows = decoder_stack->get_rows_lshow(); + + for (auto i = rows.begin();i != rows.end(); i++) { QLabel *row_label = new QLabel((*i).first.title(), this); QCheckBox *row_checkbox = new QCheckBox(this); //row_checkbox->setChecked(false); @@ -169,9 +167,8 @@ void ProtocolList::on_row_check(bool show) QVariant id = sc->property("index"); int index = id.toInt(); - boost::shared_ptr decoder_stack; - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + pv::data::DecoderStack *decoder_stack = NULL; + const auto &decode_sigs = _session->get_decode_signals(); int cur_index = 0; for(auto &d : decode_sigs) { diff --git a/DSView/pv/dialogs/protocollist.h b/DSView/pv/dialogs/protocollist.h index 1d4c68f2..0d4024d9 100755 --- a/DSView/pv/dialogs/protocollist.h +++ b/DSView/pv/dialogs/protocollist.h @@ -29,8 +29,7 @@ #include #include #include - -#include + #include "../device/devinst.h" #include "../prop/binding/deviceoptions.h" diff --git a/DSView/pv/dialogs/regionoptions.h b/DSView/pv/dialogs/regionoptions.h index a0ec9554..b3e06b78 100755 --- a/DSView/pv/dialogs/regionoptions.h +++ b/DSView/pv/dialogs/regionoptions.h @@ -28,9 +28,7 @@ #include #include #include - -#include - + #include "../toolbars/titlebar.h" #include "dsdialog.h" diff --git a/DSView/pv/dialogs/search.cpp b/DSView/pv/dialogs/search.cpp index 26744536..7f562068 100755 --- a/DSView/pv/dialogs/search.cpp +++ b/DSView/pv/dialogs/search.cpp @@ -52,8 +52,8 @@ Search::Search(QWidget *parent, SigSession *session, std::map for(auto &sig : _session->get_signals()) { assert(sig); - boost::shared_ptr logic_sig; - if ((logic_sig = boost::dynamic_pointer_cast(sig))) { + view::LogicSignal *logic_sig = NULL; + if ((logic_sig = dynamic_cast(sig))) { QLineEdit *search_lineEdit = new QLineEdit(this); if (pattern.find(logic_sig->get_index()) != pattern.end()) search_lineEdit->setText(pattern[logic_sig->get_index()]); @@ -112,8 +112,8 @@ std::map Search::get_pattern() int index = 0; for(auto &sig :_session->get_signals()) { assert(sig); - boost::shared_ptr logic_sig; - if ((logic_sig = boost::dynamic_pointer_cast(sig))) { + view::LogicSignal *logic_sig = NULL; + if ((logic_sig = dynamic_cast(sig))) { pattern[logic_sig->get_index()] = _search_lineEdit_vec[index]->text(); index++; } diff --git a/DSView/pv/dialogs/search.h b/DSView/pv/dialogs/search.h index 29c3d5a4..013c4723 100755 --- a/DSView/pv/dialogs/search.h +++ b/DSView/pv/dialogs/search.h @@ -33,9 +33,7 @@ #include "../toolbars/titlebar.h" #include "dsdialog.h" #include "../device/devinst.h" - -#include - + namespace pv { namespace dialogs { diff --git a/DSView/pv/dialogs/shadow.cpp b/DSView/pv/dialogs/shadow.cpp index 0fc91ee4..c6fd3426 100755 --- a/DSView/pv/dialogs/shadow.cpp +++ b/DSView/pv/dialogs/shadow.cpp @@ -94,7 +94,7 @@ void Shadow::draw(QPainter* painter) painter->setWorldTransform(restoreTransform); } -QRectF Shadow::boundingRectFor(const QRectF& rect) const +QRectF Shadow::boundingRectFor(const QRectF& rect) { qreal delta = blurRadius() + distance(); return rect.united(rect.adjusted(-delta, -delta, delta, delta)); diff --git a/DSView/pv/dialogs/shadow.h b/DSView/pv/dialogs/shadow.h index e37bbbad..952aad24 100755 --- a/DSView/pv/dialogs/shadow.h +++ b/DSView/pv/dialogs/shadow.h @@ -36,16 +36,16 @@ public: explicit Shadow(QObject *parent = 0); void draw(QPainter* painter); - QRectF boundingRectFor(const QRectF& rect) const; + QRectF boundingRectFor(const QRectF& rect); inline void setDistance(qreal distance) { _distance = distance; updateBoundingRect(); } - inline qreal distance() const { return _distance; } + inline qreal distance() { return _distance; } inline void setBlurRadius(qreal blurRadius) { _blurRadius = blurRadius; updateBoundingRect(); } - inline qreal blurRadius() const { return _blurRadius; } + inline qreal blurRadius() { return _blurRadius; } inline void setColor(const QColor& color) { _color = color; } - inline QColor color() const { return _color; } + inline QColor color() { return _color; } private: qreal _distance; diff --git a/DSView/pv/dialogs/storeprogress.h b/DSView/pv/dialogs/storeprogress.h index a7077142..f0475b5d 100755 --- a/DSView/pv/dialogs/storeprogress.h +++ b/DSView/pv/dialogs/storeprogress.h @@ -21,10 +21,7 @@ #ifndef DSVIEW_PV_DIALOGS_SAVEPROGRESS_H #define DSVIEW_PV_DIALOGS_SAVEPROGRESS_H - -//#include - -#include + #include #include "../storesession.h" #include "../dialogs/dsdialog.h" diff --git a/DSView/pv/dialogs/waitingdialog.cpp b/DSView/pv/dialogs/waitingdialog.cpp index b206912b..1817c34b 100755 --- a/DSView/pv/dialogs/waitingdialog.cpp +++ b/DSView/pv/dialogs/waitingdialog.cpp @@ -184,11 +184,11 @@ void WaitingDialog::changeText() zero_fgain = g_variant_get_boolean(gvar); g_variant_unref(gvar); if (zero_fgain) { - boost::shared_ptr dsoSig; + view::DsoSignal *dsoSig = NULL; for(auto &s : _session->get_signals()) { - if ((dsoSig = dynamic_pointer_cast(s))) + if ((dsoSig = dynamic_cast(s))) dsoSig->set_enable(dsoSig->get_index() == 0); } std::this_thread::sleep_for(std::chrono::milliseconds(100)); diff --git a/DSView/pv/dialogs/waitingdialog.h b/DSView/pv/dialogs/waitingdialog.h index e8fb2474..dd1071d0 100755 --- a/DSView/pv/dialogs/waitingdialog.h +++ b/DSView/pv/dialogs/waitingdialog.h @@ -27,9 +27,7 @@ #include #include #include - -#include - + #include "../sigsession.h" #include "../device/devinst.h" #include "../toolbars/titlebar.h" diff --git a/DSView/pv/dock/dsotriggerdock.cpp b/DSView/pv/dock/dsotriggerdock.cpp index c859f824..29698f19 100755 --- a/DSView/pv/dock/dsotriggerdock.cpp +++ b/DSView/pv/dock/dsotriggerdock.cpp @@ -24,8 +24,6 @@ #include "../device/devinst.h" #include "../dialogs/dsmessagebox.h" #include "../view/dsosignal.h" - -#include #include @@ -389,8 +387,8 @@ void DsoTriggerDock::init() _channel_comboBox->clear(); for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { _channel_comboBox->addItem(dsoSig->get_name(), QVariant::fromValue(dsoSig->get_index())); } } diff --git a/DSView/pv/dock/measuredock.cpp b/DSView/pv/dock/measuredock.cpp index 77166789..5b6c77dd 100755 --- a/DSView/pv/dock/measuredock.cpp +++ b/DSView/pv/dock/measuredock.cpp @@ -598,12 +598,15 @@ void MeasureDock::update_edge() if (start_ret && end_ret) { uint64_t rising_edges; uint64_t falling_edges; - const std::vector< boost::shared_ptr > sigs(_session->get_signals()); + + const auto &sigs = _session->get_signals(); + for(size_t i = 0; i < sigs.size(); i++) { - const boost::shared_ptr s(sigs[i]); - boost::shared_ptr logicSig; + view::Signal *s = sigs[i]; + view::LogicSignal *logicSig = NULL; assert(s); - if ((logicSig = dynamic_pointer_cast(s)) && + + if ((logicSig = dynamic_cast(s)) && (logicSig->enabled()) && (logicSig->get_index() == _edge_ch_cmb_vec[edge_index]->currentText().toInt())){ if (logicSig->edges(_view.get_cursor_samples(end), _view.get_cursor_samples(start), rising_edges, falling_edges)) { @@ -650,12 +653,13 @@ QComboBox* MeasureDock::create_probe_selector(QWidget *parent) void MeasureDock::update_probe_selector(QComboBox *selector) { selector->clear(); - const std::vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); + for(size_t i = 0; i < sigs.size(); i++) { - const boost::shared_ptr s(sigs[i]); + const auto s = sigs[i]; assert(s); - if (dynamic_pointer_cast(s) && s->enabled()) + if (dynamic_cast(s) && s->enabled()) { selector->addItem(QString::number(s->get_index())); } diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index a35374ab..85150806 100755 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -46,13 +46,14 @@ #include -#include #include #include "../ui/msgbox.h" #include "../dsvdef.h" #include "../config/appconfig.h" #include "../data/decode/decoderstatus.h" +using namespace std; + namespace pv { namespace dock { @@ -205,6 +206,8 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio connect(_search_edit, SIGNAL(editingFinished()), this, SLOT(search_changed())); retranslateUi(); + + ds_debug("protocol panel\n"); } ProtocolDock::~ProtocolDock() @@ -333,9 +336,9 @@ void ProtocolDock::add_protocol(bool silent) } //progress connection - const std::vector> decode_sigs(_session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); - connect(decode_sigs.back().get(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progress(int))); + connect(decode_sigs.back(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progress(int))); protocol_updated(); } @@ -373,8 +376,7 @@ void ProtocolDock::decoded_progress(int progress) int pg = 0; QString err=""; - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); int index = 0; for(auto &d : decode_sigs) { @@ -414,8 +416,7 @@ void ProtocolDock::set_model() search_done(); // clear mark_index of all DecoderStacks - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); for(auto &d : decode_sigs) { d->decoder()->set_mark_index(-1); @@ -425,8 +426,8 @@ void ProtocolDock::set_model() void ProtocolDock::update_model() { pv::data::DecoderModel *decoder_model = _session->get_decoder_model(); - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); + if (decode_sigs.size() == 0) decoder_model->setDecoderStack(NULL); else if (!decoder_model->getDecoderStack()) @@ -468,12 +469,12 @@ void ProtocolDock::resize_table_view(data::DecoderModel* decoder_model) void ProtocolDock::item_clicked(const QModelIndex &index) { pv::data::DecoderModel *decoder_model = _session->get_decoder_model(); - boost::shared_ptr decoder_stack = decoder_model->getDecoderStack(); + + auto decoder_stack = decoder_model->getDecoderStack(); if (decoder_stack) { pv::data::decode::Annotation ann; if (decoder_stack->list_annotation(ann, index.column(), index.row())) { - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); for(auto &d : decode_sigs) { d->decoder()->set_mark_index(-1); @@ -548,7 +549,8 @@ void ProtocolDock::nav_table_view() { uint64_t row_index = 0; pv::data::DecoderModel *decoder_model = _session->get_decoder_model(); - boost::shared_ptr decoder_stack = decoder_model->getDecoderStack(); + + auto decoder_stack = decoder_model->getDecoderStack(); if (decoder_stack) { uint64_t offset = _view.offset() * (decoder_stack->samplerate() * _view.scale()); std::map rows = decoder_stack->get_rows_lshow(); @@ -567,8 +569,7 @@ void ProtocolDock::nav_table_view() pv::data::decode::Annotation ann; decoder_stack->list_annotation(ann, index.column(), index.row()); - const std::vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); for(auto &d : decode_sigs) { d->decoder()->set_mark_index(-1); @@ -596,7 +597,8 @@ void ProtocolDock::search_pre() uint64_t rowCount = _model_proxy.rowCount(); QModelIndex matchingIndex; pv::data::DecoderModel *decoder_model = _session->get_decoder_model(); - boost::shared_ptr decoder_stack = decoder_model->getDecoderStack(); + + auto decoder_stack = decoder_model->getDecoderStack(); do { _cur_search_index--; if (_cur_search_index <= -1 || _cur_search_index >= _model_proxy.rowCount()) @@ -652,7 +654,8 @@ void ProtocolDock::search_nxt() uint64_t rowCount = _model_proxy.rowCount(); QModelIndex matchingIndex; pv::data::DecoderModel *decoder_model = _session->get_decoder_model(); - boost::shared_ptr decoder_stack = decoder_model->getDecoderStack(); + + auto decoder_stack = decoder_model->getDecoderStack(); do { _cur_search_index++; if (_cur_search_index < 0 || _cur_search_index >= _model_proxy.rowCount()) @@ -716,7 +719,8 @@ void ProtocolDock::search_update() return; pv::data::DecoderModel *decoder_model = _session->get_decoder_model(); - boost::shared_ptr decoder_stack = decoder_model->getDecoderStack(); + + auto decoder_stack = decoder_model->getDecoderStack(); if (!decoder_stack) return; diff --git a/DSView/pv/dock/searchdock.cpp b/DSView/pv/dock/searchdock.cpp index 87b2cee3..33c56f66 100755 --- a/DSView/pv/dock/searchdock.cpp +++ b/DSView/pv/dock/searchdock.cpp @@ -40,8 +40,7 @@ #include #include -#include -#include +#include #include "../config/appconfig.h" namespace pv { @@ -130,9 +129,9 @@ void SearchDock::on_previous() bool ret; int64_t last_pos; bool last_hit; - const boost::shared_ptr snapshot(_session->get_snapshot(SR_CHANNEL_LOGIC)); + const auto snapshot = _session->get_snapshot(SR_CHANNEL_LOGIC); assert(snapshot); - const boost::shared_ptr logic_snapshot = boost::dynamic_pointer_cast(snapshot); + const auto logic_snapshot = dynamic_cast(snapshot); if (!logic_snapshot || logic_snapshot->empty()) { dialogs::DSMessageBox msg(this); @@ -192,9 +191,9 @@ void SearchDock::on_next() { bool ret; int64_t last_pos; - const boost::shared_ptr snapshot(_session->get_snapshot(SR_CHANNEL_LOGIC)); + const auto snapshot = _session->get_snapshot(SR_CHANNEL_LOGIC); assert(snapshot); - const boost::shared_ptr logic_snapshot = boost::dynamic_pointer_cast(snapshot); + const auto logic_snapshot = dynamic_cast(snapshot); if (!logic_snapshot || logic_snapshot->empty()) { dialogs::DSMessageBox msg(this); diff --git a/DSView/pv/dsvdef.cpp b/DSView/pv/dsvdef.cpp index e5203dbe..49d0e5df 100644 --- a/DSView/pv/dsvdef.cpp +++ b/DSView/pv/dsvdef.cpp @@ -23,6 +23,13 @@ #include "dsvdef.h" #include +#ifdef DS_DEBUG_TRACE +#include + void ds_print(const char *s){ + printf(s); + } +#endif + namespace DecoderDataFormat { int Parse(const char *name){ diff --git a/DSView/pv/dsvdef.h b/DSView/pv/dsvdef.h index c35a7de0..cc5283c8 100644 --- a/DSView/pv/dsvdef.h +++ b/DSView/pv/dsvdef.h @@ -22,6 +22,17 @@ #pragma once +#include "../config.h" + + +#ifdef DS_DEBUG_TRACE + void ds_print(const char *s); + + #define ds_debug(x) ds_print((x)) +#else + #define ds_debug(x) +#endif + class QWidget; #define DESTROY_OBJECT(p) if((p)){delete (p); p = NULL;} @@ -48,3 +59,4 @@ namespace app bool is_app_top_window(QWidget* w); } + diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index dd0372af..fe69e51d 100755 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -26,8 +26,7 @@ #include "dock/protocoldock.h" -#include -#include +#include #include #include @@ -92,11 +91,7 @@ #include "../ui/msgbox.h" #include "config/appconfig.h" #include "appcontrol.h" - -using boost::shared_ptr; -using boost::dynamic_pointer_cast; -using std::list; -using std::vector; + namespace pv { @@ -549,9 +544,9 @@ void MainWindow::device_detach() _view->hide_calibration(); if (_session->get_device()->dev_inst()->mode != DSO && strncmp(_session->get_device()->name().toUtf8(), "virtual", 7)) { - const boost::shared_ptr logic_snapshot(_session->get_snapshot(SR_CHANNEL_LOGIC)); + const auto logic_snapshot = _session->get_snapshot(SR_CHANNEL_LOGIC); assert(logic_snapshot); - const boost::shared_ptr analog_snapshot(_session->get_snapshot(SR_CHANNEL_ANALOG)); + const auto analog_snapshot = _session->get_snapshot(SR_CHANNEL_ANALOG); assert(analog_snapshot); if (!logic_snapshot->empty() || !analog_snapshot->empty()) { @@ -830,8 +825,8 @@ void MainWindow::commit_trigger(bool instant) for(auto &s : _session->get_signals()) { assert(s); - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(s))) { if (logicSig->commit_trig()) i++; } @@ -848,17 +843,19 @@ void MainWindow::commit_trigger(bool instant) msg.mBox()->addButton(tr("Continue"), QMessageBox::ActionRole); msg.exec(); + if (msg.mBox()->clickedButton() == cancelButton) { for(auto &s : _session->get_signals()) { assert(s); - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(s))) { logicSig->set_trig(view::LogicSignal::NONTRIG); logicSig->commit_trig(); } } } + if (msg.mBox()->clickedButton() == noMoreButton) { app._appOptions.warnofMultiTrig = false; @@ -1068,8 +1065,8 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev) (s->get_type() == obj["type"].toDouble())) { s->set_colour(QColor(obj["colour"].toString())); - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->load_settings(); dsoSig->set_zero_ratio(obj["zeroPos"].toDouble()); dsoSig->set_trig_ratio(obj["trigValue"].toDouble()); @@ -1088,21 +1085,21 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev) s->set_colour(QColor(obj["colour"].toString())); s->set_name(g_strdup(obj["name"].toString().toUtf8().data())); - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(s))) { logicSig->set_trig(obj["strigger"].toDouble()); } - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->load_settings(); dsoSig->set_zero_ratio(obj["zeroPos"].toDouble()); dsoSig->set_trig_ratio(obj["trigValue"].toDouble()); dsoSig->commit_settings(); } - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(s))) { + view::AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(s))) { analogSig->set_zero_ratio(obj["zeroPos"].toDouble()); analogSig->commit_settings(); } @@ -1200,13 +1197,13 @@ bool MainWindow::on_store_session(QString name) else s_obj["colour"] = QJsonValue::fromVariant("default"); - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(s))) { s_obj["strigger"] = logicSig->get_trig(); } - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { s_obj["vdiv"] = QJsonValue::fromVariant(static_cast(dsoSig->get_vDialValue())); s_obj["vfactor"] = QJsonValue::fromVariant(static_cast(dsoSig->get_factor())); s_obj["coupling"] = dsoSig->get_acCoupling(); @@ -1214,8 +1211,8 @@ bool MainWindow::on_store_session(QString name) s_obj["zeroPos"] = dsoSig->get_zero_ratio(); } - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(s))) { + view::AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(s))) { s_obj["vdiv"] = QJsonValue::fromVariant(static_cast(analogSig->get_vdiv())); s_obj["vfactor"] = QJsonValue::fromVariant(static_cast(analogSig->get_factor())); s_obj["coupling"] = analogSig->get_acCoupling(); @@ -1289,7 +1286,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) if ( event->type() == QEvent::KeyPress ) { SigSession *_session = _control->GetSession(); - const vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); QKeyEvent *ke = (QKeyEvent *) event; switch(ke->key()) { case Qt::Key_S: @@ -1335,8 +1332,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) break; case Qt::Key_0: for(auto & s : sigs) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_index() == 0) dsoSig->set_vDialActive(!dsoSig->get_vDialActive()); else @@ -1348,8 +1345,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) break; case Qt::Key_1: for(auto & s : sigs) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_index() == 1) dsoSig->set_vDialActive(!dsoSig->get_vDialActive()); else @@ -1361,8 +1358,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) break; case Qt::Key_Up: for(auto &s : sigs) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_vDialActive()) { dsoSig->go_vDialNext(true); update(); @@ -1373,8 +1370,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) break; case Qt::Key_Down: for(auto &s : sigs) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_vDialActive()) { dsoSig->go_vDialPre(true); update(); diff --git a/DSView/pv/minizip/mztools.c b/DSView/pv/minizip/mztools.c index 96891c2e..6047d70c 100644 --- a/DSView/pv/minizip/mztools.c +++ b/DSView/pv/minizip/mztools.c @@ -12,8 +12,8 @@ #include "unzip.h" #define READ_8(adr) ((unsigned char)*(adr)) -#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) -#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) +#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) +#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) #define WRITE_8(buff, n) do { \ *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ diff --git a/DSView/pv/prop/binding/binding.cpp b/DSView/pv/prop/binding/binding.cpp index 78e231ba..345cae1e 100755 --- a/DSView/pv/prop/binding/binding.cpp +++ b/DSView/pv/prop/binding/binding.cpp @@ -26,14 +26,13 @@ #include #include "binding.h" - -using boost::shared_ptr; + namespace pv { namespace prop { namespace binding { -const std::vector< boost::shared_ptr >& Binding::properties() +const std::vector& Binding::properties() { return _properties; } @@ -47,7 +46,7 @@ void Binding::commit() } void Binding::add_properties_to_form(QFormLayout *layout, - bool auto_commit) const + bool auto_commit) { assert(layout); @@ -71,7 +70,7 @@ void Binding::add_properties_to_form(QFormLayout *layout, } QWidget* Binding::get_property_form(QWidget *parent, - bool auto_commit) const + bool auto_commit) { QWidget *const form = new QWidget(parent); QFormLayout *const layout = new QFormLayout(form); @@ -84,11 +83,9 @@ QWidget* Binding::get_property_form(QWidget *parent, return form; } -std::map< boost::shared_ptr, - GVariant* > Binding::get_property_value() const +std::map Binding::get_property_value() { - std::map < boost::shared_ptr, - GVariant* > pvalue; + std::map pvalue; for(auto &p : _properties) { diff --git a/DSView/pv/prop/binding/binding.h b/DSView/pv/prop/binding/binding.h index 8b413e05..68bae0d7 100755 --- a/DSView/pv/prop/binding/binding.h +++ b/DSView/pv/prop/binding/binding.h @@ -27,8 +27,7 @@ #include #include -#include -#include +#include #include @@ -45,23 +44,22 @@ namespace binding { class Binding { public: - const std::vector< boost::shared_ptr >& properties(); + const std::vector& properties(); void commit(); void add_properties_to_form(QFormLayout *layout, - bool auto_commit = false) const; + bool auto_commit = false); QWidget* get_property_form(QWidget *parent, - bool auto_commit = false) const; + bool auto_commit = false); - std::map< boost::shared_ptr, - GVariant* > get_property_value() const; + std::map get_property_value(); static QString print_gvariant(GVariant *const gvar); protected: - std::vector< boost::shared_ptr > _properties; + std::vector _properties; QWidget *_form; }; diff --git a/DSView/pv/prop/binding/decoderoptions.cpp b/DSView/pv/prop/binding/decoderoptions.cpp index df017534..cdaca0df 100755 --- a/DSView/pv/prop/binding/decoderoptions.cpp +++ b/DSView/pv/prop/binding/decoderoptions.cpp @@ -33,22 +33,16 @@ #include #include -using boost::bind; -using boost::none; -using boost::shared_ptr; -using std::make_pair; -using std::map; -using std::pair; -using std::string; -using std::vector; - +using namespace boost; +using namespace std; + namespace pv { namespace prop { namespace binding { DecoderOptions::DecoderOptions( - shared_ptr decoder_stack, - shared_ptr decoder) : + pv::data::DecoderStack* decoder_stack, + data::decode::Decoder *decoder) : _decoder_stack(decoder_stack), _decoder(decoder) { @@ -69,19 +63,16 @@ DecoderOptions::DecoderOptions( const Property::Setter setter = bind( &DecoderOptions::setter, this, opt->id, _1); - shared_ptr prop; + Property *prop = NULL; if (opt->values) prop = bind_enum(name, opt, getter, setter); else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("d"))) - prop = shared_ptr(new Double(name, name, 2, "", - none, none, getter, setter)); + prop = new Double(name, name, 2, "",none, none, getter, setter); else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("x"))) - prop = shared_ptr( - new Int(name, name, "", none, getter, setter)); + prop = new Int(name, name, "", none, getter, setter); else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("s"))) - prop = shared_ptr( - new String(name, name, getter, setter)); + prop = new String(name, name, getter, setter); else continue; @@ -89,18 +80,18 @@ DecoderOptions::DecoderOptions( } } -shared_ptr DecoderOptions::bind_enum( +Property* DecoderOptions::bind_enum( const QString &name, const srd_decoder_option *option, Property::Getter getter, Property::Setter setter) { - vector< pair > values; + std::vector > values; for (GSList *l = option->values; l; l = l->next) { GVariant *const var = (GVariant*)l->data; assert(var); values.push_back(make_pair(var, print_gvariant(var))); } - return shared_ptr(new Enum(name, name, values, getter, setter)); + return new Enum(name, name, values, getter, setter); } GVariant* DecoderOptions::getter(const char *id) @@ -111,7 +102,7 @@ GVariant* DecoderOptions::getter(const char *id) // Get the value from the hash table if it is already present const map& options = _decoder->options(); - map::const_iterator iter = options.find(id); + auto iter = options.find(id); if (iter != options.end()) val = (*iter).second; diff --git a/DSView/pv/prop/binding/decoderoptions.h b/DSView/pv/prop/binding/decoderoptions.h index 62d91ec3..258c3a62 100755 --- a/DSView/pv/prop/binding/decoderoptions.h +++ b/DSView/pv/prop/binding/decoderoptions.h @@ -23,7 +23,7 @@ #include "binding.h" -#include +#include "../property.h" struct srd_decoder_option; @@ -42,23 +42,23 @@ namespace binding { class DecoderOptions : public Binding { public: - DecoderOptions(boost::shared_ptr decoder_stack, - boost::shared_ptr decoder); + DecoderOptions(pv::data::DecoderStack *decoder_stack, + pv::data::decode::Decoder* decoder); GVariant* getter(const char *id); void setter(const char *id, GVariant *value); private: - static boost::shared_ptr bind_enum(const QString &name, + static Property* bind_enum(const QString &name, const srd_decoder_option *option, Property::Getter getter, Property::Setter setter); private: - boost::shared_ptr _decoder_stack; - boost::shared_ptr _decoder; + pv::data::DecoderStack *_decoder_stack; + pv::data::decode::Decoder *_decoder; }; } // binding diff --git a/DSView/pv/prop/binding/deviceoptions.cpp b/DSView/pv/prop/binding/deviceoptions.cpp index deef3fac..1b4f1b15 100755 --- a/DSView/pv/prop/binding/deviceoptions.cpp +++ b/DSView/pv/prop/binding/deviceoptions.cpp @@ -166,9 +166,9 @@ void DeviceOptions::config_setter( void DeviceOptions::bind_bool(const QString &name, const QString label, int key) { - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Bool(name, label, bind(config_getter, _sdi, key), - bind(config_setter, _sdi, key, _1)))); + bind(config_setter, _sdi, key, _1))); } void DeviceOptions::bind_enum(const QString &name, const QString label, int key, @@ -176,7 +176,7 @@ void DeviceOptions::bind_enum(const QString &name, const QString label, int key, { GVariant *gvar; GVariantIter iter; - vector< pair > values; + std::vector< pair > values; assert(gvar_list); @@ -184,29 +184,29 @@ void DeviceOptions::bind_enum(const QString &name, const QString label, int key, while ((gvar = g_variant_iter_next_value (&iter))) values.push_back(make_pair(gvar, printer(gvar))); - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Enum(name, label, values, bind(config_getter, _sdi, key), - bind(config_setter, _sdi, key, _1)))); + bind(config_setter, _sdi, key, _1))); } void DeviceOptions::bind_int(const QString &name, const QString label, int key, QString suffix, optional< std::pair > range) { - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Int(name, label, suffix, range, bind(config_getter, _sdi, key), - bind(config_setter, _sdi, key, _1)))); + bind(config_setter, _sdi, key, _1))); } void DeviceOptions::bind_double(const QString &name, const QString label, int key, QString suffix, optional< std::pair > range, int decimals, boost::optional step) { - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Double(name, label, decimals, suffix, range, step, bind(config_getter, _sdi, key), - bind(config_setter, _sdi, key, _1)))); + bind(config_setter, _sdi, key, _1))); } QString DeviceOptions::print_gvariant(GVariant *const gvar) @@ -242,12 +242,12 @@ void DeviceOptions::bind_samplerate(const QString &name, const QString label, assert(num_elements == 3); - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Double(name, label, 0, QObject::tr("Hz"), make_pair((double)elements[0], (double)elements[1]), (double)elements[2], bind(samplerate_double_getter, _sdi), - bind(samplerate_double_setter, _sdi, _1)))); + bind(samplerate_double_setter, _sdi, _1))); g_variant_unref(gvar_list_samplerates); } @@ -312,7 +312,7 @@ void DeviceOptions::bind_bandwidths(const QString &name, const QString label, in { GVariant *gvar; GVariantIter iter; - vector< pair > values; + std::vector< pair > values; bool bw_limit = FALSE; assert(gvar_list); @@ -332,10 +332,10 @@ void DeviceOptions::bind_bandwidths(const QString &name, const QString label, in while ((gvar = g_variant_iter_next_value (&iter))) values.push_back(make_pair(gvar, printer(gvar))); - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Enum(name, label, values, bind(config_getter, _sdi, key), - bind(config_setter, _sdi, key, _1)))); + bind(config_setter, _sdi, key, _1))); } } // binding diff --git a/DSView/pv/prop/binding/probeoptions.cpp b/DSView/pv/prop/binding/probeoptions.cpp index 3b6a101f..be3806c9 100755 --- a/DSView/pv/prop/binding/probeoptions.cpp +++ b/DSView/pv/prop/binding/probeoptions.cpp @@ -138,9 +138,9 @@ void ProbeOptions::config_setter( void ProbeOptions::bind_bool(const QString &name, const QString label, int key) { - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Bool(name, label, bind(config_getter, _sdi, _probe, key), - bind(config_setter, _sdi, _probe, key, _1)))); + bind(config_setter, _sdi, _probe, key, _1))); } void ProbeOptions::bind_enum(const QString &name, const QString label, int key, @@ -148,7 +148,7 @@ void ProbeOptions::bind_enum(const QString &name, const QString label, int key, { GVariant *gvar; GVariantIter iter; - vector< pair > values; + std::vector< pair > values; assert(gvar_list); @@ -156,29 +156,29 @@ void ProbeOptions::bind_enum(const QString &name, const QString label, int key, while ((gvar = g_variant_iter_next_value (&iter))) values.push_back(make_pair(gvar, printer(gvar))); - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Enum(name, label, values, bind(config_getter, _sdi, _probe, key), - bind(config_setter, _sdi, _probe, key, _1)))); + bind(config_setter, _sdi, _probe, key, _1))); } void ProbeOptions::bind_int(const QString &name, const QString label, int key, QString suffix, optional< std::pair > range) { - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Int(name, label, suffix, range, bind(config_getter, _sdi, _probe, key), - bind(config_setter, _sdi, _probe, key, _1)))); + bind(config_setter, _sdi, _probe, key, _1))); } void ProbeOptions::bind_double(const QString &name, const QString label, int key, QString suffix, optional< std::pair > range, int decimals, boost::optional step) { - _properties.push_back(boost::shared_ptr( + _properties.push_back( new Double(name, label, decimals, suffix, range, step, bind(config_getter, _sdi, _probe, key), - bind(config_setter, _sdi, _probe, key, _1)))); + bind(config_setter, _sdi, _probe, key, _1))); } void ProbeOptions::bind_vdiv(const QString &name, const QString label, diff --git a/DSView/pv/prop/bool.cpp b/DSView/pv/prop/bool.cpp index 75169b86..b31369c2 100755 --- a/DSView/pv/prop/bool.cpp +++ b/DSView/pv/prop/bool.cpp @@ -65,12 +65,12 @@ QWidget* Bool::get_widget(QWidget *parent, bool auto_commit) return _check_box; } -bool Bool::labeled_widget() const +bool Bool::labeled_widget() { return true; } -GVariant* Bool::get_value() const +GVariant* Bool::get_value() { GVariant *const value = _getter ? _getter() : NULL; diff --git a/DSView/pv/prop/bool.h b/DSView/pv/prop/bool.h index c9f9e409..5603914c 100755 --- a/DSView/pv/prop/bool.h +++ b/DSView/pv/prop/bool.h @@ -40,9 +40,9 @@ public: virtual ~Bool(); QWidget* get_widget(QWidget *parent, bool auto_commit); - bool labeled_widget() const; + bool labeled_widget(); - GVariant* get_value() const; + GVariant* get_value(); void commit(); diff --git a/DSView/pv/prop/enum.cpp b/DSView/pv/prop/enum.cpp index 9f5aadca..d5bd8665 100755 --- a/DSView/pv/prop/enum.cpp +++ b/DSView/pv/prop/enum.cpp @@ -34,13 +34,13 @@ namespace pv { namespace prop { Enum::Enum(QString name, QString label, - vector > values, + std::vector > values, Getter getter, Setter setter) : Property(name, label, getter, setter), _values(values), _selector(NULL) { - for (vector< pair >::const_iterator i = + for (std::vector< pair >::const_iterator i = _values.begin(); i != _values.end(); i++) g_variant_ref((*i).first); } diff --git a/DSView/pv/prop/property.cpp b/DSView/pv/prop/property.cpp index de7150b5..7933398f 100755 --- a/DSView/pv/prop/property.cpp +++ b/DSView/pv/prop/property.cpp @@ -33,22 +33,26 @@ Property::Property(QString name, QString label, Getter getter, Setter setter) : { } -const QString& Property::name() const +Property::~Property(){ + +} + +const QString& Property::name() { return _name; } -const QString& Property::label() const +const QString& Property::label() { return _label; } -bool Property::labeled_widget() const +bool Property::labeled_widget() { return false; } -GVariant* Property::get_value() const +GVariant* Property::get_value() { return NULL; } diff --git a/DSView/pv/prop/property.h b/DSView/pv/prop/property.h index 2868eedb..5ba344be 100755 --- a/DSView/pv/prop/property.h +++ b/DSView/pv/prop/property.h @@ -47,14 +47,16 @@ protected: Property(QString name, QString label, Getter getter, Setter setter); public: - const QString& name() const; - const QString& label() const; + const QString& name(); + const QString& label(); + + virtual ~Property(); virtual QWidget* get_widget(QWidget *parent, bool auto_commit = false) = 0; - virtual bool labeled_widget() const; + virtual bool labeled_widget(); - virtual GVariant* get_value() const; + virtual GVariant* get_value(); virtual void commit() = 0; diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index c5552d6f..b75f55c9 100755 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -71,8 +71,7 @@ using namespace boost; -using namespace std; - + namespace pv { // TODO: This should not be necessary @@ -115,16 +114,16 @@ SigSession::SigSession(DeviceManager *device_manager) : _stop_scale = 1; // Create snapshots & data containers - _cur_logic_snapshot.reset(new data::LogicSnapshot()); - _logic_data.reset(new data::Logic()); + _cur_logic_snapshot = new data::LogicSnapshot(); + _logic_data = new data::Logic(); _logic_data->push_snapshot(_cur_logic_snapshot); - _cur_dso_snapshot.reset(new data::DsoSnapshot()); - _dso_data.reset(new data::Dso()); + _cur_dso_snapshot = new data::DsoSnapshot(); + _dso_data = new data::Dso(); _dso_data->push_snapshot(_cur_dso_snapshot); - _cur_analog_snapshot.reset(new data::AnalogSnapshot()); - _analog_data.reset(new data::Analog()); + _cur_analog_snapshot = new data::AnalogSnapshot(); + _analog_data = new data::Analog(); _analog_data->push_snapshot(_cur_analog_snapshot); - _group_data.reset(new data::Group()); + _group_data = new data::Group(); _group_cnt = 0; connect(&_feed_timer, SIGNAL(timeout()), this, SLOT(feed_timeout())); @@ -136,7 +135,7 @@ SigSession::~SigSession() { } -DevInst* SigSession::get_device() const +DevInst* SigSession::get_device() { return _dev_inst; } @@ -230,7 +229,7 @@ void SigSession::set_default_device(boost::function error_ DevInst *default_device = NULL; - const list &devices = _device_manager->devices(); + const std::list &devices = _device_manager->devices(); if (!devices.empty()) { // Fall back to the first device in the list. default_device = devices.front(); @@ -265,18 +264,18 @@ void SigSession::release_device(DevInst *dev_inst) _dev_inst = NULL; } -SigSession::capture_state SigSession::get_capture_state() const +SigSession::capture_state SigSession::get_capture_state() { std::lock_guard lock(_sampling_mutex); return _capture_state; } -uint64_t SigSession::cur_samplelimits() const +uint64_t SigSession::cur_samplelimits() { return _cur_samplelimits; } -uint64_t SigSession::cur_samplerate() const +uint64_t SigSession::cur_samplerate() { // samplerate for current viewport if (_dev_inst->dev_inst()->mode == DSO) @@ -285,23 +284,23 @@ uint64_t SigSession::cur_samplerate() const return cur_snap_samplerate(); } -uint64_t SigSession::cur_snap_samplerate() const +uint64_t SigSession::cur_snap_samplerate() { // samplerate for current snapshot return _cur_snap_samplerate; } -double SigSession::cur_sampletime() const +double SigSession::cur_sampletime() { return cur_samplelimits() * 1.0 / cur_samplerate(); } -double SigSession::cur_snap_sampletime() const +double SigSession::cur_snap_sampletime() { return cur_samplelimits() * 1.0 / cur_snap_samplerate(); } -double SigSession::cur_view_time() const +double SigSession::cur_view_time() { return _dev_inst->get_time_base() * DS_CONF_DSO_HDIVS * 1.0 / SR_SEC(1); } @@ -374,12 +373,12 @@ void SigSession::capture_init() for(auto &s : _signals) { assert(s); - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->set_zero_ratio(dsoSig->get_zero_ratio()); } - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(s))) { + view::AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(s))) { analogSig->set_zero_ratio(analogSig->get_zero_ratio()); } } @@ -450,8 +449,8 @@ void SigSession::start_capture(bool instant, for(auto &s : _signals) { assert(s); - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) dsoSig->set_mValid(false); } @@ -489,10 +488,7 @@ void SigSession::stop_capture() { data_unlock(); - for (vector< boost::shared_ptr >::iterator i = - _decode_traces.begin(); - i != _decode_traces.end(); - i++) + for (auto i = _decode_traces.begin(); i != _decode_traces.end(); i++) (*i)->decoder()->stop_decode(); if (get_capture_state() != Running) @@ -530,22 +526,20 @@ bool SigSession::get_capture_status(bool &triggered, int &progress) return false; } -vector< boost::shared_ptr >& SigSession::get_signals() -{ - //boost::lock_guard lock(_signals_mutex); +std::vector& SigSession::get_signals() +{ return _signals; } -vector< boost::shared_ptr > SigSession::get_group_signals() -{ - //boost::lock_guard lock(_signals_mutex); +std::vector& SigSession::get_group_signals() +{ return _group_traces; } -set< boost::shared_ptr > SigSession::get_data() const +std::set SigSession::get_data() { //lock_guard lock(_signals_mutex); - set< boost::shared_ptr > data; + std::set data; for(auto &sig : _signals) { assert(sig); @@ -617,37 +611,25 @@ void SigSession::add_group() { std::list probe_index_list; - std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + auto i = _signals.begin(); while (i != _signals.end()) { if ((*i)->get_type() == SR_CHANNEL_LOGIC && (*i)->selected()) probe_index_list.push_back((*i)->get_index()); i++; } - if (probe_index_list.size() > 1) { - //_group_data.reset(new data::Group(_last_sample_rate)); -// if (_group_data->get_snapshots().empty()) -// _group_data->set_samplerate(_dev_inst->get_sample_rate()); + if (probe_index_list.size() > 1) { _group_data->init(); _group_data->set_samplerate(_cur_snap_samplerate); - const boost::shared_ptr signal( - new view::GroupSignal("New Group", - _group_data, probe_index_list, _group_cnt)); + auto signal = new view::GroupSignal("New Group", _group_data, probe_index_list, _group_cnt); _group_traces.push_back(signal); _group_cnt++; - const deque< boost::shared_ptr > &snapshots = - _logic_data->get_snapshots(); - if (!snapshots.empty()) { - //if (!_cur_group_snapshot) - //{ - // Create a new data snapshot - _cur_group_snapshot = boost::shared_ptr( - new data::GroupSnapshot(snapshots.front(), signal->get_index_list())); - //_cur_group_snapshot->append_payload(); - _group_data->push_snapshot(_cur_group_snapshot); - _cur_group_snapshot.reset(); - //} + const auto &snapshots = _logic_data->get_snapshots(); + if (!snapshots.empty()) + { + auto p = new data::GroupSnapshot(snapshots.front(), signal->get_index_list()); + _group_data->push_snapshot(p); } signals_changed(); @@ -657,25 +639,32 @@ void SigSession::add_group() void SigSession::del_group() { - std::vector< boost::shared_ptr >::iterator i = _group_traces.begin(); + auto i = _group_traces.begin(); + while (i != _group_traces.end()) { - if ((*i)->selected()) { - std::vector< boost::shared_ptr >::iterator j = _group_traces.begin(); + pv::view::GroupSignal *psig = *(i); + + if (psig->selected()) { + auto j = _group_traces.begin(); while(j != _group_traces.end()) { - if ((*j)->get_sec_index() > (*i)->get_sec_index()) + if ((*j)->get_sec_index() > psig->get_sec_index()) (*j)->set_sec_index((*j)->get_sec_index() - 1); j++; } - std::deque< boost::shared_ptr > &snapshots = _group_data->get_snapshots(); + auto &snapshots = _group_data->get_snapshots(); if (!snapshots.empty()) { - _group_data->get_snapshots().at((*i)->get_sec_index()).reset(); - std::deque< boost::shared_ptr >::iterator k = snapshots.begin(); + int dex = psig->get_sec_index(); + pv::data::GroupSnapshot *pshot = _group_data->get_snapshots().at(dex); + delete pshot; + + auto k = snapshots.begin(); k += (*i)->get_sec_index(); _group_data->get_snapshots().erase(k); } + + delete psig; - (*i).reset(); i = _group_traces.erase(i); _group_cnt--; @@ -693,8 +682,8 @@ void SigSession::init_signals() assert(_dev_inst); stop_capture(); - vector< boost::shared_ptr > sigs; - boost::shared_ptr signal; + std::vector sigs; + view::Signal *signal = NULL; unsigned int logic_probe_count = 0; unsigned int dso_probe_count = 0; unsigned int analog_probe_count = 0; @@ -741,37 +730,35 @@ void SigSession::init_signals() // Make the logic probe list { _group_traces.clear(); - vector< boost::shared_ptr >().swap(_group_traces); + std::vector().swap(_group_traces); for (GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) { sr_channel *probe = ( sr_channel *)l->data; assert(probe); - signal.reset(); + signal = NULL; + switch(probe->type) { case SR_CHANNEL_LOGIC: if (probe->enabled) - signal = boost::shared_ptr( - new view::LogicSignal(_dev_inst, _logic_data, probe)); + signal = new view::LogicSignal(_dev_inst, _logic_data, probe); break; case SR_CHANNEL_DSO: - signal = boost::shared_ptr( - new view::DsoSignal(_dev_inst, _dso_data, probe)); + signal = new view::DsoSignal(_dev_inst, _dso_data, probe); break; case SR_CHANNEL_ANALOG: if (probe->enabled) - signal = boost::shared_ptr( - new view::AnalogSignal(_dev_inst, _analog_data, probe)); + signal = new view::AnalogSignal(_dev_inst, _analog_data, probe); break; } - if(signal.get()) + if(signal != NULL) sigs.push_back(signal); } _signals.clear(); - vector< boost::shared_ptr >().swap(_signals); + std::vector().swap(_signals); _signals = sigs; } @@ -789,8 +776,8 @@ void SigSession::reload() stop_capture(); //refresh(0); - vector< boost::shared_ptr > sigs; - boost::shared_ptr signal; + std::vector sigs; + view::Signal *signal = NULL; // Make the logic probe list { @@ -798,58 +785,54 @@ void SigSession::reload() sr_channel *probe = (sr_channel *)l->data; assert(probe); - signal.reset(); + signal = NULL; + switch(probe->type) { case SR_CHANNEL_LOGIC: if (probe->enabled) { - std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + auto i = _signals.begin(); while (i != _signals.end()) { if ((*i)->get_index() == probe->index) { - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(*i))) - signal = boost::shared_ptr( - new view::LogicSignal(logicSig, _logic_data, probe)); + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(*i))) + signal = new view::LogicSignal(logicSig, _logic_data, probe); break; } i++; } - if (!signal.get()) - signal = boost::shared_ptr( - new view::LogicSignal(_dev_inst, _logic_data, probe)); + if (signal == NULL){ + signal = new view::LogicSignal(_dev_inst, _logic_data, probe); + } } break; -// case SR_CHANNEL_DSO: -// signal = boost::shared_ptr( -// new view::DsoSignal(_dev_inst,_dso_data, probe)); -// break; - + case SR_CHANNEL_ANALOG: if (probe->enabled) { - std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + auto i = _signals.begin(); while (i != _signals.end()) { if ((*i)->get_index() == probe->index) { - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(*i))) - signal = boost::shared_ptr( - new view::AnalogSignal(analogSig, _analog_data, probe)); + view::AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(*i))) + signal = new view::AnalogSignal(analogSig, _analog_data, probe); break; } i++; } - if (!signal.get()) - signal = boost::shared_ptr( - new view::AnalogSignal(_dev_inst, _analog_data, probe)); + if (signal == NULL){ + signal = new view::AnalogSignal(_dev_inst, _analog_data, probe); + } + } break; } - if (signal.get()) + if (signal != NULL) sigs.push_back(signal); } if (!sigs.empty()) { _signals.clear(); - vector< boost::shared_ptr >().swap(_signals); + std::vector().swap(_signals); _signals = sigs; } } @@ -864,8 +847,7 @@ void SigSession::refresh(int holdtime) data_lock(); if (_logic_data) { - _logic_data->init(); - //_cur_logic_snapshot.reset(); + _logic_data->init(); for(auto &d : _decode_traces) { @@ -886,8 +868,7 @@ void SigSession::refresh(int holdtime) _math_trace->get_math_stack()->init(); } if (_analog_data) { - _analog_data->init(); - //_cur_analog_snapshot.reset(); + _analog_data->init(); } QTimer::singleShot(holdtime, this, SLOT(feed_timeout())); @@ -978,8 +959,7 @@ void SigSession::feed_in_trigger(const ds_trigger_pos &trigger_pos) } void SigSession::feed_in_logic(const sr_datafeed_logic &logic) -{ - //boost::lock_guard lock(_data_mutex); +{ if (!_logic_data || _cur_logic_snapshot->memory_failed()) { qDebug() << "Unexpected logic packet"; return; @@ -1016,9 +996,7 @@ void SigSession::feed_in_logic(const sr_datafeed_logic &logic) } void SigSession::feed_in_dso(const sr_datafeed_dso &dso) -{ - //boost::lock_guard lock(_data_mutex); - +{ if(!_dso_data || _cur_dso_snapshot->memory_failed()) { qDebug() << "Unexpected dso packet"; @@ -1032,8 +1010,8 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso) for(auto &s : _signals) { assert(s); - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->set_scale(dsoSig->get_view_rect().height()); sig_enable[dsoSig->get_index()] = dsoSig->enabled(); } @@ -1047,8 +1025,8 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso) } for(auto &s : _signals) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s)) && (dsoSig->enabled())) + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s)) && (dsoSig->enabled())) dsoSig->paint_prepare(); } @@ -1088,8 +1066,7 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso) } void SigSession::feed_in_analog(const sr_datafeed_analog &analog) -{ - //boost::lock_guard lock(_data_mutex); +{ if(!_analog_data || _cur_analog_snapshot->memory_failed()) { @@ -1103,8 +1080,8 @@ void SigSession::feed_in_analog(const sr_datafeed_analog &analog) for(auto &s : _signals) { assert(s); - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(s))) { + view::AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(s))) { analogSig->set_scale(analogSig->get_totalHeight()); } } @@ -1187,16 +1164,14 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, case SR_DF_END: { { - //boost::lock_guard lock(_data_mutex); + if (!_cur_logic_snapshot->empty()) { for(auto &g : _group_traces) { assert(g); - _cur_group_snapshot = boost::shared_ptr( - new data::GroupSnapshot(_logic_data->get_snapshots().front(), g->get_index_list())); - _group_data->push_snapshot(_cur_group_snapshot); - _cur_group_snapshot.reset(); + auto p = new data::GroupSnapshot(_logic_data->get_snapshots().front(), g->get_index_list()); + _group_data->push_snapshot(p); } } _cur_logic_snapshot->capture_ended(); @@ -1331,20 +1306,18 @@ uint16_t SigSession::get_ch_num(int type) uint16_t logic_ch_num = 0; uint16_t dso_ch_num = 0; uint16_t analog_ch_num = 0; + if (_dev_inst->dev_inst()) { for(auto &s : _signals) { assert(s); - if (dynamic_pointer_cast(s) && s->enabled()) { - //if (dynamic_pointer_cast(s)) { + if (dynamic_cast(s) && s->enabled()) { logic_ch_num++; } - if (dynamic_pointer_cast(s) && s->enabled()) { - //if (dynamic_pointer_cast(s)) { + if (dynamic_cast(s) && s->enabled()) { dso_ch_num++; } - if (dynamic_pointer_cast(s) && s->enabled()) { - //if (dynamic_pointer_cast(s)) { + if (dynamic_cast(s) && s->enabled()) { analog_ch_num++; } } @@ -1366,75 +1339,74 @@ uint16_t SigSession::get_ch_num(int type) bool SigSession::add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus) -{ - bool ret = false; - map probes; - boost::shared_ptr decoder_stack; +{ + try { - try { - //lock_guard lock(_signals_mutex); + bool ret = false; // Create the decoder - decoder_stack = boost::shared_ptr( - new data::DecoderStack(this, dec, dstatus)); + std::map probes; + data::DecoderStack *decoder_stack = new data::DecoderStack(this, dec, dstatus); + assert(decoder_stack); // Make a list of all the probes std::vector all_probes; for(const GSList *i = dec->channels; i; i = i->next) all_probes.push_back((const srd_channel*)i->data); + for(const GSList *i = dec->opt_channels; i; i = i->next) all_probes.push_back((const srd_channel*)i->data); - - assert(decoder_stack); - assert(!decoder_stack->stack().empty()); - assert(decoder_stack->stack().front()); + decoder_stack->stack().front()->set_probes(probes); // Create the decode signal - boost::shared_ptr d( - new view::DecodeTrace(this, decoder_stack, - _decode_traces.size())); + view::DecodeTrace *trace = new view::DecodeTrace(this, decoder_stack, _decode_traces.size()); + assert(trace); + // set view early for decode start/end region setting for(auto &s : _signals) { if (s->get_view()) { - d->set_view(s->get_view()); + trace->set_view(s->get_view()); break; } } if (silent) { - _decode_traces.push_back(d); + _decode_traces.push_back(trace); ret = true; - } else if (d->create_popup()) { - _decode_traces.push_back(d); + } else if (trace->create_popup()) { + _decode_traces.push_back(trace); ret = true; } - } catch(const std::runtime_error &e) { - return false; - } - if (ret) { - signals_changed(); - // Do an initial decode - decoder_stack->begin_decode(); - data_updated(); - } + if (ret) + { + signals_changed(); + // Do an initial decode + decoder_stack->begin_decode(); + data_updated(); + } + else{ + delete trace; + } - return ret; + return ret; + + } catch(...) { + ds_debug("Starting a hotplug thread...\n"); + } + + return false; } -vector< boost::shared_ptr > SigSession::get_decode_signals() const -{ - //lock_guard lock(_signals_mutex); +std::vector& SigSession::get_decode_signals() +{ return _decode_traces; } void SigSession::remove_decode_signal(view::DecodeTrace *signal) { - for (vector< boost::shared_ptr >::iterator i = - _decode_traces.begin(); - i != _decode_traces.end(); - i++) - if ((*i).get() == signal) + for (auto i = _decode_traces.begin(); i != _decode_traces.end(); i++) + if ((*i) == signal) { _decode_traces.erase(i); signals_changed(); @@ -1445,14 +1417,12 @@ void SigSession::remove_decode_signal(view::DecodeTrace *signal) void SigSession::remove_decode_signal(int index) { int cur_index = 0; - for (vector< boost::shared_ptr >::iterator i = - _decode_traces.begin(); - i != _decode_traces.end(); - i++) + + for (auto i = _decode_traces.begin(); i != _decode_traces.end(); i++) { if (cur_index == index) { - auto d = (*i)->decoder().get(); + auto d = (*i)->decoder(); d->stop_decode(); //stop decoder thread _decode_traces.erase(i); signals_changed(); @@ -1464,45 +1434,35 @@ void SigSession::remove_decode_signal(int index) void SigSession::rst_decoder(int index) { - int cur_index = 0; - for (vector< boost::shared_ptr >::iterator i = - _decode_traces.begin(); - i != _decode_traces.end(); - i++) - { - if (cur_index == index) - { - if ((*i)->create_popup()) + if (index >= 0 && index < (int)_decode_traces.size()){ + auto p = _decode_traces[index]; + if (p->create_popup()) { - (*i)->decoder()->stop_decode(); - (*i)->decoder()->begin_decode(); + p->decoder()->stop_decode(); + p->decoder()->begin_decode(); data_updated(); } - return; - } - cur_index++; } } void SigSession::rst_decoder(view::DecodeTrace *signal) -{ - for (vector< boost::shared_ptr >::iterator i = - _decode_traces.begin(); - i != _decode_traces.end(); - i++) - if ((*i).get() == signal) - { - if ((*i)->create_popup()) - { - (*i)->decoder()->stop_decode(); - (*i)->decoder()->begin_decode(); - data_updated(); - } - return; - } +{ + for (auto p : _decode_traces) + { + if (p == signal) + { + if (p->create_popup()) + { + p->decoder()->stop_decode(); + p->decoder()->begin_decode(); + data_updated(); + } + break; + } + } } -pv::data::DecoderModel* SigSession::get_decoder_model() const +pv::data::DecoderModel* SigSession::get_decoder_model() { return _decoder_model; } @@ -1512,20 +1472,18 @@ void SigSession::spectrum_rebuild() { bool has_dso_signal = false; for(auto &s : _signals) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { has_dso_signal = true; // check already have - std::vector< boost::shared_ptr >::iterator iter = _spectrum_traces.begin(); + auto iter = _spectrum_traces.begin(); for(unsigned int i = 0; i < _spectrum_traces.size(); i++, iter++) if ((*iter)->get_index() == dsoSig->get_index()) break; // if not, rebuild if (iter == _spectrum_traces.end()) { - boost::shared_ptr spectrum_stack( - new data::SpectrumStack(this, dsoSig->get_index())); - boost::shared_ptr spectrum_trace( - new view::SpectrumTrace(this, spectrum_stack, dsoSig->get_index())); + auto spectrum_stack = new data::SpectrumStack(this, dsoSig->get_index()); + auto spectrum_trace = new view::SpectrumTrace(this, spectrum_stack, dsoSig->get_index()); _spectrum_traces.push_back(spectrum_trace); } } @@ -1537,15 +1495,14 @@ void SigSession::spectrum_rebuild() signals_changed(); } -vector< boost::shared_ptr > SigSession::get_spectrum_traces() -{ - //lock_guard lock(_signals_mutex); +std::vector& SigSession::get_spectrum_traces() +{ return _spectrum_traces; } void SigSession::lissajous_rebuild(bool enable, int xindex, int yindex, double percent) { - _lissajous_trace.reset(new view::LissajousTrace(enable, _dso_data, xindex, yindex, percent)); + _lissajous_trace = new view::LissajousTrace(enable, _dso_data, xindex, yindex, percent); signals_changed(); } @@ -1555,21 +1512,20 @@ void SigSession::lissajous_disable() _lissajous_trace->set_enable(false); } -boost::shared_ptr SigSession::get_lissajous_trace() -{ - //lock_guard lock(_signals_mutex); +view::LissajousTrace* SigSession::get_lissajous_trace() +{ return _lissajous_trace; } -void SigSession::math_rebuild(bool enable, - boost::shared_ptr dsoSig1, - boost::shared_ptr dsoSig2, +void SigSession::math_rebuild(bool enable,view::DsoSignal *dsoSig1, + view::DsoSignal *dsoSig2, data::MathStack::MathType type) { std::lock_guard lock(_data_mutex); - boost::shared_ptr math_stack( - new data::MathStack(this, dsoSig1, dsoSig2, type)); - _math_trace.reset(new view::MathTrace(enable, math_stack, dsoSig1, dsoSig2)); + auto math_stack = new data::MathStack(this, dsoSig1, dsoSig2, type); + DESTROY_OBJECT(_math_trace); + _math_trace = new view::MathTrace(enable, math_stack, dsoSig1, dsoSig2); + if (_math_trace && _math_trace->enabled()) { _math_trace->get_math_stack()->set_samplerate(_dev_inst->get_sample_rate()); _math_trace->get_math_stack()->realloc(_dev_inst->get_sample_limit()); @@ -1584,9 +1540,8 @@ void SigSession::math_disable() _math_trace->set_enable(false); } -boost::shared_ptr SigSession::get_math_trace() +view::MathTrace* SigSession::get_math_trace() { - //lock_guard lock(_signals_mutex); return _math_trace; } @@ -1595,22 +1550,22 @@ void SigSession::set_session_time(QDateTime time) _session_time = time; } -QDateTime SigSession::get_session_time() const +QDateTime SigSession::get_session_time() { return _session_time; } -uint64_t SigSession::get_trigger_pos() const +uint64_t SigSession::get_trigger_pos() { return _trigger_pos; } -bool SigSession::trigd() const +bool SigSession::trigd() { return _trigger_flag; } -uint8_t SigSession::trigd_ch() const +uint8_t SigSession::trigd_ch() { return _trigger_ch; } @@ -1634,7 +1589,7 @@ void SigSession::feed_timeout() } } -boost::shared_ptr SigSession::get_snapshot(int type) +data::Snapshot* SigSession::get_snapshot(int type) { if (type == SR_CHANNEL_LOGIC) return _cur_logic_snapshot; @@ -1646,7 +1601,7 @@ boost::shared_ptr SigSession::get_snapshot(int type) return NULL; } -SigSession::error_state SigSession::get_error() const +SigSession::error_state SigSession::get_error() { return _error; } @@ -1662,12 +1617,12 @@ void SigSession::clear_error() _error = No_err; } -uint64_t SigSession::get_error_pattern() const +uint64_t SigSession::get_error_pattern() { return _error_pattern; } -SigSession::run_mode SigSession::get_run_mode() const +SigSession::run_mode SigSession::get_run_mode() { return _run_mode; } @@ -1677,7 +1632,7 @@ void SigSession::set_run_mode(run_mode mode) _run_mode = mode; } -int SigSession::get_repeat_intvl() const +int SigSession::get_repeat_intvl() { return _repeat_intvl; } @@ -1694,7 +1649,7 @@ void SigSession::set_repeating(bool repeat) _repeat_hold_prg = 0; } -bool SigSession::isRepeating() const +bool SigSession::isRepeating() { return _repeating; } @@ -1729,7 +1684,7 @@ void SigSession::repeat_update() } } -int SigSession::get_repeat_hold() const +int SigSession::get_repeat_hold() { if (isRepeating()) return _repeat_hold_prg; @@ -1742,7 +1697,7 @@ void SigSession::set_map_zoom(int index) _map_zoom = index; } -int SigSession::get_map_zoom() const +int SigSession::get_map_zoom() { return _map_zoom; } @@ -1750,8 +1705,8 @@ int SigSession::get_map_zoom() const void SigSession::auto_end() { for(auto &s : _signals) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->auto_end(); } } @@ -1767,17 +1722,17 @@ void SigSession::set_save_end(uint64_t end) _save_end = end; } -uint64_t SigSession::get_save_start() const +uint64_t SigSession::get_save_start() { return _save_start; } -uint64_t SigSession::get_save_end() const +uint64_t SigSession::get_save_end() { return _save_end; } -bool SigSession::get_saving() const +bool SigSession::get_saving() { return _saving; } @@ -1804,7 +1759,7 @@ void SigSession::exit_capture() } } -float SigSession::stop_scale() const +float SigSession::stop_scale() { return _stop_scale; } diff --git a/DSView/pv/sigsession.h b/DSView/pv/sigsession.h index 9cd6324e..2ae6c63c 100755 --- a/DSView/pv/sigsession.h +++ b/DSView/pv/sigsession.h @@ -24,9 +24,7 @@ #define DSVIEW_PV_SIGSESSION_H #include -#include -#include -#include +#include #include #include @@ -139,7 +137,7 @@ public: ~SigSession(); - DevInst* get_device() const; + DevInst* get_device(); /** * Sets device instance that will be used in the next capture session. @@ -156,20 +154,20 @@ public: void release_device(DevInst *dev_inst); - capture_state get_capture_state() const; + capture_state get_capture_state(); - uint64_t cur_samplerate() const; - uint64_t cur_snap_samplerate() const; - uint64_t cur_samplelimits() const; - double cur_sampletime() const; - double cur_snap_sampletime() const; - double cur_view_time() const; + uint64_t cur_samplerate(); + uint64_t cur_snap_samplerate(); + uint64_t cur_samplelimits(); + double cur_sampletime(); + double cur_snap_sampletime(); + double cur_view_time(); void set_cur_snap_samplerate(uint64_t samplerate); void set_cur_samplelimits(uint64_t samplelimits); void set_session_time(QDateTime time); - QDateTime get_session_time() const; - uint64_t get_trigger_pos() const; + QDateTime get_session_time(); + uint64_t get_trigger_pos(); void start_capture(bool instant, boost::function error_handler); @@ -177,19 +175,15 @@ public: bool get_capture_status(bool &triggered, int &progress); void container_init(); - std::set< boost::shared_ptr > get_data() const; + std::set get_data(); - std::vector< boost::shared_ptr >& - get_signals(); - - std::vector< boost::shared_ptr > - get_group_signals(); + std::vector& get_signals(); + std::vector& get_group_signals(); bool add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus); - std::vector< boost::shared_ptr > - get_decode_signals() const; + std::vector& get_decode_signals(); void remove_decode_signal(view::DecodeTrace *signal); @@ -199,17 +193,13 @@ public: void rst_decoder(view::DecodeTrace *signal); - pv::data::DecoderModel* get_decoder_model() const; + pv::data::DecoderModel* get_decoder_model(); + std::vector& get_spectrum_traces(); - std::vector< boost::shared_ptr > - get_spectrum_traces(); + view::LissajousTrace* get_lissajous_trace(); - boost::shared_ptr - get_lissajous_trace(); - - boost::shared_ptr - get_math_trace(); + view::MathTrace* get_math_trace(); void init_signals(); @@ -232,40 +222,39 @@ public: void spectrum_rebuild(); void lissajous_rebuild(bool enable, int xindex, int yindex, double percent); void lissajous_disable(); - void math_rebuild(bool enable, - boost::shared_ptr dsoSig1, - boost::shared_ptr dsoSig2, + void math_rebuild(bool enable,pv::view::DsoSignal *dsoSig1, + pv::view::DsoSignal *dsoSig2, data::MathStack::MathType type); void math_disable(); - bool trigd() const; - uint8_t trigd_ch() const; + bool trigd(); + uint8_t trigd_ch(); - boost::shared_ptr get_snapshot(int type); + data::Snapshot* get_snapshot(int type); - error_state get_error() const; + error_state get_error(); void set_error(error_state state); void clear_error(); - uint64_t get_error_pattern() const; + uint64_t get_error_pattern(); - run_mode get_run_mode() const; + run_mode get_run_mode(); void set_run_mode(run_mode mode); - int get_repeat_intvl() const; + int get_repeat_intvl(); void set_repeat_intvl(int interval); - bool isRepeating() const; + bool isRepeating(); bool repeat_check(); - int get_repeat_hold() const; + int get_repeat_hold(); - int get_map_zoom() const; + int get_map_zoom(); void set_save_start(uint64_t start); void set_save_end(uint64_t end); - uint64_t get_save_start() const; - uint64_t get_save_end() const; - bool get_saving() const; + uint64_t get_save_start(); + uint64_t get_save_end(); + bool get_saving(); void set_saving(bool saving); void set_stop_scale(float scale); - float stop_scale() const; + float stop_scale(); void exit_capture(); @@ -402,25 +391,24 @@ private: uint64_t _cur_samplelimits; //mutable std::mutex _signals_mutex; - std::vector< boost::shared_ptr > _signals; - std::vector< boost::shared_ptr > _group_traces; + std::vector _signals; + std::vector _group_traces; - std::vector< boost::shared_ptr > _decode_traces; - pv::data::DecoderModel *_decoder_model; + std::vector _decode_traces; + pv::data::DecoderModel *_decoder_model; - std::vector< boost::shared_ptr > _spectrum_traces; - boost::shared_ptr _lissajous_trace; - boost::shared_ptr _math_trace; + std::vector _spectrum_traces; + view::LissajousTrace *_lissajous_trace; + view::MathTrace *_math_trace; mutable std::mutex _data_mutex; - boost::shared_ptr _logic_data; - boost::shared_ptr _cur_logic_snapshot; - boost::shared_ptr _dso_data; - boost::shared_ptr _cur_dso_snapshot; - boost::shared_ptr _analog_data; - boost::shared_ptr _cur_analog_snapshot; - boost::shared_ptr _group_data; - boost::shared_ptr _cur_group_snapshot; + data::Logic *_logic_data; + data::LogicSnapshot *_cur_logic_snapshot; + data::Dso *_dso_data; + data::DsoSnapshot *_cur_dso_snapshot; + data::Analog *_analog_data; + data::AnalogSnapshot *_cur_analog_snapshot; + data::Group *_group_data; int _group_cnt; std::thread *_sampling_thread; diff --git a/DSView/pv/storesession.cpp b/DSView/pv/storesession.cpp index 230fd51a..c99d2efe 100755 --- a/DSView/pv/storesession.cpp +++ b/DSView/pv/storesession.cpp @@ -82,13 +82,13 @@ SigSession* StoreSession::session() return _session; } -pair StoreSession::progress() const +std::pair StoreSession::progress() { //lock_guard lock(_mutex); - return make_pair(_units_stored, _unit_count); + return std::make_pair(_units_stored, _unit_count); } -const QString& StoreSession::error() const +const QString& StoreSession::error() { //lock_guard lock(_mutex); return _error; @@ -153,7 +153,7 @@ bool StoreSession::save_start() return false; } - const boost::shared_ptr snapshot(_session->get_snapshot(*type_set.begin())); + const auto snapshot = _session->get_snapshot(*type_set.begin()); assert(snapshot); // Check we have data if (snapshot->empty()) { @@ -205,17 +205,17 @@ bool StoreSession::save_start() return false; } -void StoreSession::save_proc(boost::shared_ptr snapshot) +void StoreSession::save_proc(data::Snapshot *snapshot) { assert(snapshot); int ret = SR_ERR; int num = 0; - boost::shared_ptr logic_snapshot; - boost::shared_ptr analog_snapshot; - boost::shared_ptr dso_snapshot; + data::LogicSnapshot *logic_snapshot = NULL; + //data::AnalogSnapshot *analog_snapshot = NULL; + //data::DsoSnapshot *dso_snapshot = NULL; - if ((logic_snapshot = boost::dynamic_pointer_cast(snapshot))) { + if ((logic_snapshot = dynamic_cast(snapshot))) { uint16_t to_save_probes = 0; for(auto &s : _session->get_signals()) { if (s->enabled() && logic_snapshot->has_data(s->get_index())) @@ -345,7 +345,7 @@ void StoreSession::save_proc(boost::shared_ptr snapshot) } } -QString StoreSession::meta_gen(boost::shared_ptr snapshot) +QString StoreSession::meta_gen(data::Snapshot *snapshot) { GSList *l; GVariant *gvar; @@ -396,8 +396,8 @@ QString StoreSession::meta_gen(boost::shared_ptr snapshot) fprintf(meta, "total blocks = %d\n", snapshot->get_block_num()); } - boost::shared_ptr logic_snapshot; - if ((logic_snapshot = dynamic_pointer_cast(snapshot))) { + data::LogicSnapshot *logic_snapshot = NULL; + if ((logic_snapshot = dynamic_cast(snapshot))) { uint16_t to_save_probes = 0; for (l = sdi->channels; l; l = l->next) { probe = (struct sr_channel *)l->data; @@ -451,8 +451,8 @@ QString StoreSession::meta_gen(boost::shared_ptr snapshot) } else if (sdi->mode == LOGIC) { fprintf(meta, "trigger time = %lld\n", _session->get_session_time().toMSecsSinceEpoch()); } else if (sdi->mode == ANALOG) { - boost::shared_ptr analog_snapshot; - if ((analog_snapshot = dynamic_pointer_cast(snapshot))) { + data::AnalogSnapshot *analog_snapshot = NULL; + if ((analog_snapshot = dynamic_cast(snapshot))) { uint8_t tmp_u8 = analog_snapshot->get_unit_bytes(); fprintf(meta, "bits = %d\n", tmp_u8*8); } @@ -559,7 +559,7 @@ bool StoreSession::export_start() return false; } - const boost::shared_ptr snapshot(_session->get_snapshot(*type_set.begin())); + const auto snapshot = _session->get_snapshot(*type_set.begin()); assert(snapshot); // Check we have data if (snapshot->empty()) { @@ -605,20 +605,20 @@ bool StoreSession::export_start() return false; } -void StoreSession::export_proc(boost::shared_ptr snapshot) +void StoreSession::export_proc(data::Snapshot *snapshot) { assert(snapshot); - boost::shared_ptr logic_snapshot; - boost::shared_ptr analog_snapshot; - boost::shared_ptr dso_snapshot; + data::LogicSnapshot *logic_snapshot = NULL; + data::AnalogSnapshot *analog_snapshot = NULL; + data::DsoSnapshot *dso_snapshot = NULL; int channel_type; - if ((logic_snapshot = boost::dynamic_pointer_cast(snapshot))) { + if ((logic_snapshot = dynamic_cast(snapshot))) { channel_type = SR_CHANNEL_LOGIC; - } else if ((dso_snapshot = boost::dynamic_pointer_cast(snapshot))) { + } else if ((dso_snapshot = dynamic_cast(snapshot))) { channel_type = SR_CHANNEL_DSO; - } else if ((analog_snapshot = boost::dynamic_pointer_cast(snapshot))) { + } else if ((analog_snapshot = dynamic_cast(snapshot))) { channel_type = SR_CHANNEL_ANALOG; } else { _has_error = true; @@ -871,15 +871,15 @@ QJsonArray StoreSession::json_decoders() QJsonObject dec_obj; QJsonArray stack_array; QJsonObject show_obj; - const boost::shared_ptr& stack = t->decoder(); - const std::list< boost::shared_ptr >& decoder = stack->stack(); + const auto &stack = t->decoder(); + const auto &decoder = stack->stack(); for(auto &dec : decoder) { QJsonArray ch_array; const srd_decoder *const d = dec->decoder();; const bool have_probes = (d->channels || d->opt_channels) != 0; if (have_probes) { - for(std::map::const_iterator i = dec->channels().begin(); + for(auto i = dec->channels().begin(); i != dec->channels().end(); i++) { QJsonObject ch_obj; ch_obj[(*i).first->id] = QJsonValue::fromVariant((*i).second); @@ -888,8 +888,8 @@ QJsonArray StoreSession::json_decoders() } QJsonObject options_obj; - boost::shared_ptr dec_binding( - new prop::binding::DecoderOptions(stack, dec)); + auto dec_binding = new prop::binding::DecoderOptions(stack, dec); + for (GSList *l = d->options; l; l = l->next) { const srd_decoder_option *const opt = @@ -934,10 +934,10 @@ QJsonArray StoreSession::json_decoders() dec_obj["stacked decoders"] = stack_array; - std::map rows = stack->get_rows_gshow(); - for (std::map::const_iterator i = rows.begin(); - i != rows.end(); i++) { - show_obj[(*i).first.title()] = QJsonValue::fromVariant((*i).second); + auto rows = stack->get_rows_gshow(); + for (auto i = rows.begin(); i != rows.end(); i++) { + pv::data::decode::Row _row = (*i).first; + show_obj[_row.title()] = QJsonValue::fromVariant((*i).second); } dec_obj["show"] = show_obj; @@ -954,17 +954,18 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra foreach (const QJsonValue &dec_value, dec_array) { QJsonObject dec_obj = dec_value.toObject(); - const vector< boost::shared_ptr > pre_dsigs( - _session->get_decode_signals()); + + auto &pre_dsigs = _session->get_decode_signals(); if (widget->sel_protocol(dec_obj["id"].toString())) widget->add_protocol(true); - const vector< boost::shared_ptr > aft_dsigs( - _session->get_decode_signals()); + + auto &aft_dsigs = _session->get_decode_signals(); if (aft_dsigs.size() > pre_dsigs.size()) { const GSList *l; - boost::shared_ptr new_dsig = aft_dsigs.back(); - const boost::shared_ptr& stack = new_dsig->decoder(); + + auto new_dsig = aft_dsigs.back(); + auto stack = new_dsig->decoder(); if (dec_obj.contains("stacked decoders")) { foreach(const QJsonValue &value, dec_obj["stacked decoders"].toArray()) { @@ -976,8 +977,7 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra assert(d); if (QString::fromUtf8(d->id) == stacked_obj["id"].toString()) { - stack->push(boost::shared_ptr( - new data::decode::Decoder(d))); + stack->push(new data::decode::Decoder(d)); break; } } @@ -985,7 +985,7 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra } } - const std::list< boost::shared_ptr >& decoder = stack->stack(); + auto &decoder = stack->stack(); for(auto &dec : decoder) { const srd_decoder *const d = dec->decoder(); @@ -1074,10 +1074,13 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra if (dec_obj.contains("show")) { QJsonObject show_obj = dec_obj["show"].toObject(); std::map rows = stack->get_rows_gshow(); - for (std::map::const_iterator i = rows.begin(); - i != rows.end(); i++) { - if (show_obj.contains((*i).first.title())) { - stack->set_rows_gshow((*i).first, show_obj[(*i).first.title()].toBool()); + + for (auto i = rows.begin();i != rows.end(); i++) { + QString key = (*i).first.title(); + if (show_obj.contains(key)) { + bool bShow = show_obj[key].toBool(); + const pv::data::decode::Row r = (*i).first; + stack->set_rows_gshow(r, bShow); } } } diff --git a/DSView/pv/storesession.h b/DSView/pv/storesession.h index 2a671365..c4a49448 100755 --- a/DSView/pv/storesession.h +++ b/DSView/pv/storesession.h @@ -25,8 +25,7 @@ #include #include #include - -#include + #include #include @@ -59,9 +58,9 @@ public: SigSession* session(); - std::pair progress() const; + std::pair progress(); - const QString& error() const; + const QString& error(); bool save_start(); @@ -72,9 +71,9 @@ public: void cancel(); private: - void save_proc(boost::shared_ptr snapshot); - QString meta_gen(boost::shared_ptr snapshot); - void export_proc(boost::shared_ptr snapshot); + void save_proc(pv::data::Snapshot *snapshot); + QString meta_gen(data::Snapshot *snapshot); + void export_proc(pv::data::Snapshot *snapshot); QString decoders_gen(); diff --git a/DSView/pv/toolbars/filebar.cpp b/DSView/pv/toolbars/filebar.cpp index 7c6e7880..0262e0ac 100755 --- a/DSView/pv/toolbars/filebar.cpp +++ b/DSView/pv/toolbars/filebar.cpp @@ -20,9 +20,7 @@ */ #include - -#include - + #include #include diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index 5efe3265..59fbcb42 100755 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -259,7 +259,7 @@ void SamplingBar::set_device_list(const std::list &devices, DevInst *s _updating_device_selector = false; } -DevInst* SamplingBar::get_selected_device() const +DevInst* SamplingBar::get_selected_device() { const int index = _device_selector.currentIndex(); if (index < 0) @@ -331,11 +331,11 @@ void SamplingBar::on_configure() void SamplingBar::zero_adj() { - boost::shared_ptr dsoSig; + view::DsoSignal *dsoSig = NULL; for(auto &s : _session->get_signals()) { - if ((dsoSig = dynamic_pointer_cast(s))) + if ((dsoSig = dynamic_cast(s))) dsoSig->set_enable(true); } const int index_back = _sample_count.currentIndex(); @@ -352,7 +352,7 @@ void SamplingBar::zero_adj() if (wait.start() == QDialog::Rejected) { for(auto &s : _session->get_signals()) { - if ((dsoSig = dynamic_pointer_cast(s))) + if ((dsoSig = dynamic_cast(s))) dsoSig->commit_settings(); } } @@ -364,19 +364,19 @@ void SamplingBar::zero_adj() commit_hori_res(); } -bool SamplingBar::get_sampling() const +bool SamplingBar::get_sampling() { return _sampling; } -bool SamplingBar::get_instant() const +bool SamplingBar::get_instant() { return _instant; } void SamplingBar::set_sampling(bool sampling) { - lock_guard lock(_sampling_mutex); + std::lock_guard lock(_sampling_mutex); _sampling = sampling; if (!sampling) { @@ -505,7 +505,7 @@ void SamplingBar::update_sample_rate_selector_value() void SamplingBar::on_samplerate_sel(int index) { (void)index; - const DevInst *dev_inst = get_selected_device(); + DevInst *dev_inst = get_selected_device(); if (dev_inst->dev_inst()->mode != DSO) update_sample_count_selector(); } @@ -707,7 +707,7 @@ void SamplingBar::on_samplecount_sel(int index) { (void)index; - const DevInst *dev_inst = get_selected_device(); + DevInst *dev_inst = get_selected_device(); if (dev_inst->dev_inst()->mode == DSO) commit_hori_res(); sig_duration_changed(); diff --git a/DSView/pv/toolbars/samplingbar.h b/DSView/pv/toolbars/samplingbar.h index 833795d0..14779f96 100755 --- a/DSView/pv/toolbars/samplingbar.h +++ b/DSView/pv/toolbars/samplingbar.h @@ -27,9 +27,7 @@ #include #include #include - -#include - + #include #include #include @@ -76,13 +74,13 @@ namespace pv void set_device_list(const std::list &devices, DevInst* selected); - DevInst *get_selected_device() const; + DevInst *get_selected_device(); void update_sample_rate_selector(); void set_sampling(bool sampling); - bool get_sampling() const; - bool get_instant() const; + bool get_sampling(); + bool get_instant(); void enable_toggle(bool enable); diff --git a/DSView/pv/toolbars/titlebar.cpp b/DSView/pv/toolbars/titlebar.cpp index 6d7b58bb..306a417a 100755 --- a/DSView/pv/toolbars/titlebar.cpp +++ b/DSView/pv/toolbars/titlebar.cpp @@ -69,17 +69,17 @@ TitleBar::TitleBar(bool top, QWidget *parent, bool hasClose) : _lay->addWidget(_minimizeButton); _lay->addWidget(_maximizeButton); - connect(this, SIGNAL(normalShow() ), parent, SLOT(showNormal() ) ); - connect(this, SIGNAL( maximizedShow() ), parent, SLOT(showMaximized() ) ); - connect(_minimizeButton, SIGNAL( clicked() ), parent, SLOT(showMinimized() ) ); - connect(_maximizeButton, SIGNAL( clicked() ), this, SLOT(showMaxRestore() ) ); + connect(this, SIGNAL(normalShow()), parent, SLOT(showNormal())); + connect(this, SIGNAL( maximizedShow()), parent, SLOT(showMaximized())); + connect(_minimizeButton, SIGNAL( clicked()), parent, SLOT(showMinimized())); + connect(_maximizeButton, SIGNAL( clicked()), this, SLOT(showMaxRestore())); } if (_isTop || _hasClose) { _closeButton= new QToolButton(this); _closeButton->setObjectName("CloseButton"); _lay->addWidget(_closeButton); - connect(_closeButton, SIGNAL( clicked() ), parent, SLOT(close() ) ); + connect(_closeButton, SIGNAL( clicked()), parent, SLOT(close())); } _lay->insertStretch(0, 500); @@ -160,7 +160,7 @@ void TitleBar::setTitle(QString title) _title->setText(title); } -QString TitleBar::title() const +QString TitleBar::title() { return _title->text(); } diff --git a/DSView/pv/toolbars/titlebar.h b/DSView/pv/toolbars/titlebar.h index a216485b..97245223 100755 --- a/DSView/pv/toolbars/titlebar.h +++ b/DSView/pv/toolbars/titlebar.h @@ -39,7 +39,7 @@ public: ~TitleBar(); void setTitle(QString title); - QString title() const; + QString title(); private: void changeEvent(QEvent *event); diff --git a/DSView/pv/view/analogsignal.cpp b/DSView/pv/view/analogsignal.cpp index 605566ac..0368932f 100755 --- a/DSView/pv/view/analogsignal.cpp +++ b/DSView/pv/view/analogsignal.cpp @@ -47,8 +47,7 @@ const QColor AnalogSignal::SignalColours[4] = { const float AnalogSignal::EnvelopeThreshold = 16.0f; -AnalogSignal::AnalogSignal(DevInst *dev_inst, - boost::shared_ptr data, +AnalogSignal::AnalogSignal(DevInst *dev_inst,data::Analog *data, sr_channel *probe) : Signal(dev_inst, probe), _data(data), @@ -96,10 +95,8 @@ AnalogSignal::AnalogSignal(DevInst *dev_inst, } } -AnalogSignal::AnalogSignal(boost::shared_ptr s, - boost::shared_ptr data, - sr_channel *probe) : - Signal(*s.get(), probe), +AnalogSignal::AnalogSignal(view::AnalogSignal *s, pv::data::Analog *data, sr_channel *probe) : + Signal(*s, probe), _data(data), _rects(NULL), _hover_en(false), @@ -124,7 +121,7 @@ AnalogSignal::~AnalogSignal() } } -boost::shared_ptr AnalogSignal::data() const +pv::data::SignalData* AnalogSignal::data() { return _data; } @@ -134,27 +131,27 @@ void AnalogSignal::set_scale(int height) _scale = height / (_ref_max - _ref_min); } -float AnalogSignal::get_scale() const +float AnalogSignal::get_scale() { return _scale; } -int AnalogSignal::get_bits() const +int AnalogSignal::get_bits() { return _bits; } -double AnalogSignal::get_ref_min() const +double AnalogSignal::get_ref_min() { return _ref_min; } -double AnalogSignal::get_ref_max() const +double AnalogSignal::get_ref_max() { return _ref_max; } -int AnalogSignal::get_hw_offset() const +int AnalogSignal::get_hw_offset() { int hw_offset = 0; GVariant *gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_HW_OFFSET); @@ -205,13 +202,11 @@ bool AnalogSignal::measure(const QPointF &p) if (!window.contains(p)) return false; - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return false; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty()) return false; @@ -248,13 +243,11 @@ QPointF AnalogSignal::get_point(uint64_t index, float &value) if (!enabled()) return pt; - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return pt; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty()) return pt; @@ -288,7 +281,7 @@ QPointF AnalogSignal::get_point(uint64_t index, float &value) /** * Probe options **/ -uint64_t AnalogSignal::get_vdiv() const +uint64_t AnalogSignal::get_vdiv() { uint64_t vdiv = 0; GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_VDIV); @@ -299,7 +292,7 @@ uint64_t AnalogSignal::get_vdiv() const return vdiv; } -uint8_t AnalogSignal::get_acCoupling() const +uint8_t AnalogSignal::get_acCoupling() { uint64_t coupling = 0; GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_COUPLING); @@ -310,7 +303,7 @@ uint8_t AnalogSignal::get_acCoupling() const return coupling; } -bool AnalogSignal::get_mapDefault() const +bool AnalogSignal::get_mapDefault() { bool isDefault = true; GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_DEFAULT); @@ -321,7 +314,7 @@ bool AnalogSignal::get_mapDefault() const return isDefault; } -QString AnalogSignal::get_mapUnit() const +QString AnalogSignal::get_mapUnit() { QString unit; GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_UNIT); @@ -332,7 +325,7 @@ QString AnalogSignal::get_mapUnit() const return unit; } -double AnalogSignal::get_mapMin() const +double AnalogSignal::get_mapMin() { double min = -1; GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MIN); @@ -343,7 +336,7 @@ double AnalogSignal::get_mapMin() const return min; } -double AnalogSignal::get_mapMax() const +double AnalogSignal::get_mapMax() { double max = 1; GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MAX); @@ -354,7 +347,7 @@ double AnalogSignal::get_mapMax() const return max; } -uint64_t AnalogSignal::get_factor() const +uint64_t AnalogSignal::get_factor() { GVariant* gvar; uint64_t factor; @@ -369,24 +362,24 @@ uint64_t AnalogSignal::get_factor() const } } -int AnalogSignal::ratio2value(double ratio) const +int AnalogSignal::ratio2value(double ratio) { return ratio * (_ref_max - _ref_min) + _ref_min; } -int AnalogSignal::ratio2pos(double ratio) const +int AnalogSignal::ratio2pos(double ratio) { const int height = get_totalHeight(); const int top = get_y() - height * 0.5; return ratio * height + top; } -double AnalogSignal::value2ratio(int value) const +double AnalogSignal::value2ratio(int value) { return max(0.0, (value - _ref_min) / (_ref_max - _ref_min)); } -double AnalogSignal::pos2ratio(int pos) const +double AnalogSignal::pos2ratio(int pos) { const int height = get_totalHeight(); const int top = get_y() - height / 2; @@ -403,7 +396,7 @@ void AnalogSignal::set_zero_vpos(int pos) } } -int AnalogSignal::get_zero_vpos() const +int AnalogSignal::get_zero_vpos() { return ratio2pos(get_zero_ratio()); } @@ -418,12 +411,12 @@ void AnalogSignal::set_zero_ratio(double ratio) g_variant_new_uint16(_zero_offset)); } -double AnalogSignal::get_zero_ratio() const +double AnalogSignal::get_zero_ratio() { return value2ratio(_zero_offset); } -int AnalogSignal::get_zero_offset() const +int AnalogSignal::get_zero_offset() { return _zero_offset; } @@ -510,13 +503,11 @@ void AnalogSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QCol assert(scale > 0); const int64_t offset = _view->offset(); - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty()) return; @@ -571,7 +562,7 @@ void AnalogSignal::paint_fore(QPainter &p, int left, int right, QColor fore, QCo } void AnalogSignal::paint_trace(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::AnalogSnapshot *snapshot, int zeroY, const int start_pixel, const uint64_t start_index, const int64_t sample_count, const double samples_per_pixel, const int order, @@ -579,10 +570,12 @@ void AnalogSignal::paint_trace(QPainter &p, { (void)width; - const int64_t channel_num = snapshot->get_channel_num(); + pv::data::AnalogSnapshot *pshot = const_cast(snapshot); + + int64_t channel_num = (int64_t)pshot->get_channel_num(); if (sample_count > 0) { - const uint8_t unit_bytes = snapshot->get_unit_bytes(); - const uint8_t *const samples = snapshot->get_samples(0); + const uint8_t unit_bytes = pshot->get_unit_bytes(); + const uint8_t *const samples = pshot->get_samples(0); assert(samples); p.setPen(_colour); @@ -603,10 +596,10 @@ void AnalogSignal::paint_trace(QPainter &p, yvalue = zeroY + (yvalue - hw_offset) * _scale; yvalue = min(max(yvalue, top), bottom); *point++ = QPointF(x, yvalue); - if (yindex == snapshot->get_ring_end()) + if (yindex == pshot->get_ring_end()) break; yindex++; - yindex %= snapshot->get_sample_count(); + yindex %= pshot->get_sample_count(); x += pixels_per_sample; } p.drawPolyline(points, point - points); @@ -615,7 +608,7 @@ void AnalogSignal::paint_trace(QPainter &p, } void AnalogSignal::paint_envelope(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::AnalogSnapshot *snapshot, int zeroY, const int start_pixel, const uint64_t start_index, const int64_t sample_count, const double samples_per_pixel, const int order, @@ -623,9 +616,10 @@ void AnalogSignal::paint_envelope(QPainter &p, { using namespace Qt; using pv::data::AnalogSnapshot; + pv::data::AnalogSnapshot *pshot = const_cast(snapshot); AnalogSnapshot::EnvelopeSection e; - snapshot->get_envelope_section(e, start_index, sample_count, + pshot->get_envelope_section(e, start_index, sample_count, samples_per_pixel, order); if (e.samples_num == 0) return; @@ -640,7 +634,8 @@ void AnalogSignal::paint_envelope(QPainter &p, float y_min = zeroY, y_max = zeroY, pre_y_min = zeroY, pre_y_max = zeroY; int pcnt = 0; const double scale_pixels_per_samples = e.scale / samples_per_pixel; - const uint64_t ring_end = max((int64_t)0, (int64_t)snapshot->get_ring_end() / e.scale - 1); + int64_t end_v = pshot->get_ring_end(); + const uint64_t ring_end = max((int64_t)0, end_v / e.scale - 1); const int hw_offset = get_hw_offset(); float x = start_pixel; @@ -717,7 +712,7 @@ void AnalogSignal::paint_hover_measure(QPainter &p, QColor fore, QColor back) p.drawText(hover_rect, Qt::AlignCenter | Qt::AlignTop | Qt::TextDontClip, hover_str); } - list::iterator i = _view->get_cursorList().begin(); + auto i = _view->get_cursorList().begin(); while (i != _view->get_cursorList().end()) { float pt_value; const QPointF pt = get_point((*i)->index(), pt_value); diff --git a/DSView/pv/view/analogsignal.h b/DSView/pv/view/analogsignal.h index 401351eb..48f3d7f6 100755 --- a/DSView/pv/view/analogsignal.h +++ b/DSView/pv/view/analogsignal.h @@ -24,8 +24,7 @@ #define DSVIEW_PV_ANALOGSIGNAL_H #include "signal.h" - -#include + namespace pv { @@ -53,23 +52,21 @@ private: static const uint8_t DefaultBits = 8; public: - AnalogSignal(DevInst* dev_inst, - boost::shared_ptr data, - sr_channel *probe); - AnalogSignal(boost::shared_ptr s, - boost::shared_ptr data, + AnalogSignal(DevInst* dev_inst, pv::data::Analog *data, sr_channel *probe); + AnalogSignal(view::AnalogSignal* s, pv::data::Analog *data, sr_channel *probe); + virtual ~AnalogSignal(); - boost::shared_ptr data() const; + pv::data::SignalData* data(); void set_scale(int height); - float get_scale() const; - int get_bits() const; - double get_ref_min() const; - double get_ref_max() const; - int get_hw_offset() const; + float get_scale(); + int get_bits(); + double get_ref_min(); + double get_ref_max(); + int get_hw_offset(); int commit_settings(); /** @@ -83,30 +80,30 @@ public: /** * Probe options **/ - uint64_t get_vdiv() const; - uint8_t get_acCoupling() const; - bool get_mapDefault() const; - QString get_mapUnit() const; - double get_mapMin() const; - double get_mapMax() const; - uint64_t get_factor() const; + uint64_t get_vdiv(); + uint8_t get_acCoupling(); + bool get_mapDefault(); + QString get_mapUnit(); + double get_mapMin(); + double get_mapMax(); + uint64_t get_factor(); /** * **/ void set_zero_vpos(int pos); - int get_zero_vpos() const; + int get_zero_vpos(); void set_zero_ratio(double ratio); - double get_zero_ratio() const; - int get_zero_offset() const; + double get_zero_ratio(); + int get_zero_offset(); /** * */ - int ratio2value(double ratio) const; - int ratio2pos(double ratio) const; - double value2ratio(int value) const; - double pos2ratio(int pos) const; + int ratio2value(double ratio); + int ratio2pos(double ratio); + double value2ratio(int value); + double pos2ratio(int pos); /** * Event @@ -139,14 +136,14 @@ public: private: void paint_trace(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::AnalogSnapshot *snapshot, int zeroY, const int start_pixel, const uint64_t start_index, const int64_t sample_count, const double samples_per_pixel, const int order, const float top, const float bottom, const int width); void paint_envelope(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::AnalogSnapshot *snapshot, int zeroY, const int start_pixel, const uint64_t start_index, const int64_t sample_count, const double samples_per_pixel, const int order, @@ -155,7 +152,7 @@ private: void paint_hover_measure(QPainter &p, QColor fore, QColor back); private: - boost::shared_ptr _data; + pv::data::Analog *_data; QRectF *_rects; diff --git a/DSView/pv/view/cursor.cpp b/DSView/pv/view/cursor.cpp index 7c136567..eca057ca 100755 --- a/DSView/pv/view/cursor.cpp +++ b/DSView/pv/view/cursor.cpp @@ -57,7 +57,7 @@ Cursor::Cursor(View &view, QColor color, uint64_t index) : { } -QRect Cursor::get_label_rect(const QRect &rect, bool &visible, bool has_hoff) const +QRect Cursor::get_label_rect(const QRect &rect, bool &visible, bool has_hoff) { const double samples_per_pixel = _view.session().cur_snap_samplerate() * _view.scale(); const double cur_offset = _index / samples_per_pixel; @@ -79,7 +79,7 @@ QRect Cursor::get_label_rect(const QRect &rect, bool &visible, bool has_hoff) co return QRect(x - label_size.width() / 2, top, label_size.width(), height); } -QRect Cursor::get_close_rect(const QRect &rect) const +QRect Cursor::get_close_rect(const QRect &rect) { return QRect(rect.right() - CloseSize, rect.top(), CloseSize, CloseSize); } diff --git a/DSView/pv/view/cursor.h b/DSView/pv/view/cursor.h index 2a33a8f2..6e8292fc 100755 --- a/DSView/pv/view/cursor.h +++ b/DSView/pv/view/cursor.h @@ -65,9 +65,9 @@ public: * @param rect The rectangle of the ruler client area. * @return Returns the label rectangle. */ - QRect get_label_rect(const QRect &rect, bool &visible, bool has_hoff = true) const; + QRect get_label_rect(const QRect &rect, bool &visible, bool has_hoff = true); - QRect get_close_rect(const QRect &rect) const; + QRect get_close_rect(const QRect &rect); /** * Paints the cursor's label to the ruler. diff --git a/DSView/pv/view/decodetrace.cpp b/DSView/pv/view/decodetrace.cpp index 07816c28..babe8024 100755 --- a/DSView/pv/view/decodetrace.cpp +++ b/DSView/pv/view/decodetrace.cpp @@ -116,7 +116,7 @@ const QString DecodeTrace::RegionStart = QT_TR_NOOP("Start"); const QString DecodeTrace::RegionEnd = QT_TR_NOOP("End "); DecodeTrace::DecodeTrace(pv::SigSession *session, - boost::shared_ptr decoder_stack, int index) : + pv::data::DecoderStack *decoder_stack, int index) : Trace(QString::fromUtf8( decoder_stack->stack().front()->decoder()->name), index, SR_CHANNEL_DECODER), _session(session), @@ -134,9 +134,9 @@ DecodeTrace::DecodeTrace(pv::SigSession *session, _colour = DecodeColours[index % countof(DecodeColours)]; - connect(_decoder_stack.get(), SIGNAL(new_decode_data()), + connect(_decoder_stack, SIGNAL(new_decode_data()), this, SLOT(on_new_decode_data())); - connect(_decoder_stack.get(), SIGNAL(decode_done()), + connect(_decoder_stack, SIGNAL(decode_done()), this, SLOT(on_decode_done())); _start_comboBox = NULL; @@ -156,12 +156,12 @@ DecodeTrace::~DecodeTrace() } } -bool DecodeTrace::enabled() const +bool DecodeTrace::enabled() { return true; } -const boost::shared_ptr& DecodeTrace::decoder() const +pv::data::DecoderStack* DecodeTrace::decoder() { return _decoder_stack; } @@ -311,7 +311,7 @@ void DecodeTrace::paint_mid(QPainter &p, int left, int right, QColor fore, QColo if ((max_annWidth > 100) || (max_annWidth > 10 && min_annWidth > 1) || (max_annWidth == 0 && samples_per_pixel < 10)) { - vector annotations; + std::vector annotations; _decoder_stack->get_annotation_subset(annotations, row, start_sample, end_sample); @@ -410,7 +410,7 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form) _probe_selectors.clear(); _decoder_forms.clear(); - list< boost::shared_ptr >& stack = _decoder_stack->stack(); + auto &stack = _decoder_stack->stack(); if (stack.empty()) { QLabel *const l = new QLabel( @@ -492,7 +492,7 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form) void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a, QPainter &p, QColor text_color, int h, int left, int right, double samples_per_pixel, double pixels_offset, int y, - size_t base_colour, double min_annWidth, QColor fore, QColor back) const + size_t base_colour, double min_annWidth, QColor fore, QColor back) { const double start = max(a.start_sample() / samples_per_pixel - pixels_offset, (double)left); @@ -537,11 +537,12 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a, if ((type == SRD_CHANNEL_COMMON) || ((type%100 != a.type()%100) && (type%100 != 0))) continue; - boost::shared_ptr logic_sig; + + LogicSignal *logic_sig = NULL; for(auto &sig : _session->get_signals()) { if((sig->get_index() == iter.second) && - (logic_sig = dynamic_pointer_cast(sig))) { + (logic_sig = dynamic_cast(sig))) { logic_sig->paint_mark(p, start, end, type/100); break; } @@ -554,7 +555,7 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a, void DecodeTrace::draw_nodetail(QPainter &p, int h, int left, int right, int y, - size_t base_colour, QColor fore, QColor back) const + size_t base_colour, QColor fore, QColor back) { (void)base_colour; (void)back; @@ -578,7 +579,7 @@ void DecodeTrace::draw_nodetail(QPainter &p, } void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter &p, - QColor fill, QColor outline, QColor text_color, int h, double x, int y, double min_annWidth) const + QColor fill, QColor outline, QColor text_color, int h, double x, int y, double min_annWidth) { (void)outline; @@ -603,13 +604,13 @@ void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter & void DecodeTrace::draw_range(const pv::data::decode::Annotation &a, QPainter &p, QColor fill, QColor outline, QColor text_color, int h, double start, - double end, int y, QColor fore, QColor back) const + double end, int y, QColor fore, QColor back) { (void)fore; const double top = y + .5 - h / 2; const double bottom = y + .5 + h / 2; - const vector annotations = a.annotations(); + const std::vector annotations = a.annotations(); p.setPen(outline); p.setBrush(fill); @@ -708,13 +709,15 @@ void DecodeTrace::draw_unshown_row(QPainter &p, int y, int h, int left, } void DecodeTrace::create_decoder_form( - boost::shared_ptr &decoder_stack, - boost::shared_ptr &dec, QWidget *parent, + pv::data::DecoderStack *decoder_stack, + data::decode::Decoder *dec, QWidget *parent, QFormLayout *form) { const GSList *l; assert(dec); + assert(decoder_stack); + const srd_decoder *const decoder = dec->decoder(); assert(decoder); @@ -756,8 +759,7 @@ void DecodeTrace::create_decoder_form( } // Add the options - boost::shared_ptr binding( - new prop::binding::DecoderOptions(decoder_stack, dec)); + auto binding = new prop::binding::DecoderOptions(decoder_stack, dec); binding->add_properties_to_form(decoder_form, true); _bindings.push_back(binding); @@ -765,41 +767,43 @@ void DecodeTrace::create_decoder_form( // pv::widgets::DecoderGroupBox *const group = new pv::widgets::DecoderGroupBox(decoder_stack, dec, decoder_form, parent); - connect(group, SIGNAL(del_stack(boost::shared_ptr&)), - this, SLOT(on_del_stack(boost::shared_ptr&))); + + connect(group, SIGNAL(del_stack(data::decode::Decoder*)), + this, SLOT(on_del_stack(data::decode::Decoder*))); form->addRow(group); _decoder_forms.push_back(group); } QComboBox* DecodeTrace::create_probe_selector( - QWidget *parent, const boost::shared_ptr &dec, + QWidget *parent, const data::decode::Decoder *dec, const srd_channel *const pdch) { assert(dec); - const vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); assert(_decoder_stack); - const map::const_iterator probe_iter = - dec->channels().find(pdch); + data::decode::Decoder *_dec = const_cast(dec); + + auto probe_iter = _dec->channels().find(pdch); QComboBox *selector = new QComboBox(parent); selector->addItem("-", QVariant::fromValue(-1)); - if (probe_iter == dec->channels().end()) + if (probe_iter == _dec->channels().end()) selector->setCurrentIndex(0); for(size_t i = 0; i < sigs.size(); i++) { - const boost::shared_ptr s(sigs[i]); + const auto s = sigs[i]; assert(s); - if (dynamic_pointer_cast(s) && s->enabled()) + if (dynamic_cast(s) && s->enabled()) { selector->addItem(s->get_name(), QVariant::fromValue(s->get_index())); - if (probe_iter != dec->channels().end()) { + if (probe_iter != _dec->channels().end()) { if ((*probe_iter).second == s->get_index()) selector->setCurrentIndex(i + 1); } @@ -809,12 +813,12 @@ QComboBox* DecodeTrace::create_probe_selector( return selector; } -void DecodeTrace::commit_decoder_probes(boost::shared_ptr &dec) +void DecodeTrace::commit_decoder_probes(data::decode::Decoder *dec) { assert(dec); - map probe_map; - const vector< boost::shared_ptr > sigs(_session->get_signals()); + std::map probe_map; + const auto &sigs = _session->get_signals(); _index_list.clear(); for(auto &s : _probe_selectors) @@ -863,7 +867,7 @@ void DecodeTrace::on_new_decode_data() _view->signals_changed(); } -int DecodeTrace::get_progress() const +int DecodeTrace::get_progress() { return _progress; } @@ -892,19 +896,18 @@ void DecodeTrace::on_stack_decoder(srd_decoder *decoder) { assert(decoder); assert(_decoder_stack); - _decoder_stack->push(boost::shared_ptr( - new data::decode::Decoder(decoder))); - //_decoder_stack->begin_decode(); + _decoder_stack->push(new data::decode::Decoder(decoder)); + create_popup_form(); } -void DecodeTrace::on_del_stack(boost::shared_ptr &dec) +void DecodeTrace::on_del_stack(data::decode::Decoder *dec) { assert(dec); assert(_decoder_stack); - _decoder_stack->remove(dec); + _decoder_stack->remove(dec); create_popup_form(); } @@ -915,10 +918,12 @@ int DecodeTrace::rows_size() int size = 0; for(auto &dec : _decoder_stack->stack()) { if (dec->shown()) { - const std::map rows = _decoder_stack->get_rows_gshow(); - for (std::map::const_iterator i = rows.begin(); - i != rows.end(); i++) { - if ((*i).first.decoder() == dec->decoder() && + + auto rows = _decoder_stack->get_rows_gshow(); + + for (auto i = rows.begin(); i != rows.end(); i++) { + pv::data::decode::Row _row = (*i).first; + if (_row.decoder() == dec->decoder() && _decoder_stack->has_annotations((*i).first) && (*i).second) size++; diff --git a/DSView/pv/view/decodetrace.h b/DSView/pv/view/decodetrace.h index 19e8015f..d2d59f37 100755 --- a/DSView/pv/view/decodetrace.h +++ b/DSView/pv/view/decodetrace.h @@ -30,8 +30,6 @@ #include #include -#include - #include #include "../dialogs/dsdialog.h" @@ -68,7 +66,7 @@ private: struct ProbeSelector { const QComboBox *_combo; - const boost::shared_ptr _decoder; + const pv::data::decode::Decoder *_decoder; const srd_channel *_pdch; }; @@ -98,13 +96,13 @@ private: public: DecodeTrace(pv::SigSession *session, - boost::shared_ptr decoder_stack, + pv::data::DecoderStack *decoder_stack, int index); ~DecodeTrace(); - bool enabled() const; + bool enabled(); - const boost::shared_ptr& decoder() const; + pv::data::DecoderStack* decoder(); void set_view(pv::view::View *view); @@ -143,7 +141,7 @@ public: **/ void frame_ended(); - int get_progress() const; + int get_progress(); protected: void paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore); @@ -156,18 +154,18 @@ private: void draw_annotation(const pv::data::decode::Annotation &a, QPainter &p, QColor text_colour, int text_height, int left, int right, double samples_per_pixel, double pixels_offset, int y, - size_t base_colour, double min_annWidth, QColor fore, QColor back) const; + size_t base_colour, double min_annWidth, QColor fore, QColor back); void draw_nodetail(QPainter &p, int text_height, int left, int right, int y, - size_t base_colour, QColor fore, QColor back) const; + size_t base_colour, QColor fore, QColor back); void draw_instant(const pv::data::decode::Annotation &a, QPainter &p, QColor fill, QColor outline, QColor text_color, int h, double x, - int y, double min_annWidth) const; + int y, double min_annWidth); void draw_range(const pv::data::decode::Annotation &a, QPainter &p, QColor fill, QColor outline, QColor text_color, int h, double start, - double end, int y, QColor fore, QColor back) const; + double end, int y, QColor fore, QColor back); void draw_error(QPainter &p, const QString &message, int left, int right); @@ -175,16 +173,16 @@ private: void draw_unshown_row(QPainter &p, int y, int h, int left, int right, QString info, QColor fore, QColor back); - void create_decoder_form(boost::shared_ptr &decoder_stack, - boost::shared_ptr &dec, + void create_decoder_form(data::DecoderStack *decoder_stack, + pv::data::decode::Decoder *dec, QWidget *parent, QFormLayout *form); QComboBox* create_probe_selector(QWidget *parent, - const boost::shared_ptr &dec, + const pv::data::decode::Decoder *dec, const srd_channel *const pdch); void commit_decoder_probes( - boost::shared_ptr &dec); + data::decode::Decoder *dec); void commit_probes(); @@ -199,32 +197,34 @@ private slots: void on_probe_selected(int); void on_stack_decoder(srd_decoder *decoder); - void on_del_stack(boost::shared_ptr &dec); + + void on_del_stack(data::decode::Decoder *dec); void on_decode_done(); void on_region_set(int index); private: - pv::SigSession *_session; - boost::shared_ptr _decoder_stack; + pv::SigSession *_session; + pv::data::DecoderStack *_decoder_stack; - uint64_t _decode_start, _decode_end; - int _start_index, _end_index; - int _start_count, _end_count; - QComboBox *_start_comboBox, *_end_comboBox; - QFormLayout *_pub_input_layer; - int _progress; - - std::list< boost::shared_ptr > - _bindings; + uint64_t _decode_start; + uint64_t _decode_end; + int _start_index; + int _end_index; + int _start_count; + int _end_count; + QComboBox *_start_comboBox; + QComboBox *_end_comboBox; + QFormLayout *_pub_input_layer; + int _progress; + std::list _bindings; std::list _probe_selectors; std::vector _decoder_forms; - std::vector _cur_row_headings; - - dialogs::DSDialog *_popup; + std::vector _cur_row_headings; + dialogs::DSDialog *_popup; }; } // namespace view diff --git a/DSView/pv/view/devmode.cpp b/DSView/pv/view/devmode.cpp index e34408b6..48e36f81 100755 --- a/DSView/pv/view/devmode.cpp +++ b/DSView/pv/view/devmode.cpp @@ -35,9 +35,7 @@ #include #include #include "../config/appconfig.h" - -using boost::shared_ptr; -using namespace std; + namespace pv { namespace view { diff --git a/DSView/pv/view/devmode.h b/DSView/pv/view/devmode.h index ae26e53c..d5c9fc1e 100755 --- a/DSView/pv/view/devmode.h +++ b/DSView/pv/view/devmode.h @@ -22,10 +22,7 @@ #ifndef DSVIEW_PV_VIEW_DEVMODE_H #define DSVIEW_PV_VIEW_DEVMODE_H - -#include -#include - + #include #include #include diff --git a/DSView/pv/view/dsldial.cpp b/DSView/pv/view/dsldial.cpp index 618817b1..86fa462e 100755 --- a/DSView/pv/view/dsldial.cpp +++ b/DSView/pv/view/dsldial.cpp @@ -119,12 +119,12 @@ void dslDial::set_sel(uint64_t sel) _sel = sel; } -uint64_t dslDial::get_sel() const +uint64_t dslDial::get_sel() { return _sel; } -uint64_t dslDial::get_count() const +uint64_t dslDial::get_count() { return _div; } @@ -145,22 +145,22 @@ bool dslDial::isMax() return false; } -uint64_t dslDial::get_min() const +uint64_t dslDial::get_min() { return _value[0]; } -uint64_t dslDial::get_max() const +uint64_t dslDial::get_max() { return _value[_div-1]; } -uint64_t dslDial::get_value() const +uint64_t dslDial::get_value() { return _value[_sel]; } -uint64_t dslDial::get_value(uint64_t i) const +uint64_t dslDial::get_value(uint64_t i) { assert(i < _div); return _value[i]; @@ -179,7 +179,7 @@ void dslDial::set_factor(uint64_t factor) } } -uint64_t dslDial::get_factor() const +uint64_t dslDial::get_factor() { return _factor; } diff --git a/DSView/pv/view/dsldial.h b/DSView/pv/view/dsldial.h index 120b491c..9c0895c9 100755 --- a/DSView/pv/view/dsldial.h +++ b/DSView/pv/view/dsldial.h @@ -50,23 +50,23 @@ public: // set/get current select void set_sel(uint64_t sel); - uint64_t get_sel() const; - uint64_t get_count() const; + uint64_t get_sel(); + uint64_t get_count(); // boundary detection bool isMin(); bool isMax(); - uint64_t get_min() const; - uint64_t get_max() const; + uint64_t get_min(); + uint64_t get_max(); // get current value - uint64_t get_value() const; - uint64_t get_value(uint64_t i) const; + uint64_t get_value(); + uint64_t get_value(uint64_t i); void set_value(uint64_t value); // set/get factor void set_factor(uint64_t factor); - uint64_t get_factor() const; + uint64_t get_factor(); private: uint64_t _div; diff --git a/DSView/pv/view/dsosignal.cpp b/DSView/pv/view/dsosignal.cpp index 7a295c5c..3a33628e 100755 --- a/DSView/pv/view/dsosignal.cpp +++ b/DSView/pv/view/dsosignal.cpp @@ -57,7 +57,7 @@ const QColor DsoSignal::SignalColours[4] = { const float DsoSignal::EnvelopeThreshold = 256.0f; DsoSignal::DsoSignal(DevInst *dev_inst, - boost::shared_ptr data, + data::Dso *data, sr_channel *probe): Signal(dev_inst, probe), _data(data), @@ -108,12 +108,12 @@ DsoSignal::~DsoSignal() { } -boost::shared_ptr DsoSignal::data() const +pv::data::SignalData* DsoSignal::data() { return _data; } -boost::shared_ptr DsoSignal::dso_data() const +pv::data::Dso* DsoSignal::dso_data() { return _data; } @@ -133,17 +133,17 @@ uint8_t DsoSignal::get_bits() return _bits; } -double DsoSignal::get_ref_min() const +double DsoSignal::get_ref_min() { return _ref_min; } -double DsoSignal::get_ref_max() const +double DsoSignal::get_ref_max() { return _ref_max; } -int DsoSignal::get_name_width() const +int DsoSignal::get_name_width() { return 0; } @@ -193,7 +193,7 @@ void DsoSignal::set_enable(bool enable) _en_lock = false; } -bool DsoSignal::get_vDialActive() const +bool DsoSignal::get_vDialActive() { return _vDialActive; } @@ -400,22 +400,22 @@ int DsoSignal::commit_settings() return ret; } -dslDial * DsoSignal::get_vDial() const +dslDial * DsoSignal::get_vDial() { return _vDial; } -uint64_t DsoSignal::get_vDialValue() const +uint64_t DsoSignal::get_vDialValue() { return _vDial->get_value(); } -uint16_t DsoSignal::get_vDialSel() const +uint16_t DsoSignal::get_vDialSel() { return _vDial->get_sel(); } -uint8_t DsoSignal::get_acCoupling() const +uint8_t DsoSignal::get_acCoupling() { return _acCoupling; } @@ -429,27 +429,27 @@ void DsoSignal::set_acCoupling(uint8_t coupling) } } -int DsoSignal::ratio2value(double ratio) const +int DsoSignal::ratio2value(double ratio) { return ratio * (_ref_max - _ref_min) + _ref_min; } -int DsoSignal::ratio2pos(double ratio) const +int DsoSignal::ratio2pos(double ratio) { return ratio * get_view_rect().height() + get_view_rect().top(); } -double DsoSignal::value2ratio(int value) const +double DsoSignal::value2ratio(int value) { return max(0.0, (value - _ref_min) / (_ref_max - _ref_min)); } -double DsoSignal::pos2ratio(int pos) const +double DsoSignal::pos2ratio(int pos) { return min(max(pos - get_view_rect().top(), 0), get_view_rect().height()) * 1.0 / get_view_rect().height(); } -double DsoSignal::get_trig_vrate() const +double DsoSignal::get_trig_vrate() { if (_dev_inst->name() == "DSLogic") return value2ratio(_trig_value - ratio2value(0.5)) + get_zero_ratio(); @@ -485,17 +485,17 @@ void DsoSignal::set_trig_ratio(double ratio, bool delta_change) g_variant_new_byte(_trig_value)); } -int DsoSignal::get_zero_vpos() const +int DsoSignal::get_zero_vpos() { return ratio2pos(get_zero_ratio()); } -double DsoSignal::get_zero_ratio() const +double DsoSignal::get_zero_ratio() { return value2ratio(_zero_offset); } -int DsoSignal::get_hw_offset() const +int DsoSignal::get_hw_offset() { int hw_offset = 0; GVariant *gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_HW_OFFSET); @@ -564,7 +564,7 @@ void DsoSignal::set_show(bool show) _show = show; } -bool DsoSignal::show() const +bool DsoSignal::show() { return _show; } @@ -692,7 +692,7 @@ QString DsoSignal::get_measure(enum DSO_MEASURE_TYPE type) return mString; } -QRect DsoSignal::get_view_rect() const +QRect DsoSignal::get_view_rect() { assert(_viewport); return QRect(0, UpMargin, @@ -704,12 +704,11 @@ void DsoSignal::paint_prepare() { assert(_view); - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return; - const boost::shared_ptr &snapshot = - snapshots.front(); + + const auto snapshot = snapshots.front(); if (snapshot->empty()) return; @@ -847,12 +846,11 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor assert(scale > 0); const int64_t offset = _view->offset(); - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return; - const boost::shared_ptr &snapshot = - snapshots.front(); + + const auto snapshot = snapshots.front(); if (snapshot->empty()) return; @@ -1018,7 +1016,7 @@ void DsoSignal::paint_fore(QPainter &p, int left, int right, QColor fore, QColor } } -QRectF DsoSignal::get_trig_rect(int left, int right) const +QRectF DsoSignal::get_trig_rect(int left, int right) { (void)left; @@ -1028,14 +1026,16 @@ QRectF DsoSignal::get_trig_rect(int left, int right) const } void DsoSignal::paint_trace(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::DsoSnapshot *snapshot, int zeroY, int left, const int64_t start, const int64_t end, int hw_offset, const double pixels_offset, const double samples_per_pixel, uint64_t num_channels) { const int64_t sample_count = end - start + 1; if (sample_count > 0) { - const uint8_t *const samples = snapshot->get_samples(start, end, get_index()); + pv::data::DsoSnapshot *pshot = const_cast(snapshot); + auto pdata = pshot->get_samples(start, end, get_index()); + const uint8_t *const samples = pdata; assert(samples); QColor trace_colour = _colour; @@ -1073,16 +1073,18 @@ void DsoSignal::paint_trace(QPainter &p, } void DsoSignal::paint_envelope(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::DsoSnapshot *snapshot, int zeroY, int left, const int64_t start, const int64_t end, int hw_offset, const double pixels_offset, const double samples_per_pixel, uint64_t num_channels) { using namespace Qt; using pv::data::DsoSnapshot; + data::DsoSnapshot *pshot = const_cast(snapshot); + DsoSnapshot::EnvelopeSection e; const uint16_t index = get_index() % num_channels; - snapshot->get_envelope_section(e, start, end, samples_per_pixel, index); + pshot->get_envelope_section(e, start, end, samples_per_pixel, index); if (e.length < 2) return; @@ -1332,7 +1334,7 @@ void DsoSignal::paint_hover_measure(QPainter &p, QColor fore, QColor back) p.drawText(hover_rect, Qt::AlignCenter | Qt::AlignTop | Qt::TextDontClip, hover_str); } - list::iterator i = _view->get_cursorList().begin(); + auto i = _view->get_cursorList().begin(); while (i != _view->get_cursorList().end()) { float pt_value; const QPointF pt = get_point((*i)->index(), pt_value); @@ -1477,13 +1479,11 @@ bool DsoSignal::measure(const QPointF &p) if (!window.contains(p)) return false; - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return false; - const boost::shared_ptr &snapshot = - snapshots.front(); + auto snapshot = const_cast(snapshots.front()); if (snapshot->empty()) return false; @@ -1514,13 +1514,11 @@ QPointF DsoSignal::get_point(uint64_t index, float &value) if (!enabled()) return pt; - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return pt; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty()) return pt; @@ -1543,13 +1541,11 @@ double DsoSignal::get_voltage(uint64_t index) if (!enabled()) return 1; - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return 1; - const boost::shared_ptr &snapshot = - snapshots.front(); + auto snapshot = const_cast(snapshots.front()); if (snapshot->empty()) return 1; diff --git a/DSView/pv/view/dsosignal.h b/DSView/pv/view/dsosignal.h index 50d079a9..2cdd8bde 100755 --- a/DSView/pv/view/dsosignal.h +++ b/DSView/pv/view/dsosignal.h @@ -24,11 +24,8 @@ #define DSVIEW_PV_DSOSIGNAL_H #include "signal.h" - -#include - + namespace pv { - namespace data { class Logic; class Dso; @@ -87,46 +84,45 @@ private: static const uint16_t MS_RectHeight = 25; public: - DsoSignal(DevInst* dev_inst, - boost::shared_ptr data, + DsoSignal(DevInst* dev_inst, pv::data::Dso *data, sr_channel *probe); virtual ~DsoSignal(); - boost::shared_ptr data() const; - boost::shared_ptr dso_data() const; + pv::data::SignalData* data(); + pv::data::Dso* dso_data(); void set_scale(int height); float get_scale(); uint8_t get_bits(); - double get_ref_min() const; - double get_ref_max() const; + double get_ref_min(); + double get_ref_max(); - int get_name_width() const; + int get_name_width(); /** * */ void set_enable(bool enable); - bool get_vDialActive() const; + bool get_vDialActive(); void set_vDialActive(bool active); bool go_vDialPre(bool manul); bool go_vDialNext(bool manul); bool update_capture(bool instant); - dslDial *get_vDial() const; - uint64_t get_vDialValue() const; - uint16_t get_vDialSel() const; - uint8_t get_acCoupling() const; + dslDial *get_vDial(); + uint64_t get_vDialValue(); + uint16_t get_vDialSel(); + uint8_t get_acCoupling(); void set_acCoupling(uint8_t coupling); void set_trig_vpos(int pos, bool delta_change = true); void set_trig_ratio(double ratio, bool delta_change = true); - double get_trig_vrate() const; + double get_trig_vrate(); void set_factor(uint64_t factor); uint64_t get_factor(); void set_show(bool show); - bool show() const; + bool show(); void set_mValid(bool valid); bool load_settings(); @@ -150,9 +146,9 @@ public: /** * Gets the mid-Y position of this signal. */ - int get_zero_vpos() const; - double get_zero_ratio() const; - int get_hw_offset() const; + int get_zero_vpos(); + double get_zero_ratio(); + int get_hw_offset(); /** * Sets the mid-Y position of this signal. */ @@ -165,10 +161,10 @@ public: /** * */ - int ratio2value(double ratio) const; - int ratio2pos(double ratio) const; - double value2ratio(int value) const; - double pos2ratio(int pos) const; + int ratio2value(double ratio); + int ratio2pos(double ratio); + double value2ratio(int value); + double pos2ratio(int pos); /** * paint prepare @@ -199,9 +195,9 @@ public: **/ void paint_fore(QPainter &p, int left, int right, QColor fore, QColor back); - QRect get_view_rect() const; + QRect get_view_rect(); - QRectF get_trig_rect(int left, int right) const; + QRectF get_trig_rect(int left, int right); QString get_measure(enum DSO_MEASURE_TYPE type); @@ -217,13 +213,13 @@ protected: private: void paint_trace(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::DsoSnapshot* snapshot, int zeroY, int left, const int64_t start, const int64_t end, int hw_offset, const double pixels_offset, const double samples_per_pixel, uint64_t num_channels); void paint_envelope(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::DsoSnapshot *snapshot, int zeroY, int left, const int64_t start, const int64_t end, int hw_offset, const double pixels_offset, const double samples_per_pixel, uint64_t num_channels); @@ -232,7 +228,7 @@ private: void auto_set(); private: - boost::shared_ptr _data; + pv::data::Dso *_data; float _scale; bool _en_lock; bool _show; diff --git a/DSView/pv/view/groupsignal.cpp b/DSView/pv/view/groupsignal.cpp index 1e67f654..0c5870aa 100755 --- a/DSView/pv/view/groupsignal.cpp +++ b/DSView/pv/view/groupsignal.cpp @@ -42,7 +42,7 @@ const QColor GroupSignal::SignalColours[4] = { const float GroupSignal::EnvelopeThreshold = 256.0f; -GroupSignal::GroupSignal(QString name, boost::shared_ptr data, +GroupSignal::GroupSignal(QString name, data::Group *data, std::list probe_index_list, int group_index) : Trace(name, probe_index_list, SR_CHANNEL_GROUP, group_index), _data(data) @@ -55,12 +55,12 @@ GroupSignal::~GroupSignal() { } -bool GroupSignal::enabled() const +bool GroupSignal::enabled() { return true; } -boost::shared_ptr GroupSignal::data() const +pv::data::SignalData* GroupSignal::data() { return _data; } @@ -85,13 +85,11 @@ void GroupSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColo _scale = _totalHeight * 1.0f / std::pow(2.0, static_cast(_index_list.size())); - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return; - const boost::shared_ptr &snapshot = - snapshots.at(_sec_index); + const auto snapshot = snapshots.at(_sec_index); const double pixels_offset = offset; const double samplerate = _data->samplerate(); @@ -116,13 +114,15 @@ void GroupSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColo } void GroupSignal::paint_trace(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::GroupSnapshot *snapshot, int y, int left, const int64_t start, const int64_t end, const double pixels_offset, const double samples_per_pixel) { const int64_t sample_count = end - start; - const uint16_t *samples = snapshot->get_samples(start, end); + pv::data::GroupSnapshot *pshot = const_cast(snapshot); + + const uint16_t *samples = pshot->get_samples(start, end); assert(samples); p.setPen(_colour); @@ -144,7 +144,7 @@ void GroupSignal::paint_trace(QPainter &p, } void GroupSignal::paint_envelope(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::GroupSnapshot *snapshot, int y, int left, const int64_t start, const int64_t end, const double pixels_offset, const double samples_per_pixel) { @@ -152,7 +152,9 @@ void GroupSignal::paint_envelope(QPainter &p, using pv::data::GroupSnapshot; GroupSnapshot::EnvelopeSection e; - snapshot->get_envelope_section(e, start, end, samples_per_pixel); + + pv::data::GroupSnapshot *pshot = const_cast(snapshot); + pshot->get_envelope_section(e, start, end, samples_per_pixel); if (e.length < 2) return; diff --git a/DSView/pv/view/groupsignal.h b/DSView/pv/view/groupsignal.h index 76f1a20f..a86c388e 100755 --- a/DSView/pv/view/groupsignal.h +++ b/DSView/pv/view/groupsignal.h @@ -26,8 +26,7 @@ #include "signal.h" #include "../data/groupsnapshot.h" -#include -#include +#include namespace pv { @@ -55,7 +54,7 @@ private: public: GroupSignal(QString name, - boost::shared_ptr data, + pv::data::Group *data, std::list probe_index_list, int group_index); virtual ~GroupSignal(); @@ -63,9 +62,9 @@ public: /** * Returns true if the trace is visible and enabled. */ - bool enabled() const; + bool enabled(); - boost::shared_ptr data() const; + pv::data::SignalData* data(); void set_scale(float scale); @@ -84,17 +83,17 @@ protected: private: void paint_trace(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::GroupSnapshot *snapshot, int y, int left, const int64_t start, const int64_t end, const double pixels_offset, const double samples_per_pixel); void paint_envelope(QPainter &p, - const boost::shared_ptr &snapshot, + const pv::data::GroupSnapshot *snapshot, int y, int left, const int64_t start, const int64_t end, const double pixels_offset, const double samples_per_pixel); private: - boost::shared_ptr _data; + pv::data::Group *_data; float _scale; }; diff --git a/DSView/pv/view/header.cpp b/DSView/pv/view/header.cpp index c5c44314..e5244e67 100755 --- a/DSView/pv/view/header.cpp +++ b/DSView/pv/view/header.cpp @@ -99,13 +99,10 @@ int Header::get_nameEditWidth() return 0; } -boost::shared_ptr Header::get_mTrace( - int &action, - const QPoint &pt) +pv::view::Trace* Header::get_mTrace(int &action, const QPoint &pt) { const int w = width(); - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); + const auto &traces = _view.get_traces(ALL_VIEW); for(auto &t : traces) { @@ -115,7 +112,7 @@ boost::shared_ptr Header::get_mTrace( return t; } - return boost::shared_ptr(); + return NULL; } void Header::paintEvent(QPaintEvent*) @@ -128,10 +125,7 @@ void Header::paintEvent(QPaintEvent*) style()->drawPrimitive(QStyle::PE_Widget, &o, &painter, this); const int w = width(); - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); - - // auto num = traces.size(); + const auto &traces = _view.get_traces(ALL_VIEW); const bool dragging = !_drag_traces.empty(); QColor fore(QWidget::palette().color(QWidget::foregroundRole())); @@ -140,7 +134,6 @@ void Header::paintEvent(QPaintEvent*) for(auto &t : traces) { assert(t); - // auto ptr = t.get(); t->paint_label(painter, w, dragging ? QPoint(-1, -1) : _mouse_point, fore); } @@ -151,8 +144,7 @@ void Header::mouseDoubleClickEvent(QMouseEvent *event) { assert(event); - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); + const auto &traces = _view.get_traces(ALL_VIEW); if (event->button() & Qt::LeftButton) { _mouse_down_point = event->pos(); @@ -175,8 +167,7 @@ void Header::mousePressEvent(QMouseEvent *event) { assert(event); - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); + const auto &traces = _view.get_traces(ALL_VIEW); int action; const bool instant = _view.session().get_instant(); if (instant && _view.session().get_capture_state() == SigSession::Running) { @@ -193,8 +184,7 @@ void Header::mousePressEvent(QMouseEvent *event) make_pair(t, t->get_v_offset())); // Select the Trace if it has been clicked - const boost::shared_ptr mTrace = - get_mTrace(action, event->pos()); + const auto mTrace = get_mTrace(action, event->pos()); if (action == Trace::COLOR && mTrace) { _colorFlag = true; } else if (action == Trace::NAME && mTrace) { @@ -229,8 +219,7 @@ void Header::mouseReleaseEvent(QMouseEvent *event) // judge for color / name / trigger / move int action; - const boost::shared_ptr mTrace = - get_mTrace(action, event->pos()); + const auto mTrace = get_mTrace(action, event->pos()); if (mTrace){ if (action == Trace::COLOR && _colorFlag) { _context_trace = mTrace; @@ -247,10 +236,11 @@ void Header::mouseReleaseEvent(QMouseEvent *event) _view.signals_changed(); _view.set_all_update(true); - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); - for(auto &t : traces) + const auto &traces = _view.get_traces(ALL_VIEW); + + for(auto &t : traces){ t->select(false); + } } _colorFlag = false; @@ -265,8 +255,7 @@ void Header::wheelEvent(QWheelEvent *event) assert(event); if (event->orientation() == Qt::Vertical) { - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); + const auto &traces = _view.get_traces(ALL_VIEW); // Vertical scrolling double shift = 0; #ifdef Q_OS_DARWIN @@ -327,29 +316,27 @@ void Header::mouseMoveEvent(QMouseEvent *event) if (!_drag_traces.empty()) { const int delta = event->pos().y() - _mouse_down_point.y(); - for (std::list, - int> >::iterator i = _drag_traces.begin(); - i != _drag_traces.end(); i++) { - const boost::shared_ptr sig((*i).first); + for (auto i = _drag_traces.begin(); i != _drag_traces.end(); i++) { + const auto sig = (*i).first; if (sig) { int y = (*i).second + delta; if (sig->get_type() == SR_CHANNEL_DSO) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(sig))) { + DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(sig))) { dsoSig->set_zero_vpos(y); _moveFlag = true; traces_moved(); } } else if (sig->get_type() == SR_CHANNEL_MATH) { - boost::shared_ptr mathTrace; - if ((mathTrace = dynamic_pointer_cast(sig))) { + MathTrace *mathTrace = NULL; + if ((mathTrace = dynamic_cast(sig))) { mathTrace->set_zero_vpos(y); _moveFlag = true; traces_moved(); } } else if (sig->get_type() == SR_CHANNEL_ANALOG) { - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(sig))) { + AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(sig))) { analogSig->set_zero_vpos(y); _moveFlag = true; traces_moved(); @@ -384,7 +371,7 @@ void Header::contextMenuEvent(QContextMenuEvent *event) int action; - const boost::shared_ptr t = get_mTrace(action, _mouse_point); + const auto t = get_mTrace(action, _mouse_point); if (!t || !t->selected() || action != Trace::LABEL) return; @@ -400,12 +387,12 @@ void Header::contextMenuEvent(QContextMenuEvent *event) // _context_trace = t; // menu.exec(event->globalPos()); -// _context_trace.reset(); +// _context_trace.r-eset(); } void Header::on_action_set_name_triggered() { - boost::shared_ptr context_Trace = _context_trace; + auto context_Trace = _context_trace; if (!context_Trace) return; diff --git a/DSView/pv/view/header.h b/DSView/pv/view/header.h index 1dc83c01..cf7741e4 100755 --- a/DSView/pv/view/header.h +++ b/DSView/pv/view/header.h @@ -24,9 +24,6 @@ #ifndef DSVIEW_PV_VIEW_HEADER_H #define DSVIEW_PV_VIEW_HEADER_H -#include -#include - #include #include @@ -49,9 +46,7 @@ public: Header(View &parent); private: - boost::shared_ptr get_mTrace( - int &action, - const QPoint &pt); + pv::view::Trace* get_mTrace(int &action, const QPoint &pt); private: void changeEvent(QEvent *event); @@ -100,10 +95,9 @@ private: QLineEdit *nameEdit; - std::list, int> > - _drag_traces; + std::list > _drag_traces; - boost::shared_ptr _context_trace; + Trace *_context_trace; QAction *_action_add_group; QAction *_action_del_group; diff --git a/DSView/pv/view/lissajoustrace.cpp b/DSView/pv/view/lissajoustrace.cpp index f1d307cc..5e091820 100755 --- a/DSView/pv/view/lissajoustrace.cpp +++ b/DSView/pv/view/lissajoustrace.cpp @@ -42,7 +42,7 @@ namespace pv { namespace view { LissajousTrace::LissajousTrace(bool enable, - boost::shared_ptr data, + data::Dso *data, int xIndex, int yIndex, int percent): Trace("Lissajous", xIndex, SR_CHANNEL_LISSAJOUS), _data(data), @@ -58,7 +58,7 @@ LissajousTrace::~LissajousTrace() { } -bool LissajousTrace::enabled() const +bool LissajousTrace::enabled() { return _enable; } @@ -68,27 +68,27 @@ void LissajousTrace::set_enable(bool enable) _enable = enable; } -int LissajousTrace::xIndex() const +int LissajousTrace::xIndex() { return _xIndex; } -int LissajousTrace::yIndex() const +int LissajousTrace::yIndex() { return _yIndex; } -int LissajousTrace::percent() const +int LissajousTrace::percent() { return _percent; } -boost::shared_ptr LissajousTrace::get_data() const +pv::data::Dso* LissajousTrace::get_data() { return _data; } -void LissajousTrace::set_data(boost::shared_ptr data) +void LissajousTrace::set_data(data::Dso *data) { _data = data; } @@ -151,12 +151,11 @@ void LissajousTrace::paint_mid(QPainter &p, int left, int right, QColor fore, QC assert(right >= left); if (enabled()) { - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return; - const boost::shared_ptr &snapshot = - snapshots.front(); + + auto snapshot = snapshots.front(); if (snapshot->empty()) return; diff --git a/DSView/pv/view/lissajoustrace.h b/DSView/pv/view/lissajoustrace.h index f5245d30..5a038a33 100755 --- a/DSView/pv/view/lissajoustrace.h +++ b/DSView/pv/view/lissajoustrace.h @@ -24,9 +24,7 @@ #define DSVIEW_PV_LISSAJOUSTRACE_H #include "trace.h" - -#include - + namespace pv { namespace data { @@ -48,20 +46,19 @@ private: static const int DIV_NUM = 10; public: - LissajousTrace(bool enable, - boost::shared_ptr data, + LissajousTrace(bool enable, pv::data::Dso *data, int xIndex, int yIndex, int percent); virtual ~LissajousTrace(); - bool enabled() const; + bool enabled(); void set_enable(bool enable); - int xIndex() const; - int yIndex() const; - int percent() const; + int xIndex(); + int yIndex(); + int percent(); - boost::shared_ptr get_data() const; - void set_data(boost::shared_ptr data); + pv::data::Dso* get_data(); + void set_data(pv::data::Dso* data); int rows_size(); @@ -92,7 +89,7 @@ public: void paint_label(QPainter &p, int right, const QPoint pt, QColor fore); private: - boost::shared_ptr _data; + pv::data::Dso *_data; bool _enable; int _xIndex; diff --git a/DSView/pv/view/logicsignal.cpp b/DSView/pv/view/logicsignal.cpp index e336dc4a..87f9fb93 100755 --- a/DSView/pv/view/logicsignal.cpp +++ b/DSView/pv/view/logicsignal.cpp @@ -46,7 +46,7 @@ const int LogicSignal::StateHeight = 12; const int LogicSignal::StateRound = 5; LogicSignal::LogicSignal(DevInst *dev_inst, - boost::shared_ptr data, + data::Logic *data, sr_channel *probe) : Signal(dev_inst, probe), _data(data), @@ -54,10 +54,10 @@ LogicSignal::LogicSignal(DevInst *dev_inst, { } -LogicSignal::LogicSignal(boost::shared_ptr s, - boost::shared_ptr data, +LogicSignal::LogicSignal(view::LogicSignal *s, + data::Logic *data, sr_channel *probe) : - Signal(*s.get(), probe), + Signal(*s, probe), _data(data), _trig(s->get_trig()) { @@ -69,22 +69,22 @@ LogicSignal::~LogicSignal() _cur_pulses.clear(); } -const sr_channel* LogicSignal::probe() const +const sr_channel* LogicSignal::probe() { return _probe; } -boost::shared_ptr LogicSignal::data() const +pv::data::SignalData* LogicSignal::data() { return _data; } -boost::shared_ptr LogicSignal::logic_data() const +pv::data::Logic* LogicSignal::logic_data() { return _data; } -LogicSignal::LogicSetRegions LogicSignal::get_trig() const +LogicSignal::LogicSetRegions LogicSignal::get_trig() { return _trig; } @@ -137,14 +137,12 @@ void LogicSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColo const int high_offset = y - _totalHeight + 0.5f; const int low_offset = y + 0.5f; - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots =_data->get_snapshots(); double samplerate = _data->samplerate(); if (snapshots.empty() || samplerate == 0) return; - - const boost::shared_ptr &snapshot = - snapshots.front(); + + auto snapshot = const_cast(snapshots.front()); if (snapshot->empty() || !snapshot->has_data(_probe->index)) return; @@ -202,7 +200,7 @@ void LogicSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColo } void LogicSignal::paint_caps(QPainter &p, QLineF *const lines, - vector< pair > &edges, bool level, + std::vector< pair > &edges, bool level, double samples_per_pixel, double pixels_offset, float x_offset, float y_offset) { @@ -210,7 +208,7 @@ void LogicSignal::paint_caps(QPainter &p, QLineF *const lines, uint64_t curX = 0; uint64_t nxtX = 0; - for (vector::const_iterator i = + for (std::vector::const_iterator i = edges.begin(); i != (edges.end() - 1); i++) if ((*i).second == level) { curX = ((*i).first / samples_per_pixel - @@ -289,17 +287,15 @@ void LogicSignal::paint_type_options(QPainter &p, int right, const QPoint pt, QC edgeTrig_rect.right() - 5, edgeTrig_rect.bottom() - 5); } -bool LogicSignal::measure(const QPointF &p, uint64_t &index0, uint64_t &index1, uint64_t &index2) const +bool LogicSignal::measure(const QPointF &p, uint64_t &index0, uint64_t &index1, uint64_t &index2) { const float gap = abs(p.y() - get_y()); if (gap < get_totalHeight() * 0.5) { - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots =_data->get_snapshots(); if (snapshots.empty()) return false; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty() || !snapshot->has_data(_probe->index)) return false; @@ -343,18 +339,16 @@ bool LogicSignal::measure(const QPointF &p, uint64_t &index0, uint64_t &index1, return false; } -bool LogicSignal::edge(const QPointF &p, uint64_t &index, int radius) const +bool LogicSignal::edge(const QPointF &p, uint64_t &index, int radius) { uint64_t pre_index, nxt_index; const float gap = abs(p.y() - get_y()); if (gap < get_totalHeight() * 0.5) { - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return false; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty() || !snapshot->has_data(_probe->index)) return false; @@ -397,7 +391,7 @@ bool LogicSignal::edge(const QPointF &p, uint64_t &index, int radius) const return false; } -bool LogicSignal::edges(const QPointF &p, uint64_t start, uint64_t &rising, uint64_t &falling) const +bool LogicSignal::edges(const QPointF &p, uint64_t start, uint64_t &rising, uint64_t &falling) { uint64_t end; const float gap = abs(p.y() - get_y()); @@ -408,15 +402,13 @@ bool LogicSignal::edges(const QPointF &p, uint64_t start, uint64_t &rising, uint return false; } -bool LogicSignal::edges(uint64_t end, uint64_t start, uint64_t &rising, uint64_t &falling) const +bool LogicSignal::edges(uint64_t end, uint64_t start, uint64_t &rising, uint64_t &falling) { - const deque< boost::shared_ptr > &snapshots = - _data->get_snapshots(); + const auto &snapshots = _data->get_snapshots(); if (snapshots.empty()) return false; - const boost::shared_ptr &snapshot = - snapshots.front(); + const auto snapshot = snapshots.front(); if (snapshot->empty() || !snapshot->has_data(_probe->index)) return false; diff --git a/DSView/pv/view/logicsignal.h b/DSView/pv/view/logicsignal.h index d2159eb5..931c0df6 100755 --- a/DSView/pv/view/logicsignal.h +++ b/DSView/pv/view/logicsignal.h @@ -26,9 +26,7 @@ #include "signal.h" -#include - -#include +#include namespace pv { @@ -66,26 +64,22 @@ public: }; public: - LogicSignal(DevInst *dev_inst, - boost::shared_ptr data, - sr_channel *probe); + LogicSignal(DevInst *dev_inst, data::Logic* data, sr_channel *probe); - LogicSignal(boost::shared_ptr s, - boost::shared_ptr data, - sr_channel *probe); + LogicSignal(view::LogicSignal*s, pv::data::Logic *data, sr_channel *probe); virtual ~LogicSignal(); - const sr_channel* probe() const; + const sr_channel* probe(); - boost::shared_ptr data() const; + pv::data::SignalData* data(); - boost::shared_ptr logic_data() const; + pv::data::Logic* logic_data(); /** * */ - LogicSetRegions get_trig() const; + LogicSetRegions get_trig(); void set_trig(int trig); bool commit_trig(); @@ -97,13 +91,13 @@ public: **/ void paint_mid(QPainter &p, int left, int right, QColor fore, QColor back); - bool measure(const QPointF &p, uint64_t &index0, uint64_t &index1, uint64_t &index2) const; + bool measure(const QPointF &p, uint64_t &index0, uint64_t &index1, uint64_t &index2); - bool edge(const QPointF &p, uint64_t &index, int radius) const; + bool edge(const QPointF &p, uint64_t &index, int radius); - bool edges(const QPointF &p, uint64_t start, uint64_t &rising, uint64_t &falling) const; + bool edges(const QPointF &p, uint64_t start, uint64_t &rising, uint64_t &falling); - bool edges(uint64_t end, uint64_t start, uint64_t &rising, uint64_t &falling) const; + bool edges(uint64_t end, uint64_t start, uint64_t &rising, uint64_t &falling); bool mouse_press(int right, const QPoint pt); @@ -122,7 +116,7 @@ private: float x_offset, float y_offset); private: - boost::shared_ptr _data; + pv::data::Logic* _data; std::vector< std::pair > _cur_edges; std::vector> _cur_pulses; LogicSetRegions _trig; diff --git a/DSView/pv/view/mathtrace.cpp b/DSView/pv/view/mathtrace.cpp index a61db919..c8f6753c 100755 --- a/DSView/pv/view/mathtrace.cpp +++ b/DSView/pv/view/mathtrace.cpp @@ -36,16 +36,14 @@ #include #include -using namespace boost; using namespace std; namespace pv { namespace view { -MathTrace::MathTrace(bool enable, - boost::shared_ptr math_stack, - boost::shared_ptr dsoSig1, - boost::shared_ptr dsoSig2): +MathTrace::MathTrace(bool enable,data::MathStack *math_stack, + view::DsoSignal *dsoSig1, + view::DsoSignal *dsoSig2): Trace("M", dsoSig1->get_index(), SR_CHANNEL_MATH), _math_stack(math_stack), _dsoSig1(dsoSig1), @@ -71,7 +69,7 @@ MathTrace::~MathTrace() { } -bool MathTrace::enabled() const +bool MathTrace::enabled() { return _enable; } @@ -81,12 +79,12 @@ void MathTrace::set_enable(bool enable) _enable = enable; } -int MathTrace::src1() const +int MathTrace::src1() { return _dsoSig1->get_index(); } -int MathTrace::src2() const +int MathTrace::src2() { return _dsoSig2->get_index(); } @@ -96,7 +94,7 @@ float MathTrace::get_scale() return _scale; } -int MathTrace::get_name_width() const +int MathTrace::get_name_width() { return 0; } @@ -138,12 +136,12 @@ void MathTrace::go_vDialNext() } } -uint64_t MathTrace::get_vDialValue() const +uint64_t MathTrace::get_vDialValue() { return _vDial->get_value(); } -uint16_t MathTrace::get_vDialSel() const +uint16_t MathTrace::get_vDialSel() { return _vDial->get_sel(); } @@ -159,7 +157,7 @@ void MathTrace::set_zero_vrate(double rate) _hw_offset = _zero_vrate * (_ref_max - _ref_min) + _ref_min; } -int MathTrace::get_zero_vpos() const +int MathTrace::get_zero_vpos() { return _zero_vrate * get_view_rect().height() + DsoSignal::UpMargin; } @@ -177,7 +175,7 @@ void MathTrace::set_show(bool show) _show = show; } -QRect MathTrace::get_view_rect() const +QRect MathTrace::get_view_rect() { assert(_viewport); return QRect(0, DsoSignal::UpMargin, @@ -426,7 +424,7 @@ void MathTrace::paint_hover_measure(QPainter &p, QColor fore, QColor back) p.drawText(hover_rect, Qt::AlignCenter | Qt::AlignTop | Qt::TextDontClip, hover_str); } - list::iterator i = _view->get_cursorList().begin(); + auto i = _view->get_cursorList().begin(); while (i != _view->get_cursorList().end()) { float pt_value; const QPointF pt = get_point((*i)->index(), pt_value); @@ -500,7 +498,7 @@ QString MathTrace::get_time(double t) return str; } -const boost::shared_ptr& MathTrace::get_math_stack() const +pv::data::MathStack* MathTrace::get_math_stack() { return _math_stack; } diff --git a/DSView/pv/view/mathtrace.h b/DSView/pv/view/mathtrace.h index 3bcd9428..8eb6413b 100755 --- a/DSView/pv/view/mathtrace.h +++ b/DSView/pv/view/mathtrace.h @@ -23,9 +23,7 @@ #ifndef DSVIEW_PV_MATHTRACE_H #define DSVIEW_PV_MATHTRACE_H -#include "trace.h" - -#include +#include "trace.h" namespace pv { @@ -52,15 +50,15 @@ public: }; public: - MathTrace(bool enable, boost::shared_ptr math_stack, - boost::shared_ptr dsoSig1, - boost::shared_ptr dsoSig2); + MathTrace(bool enable, pv::data::MathStack *math_stack, + view::DsoSignal *dsoSig1, + view::DsoSignal *dsoSig2); virtual ~MathTrace(); float get_scale(); - int get_name_width() const; + int get_name_width(); /** * @@ -68,18 +66,18 @@ public: void update_vDial(); void go_vDialPre(); void go_vDialNext(); - uint64_t get_vDialValue() const; - uint16_t get_vDialSel() const; + uint64_t get_vDialValue(); + uint16_t get_vDialSel(); - bool enabled() const; + bool enabled(); void set_enable(bool enable); void set_show(bool show); - int get_zero_vpos() const; + int get_zero_vpos(); void set_zero_vpos(int pos); - int src1() const; - int src2() const; + int src1(); + int src2(); /** * @@ -125,13 +123,13 @@ public: **/ void paint_fore(QPainter &p, int left, int right, QColor fore, QColor back); - QRect get_view_rect() const; + QRect get_view_rect(); QRectF get_rect(MathSetRegions type, int y, int right); bool mouse_wheel(int right, const QPoint pt, const int shift); - const boost::shared_ptr& get_math_stack() const; + pv::data::MathStack* get_math_stack(); protected: void paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore); @@ -148,9 +146,9 @@ private: void paint_hover_measure(QPainter &p, QColor fore, QColor back); private: - boost::shared_ptr _math_stack; - boost::shared_ptr _dsoSig1; - boost::shared_ptr _dsoSig2; + pv::data::MathStack *_math_stack; + view::DsoSignal *_dsoSig1; + view::DsoSignal *_dsoSig2; bool _enable; bool _show; diff --git a/DSView/pv/view/ruler.cpp b/DSView/pv/view/ruler.cpp index 1108087b..41b9a98c 100755 --- a/DSView/pv/view/ruler.cpp +++ b/DSView/pv/view/ruler.cpp @@ -39,8 +39,7 @@ #include #include #include - -#include + using namespace boost; using namespace std; @@ -219,7 +218,7 @@ void Ruler::mousePressEvent(QMouseEvent *event) bool visible; if (!_cursor_sel_visible & !_view.get_cursorList().empty()) { _view.show_cursors(true); - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); while (i != _view.get_cursorList().end()) { const QRect cursor_rect((*i)->get_label_rect(rect(), visible)); if ((*i)->get_close_rect(cursor_rect).contains(event->pos())) { @@ -262,7 +261,7 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event) _view.show_cursors(true); updatedCursor = true; } else if (overCursor > 0) { - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); while (--overCursor != 0) i++; (*i)->set_index(index); @@ -304,7 +303,7 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event) int overCursor; overCursor = in_cursor_sel_rect(event->pos()); if (overCursor > 0) { - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); while (--overCursor != 0) i++; _view.del_cursor(*i); @@ -430,7 +429,7 @@ void Ruler::draw_logic_tick_mark(QPainter &p) // Draw the cursors if (!_view.get_cursorList().empty()) { - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); int index = 1; while (i != _view.get_cursorList().end()) { (*i)->paint_label(p, rect(), prefix, index, _view.session().get_capture_state() == SigSession::Stopped); @@ -548,7 +547,7 @@ void Ruler::draw_osc_tick_mark(QPainter &p) // Draw the cursors if (!_view.get_cursorList().empty()) { - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); int index = 1; while (i != _view.get_cursorList().end()) { (*i)->paint_label(p, rect(), prefix, index, _view.session().get_capture_state() == SigSession::Stopped); @@ -613,7 +612,7 @@ void Ruler::draw_cursor_sel(QPainter &p) if (!_view.get_cursorList().empty()) { int index = 1; - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); while (i != _view.get_cursorList().end()) { const QRectF cursorRect = get_cursor_sel_rect(index); p.setPen(QPen(Qt::black, 1, Qt::DotLine)); @@ -662,7 +661,7 @@ void Ruler::hover_point_changed() update(); } -double Ruler::get_min_period() const +double Ruler::get_min_period() { return _min_period / MinPeriodScale; } diff --git a/DSView/pv/view/ruler.h b/DSView/pv/view/ruler.h index 18b310c9..822c7d5f 100755 --- a/DSView/pv/view/ruler.h +++ b/DSView/pv/view/ruler.h @@ -69,7 +69,7 @@ public: void set_grabbed_cursor(TimeMarker* grabbed_marker); void rel_grabbed_cursor(); - double get_min_period() const; + double get_min_period(); private: void paintEvent(QPaintEvent *event); diff --git a/DSView/pv/view/selectableitem.cpp b/DSView/pv/view/selectableitem.cpp index cc2b42cd..ed23e2ff 100755 --- a/DSView/pv/view/selectableitem.cpp +++ b/DSView/pv/view/selectableitem.cpp @@ -36,7 +36,7 @@ SelectableItem::SelectableItem() : { } -bool SelectableItem::selected() const +bool SelectableItem::selected() { return _selected; } diff --git a/DSView/pv/view/selectableitem.h b/DSView/pv/view/selectableitem.h index 7859ee4e..4a23cc97 100755 --- a/DSView/pv/view/selectableitem.h +++ b/DSView/pv/view/selectableitem.h @@ -43,14 +43,14 @@ class SelectableItem : public QObject private: static const int HighlightRadius; -public: +protected: SelectableItem(); public: /** * Returns true if the signal has been selected by the user. */ - bool selected() const; + bool selected(); /** * Selects or deselects the signal. diff --git a/DSView/pv/view/signal.cpp b/DSView/pv/view/signal.cpp index 3be6142d..23011a23 100755 --- a/DSView/pv/view/signal.cpp +++ b/DSView/pv/view/signal.cpp @@ -46,7 +46,7 @@ Signal::Signal(const Signal &s, sr_channel *probe) : { } -bool Signal::enabled() const +bool Signal::enabled() { return _probe->enabled; } @@ -58,7 +58,7 @@ void Signal::set_name(QString name) _probe->name = g_strdup(name.toUtf8().data()); } -DevInst* Signal::get_device() const +DevInst* Signal::get_device() { return _dev_inst; } diff --git a/DSView/pv/view/signal.h b/DSView/pv/view/signal.h index 1d3ed5ad..931d54b6 100755 --- a/DSView/pv/view/signal.h +++ b/DSView/pv/view/signal.h @@ -23,8 +23,7 @@ #ifndef DSVIEW_PV_SIGNAL_H #define DSVIEW_PV_SIGNAL_H - -#include + #include #include @@ -69,12 +68,12 @@ protected: Signal(const Signal &s, sr_channel * const probe); public: - virtual boost::shared_ptr data() const = 0; + virtual pv::data::SignalData* data() = 0; /** * Returns true if the trace is visible and enabled. */ - bool enabled() const; + bool enabled(); /** * Sets the name of the signal. @@ -91,7 +90,7 @@ public: */ //virtual void paint_label(QPainter &p, int right, bool hover, int action); - DevInst* get_device() const; + DevInst* get_device(); protected: DevInst* _dev_inst; diff --git a/DSView/pv/view/spectrumtrace.cpp b/DSView/pv/view/spectrumtrace.cpp index bb0ffcb9..6f7ceba3 100755 --- a/DSView/pv/view/spectrumtrace.cpp +++ b/DSView/pv/view/spectrumtrace.cpp @@ -68,7 +68,7 @@ const int SpectrumTrace::HoverPointSize = 3; const double SpectrumTrace::VerticalRate = 1.0 / 2000.0; SpectrumTrace::SpectrumTrace(pv::SigSession *session, - boost::shared_ptr spectrum_stack, int index) : + pv::data::SpectrumStack *spectrum_stack, int index) : Trace("FFT("+QString::number(index)+")", index, SR_CHANNEL_FFT), _session(session), _spectrum_stack(spectrum_stack), @@ -79,11 +79,11 @@ SpectrumTrace::SpectrumTrace(pv::SigSession *session, _offset(0) { _typeWidth = 0; - const vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); for(size_t i = 0; i < sigs.size(); i++) { - const boost::shared_ptr s(sigs[i]); + const auto s = sigs[i]; assert(s); - if (dynamic_pointer_cast(s) && index == s->get_index()) + if (dynamic_cast(s) && index == s->get_index()) _colour = s->get_colour(); } } @@ -93,7 +93,7 @@ SpectrumTrace::~SpectrumTrace() } -bool SpectrumTrace::enabled() const +bool SpectrumTrace::enabled() { return _enable; } @@ -103,7 +103,7 @@ void SpectrumTrace::set_enable(bool enable) _enable = enable; } -int SpectrumTrace::view_mode() const +int SpectrumTrace::view_mode() { return _view_mode; } @@ -123,7 +123,7 @@ std::vector SpectrumTrace::get_view_modes_support() return modes; } -const boost::shared_ptr& SpectrumTrace::get_spectrum_stack() const +pv::data::SpectrumStack* SpectrumTrace::get_spectrum_stack() { return _spectrum_stack; } @@ -160,7 +160,7 @@ void SpectrumTrace::set_offset(double delta) _view->update(); } -double SpectrumTrace::get_offset() const +double SpectrumTrace::get_offset() { return _offset; } @@ -173,7 +173,7 @@ void SpectrumTrace::set_scale(double scale) _view->update(); } -double SpectrumTrace::get_scale() const +double SpectrumTrace::get_scale() { return _scale; } @@ -183,7 +183,7 @@ void SpectrumTrace::set_dbv_range(int range) _dbv_range = range; } -int SpectrumTrace::dbv_range() const +int SpectrumTrace::dbv_range() { return _dbv_range; } @@ -296,8 +296,8 @@ void SpectrumTrace::paint_mid(QPainter &p, int left, int right, QColor fore, QCo double vfactor = 0; for(auto &s : _session->get_signals()) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if(dsoSig->get_index() == _spectrum_stack->get_index()) { vdiv = dsoSig->get_vDialValue(); vfactor = dsoSig->get_factor(); @@ -483,7 +483,7 @@ void SpectrumTrace::paint_type_options(QPainter &p, int right, const QPoint pt, (void)fore; } -QRect SpectrumTrace::get_view_rect() const +QRect SpectrumTrace::get_view_rect() { assert(_viewport); return QRect(0, UpMargin, diff --git a/DSView/pv/view/spectrumtrace.h b/DSView/pv/view/spectrumtrace.h index 293269ef..9c3f368b 100755 --- a/DSView/pv/view/spectrumtrace.h +++ b/DSView/pv/view/spectrumtrace.h @@ -25,8 +25,7 @@ #include #include - -#include + struct srd_channel; @@ -67,33 +66,32 @@ private: static const double VerticalRate; public: - SpectrumTrace(pv::SigSession *session, - boost::shared_ptr spectrum_stack, int index); + SpectrumTrace(pv::SigSession *session, pv::data::SpectrumStack *spectrum_stack, int index); ~SpectrumTrace(); - bool enabled() const; + bool enabled(); void set_enable(bool enable); void init_zoom(); void zoom(double steps, int offset); - bool zoom_hit() const; + bool zoom_hit(); void set_zoom_hit(bool hit); void set_offset(double delta); - double get_offset() const; + double get_offset(); void set_scale(double scale); - double get_scale() const; + double get_scale(); void set_dbv_range(int range); - int dbv_range() const; + int dbv_range(); std::vector get_dbv_ranges(); - int view_mode() const; + int view_mode(); void set_view_mode(unsigned int mode); std::vector get_view_modes_support(); - const boost::shared_ptr& get_spectrum_stack() const; + pv::data::SpectrumStack* get_spectrum_stack(); static QString format_freq(double freq, unsigned precision = Pricision); @@ -123,7 +121,7 @@ public: **/ void paint_fore(QPainter &p, int left, int right, QColor fore, QColor back); - QRect get_view_rect() const; + QRect get_view_rect(); protected: void paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore); @@ -134,7 +132,7 @@ private slots: private: pv::SigSession *_session; - boost::shared_ptr _spectrum_stack; + pv::data::SpectrumStack *_spectrum_stack; bool _enable; int _view_mode; diff --git a/DSView/pv/view/timemarker.cpp b/DSView/pv/view/timemarker.cpp index f103eb7f..79a43707 100755 --- a/DSView/pv/view/timemarker.cpp +++ b/DSView/pv/view/timemarker.cpp @@ -48,7 +48,7 @@ TimeMarker::TimeMarker(const TimeMarker &s) : { } -QColor TimeMarker::colour() const +QColor TimeMarker::colour() { return _colour; } @@ -58,7 +58,7 @@ void TimeMarker::set_colour(QColor color) _colour = color; } -bool TimeMarker::grabbed() const +bool TimeMarker::grabbed() { return _grabbed; } @@ -67,7 +67,7 @@ void TimeMarker::set_grabbed(bool grabbed) _grabbed = grabbed; } -uint64_t TimeMarker::index() const +uint64_t TimeMarker::index() { return _index; } diff --git a/DSView/pv/view/timemarker.h b/DSView/pv/view/timemarker.h index abcb63d6..84cc0bcb 100755 --- a/DSView/pv/view/timemarker.h +++ b/DSView/pv/view/timemarker.h @@ -60,8 +60,8 @@ public: /** * Gets the time of the marker. */ - double time() const; - uint64_t index() const; + double time(); + uint64_t index(); /** * Sets the time of the marker. @@ -71,13 +71,13 @@ public: /** * Gets/Sets colour of the marker */ - QColor colour() const; + QColor colour(); void set_colour(QColor color); /* * */ - bool grabbed() const; + bool grabbed(); void set_grabbed(bool grabbed); /** @@ -93,7 +93,7 @@ public: * @param visible is this marker in visible area * @return Returns the label rectangle. */ - virtual QRect get_label_rect(const QRect &rect, bool &visible, bool has_hoff = true) const = 0; + virtual QRect get_label_rect(const QRect &rect, bool &visible, bool has_hoff = true) = 0; /** * Paints the marker's label to the ruler. diff --git a/DSView/pv/view/trace.cpp b/DSView/pv/view/trace.cpp index fca6addf..782dfa85 100755 --- a/DSView/pv/view/trace.cpp +++ b/DSView/pv/view/trace.cpp @@ -87,12 +87,12 @@ Trace::Trace(const Trace &t) : { } -QString Trace::get_name() const +QString Trace::get_name() { return _name; } -int Trace::get_name_width() const +int Trace::get_name_width() { QFont font = QApplication::font(); QFontMetrics fm(font); @@ -105,7 +105,7 @@ void Trace::set_name(QString name) _name = name; } -QColor Trace::get_colour() const +QColor Trace::get_colour() { return _colour; } @@ -115,7 +115,7 @@ void Trace::set_colour(QColor colour) _colour = colour; } -int Trace::get_v_offset() const +int Trace::get_v_offset() { return _v_offset; } @@ -126,12 +126,12 @@ void Trace::set_v_offset(int v_offset) } -int Trace::get_type() const +int Trace::get_type() { return _type; } -int Trace::get_index() const +int Trace::get_index() { return _index_list.front(); } @@ -148,7 +148,7 @@ void Trace::set_index_list(std::list index_list) _index_list = index_list; } -int Trace::get_sec_index() const +int Trace::get_sec_index() { return _sec_index; } @@ -158,7 +158,7 @@ void Trace::set_sec_index(int sec_index) _sec_index = sec_index; } -int Trace::get_old_v_offset() const +int Trace::get_old_v_offset() { return _old_v_offset; } @@ -168,12 +168,12 @@ void Trace::set_old_v_offset(int v_offset) _old_v_offset = v_offset; } -int Trace::get_zero_vpos() const +int Trace::get_zero_vpos() { return _v_offset; } -int Trace::get_totalHeight() const +int Trace::get_totalHeight() { return _totalHeight; } @@ -195,7 +195,7 @@ void Trace::set_view(pv::view::View *view) connect(_view, SIGNAL(resize()), this, SLOT(resize())); } -pv::view::View* Trace::get_view() const +pv::view::View* Trace::get_view() { return _view; } @@ -206,7 +206,7 @@ void Trace::set_viewport(pv::view::Viewport *viewport) _viewport = viewport; } -pv::view::Viewport* Trace::get_viewport() const +pv::view::Viewport* Trace::get_viewport() { return _viewport; } @@ -399,18 +399,18 @@ void Trace::compute_text_size(QPainter &p) p.boundingRect(QRectF(), 0, "99").height()); } -QRect Trace::get_view_rect() const +QRect Trace::get_view_rect() { assert(_view); return QRect(0, 0, _view->viewport()->width(), _view->viewport()->height()); } -int Trace::get_y() const +int Trace::get_y() { return _v_offset; } -QColor Trace::get_text_colour() const +QColor Trace::get_text_colour() { return (_colour.lightness() > 64) ? Qt::black : Qt::white; } @@ -432,22 +432,22 @@ int Trace::rows_size() return 1; } -int Trace::get_leftWidth() const +int Trace::get_leftWidth() { return SquareWidth/2 + Margin; } -int Trace::get_rightWidth() const +int Trace::get_rightWidth() { return 2 * Margin + _typeWidth * SquareWidth + 1.5 * SquareWidth; } -int Trace::get_headerHeight() const +int Trace::get_headerHeight() { return SquareWidth; } -QRectF Trace::get_rect(const char *s, int y, int right) const +QRectF Trace::get_rect(const char *s, int y, int right) { const QSizeF color_size(get_leftWidth() - Margin, SquareWidth); const QSizeF name_size(right - get_leftWidth() - get_rightWidth(), SquareWidth); diff --git a/DSView/pv/view/trace.h b/DSView/pv/view/trace.h index 6c0ad638..e1b3ecfb 100755 --- a/DSView/pv/view/trace.h +++ b/DSView/pv/view/trace.h @@ -42,6 +42,7 @@ namespace view { class View; class Viewport; +//base class class Trace : public SelectableItem { Q_OBJECT @@ -72,8 +73,8 @@ public: /** * Gets the name of this signal. */ - QString get_name() const; - virtual int get_name_width() const; + QString get_name(); + virtual int get_name_width(); /** * Sets the name of the signal. @@ -83,7 +84,7 @@ public: /** * Get the colour of the signal. */ - QColor get_colour() const; + QColor get_colour(); /** * Set the colour of the signal. @@ -93,7 +94,7 @@ public: /** * Gets the vertical layout offset of this signal. */ - int get_v_offset() const; + int get_v_offset(); /** * Sets the vertical layout offset of this signal. @@ -103,21 +104,21 @@ public: /** * Gets trace type */ - int get_type() const; + int get_type(); /** * Index process */ - int get_index() const; + int get_index(); std::list &get_index_list(); void set_index_list(std::list index_list); - int get_sec_index() const; + int get_sec_index(); void set_sec_index(int sec_index); /** * Gets the height of this signal. */ - int get_totalHeight() const; + int get_totalHeight(); /** * Sets the height of this signal. @@ -127,31 +128,31 @@ public: /** * Geom */ - int get_leftWidth() const; - int get_rightWidth() const; - int get_headerHeight() const; + int get_leftWidth(); + int get_rightWidth(); + int get_headerHeight(); /** * Gets the old vertical layout offset of this signal. */ - int get_old_v_offset() const; + int get_old_v_offset(); /** * Sets the old vertical layout offset of this signal. */ void set_old_v_offset(int v_offset); - virtual int get_zero_vpos() const; + virtual int get_zero_vpos(); /** * Returns true if the trace is visible and enabled. */ - virtual bool enabled() const = 0; + virtual bool enabled() = 0; virtual void set_view(pv::view::View *view); - pv::view::View* get_view() const; + pv::view::View* get_view(); virtual void set_viewport(pv::view::Viewport *viewport); - pv::view::Viewport* get_viewport() const; + pv::view::Viewport* get_viewport(); /** * Paints prepare @@ -194,7 +195,7 @@ public: /** * Gets the y-offset of the axis. */ - int get_y() const; + int get_y(); /** * Determines if a point is in the header rect. @@ -222,11 +223,11 @@ public: * area. * @return Returns the rectangle of the signal label. */ - QRectF get_rect(const char *s, int y, int right) const; + QRectF get_rect(const char *s, int y, int right); virtual int rows_size(); - virtual QRect get_view_rect() const; + virtual QRect get_view_rect(); virtual bool mouse_double_click(int right, const QPoint pt); @@ -242,7 +243,7 @@ protected: * of the trace colour against a threshold to determine whether * white or black would be more visible. */ - QColor get_text_colour() const; + QColor get_text_colour(); /** * Paints optoins for different trace type. diff --git a/DSView/pv/view/view.cpp b/DSView/pv/view/view.cpp index 64220412..5ee7244f 100755 --- a/DSView/pv/view/view.cpp +++ b/DSView/pv/view/view.cpp @@ -23,8 +23,7 @@ #include #include #include - - + #include #include #include @@ -49,7 +48,7 @@ #include "pv/dialogs/calibration.h" #include "pv/dialogs/lissajousoptions.h" -using namespace boost; + using namespace std; namespace pv { @@ -221,17 +220,17 @@ SigSession& View::session() return *_session; } -double View::scale() const +double View::scale() { return _scale; } -int64_t View::offset() const +int64_t View::offset() { return _offset; } -double View::trig_hoff() const +double View::trig_hoff() { return _trig_hoff; } @@ -241,12 +240,12 @@ void View::set_trig_hoff(double hoff) _trig_hoff = hoff; } -double View::get_minscale() const +double View::get_minscale() { return _minscale; } -double View::get_maxscale() const +double View::get_maxscale() { return _maxscale; } @@ -323,7 +322,7 @@ bool View::zoom(double steps, int offset) } _offset = floor((_offset + offset) * (_preScale / _scale) - offset); - _offset = max(min(_offset, get_max_offset()), get_min_offset()); + _offset = max (min(_offset, get_max_offset()), get_min_offset()); if (_scale != _preScale || _offset != _preOffset) { _header->update(); @@ -374,20 +373,18 @@ void View::set_preScale_preOffset() set_scale_offset(_preScale, _preOffset); } -vector< boost::shared_ptr > View::get_traces(int type) +std::vector View::get_traces(int type) { assert(_session); - auto array = _session->get_signals(); - const vector< boost::shared_ptr > sigs(array); - const vector< boost::shared_ptr > groups(_session->get_group_signals()); + auto &sigs = _session->get_signals(); + const auto &groups = _session->get_group_signals(); - const vector< boost::shared_ptr > decode_sigs( - _session->get_decode_signals()); + const auto &decode_sigs = _session->get_decode_signals(); - const vector< boost::shared_ptr > spectrums(_session->get_spectrum_traces()); + const auto &spectrums = _session->get_spectrum_traces(); - vector< boost::shared_ptr > traces; + std::vector traces; for(auto &t : sigs) { if (type == ALL_VIEW || _trace_view_map[t->get_type()] == type) traces.push_back(t); @@ -408,12 +405,12 @@ vector< boost::shared_ptr > View::get_traces(int type) traces.push_back(t); } - boost::shared_ptr lissajous = _session->get_lissajous_trace(); + auto lissajous = _session->get_lissajous_trace(); if (lissajous && lissajous->enabled() && (type == ALL_VIEW || _trace_view_map[lissajous->get_type()] == type)) traces.push_back(lissajous); - boost::shared_ptr math = _session->get_math_trace(); + auto math = _session->get_math_trace(); if (math && math->enabled() && (type == ALL_VIEW || _trace_view_map[math->get_type()] == type)) traces.push_back(math); @@ -422,30 +419,34 @@ vector< boost::shared_ptr > View::get_traces(int type) return traces; } -bool View::compare_trace_v_offsets(const boost::shared_ptr &a, - const boost::shared_ptr &b) +bool View::compare_trace_v_offsets(const Trace *a, + const Trace *b) { assert(a); assert(b); - if (a->get_type() != b->get_type()) - return a->get_type() < b->get_type(); - else if (a->get_type() == SR_CHANNEL_DSO || a->get_type() == SR_CHANNEL_ANALOG) - return a->get_index() < b->get_index(); + + Trace *a1 = const_cast(a); + Trace *b1 = const_cast(b); + + if (a1->get_type() != b1->get_type()) + return a1->get_type() < b1->get_type(); + else if (a1->get_type() == SR_CHANNEL_DSO || a1->get_type() == SR_CHANNEL_ANALOG) + return a1->get_index() < b1->get_index(); else - return a->get_v_offset() < b->get_v_offset(); + return a1->get_v_offset() < b1->get_v_offset(); } -bool View::cursors_shown() const +bool View::cursors_shown() { return _show_cursors; } -bool View::trig_cursor_shown() const +bool View::trig_cursor_shown() { return _show_trig_cursor; } -bool View::search_cursor_shown() const +bool View::search_cursor_shown() { return _show_search_cursor; } @@ -578,14 +579,14 @@ bool View::get_search_hit() return _search_hit; } -const QPoint& View::hover_point() const +const QPoint& View::hover_point() { return _hover_point; } void View::normalize_layout() { - vector< boost::shared_ptr > traces(get_traces(ALL_VIEW)); + auto traces = get_traces(ALL_VIEW); int v_min = INT_MAX; for(auto &t : traces){ @@ -613,9 +614,9 @@ int View::get_signalHeight() return _signalHeight; } -void View::get_scroll_layout(int64_t &length, int64_t &offset) const +void View::get_scroll_layout(int64_t &length, int64_t &offset) { - const set< boost::shared_ptr > data_set = _session->get_data(); + const auto data_set = _session->get_data(); if (data_set.empty()) return; @@ -695,8 +696,8 @@ void View::signals_changed() int total_rows = 0; int label_size = 0; uint8_t max_height = MaxHeightUnit; - vector< boost::shared_ptr > time_traces; - vector< boost::shared_ptr > fft_traces; + std::vector time_traces; + std::vector fft_traces; for(auto &t : get_traces(ALL_VIEW)) { if (_trace_view_map[t->get_type()] == TIME_VIEW) @@ -736,7 +737,7 @@ void View::signals_changed() if (!time_traces.empty() && _time_viewport) { for(auto &t : time_traces) { assert(t); - if (dynamic_pointer_cast(t) || + if (dynamic_cast(t) || t->enabled()) total_rows += t->rows_size(); if (t->rows_size() != 0) @@ -779,13 +780,13 @@ void View::signals_changed() t->set_v_offset(next_v_offset + 0.5 * traceHeight + actualMargin); next_v_offset += traceHeight + 2 * actualMargin; - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(t))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(t))) { dsoSig->set_scale(dsoSig->get_view_rect().height()); } - boost::shared_ptr analogSig; - if ((analogSig = dynamic_pointer_cast(t))) { + view::AnalogSignal *analogSig = NULL; + if ((analogSig = dynamic_cast(t))) { analogSig->set_scale(analogSig->get_totalHeight()); } } @@ -848,7 +849,7 @@ int View::headerWidth() { int headerWidth = _header->get_nameEditWidth(); - const vector< boost::shared_ptr > traces(get_traces(ALL_VIEW)); + const auto &traces = get_traces(ALL_VIEW); if (!traces.empty()) { for(auto &t : traces) headerWidth = max(t->get_name_width() + t->get_leftWidth() + t->get_rightWidth(), @@ -1013,7 +1014,7 @@ void View::set_cursor_middle(int index) { assert(index < (int)_cursorList.size()); - list::iterator i = _cursorList.begin(); + auto i = _cursorList.begin(); while (index-- != 0) i++; set_scale_offset(_scale, (*i)->index() / (_session->cur_snap_samplerate() * _scale) - (get_view_width() / 2)); @@ -1092,7 +1093,7 @@ void View::on_state_changed(bool stop) QRect View::get_view_rect() { if (_session->get_device()->dev_inst()->mode == DSO) { - const vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); for(auto &s : sigs) { return s->get_view_rect(); } @@ -1105,7 +1106,7 @@ int View::get_view_width() { int view_width = 0; if (_session->get_device()->dev_inst()->mode == DSO) { - const vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); for(auto &s : sigs) { view_width = max(view_width, s->get_view_rect().width()); } @@ -1120,7 +1121,7 @@ int View::get_view_height() { int view_height = 0; if (_session->get_device()->dev_inst()->mode == DSO) { - const vector< boost::shared_ptr > sigs(_session->get_signals()); + const auto &sigs = _session->get_signals(); for(auto &s : sigs) { view_height = max(view_height, s->get_view_rect().height()); } @@ -1162,7 +1163,7 @@ void View::vDial_updated() if (_cali->isVisible()) { _cali->set_device(_session->get_device()); } - boost::shared_ptr math_trace = _session->get_math_trace(); + auto math_trace = _session->get_math_trace(); if (math_trace && math_trace->enabled()) { math_trace->update_vDial(); } @@ -1183,7 +1184,7 @@ void View::show_region(uint64_t start, uint64_t end, bool keep) update(); } else if (_session->get_map_zoom() == 0) { const double ideal_scale = (end-start) * 2.0 / _session->cur_snap_samplerate() / get_view_width(); - const double new_scale = max(min(ideal_scale, _maxscale), _minscale); + const double new_scale = max (min(ideal_scale, _maxscale), _minscale); const double new_off = (start + end) * 0.5 / (_session->cur_snap_samplerate() * new_scale) - (get_view_width() / 2); set_scale_offset(new_scale, new_off); } else { @@ -1254,7 +1255,7 @@ void View::set_capture_status() } } -bool View::get_dso_trig_moved() const +bool View::get_dso_trig_moved() { return _time_viewport->get_dso_trig_moved(); } @@ -1298,7 +1299,7 @@ ViewStatus* View::get_viewstatus() return _viewbottom; } -bool View::back_ready() const +bool View::back_ready() { return _back_ready; } diff --git a/DSView/pv/view/view.h b/DSView/pv/view/view.h index 306653d2..f5e8ea10 100755 --- a/DSView/pv/view/view.h +++ b/DSView/pv/view/view.h @@ -27,10 +27,7 @@ #include #include #include - -#include -#include - + #include #include #include @@ -112,18 +109,18 @@ public: /** * Returns the view time scale in seconds per pixel. */ - double scale() const; + double scale(); /** * Returns the pixels offset of the left edge of the view */ - int64_t offset() const; - int v_offset() const; + int64_t offset(); + int v_offset(); /** * trigger position fix */ - double trig_hoff() const; + double trig_hoff(); void set_trig_hoff(double hoff); int64_t get_min_offset(); @@ -142,14 +139,14 @@ public: void set_scale_offset(double scale, int64_t offset); void set_preScale_preOffset(); - std::vector< boost::shared_ptr > get_traces(int type); + std::vector get_traces(int type); /** * Returns true if cursors are displayed. false otherwise. */ - bool cursors_shown() const; - bool trig_cursor_shown() const; - bool search_cursor_shown() const; + bool cursors_shown(); + bool trig_cursor_shown(); + bool search_cursor_shown(); int get_spanY(); @@ -164,7 +161,7 @@ public: */ void show_cursors(bool show = true); - const QPoint& hover_point() const; + const QPoint& hover_point(); void normalize_layout(); @@ -200,8 +197,8 @@ public: /* * */ - double get_minscale() const; - double get_maxscale() const; + double get_minscale(); + double get_maxscale(); void set_update(Viewport *viewport, bool need_update); void set_all_update(bool need_update); @@ -225,14 +222,14 @@ public: void set_capture_status(); - bool get_dso_trig_moved() const; + bool get_dso_trig_moved(); ViewStatus* get_viewstatus(); /* * back paint status */ - bool back_ready() const; + bool back_ready(); void set_back(bool ready); /* @@ -261,15 +258,15 @@ signals: void auto_trig(int index); private: - void get_scroll_layout(int64_t &length, int64_t &offset) const; + void get_scroll_layout(int64_t &length, int64_t &offset); void update_scroll(); void update_margins(); static bool compare_trace_v_offsets( - const boost::shared_ptr &a, - const boost::shared_ptr &b); + const pv::view::Trace *a, + const pv::view::Trace *b); void clear(); void reconstruct(); diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index 5c548e63..95a2ff46 100755 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -40,8 +40,8 @@ #include #include - #include "../config/appconfig.h" +#include "../dsvdef.h" using namespace boost; using namespace std; @@ -107,11 +107,11 @@ Viewport::Viewport(View &parent, View_type type) : connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),this, SLOT(show_contextmenu(const QPoint&))); } -int Viewport::get_total_height() const +int Viewport::get_total_height() { int h = 0; - const vector< boost::shared_ptr > traces(_view.get_traces(_type)); + const auto &traces = _view.get_traces(_type); for(auto &t : traces) { assert(t); h += (int)(t->get_totalHeight()); @@ -121,7 +121,7 @@ int Viewport::get_total_height() const return h; } -QPoint Viewport::get_mouse_point() const +QPoint Viewport::get_mouse_point() { return _mouse_point; } @@ -149,7 +149,8 @@ void Viewport::paintEvent(QPaintEvent *event) QColor back(QWidget::palette().color(QWidget::backgroundRole())); fore.setAlpha(View::ForeAlpha); _view.set_back(false); - const vector< boost::shared_ptr > traces(_view.get_traces(_type)); + + const auto &traces = _view.get_traces(_type); for(auto &t : traces) { @@ -202,15 +203,13 @@ void Viewport::paintEvent(QPaintEvent *event) void Viewport::paintSignals(QPainter &p, QColor fore, QColor back) { - const vector< boost::shared_ptr > traces(_view.get_traces(_type)); + const auto &traces = _view.get_traces(_type); + if (_view.session().get_device()->dev_inst()->mode == LOGIC) { for(auto &t : traces) { - assert(t); - // auto ptr = t.get(); - // ptr->paint_mid(p, 0, t->get_view_rect().right(), fore, back); - // continue; + assert(t); if (t->enabled()) t->paint_mid(p, 0, t->get_view_rect().right(), fore, back); @@ -253,7 +252,7 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back) //const QRect xrect = QRect(rect().left(), rect().top(), _view.get_view_width(), rect().height()); const QRect xrect = _view.get_view_rect(); if (_view.cursors_shown() && _type == TIME_VIEW) { - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); int index = 0; while (i != _view.get_cursorList().end()) { const int64_t cursorX = _view.index2pixel((*i)->index()); @@ -268,7 +267,7 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back) } if (_view.xcursors_shown() && _type == TIME_VIEW) { - list::iterator i = _view.get_xcursorList().begin(); + auto i = _view.get_xcursorList().begin(); int index = 0; bool hovered = false; while (i != _view.get_xcursorList().end()) { @@ -521,14 +520,15 @@ void Viewport::mousePressEvent(QMouseEvent *event) if (_action_type == NO_ACTION && event->button() == Qt::LeftButton && _view.session().get_device()->dev_inst()->mode == DSO) { - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { assert(s); if (!s->enabled()) continue; - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_trig_rect(0, _view.get_view_width()).contains(_mouse_point)) { _drag_sig = s; _action_type = DSO_TRIG_MOVE; @@ -551,7 +551,7 @@ void Viewport::mousePressEvent(QMouseEvent *event) } } if (_action_type == NO_ACTION && _view.cursors_shown()) { - list::iterator i = _view.get_cursorList().begin(); + auto i = _view.get_cursorList().begin(); while (i != _view.get_cursorList().end()) { const int64_t cursorX = _view.index2pixel((*i)->index()); if ((*i)->grabbed()) { @@ -565,7 +565,7 @@ void Viewport::mousePressEvent(QMouseEvent *event) } } if (_action_type == NO_ACTION && _view.xcursors_shown()) { - list::iterator i = _view.get_xcursorList().begin(); + auto i = _view.get_xcursorList().begin(); const QRect xrect = _view.get_view_rect(); while (i != _view.get_xcursorList().end()) { const double cursorX = xrect.left() + (*i)->value(XCursor::XCur_Y)*xrect.width(); @@ -577,13 +577,13 @@ void Viewport::mousePressEvent(QMouseEvent *event) _view.show_xcursors(false); break; } else if ((*i)->get_map_rect(xrect).contains(_view.hover_point())) { - vector< boost::shared_ptr > sigs(_view.session().get_signals()); - vector< boost::shared_ptr >::iterator s = sigs.begin(); + auto &sigs = _view.session().get_signals(); + auto s = sigs.begin(); bool sig_looped = ((*i)->channel() == NULL); bool no_dsoSig = true; while (1) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(*s)) && + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(*s)) && dsoSig->enabled()) { no_dsoSig = false; if (sig_looped) { @@ -656,8 +656,8 @@ void Viewport::mouseMoveEvent(QMouseEvent *event) !(event->buttons() | Qt::NoButton)) { if (_action_type == DSO_TRIG_MOVE) { if (_drag_sig) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(_drag_sig))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(_drag_sig))) { dsoSig->set_trig_vpos(event->pos().y()); _dso_trig_moved = true; } @@ -669,21 +669,21 @@ void Viewport::mouseMoveEvent(QMouseEvent *event) int curX = _view.hover_point().x(); uint64_t index0 = 0, index1 = 0, index2 = 0; bool logic = false; - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s: sigs) { assert(s); - boost::shared_ptr logicSig; - boost::shared_ptr dsoSig; + view::LogicSignal *logicSig = NULL; + view::DsoSignal *dsoSig = NULL; if ((_view.session().get_device()->dev_inst()->mode == LOGIC) && - (logicSig = dynamic_pointer_cast(s))) { + (logicSig = dynamic_cast(s))) { if (logicSig->measure(event->pos(), index0, index1, index2)) { logic = true; break; } } if ((_view.session().get_device()->dev_inst()->mode == DSO) && - (dsoSig = dynamic_pointer_cast(s))) { + (dsoSig = dynamic_cast(s))) { curX = min(dsoSig->get_view_rect().right(), curX); break; } @@ -712,7 +712,7 @@ void Viewport::mouseMoveEvent(QMouseEvent *event) _curs_moved = true; } else { if (_view.xcursors_shown()) { - list::iterator i = _view.get_xcursorList().begin(); + auto i = _view.get_xcursorList().begin(); const QRect xrect = _view.get_view_rect(); while (i != _view.get_xcursorList().end()) { if ((*i)->grabbed() != XCursor::XCur_None) { @@ -787,12 +787,12 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event) // priority 2 if (_action_type == NO_ACTION) { if (_mouse_down_point.x() == event->pos().x()) { - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { assert(s); - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(s))) { if (logicSig->edge(event->pos(), _edge_start, 10)) { _action_type = LOGIC_JUMP; _cur_preX = _view.index2pixel(_edge_start); @@ -811,7 +811,7 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event) // priority 3 if (_action_type == NO_ACTION) { if (_mouse_down_point.x() == event->pos().x()) { - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { assert(s); @@ -844,15 +844,17 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event) } } else if (_action_type == DSO_TRIG_MOVE) { if (_dso_trig_moved && event->button() == Qt::LeftButton) { - _drag_sig.reset(); + _drag_sig = NULL; _action_type = NO_ACTION; _dso_trig_moved = false; - const vector< boost::shared_ptr > traces( - _view.get_traces(ALL_VIEW)); - for(auto &t : traces) - t->select(false); + const auto &traces = _view.get_traces(ALL_VIEW); + + for(auto &t : traces){ + t->select(false); + } } + } else if (_action_type == DSO_XM_STEP0) { if (event->button() == Qt::LeftButton) { _action_type = DSO_XM_STEP1; @@ -895,7 +897,7 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event) } if (_xcurs_moved && event->button() == Qt::LeftButton) { _action_type = NO_ACTION; - list::iterator i = _view.get_xcursorList().begin(); + auto i = _view.get_xcursorList().begin(); while (i != _view.get_xcursorList().end()) { (*i)->rel_grabbed(); i++; @@ -966,11 +968,11 @@ void Viewport::mouseDoubleClickEvent(QMouseEvent *event) uint64_t index; uint64_t index0 = 0, index1 = 0, index2 = 0; if (_view.session().get_device()->dev_inst()->mode == LOGIC) { - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { assert(s); - boost::shared_ptr logicSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + if ((logicSig = dynamic_cast(s))) { if (logicSig->measure(event->pos(), index0, index1, index2)) { logic = true; break; @@ -1066,11 +1068,11 @@ void Viewport::wheelEvent(QWheelEvent *event) } } - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { assert(s); - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { dsoSig->auto_end(); } } @@ -1174,14 +1176,15 @@ void Viewport::measure() _measure_type = NO_MEASURE; if (_type == TIME_VIEW) { const uint64_t sample_rate = _view.session().cur_snap_samplerate(); - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { assert(s); - boost::shared_ptr logicSig; - boost::shared_ptr dsoSig; - boost::shared_ptr analogSig; - if ((logicSig = dynamic_pointer_cast(s))) { + view::LogicSignal *logicSig = NULL; + view::DsoSignal *dsoSig = NULL; + view::AnalogSignal *analogSig = NULL; + + if ((logicSig = dynamic_cast(s))) { if (_action_type == NO_ACTION) { if (logicSig->measure(_mouse_point, _cur_sample, _nxt_sample, _thd_sample)) { _measure_type = LOGIC_FREQ; @@ -1231,7 +1234,7 @@ void Viewport::measure() _edge_hit = false; } } - } else if ((dsoSig = dynamic_pointer_cast(s))) { + } else if ((dsoSig = dynamic_cast(s))) { if (dsoSig->enabled()) { if (_measure_en && dsoSig->measure(_view.hover_point())) { _measure_type = DSO_VALUE; @@ -1239,7 +1242,7 @@ void Viewport::measure() _measure_type = NO_MEASURE; } } - } else if ((analogSig = dynamic_pointer_cast(s))) { + } else if ((analogSig = dynamic_cast(s))) { if (analogSig->enabled()) { if (_measure_en && analogSig->measure(_view.hover_point())) { _measure_type = DSO_VALUE; @@ -1249,7 +1252,7 @@ void Viewport::measure() } } } - const boost::shared_ptr mathTrace(_view.session().get_math_trace()); + const auto mathTrace = _view.session().get_math_trace(); if (mathTrace && mathTrace->enabled()) { if (_measure_en && mathTrace->measure(_view.hover_point())) { _measure_type = DSO_VALUE; @@ -1329,14 +1332,15 @@ void Viewport::paintMeasure(QPainter &p, QColor fore, QColor back) } } - const vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); if (_action_type == NO_ACTION && _measure_type == DSO_VALUE) { for(auto &s : sigs) { - boost::shared_ptr dsoSig; - boost::shared_ptr analogSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + view::AnalogSignal* analogSig = NULL; + + if ((dsoSig = dynamic_cast(s))) { uint64_t index; double value; QPointF hpoint; @@ -1346,7 +1350,7 @@ void Viewport::paintMeasure(QPainter &p, QColor fore, QColor back) p.drawLine(hpoint.x(), dsoSig->get_view_rect().top(), hpoint.x(), dsoSig->get_view_rect().bottom()); } - } else if ((analogSig = dynamic_pointer_cast(s))) { + } else if ((analogSig = dynamic_cast(s))) { uint64_t index; double value; QPointF hpoint; @@ -1362,8 +1366,8 @@ void Viewport::paintMeasure(QPainter &p, QColor fore, QColor back) if (_dso_ym_valid) { for(auto &s : sigs) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) { + view::DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) { if (dsoSig->get_index() == _dso_ym_sig_index) { p.setPen(QPen(dsoSig->get_colour(), 1, Qt::DotLine)); const int text_height = p.boundingRect(0, 0, INT_MAX, INT_MAX, @@ -1670,7 +1674,7 @@ void Viewport::unshow_wait_trigger() update(); } -bool Viewport::get_dso_trig_moved() const +bool Viewport::get_dso_trig_moved() { return _dso_trig_moved; } diff --git a/DSView/pv/view/viewport.h b/DSView/pv/view/viewport.h index c1d298f1..18b4dc4d 100755 --- a/DSView/pv/view/viewport.h +++ b/DSView/pv/view/viewport.h @@ -25,10 +25,7 @@ #define DSVIEW_PV_VIEW_VIEWPORT_H #include - -#include -#include - + #include #include #include @@ -92,9 +89,9 @@ public: public: explicit Viewport(View &parent, View_type type); - int get_total_height() const; + int get_total_height(); - QPoint get_mouse_point() const; + QPoint get_mouse_point(); QString get_measure(QString option); @@ -109,7 +106,7 @@ public: void set_need_update(bool update); - bool get_dso_trig_moved() const; + bool get_dso_trig_moved(); protected: bool event(QEvent *event) override; @@ -198,7 +195,7 @@ private: bool transfer_started; int timer_cnt; - boost::shared_ptr _drag_sig; + Signal *_drag_sig; uint64_t _hover_index; bool _hover_hit; diff --git a/DSView/pv/view/viewstatus.cpp b/DSView/pv/view/viewstatus.cpp index 27345f84..3a1cf19f 100755 --- a/DSView/pv/view/viewstatus.cpp +++ b/DSView/pv/view/viewstatus.cpp @@ -74,14 +74,14 @@ void ViewStatus::paintEvent(QPaintEvent *) fore.setAlpha(View::BackAlpha); for(size_t i = 0; i < _mrects.size(); i++) { int sig_index = std::get<1>(_mrects[i]); - boost::shared_ptr dsoSig = NULL; - const vector< boost::shared_ptr > sigs(_session->get_signals()); + view::DsoSignal *dsoSig = NULL; + const auto &sigs = _session->get_signals(); for(auto &s : sigs) { assert(s); if (!s->enabled()) continue; - if ((dsoSig = dynamic_pointer_cast(s))) { + if ((dsoSig = dynamic_cast(s))) { if (sig_index == dsoSig->get_index()) break; else diff --git a/DSView/pv/view/viewstatus.h b/DSView/pv/view/viewstatus.h index 29bd473e..c8edf813 100755 --- a/DSView/pv/view/viewstatus.h +++ b/DSView/pv/view/viewstatus.h @@ -27,9 +27,7 @@ #include #include #include - -#include #include diff --git a/DSView/pv/view/xcursor.cpp b/DSView/pv/view/xcursor.cpp index eeecf6aa..decdc14c 100755 --- a/DSView/pv/view/xcursor.cpp +++ b/DSView/pv/view/xcursor.cpp @@ -46,11 +46,11 @@ XCursor::XCursor(View &view, QColor &colour, _colour(colour) { _dsoSig = NULL; - const std::vector< boost::shared_ptr > sigs(_view.session().get_signals()); + const auto &sigs = _view.session().get_signals(); for(auto &s : sigs) { - boost::shared_ptr dsoSig; - if ((dsoSig = dynamic_pointer_cast(s))) + DsoSignal *dsoSig = NULL; + if ((dsoSig = dynamic_cast(s))) if (dsoSig->enabled()) { _dsoSig = dsoSig; break; @@ -70,7 +70,7 @@ XCursor::XCursor(const XCursor &x) : { } -QColor XCursor::colour() const +QColor XCursor::colour() { return _colour; } @@ -83,16 +83,16 @@ void XCursor::set_colour(QColor color) /** * Gets/Sets the mapping channel of the marker */ -boost::shared_ptr XCursor::channel() const +DsoSignal* XCursor::channel() { return _dsoSig; } -void XCursor::set_channel(boost::shared_ptr sig) +void XCursor::set_channel(DsoSignal *sig) { _dsoSig = sig; } -enum XCursor::XCur_type XCursor::grabbed() const +enum XCursor::XCur_type XCursor::grabbed() { return _grabbed; } @@ -108,7 +108,7 @@ void XCursor::rel_grabbed() _grabbed = XCur_None; } -double XCursor::value(XCur_type type) const +double XCursor::value(XCur_type type) { if (type == XCur_Y) return _yvalue; @@ -182,7 +182,7 @@ void XCursor::paint(QPainter &p, const QRect &rect, XCur_type highlight, int or * @param rect The rectangle of the xcursor area. * @return Returns the map label rectangle. */ -QRect XCursor::get_map_rect(const QRect &rect) const +QRect XCursor::get_map_rect(const QRect &rect) { const int width = 10; const int64_t y = rect.top() + _value0 * rect.height() - width/2; @@ -194,7 +194,7 @@ QRect XCursor::get_map_rect(const QRect &rect) const * @param rect The rectangle of the xcursor area. * @return Returns the close label rectangle. */ -QRect XCursor::get_close_rect(const QRect &rect) const +QRect XCursor::get_close_rect(const QRect &rect) { const int width = 10; const int64_t y = rect.top() + _value1 * rect.height() - width/2; diff --git a/DSView/pv/view/xcursor.h b/DSView/pv/view/xcursor.h index e64d80b8..7a95bf1c 100755 --- a/DSView/pv/view/xcursor.h +++ b/DSView/pv/view/xcursor.h @@ -26,10 +26,7 @@ #include #include #include - -#include -#include - + #include class QPainter; @@ -74,25 +71,25 @@ public: /** * Gets/Set the value of the marker. */ - double value(enum XCur_type type) const; + double value(enum XCur_type type); void set_value(enum XCur_type type, double value); /** * Gets/Sets colour of the marker */ - QColor colour() const; + QColor colour(); void set_colour(QColor color); /** * Gets/Sets the mapping channel of the marker */ - boost::shared_ptr channel() const; - void set_channel(boost::shared_ptr sig); + DsoSignal* channel(); + void set_channel(DsoSignal *sig); /** * grab & move */ - enum XCur_type grabbed() const; + enum XCur_type grabbed(); void set_grabbed(enum XCur_type type, bool grabbed); void rel_grabbed(); @@ -108,14 +105,14 @@ public: * @param rect The rectangle of the xcursor area. * @return Returns the map label rectangle. */ - QRect get_map_rect(const QRect &rect) const; + QRect get_map_rect(const QRect &rect); /** * Gets the close label rectangle. * @param rect The rectangle of the xcursor area. * @return Returns the close label rectangle. */ - QRect get_close_rect(const QRect &rect) const; + QRect get_close_rect(const QRect &rect); /** * Paints the labels to the xcursor. @@ -128,8 +125,8 @@ signals: void value_changed(); protected: - View &_view; - boost::shared_ptr _dsoSig; + View &_view; + DsoSignal *_dsoSig; double _yvalue; double _value0; diff --git a/DSView/pv/widgets/decodergroupbox.cpp b/DSView/pv/widgets/decodergroupbox.cpp index 2da50f7b..82a809b5 100755 --- a/DSView/pv/widgets/decodergroupbox.cpp +++ b/DSView/pv/widgets/decodergroupbox.cpp @@ -41,8 +41,8 @@ namespace pv { namespace widgets { -DecoderGroupBox::DecoderGroupBox(boost::shared_ptr &decoder_stack, - boost::shared_ptr &dec, +DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack, + data::decode::Decoder *dec, QLayout *dec_layout, QWidget *parent) : QScrollArea(parent), diff --git a/DSView/pv/widgets/decodergroupbox.h b/DSView/pv/widgets/decodergroupbox.h index 61f5599b..96812532 100755 --- a/DSView/pv/widgets/decodergroupbox.h +++ b/DSView/pv/widgets/decodergroupbox.h @@ -26,8 +26,7 @@ #include #include #include -#include -#include +#include namespace pv { @@ -45,8 +44,8 @@ class DecoderGroupBox : public QScrollArea Q_OBJECT public: - DecoderGroupBox(boost::shared_ptr &decoder_stack, - boost::shared_ptr &dec, QLayout *dec_layout, + DecoderGroupBox(pv::data::DecoderStack *decoder_stack, + data::decode::Decoder *dec, QLayout *dec_layout, QWidget *parent = NULL); ~DecoderGroupBox(); bool eventFilter(QObject *o, QEvent *e); @@ -54,7 +53,7 @@ public: signals: void show_hide_decoder(); void show_hide_row(); - void del_stack(boost::shared_ptr &_dec); + void del_stack(data::decode::Decoder *_dec); private slots: void tog_icon(); @@ -63,8 +62,8 @@ private slots: private: QWidget *_widget; - boost::shared_ptr &_decoder_stack; - boost::shared_ptr &_dec; + pv::data::DecoderStack *_decoder_stack; + data::decode::Decoder *_dec; int _index; QGridLayout *_layout;