CExternalFileConverterComp.h
Go to the documentation of this file.
1 #ifndef ifileproc_CExternalFileConverterComp_included
2 #define ifileproc_CExternalFileConverterComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QProcess>
7 
8 // ACF includes
9 #include <ilog/TLoggerCompWrap.h>
10 #include <iprm/INameParam.h>
11 #include <ifile/IFileNameParam.h>
13 
14 
15 namespace ifileproc
16 {
17 
18 
41  public QObject,
43  virtual public ifileproc::IFileConversion
44 {
45  Q_OBJECT
46 
47 public:
49 
50  I_BEGIN_COMPONENT(CExternalFileConverterComp);
51  I_REGISTER_INTERFACE(ifileproc::IFileConversion);
52  I_ASSIGN(m_executablePathCompPtr, "ExecutablePath", "Path to the converter's executable file", true, "ExecutablePath");
53  I_ASSIGN(m_defaultProcessArgumentsAttrPtr, "DefaultProcessArguments", "Application conversion arguments.\nUse $(Input) to specify the input and $(Output) for output file name", false, "$(Input) $(Output)");
54  I_ASSIGN(m_processArgumentsParamsIdAttrPtr, "ProcessArgumentsParamsId", "ID of the command line parameter (given as a INameParam object) in the parameter set", true, "ProcessArgumentsParamsId");
55  I_ASSIGN_MULTI_0(m_additionalArgumentsCompPtr, "AdditionalArguments", "Additional command line arguments", false);
56  I_END_COMPONENT;
57 
58  // reimplemented (ifileproc::IFileConversion)
59  virtual int ConvertFiles(
60  const QString& inputPath,
61  QString& outputPath,
62  const iprm::IParamsSet* paramsPtr = NULL,
63  ibase::IProgressManager* progressManagerPtr = NULL) const;
64 
65 protected:
66  // reimplemented (icomp::CComponentBase)
67  virtual void OnComponentCreated();
68 
69 private Q_SLOTS:
70  void OnReadyReadStandardError();
71  void OnReadyReadStandardOutput();
72 
73 private:
74  I_REF(ifile::IFileNameParam, m_executablePathCompPtr);
75  I_ATTR(QString, m_defaultProcessArgumentsAttrPtr);
76  I_ATTR(QByteArray, m_processArgumentsParamsIdAttrPtr);
77  I_MULTIREF(iprm::INameParam, m_additionalArgumentsCompPtr);
78 
79 #ifndef QT_NO_PROCESS
80  mutable QProcess m_conversionProcess;
81 #endif
82 };
83 
84 
85 } // namespace ifileproc
86 
87 
88 #endif // !ifileproc_CExternalFileConverterComp_included
89 
90 
virtual int ConvertFiles(const QString &inputPath, QString &outputPath, const iprm::IParamsSet *paramsPtr=NULL, ibase::IProgressManager *progressManagerPtr=NULL) const
Copy a file or files from inputPath to destination outputPath.
File converter, which uses an external programm to perform the file conversion.
General interface for conversion of files.

© 2007-2017 Witold Gantzke and Kirill Lepskiy