#pragma once #include #include #include #include #include //! The HistoryModel implements the AbstractTableModel for interacting with the view. class HistoryModel : public QAbstractTableModel { Q_OBJECT private: mutable std::mutex history_mutex; std::vector* current_items = nullptr; std::string getRequestHeader(const HistoryItem& item) const; std::string getResponseHeader(const HistoryItem& item) const; public: //! HistoryModel constructor HistoryModel(QObject *parent = nullptr); //! rowCount int rowCount(const QModelIndex &parent = QModelIndex()) const override; //! columnCount int columnCount(const QModelIndex &parent = QModelIndex()) const override; //! data QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; //! headerData QVariant headerData(int section, Qt::Orientation orientation, int role) const override; //! update void update(std::vector* items); }; //! HistoryProxyModel implements a SortFilterProxyModel for interacting with the view class HistoryProxyModel : public QSortFilterProxyModel { Q_OBJECT private: public: //! lessThan bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; //! filterAcceptsRow bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; };