X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftabular_decoder%2Fview.hpp;h=73fb30c4f0a1fb4a85b396c452b5d9b3b5cc9cf6;hp=6bb89c86616e33ab680b60bd86488ef4eaa0b28f;hb=8845be3c9c7d5aca02fb2efc4038f4735a5242d6;hpb=8997f62a4f87c822578aa5d835e1dd8109c6f5eb diff --git a/pv/views/tabular_decoder/view.hpp b/pv/views/tabular_decoder/view.hpp index 6bb89c86..73fb30c4 100644 --- a/pv/views/tabular_decoder/view.hpp +++ b/pv/views/tabular_decoder/view.hpp @@ -17,16 +17,16 @@ * along with this program; if not, see . */ -#ifndef PULSEVIEW_PV_VIEWS_TABULARDECODER_VIEW_HPP -#define PULSEVIEW_PV_VIEWS_TABULARDECODER_VIEW_HPP +#ifndef PULSEVIEW_PV_VIEWS_TABULAR_DECODER_VIEW_HPP +#define PULSEVIEW_PV_VIEWS_TABULAR_DECODER_VIEW_HPP #include #include #include +#include #include #include -#include "pv/globalsettings.hpp" #include "pv/metadata_obj.hpp" #include "pv/views/viewbase.hpp" #include "pv/data/decodesignal.hpp" @@ -57,17 +57,19 @@ extern const char* SaveTypeNames[SaveTypeCount]; extern const char* ViewModeNames[ViewModeCount]; -class AnnotationCollectionModel : public QAbstractTableModel, public GlobalSettingsInterface +class AnnotationCollectionModel : public QAbstractTableModel { Q_OBJECT public: AnnotationCollectionModel(QObject* parent = nullptr); + int get_hierarchy_level(const Annotation* ann) const; QVariant data_from_ann(const Annotation* ann, int index) const; QVariant data(const QModelIndex& index, int role) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; + uint8_t first_hidden_column() const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; QModelIndex index(int row, int column, @@ -79,12 +81,14 @@ public: int columnCount(const QModelIndex& parent_idx = QModelIndex()) const override; void set_signal_and_segment(data::DecodeSignal* signal, uint32_t current_segment); - void set_sample_range(uint64_t start_sample, uint64_t end_sample); void set_hide_hidden(bool hide_hidden); void update_annotations_without_hidden(); + QModelIndex update_highlighted_rows(QModelIndex first, QModelIndex last, + int64_t sample_num); - void on_setting_changed(const QString &key, const QVariant &value) override; +private Q_SLOTS: + void on_annotation_visibility_changed(); private: vector header_data_; @@ -92,15 +96,33 @@ private: deque all_annotations_without_hidden_; const deque* dataset_; data::DecodeSignal* signal_; + uint8_t first_hidden_column_; uint32_t prev_segment_; uint64_t prev_last_row_; - uint64_t start_sample_, end_sample_, start_index_, end_index_; + int64_t highlight_sample_num_; + bool had_highlight_before_; bool hide_hidden_; - bool theme_is_dark_; }; -class QCustomTableView : public QTableView +class CustomFilterProxyModel : public QSortFilterProxyModel +{ + Q_OBJECT + +public: + CustomFilterProxyModel(QObject* parent = 0); + + void set_sample_range(uint64_t start_sample, uint64_t end_sample); + +protected: + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; + +private: + uint64_t range_start_sample_, range_end_sample_; +}; + + +class CustomTableView : public QTableView { Q_OBJECT @@ -174,9 +196,9 @@ private: QToolButton* save_button_; QAction* save_action_; - QCustomTableView* table_view_; - + CustomTableView* table_view_; AnnotationCollectionModel* model_; + CustomFilterProxyModel* filter_proxy_model_; data::DecodeSignal* signal_; const data::decode::Decoder* decoder_; @@ -186,4 +208,4 @@ private: } // namespace views } // namespace pv -#endif // PULSEVIEW_PV_VIEWS_TABULARDECODER_VIEW_HPP +#endif // PULSEVIEW_PV_VIEWS_TABULAR_DECODER_VIEW_HPP