X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=gui%2Fapitracecall.cpp;h=f500d90c8b2f62b89a12c626a62418e5a88125c8;hb=e525e6f8733c35f5b9d7b6da1ce1e56a7d70f5ba;hp=8d95f167fd44607f7d21157316ecb367c59fd0c0;hpb=c17434303f411267d325f5218e0394e722079402;p=apitrace diff --git a/gui/apitracecall.cpp b/gui/apitracecall.cpp index 8d95f16..f500d90 100644 --- a/gui/apitracecall.cpp +++ b/gui/apitracecall.cpp @@ -129,10 +129,10 @@ apiVariantToString(const QVariant &variant, bool multiLine) return variant.value().toString(); } if (variant.canConvert()) { - return variant.value().toString(); + return variant.value().toString(multiLine); } if (variant.canConvert()) { - return variant.value().toString(); + return variant.value().toString(multiLine); } if (variant.canConvert()) { return variant.value().toString(); @@ -208,16 +208,7 @@ void VariantVisitor::visit(Trace::Array *array) void VariantVisitor::visit(Trace::Blob *blob) { - //XXX - //FIXME: this is a nasty hack. Trace::Blob's can't - // delete the contents in the destructor because - // the data is being used by other calls. We piggy back - // on that assumption and don't deep copy the data. If - // Blob's will start deleting the data we will need to - // start deep copying it or switch to using something like - // Boost's shared_ptr or Qt's QSharedPointer to handle it - blob->toPointer(true); - QByteArray barray = QByteArray::fromRawData(blob->buf, blob->size); + QByteArray barray = QByteArray(blob->buf, blob->size); m_variant = QVariant(barray); } @@ -353,7 +344,7 @@ ApiStruct::ApiStruct(const Trace::Struct *s) init(s); } -QString ApiStruct::toString() const +QString ApiStruct::toString(bool multiLine) const { QString str; @@ -361,7 +352,7 @@ QString ApiStruct::toString() const for (unsigned i = 0; i < m_members.count(); ++i) { str += m_sig.memberNames[i] % QLatin1Literal(" = ") % - apiVariantToString(m_members[i]); + apiVariantToString(m_members[i], multiLine); if (i < m_members.count() - 1) str += QLatin1String(", "); } @@ -400,13 +391,13 @@ QVector ApiArray::values() const return m_array; } -QString ApiArray::toString() const +QString ApiArray::toString(bool multiLine) const { QString str; str += QLatin1String("["); for(int i = 0; i < m_array.count(); ++i) { const QVariant &var = m_array[i]; - str += apiVariantToString(var); + str += apiVariantToString(var, multiLine); if (i < m_array.count() - 1) str += QLatin1String(", "); } @@ -537,6 +528,22 @@ const QList & ApiTraceState::framebuffers() const return m_framebuffers; } +ApiFramebuffer ApiTraceState::colorBuffer() const +{ + foreach (ApiFramebuffer fbo, m_framebuffers) { + if (fbo.type() == QLatin1String("GL_BACK")) { + return fbo; + } + } + foreach (ApiFramebuffer fbo, m_framebuffers) { + if (fbo.type() == QLatin1String("GL_FRONT")) { + return fbo; + } + } + return ApiFramebuffer(); +} + + ApiTraceCallSignature::ApiTraceCallSignature(const QString &name, const QStringList &argNames) : m_name(name), @@ -657,11 +664,8 @@ QString ApiTraceCall::error() const void ApiTraceCall::setError(const QString &msg) { if (m_error != msg) { - ApiTrace *trace = parentTrace(); m_error = msg; m_richText = QString(); - if (trace) - trace->callError(this); } } @@ -932,7 +936,8 @@ ApiTraceFrame::ApiTraceFrame(ApiTrace *parentTrace) m_parentTrace(parentTrace), m_binaryDataSize(0), m_loaded(false), - m_callsToLoad(0) + m_callsToLoad(0), + m_lastCallIndex(0) { } @@ -946,23 +951,23 @@ QStaticText ApiTraceFrame::staticText() const if (m_staticText && !m_staticText->text().isEmpty()) return *m_staticText; - QString richText; + QString richText = QObject::tr( + "Frame %1" + "   " + " " + "(%2 calls)") + .arg(number) + .arg(m_loaded ? m_calls.count() : m_callsToLoad); //mark the frame if it uploads more than a meg a frame if (m_binaryDataSize > (1024*1024)) { richText = QObject::tr( - "" - "Frame %1" + "%1" "" "    (%2MB)") - .arg(number) + .arg(richText) .arg(double(m_binaryDataSize / (1024.*1024.)), 0, 'g', 2); - } else { - richText = - QObject::tr( - "Frame %1") - .arg(number); } if (!m_staticText) @@ -1043,9 +1048,11 @@ void ApiTraceFrame::setCalls(const QVector &calls, m_calls = calls; m_binaryDataSize = binaryDataSize; m_loaded = true; + delete m_staticText; + m_staticText = 0; } -bool ApiTraceFrame::loaded() const +bool ApiTraceFrame::isLoaded() const { return m_loaded; } @@ -1113,3 +1120,17 @@ ApiTraceFrame::findPrevCall(ApiTraceCall *from, } return 0; } + +void ApiTraceFrame::setLastCallIndex(unsigned index) +{ + m_lastCallIndex = index; +} + +unsigned ApiTraceFrame::lastCallIndex() const +{ + if (m_loaded && !m_calls.isEmpty()) { + return m_calls.last()->index(); + } else { + return m_lastCallIndex; + } +}