bigsnitch/historymodel.h
2020-08-26 20:58:36 +02:00

31 lines
825 B
C++

#pragma once
#include <includes.h>
#include <QAbstractTableModel>
struct HistoryItem {
int id = -1;
double timestamp = 0;
std::string method;
std::string scheme;
std::string host;
unsigned short port = 0;
std::string path;
int status_code = 0;
std::string reason;
double rtt = 0.0;
size_t size = 0;
};
class HistoryModel : public QAbstractTableModel
{
Q_OBJECT
private:
std::vector<HistoryItem>* current_items = nullptr;
public:
HistoryModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void update(std::vector<HistoryItem>* items);
};