Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / QtDialog / QCMake.h
blob9b954854f0100c0de210192186164177e0aedece
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMake.h,v $
5 Language: C++
6 Date: $Date: 2008-04-02 21:41:24 $
7 Version: $Revision: 1.10 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef __QCMake_h
19 #define __QCMake_h
20 #ifdef _MSC_VER
21 #pragma warning ( disable : 4127 )
22 #pragma warning ( disable : 4512 )
23 #endif
25 #include <QObject>
26 #include <QString>
27 #include <QVariant>
28 #include <QList>
29 #include <QStringList>
30 #include <QMetaType>
32 class cmake;
34 /// struct to represent cache properties in Qt
35 /// Value is of type String or Bool
36 struct QCMakeCacheProperty
38 enum PropertyType { BOOL, PATH, FILEPATH, STRING };
39 QString Key;
40 QVariant Value;
41 QString Help;
42 PropertyType Type;
43 bool Advanced;
44 bool operator==(const QCMakeCacheProperty& other) const
46 return this->Key == other.Key;
48 bool operator<(const QCMakeCacheProperty& other) const
50 return this->Key < other.Key;
54 // make types usable with QVariant
55 Q_DECLARE_METATYPE(QCMakeCacheProperty)
56 typedef QList<QCMakeCacheProperty> QCMakeCachePropertyList;
57 Q_DECLARE_METATYPE(QCMakeCachePropertyList)
59 /// Qt API for CMake library.
60 /// Wrapper like class allows for easier integration with
61 /// Qt features such as, signal/slot connections, multi-threading, etc..
62 class QCMake : public QObject
64 Q_OBJECT
65 public:
66 QCMake(QObject* p=0);
67 ~QCMake();
68 void SetSuppressDevWarnings(bool value);
69 public slots:
70 /// load the cache file in a directory
71 void loadCache(const QString& dir);
72 /// set the source directory containing the source
73 void setSourceDirectory(const QString& dir);
74 /// set the binary directory to build in
75 void setBinaryDirectory(const QString& dir);
76 /// set the desired generator to use
77 void setGenerator(const QString& generator);
78 /// do the configure step
79 void configure();
80 /// generate the files
81 void generate();
82 /// set the property values
83 void setProperties(const QCMakeCachePropertyList&);
84 /// interrupt the configure or generate process
85 void interrupt();
86 /// delete the cache in binary directory
87 void deleteCache();
88 /// reload the cache in binary directory
89 void reloadCache();
90 /// set whether to do debug output
91 void setDebugOutput(bool);
93 public:
94 /// get the list of cache properties
95 QCMakeCachePropertyList properties() const;
96 /// get the current binary directory
97 QString binaryDirectory() const;
98 /// get the current source directory
99 QString sourceDirectory() const;
100 /// get the current generator
101 QString generator() const;
102 /// get the available generators
103 QStringList availableGenerators() const;
104 /// get whether to do debug output
105 bool getDebugOutput() const;
107 signals:
108 /// signal when properties change (during read from disk or configure process)
109 void propertiesChanged(const QCMakeCachePropertyList& vars);
110 /// signal when the generator changes
111 void generatorChanged(const QString& gen);
112 /// signal when the source directory changes (binary directory already
113 /// containing a CMakeCache.txt file)
114 void sourceDirChanged(const QString& dir);
115 /// signal for progress events
116 void progressChanged(const QString& msg, float percent);
117 /// signal when configure is done
118 void configureDone(int error);
119 /// signal when generate is done
120 void generateDone(int error);
121 /// signal when there is an output message
122 void outputMessage(const QString& msg);
123 /// signal when there is an error message
124 void errorMessage(const QString& msg);
125 /// signal when debug output changes
126 void debugOutputChanged(bool);
128 protected:
129 cmake* CMakeInstance;
131 static void progressCallback(const char* msg, float percent, void* cd);
132 static void errorCallback(const char* msg, const char* title,
133 bool&, void* cd);
134 bool SuppressDevWarnings;
135 QString SourceDirectory;
136 QString BinaryDirectory;
137 QString Generator;
138 QStringList AvailableGenerators;
139 QString CMakeExecutable;
142 #endif // __QCMake_h