Files
sqlitebrowser/src/RemoteCommitsModel.h
Martin Kleusberg 8b5f34c406 dbhub: Show more information in tree views
This adds a column for the file size to the list of commits.

It also adds a couple of tooltips to the Remote and Commit tree views to
show additional information. Especially for remote databases this adds a
lot of valuable information.
2020-07-27 16:23:21 +02:00

45 lines
1.2 KiB
C++

#ifndef REMOTECOMMITSMODEL_H
#define REMOTECOMMITSMODEL_H
#include <QAbstractItemModel>
#include <json.hpp>
class QTreeWidgetItem;
class RemoteCommitsModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit RemoteCommitsModel(QObject* parent);
~RemoteCommitsModel() override;
void clear();
void refresh(const std::string& json_data, const std::string& last_commit_id, const std::string& current_commit_id);
QModelIndex index(int row, int column,const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& index) const override;
QVariant data(const QModelIndex& index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
enum Columns
{
ColumnCommitId,
ColumnMessage,
ColumnDate,
ColumnAuthor,
ColumnSize,
};
private:
// Pointer to the root item. This contains all the actual item data.
QTreeWidgetItem* rootItem;
};
#endif