From: Zack Rusin Date: Tue, 19 Apr 2011 05:59:20 +0000 (-0400) Subject: more error handling changes. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=cc0b4911a0ccc002c1eed54637f67f21c56b40fc;p=apitrace more error handling changes. --- diff --git a/gui/apitrace.cpp b/gui/apitrace.cpp index 6fa994a..012ce6c 100644 --- a/gui/apitrace.cpp +++ b/gui/apitrace.cpp @@ -262,7 +262,19 @@ bool ApiTrace::isSaving() const void ApiTrace::callError(ApiTraceCall *call) { + Q_ASSERT(call); + + if (call->hasError()) + m_errors.insert(call); + else + m_errors.remove(call); + emit changed(call); } +bool ApiTrace::hasErrors() const +{ + return !m_errors.isEmpty(); +} + #include "apitrace.moc" diff --git a/gui/apitrace.h b/gui/apitrace.h index a493fd2..d0b76fa 100644 --- a/gui/apitrace.h +++ b/gui/apitrace.h @@ -52,6 +52,8 @@ public: bool isSaving() const; + bool hasErrors() const; + public slots: void setFileName(const QString &name); void setFrameMarker(FrameMarker marker); @@ -89,6 +91,8 @@ private: QSet m_editedCalls; bool m_needsSaving; + + QSet m_errors; }; #endif diff --git a/gui/apitracecall.cpp b/gui/apitracecall.cpp index bac3d73..2d41e25 100644 --- a/gui/apitracecall.cpp +++ b/gui/apitracecall.cpp @@ -30,14 +30,16 @@ const char * const styleSheet = " color: #0000ff;\n" "}\n" ".error {\n" + " border: 1px solid rgb(255,0,0);\n" " margin: 10px;\n" - " padding: 0;\n" - " color: red;\n" - " background: #6fb2e5;\n" - " box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" - " -o-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" - " -webkit-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" - " -moz-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" + " padding: 1;\n" + " border-radius: 4px;\n" + // also looks great but qtwebkit doesn't support it + //" background: #6fb2e5;\n" + //" box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" + //" -o-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" + //" -webkit-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" + //" -moz-box-shadow: 0 1px 5px #0061aa, inset 0 10px 20px #b6f9ff;\n" "}\n"; ApiPointer::ApiPointer(unsigned long long val) @@ -387,6 +389,14 @@ QString ApiTraceCall::toHtml() const } m_richText += QLatin1String(""); + if (hasError()) { + QString errorStr = + QString::fromLatin1( + "
%1
") + .arg(m_error); + m_richText += errorStr; + } + m_richText = QString::fromLatin1( "