1#ifndef GITLOGDIALOG_H
2#define GITLOGDIALOG_H
3
4#include <QDialog>
5#include <QAbstractTableModel>
6#include <QMap>
7#include "gitutils.h"
8
9namespace Ui {
10class GitLogDialog;
11}
12
13class GitLogModel: public QAbstractTableModel {
14 Q_OBJECT
15public:
16 using CommitInfoCache=QMap<int, PGitCommitInfo>;
17 using PCommitInfoCache=std::shared_ptr<CommitInfoCache>;
18 using CommitInfoCacheManager = QMap<const GitLogModel*, PCommitInfoCache>;
19 explicit GitLogModel(const QString& folder,QObject *parent = nullptr);
20 ~GitLogModel();
21
22 // QAbstractItemModel interface
23public:
24 int rowCount(const QModelIndex &parent) const override;
25 int columnCount(const QModelIndex &parent) const override;
26 QVariant data(const QModelIndex &index, int role) const override;
27 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
28 PGitCommitInfo commitInfo(const QModelIndex &index) const;
29 const QString &folder() const;
30
31private:
32 QString mFolder;
33 int mCount;
34};
35
36class GitLogDialog : public QDialog
37{
38 Q_OBJECT
39public:
40 explicit GitLogDialog(const QString& folder, QWidget *parent = nullptr);
41 ~GitLogDialog();
42
43private slots:
44 void on_btnClose_clicked();
45 void onLogsContextMenu(const QPoint &pos);
46
47 void on_actionReset_triggered();
48
49private:
50 Ui::GitLogDialog *ui;
51 GitLogModel mModel;
52};
53
54
55#endif // GITLOGDIALOG_H
56