ctkCmdLineModuleXmlProgressWatcher.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKCMDLINEMODULEXMLPROGRESSWATCHER_H
  16. #define CTKCMDLINEMODULEXMLPROGRESSWATCHER_H
  17. #include "ctkCommandLineModulesCoreExport.h"
  18. #include <QObject>
  19. class ctkCmdLineModuleXmlProgressWatcherPrivate;
  20. class QIODevice;
  21. class QProcess;
  22. /**
  23. * \class ctkCmdLineModuleXmlProgressWatcher
  24. * \brief Provides progress updates of a module.
  25. * \ingroup CommandLineModulesCore_API
  26. *
  27. * This class is usually only used by back-end implementators for modules
  28. * which can report progress and results in the form of XML fragments written
  29. * to a QIODevice.
  30. */
  31. class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleXmlProgressWatcher : public QObject
  32. {
  33. Q_OBJECT
  34. public:
  35. ctkCmdLineModuleXmlProgressWatcher(QIODevice* input);
  36. ctkCmdLineModuleXmlProgressWatcher(QProcess* input);
  37. ~ctkCmdLineModuleXmlProgressWatcher();
  38. Q_SIGNALS:
  39. void filterStarted(const QString& name, const QString& comment);
  40. void filterProgress(float progress, const QString& comment);
  41. void filterResult(const QString& parameter, const QString& value);
  42. void filterFinished(const QString& name, const QString& comment);
  43. void filterXmlError(const QString& error);
  44. void outputDataAvailable(const QByteArray& outputData);
  45. void errorDataAvailable(const QByteArray& errorData);
  46. private:
  47. friend class ctkCmdLineModuleXmlProgressWatcherPrivate;
  48. Q_PRIVATE_SLOT(d, void _q_readyRead())
  49. Q_PRIVATE_SLOT(d, void _q_readyReadError())
  50. QScopedPointer<ctkCmdLineModuleXmlProgressWatcherPrivate> d;
  51. };
  52. #endif // CTKCMDLINEMODULEXMLPROGRESSWATCHER_H