X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftabular_decoder%2Fview.hpp;h=484b81be799775a3619b7fe969175ad470a878ed;hp=83a4549161bed2d391312aa8db669317ef9be264;hb=85125b0f34be424fdf8a8a5133f2494722077d7d;hpb=24d69d27584c7adec70bc0d6db764a3db04fce3c diff --git a/pv/views/tabular_decoder/view.hpp b/pv/views/tabular_decoder/view.hpp index 83a45491..484b81be 100644 --- a/pv/views/tabular_decoder/view.hpp +++ b/pv/views/tabular_decoder/view.hpp @@ -25,6 +25,7 @@ #include #include +#include "pv/globalsettings.hpp" #include "pv/views/viewbase.hpp" #include "pv/data/decodesignal.hpp" @@ -35,37 +36,14 @@ namespace views { namespace tabular_decoder { -class AnnotationCollectionItem -{ -public: - AnnotationCollectionItem(const vector& data, - shared_ptr parent = nullptr); - - void appendSubItem(shared_ptr item); - - shared_ptr subItem(int row) const; - shared_ptr parent() const; - shared_ptr findSubItem(const QVariant& value, int column); - - int subItemCount() const; - int columnCount() const; - int row() const; - QVariant data(int column) const; - -private: - vector< shared_ptr > subItems_; - vector data_; - shared_ptr parent_; -}; - - -class AnnotationCollectionModel : public QAbstractItemModel +class AnnotationCollectionModel : public QAbstractTableModel, public GlobalSettingsInterface { Q_OBJECT public: AnnotationCollectionModel(QObject* parent = nullptr); + 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; @@ -79,8 +57,27 @@ public: int rowCount(const QModelIndex& parent_idx = QModelIndex()) const override; int columnCount(const QModelIndex& parent_idx = QModelIndex()) const override; + void set_signal_and_segment(data::DecodeSignal* signal, uint32_t current_segment); + + void on_setting_changed(const QString &key, const QVariant &value) override; + private: - shared_ptr root_; + vector header_data_; + const deque* all_annotations_; + data::DecodeSignal* signal_; + uint32_t prev_segment_; + uint64_t prev_last_row_; + bool theme_is_dark_; +}; + + +class QCustomTableView : public QTableView +{ + Q_OBJECT + +public: + QSize minimumSizeHint() const; + QSize sizeHint() const; }; @@ -115,29 +112,37 @@ private: private Q_SLOTS: void on_selected_decoder_changed(int index); void on_signal_name_changed(const QString &name); + void on_signal_color_changed(const QColor &color); void on_new_annotations(); + void on_decoder_reset(); void on_decoder_stacked(void* decoder); void on_decoder_removed(void* decoder); void on_actionSave_triggered(QAction* action = nullptr); + void on_table_item_clicked(const QModelIndex& index); + void on_table_item_double_clicked(const QModelIndex& index); + void on_table_header_requested(const QPoint& pos); + void on_table_header_toggled(bool checked); + virtual void perform_delayed_view_update(); private: QWidget* parent_; - QComboBox *decoder_selector_; + QComboBox* decoder_selector_; QToolButton* save_button_; QAction* save_action_; - QTableView* table_view_; + QCustomTableView* table_view_; AnnotationCollectionModel* model_; - data::DecodeSignal *signal_; - const data::decode::Decoder *decoder_; + data::DecodeSignal* signal_; + const data::decode::Decoder* decoder_; + bool updating_data_; }; } // namespace tabular_decoder