RedPanda-CPP/RedPandaIDE/vcs/gitlogdialog.h

56 lines
1.4 KiB
C
Raw Normal View History

2022-02-21 23:35:28 +08:00
#ifndef GITLOGDIALOG_H
#define GITLOGDIALOG_H
#include <QDialog>
#include <QAbstractTableModel>
#include <QMap>
#include "gitutils.h"
namespace Ui {
class GitLogDialog;
}
class GitLogModel: public QAbstractTableModel {
Q_OBJECT
2022-02-21 23:35:28 +08:00
public:
2022-02-23 19:25:34 +08:00
using CommitInfoCache=QMap<int, PGitCommitInfo>;
using PCommitInfoCache=std::shared_ptr<CommitInfoCache>;
using CommitInfoCacheManager = QMap<const GitLogModel*, PCommitInfoCache>;
2022-02-21 23:35:28 +08:00
explicit GitLogModel(const QString& folder,QObject *parent = nullptr);
2022-02-23 19:25:34 +08:00
~GitLogModel();
2022-02-21 23:35:28 +08:00
// QAbstractItemModel interface
public:
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
2022-02-23 19:25:34 +08:00
PGitCommitInfo commitInfo(const QModelIndex &index) const;
2022-02-21 23:35:28 +08:00
const QString &folder() const;
private:
QString mFolder;
int mCount;
};
class GitLogDialog : public QDialog
{
Q_OBJECT
public:
explicit GitLogDialog(const QString& folder, QWidget *parent = nullptr);
~GitLogDialog();
private slots:
void on_btnClose_clicked();
void onLogsContextMenu(const QPoint &pos);
2022-02-22 17:12:54 +08:00
void on_actionReset_triggered();
2022-02-21 23:35:28 +08:00
private:
Ui::GitLogDialog *ui;
GitLogModel mModel;
};
2022-02-23 19:25:34 +08:00
2022-02-21 23:35:28 +08:00
#endif // GITLOGDIALOG_H