Menu item "Checkout" spawns a dialog, thus requires ellipsis
[qgit4/redivivus.git] / src / lanes.h
blob85e1f66815d1d429f042e87e4f56b77edb377198
1 /*
2 Author: Marco Costalba (C) 2005-2007
4 Copyright: See COPYING file that comes with this distribution
6 */
7 #ifndef LANES_H
8 #define LANES_H
10 #include <QString>
11 #include <QVector>
13 class QStringList;
17 // At any given time, the Lanes class represents a single revision (row) of the history graph.
18 // The Lanes class contains a vector of the sha1 hashes of the next commit to appear in each lane (column).
19 // The Lanes class also contains a vector used to decide which glyph to draw on the history graph.
21 // For each revision (row) (from recent (top) to ancient past (bottom)), the Lanes class is updated, and the
22 // current revision (row) of glyphs is saved elsewhere (via getLanes()).
24 // The ListView class is responsible for rendering the glyphs.
28 class Lanes {
29 public:
30 Lanes() {} // init() will setup us later, when data is available
31 bool isEmpty() { return typeVec.empty(); }
32 void init(const QString& expectedSha);
33 void clear();
34 bool isFork(const QString& sha, bool& isDiscontinuity);
35 void setBoundary(bool isBoundary);
36 void setFork(const QString& sha);
37 void setMerge(const QStringList& parents);
38 void setInitial();
39 void setApplied();
40 void changeActiveLane(const QString& sha);
41 void afterMerge();
42 void afterFork();
43 bool isBranch();
44 void afterBranch();
45 void afterApplied();
46 void nextParent(const QString& sha);
47 void getLanes(QVector<int> &ln) { ln = typeVec; } // O(1) vector is implicitly shared
49 private:
50 int findNextSha(const QString& next, int pos);
51 int findType(int type, int pos);
52 int add(int type, const QString& next, int pos);
54 int activeLane;
55 QVector<int> typeVec; // Describes which glyphs should be drawn.
56 QVector<QString> nextShaVec; // The sha1 hashes of the next commit to appear in each lane (column).
57 bool boundary;
58 int NODE, NODE_L, NODE_R;
61 #endif