Fix indention.
authorZack Rusin <zack@kde.org>
Tue, 6 Sep 2011 22:25:34 +0000 (18:25 -0400)
committerZack Rusin <zack@kde.org>
Tue, 6 Sep 2011 22:25:34 +0000 (18:25 -0400)
gui/traceloader.cpp

index a23f3f4..b6eba6a 100644 (file)
@@ -44,10 +44,10 @@ void TraceLoader::loadTrace(const QString &filename)
 
     qDebug() <<"\t support offsets = "<<m_parser.supportsOffsets();
     if (m_parser.supportsOffsets()) {
-       scanTrace();
+        scanTrace();
     } else {
-       //Load the entire file into memory
-       parseTrace();
+        //Load the entire file into memory
+        parseTrace();
     }
 
     emit finishedParsing();
@@ -76,7 +76,7 @@ void TraceLoader::loadFrame(int frameIdx)
 
             }
             assert(parsedCalls == numOfCalls);
-//            emit parsedFrame();
+            //            emit parsedFrame();
         }
     }
 }
@@ -92,19 +92,19 @@ bool TraceLoader::isCallAFrameMarker(const Trace::Call *call) const
 
     switch (m_frameMarker) {
     case ApiTrace::FrameMarker_SwapBuffers:
-       return  name.find("SwapBuffers") != std::string::npos ||
-               name == "CGLFlushDrawable" ||
-               name == "glFrameTerminatorGREMEDY";
-       break;
+        return  name.find("SwapBuffers") != std::string::npos ||
+                name == "CGLFlushDrawable" ||
+                name == "glFrameTerminatorGREMEDY";
+        break;
     case ApiTrace::FrameMarker_Flush:
-       return name == "glFlush";
-       break;
+        return name == "glFlush";
+        break;
     case ApiTrace::FrameMarker_Finish:
-       return name == "glFinish";
-       break;
+        return name == "glFinish";
+        break;
     case ApiTrace::FrameMarker_Clear:
-       return name == "glClear";
-       break;
+        return name == "glClear";
+        break;
     }
     return false;
 }
@@ -120,152 +120,152 @@ int TraceLoader::numberOfCallsInFrame(int frameIdx) const
         return 0;
     }
     FrameOffsets::const_iterator itr =
