FirstConfigure.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. #ifndef FirstConfigure_h
  2. #define FirstConfigure_h
  3. #include <QWizard>
  4. #include <QWizardPage>
  5. #include "cmake.h"
  6. #include "ui_Compilers.h"
  7. #include "ui_CrossCompiler.h"
  8. class QRadioButton;
  9. class QComboBox;
  10. //! the wizard pages we'll use for the first configure of a build
  11. enum FirstConfigurePages
  12. {
  13. Start,
  14. NativeSetup,
  15. ToolchainSetup,
  16. CrossSetup,
  17. Done
  18. };
  19. //! the first page that gives basic options for what compilers setup to choose
  20. //! from
  21. class StartCompilerSetup : public QWizardPage
  22. {
  23. Q_OBJECT
  24. public:
  25. StartCompilerSetup(QString defaultGeneratorPlatform,
  26. QString defaultGeneratorToolset, QWidget* p);
  27. ~StartCompilerSetup();
  28. void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
  29. void setCurrentGenerator(const QString& gen);
  30. QString getGenerator() const;
  31. QString getToolset() const;
  32. QString getPlatform() const;
  33. bool defaultSetup() const;
  34. bool compilerSetup() const;
  35. bool crossCompilerSetup() const;
  36. bool crossCompilerToolChainFile() const;
  37. int nextId() const;
  38. signals:
  39. void selectionChanged();
  40. protected slots:
  41. void onSelectionChanged(bool);
  42. void onGeneratorChanged(QString const& name);
  43. protected:
  44. QComboBox* GeneratorOptions;
  45. QRadioButton* CompilerSetupOptions[4];
  46. QFrame* ToolsetFrame;
  47. QLineEdit* Toolset;
  48. QLabel* ToolsetLabel;
  49. QFrame* PlatformFrame;
  50. QComboBox* PlatformOptions;
  51. QLabel* PlatformLabel;
  52. QStringList GeneratorsSupportingToolset;
  53. QStringList GeneratorsSupportingPlatform;
  54. QMultiMap<QString, QString> GeneratorSupportedPlatforms;
  55. QMap<QString, QString> GeneratorDefaultPlatform;
  56. QString DefaultGeneratorPlatform, DefaultGeneratorToolset;
  57. private:
  58. QFrame* CreateToolsetWidgets();
  59. QFrame* CreatePlatformWidgets();
  60. };
  61. //! the page that gives basic options for native compilers
  62. class NativeCompilerSetup
  63. : public QWizardPage
  64. , protected Ui::Compilers
  65. {
  66. Q_OBJECT
  67. public:
  68. NativeCompilerSetup(QWidget* p);
  69. ~NativeCompilerSetup();
  70. QString getCCompiler() const;
  71. void setCCompiler(const QString&);
  72. QString getCXXCompiler() const;
  73. void setCXXCompiler(const QString&);
  74. QString getFortranCompiler() const;
  75. void setFortranCompiler(const QString&);
  76. int nextId() const { return -1; }
  77. };
  78. //! the page that gives options for cross compilers
  79. class CrossCompilerSetup
  80. : public QWizardPage
  81. , protected Ui::CrossCompiler
  82. {
  83. Q_OBJECT
  84. public:
  85. CrossCompilerSetup(QWidget* p);
  86. ~CrossCompilerSetup();
  87. QString getSystem() const;
  88. void setSystem(const QString&);
  89. QString getVersion() const;
  90. void setVersion(const QString&);
  91. QString getProcessor() const;
  92. void setProcessor(const QString&);
  93. QString getCCompiler() const;
  94. void setCCompiler(const QString&);
  95. QString getCXXCompiler() const;
  96. void setCXXCompiler(const QString&);
  97. QString getFortranCompiler() const;
  98. void setFortranCompiler(const QString&);
  99. QString getFindRoot() const;
  100. void setFindRoot(const QString&);
  101. enum CrossMode
  102. {
  103. BOTH,
  104. ONLY,
  105. NEVER
  106. };
  107. int getProgramMode() const;
  108. void setProgramMode(int);
  109. int getLibraryMode() const;
  110. void setLibraryMode(int);
  111. int getIncludeMode() const;
  112. void setIncludeMode(int);
  113. int nextId() const { return -1; }
  114. };
  115. //! the page that gives options for a toolchain file
  116. class ToolchainCompilerSetup : public QWizardPage
  117. {
  118. Q_OBJECT
  119. public:
  120. ToolchainCompilerSetup(QWidget* p);
  121. ~ToolchainCompilerSetup();
  122. QString toolchainFile() const;
  123. void setToolchainFile(const QString&);
  124. int nextId() const { return -1; }
  125. protected:
  126. QCMakeFilePathEditor* ToolchainFile;
  127. };
  128. //! the wizard with the pages
  129. class FirstConfigure : public QWizard
  130. {
  131. Q_OBJECT
  132. public:
  133. FirstConfigure();
  134. ~FirstConfigure();
  135. void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
  136. QString getGenerator() const;
  137. QString getPlatform() const;
  138. QString getToolset() const;
  139. bool defaultSetup() const;
  140. bool compilerSetup() const;
  141. bool crossCompilerSetup() const;
  142. bool crossCompilerToolChainFile() const;
  143. QString getCCompiler() const;
  144. QString getCXXCompiler() const;
  145. QString getFortranCompiler() const;
  146. QString getSystemName() const;
  147. QString getSystemVersion() const;
  148. QString getSystemProcessor() const;
  149. QString getCrossRoot() const;
  150. QString getCrossProgramMode() const;
  151. QString getCrossLibraryMode() const;
  152. QString getCrossIncludeMode() const;
  153. QString getCrossCompilerToolChainFile() const;
  154. void loadFromSettings();
  155. void saveToSettings();
  156. protected:
  157. StartCompilerSetup* mStartCompilerSetupPage;
  158. NativeCompilerSetup* mNativeCompilerSetupPage;
  159. CrossCompilerSetup* mCrossCompilerSetupPage;
  160. ToolchainCompilerSetup* mToolchainCompilerSetupPage;
  161. QString mDefaultGenerator;
  162. };
  163. #endif // FirstConfigure_h