X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftabular_decoder%2Fview.hpp;h=3cdcac18637195d597049a90e6505bac0f6409fb;hb=6f2f5d25db4f9a674ca25e5b74caf518ecd38ff6;hp=7d25f700e3089376a12c64fecaed89672f7aa782;hpb=8e168b23846653c087e46b6a63feffac48512ddb;p=pulseview.git diff --git a/pv/views/tabular_decoder/view.hpp b/pv/views/tabular_decoder/view.hpp index 7d25f700..3cdcac18 100644 --- a/pv/views/tabular_decoder/view.hpp +++ b/pv/views/tabular_decoder/view.hpp @@ -17,12 +17,14 @@ * 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 @@ -63,10 +65,12 @@ class AnnotationCollectionModel : public QAbstractTableModel 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, @@ -78,10 +82,11 @@ 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); private Q_SLOTS: void on_annotation_visibility_changed(); @@ -92,20 +97,48 @@ 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_; }; -class QCustomTableView : public QTableView +class CustomFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - QSize minimumSizeHint() const; - QSize sizeHint() const; + CustomFilterProxyModel(QObject* parent = 0); + + void set_sample_range(uint64_t start_sample, uint64_t end_sample); + + void enable_range_filtering(bool value); + +protected: + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; + +private: + uint64_t range_start_sample_, range_end_sample_; + bool range_filtering_enabled_; +}; + + +class CustomTableView : public QTableView +{ + Q_OBJECT + +public: + virtual QSize minimumSizeHint() const override; + virtual QSize sizeHint() const override; + +protected: + virtual void keyPressEvent(QKeyEvent *event) override; + +Q_SIGNALS: + void activatedByKey(const QModelIndex &index); }; @@ -173,9 +206,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_; @@ -185,4 +218,4 @@ private: } // namespace views } // namespace pv -#endif // PULSEVIEW_PV_VIEWS_TABULARDECODER_VIEW_HPP +#endif // PULSEVIEW_PV_VIEWS_TABULAR_DECODER_VIEW_HPP