-          m_frameOffsets.find(frameIdx);
+            m_frameOffsets.find(frameIdx);
     return itr->numberOfCalls;
 }
 
 void TraceLoader::loadHelpFile()
 {
-   QFile file(":/resources/glreference.tsv");
-   if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
-      QString line;
-      while (!file.atEnd()) {
-         line = file.readLine();
-         QString function = line.section('\t', 0, 0).trimmed();
-         QUrl url = QUrl(line.section('\t', 1, 1).trimmed());
-         //qDebug()<<"function = "<<function<<", url = "<<url.toString();
-         m_helpHash.insert(function, url);
-      }
-   } else {
-      qWarning() << "Couldn't open reference file "
-                 << file.fileName();
-   }
-   file.close();
+    QFile file(":/resources/glreference.tsv");
+    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+        QString line;
+        while (!file.atEnd()) {
+            line = file.readLine();
+            QString function = line.section('\t', 0, 0).trimmed();
+            QUrl url = QUrl(line.section('\t', 1, 1).trimmed());
+            //qDebug()<<"function = "<<function<<", url = "<<url.toString();
+            m_helpHash.insert(function, url);
+        }
+    } else {
+        qWarning() << "Couldn't open reference file "
+                   << file.fileName();
+    }
+    file.close();
 }
 
 void TraceLoader::scanTrace()
 {
-   QList<ApiTraceFrame*> frames;
-   ApiTraceFrame *currentFrame = 0;
-
-   Trace::Call *call;
-   Trace::File::Offset startOffset;
-   int numOfFrames = 0;
-   int numOfCalls = 0;
-   unsigned callNum = 0;
-   int lastPercentReport = 0;
-
-   startOffset = m_parser.currentOffset();
-   callNum = m_parser.currentCallNumber();
-
-   while ((call = m_parser.scan_call())) {
-       ++numOfCalls;
-
-       if (isCallAFrameMarker(call)) {
-           Trace::File::Offset endOffset = m_parser.currentOffset();
-           FrameOffset frameOffset(startOffset);
-           frameOffset.numberOfCalls = numOfCalls;
-           frameOffset.callNumber = callNum;
-
-           currentFrame = new ApiTraceFrame();
-           currentFrame->number = numOfFrames;
-           currentFrame->setNumChildren(numOfCalls);
-           frames.append(currentFrame);
-
-           m_frameOffsets[numOfFrames] = frameOffset;
-           ++numOfFrames;
-
-           if (m_parser.percentRead() - lastPercentReport >= 5) {
-               emit parsed(m_parser.percentRead());
-               lastPercentReport = m_parser.percentRead();
-           }
-           startOffset = endOffset;
-           callNum = m_parser.currentCallNumber();
-           numOfCalls = 0;
-       }
-       //call->dump(std::cout, color);
-       delete call;
-   }
-
-   if (numOfCalls) {
-//      Trace::File::Offset endOffset = m_parser.currentOffset();
-      FrameOffset frameOffset(startOffset);
-      frameOffset.numberOfCalls = numOfCalls;
-      frameOffset.callNumber = callNum;
-
-      currentFrame = new ApiTraceFrame();
-      currentFrame->number = numOfFrames;
-      currentFrame->setNumChildren(numOfCalls);
-      frames.append(currentFrame);
-
-      m_frameOffsets[numOfFrames] = frameOffset;
-      ++numOfFrames;
-   }
-
-   emit parsed(100);
-
-   emit framesLoaded(frames);
+    QList<ApiTraceFrame*> frames;
+    ApiTraceFrame *currentFrame = 0;
+
+    Trace::Call *call;
+    Trace::File::Offset startOffset;
+    int numOfFrames = 0;
+    int numOfCalls = 0;
+    unsigned callNum = 0;
+    int lastPercentReport = 0;
+
+    startOffset = m_parser.currentOffset();
+    callNum = m_parser.currentCallNumber();
+
+    while ((call = m_parser.scan_call())) {
+        ++numOfCalls;
+
+        if (isCallAFrameMarker(call)) {
+            Trace::File::Offset endOffset = m_parser.currentOffset();
+            FrameOffset frameOffset(startOffset);
+            frameOffset.numberOfCalls = numOfCalls;
+            frameOffset.callNumber = callNum;
+
+            currentFrame = new ApiTraceFrame();
+            currentFrame->number = numOfFrames;
+            currentFrame->setNumChildren(numOfCalls);
+            frames.append(currentFrame);
+
+            m_frameOffsets[numOfFrames] = frameOffset;
+            ++numOfFrames;
+
+            if (m_parser.percentRead() - lastPercentReport >= 5) {
+                emit parsed(m_parser.percentRead());
+                lastPercentReport = m_parser.percentRead();
+            }
+            startOffset = endOffset;
+            callNum = m_parser.currentCallNumber();
+            numOfCalls = 0;
+        }
+        //call->dump(std::cout, color);
+        delete call;
+    }
+
+    if (numOfCalls) {
+        //      Trace::File::Offset endOffset = m_parser.currentOffset();
+        FrameOffset frameOffset(startOffset);
+        frameOffset.numberOfCalls = numOfCalls;
+        frameOffset.callNumber = callNum;
+
+        currentFrame = new ApiTraceFrame();
+        currentFrame->number = numOfFrames;
+        currentFrame->setNumChildren(numOfCalls);
+        frames.append(currentFrame);
+
+        m_frameOffsets[numOfFrames] = frameOffset;
+        ++numOfFrames;
+    }
+
+    emit parsed(100);
+
+    emit framesLoaded(frames);
 }
 
 void TraceLoader::parseTrace()
 {
-   QList<ApiTraceFrame*> frames;
-   ApiTraceFrame *currentFrame = 0;
-   int frameCount = 0;
-   QVector<ApiTraceCall*> calls;
-   quint64 binaryDataSize = 0;
-
-   int lastPercentReport = 0;
-
-   Trace::Call *call = m_parser.parse_call();
-   while (call) {
-      //std::cout << *call;
-      if (!currentFrame) {
-         currentFrame = new ApiTraceFrame();
-         currentFrame->number = frameCount;
-         ++frameCount;
-      }
-      ApiTraceCall *apiCall =
-            apiCallFromTraceCall(call, m_helpHash, currentFrame, this);
-      calls.append(apiCall);
-      if (apiCall->hasBinaryData()) {
-         QByteArray data =
-               apiCall->arguments()[apiCall->binaryDataIndex()].toByteArray();
-         binaryDataSize += data.size();
-      }
-      if (ApiTrace::isCallAFrameMarker(apiCall,
-                                       m_frameMarker)) {
-         calls.squeeze();
-         currentFrame->setCalls(calls, binaryDataSize);
-         calls.clear();
-         frames.append(currentFrame);
-         currentFrame = 0;
-         binaryDataSize = 0;
-         if (frames.count() >= FRAMES_TO_CACHE) {
-            emit framesLoaded(frames);
-            frames.clear();
-         }
-         if (m_parser.percentRead() - lastPercentReport >= 5) {
-            emit parsed(m_parser.percentRead());
-            lastPercentReport = m_parser.percentRead();
-         }
-      }
-      delete call;
-      call = m_parser.parse_call();
-   }
-
-   //last frames won't have markers
-   //  it's just a bunch of Delete calls for every object
-   //  after the last SwapBuffers
-   if (currentFrame) {
-       calls.squeeze();
-       currentFrame->setCalls(calls, binaryDataSize);
-       frames.append(currentFrame);
-       currentFrame = 0;
-   }
-   if (frames.count()) {
-       emit framesLoaded(frames);
-   }
+    QList<ApiTraceFrame*> frames;
+    ApiTraceFrame *currentFrame = 0;
+    int frameCount = 0;
+    QVector<ApiTraceCall*> calls;
+    quint64 binaryDataSize = 0;
+
+    int lastPercentReport = 0;
+
+    Trace::Call *call = m_parser.parse_call();
+    while (call) {
+        //std::cout << *call;
+        if (!currentFrame) {
+            currentFrame = new ApiTraceFrame();
+            currentFrame->number = frameCount;
+            ++frameCount;
+        }
+        ApiTraceCall *apiCall =
+                apiCallFromTraceCall(call, m_helpHash, currentFrame, this);
+        calls.append(apiCall);
+        if (apiCall->hasBinaryData()) {
+            QByteArray data =
+                    apiCall->arguments()[apiCall->binaryDataIndex()].toByteArray();
+            binaryDataSize += data.size();
+        }
+        if (ApiTrace::isCallAFrameMarker(apiCall,
+                                         m_frameMarker)) {
+            calls.squeeze();
+            currentFrame->setCalls(calls, binaryDataSize);
+            calls.clear();
+            frames.append(currentFrame);
+            currentFrame = 0;
+            binaryDataSize = 0;
+            if (frames.count() >= FRAMES_TO_CACHE) {
+                emit framesLoaded(frames);
+                frames.clear();
+            }
+            if (m_parser.percentRead() - lastPercentReport >= 5) {
+                emit parsed(m_parser.percentRead());
+                lastPercentReport = m_parser.percentRead();
+            }
+        }
+        delete call;
+        call = m_parser.parse_call();
+    }
+
+    //last frames won't have markers
+    //  it's just a bunch of Delete calls for every object
+    //  after the last SwapBuffers
+    if (currentFrame) {
+        calls.squeeze();
+        currentFrame->setCalls(calls, binaryDataSize);
+        frames.append(currentFrame);
+        currentFrame = 0;
+    }
+    if (frames.count()) {
+        emit framesLoaded(frames);
+    }
 }