ENH: Allow edit on single click. Fixes #9393. Also fix row heights to be consistent.
[cmake.git] / Source / QtDialog / QCMake.h
blobb1b2cc3d60d33cc39b2d72474727a20c6d23ed7b
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMake.h,v $
5 Language: C++
6 Date: $Date: 2009-03-12 15:19:27 $
7 Version: $Revision: 1.13 $
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 cmake properties in Qt
35 /// Value is of type String or Bool
36 struct QCMakeProperty
38 enum PropertyType { BOOL, PATH, FILEPATH, STRING };
39 QString Key;
40 QVariant Value;
41 QStringList Strings;
42 QString Help;
43 PropertyType Type;
44 bool Advanced;
45 bool operator==(const QCMakeProperty& other) const
47 return this->Key == other.Key;
49 bool operator<(const QCMakeProperty& other) const
51 return this->Key < other.Key;
55 // list of properties
56 typedef QList<QCMakeProperty> QCMakePropertyList;
58 // allow QVariant to be a property or list of properties
59 Q_DECLARE_METATYPE(QCMakeProperty)
60 Q_DECLARE_METATYPE(QCMakePropertyList)
62 /// Qt API for CMake library.
63 /// Wrapper like class allows for easier integration with
64 /// Qt features such as, signal/slot connections, multi-threading, etc..
65 class QCMake : public QObject
67 Q_OBJECT
68 public:
69 QCMake(QObject* p=0);
70 ~QCMake();
71 public slots:
72 /// load the cache file in a directory
73 void loadCache(const QString& dir);
74 /// set the source directory containing the source
75 void setSourceDirectory(const QString& dir);
76 /// set the binary directory to build in
77 void setBinaryDirectory(const QString& dir);
78 /// set the desired generator to use
79 void setGenerator(const QString& generator);
80 /// do the configure step
81 void configure();
82 /// generate the files
83 void generate();
84 /// set the property values
85 void setProperties(const QCMakePropertyList&);
86 /// interrupt the configure or generate process
87 void interrupt();
88 /// delete the cache in binary directory
89 void deleteCache();
90 /// reload the cache in binary directory
91 void reloadCache();
92 /// set whether to do debug output
93 void setDebugOutput(bool);
94 /// set whether to do suppress dev warnings
95 void setSuppressDevWarnings(bool value);
97 public:
98 /// get the list of cache properties
99 QCMakePropertyList properties() const;
100 /// get the current binary directory
101 QString binaryDirectory() const;
102 /// get the current source directory
103 QString sourceDirectory() const;
104 /// get the current generator
105 QString generator() const;
106 /// get the available generators
107 QStringList availableGenerators() const;
108 /// get whether to do debug output
109 bool getDebugOutput() const;
111 signals:
112 /// signal when properties change (during read from disk or configure process)
113 void propertiesChanged(const QCMakePropertyList& vars);
114 /// signal when the generator changes
115 void generatorChanged(const QString& gen);
116 /// signal when the source directory changes (binary directory already
117 /// containing a CMakeCache.txt file)
118 void sourceDirChanged(const QString& dir);
119 /// signal when the binary directory changes
120 void binaryDirChanged(const QString& dir);
121 /// signal for progress events
122 void progressChanged(const QString& msg, float percent);
123 /// signal when configure is done
124 void configureDone(int error);
125 /// signal when generate is done
126 void generateDone(int error);
127 /// signal when there is an output message
128 void outputMessage(const QString& msg);
129 /// signal when there is an error message
130 void errorMessage(const QString& msg);
131 /// signal when debug output changes
132 void debugOutputChanged(bool);
134 protected:
135 cmake* CMakeInstance;
137 static void progressCallback(const char* msg, float percent, void* cd);
138 static void errorCallback(const char* msg, const char* title,
139 bool&, void* cd);
140 bool SuppressDevWarnings;
141 QString SourceDirectory;
142 QString BinaryDirectory;
143 QString Generator;
144 QStringList AvailableGenerators;
145 QString CMakeExecutable;
148 #endif // __QCMake_h