CMakeSetupDialog.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef CMakeSetupDialog_h
  11. #define CMakeSetupDialog_h
  12. #include "QCMake.h"
  13. #include <QMainWindow>
  14. #include <QThread>
  15. #include <QEventLoop>
  16. #include "ui_CMakeSetupDialog.h"
  17. class QCMakeThread;
  18. class CMakeCacheModel;
  19. class QProgressBar;
  20. class QToolButton;
  21. /// Qt user interface for CMake
  22. class CMakeSetupDialog : public QMainWindow, public Ui::CMakeSetupDialog
  23. {
  24. Q_OBJECT
  25. public:
  26. CMakeSetupDialog();
  27. ~CMakeSetupDialog();
  28. public slots:
  29. void setBinaryDirectory(const QString& dir);
  30. void setSourceDirectory(const QString& dir);
  31. protected slots:
  32. void initialize();
  33. void doConfigure();
  34. void doGenerate();
  35. void doInstallForCommandLine();
  36. void doHelp();
  37. void doAbout();
  38. void doInterrupt();
  39. void error(const QString& message);
  40. void message(const QString& message);
  41. void doSourceBrowse();
  42. void doBinaryBrowse();
  43. void doReloadCache();
  44. void doDeleteCache();
  45. void updateSourceDirectory(const QString& dir);
  46. void updateBinaryDirectory(const QString& dir);
  47. void showProgress(const QString& msg, float percent);
  48. void setEnabledState(bool);
  49. bool setupFirstConfigure();
  50. void updateGeneratorLabel(const QString& gen);
  51. void setExitAfterGenerate(bool);
  52. void addBinaryPath(const QString&);
  53. QStringList loadBuildPaths();
  54. void saveBuildPaths(const QStringList&);
  55. void onBinaryDirectoryChanged(const QString& dir);
  56. void onSourceDirectoryChanged(const QString& dir);
  57. void setCacheModified();
  58. void removeSelectedCacheEntries();
  59. void selectionChanged();
  60. void addCacheEntry();
  61. void startSearch();
  62. void setDebugOutput(bool);
  63. void setAdvancedView(bool);
  64. void setGroupedView(bool);
  65. void showUserChanges();
  66. void setSearchFilter(const QString& str);
  67. bool prepareConfigure();
  68. bool doConfigureInternal();
  69. bool doGenerateInternal();
  70. void exitLoop(int);
  71. protected:
  72. enum State { Interrupting, ReadyConfigure, ReadyGenerate, Configuring, Generating };
  73. void enterState(State s);
  74. void closeEvent(QCloseEvent*);
  75. void dragEnterEvent(QDragEnterEvent*);
  76. void dropEvent(QDropEvent*);
  77. QCMakeThread* CMakeThread;
  78. bool ExitAfterGenerate;
  79. bool CacheModified;
  80. bool ConfigureNeeded;
  81. QAction* ReloadCacheAction;
  82. QAction* DeleteCacheAction;
  83. QAction* ExitAction;
  84. QAction* ConfigureAction;
  85. QAction* GenerateAction;
  86. QAction* SuppressDevWarningsAction;
  87. QAction* WarnUninitializedAction;
  88. QAction* WarnUnusedAction;
  89. QAction* InstallForCommandLineAction;
  90. State CurrentState;
  91. QTextCharFormat ErrorFormat;
  92. QTextCharFormat MessageFormat;
  93. QStringList AddVariableCompletions;
  94. QEventLoop LocalLoop;
  95. float ProgressOffset;
  96. float ProgressFactor;
  97. };
  98. // QCMake instance on a thread
  99. class QCMakeThread : public QThread
  100. {
  101. Q_OBJECT
  102. public:
  103. QCMakeThread(QObject* p);
  104. QCMake* cmakeInstance() const;
  105. signals:
  106. void cmakeInitialized();
  107. protected:
  108. virtual void run();
  109. QCMake* CMakeInstance;
  110. };
  111. #endif // CMakeSetupDialog_h