CMakeSetupDialog.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef CMakeSetupDialog_h
  14. #define CMakeSetupDialog_h
  15. #include "QCMake.h"
  16. #include <QMainWindow>
  17. #include <QThread>
  18. #include "ui_CMakeSetupDialog.h"
  19. class QCMakeThread;
  20. class CMakeCacheModel;
  21. class QProgressBar;
  22. class QToolButton;
  23. /// Qt user interface for CMake
  24. class CMakeSetupDialog : public QMainWindow, public Ui::CMakeSetupDialog
  25. {
  26. Q_OBJECT
  27. public:
  28. CMakeSetupDialog();
  29. ~CMakeSetupDialog();
  30. public slots:
  31. void setBinaryDirectory(const QString& dir);
  32. void setSourceDirectory(const QString& dir);
  33. protected slots:
  34. void initialize();
  35. void doConfigure();
  36. void doGenerate();
  37. void doHelp();
  38. void doAbout();
  39. void doInterrupt();
  40. void finishConfigure(int error);
  41. void finishGenerate(int error);
  42. void error(const QString& message);
  43. void message(const QString& message);
  44. void doSourceBrowse();
  45. void doBinaryBrowse();
  46. void doReloadCache();
  47. void doDeleteCache();
  48. void updateSourceDirectory(const QString& dir);
  49. void showProgress(const QString& msg, float percent);
  50. void setEnabledState(bool);
  51. void promptForGenerator();
  52. void updateGeneratorLabel(const QString& gen);
  53. void setExitAfterGenerate(bool);
  54. void addBinaryPath(const QString&);
  55. QStringList loadBuildPaths();
  56. void saveBuildPaths(const QStringList&);
  57. void onBinaryDirectoryChanged(const QString& dir);
  58. void onSourceDirectoryChanged(const QString& dir);
  59. void setCacheModified();
  60. void removeSelectedCacheEntries();
  61. void selectionChanged();
  62. void addCacheEntry();
  63. void startSearch();
  64. protected:
  65. enum State { Interrupting, ReadyConfigure, ReadyGenerate, Configuring, Generating };
  66. void enterState(State s);
  67. void closeEvent(QCloseEvent*);
  68. void dragEnterEvent(QDragEnterEvent*);
  69. void dropEvent(QDropEvent*);
  70. QCMakeThread* CMakeThread;
  71. bool ExitAfterGenerate;
  72. bool CacheModified;
  73. QAction* ReloadCacheAction;
  74. QAction* DeleteCacheAction;
  75. QAction* ExitAction;
  76. QAction* ConfigureAction;
  77. QAction* GenerateAction;
  78. State CurrentState;
  79. };
  80. // QCMake instance on a thread
  81. class QCMakeThread : public QThread
  82. {
  83. Q_OBJECT
  84. public:
  85. QCMakeThread(QObject* p);
  86. QCMake* cmakeInstance() const;
  87. signals:
  88. void cmakeInitialized();
  89. protected:
  90. virtual void run();
  91. QCMake* CMakeInstance;
  92. };
  93. #endif // CMakeSetupDialog_h