X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsubwindows%2Fdecoder_selector%2Fsubwindow.hpp;h=c189fb24860efb085a859617e5bd8bf4bcb896eb;hp=baeedd36dad343a7247a8bdf53be2b2643c49916;hb=c409988b235a55772537ef92e1a231bb0a75fa6e;hpb=c2b80ad9a17caef1089848134b2354c544ea1dc3 diff --git a/pv/subwindows/decoder_selector/subwindow.hpp b/pv/subwindows/decoder_selector/subwindow.hpp index baeedd36..c189fb24 100644 --- a/pv/subwindows/decoder_selector/subwindow.hpp +++ b/pv/subwindows/decoder_selector/subwindow.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ class DecoderCollectionModel : public QAbstractItemModel Q_OBJECT public: - DecoderCollectionModel(QObject* parent = 0); + DecoderCollectionModel(QObject* parent = nullptr); QVariant data(const QModelIndex& index, int role) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; @@ -84,6 +85,23 @@ private: }; +class QCustomSortFilterProxyModel : public QSortFilterProxyModel +{ +protected: + bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const; +}; + +class QCustomTreeView : public QTreeView +{ + Q_OBJECT + +public: + void currentChanged(const QModelIndex& current, const QModelIndex& previous); + +Q_SIGNALS: + void currentChanged(const QModelIndex& current); +}; + class SubWindow : public SubWindowBase { Q_OBJECT @@ -94,38 +112,42 @@ public: bool has_toolbar() const; QToolBar* create_toolbar(QWidget *parent) const; - const srd_decoder* get_srd_decoder_from_id(QString id) const; + int minimum_width() const; /** * Returns a list of input types that a given protocol decoder requires * ("logic", "uart", etc.) */ - vector decoder_inputs(const srd_decoder* d) const; + vector get_decoder_inputs(const srd_decoder* d) const; /** * Returns a list of protocol decoder IDs which provide a given output * ("uart", "spi", etc.) */ - vector decoders_providing(const char* output) const; + vector get_decoders_providing(const char* output) const; Q_SIGNALS: void new_decoders_selected(vector decoders); public Q_SLOTS: - void on_item_clicked(const QModelIndex& index); - void on_item_double_clicked(const QModelIndex& index); + void on_item_changed(const QModelIndex& index); + void on_item_activated(const QModelIndex& index); + + void on_filter_changed(const QString& text); + void on_filter_return_pressed(); private: QSplitter* splitter_; - QTreeView* tree_view_; + QCustomTreeView* tree_view_; QWidget* info_box_; QLabel* info_label_header_; QLabel* info_label_body_; QLabel* info_label_footer_; DecoderCollectionModel* model_; + QCustomSortFilterProxyModel* sort_filter_model_; }; -} // decoder_selector +} // namespace decoder_selector } // namespace subwindows } // namespace pv