comparison changesetdetailitem.cpp @ 125:63c2f3f61c79

* Add Incoming dialog and better layouts for dialogs generally
author Chris Cannam
date Mon, 29 Nov 2010 17:03:17 +0000
parents 1f27f71a7034
children fcaf09ee825d
comparison
equal deleted inserted replaced
124:1f27f71a7034 125:63c2f3f61c79
56 { 56 {
57 paint->save(); 57 paint->save();
58 58
59 ColourSet *colourSet = ColourSet::instance(); 59 ColourSet *colourSet = ColourSet::instance();
60 QColor branchColour = colourSet->getColourFor(m_changeset->branch()); 60 QColor branchColour = colourSet->getColourFor(m_changeset->branch());
61 QColor userColour = colourSet->getColourFor(m_changeset->author()); 61 QColor userColour = colourSet->getColourFor(m_changeset->user());
62 62
63 QFont f(m_font); 63 QFont f(m_font);
64 64
65 QTransform t = paint->worldTransform(); 65 QTransform t = paint->worldTransform();
66 float scale = std::min(t.m11(), t.m22()); 66 float scale = std::min(t.m11(), t.m22());
118 118
119 void 119 void
120 ChangesetDetailItem::makeDocument() 120 ChangesetDetailItem::makeDocument()
121 { 121 {
122 delete m_doc; 122 delete m_doc;
123
124 QString description;
125 QString rowTemplate = "<tr><td><b>%1</b></td><td>%2</td></tr>";
126
127 description = "<qt><table border=0>";
128
129 QString comment = m_changeset->comment().trimmed();
130 comment = comment.replace(QRegExp("^\""), "");
131 comment = comment.replace(QRegExp("\"$"), "");
132 comment = comment.replace("\\\"", "\"");
133 comment = xmlEncode(comment);
134 comment = comment.replace("\\n", "<br>");
135
136 QStringList propNames, propTexts;
137
138 propNames << "id"
139 << "author"
140 << "datetime"
141 << "branch"
142 << "tag"
143 << "comment";
144
145 propTexts << QObject::tr("Identifier")
146 << QObject::tr("Author")
147 << QObject::tr("Date")
148 << QObject::tr("Branch")
149 << QObject::tr("Tag")
150 << QObject::tr("Comment");
151
152 for (int i = 0; i < propNames.size(); ++i) {
153 QString prop = propNames[i];
154 QString value;
155 if (prop == "comment") value = comment;
156 else {
157 value = xmlEncode(m_changeset->property
158 (prop.toLocal8Bit().data()).toString());
159 }
160 if (value != "") {
161 description += rowTemplate
162 .arg(xmlEncode(propTexts[i]))
163 .arg(value);
164 }
165 }
166
167 description += "</table></qt>";
168
169 DEBUG << "ChangesetDetailItem: description = " << description << endl;
170
171 m_doc = new QTextDocument; 123 m_doc = new QTextDocument;
172 m_doc->setHtml(description); 124 m_doc->setHtml(m_changeset->formatHtml());
173 } 125 }
174 126