X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftabular_decoder%2Fview.hpp;h=93761bda49bc15e56fadad2162bec7791aa55b13;hb=c84afcfd68ab1fef53e579c8c04d4e83ef9597a0;hp=b19ba61450fbe59248f9a6950fc55794585ef324;hpb=f54e68b03d5d24c7787962fcc701d8d52b0ec8ab;p=pulseview.git diff --git a/pv/views/tabular_decoder/view.hpp b/pv/views/tabular_decoder/view.hpp index b19ba614..93761bda 100644 --- a/pv/views/tabular_decoder/view.hpp +++ b/pv/views/tabular_decoder/view.hpp @@ -21,10 +21,12 @@ #define PULSEVIEW_PV_VIEWS_TABULARDECODER_VIEW_HPP #include +#include #include #include #include +#include "pv/globalsettings.hpp" #include "pv/views/viewbase.hpp" #include "pv/data/decodesignal.hpp" @@ -35,13 +37,33 @@ namespace views { namespace tabular_decoder { -class AnnotationCollectionModel : public QAbstractTableModel +// When adding an entry here, don't forget to update SaveTypeNames as well +enum SaveType { + SaveTypeCSVEscaped, + SaveTypeCSVQuoted, + SaveTypeCount // Indicates how many save types there are, must always be last +}; + +// When adding an entry here, don't forget to update ViewModeNames as well +enum ViewModeType { + ViewModeAll, + ViewModeLatest, +// ViewModeVisible, + ViewModeCount // Indicates how many save types there are, must always be last +}; + +extern const char* SaveTypeNames[SaveTypeCount]; +extern const char* ViewModeNames[ViewModeCount]; + + +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; @@ -56,12 +78,22 @@ public: int columnCount(const QModelIndex& parent_idx = QModelIndex()) const override; void set_signal_and_segment(data::DecodeSignal* signal, uint32_t current_segment); + void set_hide_hidden(bool hide_hidden); + + void update_annotations_without_hidden(); + + void on_setting_changed(const QString &key, const QVariant &value) override; private: vector header_data_; const deque* all_annotations_; + deque all_annotations_without_hidden_; + const deque* dataset_; + data::DecodeSignal* signal_; uint32_t prev_segment_; uint64_t prev_last_row_; + bool hide_hidden_; + bool theme_is_dark_; }; @@ -101,24 +133,36 @@ private: void reset_data(); void update_data(); - void save_data() const; + void save_data_as_csv(unsigned int save_type) const; private Q_SLOTS: void on_selected_decoder_changed(int index); + void on_hide_hidden_changed(bool checked); + void on_view_mode_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_; + QCheckBox* hide_hidden_cb_; + QComboBox* view_mode_selector_; QToolButton* save_button_; QAction* save_action_; @@ -129,7 +173,6 @@ private: data::DecodeSignal* signal_; const data::decode::Decoder* decoder_; - bool updating_data_; }; } // namespace tabular_decoder