123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #ifndef FILEUTILITIES_H
- #define FILEUTILITIES_H
- #include <QList>
- #include <QPair>
- #include <QSharedPointer>
- class QDir;
- #include "generatoroutputview.h"
- #include "generatordata.h"
- #include "hybridplugin.h"
- #include "defines.h"
- class FileUtilities
- {
- public:
- FileUtilities(GeneratorOutputView &outputView, GeneratorData &generatorData);
- bool updateMainFile();
- bool updateMainWindowFile();
- bool updateProjectFile(QString filename);
- void createWidgetResourceFile();
- bool createWidgetProjectFile(const QList< QSharedPointer<HybridPlugin> > &plugins);
- bool createPluginsProjectFile(const QList< QSharedPointer<HybridPlugin> > &plugins);
- bool configXmlToInfoPlistFile(WidgetType widgetType);
- bool directoryToInfoPlistFile();
- QString getMainHTMLFileFullPath();
- QString getWidgetIdentifier();
- /**
- * Finds a file recursively under a directory.
- *
- * @param dir under which the file is to be found, directly or
- * indirectly
- *
- * @param fileName the name of the file to be found.
- *
- * @return the absolute path to the file, if found, empty string
- * otherwise.
- */
- static QString findFile(const QDir & dir,
- const QString & fileName);
- /**
- * Makes sure that tmpDir exists and it is empty.
- */
- static bool clearUpDir(QDir tmpDir);
- /**
- * Unzips a widget file to a directory. Blocking (sync) call.
- *
- * @return true iff successful
- */
- static bool syncUnzipWidgetFile(const QString & wgzFile,
- const QString & unzipDir);
- /**
- * Figures out the app name(s) for a widget File.
- *
- * @param widgetFilePath path to a widget file or widget directory
- *
- * @return a pair of <app-name, app-display-name> values.
- */
- static QPair<QString, QString> sniffAppNames(const QString & widgetFilePath);
- private:
- bool readTemplateFile(const QString &fileName, QString &fileContent, const QString &onErrorMessage);
- void processTemplateProjectFileLine(QString &templateFileLine);
- GeneratorOutputView &m_outputView;
- GeneratorData &m_generatorData;
- QString m_infoPlistFileNameNoSpaces;
- };
- #endif // FILEUTILITIES_H
|