Mercurial > hg > easyhg
comparison changesetitem.cpp @ 128:fcaf09ee825d
* Show tags and current working copy parents in history graph
author | Chris Cannam |
---|---|
date | Mon, 29 Nov 2010 20:09:58 +0000 |
parents | 63c2f3f61c79 |
children | 16ceeee30e2a |
comparison
equal
deleted
inserted
replaced
127:758471b71721 | 128:fcaf09ee825d |
---|---|
25 #include <QPainter> | 25 #include <QPainter> |
26 #include <QGraphicsScene> | 26 #include <QGraphicsScene> |
27 | 27 |
28 ChangesetItem::ChangesetItem(Changeset *cs) : | 28 ChangesetItem::ChangesetItem(Changeset *cs) : |
29 m_changeset(cs), m_detail(0), | 29 m_changeset(cs), m_detail(0), |
30 m_showBranch(false), m_column(0), m_row(0), m_wide(false) | 30 m_showBranch(false), m_column(0), m_row(0), m_wide(false), m_current(false) |
31 { | 31 { |
32 m_font = QFont(); | 32 m_font = QFont(); |
33 m_font.setPixelSize(11); | 33 m_font.setPixelSize(11); |
34 m_font.setBold(false); | 34 m_font.setBold(false); |
35 m_font.setItalic(false); | 35 m_font.setItalic(false); |
87 { | 87 { |
88 paint->save(); | 88 paint->save(); |
89 | 89 |
90 ColourSet *colourSet = ColourSet::instance(); | 90 ColourSet *colourSet = ColourSet::instance(); |
91 QColor branchColour = colourSet->getColourFor(m_changeset->branch()); | 91 QColor branchColour = colourSet->getColourFor(m_changeset->branch()); |
92 QColor userColour = colourSet->getColourFor(m_changeset->user()); | 92 QColor userColour = colourSet->getColourFor(m_changeset->author()); |
93 | 93 |
94 QFont f(m_font); | 94 QFont f(m_font); |
95 | 95 |
96 QTransform t = paint->worldTransform(); | 96 QTransform t = paint->worldTransform(); |
97 float scale = std::min(t.m11(), t.m22()); | 97 float scale = std::min(t.m11(), t.m22()); |
117 | 117 |
118 int height = 49; | 118 int height = 49; |
119 QRectF r(x0, 0, width - 3, height); | 119 QRectF r(x0, 0, width - 3, height); |
120 paint->drawRect(r); | 120 paint->drawRect(r); |
121 | 121 |
122 if (m_current) { | |
123 paint->drawRect(QRectF(x0 - 4, -4, width + 5, height + 8)); | |
124 } | |
125 | |
122 if (scale < 0.1) { | 126 if (scale < 0.1) { |
123 paint->restore(); | 127 paint->restore(); |
124 return; | 128 return; |
125 } | 129 } |
126 | 130 |
128 QBrush(userColour)); | 132 QBrush(userColour)); |
129 | 133 |
130 paint->setPen(QPen(Qt::white)); | 134 paint->setPen(QPen(Qt::white)); |
131 | 135 |
132 int wid = width - 5; | 136 int wid = width - 5; |
133 QString person = TextAbbrev::abbreviate(m_changeset->userName(), fm, wid); | 137 QString person = TextAbbrev::abbreviate(m_changeset->authorName(), fm, wid); |
134 paint->drawText(x0 + 3, fm.ascent(), person); | 138 paint->drawText(x0 + 3, fm.ascent(), person); |
135 | 139 |
136 paint->setPen(QPen(Qt::black)); | 140 paint->setPen(QPen(Qt::black)); |
141 | |
142 QString tags = m_changeset->tags().join(" ").trimmed(); | |
143 if (tags != "") { | |
144 int tw = fm.width(tags); | |
145 paint->fillRect(QRectF(x0 + width - 8 - tw, 1, tw + 4, fh - 1), | |
146 QBrush(Qt::yellow)); | |
147 paint->drawText(x0 + width - 6 - tw, fm.ascent(), tags); | |
148 } | |
137 | 149 |
138 if (m_showBranch) { | 150 if (m_showBranch) { |
139 // write branch name | 151 // write branch name |
140 f.setBold(true); | 152 f.setBold(true); |
141 paint->setFont(f); | 153 paint->setFont(f); |