maemo5qtprojectgenerator.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef MAEMO5QTPROJECTGENERATOR_H
  2. #define MAEMO5QTPROJECTGENERATOR_H
  3. #include <QMap>
  4. #include <QObject>
  5. #include <QSet>
  6. #include <QString>
  7. #include <QStack>
  8. #include <QProcess>
  9. #include "defines.h"
  10. #include "generatordata.h"
  11. #include "generatoroutputview.h"
  12. #include "iqtprojectgenerator.h"
  13. class Maemo5ProcessRunner;
  14. class Maemo5QtProjectGenerator : public IQtProjectGenerator
  15. {
  16. Q_OBJECT
  17. protected:
  18. //
  19. // protected members
  20. //
  21. GeneratorOutputView & m_outputView;
  22. GeneratorData m_generatorData;
  23. Maemo5ProcessRunner * m_processRunner;
  24. GeneratorPhase m_currentGeneratorPhase;
  25. GeneratorTarget m_generatorTarget;
  26. // TODO ? QStack<QString> m_pluginDirs;
  27. WidgetType m_resolvedWidgetType;
  28. QString m_appName;
  29. QString m_appDisplayName;
  30. QMap<QString, QString> m_filenameSubstitutions;
  31. QSet<QString> m_ignorePatterns;
  32. QMap<QString, QString> m_keywordSubstitutions;
  33. public:
  34. //
  35. // lifetime management
  36. //
  37. Maemo5QtProjectGenerator(GeneratorOutputView & outputView,
  38. QObject * parent = NULL);
  39. virtual ~Maemo5QtProjectGenerator();
  40. //
  41. // public operators
  42. //
  43. signals:
  44. void started(GeneratorTarget target);
  45. void finished(int exitCode);
  46. public:
  47. virtual IStatusUpdater * createStatusUpdater(QObject * parent = NULL);
  48. virtual const PlatformType& platform();
  49. virtual void build(const QString &widgetFile,
  50. RcSession & /* rcSession */);
  51. virtual void rebuild(RcSession & /* rcSession */);
  52. virtual void preview(const QString &widgetFile);
  53. virtual void closeProject();
  54. virtual GeneratorOutputView &outputView() const;
  55. virtual GeneratorData &generatorData();
  56. virtual GeneratorPhase getCurrentPhase() const;
  57. virtual GeneratorTarget getTarget() const;
  58. virtual QString getStatusText() const;
  59. virtual QWidget * createSettingsWidget(const QString & widgetFile,
  60. QWidget * parent = NULL) const;
  61. virtual void saveSettings(QWidget * settingsWidget) const;
  62. virtual QStringList errorsForTarget(GeneratorTarget generatorTarget) const;
  63. virtual PkgInstallResult installPkg(const QFileInfo & pkgFile) const;
  64. protected slots:
  65. virtual void dpkgBuildPackageFinished(int exitCode,
  66. QProcess::ExitStatus exitStatus);
  67. virtual void widgetFilesCopied(int exitCode,
  68. QProcess::ExitStatus exitStatus = QProcess::NormalExit);
  69. protected:
  70. // OBS virtual Maemo5ProcessRunner * createProcessRunner();
  71. void copyWidgetDirectory(const QString &wgzFile); // Uncompress widget file
  72. bool prepareProject();
  73. bool prepareEnvironment(const QString &wgzFile);
  74. void unzipWidgetFile(const QString &wgzFile);
  75. bool registerStatus(bool status);
  76. void sniffWidgetType();
  77. bool copyFrameworkAndPluginSrcFiles();
  78. bool prepareEnvironmentForNonWRTWidget();
  79. bool handleWidgetConfigFile();
  80. bool copyHybridApiJs();
  81. bool copyDisableSelectionCSS();
  82. void handleWidgetDirectory();
  83. bool updateMainFile();
  84. bool updateMainWindowFile();
  85. void parseWidgetResourceFile();
  86. bool updateFrameworkProjectFile();
  87. bool copyMaemo5Files();
  88. bool copyCopyrightFile();
  89. virtual void startBuild();
  90. /** OBS
  91. * Synchronously unzips a widget file - returns with success.
  92. * /
  93. bool syncUnzipWidgetFile(const QString & wgzFile,
  94. const QString & unzipDir);
  95. void sniffAppNames(const QString & widgetFile);
  96. */
  97. void updateSubstitutions(const QString & widgetFile);
  98. };
  99. #endif // MAEMO5QTPROJECTGENERATOR_H