X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fapicalldelegate.cpp;h=c68717580ddc6e5e5d94f3b95eb9fd27b8d6cf45;hb=149e71e4b1dc7521d78b471747e3c4ab1c9b5ddf;hp=c2a1b23f54f47172fcc59885989011b2c68c7d58;hpb=0ad49cbe3446dfe8404516852c904b40cf909c7c;p=apitrace diff --git a/gui/apicalldelegate.cpp b/gui/apicalldelegate.cpp index c2a1b23..c687175 100644 --- a/gui/apicalldelegate.cpp +++ b/gui/apicalldelegate.cpp @@ -12,7 +12,8 @@ ApiCallDelegate::ApiCallDelegate(QWidget *parent) : QStyledItemDelegate(parent), m_stateEmblem(":/resources/dialog-information.png"), - m_editEmblem(":/resources/document-edit.png") + m_editEmblem(":/resources/document-edit.png"), + m_errorEmblem(":/resources/script-error.png") { } @@ -26,13 +27,24 @@ void ApiCallDelegate::paint(QPainter *painter, Q_ASSERT(index.column() == 0); if (event) { - QPoint offset; + QPoint offset = QPoint(0, 0); QStaticText text = event->staticText(); //text.setTextWidth(option.rect.width()); //QStyledItemDelegate::paint(painter, option, index); QStyle *style = QApplication::style(); style->drawControl(QStyle::CE_ItemViewItem, &option, painter, 0); - if (!event->state().isEmpty()) { + + // draw thumbnail of frame + if(event->type() == ApiTraceEvent::Frame) { + ApiTraceFrame *frame = static_cast(event); + const QImage & thumbnail = frame->thumbnail(); + if (!thumbnail.isNull()) { + painter->drawImage(option.rect.topLeft() + offset, thumbnail); + offset += QPoint(option.rect.height() + 16, 0); + } + } + + if (event->hasState()) { QPixmap px = m_stateEmblem.pixmap(option.rect.height(), option.rect.height()); painter->drawPixmap(option.rect.topLeft(), px); @@ -40,6 +52,12 @@ void ApiCallDelegate::paint(QPainter *painter, } if (event->type() == ApiTraceEvent::Call) { ApiTraceCall *call = static_cast(event); + if (call->hasError()) { + QPixmap px = m_errorEmblem.pixmap(option.rect.height(), + option.rect.height()); + painter->drawPixmap(option.rect.topLeft() + offset, px); + offset += QPoint(option.rect.height() + 5, 0); + } if (call->edited()) { QPixmap px = m_editEmblem.pixmap(option.rect.height(), option.rect.height()); @@ -60,7 +78,10 @@ QSize ApiCallDelegate::sizeHint(const QStyleOptionViewItem &option, ApiTraceEvent *event = index.data(ApiTraceModel::EventRole).value(); +#ifndef __APPLE__ + /* XXX: This fails on MacOSX, but seems safe to ignore */ Q_ASSERT(index.column() == 0); +#endif if (event) { QStaticText text = event->staticText();