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(e->sig);
197 m_loader->addEnumSignature(e->sig->id, sig);
201 m_variant = QVariant::fromValue(ApiEnum(sig, e->value));
204 void VariantVisitor::visit(trace::Bitmask *bitmask)
206 m_variant = QVariant::fromValue(ApiBitmask(bitmask));
209 void VariantVisitor::visit(trace::Struct *str)
211 m_variant = QVariant::fromValue(ApiStruct(str));
214 void VariantVisitor::visit(trace::Array *array)
216 m_variant = QVariant::fromValue(ApiArray(array));
219 void VariantVisitor::visit(trace::Blob *blob)
221 QByteArray barray = QByteArray(blob->buf, blob->size);
222 m_variant = QVariant(barray);
225 void VariantVisitor::visit(trace::Pointer *ptr)
227 m_variant = QVariant::fromValue(ApiPointer(ptr->value));
230 void VariantVisitor::visit(trace::Repr *repr)
232 /* TODO: Preserve both the human and machine value */
233 repr->humanValue->visit(*this);
236 ApiTraceEnumSignature::ApiTraceEnumSignature(const trace::EnumSig *sig)
238 for (const trace::EnumValue *it = sig->values;
239 it != sig->values + sig->num_values; ++it) {
240 QPair<QString, signed long long> pair;
242 pair.first = QString::fromStdString(it->name);
243 pair.second = it->value;
245 m_names.append(pair);
249 QString ApiTraceEnumSignature::name(signed long long value) const
251 for (ValueList::const_iterator it = m_names.begin();
252 it != m_names.end(); ++it) {
253 if (value == it->second) {
257 return QString::fromLatin1("%1").arg(value);
260 ApiEnum::ApiEnum(ApiTraceEnumSignature *sig, signed long long value)
261 : m_sig(sig), m_value(value)
265 QString ApiEnum::toString() const
268 return m_sig->name(m_value);
270 Q_ASSERT(!"should never happen");
274 QVariant ApiEnum::value() const
277 return QVariant::fromValue(m_value);
279 Q_ASSERT(!"should never happen");
283 QString ApiEnum::name() const
286 return m_sig->name(m_value);
288 Q_ASSERT(!"should never happen");
292 unsigned long long ApiBitmask::value() const
297 ApiBitmask::Signature ApiBitmask::signature() const
302 ApiStruct::Signature ApiStruct::signature() const
307 QList<QVariant> ApiStruct::values() const
312 ApiPointer::ApiPointer(unsigned long long val)
318 unsigned long long ApiPointer::value() const
323 QString ApiPointer::toString() const
326 return QString("0x%1").arg(m_value, 0, 16);
328 return QLatin1String("NULL");
331 ApiBitmask::ApiBitmask(const trace::Bitmask *bitmask)
337 void ApiBitmask::init(const trace::Bitmask *bitmask)
342 m_value = bitmask->value;
343 for (const trace::BitmaskFlag *it = bitmask->sig->flags;
344 it != bitmask->sig->flags + bitmask->sig->num_flags; ++it) {
345 QPair<QString, unsigned long long> pair;
347 pair.first = QString::fromStdString(it->name);
348 pair.second = it->value;
354 QString ApiBitmask::toString() const
357 unsigned long long value = m_value;
359 for (Signature::const_iterator it = m_sig.begin(); it != m_sig.end(); ++it) {
360 Q_ASSERT(it->second || first);
361 if ((it->second && (value & it->second) == it->second) ||
362 (!it->second && value == 0)) {
364 str += QLatin1String(" | ");
367 value &= ~it->second;
374 if (value || first) {
376 str += QLatin1String(" | ");
378 str += QString::fromLatin1("0x%1").arg(value, 0, 16);
383 ApiStruct::ApiStruct(const trace::Struct *s)
388 QString ApiStruct::toString(bool multiLine) const
392 str += QLatin1String("{");
393 for (unsigned i = 0; i < m_members.count(); ++i) {
394 str += m_sig.memberNames[i] %
395 QLatin1Literal(" = ") %
396 apiVariantToString(m_members[i], multiLine);
397 if (i < m_members.count() - 1)
398 str += QLatin1String(", ");
400 str += QLatin1String("}");
405 void ApiStruct::init(const trace::Struct *s)
410 m_sig.name = QString::fromStdString(s->sig->name);
411 for (unsigned i = 0; i < s->sig->num_members; ++i) {
412 VariantVisitor vis(0);
413 m_sig.memberNames.append(
414 QString::fromStdString(s->sig->member_names[i]));
415 s->members[i]->visit(vis);
416 m_members.append(vis.variant());
420 ApiArray::ApiArray(const trace::Array *arr)
425 ApiArray::ApiArray(const QVector<QVariant> &vals)
430 QVector<QVariant> ApiArray::values() const
435 QString ApiArray::toString(bool multiLine) const
438 str += QLatin1String("[");
439 for(int i = 0; i < m_array.count(); ++i) {
440 const QVariant &var = m_array[i];
441 str += apiVariantToString(var, multiLine);
442 if (i < m_array.count() - 1)
443 str += QLatin1String(", ");
445 str += QLatin1String("]");
450 void ApiArray::init(const trace::Array *arr)
455 m_array.reserve(arr->values.size());
456 for (int i = 0; i < arr->values.size(); ++i) {
457 VariantVisitor vis(0);
458 arr->values[i]->visit(vis);
460 m_array.append(vis.variant());
465 ApiTraceState::ApiTraceState()
469 ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
471 m_parameters = parsedJson[QLatin1String("parameters")].toMap();
472 QVariantMap attachedShaders =
473 parsedJson[QLatin1String("shaders")].toMap();
474 QVariantMap::const_iterator itr;
477 for (itr = attachedShaders.constBegin(); itr != attachedShaders.constEnd();
479 QString type = itr.key();
480 QString source = itr.value().toString();
481 m_shaderSources[type] = source;
484 m_uniforms = parsedJson[QLatin1String("uniforms")].toMap();
486 QVariantMap textures =
487 parsedJson[QLatin1String("textures")].toMap();
488 for (itr = textures.constBegin(); itr != textures.constEnd(); ++itr) {
489 QVariantMap image = itr.value().toMap();
490 QSize size(image[QLatin1String("__width__")].toInt(),
491 image[QLatin1String("__height__")].toInt());
492 QString cls = image[QLatin1String("__class__")].toString();
494 image[QLatin1String("__depth__")].toInt();
496 image[QLatin1String("__format__")].toString();
498 QByteArray dataArray =
499 image[QLatin1String("__data__")].toByteArray();
504 tex.setFormatName(formatName);
505 tex.setLabel(itr.key());
506 tex.contentsFromBase64(dataArray);
508 m_textures.append(tex);
512 parsedJson[QLatin1String("framebuffer")].toMap();
513 for (itr = fbos.constBegin(); itr != fbos.constEnd(); ++itr) {
514 QVariantMap buffer = itr.value().toMap();
515 QSize size(buffer[QLatin1String("__width__")].toInt(),
516 buffer[QLatin1String("__height__")].toInt());
517 QString cls = buffer[QLatin1String("__class__")].toString();
518 int depth = buffer[QLatin1String("__depth__")].toInt();
519 QString formatName = buffer[QLatin1String("__format__")].toString();
521 QByteArray dataArray =
522 buffer[QLatin1String("__data__")].toByteArray();
527 fbo.setFormatName(formatName);
528 fbo.setType(itr.key());
529 fbo.contentsFromBase64(dataArray);
530 m_framebuffers.append(fbo);
534 const QVariantMap & ApiTraceState::parameters() const
539 const QMap<QString, QString> & ApiTraceState::shaderSources() const
541 return m_shaderSources;
544 const QVariantMap & ApiTraceState::uniforms() const
549 bool ApiTraceState::isEmpty() const
551 return m_parameters.isEmpty() &&
552 m_shaderSources.isEmpty() &&
553 m_textures.isEmpty() &&
554 m_framebuffers.isEmpty();
557 const QList<ApiTexture> & ApiTraceState::textures() const
562 const QList<ApiFramebuffer> & ApiTraceState::framebuffers() const
564 return m_framebuffers;
567 ApiFramebuffer ApiTraceState::colorBuffer() const
569 foreach (ApiFramebuffer fbo, m_framebuffers) {
570 if (fbo.type() == QLatin1String("GL_BACK")) {
574 foreach (ApiFramebuffer fbo, m_framebuffers) {
575 if (fbo.type() == QLatin1String("GL_FRONT")) {
579 return ApiFramebuffer();
583 ApiTraceCallSignature::ApiTraceCallSignature(const QString &name,
584 const QStringList &argNames)
590 ApiTraceCallSignature::~ApiTraceCallSignature()
594 QUrl ApiTraceCallSignature::helpUrl() const
599 void ApiTraceCallSignature::setHelpUrl(const QUrl &url)
604 ApiTraceEvent::ApiTraceEvent()
605 : m_type(ApiTraceEvent::None),
606 m_hasBinaryData(false),
607 m_binaryDataIndex(0),
613 ApiTraceEvent::ApiTraceEvent(Type t)
615 m_hasBinaryData(false),
616 m_binaryDataIndex(0),
622 ApiTraceEvent::~ApiTraceEvent()
628 QVariantMap ApiTraceEvent::stateParameters() const
631 return m_state->parameters();
633 return QVariantMap();
637 ApiTraceState *ApiTraceEvent::state() const
642 void ApiTraceEvent::setState(ApiTraceState *state)
647 ApiTraceCall::ApiTraceCall(ApiTraceFrame *parentFrame,
649 const trace::Call *call)
650 : ApiTraceEvent(ApiTraceEvent::Call),
651 m_parentFrame(parentFrame)
655 m_signature = loader->signature(call->sig->id);
658 QString name = QString::fromStdString(call->sig->name);
659 QStringList argNames;
660 argNames.reserve(call->sig->num_args);
661 for (int i = 0; i < call->sig->num_args; ++i) {
662 argNames += QString::fromStdString(call->sig->arg_names[i]);
664 m_signature = new ApiTraceCallSignature(name, argNames);
665 loader->addSignature(call->sig->id, m_signature);
668 VariantVisitor retVisitor(loader);
669 call->ret->visit(retVisitor);
670 m_returnValue = retVisitor.variant();
672 m_argValues.reserve(call->args.size());
673 for (int i = 0; i < call->args.size(); ++i) {
674 if (call->args[i].value) {
675 VariantVisitor argVisitor(loader);
676 call->args[i].value->visit(argVisitor);
677 m_argValues.append(argVisitor.variant());
678 if (m_argValues[i].type() == QVariant::ByteArray) {
679 m_hasBinaryData = true;
680 m_binaryDataIndex = i;
683 m_argValues.append(QVariant());
686 m_argValues.squeeze();
687 m_flags = call->flags;
690 ApiTraceCall::~ApiTraceCall()
695 bool ApiTraceCall::hasError() const
697 return !m_error.isEmpty();
700 QString ApiTraceCall::error() const
705 void ApiTraceCall::setError(const QString &msg)
707 if (m_error != msg) {
709 m_richText = QString();
713 ApiTrace * ApiTraceCall::parentTrace() const
716 return m_parentFrame->parentTrace();
720 QVector<QVariant> ApiTraceCall::originalValues() const
725 void ApiTraceCall::setEditedValues(const QVector<QVariant> &lst)
727 ApiTrace *trace = parentTrace();
729 m_editedValues = lst;
730 //lets regenerate data
731 m_richText = QString();
732 m_searchText = QString();
737 if (!lst.isEmpty()) {
738 trace->callEdited(this);
740 trace->callReverted(this);
745 QVector<QVariant> ApiTraceCall::editedValues() const
747 return m_editedValues;
750 bool ApiTraceCall::edited() const
752 return !m_editedValues.isEmpty();
755 void ApiTraceCall::revert()
757 setEditedValues(QVector<QVariant>());
760 void ApiTraceCall::setHelpUrl(const QUrl &url)
762 m_signature->setHelpUrl(url);
765 void ApiTraceCall::setParentFrame(ApiTraceFrame *frame)
767 m_parentFrame = frame;
770 ApiTraceFrame * ApiTraceCall::parentFrame()const
772 return m_parentFrame;
775 int ApiTraceCall::index() const
780 QString ApiTraceCall::name() const
782 return m_signature->name();
785 QStringList ApiTraceCall::argNames() const
787 return m_signature->argNames();
790 QVector<QVariant> ApiTraceCall::arguments() const
792 if (m_editedValues.isEmpty())
795 return m_editedValues;
798 QVariant ApiTraceCall::returnValue() const
800 return m_returnValue;
803 trace::CallFlags ApiTraceCall::flags() const
808 QUrl ApiTraceCall::helpUrl() const
810 return m_signature->helpUrl();
813 bool ApiTraceCall::hasBinaryData() const
815 return m_hasBinaryData;
818 int ApiTraceCall::binaryDataIndex() const
820 return m_binaryDataIndex;
823 QStaticText ApiTraceCall::staticText() const
825 if (m_staticText && !m_staticText->text().isEmpty())
826 return *m_staticText;
828 QVector<QVariant> argValues = arguments();
830 QString richText = QString::fromLatin1(
831 "<span style=\"font-weight:bold\">%1</span>(").arg(
832 m_signature->name());
833 QStringList argNames = m_signature->argNames();
834 for (int i = 0; i < argNames.count(); ++i) {
835 richText += QLatin1String("<span style=\"color:#0000ff\">");
836 QString argText = apiVariantToString(argValues[i]);
838 //if arguments are really long (e.g. shader text), cut them
840 if (argText.length() > 40) {
841 QString shortened = argText.mid(0, 40);
842 shortened[argText.length() - 5] = '.';
843 shortened[argText.length() - 4] = '.';
844 shortened[argText.length() - 3] = '.';
845 shortened[argText.length() - 2] = argText.at(argText.length() - 2);
846 shortened[argText.length() - 1] = argText.at(argText.length() - 1);
847 richText += shortened;
851 richText += QLatin1String("</span>");
852 if (i < argNames.count() - 1)
853 richText += QLatin1String(", ");
855 richText += QLatin1String(")");
856 if (m_returnValue.isValid()) {
858 QLatin1Literal(" = ") %
859 QLatin1Literal("<span style=\"color:#0000ff\">") %
860 apiVariantToString(m_returnValue) %
861 QLatin1Literal("</span>");
865 m_staticText = new QStaticText(richText);
867 m_staticText->setText(richText);
869 opt.setWrapMode(QTextOption::NoWrap);
870 m_staticText->setTextOption(opt);
871 m_staticText->prepare();
873 return *m_staticText;
876 QString ApiTraceCall::toHtml() const
878 if (!m_richText.isEmpty())
881 m_richText += QLatin1String("<div class=\"call\">");
885 QString::fromLatin1("%1) ")
890 QString::fromLatin1("Frame %1")
891 .arg(m_parentFrame->number);
893 QUrl helpUrl = m_signature->helpUrl();
894 if (helpUrl.isEmpty()) {
895 m_richText += QString::fromLatin1(
896 "<span class=\"callName\" title=\"%1\">%2</span>(")
898 .arg(m_signature->name());
900 m_richText += QString::fromLatin1(
901 "<span class=\"callName\" title=\"%1\"><a href=\"%2\">%3</a></span>(")
903 .arg(helpUrl.toString())
904 .arg(m_signature->name());
907 QVector<QVariant> argValues = arguments();
908 QStringList argNames = m_signature->argNames();
909 for (int i = 0; i < argNames.count(); ++i) {
911 QLatin1String("<span class=\"arg-name\">") +
913 QLatin1String("</span>") +
914 QLatin1Literal(" = ") +
915 QLatin1Literal("<span class=\"arg-value\">") +
916 apiVariantToString(argValues[i], true) +
917 QLatin1Literal("</span>");
918 if (i < argNames.count() - 1)
919 m_richText += QLatin1String(", ");
921 m_richText += QLatin1String(")");
923 if (m_returnValue.isValid()) {
925 QLatin1String(" = ") +
926 QLatin1String("<span style=\"color:#0000ff\">") +
927 apiVariantToString(m_returnValue, true) +
928 QLatin1String("</span>");
930 m_richText += QLatin1String("</div>");
935 "<div class=\"error\">%1</div>")
937 m_richText += errorStr;
942 "<html><head><style type=\"text/css\" media=\"all\">"
943 "%1</style></head><body>%2</body></html>")
946 m_richText.squeeze();
948 //qDebug()<<m_richText;
952 QString ApiTraceCall::searchText() const
954 if (!m_searchText.isEmpty())
957 QVector<QVariant> argValues = arguments();
958 m_searchText = m_signature->name() + QLatin1Literal("(");
959 QStringList argNames = m_signature->argNames();
960 for (int i = 0; i < argNames.count(); ++i) {
961 m_searchText += argNames[i] +
962 QLatin1Literal(" = ") +
963 apiVariantToString(argValues[i]);
964 if (i < argNames.count() - 1)
965 m_searchText += QLatin1String(", ");
967 m_searchText += QLatin1String(")");
969 if (m_returnValue.isValid()) {
970 m_searchText += QLatin1Literal(" = ") +
971 apiVariantToString(m_returnValue);
973 m_searchText.squeeze();
977 int ApiTraceCall::numChildren() const
982 bool ApiTraceCall::contains(const QString &str,
983 Qt::CaseSensitivity sensitivity) const
985 QString txt = searchText();
986 return txt.contains(str, sensitivity);
990 ApiTraceFrame::ApiTraceFrame(ApiTrace *parentTrace)
991 : ApiTraceEvent(ApiTraceEvent::Frame),
992 m_parentTrace(parentTrace),
1000 ApiTraceFrame::~ApiTraceFrame()
1002 qDeleteAll(m_calls);
1005 QStaticText ApiTraceFrame::staticText() const
1007 if (m_staticText && !m_staticText->text().isEmpty())
1008 return *m_staticText;
1010 QString richText = QObject::tr(
1011 "<span style=\"font-weight:bold\">Frame %1</span>"
1012 " "
1013 "<span style=\"font-style:italic;font-size:small;font-weight:lighter;\"> "
1014 "(%2 calls)</span>")
1016 .arg(m_loaded ? m_calls.count() : m_callsToLoad);
1018 //mark the frame if it uploads more than a meg a frame
1019 if (m_binaryDataSize > (1024*1024)) {
1023 "<span style=\"font-style:italic;\">"
1024 " (%2MB)</span>")
1026 .arg(double(m_binaryDataSize / (1024.*1024.)), 0, 'g', 2);
1030 m_staticText = new QStaticText(richText);
1033 opt.setWrapMode(QTextOption::NoWrap);
1034 m_staticText->setTextOption(opt);
1035 m_staticText->prepare();
1037 return *m_staticText;
1040 int ApiTraceFrame::numChildren() const
1042 return m_calls.count();
1045 ApiTrace * ApiTraceFrame::parentTrace() const
1047 return m_parentTrace;
1050 void ApiTraceFrame::addCall(ApiTraceCall *call)
1052 m_calls.append(call);
1053 if (call->hasBinaryData()) {
1055 call->arguments()[call->binaryDataIndex()].toByteArray();
1056 m_binaryDataSize += data.size();
1060 QVector<ApiTraceCall*> ApiTraceFrame::calls() const
1065 ApiTraceCall * ApiTraceFrame::call(int idx) const
1067 return m_calls.value(idx);
1071 ApiTraceCall * ApiTraceFrame::callWithIndex(int index) const
1073 QVector<ApiTraceCall*>::const_iterator itr;
1074 for (itr = m_calls.constBegin(); itr != m_calls.constEnd(); ++itr) {
1075 if ((*itr)->index() == index) {
1082 int ApiTraceFrame::callIndex(ApiTraceCall *call) const
1084 return m_calls.indexOf(call);
1087 bool ApiTraceFrame::isEmpty() const
1090 return m_calls.isEmpty();
1092 return m_callsToLoad == 0;
1096 int ApiTraceFrame::binaryDataSize() const
1098 return m_binaryDataSize;
1101 void ApiTraceFrame::setCalls(const QVector<ApiTraceCall*> &calls,
1102 quint64 binaryDataSize)
1105 m_binaryDataSize = binaryDataSize;
1107 delete m_staticText;
1111 bool ApiTraceFrame::isLoaded() const
1116 void ApiTraceFrame::setLoaded(bool l)
1121 void ApiTraceFrame::setNumChildren(int num)
1123 m_callsToLoad = num;
1126 void ApiTraceFrame::setParentTrace(ApiTrace *parent)
1128 m_parentTrace = parent;
1131 int ApiTraceFrame::numChildrenToLoad() const
1133 return m_callsToLoad;
1137 ApiTraceFrame::findNextCall(ApiTraceCall *from,
1139 Qt::CaseSensitivity sensitivity) const
1146 callIndex = m_calls.indexOf(from) + 1;
1149 for (int i = callIndex; i < m_calls.count(); ++i) {
1150 ApiTraceCall *call = m_calls[i];
1151 if (call->contains(str, sensitivity)) {
1159 ApiTraceFrame::findPrevCall(ApiTraceCall *from,
1161 Qt::CaseSensitivity sensitivity) const
1165 int callIndex = m_calls.count() - 1;
1168 callIndex = m_calls.indexOf(from) - 1;
1171 for (int i = callIndex; i >= 0; --i) {
1172 ApiTraceCall *call = m_calls[i];
1173 if (call->contains(str, sensitivity)) {
1180 void ApiTraceFrame::setLastCallIndex(unsigned index)
1182 m_lastCallIndex = index;
1185 unsigned ApiTraceFrame::lastCallIndex() const
1187 if (m_loaded && !m_calls.isEmpty()) {
1188 return m_calls.last()->index();
1190 return m_lastCallIndex;
1194 void ApiTraceFrame::setThumbnail(const QImage & thumbnail)
1196 m_thumbnail = thumbnail;
1199 const QImage & ApiTraceFrame::thumbnail() const