qtbindings 4.6.3.4 → 4.8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/KNOWN_ISSUES.txt +19 -5
- data/README.txt +119 -93
- data/Rakefile +28 -27
- data/examples/desktop/systray/window.rb +43 -47
- data/examples/draganddrop/dropsite/dropsitewidget.rb +10 -9
- data/examples/mainwindows/mdi/mainwindow.rb +4 -4
- data/examples/network/broadcastsender/sender.rb +3 -1
- data/examples/qtscribble/scribble.rb +270 -0
- data/examples/ruboids/LICENSE.txt +58 -0
- data/examples/run_all.rb +1 -0
- data/examples/textedit/textedit.rb +150 -0
- data/examples/widgets/scribble/scribblearea.rb +19 -19
- data/ext/cmake/modules/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/cmake/modules/FindLibraryWithDebug.cmake +113 -0
- data/ext/cmake/modules/FindPhonon.cmake +71 -0
- data/ext/cmake/modules/FindQImageBlitz.cmake +51 -0
- data/ext/cmake/modules/FindRuby.cmake +17 -17
- data/ext/cmake/modules/MacroOptionalFindPackage.cmake +6 -26
- data/ext/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/cmake/modules/SmokeConfig.cmake.in +109 -0
- data/ext/generator/cmake/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/generator/cmake/CMakeLists.txt +24 -0
- data/ext/generator/cmake/FindLibraryWithDebug.cmake +113 -0
- data/ext/generator/cmake/FindPhonon.cmake +71 -0
- data/ext/generator/cmake/FindQImageBlitz.cmake +51 -0
- data/ext/generator/cmake/FindQScintilla.cmake +57 -0
- data/ext/generator/cmake/FindQwt5.cmake +104 -0
- data/ext/generator/cmake/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
- data/ext/generator/cmake/MacroLogFeature.cmake +146 -0
- data/ext/generator/cmake/MacroOptionalAddBindings.cmake +47 -0
- data/ext/generator/cmake/MacroOptionalFindPackage.cmake +28 -0
- data/ext/generator/cmake/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/generator/cmake/SmokeConfig.cmake.in +109 -0
- data/ext/generator/config.h +25 -0
- data/ext/generator/generatorpreprocessor.cpp +60 -41
- data/ext/generator/generators/dump/CMakeLists.txt +5 -0
- data/ext/generator/generators/smoke/CMakeLists.txt +5 -0
- data/ext/generator/generators/smoke/globals.h +3 -1
- data/ext/generator/generators/smoke/helpers.cpp +21 -2
- data/ext/generator/generators/smoke/writeSmokeDataFile.cpp +26 -1
- data/ext/generator/main.cpp +5 -1
- data/ext/generator/options.cpp +1 -0
- data/ext/generator/options.h +1 -0
- data/ext/generator/parser/CMakeLists.txt +10 -1
- data/ext/generator/parser/parser.cpp +6 -6
- data/ext/generator/parser/parser.h +2 -12
- data/ext/generator/parser/parsesession.cpp +1 -0
- data/ext/generator/parser/rpp/CMakeLists.txt +6 -0
- data/ext/generator/parser/rpp/chartools.cpp +3 -3
- data/ext/generator/parser/rpp/chartools.h +3 -1
- data/ext/generator/parser/rpp/pp-scanner.cpp +2 -1
- data/ext/generator/parser/rpp/tests/CMakeLists.txt +4 -0
- data/ext/generator/parser/tests/CMakeLists.txt +16 -0
- data/ext/generator/smoke.h +557 -0
- data/ext/generator/smokegen_string.h +43 -0
- data/ext/generator/type.cpp +15 -6
- data/ext/generator/type_compiler.cpp +2 -0
- data/ext/ruby/qtruby/src/qtruby.cpp +147 -143
- data/ext/ruby/qttest/qttesthandlers.cpp +1 -0
- data/ext/smoke/qtcore/QtGuess.txt +23 -25
- data/ext/smoke/qtcore/smokeconfig.xml +1 -0
- data/ext/smoke/qtdbus/smokeconfig.xml +2 -0
- data/ext/smoke/qtgui/smokeconfig.xml +14 -4
- data/ext/smoke/qthelp/smokeconfig.xml +1 -0
- data/ext/smoke/qtmultimedia/smokeconfig.xml +1 -0
- data/ext/smoke/qtnetwork/smokeconfig.xml +2 -0
- data/ext/smoke/qtopengl/smokeconfig.xml +1 -0
- data/ext/smoke/qtsql/smokeconfig.xml +1 -0
- data/ext/smoke/qtsvg/smokeconfig.xml +1 -0
- data/ext/smoke/qtwebkit/smokeconfig.xml +3 -0
- data/extconf.rb +37 -23
- data/lib/Qt/qtruby4.rb +4 -4
- data/lib/Qt4.rb +1 -1
- data/lib/qtbindings_version.rb +2 -2
- metadata +50 -40
@@ -0,0 +1,22 @@
|
|
1
|
+
# MACRO_WRITE_BASIC_CMAKE_VERSION_FILE( _filename _major _minor _patch)
|
2
|
+
# Writes a file for use as <package>ConfigVersion.cmake file to <_filename>.
|
3
|
+
# See the documentation of FIND_PACKAGE() for details on this.
|
4
|
+
# _filename is the output filename, it should be in the build tree.
|
5
|
+
# _major is the major version number of the project to be installed
|
6
|
+
# _minor is the minor version number of the project to be installed
|
7
|
+
# _patch is the patch version number of the project to be installed
|
8
|
+
#
|
9
|
+
|
10
|
+
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
|
11
|
+
#
|
12
|
+
# Redistribution and use is allowed according to the terms of the BSD license.
|
13
|
+
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
14
|
+
|
15
|
+
get_filename_component(_currentListFileDir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
16
|
+
|
17
|
+
function(MACRO_WRITE_BASIC_CMAKE_VERSION_FILE _filename _major _minor _patch)
|
18
|
+
set(PROJECT_VERSION_MAJOR ${_major})
|
19
|
+
set(PROJECT_VERSION_MINOR ${_minor})
|
20
|
+
set(PROJECT_VERSION_PATCH ${_patch})
|
21
|
+
configure_file(${_currentListFileDir}/BasicFindPackageVersion.cmake.in "${_filename}" @ONLY)
|
22
|
+
endfunction(MACRO_WRITE_BASIC_CMAKE_VERSION_FILE _major _minor _patch)
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Find smoke libraries.
|
2
|
+
#
|
3
|
+
# Use:
|
4
|
+
#
|
5
|
+
# find_package(Smoke [REQUIRED] COMPONENTS QtCore QtGui <other components>)
|
6
|
+
#
|
7
|
+
# Defines:
|
8
|
+
#
|
9
|
+
# SMOKE_INCLUDE_DIR Directory in which smoke.h is located
|
10
|
+
# SMOKE_CMAKE_MODULE_DIR Directory with additional cmake files used by kdebindings
|
11
|
+
# SMOKE_GEN_BIN The path of the smokegen executable
|
12
|
+
# SMOKE_GEN_SHARED Directory in which commonly used smokegen files reside
|
13
|
+
# SMOKE_API_BIN The path of the smokeapi executable
|
14
|
+
# SMOKE_GENERATOR_SMOKE_LIB Path of generator_smoke library
|
15
|
+
# SMOKE_GENERATOR_DUMP_LIB Path of generator_dump library
|
16
|
+
# SMOKE_<component>_INCLUDE_DIR Directory in which to find smoke/<component>_smoke.h
|
17
|
+
# SMOKE_<component>_LIBRARY Library for the smoke lib
|
18
|
+
#
|
19
|
+
# Copyright (c) 2010, Arno Rehn <arno@arnorehn.de>
|
20
|
+
# (c) 2010, Ian Monroe <ian@monroe.nu>
|
21
|
+
# Redistribution and use is allowed according to the terms of the BSD license.
|
22
|
+
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
23
|
+
|
24
|
+
#####################
|
25
|
+
# utility functions #
|
26
|
+
#####################
|
27
|
+
|
28
|
+
function (_print type message)
|
29
|
+
if (NOT Smoke_FIND_QUIETLY)
|
30
|
+
message (${type} "${message}")
|
31
|
+
endif (NOT Smoke_FIND_QUIETLY)
|
32
|
+
endfunction (_print type message)
|
33
|
+
|
34
|
+
|
35
|
+
##############################
|
36
|
+
# find individual smoke libs #
|
37
|
+
##############################Smoke_FIND_REQUIRED
|
38
|
+
|
39
|
+
macro (find_smoke_component name)
|
40
|
+
string(TOUPPER ${name} uppercase)
|
41
|
+
string(TOLOWER ${name} lowercase)
|
42
|
+
|
43
|
+
if (NOT SMOKE_${uppercase}_FOUND)
|
44
|
+
set (SMOKE_${uppercase}_FOUND FALSE CACHE INTERNAL "")
|
45
|
+
|
46
|
+
find_path(SMOKE_${uppercase}_INCLUDE_DIR
|
47
|
+
${lowercase}_smoke.h
|
48
|
+
PATH ${SMOKE_INCLUDE_DIR}
|
49
|
+
NO_DEFAULT_PATH
|
50
|
+
)
|
51
|
+
if(WIN32)
|
52
|
+
# DLLs are in the bin directory.
|
53
|
+
find_library(SMOKE_${uppercase}_LIBRARY
|
54
|
+
smoke${lowercase}
|
55
|
+
PATHS "@CMAKE_INSTALL_PREFIX@/bin"
|
56
|
+
NO_DEFAULT_PATH)
|
57
|
+
else(WIN32)
|
58
|
+
find_library(SMOKE_${uppercase}_LIBRARY
|
59
|
+
smoke${lowercase}
|
60
|
+
PATHS "@SMOKE_LIBRARY_PREFIX@"
|
61
|
+
NO_DEFAULT_PATH)
|
62
|
+
endif(WIN32)
|
63
|
+
|
64
|
+
if (NOT SMOKE_${uppercase}_INCLUDE_DIR OR NOT SMOKE_${uppercase}_LIBRARY)
|
65
|
+
if (Smoke_FIND_REQUIRED)
|
66
|
+
_print(FATAL_ERROR "Could not find Smoke${name}")
|
67
|
+
else (Smoke_FIND_REQUIRED)
|
68
|
+
_print(STATUS "Could not find Smoke${name}")
|
69
|
+
endif (Smoke_FIND_REQUIRED)
|
70
|
+
else (NOT SMOKE_${uppercase}_INCLUDE_DIR OR NOT SMOKE_${uppercase}_LIBRARY)
|
71
|
+
set (SMOKE_${uppercase}_FOUND TRUE CACHE INTERNAL "")
|
72
|
+
_print(STATUS "Found Smoke${name}: ${SMOKE_${uppercase}_LIBRARY}")
|
73
|
+
endif (NOT SMOKE_${uppercase}_INCLUDE_DIR OR NOT SMOKE_${uppercase}_LIBRARY)
|
74
|
+
|
75
|
+
mark_as_advanced(SMOKE_${uppercase}_INCLUDE_DIR SMOKE_${uppercase}_LIBRARY SMOKE_${uppercase}_FOUND)
|
76
|
+
endif (NOT SMOKE_${uppercase}_FOUND)
|
77
|
+
endmacro (find_smoke_component)
|
78
|
+
|
79
|
+
################
|
80
|
+
# find smoke.h #
|
81
|
+
################
|
82
|
+
set(SMOKE_INCLUDE_DIR "@SMOKE_INCLUDE_DIR@")
|
83
|
+
set(SMOKE_CMAKE_MODULE_DIR "@SMOKE_CMAKE_MODULE_DIR@")
|
84
|
+
set(SMOKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
|
85
|
+
set(SMOKE_GENERATOR_SMOKE_LIB "@SMOKE_GENERATOR_SMOKE_LIB@")
|
86
|
+
set(SMOKE_GENERATOR_DUMP_LIB "@SMOKE_GENERATOR_DUMP_LIB@")
|
87
|
+
set(SMOKE_GEN_BIN "@SMOKE_GEN_BIN@")
|
88
|
+
set(SMOKE_GEN_SHARED "@SMOKE_GEN_SHARED@")
|
89
|
+
set(SMOKE_API_BIN "@SMOKE_API_BIN@")
|
90
|
+
|
91
|
+
find_library(SMOKE_BASE_LIBRARY smokebase
|
92
|
+
PATHS "@SMOKE_LIBRARY_PREFIX@"
|
93
|
+
NO_DEFAULT_PATH)
|
94
|
+
|
95
|
+
if (NOT SMOKE_BASE_LIBRARY)
|
96
|
+
if (Smoke_FIND_REQUIRED)
|
97
|
+
_print(FATAL_ERROR "Could not find SMOKE")
|
98
|
+
else (Smoke_FIND_REQUIRED)
|
99
|
+
_print(STATUS "Could not find SMOKE")
|
100
|
+
endif (Smoke_FIND_REQUIRED)
|
101
|
+
endif (NOT SMOKE_BASE_LIBRARY)
|
102
|
+
|
103
|
+
mark_as_advanced(SMOKE_INCLUDE_DIR SMOKE_BASE_LIBRARY)
|
104
|
+
|
105
|
+
if (Smoke_FIND_COMPONENTS)
|
106
|
+
foreach (component ${Smoke_FIND_COMPONENTS})
|
107
|
+
find_smoke_component(${component})
|
108
|
+
endforeach(component)
|
109
|
+
endif (Smoke_FIND_COMPONENTS)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#ifndef SMOKEGEN_CONFIG_H_7990E7PK
|
2
|
+
#define SMOKEGEN_CONFIG_H_7990E7PK
|
3
|
+
/*
|
4
|
+
Copyright (C) 2011 Michael Jansen <kde@michael-jansen.biz>
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation; either version 2 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License along
|
17
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
*/
|
20
|
+
|
21
|
+
|
22
|
+
// The library suffix used when compiling smoke
|
23
|
+
#define LIB_SUFFIX "@LIB_SUFFIX@"
|
24
|
+
|
25
|
+
#endif // #define SMOKEGEN_CONFIG_H_7990E7PK
|
@@ -22,6 +22,8 @@
|
|
22
22
|
#include <rpp/pp-environment.h>
|
23
23
|
#include <rpp/pp-macro.h>
|
24
24
|
|
25
|
+
#include <QCoreApplication>
|
26
|
+
|
25
27
|
#include <QtDebug>
|
26
28
|
|
27
29
|
QList<QString> parsedHeaders;
|
@@ -100,6 +102,32 @@ Preprocessor::Preprocessor(const QList<QDir>& includeDirs, const QStringList& de
|
|
100
102
|
exportMacro->variadics = false;
|
101
103
|
m_topBlock->setMacro(exportMacro);
|
102
104
|
|
105
|
+
// the following macros are gcc specialties
|
106
|
+
exportMacro = new rpp::pp_macro;
|
107
|
+
exportMacro->name = IndexedString("__extension__");
|
108
|
+
exportMacro->function_like = false;
|
109
|
+
exportMacro->variadics = false;
|
110
|
+
m_topBlock->setMacro(exportMacro);
|
111
|
+
|
112
|
+
exportMacro = new rpp::pp_macro;
|
113
|
+
exportMacro->name = IndexedString("__restrict");
|
114
|
+
exportMacro->function_like = false;
|
115
|
+
exportMacro->variadics = false;
|
116
|
+
m_topBlock->setMacro(exportMacro);
|
117
|
+
|
118
|
+
exportMacro = new rpp::pp_macro;
|
119
|
+
exportMacro->name = IndexedString("__const");
|
120
|
+
exportMacro->definition.append(IndexedString("const"));
|
121
|
+
exportMacro->function_like = false;
|
122
|
+
exportMacro->variadics = false;
|
123
|
+
m_topBlock->setMacro(exportMacro);
|
124
|
+
|
125
|
+
exportMacro = new rpp::pp_macro;
|
126
|
+
exportMacro->name = IndexedString("__attribute__");
|
127
|
+
exportMacro->function_like = true;
|
128
|
+
exportMacro->variadics = false;
|
129
|
+
m_topBlock->setMacro(exportMacro);
|
130
|
+
|
103
131
|
exportMacro = new rpp::pp_macro;
|
104
132
|
exportMacro->name = IndexedString("__SMOKEGEN_RUN__");
|
105
133
|
exportMacro->definition.append(IndexedString('1'));
|
@@ -175,9 +203,13 @@ PreprocessedContents Preprocessor::preprocess()
|
|
175
203
|
|
176
204
|
rpp::Stream* Preprocessor::sourceNeeded(QString& fileName, rpp::Preprocessor::IncludeType type, int sourceLine, bool skipCurrentPath)
|
177
205
|
{
|
206
|
+
#ifdef Q_WS_MAC
|
207
|
+
static QRegExp frameworkExpr("([^/]+)/(.*)");
|
208
|
+
#endif
|
209
|
+
|
178
210
|
if (m_fileStack.top().fileName() == fileName && type == rpp::Preprocessor::IncludeGlobal) {
|
179
211
|
#ifdef DEBUG
|
180
|
-
qDebug("prevented possible endless loop because of #include<%s>", qPrintable(fileName));
|
212
|
+
qDebug("prevented possible endless loop because of #include <%s>", qPrintable(fileName));
|
181
213
|
#endif
|
182
214
|
return 0;
|
183
215
|
}
|
@@ -191,8 +223,12 @@ rpp::Stream* Preprocessor::sourceNeeded(QString& fileName, rpp::Preprocessor::In
|
|
191
223
|
|
192
224
|
QString path;
|
193
225
|
QFileInfo info(fileName);
|
194
|
-
|
195
|
-
|
226
|
+
|
227
|
+
// smokegen chokes on gcc's string.h, so use our simplified version here
|
228
|
+
if (type == rpp::Preprocessor::IncludeGlobal && fileName == "string.h") {
|
229
|
+
static QString customStringHPath = qApp->applicationDirPath() + "/../share/smokegen/string.h";
|
230
|
+
path = customStringHPath;
|
231
|
+
} else if (info.isAbsolute()) {
|
196
232
|
path = fileName;
|
197
233
|
} else if (type == rpp::Preprocessor::IncludeLocal) {
|
198
234
|
info.setFile(m_fileStack.last().dir(), fileName);
|
@@ -200,57 +236,40 @@ rpp::Stream* Preprocessor::sourceNeeded(QString& fileName, rpp::Preprocessor::In
|
|
200
236
|
path = info.absoluteFilePath();
|
201
237
|
}
|
202
238
|
if (path.isEmpty()) {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
239
|
+
#ifdef Q_WS_MAC
|
240
|
+
QString framework;
|
241
|
+
QString header;
|
242
|
+
if (frameworkExpr.exactMatch(fileName)) {
|
243
|
+
framework = frameworkExpr.cap(1);
|
244
|
+
header = frameworkExpr.cap(2);
|
245
|
+
}
|
209
246
|
#endif
|
210
|
-
|
247
|
+
|
248
|
+
Q_FOREACH (const QDir& dir, m_includeDirs) {
|
211
249
|
info.setFile(dir, fileName);
|
212
250
|
if (info.isFile()) {
|
213
251
|
path = info.absoluteFilePath();
|
214
|
-
// qWarning("Found #include<%s>", qPrintable(fileName));
|
215
252
|
break;
|
216
253
|
}
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
QStringList splitString = fileName.split("/");
|
224
|
-
if (splitString.size() >= 2) {
|
225
|
-
QString frameworkName = splitString.takeFirst();
|
226
|
-
QString remainingFileName = splitString.join("/");
|
227
|
-
QDir dir1 = QDir(("/System/Library/Frameworks/" + frameworkName) + ".framework/Headers");
|
228
|
-
QDir dir2 = QDir(("/Library/Frameworks/" + frameworkName) + ".framework/Headers");
|
229
|
-
info.setFile(dir1, remainingFileName);
|
230
|
-
if (info.isFile()) {
|
231
|
-
path = info.absoluteFilePath();
|
232
|
-
// qWarning("Found #include<%s>", qPrintable(fileName));
|
233
|
-
}
|
234
|
-
else {
|
235
|
-
info.setFile(dir2, remainingFileName);
|
254
|
+
|
255
|
+
#ifdef Q_WS_MAC
|
256
|
+
QDir parentDir = dir;
|
257
|
+
parentDir.cdUp();
|
258
|
+
if (parentDir.dirName() == framework + ".framework" && dir.dirName() == "Headers") {
|
259
|
+
info.setFile(dir, header);
|
236
260
|
if (info.isFile()) {
|
237
261
|
path = info.absoluteFilePath();
|
238
|
-
|
262
|
+
break;
|
239
263
|
}
|
240
264
|
}
|
265
|
+
#endif
|
241
266
|
}
|
242
267
|
}
|
268
|
+
|
269
|
+
if (path.isEmpty()) {
|
270
|
+
#ifdef DEBUG
|
271
|
+
qDebug("PP: File not found: %s", qPrintable(fileName));
|
243
272
|
#endif
|
244
|
-
|
245
|
-
if (fileName == "stdio.h")
|
246
|
-
{
|
247
|
-
qWarning("Not parsing stdio.h because it is not handled correctly by smokegen on FreeBSD based systems");
|
248
|
-
return 0;
|
249
|
-
}
|
250
|
-
|
251
|
-
if (path.isEmpty())
|
252
|
-
{
|
253
|
-
qWarning("Couldn't find file for #include<%s>", qPrintable(fileName));
|
254
273
|
return 0;
|
255
274
|
}
|
256
275
|
|
@@ -7,4 +7,9 @@ add_library(generator_dump MODULE ${generator_dump_SRC})
|
|
7
7
|
target_link_libraries(generator_dump ${QT_QTCORE_LIBRARY} smokegen)
|
8
8
|
set_target_properties(generator_dump PROPERTIES PREFIX "")
|
9
9
|
|
10
|
+
if (WIN32)
|
11
|
+
# Realign the stack, for compatibility with an older ABI.
|
12
|
+
set_target_properties (generator_dump PROPERTIES COMPILE_FLAGS -mstackrealign)
|
13
|
+
endif (WIN32)
|
14
|
+
|
10
15
|
install(TARGETS generator_dump LIBRARY DESTINATION ${LIB_INSTALL_DIR}/smokegen)
|
@@ -10,4 +10,9 @@ add_library(generator_smoke MODULE ${generator_smoke_SRC})
|
|
10
10
|
target_link_libraries(generator_smoke ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} smokegen)
|
11
11
|
set_target_properties(generator_smoke PROPERTIES PREFIX "")
|
12
12
|
|
13
|
+
if (WIN32)
|
14
|
+
# Realign the stack, for compatibility with an older ABI.
|
15
|
+
set_target_properties (generator_smoke PROPERTIES COMPILE_FLAGS -mstackrealign)
|
16
|
+
endif (WIN32)
|
17
|
+
|
13
18
|
install(TARGETS generator_smoke LIBRARY DESTINATION ${LIB_INSTALL_DIR}/smokegen/)
|
@@ -127,7 +127,9 @@ struct Util
|
|
127
127
|
|
128
128
|
static QChar munge(const Type *type);
|
129
129
|
static QString mungedName(const Method&);
|
130
|
-
|
130
|
+
|
131
|
+
static Type* normalizeType(const Type* type);
|
132
|
+
|
131
133
|
static QString stackItemField(const Type* type);
|
132
134
|
static QString assignmentString(const Type* type, const QString& var);
|
133
135
|
static QList<const Method*> collectVirtualMethods(const Class* klass);
|
@@ -191,8 +191,13 @@ void Util::preparse(QSet<Type*> *usedTypes, QSet<const Class*> *superClasses, co
|
|
191
191
|
}
|
192
192
|
addOverloads(m);
|
193
193
|
(*usedTypes) << m.type();
|
194
|
-
foreach (const Parameter& param, m.parameters())
|
194
|
+
foreach (const Parameter& param, m.parameters()) {
|
195
195
|
(*usedTypes) << param.type();
|
196
|
+
|
197
|
+
if (m.isSlot() || m.isSignal() || m.isQPropertyAccessor()) {
|
198
|
+
(*usedTypes) << Util::normalizeType(param.type());
|
199
|
+
}
|
200
|
+
}
|
196
201
|
}
|
197
202
|
foreach (const Field& f, klass.fields()) {
|
198
203
|
if (f.access() == Access_private)
|
@@ -490,6 +495,20 @@ QString Util::mungedName(const Method& meth) {
|
|
490
495
|
return ret;
|
491
496
|
}
|
492
497
|
|
498
|
+
Type* Util::normalizeType(const Type* type) {
|
499
|
+
Type normalizedType = *type;
|
500
|
+
if (normalizedType.isConst() && normalizedType.isRef()) {
|
501
|
+
normalizedType.setIsConst(false);
|
502
|
+
normalizedType.setIsRef(false);
|
503
|
+
}
|
504
|
+
|
505
|
+
if (normalizedType.pointerDepth() == 0) {
|
506
|
+
normalizedType.setIsConst(false);
|
507
|
+
}
|
508
|
+
|
509
|
+
return Type::registerType(normalizedType);
|
510
|
+
}
|
511
|
+
|
493
512
|
QString Util::stackItemField(const Type* type)
|
494
513
|
{
|
495
514
|
if (type->getTypedef()) {
|
@@ -590,7 +609,7 @@ void Util::addAccessorMethods(const Field& field, QSet<Type*> *usedTypes)
|
|
590
609
|
{
|
591
610
|
Class* klass = field.getClass();
|
592
611
|
Type* type = field.type();
|
593
|
-
if (type->getClass() && type->pointerDepth() == 0) {
|
612
|
+
if (type->getClass() && type->pointerDepth() == 0 && !(ParserOptions::qtMode && type->getClass()->name() == "QFlags")) {
|
594
613
|
Type newType = *type;
|
595
614
|
newType.setIsRef(true);
|
596
615
|
type = Type::registerType(newType);
|
@@ -59,6 +59,9 @@ SmokeDataFile::SmokeDataFile()
|
|
59
59
|
usedTypes << meth->type();
|
60
60
|
foreach (const Parameter& param, meth->parameters()) {
|
61
61
|
usedTypes << param.type();
|
62
|
+
if (meth->isSlot() || meth->isSignal() || meth->isQPropertyAccessor()) {
|
63
|
+
usedTypes << Util::normalizeType(param.type());
|
64
|
+
}
|
62
65
|
}
|
63
66
|
declaredVirtualMethods[meth->getClass()] << meth;
|
64
67
|
}
|
@@ -173,6 +176,9 @@ void SmokeDataFile::write()
|
|
173
176
|
QFile smokedata(Options::outputDir.filePath("smokedata.cpp"));
|
174
177
|
smokedata.open(QFile::ReadWrite | QFile::Truncate);
|
175
178
|
QTextStream out(&smokedata);
|
179
|
+
QFile argNames(Options::outputDir.filePath(QString("%1.argnames.txt").arg(Options::module)));
|
180
|
+
argNames.open(QFile::ReadWrite | QFile::Truncate);
|
181
|
+
QTextStream outArgNames(&argNames);
|
176
182
|
foreach (const QFileInfo& file, Options::headerList)
|
177
183
|
out << "#include <" << file.fileName() << ">\n";
|
178
184
|
out << "\n#include <smoke.h>\n";
|
@@ -419,14 +425,32 @@ void SmokeDataFile::write()
|
|
419
425
|
}
|
420
426
|
QVector<int> indices(meth.parameters().count());
|
421
427
|
QStringList comment;
|
428
|
+
if (meth.parameters().size() > 0) {
|
429
|
+
outArgNames << klass->name() << "," << meth.name();
|
430
|
+
}
|
422
431
|
for (int i = 0; i < indices.size(); i++) {
|
423
432
|
Type* t = meth.parameters()[i].type();
|
424
433
|
if (!typeIndex.contains(t)) {
|
425
434
|
qFatal("missing type: %s in method %s (while building munged names map)", qPrintable(t->toString()), qPrintable(meth.toString(false, true)));
|
426
435
|
}
|
427
|
-
|
436
|
+
outArgNames << ",";
|
437
|
+
outArgNames << (indices[i] = typeIndex[t]);
|
428
438
|
comment << t->toString();
|
429
439
|
}
|
440
|
+
if (meth.parameters().size() > 0) {
|
441
|
+
outArgNames << ";";
|
442
|
+
for (int i = 0; i < meth.parameters().size(); i++) {
|
443
|
+
QString paramName = meth.parameters()[i].name();
|
444
|
+
if (paramName == "") {
|
445
|
+
paramName = "arg" + QString::number(i + 1);
|
446
|
+
}
|
447
|
+
outArgNames << paramName;
|
448
|
+
if (i < meth.parameters().size() - 1) {
|
449
|
+
outArgNames << ",";
|
450
|
+
}
|
451
|
+
}
|
452
|
+
outArgNames << "\n";
|
453
|
+
}
|
430
454
|
int idx = 0;
|
431
455
|
if ((idx = parameterList.value(indices, -1)) == -1) {
|
432
456
|
idx = currentIdx;
|
@@ -726,4 +750,5 @@ void SmokeDataFile::write()
|
|
726
750
|
out << "}\n";
|
727
751
|
|
728
752
|
smokedata.close();
|
753
|
+
argNames.close();
|
729
754
|
}
|