1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
/*
Description: interface to git programs
Author: Marco Costalba (C) 2005-2007
Copyright: See COPYING file that comes with this distribution
*/
#ifndef FILEHISTORY_H
#define FILEHISTORY_H
#include <QAbstractItemModel>
#include "common.h"
//class Annotate;
//class DataLoader;
class Git;
class Lanes;
class FileHistory : public QAbstractItemModel
{
Q_OBJECT
public:
FileHistory(QObject* parent, Git* git);
~FileHistory();
void clear(bool complete = true);
const QString sha(int row) const;
int row(SCRef sha) const;
const QStringList fileNames() const { return fNames; }
void resetFileNames(SCRef fn);
void setEarlyOutputState(bool b = true) { earlyOutputCnt = (b ? earlyOutputCntBase : -1); }
void setAnnIdValid(bool b = true) { annIdValid = b; }
virtual QVariant data(const QModelIndex &index, int role) const;
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
virtual QVariant headerData(int s, Qt::Orientation o, int role = Qt::DisplayRole) const;
virtual QModelIndex index(int r, int c, const QModelIndex& par = QModelIndex()) const;
virtual QModelIndex parent(const QModelIndex& index) const;
virtual int rowCount(const QModelIndex& par = QModelIndex()) const;
virtual bool hasChildren(const QModelIndex& par = QModelIndex()) const;
virtual int columnCount(const QModelIndex&) const { return 6; }
public slots:
void on_changeFont(const QFont&);
private slots:
void on_newRevsAdded(const FileHistory*, const QVector<ShaString>&);
void on_loadCompleted(const FileHistory*, const QString&);
private:
friend class Annotate;
friend class DataLoader;
friend class Git;
void flushTail();
const QString timeDiff(unsigned long secs) const;
Git* git;
RevMap revs;
ShaVect revOrder;
Lanes* lns;
uint firstFreeLane;
QList<QByteArray*> rowData;
QList<QVariant> headerInfo;
int rowCnt;
bool annIdValid;
unsigned long secs;
int loadTime;
int earlyOutputCnt;
int earlyOutputCntBase;
QStringList fNames;
QStringList curFNames;
QStringList renamedRevs;
QHash<QString, QString> renamedPatches;
};
#endif // FILEHISTORY_H
|