CMakeSetupDialog.h 3.6 KB

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