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.2em;\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.userType() == QVariant::Double) {
105 return QString::number(variant.toFloat());
107 if (variant.userType() == QVariant::ByteArray) {
108 if (variant.toByteArray().size() < 1024) {
109 int bytes = variant.toByteArray().size();
110 return QObject::tr("[binary data, size = %1 bytes]").arg(bytes);
112 float kb = variant.toByteArray().size()/1024.;
113 return QObject::tr("[binary data, size = %1 kb]").arg(kb);
117 if (variant.userType() == QVariant::String) {
118 return plainTextToHTML(variant.toString(), multiLine);
121 if (variant.userType() < QVariant::UserType) {
122 return variant.toString();
125 if (variant.canConvert<ApiPointer>()) {
126 return variant.value<ApiPointer>().toString();
128 if (variant.canConvert<ApiBitmask>()) {
129 return variant.value<ApiBitmask>().toString();
131 if (variant.canConvert<ApiStruct>()) {
132 return variant.value<ApiStruct>().toString(multiLine);
134 if (variant.canConvert<ApiArray>()) {
135 return variant.value<ApiArray>().toString(multiLine);
137 if (variant.canConvert<ApiEnum>()) {
138 return variant.value<ApiEnum>().toString();
145 void VariantVisitor::visit(Trace::Null *)
147 m_variant = QVariant::fromValue(ApiPointer(0));
150 void VariantVisitor::visit(Trace::Bool *node)
152 m_variant = QVariant(node->value);
155 void VariantVisitor::visit(Trace::SInt *node)
157 m_variant = QVariant(node->value);
160 void VariantVisitor::visit(Trace::UInt *node)
162 m_variant = QVariant(node->value);
165 void VariantVisitor::visit(Trace::Float *node)
167 m_variant = QVariant(node->value);
170 void VariantVisitor::visit(Trace::String *node)
172 m_variant = QVariant(QString::fromStdString(node->value));
175 void VariantVisitor::visit(Trace::Enum *e)
177 ApiTraceEnumSignature *sig = 0;
180 sig = m_loader->enumSignature(e->sig->id);
183 sig = new ApiTraceEnumSignature(
184 QString::fromStdString(e->sig->name),
185 QVariant(e->sig->value));
187 m_loader->addEnumSignature(e->sig->id, sig);
191 m_variant = QVariant::fromValue(ApiEnum(sig));
194 void VariantVisitor::visit(Trace::Bitmask *bitmask)
196 m_variant = QVariant::fromValue(ApiBitmask(bitmask));
199 void VariantVisitor::visit(Trace::Struct *str)
201 m_variant = QVariant::fromValue(ApiStruct(str));
204 void VariantVisitor::visit(Trace::Array *array)
206 m_variant = QVariant::fromValue(ApiArray(array));
209 void VariantVisitor::visit(Trace::Blob *blob)
212 //FIXME: this is a nasty hack. Trace::Blob's can't
213 // delete the contents in the destructor because
214 // the data is being used by other calls. We piggy back
215 // on that assumption and don't deep copy the data. If
216 // Blob's will start deleting the data we will need to
217 // start deep copying it or switch to using something like
218 // Boost's shared_ptr or Qt's QSharedPointer to handle it
219 blob->toPointer(true);
220 QByteArray barray = QByteArray::fromRawData(blob->buf, blob->size);
221 m_variant = QVariant(barray);
224 void VariantVisitor::visit(Trace::Pointer *ptr)
226 m_variant = QVariant::fromValue(ApiPointer(ptr->value));
230 ApiEnum::ApiEnum(ApiTraceEnumSignature *sig)
235 QString ApiEnum::toString() const
238 return m_sig->name();
240 Q_ASSERT(!"should never happen");
244 QVariant ApiEnum::value() const
247 return m_sig->value();
249 Q_ASSERT(!"should never happen");
253 QString ApiEnum::name() const
256 return m_sig->name();
258 Q_ASSERT(!"should never happen");
262 unsigned long long ApiBitmask::value() const
267 ApiBitmask::Signature ApiBitmask::signature() const
272 ApiStruct::Signature ApiStruct::signature() const
277 QList<QVariant> ApiStruct::values() const
282 ApiPointer::ApiPointer(unsigned long long val)
288 unsigned long long ApiPointer::value() const
293 QString ApiPointer::toString() const
296 return QString("0x%1").arg(m_value, 0, 16);
298 return QLatin1String("NULL");
301 ApiBitmask::ApiBitmask(const Trace::Bitmask *bitmask)
307 void ApiBitmask::init(const Trace::Bitmask *bitmask)
312 m_value = bitmask->value;
313 for (const Trace::BitmaskFlag *it = bitmask->sig->flags;
314 it != bitmask->sig->flags + bitmask->sig->num_flags; ++it) {
316 QPair<QString, unsigned long long> pair;
318 pair.first = QString::fromStdString(it->name);
319 pair.second = it->value;
325 QString ApiBitmask::toString() const
328 unsigned long long value = m_value;
330 for (Signature::const_iterator it = m_sig.begin();
331 value != 0 && it != m_sig.end(); ++it) {
332 Q_ASSERT(it->second);
333 if ((value & it->second) == it->second) {
335 str += QLatin1String(" | ");
338 value &= ~it->second;
342 if (value || first) {
344 str += QLatin1String(" | ");
346 str += QString::fromLatin1("0x%1").arg(value, 0, 16);
351 ApiStruct::ApiStruct(const Trace::Struct *s)
356 QString ApiStruct::toString(bool multiLine) const
360 str += QLatin1String("{");
361 for (unsigned i = 0; i < m_members.count(); ++i) {
362 str += m_sig.memberNames[i] %
363 QLatin1Literal(" = ") %
364 apiVariantToString(m_members[i], multiLine);
365 if (i < m_members.count() - 1)
366 str += QLatin1String(", ");
368 str += QLatin1String("}");
373 void ApiStruct::init(const Trace::Struct *s)
378 m_sig.name = QString::fromStdString(s->sig->name);
379 for (unsigned i = 0; i < s->sig->num_members; ++i) {
380 VariantVisitor vis(0);
381 m_sig.memberNames.append(
382 QString::fromStdString(s->sig->member_names[i]));
383 s->members[i]->visit(vis);
384 m_members.append(vis.variant());
388 ApiArray::ApiArray(const Trace::Array *arr)
393 ApiArray::ApiArray(const QVector<QVariant> &vals)
398 QVector<QVariant> ApiArray::values() const
403 QString ApiArray::toString(bool multiLine) const
406 str += QLatin1String("[");
407 for(int i = 0; i < m_array.count(); ++i) {
408 const QVariant &var = m_array[i];
409 str += apiVariantToString(var, multiLine);
410 if (i < m_array.count() - 1)
411 str += QLatin1String(", ");
413 str += QLatin1String("]");
418 void ApiArray::init(const Trace::Array *arr)
423 m_array.reserve(arr->values.size());
424 for (int i = 0; i < arr->values.size(); ++i) {
425 VariantVisitor vis(0);
426 arr->values[i]->visit(vis);
428 m_array.append(vis.variant());
433 ApiTraceState::ApiTraceState()
437 ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
439 m_parameters = parsedJson[QLatin1String("parameters")].toMap();
440 QVariantMap attachedShaders =
441 parsedJson[QLatin1String("shaders")].toMap();
442 QVariantMap::const_iterator itr;
445 for (itr = attachedShaders.constBegin(); itr != attachedShaders.constEnd();
447 QString type = itr.key();
448 QString source = itr.value().toString();
449 m_shaderSources[type] = source;
452 m_uniforms = parsedJson[QLatin1String("uniforms")].toMap();
454 QVariantMap textures =
455 parsedJson[QLatin1String("textures")].toMap();
456 for (itr = textures.constBegin(); itr != textures.constEnd(); ++itr) {
457 QVariantMap image = itr.value().toMap();
458 QSize size(image[QLatin1String("__width__")].toInt(),
459 image[QLatin1String("__height__")].toInt());
460 QString cls = image[QLatin1String("__class__")].toString();
461 QString type = image[QLatin1String("__type__")].toString();
463 image[QLatin1String("__normalized__")].toBool();
465 image[QLatin1String("__channels__")].toInt();
467 Q_ASSERT(type == QLatin1String("uint8"));
468 Q_ASSERT(normalized == true);
469 Q_UNUSED(normalized);
471 QByteArray dataArray =
472 image[QLatin1String("__data__")].toByteArray();
476 tex.setNumChannels(numChannels);
477 tex.setLabel(itr.key());
478 tex.contentsFromBase64(dataArray);
480 m_textures.append(tex);
484 parsedJson[QLatin1String("framebuffer")].toMap();
485 for (itr = fbos.constBegin(); itr != fbos.constEnd(); ++itr) {
486 QVariantMap buffer = itr.value().toMap();
487 QSize size(buffer[QLatin1String("__width__")].toInt(),
488 buffer[QLatin1String("__height__")].toInt());
489 QString cls = buffer[QLatin1String("__class__")].toString();
490 QString type = buffer[QLatin1String("__type__")].toString();
491 bool normalized = buffer[QLatin1String("__normalized__")].toBool();
492 int numChannels = buffer[QLatin1String("__channels__")].toInt();
494 Q_ASSERT(type == QLatin1String("uint8"));
495 Q_ASSERT(normalized == true);
496 Q_UNUSED(normalized);
498 QByteArray dataArray =
499 buffer[QLatin1String("__data__")].toByteArray();
503 fbo.setNumChannels(numChannels);
504 fbo.setType(itr.key());
505 fbo.contentsFromBase64(dataArray);
506 m_framebuffers.append(fbo);
510 const QVariantMap & ApiTraceState::parameters() const
515 const QMap<QString, QString> & ApiTraceState::shaderSources() const
517 return m_shaderSources;
520 const QVariantMap & ApiTraceState::uniforms() const
525 bool ApiTraceState::isEmpty() const
527 return m_parameters.isEmpty();
530 const QList<ApiTexture> & ApiTraceState::textures() const
535 const QList<ApiFramebuffer> & ApiTraceState::framebuffers() const
537 return m_framebuffers;
540 ApiFramebuffer ApiTraceState::colorBuffer() const
542 foreach (ApiFramebuffer fbo, m_framebuffers) {
543 if (fbo.type() == QLatin1String("GL_BACK")) {
547 foreach (ApiFramebuffer fbo, m_framebuffers) {
548 if (fbo.type() == QLatin1String("GL_FRONT")) {
552 return ApiFramebuffer();
556 ApiTraceCallSignature::ApiTraceCallSignature(const QString &name,
557 const QStringList &argNames)
563 ApiTraceCallSignature::~ApiTraceCallSignature()
567 QUrl ApiTraceCallSignature::helpUrl() const
572 void ApiTraceCallSignature::setHelpUrl(const QUrl &url)
577 ApiTraceEvent::ApiTraceEvent()
578 : m_type(ApiTraceEvent::None),
579 m_hasBinaryData(false),
580 m_binaryDataIndex(0),
586 ApiTraceEvent::ApiTraceEvent(Type t)
588 m_hasBinaryData(false),
589 m_binaryDataIndex(0),
595 ApiTraceEvent::~ApiTraceEvent()
601 QVariantMap ApiTraceEvent::stateParameters() const
604 return m_state->parameters();
606 return QVariantMap();
610 ApiTraceState *ApiTraceEvent::state() const
615 void ApiTraceEvent::setState(ApiTraceState *state)
620 ApiTraceCall::ApiTraceCall(ApiTraceFrame *parentFrame,
622 const Trace::Call *call)
623 : ApiTraceEvent(ApiTraceEvent::Call),
624 m_parentFrame(parentFrame)
628 m_signature = loader->signature(call->sig->id);
631 QString name = QString::fromStdString(call->sig->name);
632 QStringList argNames;
633 argNames.reserve(call->sig->num_args);
634 for (int i = 0; i < call->sig->num_args; ++i) {
635 argNames += QString::fromStdString(call->sig->arg_names[i]);
637 m_signature = new ApiTraceCallSignature(name, argNames);
638 loader->addSignature(call->sig->id, m_signature);
641 VariantVisitor retVisitor(loader);
642 call->ret->visit(retVisitor);
643 m_returnValue = retVisitor.variant();
645 m_argValues.reserve(call->args.size());
646 for (int i = 0; i < call->args.size(); ++i) {
647 VariantVisitor argVisitor(loader);
648 call->args[i]->visit(argVisitor);
649 m_argValues.append(argVisitor.variant());
650 if (m_argValues[i].type() == QVariant::ByteArray) {
651 m_hasBinaryData = true;
652 m_binaryDataIndex = i;
655 m_argValues.squeeze();
658 ApiTraceCall::~ApiTraceCall()
663 bool ApiTraceCall::hasError() const
665 return !m_error.isEmpty();
668 QString ApiTraceCall::error() const
673 void ApiTraceCall::setError(const QString &msg)
675 if (m_error != msg) {
677 m_richText = QString();
681 ApiTrace * ApiTraceCall::parentTrace() const
684 return m_parentFrame->parentTrace();
688 QVector<QVariant> ApiTraceCall::originalValues() const
693 void ApiTraceCall::setEditedValues(const QVector<QVariant> &lst)
695 ApiTrace *trace = parentTrace();
697 m_editedValues = lst;
698 //lets regenerate data
699 m_richText = QString();
700 m_searchText = QString();
705 if (!lst.isEmpty()) {
706 trace->callEdited(this);
708 trace->callReverted(this);
713 QVector<QVariant> ApiTraceCall::editedValues() const
715 return m_editedValues;
718 bool ApiTraceCall::edited() const
720 return !m_editedValues.isEmpty();
723 void ApiTraceCall::revert()
725 setEditedValues(QVector<QVariant>());
728 void ApiTraceCall::setHelpUrl(const QUrl &url)
730 m_signature->setHelpUrl(url);
733 void ApiTraceCall::setParentFrame(ApiTraceFrame *frame)
735 m_parentFrame = frame;
738 ApiTraceFrame * ApiTraceCall::parentFrame()const
740 return m_parentFrame;
743 int ApiTraceCall::index() const
748 QString ApiTraceCall::name() const
750 return m_signature->name();
753 QStringList ApiTraceCall::argNames() const
755 return m_signature->argNames();
758 QVector<QVariant> ApiTraceCall::arguments() const
760 if (m_editedValues.isEmpty())
763 return m_editedValues;
766 QVariant ApiTraceCall::returnValue() const
768 return m_returnValue;
771 QUrl ApiTraceCall::helpUrl() const
773 return m_signature->helpUrl();
776 bool ApiTraceCall::hasBinaryData() const
778 return m_hasBinaryData;
781 int ApiTraceCall::binaryDataIndex() const
783 return m_binaryDataIndex;
786 QStaticText ApiTraceCall::staticText() const
788 if (m_staticText && !m_staticText->text().isEmpty())
789 return *m_staticText;
791 QVector<QVariant> argValues = arguments();
793 QString richText = QString::fromLatin1(
794 "<span style=\"font-weight:bold\">%1</span>(").arg(
795 m_signature->name());
796 QStringList argNames = m_signature->argNames();
797 for (int i = 0; i < argNames.count(); ++i) {
798 richText += QLatin1String("<span style=\"color:#0000ff\">");
799 QString argText = apiVariantToString(argValues[i]);
801 //if arguments are really long (e.g. shader text), cut them
803 if (argText.length() > 40) {
804 QString shortened = argText.mid(0, 40);
805 shortened[argText.length() - 5] = '.';
806 shortened[argText.length() - 4] = '.';
807 shortened[argText.length() - 3] = '.';
808 shortened[argText.length() - 2] = argText.at(argText.length() - 2);
809 shortened[argText.length() - 1] = argText.at(argText.length() - 1);
810 richText += shortened;
814 richText += QLatin1String("</span>");
815 if (i < argNames.count() - 1)
816 richText += QLatin1String(", ");
818 richText += QLatin1String(")");
819 if (m_returnValue.isValid()) {
821 QLatin1Literal(" = ") %
822 QLatin1Literal("<span style=\"color:#0000ff\">") %
823 apiVariantToString(m_returnValue) %
824 QLatin1Literal("</span>");
828 m_staticText = new QStaticText(richText);
830 m_staticText->setText(richText);
832 opt.setWrapMode(QTextOption::NoWrap);
833 m_staticText->setTextOption(opt);
834 m_staticText->prepare();
836 return *m_staticText;
839 QString ApiTraceCall::toHtml() const
841 if (!m_richText.isEmpty())
844 m_richText = QLatin1String("<div class=\"call\">");
846 QUrl helpUrl = m_signature->helpUrl();
847 if (helpUrl.isEmpty()) {
848 m_richText += QString::fromLatin1(
849 "%1) <span class=\"callName\">%2</span>(")
851 .arg(m_signature->name());
853 m_richText += QString::fromLatin1(
854 "%1) <span class=\"callName\"><a href=\"%2\">%3</a></span>(")
856 .arg(helpUrl.toString())
857 .arg(m_signature->name());
860 QVector<QVariant> argValues = arguments();
861 QStringList argNames = m_signature->argNames();
862 for (int i = 0; i < argNames.count(); ++i) {
864 QLatin1String("<span class=\"arg-name\">") +
866 QLatin1String("</span>") +
867 QLatin1Literal(" = ") +
868 QLatin1Literal("<span class=\"arg-value\">") +
869 apiVariantToString(argValues[i], true) +
870 QLatin1Literal("</span>");
871 if (i < argNames.count() - 1)
872 m_richText += QLatin1String(", ");
874 m_richText += QLatin1String(")");
876 if (m_returnValue.isValid()) {
878 QLatin1String(" = ") +
879 QLatin1String("<span style=\"color:#0000ff\">") +
880 apiVariantToString(m_returnValue, true) +
881 QLatin1String("</span>");
883 m_richText += QLatin1String("</div>");
888 "<div class=\"error\">%1</div>")
890 m_richText += errorStr;
895 "<html><head><style type=\"text/css\" media=\"all\">"
896 "%1</style></head><body>%2</body></html>")
899 m_richText.squeeze();
901 //qDebug()<<m_richText;
905 QString ApiTraceCall::searchText() const
907 if (!m_searchText.isEmpty())
910 QVector<QVariant> argValues = arguments();
911 m_searchText = m_signature->name() + QLatin1Literal("(");
912 QStringList argNames = m_signature->argNames();
913 for (int i = 0; i < argNames.count(); ++i) {
914 m_searchText += argNames[i] +
915 QLatin1Literal(" = ") +
916 apiVariantToString(argValues[i]);
917 if (i < argNames.count() - 1)
918 m_searchText += QLatin1String(", ");
920 m_searchText += QLatin1String(")");
922 if (m_returnValue.isValid()) {
923 m_searchText += QLatin1Literal(" = ") +
924 apiVariantToString(m_returnValue);
926 m_searchText.squeeze();
930 int ApiTraceCall::numChildren() const
935 bool ApiTraceCall::contains(const QString &str,
936 Qt::CaseSensitivity sensitivity) const
938 QString txt = searchText();
939 return txt.contains(str, sensitivity);
943 ApiTraceFrame::ApiTraceFrame(ApiTrace *parentTrace)
944 : ApiTraceEvent(ApiTraceEvent::Frame),
945 m_parentTrace(parentTrace),
953 ApiTraceFrame::~ApiTraceFrame()
958 QStaticText ApiTraceFrame::staticText() const
960 if (m_staticText && !m_staticText->text().isEmpty())
961 return *m_staticText;
963 QString richText = QObject::tr(
964 "<span style=\"font-weight:bold\">Frame %1</span>"
966 "<span style=\"font-style:italic;font-size:small;font-weight:lighter;\"> "
969 .arg(m_loaded ? m_calls.count() : m_callsToLoad);
971 //mark the frame if it uploads more than a meg a frame
972 if (m_binaryDataSize > (1024*1024)) {
976 "<span style=\"font-style:italic;\">"
977 " (%2MB)</span>")
979 .arg(double(m_binaryDataSize / (1024.*1024.)), 0, 'g', 2);
983 m_staticText = new QStaticText(richText);
986 opt.setWrapMode(QTextOption::NoWrap);
987 m_staticText->setTextOption(opt);
988 m_staticText->prepare();
990 return *m_staticText;
993 int ApiTraceFrame::numChildren() const
995 return m_calls.count();
998 ApiTrace * ApiTraceFrame::parentTrace() const
1000 return m_parentTrace;
1003 void ApiTraceFrame::addCall(ApiTraceCall *call)
1005 m_calls.append(call);
1006 if (call->hasBinaryData()) {
1008 call->arguments()[call->binaryDataIndex()].toByteArray();
1009 m_binaryDataSize += data.size();
1013 QVector<ApiTraceCall*> ApiTraceFrame::calls() const
1018 ApiTraceCall * ApiTraceFrame::call(int idx) const
1020 return m_calls.value(idx);
1024 ApiTraceCall * ApiTraceFrame::callWithIndex(int index) const
1026 QVector<ApiTraceCall*>::const_iterator itr;
1027 for (itr = m_calls.constBegin(); itr != m_calls.constEnd(); ++itr) {
1028 if ((*itr)->index() == index) {
1035 int ApiTraceFrame::callIndex(ApiTraceCall *call) const
1037 return m_calls.indexOf(call);
1040 bool ApiTraceFrame::isEmpty() const
1043 return m_calls.isEmpty();
1045 return m_callsToLoad == 0;
1049 int ApiTraceFrame::binaryDataSize() const
1051 return m_binaryDataSize;
1054 void ApiTraceFrame::setCalls(const QVector<ApiTraceCall*> &calls,
1055 quint64 binaryDataSize)
1058 m_binaryDataSize = binaryDataSize;
1060 delete m_staticText;
1064 bool ApiTraceFrame::isLoaded() const
1069 void ApiTraceFrame::setLoaded(bool l)
1074 void ApiTraceFrame::setNumChildren(int num)
1076 m_callsToLoad = num;
1079 void ApiTraceFrame::setParentTrace(ApiTrace *parent)
1081 m_parentTrace = parent;
1084 int ApiTraceFrame::numChildrenToLoad() const
1086 return m_callsToLoad;
1090 ApiTraceFrame::findNextCall(ApiTraceCall *from,
1092 Qt::CaseSensitivity sensitivity) const
1099 callIndex = m_calls.indexOf(from) + 1;
1102 for (int i = callIndex; i < m_calls.count(); ++i) {
1103 ApiTraceCall *call = m_calls[i];
1104 if (call->contains(str, sensitivity)) {
1112 ApiTraceFrame::findPrevCall(ApiTraceCall *from,
1114 Qt::CaseSensitivity sensitivity) const
1118 int callIndex = m_calls.count() - 1;
1121 callIndex = m_calls.indexOf(from) - 1;
1124 for (int i = callIndex; i >= 0; --i) {
1125 ApiTraceCall *call = m_calls[i];
1126 if (call->contains(str, sensitivity)) {
1133 void ApiTraceFrame::setLastCallIndex(unsigned index)
1135 m_lastCallIndex = index;
1138 unsigned ApiTraceFrame::lastCallIndex() const
1140 if (m_loaded && !m_calls.isEmpty()) {
1141 return m_calls.last()->index();
1143 return m_lastCallIndex;