CMakeSetupDialog.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. void doOutputFindDialog();
  72. void doOutputFindNext(bool directionForward = true);
  73. void doOutputFindPrev();
  74. protected:
  75. enum State { Interrupting, ReadyConfigure, ReadyGenerate, Configuring, Generating };
  76. void enterState(State s);
  77. void closeEvent(QCloseEvent*);
  78. void dragEnterEvent(QDragEnterEvent*);
  79. void dropEvent(QDropEvent*);
  80. QCMakeThread* CMakeThread;
  81. bool ExitAfterGenerate;
  82. bool CacheModified;
  83. bool ConfigureNeeded;
  84. QAction* ReloadCacheAction;
  85. QAction* DeleteCacheAction;
  86. QAction* ExitAction;
  87. QAction* ConfigureAction;
  88. QAction* GenerateAction;
  89. QAction* SuppressDevWarningsAction;
  90. QAction* WarnUninitializedAction;
  91. QAction* WarnUnusedAction;
  92. QAction* InstallForCommandLineAction;
  93. State CurrentState;
  94. QTextCharFormat ErrorFormat;
  95. QTextCharFormat MessageFormat;
  96. QStringList AddVariableCompletions;
  97. QStringList FindHistory;
  98. QEventLoop LocalLoop;
  99. float ProgressOffset;
  100. float ProgressFactor;
  101. };
  102. // QCMake instance on a thread
  103. class QCMakeThread : public QThread
  104. {
  105. Q_OBJECT
  106. public:
  107. QCMakeThread(QObject* p);
  108. QCMake* cmakeInstance() const;
  109. signals:
  110. void cmakeInitialized();
  111. protected:
  112. virtual void run();
  113. QCMake* CMakeInstance;
  114. };
  115. #endif // CMakeSetupDialog_h