]> sigrok.org Git - pulseview.git/blobdiff - pv/views/tabular_decoder/view.hpp
TabularDecModel: Fix multi-row selection issue
[pulseview.git] / pv / views / tabular_decoder / view.hpp
index 461cc7cd2c460092e0aa436ea6851e6652311c34..9c251382c675bbb2e2cb074dbde47016eb02afc7 100644 (file)
@@ -36,6 +36,16 @@ namespace views {
 
 namespace tabular_decoder {
 
+// 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
+};
+
+extern const char* SaveTypeNames[SaveTypeCount];
+
+
 class AnnotationCollectionModel : public QAbstractTableModel, public GlobalSettingsInterface
 {
        Q_OBJECT
@@ -43,6 +53,7 @@ class AnnotationCollectionModel : public QAbstractTableModel, public GlobalSetti
 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;
 
@@ -106,7 +117,7 @@ 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);
@@ -120,6 +131,11 @@ private Q_SLOTS:
 
        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:
@@ -136,7 +152,6 @@ private:
 
        data::DecodeSignal* signal_;
        const data::decode::Decoder* decoder_;
-       bool updating_data_;
 };
 
 } // namespace tabular_decoder