1 #include "apitracecall.h"
4 #include "traceloader.h"
5 #include "trace_model.hpp"
10 #define QT_USE_FAST_OPERATOR_PLUS
11 #include <QStringBuilder>
12 #include <QTextDocument>
14 const char * const styleSheet =
16 " font-weight:bold;\n"
17 // text shadow looks great but doesn't work well in qtwebkit 4.7
18 " /*text-shadow: 0px 2px 3px #555;*/\n"
19 " font-size: 1.1em;\n"
22 " border: 1px solid rgb(238,206,0);\n"
23 " border-radius: 4px;\n"
24 " background: yellow;\n"
26 " box-shadow: 0px 1px 3px dimgrey;\n"
27 " -webkit-transition: background 1s linear;\n"
30 " background: white;\n"
36 " border: 1px solid rgb(255,0,0);\n"
39 " border-radius: 4px;\n"
40 // also looks great but qtwebkit doesn't support it
41 //" background: #6fb2e5;\n"
42 //" box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n"
43 //" -o-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n"
44 //" -webkit-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n"
45 //" -moz-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n"
49 // Qt::convertFromPlainText doesn't do precisely what we want
51 plainTextToHTML(const QString & plain, bool multiLine)
56 for (int i = 0; i < plain.length(); ++i) {
57 if (plain[i] == QLatin1Char('\n')){
59 rich += QLatin1String("<br>\n");
61 rich += QLatin1String("\\n");
66 if (plain[i] == QLatin1Char('\t')){
68 rich += QChar(0x00a0U);
71 rich += QChar(0x00a0U);
75 rich += QLatin1String("\\t");
78 } else if (plain[i].isSpace()) {
79 rich += QChar(0x00a0U);
81 } else if (plain[i] == QLatin1Char('<')) {
82 rich += QLatin1String("<");
83 } else if (plain[i] == QLatin1Char('>')) {
84 rich += QLatin1String(">");
85 } else if (plain[i] == QLatin1Char('&')) {
86 rich += QLatin1String("&");
95 return QLatin1Literal("\"") + rich + QLatin1Literal("\"");
102 apiVariantToString(const QVariant &variant, bool multiLine)
104 if (variant.isNull()) {
105 return QLatin1String("?");
108 if (variant.userType() == QMetaType::Float) {
109 return QString::number(variant.toFloat());
111 if (variant.userType() == QVariant::Double) {
112 return QString::number(variant.toDouble());
114 if (variant.userType() == QVariant::ByteArray) {
115 if (variant.toByteArray().size() < 1024) {
116 int bytes = variant.toByteArray().size();
117 return QObject::tr("[binary data, size = %1 bytes]").arg(bytes);
119 float kb = variant.toByteArray().size()/1024.;
120 return QObject::tr("[binary data, size = %1 kb]").arg(kb);
124 if (variant.userType() == QVariant::String) {
125 return plainTextToHTML(variant.toString(), multiLine);
128 if (variant.userType() < QVariant::UserType) {
129 return variant.toString();
132 if (variant.canConvert<ApiPointer>()) {
133 return variant.value<ApiPointer>().toString();
135 if (variant.canConvert<ApiBitmask>()) {
136 return variant.value<ApiBitmask>().toString();
138 if (variant.canConvert<ApiStruct>()) {
139 return variant.value<ApiStruct>().toString(multiLine);
141 if (variant.canConvert<ApiArray>()) {
142 return variant.value<ApiArray>().toString(multiLine);
144 if (variant.canConvert<ApiEnum>()) {
145 return variant.value<ApiEnum>().toString();
152 void VariantVisitor::visit(trace::Null *)
154 m_variant = QVariant::fromValue(ApiPointer(0));
157 void VariantVisitor::visit(trace::Bool *node)
159 m_variant = QVariant(node->value);
162 void VariantVisitor::visit(trace::SInt *node)
164 m_variant = QVariant(node->value);
167 void VariantVisitor::visit(trace::UInt *node)
169 m_variant = QVariant(node->value);
172 void VariantVisitor::visit(trace::Float *node)
174 m_variant = QVariant(node->value);
177 void VariantVisitor::visit(trace::Double *node)
179 m_variant = QVariant(node->value);
182 void VariantVisitor::visit(trace::String *node)
184 m_variant = QVariant(QString::fromStdString(node->value));
187 void VariantVisitor::visit(trace::Enum *e)
189 ApiTraceEnumSignature *sig = 0;
192 sig = m_loader->enumSignature(e->sig->id);
195 sig = new ApiTraceEnumSignature(
196 QString::fromStdString(e->sig->name),
197 QVariant(e->sig->value));
199 m_loader->addEnumSignature(e->sig->id, sig);
203 m_variant = QVariant::fromValue(ApiEnum(sig));
206 void VariantVisitor::visit(trace::Bitmask *bitmask)
208 m_variant = QVariant::fromValue(ApiBitmask(bitmask));
211 void VariantVisitor::visit(trace::Struct *str)
213 m_variant = QVariant::fromValue(ApiStruct(str));
216 void VariantVisitor::visit(trace::Array *array)
218 m_variant = QVariant::fromValue(ApiArray(array));
221 void VariantVisitor::visit(trace::Blob *blob)
223 QByteArray barray = QByteArray(blob->buf, blob->size);
224 m_variant = QVariant(barray);
227 void VariantVisitor::visit(trace::Pointer *ptr)
229 m_variant = QVariant::fromValue(ApiPointer(ptr->value));
233 ApiEnum::ApiEnum(ApiTraceEnumSignature *sig)
238 QString ApiEnum::toString() const
241 return m_sig->name();
243 Q_ASSERT(!"should never happen");
247 QVariant ApiEnum::value() const
250 return m_sig->value();
252 Q_ASSERT(!"should never happen");
256 QString ApiEnum::name() const
259 return m_sig->name();
261 Q_ASSERT(!"should never happen");
265 unsigned long long ApiBitmask::value() const
270 ApiBitmask::Signature ApiBitmask::signature() const
275 ApiStruct::Signature ApiStruct::signature() const
280 QList<QVariant> ApiStruct::values() const
285 ApiPointer::ApiPointer(unsigned long long val)
291 unsigned long long ApiPointer::value() const
296 QString ApiPointer::toString() const
299 return QString("0x%1").arg(m_value, 0, 16);
301 return QLatin1String("NULL");
304 ApiBitmask::ApiBitmask(const trace::Bitmask *bitmask)
310 void ApiBitmask::init(const trace::Bitmask *bitmask)
315 m_value = bitmask->value;
316 for (const trace::BitmaskFlag *it = bitmask->sig->flags;
317 it != bitmask->sig->flags + bitmask->sig->num_flags; ++it) {
319 QPair<QString, unsigned long long> pair;
321 pair.first = QString::fromStdString(it->name);
322 pair.second = it->value;
328 QString ApiBitmask::toString() const
331 unsigned long long value = m_value;
333 for (Signature::const_iterator it = m_sig.begin();
334 value != 0 && it != m_sig.end(); ++it) {
335 Q_ASSERT(it->second);
336 if ((value & it->second) == it->second) {
338 str += QLatin1String(" | ");
341 value &= ~it->second;
345 if (value || first) {
347 str += QLatin1String(" | ");
349 str += QString::fromLatin1("0x%1").arg(value, 0, 16);
354 ApiStruct::ApiStruct(const trace::Struct *s)
359 QString ApiStruct::toString(bool multiLine) const
363 str += QLatin1String("{");
364 for (unsigned i = 0; i < m_members.count(); ++i) {
365 str += m_sig.memberNames[i] %
366 QLatin1Literal(" = ") %
367 apiVariantToString(m_members[i], multiLine);
368 if (i < m_members.count() - 1)
369 str += QLatin1String(", ");
371 str += QLatin1String("}");
376 void ApiStruct::init(const trace::Struct *s)
381 m_sig.name = QString::fromStdString(s->sig->name);
382 for (unsigned i = 0; i < s->sig->num_members; ++i) {
383 VariantVisitor vis(0);
384 m_sig.memberNames.append(
385 QString::fromStdString(s->sig->member_names[i]));
386 s->members[i]->visit(vis);
387 m_members.append(vis.variant());
391 ApiArray::ApiArray(const trace::Array *arr)
396 ApiArray::ApiArray(const QVector<QVariant> &vals)
401 QVector<QVariant> ApiArray::values() const
406 QString ApiArray::toString(bool multiLine) const
409 str += QLatin1String("[");
410 for(int i = 0; i < m_array.count(); ++i) {
411 const QVariant &var = m_array[i];
412 str += apiVariantToString(var, multiLine);
413 if (i < m_array.count() - 1)
414 str += QLatin1String(", ");
416 str += QLatin1String("]");
421 void ApiArray::init(const trace::Array *arr)
426 m_array.reserve(arr->values.size());
427 for (int i = 0; i < arr->values.size(); ++i) {
428 VariantVisitor vis(0);
429 arr->values[i]->visit(vis);
431 m_array.append(vis.variant());
436 ApiTraceState::ApiTraceState()
440 ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
442 m_parameters = parsedJson[QLatin1String("parameters")].toMap();
443 QVariantMap attachedShaders =
444 parsedJson[QLatin1String("shaders")].toMap();
445 QVariantMap::const_iterator itr;
448 for (itr = attachedShaders.constBegin(); itr != attachedShaders.constEnd();
450 QString type = itr.key();
451 QString source = itr.value().toString();
452 m_shaderSources[type] = source;
455 m_uniforms = parsedJson[QLatin1String("uniforms")].toMap();
457 QVariantMap textures =
458 parsedJson[QLatin1String("textures")].toMap();
459 for (itr = textures.constBegin(); itr != textures.constEnd(); ++itr) {
460 QVariantMap image = itr.value().toMap();
461 QSize size(image[QLatin1String("__width__")].toInt(),
462 image[QLatin1String("__height__")].toInt());
463 QString cls = image[QLatin1String("__class__")].toString();
464 QString type = image[QLatin1String("__type__")].toString();
466 image[QLatin1String("__normalized__")].toBool();
468 image[QLatin1String("__channels__")].toInt();
470 image[QLatin1String("__depth__")].toInt();
472 image[QLatin1String("__format__")].toString();
474 Q_ASSERT(type == QLatin1String("uint8"));
475 Q_ASSERT(normalized == true);
476 Q_UNUSED(normalized);
478 QByteArray dataArray =
479 image[QLatin1String("__data__")].toByteArray();
484 tex.setFormatName(formatName);
485 tex.setNumChannels(numChannels);
486 tex.setLabel(itr.key());
487 tex.contentsFromBase64(dataArray);
489 m_textures.append(tex);
493 parsedJson[QLatin1String("framebuffer")].toMap();
494 for (itr = fbos.constBegin(); itr != fbos.constEnd(); ++itr) {
495 QVariantMap buffer = itr.value().toMap();
496 QSize size(buffer[QLatin1String("__width__")].toInt(),
497 buffer[QLatin1String("__height__")].toInt());
498 QString cls = buffer[QLatin1String("__class__")].toString();
499 QString type = buffer[QLatin1String("__type__")].toString();
500 bool normalized = buffer[QLatin1String("__normalized__")].toBool();
501 int numChannels = buffer[QLatin1String("__channels__")].toInt();
502 int depth = buffer[QLatin1String("__depth__")].toInt();
503 QString formatName = buffer[QLatin1String("__format__")].toString();
505 Q_ASSERT(type == QLatin1String("uint8"));
506 Q_ASSERT(normalized == true);
507 Q_UNUSED(normalized);
509 QByteArray dataArray =
510 buffer[QLatin1String("__data__")].toByteArray();
515 fbo.setFormatName(formatName);
516 fbo.setNumChannels(numChannels);
517 fbo.setType(itr.key());
518 fbo.contentsFromBase64(dataArray);
519 m_framebuffers.append(fbo);
523 const QVariantMap & ApiTraceState::parameters() const
528 const QMap<QString, QString> & ApiTraceState::shaderSources() const
530 return m_shaderSources;
533 const QVariantMap & ApiTraceState::uniforms() const
538 bool ApiTraceState::isEmpty() const
540 return m_parameters.isEmpty();
543 const QList<ApiTexture> & ApiTraceState::textures() const
548 const QList<ApiFramebuffer> & ApiTraceState::framebuffers() const
550 return m_framebuffers;
553 ApiFramebuffer ApiTraceState::colorBuffer() const
555 foreach (ApiFramebuffer fbo, m_framebuffers) {
556 if (fbo.type() == QLatin1String("GL_BACK")) {
560 foreach (ApiFramebuffer fbo, m_framebuffers) {
561 if (fbo.type() == QLatin1String("GL_FRONT")) {
565 return ApiFramebuffer();
569 ApiTraceCallSignature::ApiTraceCallSignature(const QString &name,
570 const QStringList &argNames)
576 ApiTraceCallSignature::~ApiTraceCallSignature()
580 QUrl ApiTraceCallSignature::helpUrl() const
585 void ApiTraceCallSignature::setHelpUrl(const QUrl &url)
590 ApiTraceEvent::ApiTraceEvent()
591 : m_type(ApiTraceEvent::None),
592 m_hasBinaryData(false),
593 m_binaryDataIndex(0),
599 ApiTraceEvent::ApiTraceEvent(Type t)
601 m_hasBinaryData(false),
602 m_binaryDataIndex(0),
608 ApiTraceEvent::~ApiTraceEvent()
614 QVariantMap ApiTraceEvent::stateParameters() const
617 return m_state->parameters();
619 return QVariantMap();
623 ApiTraceState *ApiTraceEvent::state() const
628 void ApiTraceEvent::setState(ApiTraceState *state)
633 ApiTraceCall::ApiTraceCall(ApiTraceFrame *parentFrame,
635 const trace::Call *call)
636 : ApiTraceEvent(ApiTraceEvent::Call),
637 m_parentFrame(parentFrame)
641 m_signature = loader->signature(call->sig->id);
644 QString name = QString::fromStdString(call->sig->name);
645 QStringList argNames;
646 argNames.reserve(call->sig->num_args);
647 for (int i = 0; i < call->sig->num_args; ++i) {
648 argNames += QString::fromStdString(call->sig->arg_names[i]);
650 m_signature = new ApiTraceCallSignature(name, argNames);
651 loader->addSignature(call->sig->id, m_signature);
654 VariantVisitor retVisitor(loader);
655 call->ret->visit(retVisitor);
656 m_returnValue = retVisitor.variant();
658 m_argValues.reserve(call->args.size());
659 for (int i = 0; i < call->args.size(); ++i) {
661 VariantVisitor argVisitor(loader);
662 call->args[i]->visit(argVisitor);
663 m_argValues.append(argVisitor.variant());
664 if (m_argValues[i].type() == QVariant::ByteArray) {
665 m_hasBinaryData = true;
666 m_binaryDataIndex = i;
669 m_argValues.append(QVariant());
672 m_argValues.squeeze();
675 ApiTraceCall::~ApiTraceCall()
680 bool ApiTraceCall::hasError() const
682 return !m_error.isEmpty();
685 QString ApiTraceCall::error() const
690 void ApiTraceCall::setError(const QString &msg)
692 if (m_error != msg) {
694 m_richText = QString();
698 ApiTrace * ApiTraceCall::parentTrace() const
701 return m_parentFrame->parentTrace();
705 QVector<QVariant> ApiTraceCall::originalValues() const
710 void ApiTraceCall::setEditedValues(const QVector<QVariant> &lst)
712 ApiTrace *trace = parentTrace();
714 m_editedValues = lst;
715 //lets regenerate data
716 m_richText = QString();
717 m_searchText = QString();
722 if (!lst.isEmpty()) {
723 trace->callEdited(this);
725 trace->callReverted(this);
730 QVector<QVariant> ApiTraceCall::editedValues() const
732 return m_editedValues;
735 bool ApiTraceCall::edited() const
737 return !m_editedValues.isEmpty();
740 void ApiTraceCall::revert()
742 setEditedValues(QVector<QVariant>());
745 void ApiTraceCall::setHelpUrl(const QUrl &url)
747 m_signature->setHelpUrl(url);
750 void ApiTraceCall::setParentFrame(ApiTraceFrame *frame)
752 m_parentFrame = frame;
755 ApiTraceFrame * ApiTraceCall::parentFrame()const
757 return m_parentFrame;
760 int ApiTraceCall::index() const
765 QString ApiTraceCall::name() const
767 return m_signature->name();
770 QStringList ApiTraceCall::argNames() const
772 return m_signature->argNames();
775 QVector<QVariant> ApiTraceCall::arguments() const
777 if (m_editedValues.isEmpty())
780 return m_editedValues;
783 QVariant ApiTraceCall::returnValue() const
785 return m_returnValue;
788 QUrl ApiTraceCall::helpUrl() const
790 return m_signature->helpUrl();
793 bool ApiTraceCall::hasBinaryData() const
795 return m_hasBinaryData;
798 int ApiTraceCall::binaryDataIndex() const
800 return m_binaryDataIndex;
803 QStaticText ApiTraceCall::staticText() const
805 if (m_staticText && !m_staticText->text().isEmpty())
806 return *m_staticText;
808 QVector<QVariant> argValues = arguments();
810 QString richText = QString::fromLatin1(
811 "<span style=\"font-weight:bold\">%1</span>(").arg(
812 m_signature->name());
813 QStringList argNames = m_signature->argNames();
814 for (int i = 0; i < argNames.count(); ++i) {
815 richText += QLatin1String("<span style=\"color:#0000ff\">");
816 QString argText = apiVariantToString(argValues[i]);
818 //if arguments are really long (e.g. shader text), cut them
820 if (argText.length() > 40) {
821 QString shortened = argText.mid(0, 40);
822 shortened[argText.length() - 5] = '.';
823 shortened[argText.length() - 4] = '.';
824 shortened[argText.length() - 3] = '.';
825 shortened[argText.length() - 2] = argText.at(argText.length() - 2);
826 shortened[argText.length() - 1] = argText.at(argText.length() - 1);
827 richText += shortened;
831 richText += QLatin1String("</span>");
832 if (i < argNames.count() - 1)
833 richText += QLatin1String(", ");
835 richText += QLatin1String(")");
836 if (m_returnValue.isValid()) {
838 QLatin1Literal(" = ") %
839 QLatin1Literal("<span style=\"color:#0000ff\">") %
840 apiVariantToString(m_returnValue) %
841 QLatin1Literal("</span>");
845 m_staticText = new QStaticText(richText);
847 m_staticText->setText(richText);
849 opt.setWrapMode(QTextOption::NoWrap);
850 m_staticText->setTextOption(opt);
851 m_staticText->prepare();
853 return *m_staticText;
856 QString ApiTraceCall::toHtml() const
858 if (!m_richText.isEmpty())
861 m_richText += QLatin1String("<div class=\"call\">");
865 QString::fromLatin1("%1) ")
870 QString::fromLatin1("Frame %1")
871 .arg(m_parentFrame->number);
873 QUrl helpUrl = m_signature->helpUrl();
874 if (helpUrl.isEmpty()) {
875 m_richText += QString::fromLatin1(
876 "<span class=\"callName\" title=\"%1\">%2</span>(")
878 .arg(m_signature->name());
880 m_richText += QString::fromLatin1(
881 "<span class=\"callName\" title=\"%1\"><a href=\"%2\">%3</a></span>(")
883 .arg(helpUrl.toString())
884 .arg(m_signature->name());
887 QVector<QVariant> argValues = arguments();
888 QStringList argNames = m_signature->argNames();
889 for (int i = 0; i < argNames.count(); ++i) {
891 QLatin1String("<span class=\"arg-name\">") +
893 QLatin1String("</span>") +
894 QLatin1Literal(" = ") +
895 QLatin1Literal("<span class=\"arg-value\">") +
896 apiVariantToString(argValues[i], true) +
897 QLatin1Literal("</span>");
898 if (i < argNames.count() - 1)
899 m_richText += QLatin1String(", ");
901 m_richText += QLatin1String(")");
903 if (m_returnValue.isValid()) {
905 QLatin1String(" = ") +
906 QLatin1String("<span style=\"color:#0000ff\">") +
907 apiVariantToString(m_returnValue, true) +
908 QLatin1String("</span>");
910 m_richText += QLatin1String("</div>");
915 "<div class=\"error\">%1</div>")
917 m_richText += errorStr;
922 "<html><head><style type=\"text/css\" media=\"all\">"
923 "%1</style></head><body>%2</body></html>")
926 m_richText.squeeze();
928 //qDebug()<<m_richText;
932 QString ApiTraceCall::searchText() const
934 if (!m_searchText.isEmpty())
937 QVector<QVariant> argValues = arguments();
938 m_searchText = m_signature->name() + QLatin1Literal("(");
939 QStringList argNames = m_signature->argNames();
940 for (int i = 0; i < argNames.count(); ++i) {
941 m_searchText += argNames[i] +
942 QLatin1Literal(" = ") +
943 apiVariantToString(argValues[i]);
944 if (i < argNames.count() - 1)
945 m_searchText += QLatin1String(", ");
947 m_searchText += QLatin1String(")");
949 if (m_returnValue.isValid()) {
950 m_searchText += QLatin1Literal(" = ") +
951 apiVariantToString(m_returnValue);
953 m_searchText.squeeze();
957 int ApiTraceCall::numChildren() const
962 bool ApiTraceCall::contains(const QString &str,
963 Qt::CaseSensitivity sensitivity) const
965 QString txt = searchText();
966 return txt.contains(str, sensitivity);
970 ApiTraceFrame::ApiTraceFrame(ApiTrace *parentTrace)
971 : ApiTraceEvent(ApiTraceEvent::Frame),
972 m_parentTrace(parentTrace),
980 ApiTraceFrame::~ApiTraceFrame()
985 QStaticText ApiTraceFrame::staticText() const
987 if (m_staticText && !m_staticText->text().isEmpty())
988 return *m_staticText;
990 QString richText = QObject::tr(
991 "<span style=\"font-weight:bold\">Frame %1</span>"
993 "<span style=\"font-style:italic;font-size:small;font-weight:lighter;\"> "
996 .arg(m_loaded ? m_calls.count() : m_callsToLoad);
998 //mark the frame if it uploads more than a meg a frame
999 if (m_binaryDataSize > (1024*1024)) {
1003 "<span style=\"font-style:italic;\">"
1004 " (%2MB)</span>")
1006 .arg(double(m_binaryDataSize / (1024.*1024.)), 0, 'g', 2);
1010 m_staticText = new QStaticText(richText);
1013 opt.setWrapMode(QTextOption::NoWrap);
1014 m_staticText->setTextOption(opt);
1015 m_staticText->prepare();
1017 return *m_staticText;
1020 int ApiTraceFrame::numChildren() const
1022 return m_calls.count();
1025 ApiTrace * ApiTraceFrame::parentTrace() const
1027 return m_parentTrace;
1030 void ApiTraceFrame::addCall(ApiTraceCall *call)
1032 m_calls.append(call);
1033 if (call->hasBinaryData()) {
1035 call->arguments()[call->binaryDataIndex()].toByteArray();
1036 m_binaryDataSize += data.size();
1040 QVector<ApiTraceCall*> ApiTraceFrame::calls() const
1045 ApiTraceCall * ApiTraceFrame::call(int idx) const
1047 return m_calls.value(idx);
1051 ApiTraceCall * ApiTraceFrame::callWithIndex(int index) const
1053 QVector<ApiTraceCall*>::const_iterator itr;
1054 for (itr = m_calls.constBegin(); itr != m_calls.constEnd(); ++itr) {
1055 if ((*itr)->index() == index) {
1062 int ApiTraceFrame::callIndex(ApiTraceCall *call) const
1064 return m_calls.indexOf(call);
1067 bool ApiTraceFrame::isEmpty() const
1070 return m_calls.isEmpty();
1072 return m_callsToLoad == 0;
1076 int ApiTraceFrame::binaryDataSize() const
1078 return m_binaryDataSize;
1081 void ApiTraceFrame::setCalls(const QVector<ApiTraceCall*> &calls,
1082 quint64 binaryDataSize)
1085 m_binaryDataSize = binaryDataSize;
1087 delete m_staticText;
1091 bool ApiTraceFrame::isLoaded() const
1096 void ApiTraceFrame::setLoaded(bool l)
1101 void ApiTraceFrame::setNumChildren(int num)
1103 m_callsToLoad = num;
1106 void ApiTraceFrame::setParentTrace(ApiTrace *parent)
1108 m_parentTrace = parent;
1111 int ApiTraceFrame::numChildrenToLoad() const
1113 return m_callsToLoad;
1117 ApiTraceFrame::findNextCall(ApiTraceCall *from,
1119 Qt::CaseSensitivity sensitivity) const
1126 callIndex = m_calls.indexOf(from) + 1;
1129 for (int i = callIndex; i < m_calls.count(); ++i) {
1130 ApiTraceCall *call = m_calls[i];
1131 if (call->contains(str, sensitivity)) {
1139 ApiTraceFrame::findPrevCall(ApiTraceCall *from,
1141 Qt::CaseSensitivity sensitivity) const
1145 int callIndex = m_calls.count() - 1;
1148 callIndex = m_calls.indexOf(from) - 1;
1151 for (int i = callIndex; i >= 0; --i) {
1152 ApiTraceCall *call = m_calls[i];
1153 if (call->contains(str, sensitivity)) {
1160 void ApiTraceFrame::setLastCallIndex(unsigned index)
1162 m_lastCallIndex = index;
1165 unsigned ApiTraceFrame::lastCallIndex() const
1167 if (m_loaded && !m_calls.isEmpty()) {
1168 return m_calls.last()->index();
1170 return m_lastCallIndex;