Browse Source

Updated ctkCmdLineModuleXmlProgressWatcher to cope with just stdout data

MattClarkson 12 years ago
parent
commit
1bc34bf5fc
1 changed files with 15 additions and 8 deletions
  1. 15 8
      Libs/CommandLineModules/Core/ctkCmdLineModuleXmlProgressWatcher.cpp

+ 15 - 8
Libs/CommandLineModules/Core/ctkCmdLineModuleXmlProgressWatcher.cpp

@@ -61,7 +61,13 @@ public:
   void _q_readyRead()
   {
     input->seek(readPos);
-    reader.addData(input->readAll());
+
+    QByteArray buffer = input->readAll();
+
+    buffer.prepend("<module-snippet>");
+    buffer.append("</module-snippet>");
+
+    reader.addData(buffer);
     readPos = input->pos();
     parseProgressXml();
   }
@@ -123,7 +129,7 @@ public:
         QString parent;
         if (!stack.empty()) parent = stack.back();
 
-        if (name.compare("module-root") != 0)
+        if (name.compare("module-root") != 0 && name.compare("module-snippet") != 0)
         {
           stack.push_back(name.toString());
         }
@@ -171,13 +177,8 @@ public:
           if (!stack.empty()) parent = stack.back();
         }
 
-        if (parent.isEmpty())
+        if (parent.isEmpty() && name.compare("module-snippet") != 0)
         {
-          if (!outputData.isEmpty())
-          {
-            emit q->outputDataAvailable(outputData);
-            outputData.clear();
-          }
           if (name.compare(FILTER_START, Qt::CaseInsensitive) == 0)
           {
             emit q->filterStarted(currentName, currentComment);
@@ -208,6 +209,12 @@ public:
       default:
         break;
       }
+
+      if (!outputData.isEmpty())
+      {
+        emit q->outputDataAvailable(outputData);
+        outputData.clear();
+      }
       type = reader.readNext();
     }