| 165 | } |
| 166 | |
| 167 | void VcsAnnotationItemDelegate::renderMessageAndAge(QPainter* painter, |
| 168 | const KTextEditor::StyleOptionAnnotationItem& option, |
| 169 | const QRect& messageRect, const QString& messageText, |
| 170 | const QRect& ageRect, const QString& ageText) const |
| 171 | { |
| 172 | Q_UNUSED(option); |
| 173 | |
| 174 | painter->save(); |
| 175 | |
| 176 | const auto normalStyle = option.view->defaultStyleAttribute(KSyntaxHighlighting::Theme::TextStyle::Normal); |
| 177 | painter->setPen(normalStyle->foreground().color()); |
| 178 | painter->drawText(messageRect, Qt::AlignLeading | Qt::AlignVCenter, |
| 179 | painter->fontMetrics().elidedText(messageText, Qt::ElideRight, messageRect.width())); |
| 180 | |
| 181 | // TODO: defaultStyleAttribute only returns reliably for TextStyle::Normal, so what to do for a comment-like color? |
| 182 | const auto commentStyle = option.view->defaultStyleAttribute(KSyntaxHighlighting::Theme::TextStyle::Normal); |
| 183 | painter->setPen(commentStyle->foreground().color()); |
| 184 | painter->drawText(ageRect, Qt::AlignTrailing | Qt::AlignVCenter, ageText); |
| 185 | |
| 186 | painter->restore(); |
| 187 | } |
| 188 | |
| 189 | void VcsAnnotationItemDelegate::renderAuthor(QPainter* painter, |
| 190 | const KTextEditor::StyleOptionAnnotationItem& option, |