]> git.cworth.org Git - apitrace/commitdiff
shorten really long arguments
authorZack Rusin <zack@kde.org>
Fri, 1 Apr 2011 02:55:57 +0000 (22:55 -0400)
committerZack Rusin <zack@kde.org>
Fri, 1 Apr 2011 02:55:57 +0000 (22:55 -0400)
text layouting on megs of shader code and binary data is just a bad
idea.

gui/apitracecall.cpp

index ccb0f63cc31183a19e2e1a91f642bf7a22f19f3b..dd05eeee49b40b8c28c523399843c15974cf61e6 100644 (file)
@@ -233,7 +233,21 @@ QStaticText ApiTraceCall::staticText() const
     QString richText = QString::fromLatin1("<span style=\"font-weight:bold\">%1</span>(").arg(name);
     for (int i = 0; i < argNames.count(); ++i) {
         richText += QLatin1String("<span style=\"color:#0000ff\">");
-        richText += apiVariantToString(argValues[i]);
+        QString argText = apiVariantToString(argValues[i]);
+
+        //if arguments are really long (e.g. shader text), cut them
+        // and elide it
+        if (argText.length() > 40) {
+            QString shortened = argText.mid(0, 40);
+            shortened[argText.length() - 5] = '.';
+            shortened[argText.length() - 4] = '.';
+            shortened[argText.length() - 3] = '.';
+            shortened[argText.length() - 2] = argText[argText.length() - 2];
+            shortened[argText.length() - 1] = argText[argText.length() - 1];
+            richText += shortened;
+        } else {
+            richText += argText;
+        }
         richText += QLatin1String("</span>");
         if (i < argNames.count() - 1)
             richText += QString::fromLatin1(", ");