comparison src/changesetitem.cpp @ 521:b5a342a71218

Bookmarks display now... OK
author Chris Cannam
date Thu, 10 Nov 2011 17:19:06 +0000
parents a17c06f773cd
children a1d210c767ab
comparison
equal deleted inserted replaced
520:a17c06f773cd 521:b5a342a71218
336 } 336 }
337 337
338 int height = (lineCount + 1) * fh + 2; 338 int height = (lineCount + 1) * fh + 2;
339 QRectF r(x0, 0, width - 3, height); 339 QRectF r(x0, 0, width - 3, height);
340 340
341 QColor textColour = Qt::black;
342 textColour.setAlpha(alpha);
343
344 if (m_showBranch && showText) {
345 // write branch name
346 paint->save();
347 f.setBold(true);
348 paint->setFont(f);
349 paint->setPen(QPen(branchColour));
350 QString branch = m_changeset->branch();
351 if (branch == "") branch = "default";
352 int wid = width - 3;
353 branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid);
354 paint->drawText(x0, -fh + fm.ascent() - 4, branch);
355 f.setBold(false);
356 paint->restore();
357 }
358
359 QStringList bookmarks = m_changeset->bookmarks();
360 if (!bookmarks.empty() && showText) {
361 QString bmText = bookmarks.join(" ").trimmed();
362 int bw = fm.width(bmText);
363 int bx = x0 + width - bw - 14;
364 if (m_current) bx = bx - fh*1.5 + 3;
365 paint->save();
366 paint->setPen(QPen(branchColour, 2));
367 // paint->setBrush(QBrush(Qt::white));
368 paint->setBrush(QBrush(branchColour));
369 paint->drawRoundedRect(QRectF(bx, -fh - 4, bw + 4, fh * 2), 5, 5);
370 paint->setPen(QPen(Qt::white));
371 paint->drawText(bx + 2, -fh + fm.ascent() - 4, bmText);
372 paint->restore();
373 }
374
341 if (showProperLines) { 375 if (showProperLines) {
342 376
343 if (m_new) { 377 if (m_new) {
344 paint->setBrush(QColor(255, 255, 220)); 378 paint->setBrush(QColor(255, 255, 220));
345 } else { 379 } else {
377 paint->setPen(QPen(Qt::white)); 411 paint->setPen(QPen(Qt::white));
378 412
379 QString person = TextAbbrev::abbreviate(m_changeset->authorName(), 413 QString person = TextAbbrev::abbreviate(m_changeset->authorName(),
380 fm, textwid); 414 fm, textwid);
381 paint->drawText(x0 + 3, fm.ascent(), person); 415 paint->drawText(x0 + 3, fm.ascent(), person);
382
383 QColor textColour = Qt::black;
384 textColour.setAlpha(alpha);
385 416
386 paint->setPen(QPen(textColour)); 417 paint->setPen(QPen(textColour));
387 418
388 QStringList tags = m_changeset->tags(); 419 QStringList tags = m_changeset->tags();
389 if (!tags.empty()) { 420 if (!tags.empty()) {
403 int tw = fm.width(tagText); 434 int tw = fm.width(tagText);
404 paint->fillRect(QRectF(x0 + width - 8 - tw, 1, tw + 4, fh - 1), 435 paint->fillRect(QRectF(x0 + width - 8 - tw, 1, tw + 4, fh - 1),
405 QBrush(Qt::yellow)); 436 QBrush(Qt::yellow));
406 paint->drawText(x0 + width - 6 - tw, fm.ascent(), tagText); 437 paint->drawText(x0 + width - 6 - tw, fm.ascent(), tagText);
407 } 438 }
408 }
409
410 if (m_showBranch) {
411 // write branch name
412 paint->save();
413 f.setBold(true);
414 paint->setFont(f);
415 paint->setPen(QPen(branchColour));
416 QString branch = m_changeset->branch();
417 if (branch == "") branch = "default";
418 int wid = width - 3;
419 branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid);
420 paint->drawText(x0, -fh + fm.ascent() - 4, branch);
421 f.setBold(false);
422 paint->restore();
423 }
424
425 QStringList bookmarks = m_changeset->bookmarks();
426 if (!bookmarks.empty()) {
427 QString bmText = bookmarks.join(" ").trimmed();
428 int bw = fm.width(bmText);
429 paint->fillRect(QRectF(x0 + width - fh*2 - bw, -fh - 4,
430 bw + 4, fh - 1),
431 QBrush(Qt::yellow));
432 paint->drawText(x0 + width - fh*2 - bw + 2,
433 -fh + fm.ascent() - 4, bmText);
434 } 439 }
435 440
436 paint->setPen(QPen(branchColour, 2)); 441 paint->setPen(QPen(branchColour, 2));
437 paint->setBrush(Qt::NoBrush); 442 paint->setBrush(Qt::NoBrush);
438 paint->drawRoundedRect(r, 7, 7); 443 paint->drawRoundedRect(r, 7, 7);