Mercurial > hg > easyhg
comparison src/changesetitem.cpp @ 390:ef31a55c86b6 item_appearance_adjustments
Add little yellow star to current item
author | Chris Cannam |
---|---|
date | Tue, 24 May 2011 17:21:31 +0100 |
parents | ce6a70970808 |
children | 1a811e7721f1 |
comparison
equal
deleted
inserted
replaced
389:496f2042155a | 390:ef31a55c86b6 |
---|---|
31 #include <QLabel> | 31 #include <QLabel> |
32 #include <QWidgetAction> | 32 #include <QWidgetAction> |
33 #include <QApplication> | 33 #include <QApplication> |
34 #include <QClipboard> | 34 #include <QClipboard> |
35 | 35 |
36 QImage *ChangesetItem::m_star = 0; | |
37 | |
36 ChangesetItem::ChangesetItem(Changeset *cs) : | 38 ChangesetItem::ChangesetItem(Changeset *cs) : |
37 m_changeset(cs), m_detail(0), | 39 m_changeset(cs), m_detail(0), |
38 m_showBranch(false), m_column(0), m_row(0), m_wide(false), | 40 m_showBranch(false), m_column(0), m_row(0), m_wide(false), |
39 m_current(false), m_new(false) | 41 m_current(false), m_new(false) |
40 { | 42 { |
41 m_font = QFont(); | 43 m_font = QFont(); |
42 m_font.setPixelSize(11); | 44 m_font.setPixelSize(11); |
43 m_font.setBold(false); | 45 m_font.setBold(false); |
44 m_font.setItalic(false); | 46 m_font.setItalic(false); |
45 setCursor(Qt::ArrowCursor); | 47 setCursor(Qt::ArrowCursor); |
48 | |
49 if (!m_star) m_star = new QImage(":images/star.png"); | |
46 } | 50 } |
47 | 51 |
48 QString | 52 QString |
49 ChangesetItem::getId() | 53 ChangesetItem::getId() |
50 { | 54 { |
383 | 387 |
384 paint->setPen(QPen(branchColour, 2)); | 388 paint->setPen(QPen(branchColour, 2)); |
385 paint->setBrush(Qt::NoBrush); | 389 paint->setBrush(Qt::NoBrush); |
386 paint->drawRoundedRect(r, 7, 7); | 390 paint->drawRoundedRect(r, 7, 7); |
387 | 391 |
392 if (m_current && showProperLines) { | |
393 paint->setRenderHint(QPainter::SmoothPixmapTransform, true); | |
394 int starSize = fh * 1.5; | |
395 paint->drawImage(QRectF(x0 + width - starSize, | |
396 -fh, starSize, starSize), | |
397 *m_star); | |
398 } | |
399 | |
388 if (m_showBranch) { | 400 if (m_showBranch) { |
389 // write branch name | 401 // write branch name |
390 paint->save(); | 402 paint->save(); |
391 f.setBold(true); | 403 f.setBold(true); |
392 paint->setFont(f); | 404 paint->setFont(f); |
442 int fh = fm.height(); | 454 int fh = fm.height(); |
443 int size = fh * 2; | 455 int size = fh * 2; |
444 int x0 = -size/2 + 25; | 456 int x0 = -size/2 + 25; |
445 | 457 |
446 paint->setBrush(Qt::white); | 458 paint->setBrush(Qt::white); |
459 | |
460 if (showProperLines) { | |
461 | |
462 if (m_current) { | |
463 paint->drawEllipse(QRectF(x0 - 4, fh - 4, size + 8, size + 8)); | |
464 } | |
465 | |
466 if (m_new) { | |
467 paint->save(); | |
468 paint->setPen(Qt::yellow); | |
469 paint->setBrush(Qt::NoBrush); | |
470 paint->drawEllipse(QRectF(x0 - 2, fh - 2, size + 4, size + 4)); | |
471 paint->restore(); | |
472 } | |
473 } | |
474 | |
447 paint->drawEllipse(QRectF(x0, fh, size, size)); | 475 paint->drawEllipse(QRectF(x0, fh, size, size)); |
448 | 476 |
449 if (m_showBranch) { | 477 if (m_showBranch) { |
450 // write branch name | 478 // write branch name |
451 paint->save(); | 479 paint->save(); |
459 paint->drawText(-wid/2 + 25, fm.ascent() - 4, branch); | 487 paint->drawText(-wid/2 + 25, fm.ascent() - 4, branch); |
460 f.setBold(false); | 488 f.setBold(false); |
461 paint->restore(); | 489 paint->restore(); |
462 } | 490 } |
463 | 491 |
492 if (m_current && showProperLines) { | |
493 paint->setRenderHint(QPainter::SmoothPixmapTransform, true); | |
494 int starSize = fh * 1.5; | |
495 paint->drawImage(QRectF(x0 + size - starSize/2, | |
496 0, starSize, starSize), | |
497 *m_star); | |
498 } | |
499 | |
464 paint->restore(); | 500 paint->restore(); |
465 } | 501 } |
466 | 502 |