iqtprojectgenerator.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #ifndef IQTPROJECTGENERATOR_H
  2. #define IQTPROJECTGENERATOR_H
  3. #include <QObject>
  4. #include <QList>
  5. #include <QSharedPointer>
  6. #include "istatusupdater.h"
  7. #include "generatordata.h"
  8. #include "generatoroutputview.h"
  9. #include "hybridpluginxmlhandler.h"
  10. #include "defines.h"
  11. class HybridPlugin;
  12. struct PlatformType
  13. {
  14. QString m_platformName;
  15. int m_platformVersion;
  16. int m_qtVersion;
  17. };
  18. class RcSession;
  19. /**
  20. * Interface for project generators. Implementations of this interface
  21. * will generate projects for different platforms (symbian, maemo).
  22. */
  23. class IQtProjectGenerator : public QObject
  24. {
  25. Q_OBJECT
  26. public:
  27. //
  28. // lifetime management
  29. //
  30. IQtProjectGenerator(QObject * parent = NULL);
  31. virtual ~IQtProjectGenerator() = 0;
  32. //
  33. // public operators
  34. //
  35. signals:
  36. void started(GeneratorTarget target);
  37. void finished(int exitCode);
  38. protected:
  39. //
  40. // common members
  41. //
  42. QMap< QString, QSharedPointer<HybridPluginPlatform> > m_selection;
  43. QList< QSharedPointer<HybridPlugin> > m_plugins;
  44. PlatformType m_platform;
  45. bool m_selectionDone;
  46. public:
  47. /**
  48. * Creates and initializes a status updater object.
  49. *
  50. * The creates status updater will be wired up (signals/slots etc) using thís
  51. * generator instance.
  52. *
  53. * @return a newly create instance of status updater, or NULL on failure.
  54. */
  55. virtual IStatusUpdater * createStatusUpdater(QObject * parent = NULL) = 0;
  56. /**
  57. * Returns the current platform details.
  58. */
  59. virtual const PlatformType& platform() = 0;
  60. /**
  61. * Return a list of plugins. Note that the list contains all available plugins,
  62. * whether compatible with the current platform or not.
  63. */
  64. virtual const QList< QSharedPointer<HybridPlugin> >& plugins();
  65. /**
  66. * Reset the platform selection for each plugin based on each plugin's
  67. * available versions. User should be able to override this in settings.
  68. */
  69. virtual void confirmPluginPlatform();
  70. /**
  71. * Build a widget.
  72. *
  73. * @param widgetFile - path to a widget file or directory.
  74. * @param rcSession the session required to build remotely, in case
  75. * this qt-project-generator instance is a remote builder.
  76. */
  77. virtual void build(const QString &widgetFile,
  78. RcSession &rcSession) = 0;
  79. /**
  80. * Re-build a widget.
  81. *
  82. * @param rcSession the session required to build remotely, in case
  83. * this qt-project-generator instance is a remote builder.
  84. */
  85. virtual void rebuild(RcSession &rcSession) = 0;
  86. // TODO eventually, preview should go to its own class, as it is not platform
  87. // specific ...
  88. virtual void preview(const QString &widgetFile) = 0;
  89. virtual void closeProject() = 0;
  90. virtual GeneratorOutputView &outputView() const = 0;
  91. virtual GeneratorData &generatorData() = 0;
  92. virtual GeneratorPhase getCurrentPhase() const = 0;
  93. virtual GeneratorTarget getTarget() const = 0;
  94. virtual QString getStatusText() const = 0;
  95. /**
  96. * Creates a widget to paste into a dialog/window that can edit
  97. * settings important to the platform specific generator. Persisted
  98. * settings are loaded via "Settings".
  99. *
  100. * @param widgetFile the path to the currently selected widget file.
  101. * Its value may be empty, in case there has been no file
  102. * selections yet.
  103. *
  104. * @param parent to the widget to be created
  105. */
  106. virtual QWidget * createSettingsWidget(const QString & widgetFile,
  107. QWidget * parent = NULL) const = 0;
  108. /**
  109. * Creates a widget to show information of plugins that are compatible
  110. * with the selected platform. The plugin selection can be altered
  111. * to enable different sets to be included in different projects.
  112. */
  113. virtual QWidget * createSettingsPluginsWidget(QWidget * parent = 0);
  114. /**
  115. * Reads settings from the widget (created by createSettingsWidget) and
  116. * persist them using class "Settings".
  117. */
  118. virtual void saveSettings(QWidget * settingsWidget) const = 0;
  119. /**
  120. * Reads the plugin selection from the widget and saves the selection
  121. * in the plugin list itself.
  122. */
  123. virtual void savePluginSettings(QWidget * settingsWidget);
  124. /**
  125. * Checks sanity of settings (perstisted by "Settings" class).
  126. *
  127. * GeneratorTarget the target to check settings for.
  128. */
  129. virtual QStringList errorsForTarget(GeneratorTarget generatorTarget) const = 0;
  130. /**
  131. * Possible outcomes of package installing action.
  132. */
  133. enum PkgInstallResult
  134. {
  135. PKGINSTALL_NOT_SUPPORTED,
  136. PKGINSTALL_ERROR,
  137. PKGINSTALL_OK
  138. };
  139. /**
  140. * Platform specific way of installing created package. It is an
  141. * optional operation.
  142. *
  143. * @param pkgFile the package file to install to a device of
  144. * the platform this generator represents.
  145. *
  146. * @return result of the package installing action.
  147. */
  148. virtual PkgInstallResult installPkg(const QFileInfo & pkgFile) const = 0;
  149. };
  150. #endif // IQTPROJECTGENERATOR_H