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
10 #include "ilog/TLoggerCompWrap.h"
11 
12 #include "iprm/INameParam.h"
13 #include "ifile/IFileNameParam.h"
14 
15 
16 namespace ifileproc
17 {
18 
19 
37  public QObject,
39  virtual public ifileproc::IFileConvertCopy
40 {
41  Q_OBJECT
42 
43 public:
45 
46  I_BEGIN_COMPONENT(CExternalFileConverterComp);
47  I_REGISTER_INTERFACE(ifileproc::IFileConvertCopy);
48  I_ASSIGN(m_executablePathCompPtr, "ExecutablePath", "Path to the application's binary", true, "ExecutablePath");
49  I_ASSIGN(m_defaultProcessArgumentsAttrPtr, "DefaultProcessArguments", "Application conversion arguments.\nUse $(Input) to specify the input and $(Output) for output file name", false, "$(Input) $(Output)");
50  I_ASSIGN(m_processArgumentsParamsIdAttrPtr, "ProcessArgumentsParamsId", "ID of the command line parameter (given as a INameParam object) in the parameter set", true, "ProcessArgumentsParamsId");
51  I_ASSIGN_MULTI_0(m_additionalArgumentsCompPtr, "AdditionalArguments", "Additional command line arguments", false);
52  I_END_COMPONENT;
53 
54  // reimplemented (ifileproc::IFileConvertCopy)
55  virtual bool ConvertFiles(
56  const QString& inputPath,
57  const QString& outputPath,
58  const iprm::IParamsSet* paramsPtr = NULL) const;
59 
60 protected:
61  // reimplemented (icomp::CComponentBase)
62  virtual void OnComponentCreated();
63 
64 private Q_SLOTS:
65  void OnReadyReadStandardError();
66  void OnReadyReadStandardOutput();
67 
68 private:
69  I_REF(ifile::IFileNameParam, m_executablePathCompPtr);
70  I_ATTR(QString, m_defaultProcessArgumentsAttrPtr);
71  I_ATTR(QByteArray, m_processArgumentsParamsIdAttrPtr);
72  I_MULTIREF(iprm::INameParam, m_additionalArgumentsCompPtr);
73 
74  mutable QProcess m_conversionProcess;
75 };
76 
77 
78 } // namespace ifileproc
79 
80 
81 #endif // !ifileproc_CExternalFileConverterComp_included
82 
83 
Common interface for file copying.
File converter, which uses an external programm to perform the convert action.
virtual bool ConvertFiles(const QString &inputPath, const QString &outputPath, const iprm::IParamsSet *paramsPtr=NULL) const
Copy a file or files from inputPath to destination outputPath.

© 2007-2011 Witold Gantzke and Kirill Lepskiy