summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit38be0d13830efd2d98281c645c3a60afe05ffece (patch)
tree6ea73f3ec77f7d153333779883e8120f82820abe /tools
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/configure.pro132
-rw-r--r--tools/configure/configure_pch.h74
-rw-r--r--tools/configure/configureapp.cpp4200
-rw-r--r--tools/configure/configureapp.h187
-rw-r--r--tools/configure/environment.cpp516
-rw-r--r--tools/configure/environment.h82
-rw-r--r--tools/configure/main.cpp114
-rw-r--r--tools/configure/tools.cpp249
-rw-r--r--tools/configure/tools.h58
-rw-r--r--tools/shared/symbian/epocroot.cpp227
-rw-r--r--tools/shared/symbian/epocroot.pri11
-rw-r--r--tools/shared/symbian/epocroot_p.h83
-rw-r--r--tools/shared/windows/registry.cpp169
-rw-r--r--tools/shared/windows/registry_p.h80
-rw-r--r--tools/uilib/abstractformbuilder.cpp3209
-rw-r--r--tools/uilib/abstractformbuilder.h290
-rw-r--r--tools/uilib/container.h75
-rw-r--r--tools/uilib/container.qdoc172
-rw-r--r--tools/uilib/customwidget.h101
-rw-r--r--tools/uilib/customwidget.qdoc295
-rw-r--r--tools/uilib/formbuilder.cpp570
-rw-r--r--tools/uilib/formbuilder.h115
-rw-r--r--tools/uilib/formbuilderextra.cpp555
-rw-r--r--tools/uilib/formbuilderextra_p.h262
-rw-r--r--tools/uilib/formscriptrunner.cpp208
-rw-r--r--tools/uilib/formscriptrunner_p.h120
-rw-r--r--tools/uilib/properties.cpp681
-rw-r--r--tools/uilib/properties_p.h176
-rw-r--r--tools/uilib/qdesignerexportwidget.h66
-rw-r--r--tools/uilib/resourcebuilder.cpp180
-rw-r--r--tools/uilib/resourcebuilder_p.h104
-rw-r--r--tools/uilib/textbuilder.cpp84
-rw-r--r--tools/uilib/textbuilder_p.h93
-rw-r--r--tools/uilib/ui4.cpp11154
-rw-r--r--tools/uilib/ui4_p.h3807
-rw-r--r--tools/uilib/uilib.pri32
-rw-r--r--tools/uilib/uilib_global.h64
-rw-r--r--tools/uilib/widgets.table148
38 files changed, 28743 insertions, 0 deletions
diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro
new file mode 100644
index 0000000000..124564667c
--- /dev/null
+++ b/tools/configure/configure.pro
@@ -0,0 +1,132 @@
+TARGET = configure
+DESTDIR = $$PWD/../.. # build directly in source dir
+
+CONFIG += console flat
+CONFIG -= moc qt
+DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE
+DEFINES += QT_BOOTSTRAPPED
+
+win32 : LIBS += -lole32 -ladvapi32
+win32-msvc.net | win32-msvc2* : QMAKE_CXXFLAGS += /EHsc
+win32-g++* : LIBS += -luuid
+
+win32-msvc* {
+ QMAKE_CFLAGS_RELEASE -= -MD
+ QMAKE_CFLAGS_RELEASE += -MT
+ QMAKE_CFLAGS_DEBUG -= -MDd
+ QMAKE_CFLAGS_DEBUG += -MTd
+ QMAKE_CXXFLAGS_RELEASE -= -MD
+ QMAKE_CXXFLAGS_RELEASE += -MT
+ QMAKE_CXXFLAGS_DEBUG -= -MDd
+ QMAKE_CXXFLAGS_DEBUG += -MTd
+}
+
+PRECOMPILED_HEADER = configure_pch.h
+
+INCLUDEPATH += \
+ $$QT_SOURCE_TREE/src/corelib/arch/generic \
+ $$QT_SOURCE_TREE/src/corelib/global \
+ $$QT_BUILD_TREE/include \
+ $$QT_BUILD_TREE/include/QtCore \
+ $$QT_SOURCE_TREE/tools/shared
+
+HEADERS = configureapp.h environment.h tools.h\
+ $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qbytearraymatcher.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qchar.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qhash.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qlist.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qlocale.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qvector.h \
+ $$QT_SOURCE_TREE/src/corelib/codecs/qutfcodec_p.h \
+ $$QT_SOURCE_TREE/src/corelib/codecs/qtextcodec.h \
+ $$QT_SOURCE_TREE/src/corelib/global/qglobal.h \
+ $$QT_SOURCE_TREE/src/corelib/global/qnumeric.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qbuffer.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qdatastream.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qdir.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qdiriterator.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfile.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfileinfo.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystementry_p.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystemengine_p.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystemmetadata_p.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystemiterator_p.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_iterator_p.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qiodevice.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qtextstream.h \
+ $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qdatetime.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qmap.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qregexp.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstring.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstringlist.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstringmatcher.h \
+ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h \
+ $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror_p.h \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h \
+ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h
+
+
+SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qbytearraymatcher.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qchar.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qhash.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qlist.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qlocale.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qvector.cpp \
+ $$QT_SOURCE_TREE/src/corelib/codecs/qutfcodec.cpp \
+ $$QT_SOURCE_TREE/src/corelib/codecs/qtextcodec.cpp \
+ $$QT_SOURCE_TREE/src/corelib/global/qglobal.cpp \
+ $$QT_SOURCE_TREE/src/corelib/global/qnumeric.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qbuffer.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qdatastream.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qdir.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qdiriterator.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfile.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfileinfo.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qabstractfileengine.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystementry.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystemengine.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystemengine_win.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfilesystemiterator_win.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_win.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_iterator.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qiodevice.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qtextstream.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.cpp \
+ $$QT_SOURCE_TREE/src/corelib/plugin/qsystemlibrary.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qdatetime.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qmap.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qregexp.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstring.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstringlist.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qstringmatcher.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qvsnprintf.cpp \
+ $$QT_SOURCE_TREE/src/corelib/kernel/qvariant.cpp \
+ $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror.cpp \
+ $$QT_SOURCE_TREE/src/corelib/io/qurl.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qline.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qsize.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qpoint.cpp \
+ $$QT_SOURCE_TREE/src/corelib/tools/qrect.cpp \
+ $$QT_SOURCE_TREE/src/corelib/kernel/qmetatype.cpp \
+ $$QT_SOURCE_TREE/src/corelib/global/qmalloc.cpp \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.cpp \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils.cpp \
+ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp
+
+DEFINES += COMMERCIAL_VERSION
+
+INCLUDEPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \
+ $$QT_SOURCE_TREE/include/QtCore \
+ $$QT_SOURCE_TREE/tools/shared
diff --git a/tools/configure/configure_pch.h b/tools/configure/configure_pch.h
new file mode 100644
index 0000000000..3fe15f5952
--- /dev/null
+++ b/tools/configure/configure_pch.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if (defined(_WIN32) || defined(__NT__))
+# define QT_UNDEF_MACROS_IN_PCH
+# define _WINSCARD_H_
+# define _POSIX_ /* Make sure PATH_MAX et al. are defined */
+# include <limits.h>
+# undef _POSIX_ /* Don't polute */
+
+ /* Make sure IP v6 is defined first of all, before windows.h */
+# ifndef QT_NO_IPV6
+# include <winsock2.h>
+# endif
+# include <stdlib.h>
+#endif
+
+#if defined __cplusplus
+#include <qglobal.h>
+#include <qlist.h>
+#include <qvariant.h> // All moc genereated code has this include
+#include <qplatformdefs.h>
+#include <qregexp.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qtextcodec.h>
+
+#include <limits.h>
+#include <stdlib.h>
+#endif
+
+#if defined(QT_UNDEF_MACROS_IN_PCH)
+# undef max /* These are defined in windef.h, but */
+# undef min /* we don't want them when building Qt */
+# undef _WINSCARD_H_
+#endif
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
new file mode 100644
index 0000000000..494ea52ec5
--- /dev/null
+++ b/tools/configure/configureapp.cpp
@@ -0,0 +1,4200 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "configureapp.h"
+#include "environment.h"
+#ifdef COMMERCIAL_VERSION
+# include "tools.h"
+#endif
+
+#include <QDate>
+#include <qdir.h>
+#include <qtemporaryfile.h>
+#include <qstack.h>
+#include <qdebug.h>
+#include <qfileinfo.h>
+#include <qtextstream.h>
+#include <qregexp.h>
+#include <qhash.h>
+
+#include <iostream>
+#include <windows.h>
+#include <conio.h>
+
+QT_BEGIN_NAMESPACE
+
+std::ostream &operator<<(std::ostream &s, const QString &val) {
+ s << val.toLocal8Bit().data();
+ return s;
+}
+
+
+using namespace std;
+
+// Macros to simplify options marking
+#define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " )
+
+
+bool writeToFile(const char* text, const QString &filename)
+{
+ QByteArray symFile(text);
+ QFile file(filename);
+ QDir dir(QFileInfo(file).absoluteDir());
+ if (!dir.exists())
+ dir.mkpath(dir.absolutePath());
+ if (!file.open(QFile::WriteOnly)) {
+ cout << "Couldn't write to " << qPrintable(filename) << ": " << qPrintable(file.errorString())
+ << endl;
+ return false;
+ }
+ file.write(symFile);
+ return true;
+}
+
+Configure::Configure(int& argc, char** argv)
+{
+ useUnixSeparators = false;
+ // Default values for indentation
+ optionIndent = 4;
+ descIndent = 25;
+ outputWidth = 0;
+ // Get console buffer output width
+ CONSOLE_SCREEN_BUFFER_INFO info;
+ HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (GetConsoleScreenBufferInfo(hStdout, &info))
+ outputWidth = info.dwSize.X - 1;
+ outputWidth = qMin(outputWidth, 79); // Anything wider gets unreadable
+ if (outputWidth < 35) // Insanely small, just use 79
+ outputWidth = 79;
+ int i;
+
+ /*
+ ** Set up the initial state, the default
+ */
+ dictionary[ "CONFIGCMD" ] = argv[ 0 ];
+
+ for (i = 1; i < argc; i++)
+ configCmdLine += argv[ i ];
+
+
+ // Get the path to the executable
+ wchar_t module_name[MAX_PATH];
+ GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t));
+ QFileInfo sourcePathInfo = QString::fromWCharArray(module_name);
+ sourcePath = sourcePathInfo.absolutePath();
+ sourceDir = sourcePathInfo.dir();
+ buildPath = QDir::currentPath();
+#if 0
+ const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR);
+#else
+ const QString installPath = buildPath;
+#endif
+ if (sourceDir != buildDir) { //shadow builds!
+ if (!findFile("perl") && !findFile("perl.exe")) {
+ cout << "Error: Creating a shadow build of Qt requires" << endl
+ << "perl to be in the PATH environment";
+ exit(0); // Exit cleanly for Ctrl+C
+ }
+
+ cout << "Preparing build tree..." << endl;
+ QDir(buildPath).mkpath("bin");
+
+ { //duplicate qmake
+ QStack<QString> qmake_dirs;
+ qmake_dirs.push("qmake");
+ while (!qmake_dirs.isEmpty()) {
+ QString dir = qmake_dirs.pop();
+ QString od(buildPath + "/" + dir);
+ QString id(sourcePath + "/" + dir);
+ QFileInfoList entries = QDir(id).entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries);
+ for (int i = 0; i < entries.size(); ++i) {
+ QFileInfo fi(entries.at(i));
+ if (fi.isDir()) {
+ qmake_dirs.push(dir + "/" + fi.fileName());
+ QDir().mkpath(od + "/" + fi.fileName());
+ } else {
+ QDir().mkpath(od);
+ bool justCopy = true;
+ const QString fname = fi.fileName();
+ const QString outFile(od + "/" + fname), inFile(id + "/" + fname);
+ if (fi.fileName() == "Makefile") { //ignore
+ } else if (fi.suffix() == "h" || fi.suffix() == "cpp") {
+ QTemporaryFile tmpFile;
+ if (tmpFile.open()) {
+ QTextStream stream(&tmpFile);
+ stream << "#include \"" << inFile << "\"" << endl;
+ justCopy = false;
+ stream.flush();
+ tmpFile.flush();
+ if (filesDiffer(tmpFile.fileName(), outFile)) {
+ QFile::remove(outFile);
+ tmpFile.copy(outFile);
+ }
+ }
+ }
+ if (justCopy && filesDiffer(inFile, outFile))
+ QFile::copy(inFile, outFile);
+ }
+ }
+ }
+ }
+
+ { //make a syncqt script(s) that can be used in the shadow
+ QFile syncqt(buildPath + "/bin/syncqt");
+ if (syncqt.open(QFile::WriteOnly)) {
+ QTextStream stream(&syncqt);
+ stream << "#!/usr/bin/perl -w" << endl
+ << "require \"" << sourcePath + "/bin/syncqt\";" << endl;
+ }
+ QFile syncqt_bat(buildPath + "/bin/syncqt.bat");
+ if (syncqt_bat.open(QFile::WriteOnly)) {
+ QTextStream stream(&syncqt_bat);
+ stream << "@echo off" << endl
+ << "set QTDIR=" << QDir::toNativeSeparators(sourcePath) << endl
+ << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/syncqt.bat -outdir \"") << fixSeparators(buildPath) << "\"" << endl
+ << "set QTDIR=" << QDir::toNativeSeparators(buildPath) << endl;
+ syncqt_bat.close();
+ }
+ }
+
+ // make patch_capabilities and createpackage scripts for Symbian that can be used from the shadow build
+ QFile patch_capabilities(buildPath + "/bin/patch_capabilities");
+ if (patch_capabilities.open(QFile::WriteOnly)) {
+ QTextStream stream(&patch_capabilities);
+ stream << "#!/usr/bin/perl -w" << endl
+ << "require \"" << sourcePath + "/bin/patch_capabilities\";" << endl;
+ }
+ QFile patch_capabilities_bat(buildPath + "/bin/patch_capabilities.bat");
+ if (patch_capabilities_bat.open(QFile::WriteOnly)) {
+ QTextStream stream(&patch_capabilities_bat);
+ stream << "@echo off" << endl
+ << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/patch_capabilities.bat %*") << endl;
+ patch_capabilities_bat.close();
+ }
+ QFile createpackage(buildPath + "/bin/createpackage");
+ if (createpackage.open(QFile::WriteOnly)) {
+ QTextStream stream(&createpackage);
+ stream << "#!/usr/bin/perl -w" << endl
+ << "require \"" << sourcePath + "/bin/createpackage\";" << endl;
+ }
+ QFile createpackage_bat(buildPath + "/bin/createpackage.bat");
+ if (createpackage_bat.open(QFile::WriteOnly)) {
+ QTextStream stream(&createpackage_bat);
+ stream << "@echo off" << endl
+ << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/createpackage.bat %*") << endl;
+ createpackage_bat.close();
+ }
+
+ // For Windows CE and shadow builds we need to copy these to the
+ // build directory.
+ QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat");
+ //copy the mkspecs
+ buildDir.mkpath("mkspecs");
+ if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
+ cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl;
+ dictionary["DONE"] = "error";
+ return;
+ }
+ }
+
+ dictionary[ "QT_SOURCE_TREE" ] = fixSeparators(sourcePath);
+ dictionary[ "QT_BUILD_TREE" ] = fixSeparators(buildPath);
+ dictionary[ "QT_INSTALL_PREFIX" ] = fixSeparators(installPath);
+
+ dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC");
+ if (dictionary[ "QMAKESPEC" ].size() == 0) {
+ dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
+ dictionary[ "QMAKESPEC_FROM" ] = "detected";
+ } else {
+ dictionary[ "QMAKESPEC_FROM" ] = "env";
+ }
+
+ dictionary[ "ARCHITECTURE" ] = "windows";
+ dictionary[ "QCONFIG" ] = "full";
+ dictionary[ "EMBEDDED" ] = "no";
+ dictionary[ "BUILD_QMAKE" ] = "yes";
+ dictionary[ "DSPFILES" ] = "yes";
+ dictionary[ "VCPROJFILES" ] = "yes";
+ dictionary[ "QMAKE_INTERNAL" ] = "no";
+ dictionary[ "FAST" ] = "no";
+ dictionary[ "NOPROCESS" ] = "no";
+ dictionary[ "STL" ] = "yes";
+ dictionary[ "EXCEPTIONS" ] = "yes";
+ dictionary[ "RTTI" ] = "yes";
+ dictionary[ "MMX" ] = "auto";
+ dictionary[ "3DNOW" ] = "auto";
+ dictionary[ "SSE" ] = "auto";
+ dictionary[ "SSE2" ] = "auto";
+ dictionary[ "IWMMXT" ] = "auto";
+ dictionary[ "SYNCQT" ] = "auto";
+ dictionary[ "CE_CRT" ] = "no";
+ dictionary[ "CETEST" ] = "auto";
+ dictionary[ "CE_SIGNATURE" ] = "no";
+ dictionary[ "SCRIPT" ] = "auto";
+ dictionary[ "SCRIPTTOOLS" ] = "auto";
+ dictionary[ "XMLPATTERNS" ] = "auto";
+ dictionary[ "PHONON" ] = "auto";
+ dictionary[ "PHONON_BACKEND" ] = "yes";
+ dictionary[ "MULTIMEDIA" ] = "yes";
+ dictionary[ "AUDIO_BACKEND" ] = "auto";
+ dictionary[ "WMSDK" ] = "auto";
+ dictionary[ "DIRECTSHOW" ] = "no";
+ dictionary[ "WEBKIT" ] = "auto";
+ dictionary[ "DECLARATIVE" ] = "auto";
+ dictionary[ "DECLARATIVE_DEBUG" ]= "yes";
+ dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
+ dictionary[ "DIRECTWRITE" ] = "no";
+
+ QString version;
+ QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h");
+ if (qglobal_h.open(QFile::ReadOnly)) {
+ QTextStream read(&qglobal_h);
+ QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\"");
+ QString line;
+ while (!read.atEnd()) {
+ line = read.readLine();
+ if (version_regexp.exactMatch(line)) {
+ version = version_regexp.cap(1).trimmed();
+ if (!version.isEmpty())
+ break;
+ }
+ }
+ qglobal_h.close();
+ }
+
+ if (version.isEmpty())
+ version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
+
+ dictionary[ "VERSION" ] = version;
+ {
+ QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
+ if (version_re.exactMatch(version)) {
+ dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
+ dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
+ dictionary[ "VERSION_PATCH" ] = version_re.cap(3);
+ }
+ }
+
+ dictionary[ "REDO" ] = "no";
+ dictionary[ "DEPENDENCIES" ] = "no";
+
+ dictionary[ "BUILD" ] = "debug";
+ dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
+
+ dictionary[ "BUILDTYPE" ] = "none";
+
+ dictionary[ "BUILDDEV" ] = "no";
+ dictionary[ "BUILDNOKIA" ] = "no";
+
+ dictionary[ "SHARED" ] = "yes";
+
+ dictionary[ "ZLIB" ] = "auto";
+
+ dictionary[ "GIF" ] = "auto";
+ dictionary[ "TIFF" ] = "auto";
+ dictionary[ "JPEG" ] = "auto";
+ dictionary[ "PNG" ] = "auto";
+ dictionary[ "MNG" ] = "auto";
+ dictionary[ "LIBTIFF" ] = "auto";
+ dictionary[ "LIBJPEG" ] = "auto";
+ dictionary[ "LIBPNG" ] = "auto";
+ dictionary[ "LIBMNG" ] = "auto";
+ dictionary[ "FREETYPE" ] = "no";
+
+ dictionary[ "QT3SUPPORT" ] = "yes";
+ dictionary[ "ACCESSIBILITY" ] = "yes";
+ dictionary[ "OPENGL" ] = "yes";
+ dictionary[ "OPENVG" ] = "no";
+ dictionary[ "IPV6" ] = "yes"; // Always, dynamically loaded
+ dictionary[ "OPENSSL" ] = "auto";
+ dictionary[ "DBUS" ] = "auto";
+ dictionary[ "S60" ] = "yes";
+
+ dictionary[ "STYLE_WINDOWS" ] = "yes";
+ dictionary[ "STYLE_WINDOWSXP" ] = "auto";
+ dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
+ dictionary[ "STYLE_PLASTIQUE" ] = "yes";
+ dictionary[ "STYLE_CLEANLOOKS" ]= "yes";
+ dictionary[ "STYLE_WINDOWSCE" ] = "no";
+ dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
+ dictionary[ "STYLE_MOTIF" ] = "yes";
+ dictionary[ "STYLE_CDE" ] = "yes";
+ dictionary[ "STYLE_S60" ] = "no";
+ dictionary[ "STYLE_GTK" ] = "no";
+
+ dictionary[ "SQL_MYSQL" ] = "no";
+ dictionary[ "SQL_ODBC" ] = "no";
+ dictionary[ "SQL_OCI" ] = "no";
+ dictionary[ "SQL_PSQL" ] = "no";
+ dictionary[ "SQL_TDS" ] = "no";
+ dictionary[ "SQL_DB2" ] = "no";
+ dictionary[ "SQL_SQLITE" ] = "auto";
+ dictionary[ "SQL_SQLITE_LIB" ] = "qt";
+ dictionary[ "SQL_SQLITE2" ] = "no";
+ dictionary[ "SQL_IBASE" ] = "no";
+ dictionary[ "GRAPHICS_SYSTEM" ] = "raster";
+
+ QString tmp = dictionary[ "QMAKESPEC" ];
+ if (tmp.contains("\\")) {
+ tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
+ } else {
+ tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
+ }
+ dictionary[ "QMAKESPEC" ] = tmp;
+
+ dictionary[ "INCREDIBUILD_XGE" ] = "auto";
+ dictionary[ "LTCG" ] = "no";
+ dictionary[ "NATIVE_GESTURES" ] = "yes";
+ dictionary[ "MSVC_MP" ] = "no";
+}
+
+Configure::~Configure()
+{
+ for (int i=0; i<3; ++i) {
+ QList<MakeItem*> items = makeList[i];
+ for (int j=0; j<items.size(); ++j)
+ delete items[j];
+ }
+}
+
+QString Configure::fixSeparators(const QString &somePath, bool escape)
+{
+ if (useUnixSeparators)
+ return QDir::fromNativeSeparators(somePath);
+ QString ret = QDir::toNativeSeparators(somePath);
+ return escape ? escapeSeparators(ret) : ret;
+}
+
+QString Configure::escapeSeparators(const QString &somePath)
+{
+ QString out = somePath;
+ out.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
+ return out;
+}
+
+// We could use QDir::homePath() + "/.qt-license", but
+// that will only look in the first of $HOME,$USERPROFILE
+// or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
+// more forgiving for the end user..
+QString Configure::firstLicensePath()
+{
+ QStringList allPaths;
+ allPaths << "./.qt-license"
+ << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
+ << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
+ << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
+ for (int i = 0; i< allPaths.count(); ++i)
+ if (QFile::exists(allPaths.at(i)))
+ return allPaths.at(i);
+ return QString();
+}
+
+
+// #### somehow I get a compiler error about vc++ reaching the nesting limit without
+// undefining the ansi for scoping.
+#ifdef for
+#undef for
+#endif
+
+void Configure::parseCmdLine()
+{
+ int argCount = configCmdLine.size();
+ int i = 0;
+ const QStringList imageFormats = QStringList() << "gif" << "png" << "mng" << "jpeg" << "tiff";
+
+#if !defined(EVAL)
+ if (argCount < 1) // skip rest if no arguments
+ ;
+ else if (configCmdLine.at(i) == "-redo") {
+ dictionary[ "REDO" ] = "yes";
+ configCmdLine.clear();
+ reloadCmdLine();
+ }
+ else if (configCmdLine.at(i) == "-loadconfig") {
+ ++i;
+ if (i != argCount) {
+ dictionary[ "REDO" ] = "yes";
+ dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
+ configCmdLine.clear();
+ reloadCmdLine();
+ } else {
+ dictionary[ "HELP" ] = "yes";
+ }
+ i = 0;
+ }
+ argCount = configCmdLine.size();
+#endif
+
+ // Look first for XQMAKESPEC
+ for (int j = 0 ; j < argCount; ++j)
+ {
+ if (configCmdLine.at(j) == "-xplatform") {
+ ++j;
+ if (j == argCount)
+ break;
+ dictionary["XQMAKESPEC"] = configCmdLine.at(j);
+ if (!dictionary[ "XQMAKESPEC" ].isEmpty())
+ applySpecSpecifics();
+ }
+ }
+
+ for (; i<configCmdLine.size(); ++i) {
+ bool continueElse[] = {false, false};
+ if (configCmdLine.at(i) == "-help"
+ || configCmdLine.at(i) == "-h"
+ || configCmdLine.at(i) == "-?")
+ dictionary[ "HELP" ] = "yes";
+
+#if !defined(EVAL)
+ else if (configCmdLine.at(i) == "-qconfig") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QCONFIG" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-buildkey") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "USER_BUILD_KEY" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-release") {
+ dictionary[ "BUILD" ] = "release";
+ if (dictionary[ "BUILDALL" ] == "auto")
+ dictionary[ "BUILDALL" ] = "no";
+ } else if (configCmdLine.at(i) == "-debug") {
+ dictionary[ "BUILD" ] = "debug";
+ if (dictionary[ "BUILDALL" ] == "auto")
+ dictionary[ "BUILDALL" ] = "no";
+ } else if (configCmdLine.at(i) == "-debug-and-release")
+ dictionary[ "BUILDALL" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-shared")
+ dictionary[ "SHARED" ] = "yes";
+ else if (configCmdLine.at(i) == "-static")
+ dictionary[ "SHARED" ] = "no";
+ else if (configCmdLine.at(i) == "-developer-build")
+ dictionary[ "BUILDDEV" ] = "yes";
+ else if (configCmdLine.at(i) == "-nokia-developer") {
+ cout << "Detected -nokia-developer option" << endl;
+ cout << "Nokia employees and agents are allowed to use this software under" << endl;
+ cout << "the authority of Nokia Corporation and/or its subsidiary(-ies)" << endl;
+ dictionary[ "BUILDNOKIA" ] = "yes";
+ dictionary[ "BUILDDEV" ] = "yes";
+ dictionary["LICENSE_CONFIRMED"] = "yes";
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ dictionary[ "SYMBIAN_DEFFILES" ] = "no";
+ }
+ }
+ else if (configCmdLine.at(i) == "-opensource") {
+ dictionary[ "BUILDTYPE" ] = "opensource";
+ }
+ else if (configCmdLine.at(i) == "-commercial") {
+ dictionary[ "BUILDTYPE" ] = "commercial";
+ }
+ else if (configCmdLine.at(i) == "-ltcg") {
+ dictionary[ "LTCG" ] = "yes";
+ }
+ else if (configCmdLine.at(i) == "-no-ltcg") {
+ dictionary[ "LTCG" ] = "no";
+ }
+ else if (configCmdLine.at(i) == "-mp") {
+ dictionary[ "MSVC_MP" ] = "yes";
+ }
+ else if (configCmdLine.at(i) == "-no-mp") {
+ dictionary[ "MSVC_MP" ] = "no";
+ }
+
+#endif
+
+ else if (configCmdLine.at(i) == "-platform") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
+ dictionary[ "QMAKESPEC_FROM" ] = "commandline";
+ } else if (configCmdLine.at(i) == "-arch") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "ARCHITECTURE" ] = configCmdLine.at(i);
+ if (configCmdLine.at(i) == "boundschecker") {
+ dictionary[ "ARCHITECTURE" ] = "generic"; // Boundschecker uses the generic arch,
+ qtConfig += "boundschecker"; // but also needs this CONFIG option
+ }
+ } else if (configCmdLine.at(i) == "-embedded") {
+ dictionary[ "EMBEDDED" ] = "yes";
+ } else if (configCmdLine.at(i) == "-xplatform") {
+ ++i;
+ // do nothing
+ }
+
+
+#if !defined(EVAL)
+ else if (configCmdLine.at(i) == "-no-zlib") {
+ // No longer supported since Qt 4.4.0
+ // But save the information for later so that we can print a warning
+ //
+ // If you REALLY really need no zlib support, you can still disable
+ // it by doing the following:
+ // add "no-zlib" to mkspecs/qconfig.pri
+ // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
+ //
+ // There's no guarantee that Qt will build under those conditions
+
+ dictionary[ "ZLIB_FORCED" ] = "yes";
+ } else if (configCmdLine.at(i) == "-qt-zlib") {
+ dictionary[ "ZLIB" ] = "qt";
+ } else if (configCmdLine.at(i) == "-system-zlib") {
+ dictionary[ "ZLIB" ] = "system";
+ }
+
+ // Image formats --------------------------------------------
+ else if (configCmdLine.at(i) == "-no-gif")
+ dictionary[ "GIF" ] = "no";
+
+ else if (configCmdLine.at(i) == "-no-libtiff") {
+ dictionary[ "TIFF"] = "no";
+ dictionary[ "LIBTIFF" ] = "no";
+ } else if (configCmdLine.at(i) == "-qt-libtiff") {
+ dictionary[ "LIBTIFF" ] = "qt";
+ } else if (configCmdLine.at(i) == "-system-libtiff") {
+ dictionary[ "LIBTIFF" ] = "system";
+ }
+
+ else if (configCmdLine.at(i) == "-no-libjpeg") {
+ dictionary[ "JPEG" ] = "no";
+ dictionary[ "LIBJPEG" ] = "no";
+ } else if (configCmdLine.at(i) == "-qt-libjpeg") {
+ dictionary[ "LIBJPEG" ] = "qt";
+ } else if (configCmdLine.at(i) == "-system-libjpeg") {
+ dictionary[ "LIBJPEG" ] = "system";
+ }
+
+ else if (configCmdLine.at(i) == "-no-libpng") {
+ dictionary[ "PNG" ] = "no";
+ dictionary[ "LIBPNG" ] = "no";
+ } else if (configCmdLine.at(i) == "-qt-libpng") {
+ dictionary[ "LIBPNG" ] = "qt";
+ } else if (configCmdLine.at(i) == "-system-libpng") {
+ dictionary[ "LIBPNG" ] = "system";
+ }
+
+ else if (configCmdLine.at(i) == "-no-libmng") {
+ dictionary[ "MNG" ] = "no";
+ dictionary[ "LIBMNG" ] = "no";
+ } else if (configCmdLine.at(i) == "-qt-libmng") {
+ dictionary[ "LIBMNG" ] = "qt";
+ } else if (configCmdLine.at(i) == "-system-libmng") {
+ dictionary[ "LIBMNG" ] = "system";
+ }
+
+ // Text Rendering --------------------------------------------
+ else if (configCmdLine.at(i) == "-no-freetype")
+ dictionary[ "FREETYPE" ] = "no";
+ else if (configCmdLine.at(i) == "-qt-freetype")
+ dictionary[ "FREETYPE" ] = "yes";
+
+ // CE- C runtime --------------------------------------------
+ else if (configCmdLine.at(i) == "-crt") {
+ ++i;
+ if (i == argCount)
+ break;
+ QDir cDir(configCmdLine.at(i));
+ if (!cDir.exists())
+ cout << "WARNING: Could not find directory (" << qPrintable(configCmdLine.at(i)) << ")for C runtime deployment" << endl;
+ else
+ dictionary[ "CE_CRT" ] = QDir::toNativeSeparators(cDir.absolutePath());
+ } else if (configCmdLine.at(i) == "-qt-crt") {
+ dictionary[ "CE_CRT" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-crt") {
+ dictionary[ "CE_CRT" ] = "no";
+ }
+ // cetest ---------------------------------------------------
+ else if (configCmdLine.at(i) == "-no-cetest") {
+ dictionary[ "CETEST" ] = "no";
+ dictionary[ "CETEST_REQUESTED" ] = "no";
+ } else if (configCmdLine.at(i) == "-cetest") {
+ // although specified to use it, we stay at "auto" state
+ // this is because checkAvailability() adds variables
+ // we need for crosscompilation; but remember if we asked
+ // for it.
+ dictionary[ "CETEST_REQUESTED" ] = "yes";
+ }
+ // Qt/CE - signing tool -------------------------------------
+ else if (configCmdLine.at(i) == "-signature") {
+ ++i;
+ if (i == argCount)
+ break;
+ QFileInfo info(configCmdLine.at(i));
+ if (!info.exists())
+ cout << "WARNING: Could not find signature file (" << qPrintable(configCmdLine.at(i)) << ")" << endl;
+ else
+ dictionary[ "CE_SIGNATURE" ] = QDir::toNativeSeparators(info.absoluteFilePath());
+ }
+ // Styles ---------------------------------------------------
+ else if (configCmdLine.at(i) == "-qt-style-windows")
+ dictionary[ "STYLE_WINDOWS" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-windows")
+ dictionary[ "STYLE_WINDOWS" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-windowsce")
+ dictionary[ "STYLE_WINDOWSCE" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-windowsce")
+ dictionary[ "STYLE_WINDOWSCE" ] = "no";
+ else if (configCmdLine.at(i) == "-qt-style-windowsmobile")
+ dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-windowsmobile")
+ dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-windowsxp")
+ dictionary[ "STYLE_WINDOWSXP" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-windowsxp")
+ dictionary[ "STYLE_WINDOWSXP" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-windowsvista")
+ dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-windowsvista")
+ dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-plastique")
+ dictionary[ "STYLE_PLASTIQUE" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-plastique")
+ dictionary[ "STYLE_PLASTIQUE" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-cleanlooks")
+ dictionary[ "STYLE_CLEANLOOKS" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-cleanlooks")
+ dictionary[ "STYLE_CLEANLOOKS" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-motif")
+ dictionary[ "STYLE_MOTIF" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-motif")
+ dictionary[ "STYLE_MOTIF" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-cde")
+ dictionary[ "STYLE_CDE" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-cde")
+ dictionary[ "STYLE_CDE" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-style-s60")
+ dictionary[ "STYLE_S60" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-style-s60")
+ dictionary[ "STYLE_S60" ] = "no";
+
+ // Qt 3 Support ---------------------------------------------
+ else if (configCmdLine.at(i) == "-no-qt3support")
+ dictionary[ "QT3SUPPORT" ] = "no";
+
+ // Work around compiler nesting limitation
+ else
+ continueElse[1] = true;
+ if (!continueElse[1]) {
+ }
+
+ // OpenGL Support -------------------------------------------
+ else if (configCmdLine.at(i) == "-no-opengl") {
+ dictionary[ "OPENGL" ] = "no";
+ } else if (configCmdLine.at(i) == "-opengl-es-cm") {
+ dictionary[ "OPENGL" ] = "yes";
+ dictionary[ "OPENGL_ES_CM" ] = "yes";
+ } else if (configCmdLine.at(i) == "-opengl-es-2") {
+ dictionary[ "OPENGL" ] = "yes";
+ dictionary[ "OPENGL_ES_2" ] = "yes";
+ } else if (configCmdLine.at(i) == "-opengl") {
+ dictionary[ "OPENGL" ] = "yes";
+ i++;
+ if (i == argCount)
+ break;
+
+ if (configCmdLine.at(i) == "es1") {
+ dictionary[ "OPENGL_ES_CM" ] = "yes";
+ } else if ( configCmdLine.at(i) == "es2" ) {
+ dictionary[ "OPENGL_ES_2" ] = "yes";
+ } else if ( configCmdLine.at(i) == "desktop" ) {
+ // OPENGL=yes suffices
+ } else {
+ cout << "Argument passed to -opengl option is not valid." << endl;
+ dictionary[ "DONE" ] = "error";
+ break;
+ }
+ }
+
+ // OpenVG Support -------------------------------------------
+ else if (configCmdLine.at(i) == "-openvg") {
+ dictionary[ "OPENVG" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-openvg") {
+ dictionary[ "OPENVG" ] = "no";
+ }
+
+ // Databases ------------------------------------------------
+ else if (configCmdLine.at(i) == "-qt-sql-mysql")
+ dictionary[ "SQL_MYSQL" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-mysql")
+ dictionary[ "SQL_MYSQL" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-mysql")
+ dictionary[ "SQL_MYSQL" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-odbc")
+ dictionary[ "SQL_ODBC" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-odbc")
+ dictionary[ "SQL_ODBC" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-odbc")
+ dictionary[ "SQL_ODBC" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-oci")
+ dictionary[ "SQL_OCI" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-oci")
+ dictionary[ "SQL_OCI" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-oci")
+ dictionary[ "SQL_OCI" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-psql")
+ dictionary[ "SQL_PSQL" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-psql")
+ dictionary[ "SQL_PSQL" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-psql")
+ dictionary[ "SQL_PSQL" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-tds")
+ dictionary[ "SQL_TDS" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-tds")
+ dictionary[ "SQL_TDS" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-tds")
+ dictionary[ "SQL_TDS" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-db2")
+ dictionary[ "SQL_DB2" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-db2")
+ dictionary[ "SQL_DB2" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-db2")
+ dictionary[ "SQL_DB2" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-sqlite")
+ dictionary[ "SQL_SQLITE" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
+ dictionary[ "SQL_SQLITE" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-sqlite")
+ dictionary[ "SQL_SQLITE" ] = "no";
+ else if (configCmdLine.at(i) == "-system-sqlite")
+ dictionary[ "SQL_SQLITE_LIB" ] = "system";
+ else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
+ dictionary[ "SQL_SQLITE2" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
+ dictionary[ "SQL_SQLITE2" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-sqlite2")
+ dictionary[ "SQL_SQLITE2" ] = "no";
+
+ else if (configCmdLine.at(i) == "-qt-sql-ibase")
+ dictionary[ "SQL_IBASE" ] = "yes";
+ else if (configCmdLine.at(i) == "-plugin-sql-ibase")
+ dictionary[ "SQL_IBASE" ] = "plugin";
+ else if (configCmdLine.at(i) == "-no-sql-ibase")
+ dictionary[ "SQL_IBASE" ] = "no";
+
+ // Image formats --------------------------------------------
+ else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
+ imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+ dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
+ else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
+ imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+ dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
+ else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
+ imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+ dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
+#endif
+ // IDE project generation -----------------------------------
+ else if (configCmdLine.at(i) == "-no-dsp")
+ dictionary[ "DSPFILES" ] = "no";
+ else if (configCmdLine.at(i) == "-dsp")
+ dictionary[ "DSPFILES" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-no-vcp")
+ dictionary[ "VCPFILES" ] = "no";
+ else if (configCmdLine.at(i) == "-vcp")
+ dictionary[ "VCPFILES" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-no-vcproj")
+ dictionary[ "VCPROJFILES" ] = "no";
+ else if (configCmdLine.at(i) == "-vcproj")
+ dictionary[ "VCPROJFILES" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-no-incredibuild-xge")
+ dictionary[ "INCREDIBUILD_XGE" ] = "no";
+ else if (configCmdLine.at(i) == "-incredibuild-xge")
+ dictionary[ "INCREDIBUILD_XGE" ] = "yes";
+ else if (configCmdLine.at(i) == "-native-gestures")
+ dictionary[ "NATIVE_GESTURES" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-native-gestures")
+ dictionary[ "NATIVE_GESTURES" ] = "no";
+#if !defined(EVAL)
+ // Symbian Support -------------------------------------------
+ else if (configCmdLine.at(i) == "-fpu")
+ {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "ARM_FPU_TYPE" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-s60")
+ dictionary[ "S60" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-s60")
+ dictionary[ "S60" ] = "no";
+
+ else if (configCmdLine.at(i) == "-usedeffiles")
+ dictionary[ "SYMBIAN_DEFFILES" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-usedeffiles")
+ dictionary[ "SYMBIAN_DEFFILES" ] = "no";
+
+ // Others ---------------------------------------------------
+ else if (configCmdLine.at(i) == "-fast")
+ dictionary[ "FAST" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-fast")
+ dictionary[ "FAST" ] = "no";
+
+ else if (configCmdLine.at(i) == "-stl")
+ dictionary[ "STL" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-stl")
+ dictionary[ "STL" ] = "no";
+
+ else if (configCmdLine.at(i) == "-exceptions")
+ dictionary[ "EXCEPTIONS" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-exceptions")
+ dictionary[ "EXCEPTIONS" ] = "no";
+
+ else if (configCmdLine.at(i) == "-rtti")
+ dictionary[ "RTTI" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-rtti")
+ dictionary[ "RTTI" ] = "no";
+
+ else if (configCmdLine.at(i) == "-accessibility")
+ dictionary[ "ACCESSIBILITY" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-accessibility") {
+ dictionary[ "ACCESSIBILITY" ] = "no";
+ cout << "Setting accessibility to NO" << endl;
+ }
+
+ else if (configCmdLine.at(i) == "-no-mmx")
+ dictionary[ "MMX" ] = "no";
+ else if (configCmdLine.at(i) == "-mmx")
+ dictionary[ "MMX" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-3dnow")
+ dictionary[ "3DNOW" ] = "no";
+ else if (configCmdLine.at(i) == "-3dnow")
+ dictionary[ "3DNOW" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-sse")
+ dictionary[ "SSE" ] = "no";
+ else if (configCmdLine.at(i) == "-sse")
+ dictionary[ "SSE" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-sse2")
+ dictionary[ "SSE2" ] = "no";
+ else if (configCmdLine.at(i) == "-sse2")
+ dictionary[ "SSE2" ] = "yes";
+ else if (configCmdLine.at(i) == "-no-iwmmxt")
+ dictionary[ "IWMMXT" ] = "no";
+ else if (configCmdLine.at(i) == "-iwmmxt")
+ dictionary[ "IWMMXT" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-no-openssl") {
+ dictionary[ "OPENSSL"] = "no";
+ } else if (configCmdLine.at(i) == "-openssl") {
+ dictionary[ "OPENSSL" ] = "yes";
+ } else if (configCmdLine.at(i) == "-openssl-linked") {
+ dictionary[ "OPENSSL" ] = "linked";
+ } else if (configCmdLine.at(i) == "-no-qdbus") {
+ dictionary[ "DBUS" ] = "no";
+ } else if (configCmdLine.at(i) == "-qdbus") {
+ dictionary[ "DBUS" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-dbus") {
+ dictionary[ "DBUS" ] = "no";
+ } else if (configCmdLine.at(i) == "-dbus") {
+ dictionary[ "DBUS" ] = "yes";
+ } else if (configCmdLine.at(i) == "-dbus-linked") {
+ dictionary[ "DBUS" ] = "linked";
+ } else if (configCmdLine.at(i) == "-no-script") {
+ dictionary[ "SCRIPT" ] = "no";
+ } else if (configCmdLine.at(i) == "-script") {
+ dictionary[ "SCRIPT" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-scripttools") {
+ dictionary[ "SCRIPTTOOLS" ] = "no";
+ } else if (configCmdLine.at(i) == "-scripttools") {
+ dictionary[ "SCRIPTTOOLS" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-xmlpatterns") {
+ dictionary[ "XMLPATTERNS" ] = "no";
+ } else if (configCmdLine.at(i) == "-xmlpatterns") {
+ dictionary[ "XMLPATTERNS" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-multimedia") {
+ dictionary[ "MULTIMEDIA" ] = "no";
+ } else if (configCmdLine.at(i) == "-multimedia") {
+ dictionary[ "MULTIMEDIA" ] = "yes";
+ } else if (configCmdLine.at(i) == "-audio-backend") {
+ dictionary[ "AUDIO_BACKEND" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-audio-backend") {
+ dictionary[ "AUDIO_BACKEND" ] = "no";
+ } else if (configCmdLine.at(i) == "-no-phonon") {
+ dictionary[ "PHONON" ] = "no";
+ } else if (configCmdLine.at(i) == "-phonon") {
+ dictionary[ "PHONON" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-phonon-backend") {
+ dictionary[ "PHONON_BACKEND" ] = "no";
+ } else if (configCmdLine.at(i) == "-phonon-backend") {
+ dictionary[ "PHONON_BACKEND" ] = "yes";
+ } else if (configCmdLine.at(i) == "-phonon-wince-ds9") {
+ dictionary[ "DIRECTSHOW" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-webkit") {
+ dictionary[ "WEBKIT" ] = "no";
+ } else if (configCmdLine.at(i) == "-webkit") {
+ dictionary[ "WEBKIT" ] = "yes";
+ } else if (configCmdLine.at(i) == "-webkit-debug") {
+ dictionary[ "WEBKIT" ] = "debug";
+ } else if (configCmdLine.at(i) == "-no-declarative") {
+ dictionary[ "DECLARATIVE" ] = "no";
+ } else if (configCmdLine.at(i) == "-declarative") {
+ dictionary[ "DECLARATIVE" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-declarative-debug") {
+ dictionary[ "DECLARATIVE_DEBUG" ] = "no";
+ } else if (configCmdLine.at(i) == "-declarative-debug") {
+ dictionary[ "DECLARATIVE_DEBUG" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
+ dictionary[ "PLUGIN_MANIFESTS" ] = "no";
+ } else if (configCmdLine.at(i) == "-plugin-manifests") {
+ dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
+ }
+
+ // Work around compiler nesting limitation
+ else
+ continueElse[0] = true;
+ if (!continueElse[0]) {
+ }
+
+ else if (configCmdLine.at(i) == "-internal")
+ dictionary[ "QMAKE_INTERNAL" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-no-qmake")
+ dictionary[ "BUILD_QMAKE" ] = "no";
+ else if (configCmdLine.at(i) == "-qmake")
+ dictionary[ "BUILD_QMAKE" ] = "yes";
+
+ else if (configCmdLine.at(i) == "-dont-process")
+ dictionary[ "NOPROCESS" ] = "yes";
+ else if (configCmdLine.at(i) == "-process")
+ dictionary[ "NOPROCESS" ] = "no";
+
+ else if (configCmdLine.at(i) == "-no-qmake-deps")
+ dictionary[ "DEPENDENCIES" ] = "no";
+ else if (configCmdLine.at(i) == "-qmake-deps")
+ dictionary[ "DEPENDENCIES" ] = "yes";
+
+
+ else if (configCmdLine.at(i) == "-qtnamespace") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
+ } else if (configCmdLine.at(i) == "-qtlibinfix") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ dictionary[ "QT_INSTALL_PLUGINS" ] =
+ QString("\\resource\\qt%1\\plugins").arg(dictionary[ "QT_LIBINFIX" ]);
+ dictionary[ "QT_INSTALL_IMPORTS" ] =
+ QString("\\resource\\qt%1\\imports").arg(dictionary[ "QT_LIBINFIX" ]);
+ dictionary[ "QT_INSTALL_TRANSLATIONS" ] =
+ QString("\\resource\\qt%1\\translations").arg(dictionary[ "QT_LIBINFIX" ]);
+ }
+ } else if (configCmdLine.at(i) == "-D") {
+ ++i;
+ if (i == argCount)
+ break;
+ qmakeDefines += configCmdLine.at(i);
+ } else if (configCmdLine.at(i) == "-I") {
+ ++i;
+ if (i == argCount)
+ break;
+ qmakeIncludes += configCmdLine.at(i);
+ } else if (configCmdLine.at(i) == "-L") {
+ ++i;
+ if (i == argCount)
+ break;
+ QFileInfo check(configCmdLine.at(i));
+ if (!check.isDir()) {
+ cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
+ dictionary[ "DONE" ] = "error";
+ break;
+ }
+ qmakeLibs += QString("-L" + configCmdLine.at(i));
+ } else if (configCmdLine.at(i) == "-l") {
+ ++i;
+ if (i == argCount)
+ break;
+ qmakeLibs += QString("-l" + configCmdLine.at(i));
+ } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
+ opensslLibs = configCmdLine.at(i);
+ } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
+ psqlLibs = configCmdLine.at(i);
+ } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
+ sybase = configCmdLine.at(i);
+ } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
+ sybaseLibs = configCmdLine.at(i);
+ }
+
+ else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "VERSION" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-saveconfig") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-confirm-license") {
+ dictionary["LICENSE_CONFIRMED"] = "yes";
+ }
+
+ else if (configCmdLine.at(i) == "-nomake") {
+ ++i;
+ if (i == argCount)
+ break;
+ disabledBuildParts += configCmdLine.at(i);
+ }
+
+ // Directories ----------------------------------------------
+ else if (configCmdLine.at(i) == "-prefix") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-bindir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-libdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-docdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-headerdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-plugindir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-importdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
+ }
+ else if (configCmdLine.at(i) == "-datadir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-translationdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-examplesdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-demosdir") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_INSTALL_DEMOS" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-hostprefix") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-make") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "MAKE" ] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-graphicssystem") {
+ ++i;
+ if (i == argCount)
+ break;
+ QString system = configCmdLine.at(i);
+ if (system == QLatin1String("raster")
+ || system == QLatin1String("opengl")
+ || system == QLatin1String("openvg")
+ || system == QLatin1String("runtime"))
+ dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i) == "-runtimegraphicssystem") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary["RUNTIME_SYSTEM"] = configCmdLine.at(i);
+ }
+
+ else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
+ // Scan to see if any specific modules and drivers are enabled or disabled
+ for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
+ if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
+ enabledModules += (*module);
+ break;
+ }
+ else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
+ disabledModules += (*module);
+ break;
+ }
+ }
+ }
+
+ else if (configCmdLine.at(i) == "-directwrite") {
+ dictionary["DIRECTWRITE"] = "yes";
+ } else if (configCmdLine.at(i) == "-no-directwrite") {
+ dictionary["DIRECTWRITE"] = "no";
+ }
+
+ else {
+ dictionary[ "HELP" ] = "yes";
+ cout << "Unknown option " << configCmdLine.at(i) << endl;
+ break;
+ }
+
+#endif
+ }
+
+ // Ensure that QMAKESPEC exists in the mkspecs folder
+ QDir mkspec_dir = fixSeparators(sourcePath + "/mkspecs");
+ QStringList mkspecs = mkspec_dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
+
+ if (dictionary["QMAKESPEC"].toLower() == "features"
+ || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
+ dictionary[ "HELP" ] = "yes";
+ if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
+ cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
+ } else if (dictionary ["QMAKESPEC_FROM"] == "env") {
+ cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"]
+ << "\" which is not a supported platform" << endl;
+ } else { // was autodetected from environment
+ cout << "Unable to detect the platform from environment. Use -platform command line"
+ "argument or set the QMAKESPEC environment variable and run configure again" << endl;
+ }
+ cout << "See the README file for a list of supported operating systems and compilers." << endl;
+ } else {
+ if (dictionary[ "QMAKESPEC" ].endsWith("-icc") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc.net") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc2002") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc2003") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc2005") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") ||
+ dictionary[ "QMAKESPEC" ].endsWith("-msvc2010")) {
+ if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake";
+ dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
+ } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
+ if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make";
+ if (Environment::detectExecutable("sh.exe")) {
+ dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++-sh";
+ } else {
+ dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++";
+ }
+ } else {
+ if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make";
+ dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
+ }
+ }
+
+ // Tell the user how to proceed building Qt after configure finished its job
+ dictionary["QTBUILDINSTRUCTION"] = dictionary["MAKE"];
+ if (dictionary.contains("XQMAKESPEC")) {
+ if (dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ dictionary["QTBUILDINSTRUCTION"] = QString("make debug-winscw|debug-armv5|release-armv5");
+ } else if (dictionary["XQMAKESPEC"].startsWith("wince")) {
+ dictionary["QTBUILDINSTRUCTION"] =
+ QString("setcepaths.bat ") + dictionary["XQMAKESPEC"] + QString(" && ") + dictionary["MAKE"];
+ }
+ }
+
+ // Tell the user how to confclean before the next configure
+ dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean");
+
+ // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
+ if (dictionary.contains("XQMAKESPEC") &&
+ !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
+ dictionary["HELP"] = "yes";
+ cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
+ }
+
+ // Ensure that the crt to be deployed can be found
+ if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) {
+ QDir cDir(dictionary["CE_CRT"]);
+ QStringList entries = cDir.entryList();
+ bool hasDebug = entries.contains("msvcr80.dll");
+ bool hasRelease = entries.contains("msvcr80d.dll");
+ if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) {
+ cout << "Could not find debug and release c-runtime." << endl;
+ cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl;
+ cout << "the path specified. Setting to -no-crt";
+ dictionary[ "CE_CRT" ] = "no";
+ } else if ((dictionary["BUILD"] == "debug") && !hasDebug) {
+ cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl;
+ cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
+ dictionary[ "CE_CRT" ] = "no";
+ } else if ((dictionary["BUILD"] == "release") && !hasRelease) {
+ cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl;
+ cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
+ dictionary[ "CE_CRT" ] = "no";
+ }
+ }
+
+ useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
+
+ // Allow tests for private classes to be compiled against internal builds
+ if (dictionary["BUILDDEV"] == "yes")
+ qtConfig += "private_tests";
+
+
+#if !defined(EVAL)
+ for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
+ modules.removeAll((*dis));
+ }
+ for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
+ if (modules.indexOf((*ena)) == -1)
+ modules += (*ena);
+ }
+ qtConfig += modules;
+
+ for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
+ qtConfig.removeAll(*it);
+
+ if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
+ saveCmdLine();
+#endif
+}
+
+#if !defined(EVAL)
+void Configure::validateArgs()
+{
+ // Validate the specified config
+
+ // Get all possible configurations from the file system.
+ QDir dir;
+ QStringList filters;
+ filters << "qconfig-*.h";
+ dir.setNameFilters(filters);
+ dir.setPath(sourcePath + "/src/corelib/global/");
+
+ QStringList stringList = dir.entryList();
+
+ QStringList::Iterator it;
+ for (it = stringList.begin(); it != stringList.end(); ++it)
+ allConfigs << it->remove("qconfig-").remove(".h");
+ allConfigs << "full";
+
+ // Try internal configurations first.
+ QStringList possible_configs = QStringList()
+ << "minimal"
+ << "small"
+ << "medium"
+ << "large"
+ << "full";
+ int index = possible_configs.indexOf(dictionary["QCONFIG"]);
+ if (index >= 0) {
+ for (int c = 0; c <= index; c++) {
+ qmakeConfig += possible_configs[c] + "-config";
+ }
+ return;
+ }
+
+ // If the internal configurations failed, try others.
+ QStringList::Iterator config;
+ for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
+ if ((*config) == dictionary[ "QCONFIG" ])
+ break;
+ }
+ if (config == allConfigs.end()) {
+ dictionary[ "HELP" ] = "yes";
+ cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
+ }
+ else
+ qmakeConfig += (*config) + "-config";
+}
+#endif
+
+
+// Output helper functions --------------------------------[ Start ]-
+/*!
+ Determines the length of a string token.
+*/
+static int tokenLength(const char *str)
+{
+ if (*str == 0)
+ return 0;
+
+ const char *nextToken = strpbrk(str, " _/\n\r");
+ if (nextToken == str || !nextToken)
+ return 1;
+
+ return int(nextToken - str);
+}
+
+/*!
+ Prints out a string which starts at position \a startingAt, and
+ indents each wrapped line with \a wrapIndent characters.
+ The wrap point is set to the console width, unless that width
+ cannot be determined, or is too small.
+*/
+void Configure::desc(const char *description, int startingAt, int wrapIndent)
+{
+ int linePos = startingAt;
+
+ bool firstLine = true;
+ const char *nextToken = description;
+ while (*nextToken) {
+ int nextTokenLen = tokenLength(nextToken);
+ if (*nextToken == '\n' // Wrap on newline, duh
+ || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
+ {
+ printf("\n");
+ linePos = 0;
+ firstLine = false;
+ if (*nextToken == '\n')
+ ++nextToken;
+ continue;
+ }
+ if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
+ printf("%*s", wrapIndent , "");
+ linePos = wrapIndent;
+ if (*nextToken == ' ') {
+ ++nextToken;
+ continue;
+ }
+ }
+ printf("%.*s", nextTokenLen, nextToken);
+ linePos += nextTokenLen;
+ nextToken += nextTokenLen;
+ }
+}
+
+/*!
+ Prints out an option with its description wrapped at the
+ description starting point. If \a skipIndent is true, the
+ indentation to the option is not outputted (used by marked option
+ version of desc()). Extra spaces between option and its
+ description is filled with\a fillChar, if there's available
+ space.
+*/
+void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
+{
+ if (!skipIndent)
+ printf("%*s", optionIndent, "");
+
+ int remaining = descIndent - optionIndent - strlen(option);
+ int wrapIndent = descIndent + qMax(0, 1 - remaining);
+ printf("%s", option);
+
+ if (remaining > 2) {
+ printf(" "); // Space in front
+ for (int i = remaining; i > 2; --i)
+ printf("%c", fillChar); // Fill, if available space
+ }
+ printf(" "); // Space between option and description
+
+ desc(description, wrapIndent, wrapIndent);
+ printf("\n");
+}
+
+/*!
+ Same as above, except it also marks an option with an '*', if
+ the option is default action.
+*/
+void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
+{
+ const QString markedAs = dictionary.value(mark_option);
+ if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
+ printf(" + ");
+ else if (markedAs == "auto") // setting marked as "auto" and option is default => +
+ printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
+ else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
+ printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
+ else // None are "auto", (markedAs == mark) => *
+ printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
+
+ desc(option, description, true, fillChar);
+}
+
+/*!
+ Modifies the default configuration based on given -platform option.
+ Eg. switches to different default styles for Windows CE.
+*/
+void Configure::applySpecSpecifics()
+{
+ if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) {
+ dictionary[ "STYLE_WINDOWSXP" ] = "no";
+ dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
+ dictionary[ "STYLE_PLASTIQUE" ] = "no";
+ dictionary[ "STYLE_CLEANLOOKS" ] = "no";
+ dictionary[ "STYLE_WINDOWSCE" ] = "yes";
+ dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
+ dictionary[ "STYLE_MOTIF" ] = "no";
+ dictionary[ "STYLE_CDE" ] = "no";
+ dictionary[ "STYLE_S60" ] = "no";
+ dictionary[ "FREETYPE" ] = "no";
+ dictionary[ "QT3SUPPORT" ] = "no";
+ dictionary[ "OPENGL" ] = "no";
+ dictionary[ "OPENSSL" ] = "no";
+ dictionary[ "STL" ] = "no";
+ dictionary[ "EXCEPTIONS" ] = "no";
+ dictionary[ "RTTI" ] = "no";
+ dictionary[ "ARCHITECTURE" ] = "windowsce";
+ dictionary[ "3DNOW" ] = "no";
+ dictionary[ "SSE" ] = "no";
+ dictionary[ "SSE2" ] = "no";
+ dictionary[ "MMX" ] = "no";
+ dictionary[ "IWMMXT" ] = "no";
+ dictionary[ "CE_CRT" ] = "yes";
+ dictionary[ "WEBKIT" ] = "no";
+ dictionary[ "PHONON" ] = "yes";
+ dictionary[ "DIRECTSHOW" ] = "no";
+ // We only apply MMX/IWMMXT for mkspecs we know they work
+ if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) {
+ dictionary[ "MMX" ] = "yes";
+ dictionary[ "IWMMXT" ] = "yes";
+ dictionary[ "DIRECTSHOW" ] = "yes";
+ }
+ dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
+ dictionary[ "QT_INSTALL_PREFIX" ] = "";
+
+ } else if (dictionary[ "XQMAKESPEC" ].startsWith("symbian")) {
+ dictionary[ "ACCESSIBILITY" ] = "no";
+ dictionary[ "STYLE_WINDOWSXP" ] = "no";
+ dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
+ dictionary[ "STYLE_PLASTIQUE" ] = "no";
+ dictionary[ "STYLE_CLEANLOOKS" ] = "no";
+ dictionary[ "STYLE_WINDOWSCE" ] = "no";
+ dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
+ dictionary[ "STYLE_MOTIF" ] = "no";
+ dictionary[ "STYLE_CDE" ] = "no";
+ dictionary[ "STYLE_S60" ] = "yes";
+ dictionary[ "FREETYPE" ] = "no";
+ dictionary[ "QT3SUPPORT" ] = "no";
+ dictionary[ "OPENGL" ] = "no";
+ dictionary[ "OPENSSL" ] = "yes";
+ // On Symbian we now always will have IPv6 with no chance to disable it
+ dictionary[ "IPV6" ] = "yes";
+ dictionary[ "STL" ] = "yes";
+ dictionary[ "EXCEPTIONS" ] = "yes";
+ dictionary[ "RTTI" ] = "yes";
+ dictionary[ "ARCHITECTURE" ] = "symbian";
+ dictionary[ "3DNOW" ] = "no";
+ dictionary[ "SSE" ] = "no";
+ dictionary[ "SSE2" ] = "no";
+ dictionary[ "MMX" ] = "no";
+ dictionary[ "IWMMXT" ] = "no";
+ dictionary[ "CE_CRT" ] = "no";
+ dictionary[ "DIRECT3D" ] = "no";
+ dictionary[ "WEBKIT" ] = "yes";
+ dictionary[ "ASSISTANT_WEBKIT" ] = "no";
+ dictionary[ "PHONON" ] = "yes";
+ dictionary[ "XMLPATTERNS" ] = "yes";
+ dictionary[ "QT_GLIB" ] = "no";
+ dictionary[ "S60" ] = "yes";
+ dictionary[ "SYMBIAN_DEFFILES" ] = "yes";
+ // iconv makes makes apps start and run ridiculously slowly in symbian emulator (HW not tested)
+ // iconv_open seems to return -1 always, so something is probably missing from the platform.
+ dictionary[ "QT_ICONV" ] = "no";
+ dictionary[ "SCRIPTTOOLS" ] = "no";
+ dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
+ dictionary[ "QT_INSTALL_PREFIX" ] = "";
+ dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins";
+ dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports";
+ dictionary[ "QT_INSTALL_TRANSLATIONS" ] = "\\resource\\qt\\translations";
+ dictionary[ "ARM_FPU_TYPE" ] = "softvfp";
+ dictionary[ "SQL_SQLITE" ] = "yes";
+ dictionary[ "SQL_SQLITE_LIB" ] = "system";
+
+ // Disable building docs and translations for now
+ disabledBuildParts << "docs" << "translations";
+
+ } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
+ //TODO
+ dictionary[ "STYLE_WINDOWSXP" ] = "no";
+ dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
+ dictionary[ "KBD_DRIVERS" ] = "tty";
+ dictionary[ "GFX_DRIVERS" ] = "linuxfb vnc";
+ dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
+ dictionary[ "QT3SUPPORT" ] = "no";
+ dictionary[ "OPENGL" ] = "no";
+ dictionary[ "EXCEPTIONS" ] = "no";
+ dictionary[ "DBUS"] = "no";
+ dictionary[ "QT_QWS_DEPTH" ] = "4 8 16 24 32";
+ dictionary[ "QT_SXE" ] = "no";
+ dictionary[ "QT_INOTIFY" ] = "no";
+ dictionary[ "QT_LPR" ] = "no";
+ dictionary[ "QT_CUPS" ] = "no";
+ dictionary[ "QT_GLIB" ] = "no";
+ dictionary[ "QT_ICONV" ] = "no";
+
+ dictionary["DECORATIONS"] = "default windows styled";
+ }
+}
+
+QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths)
+{
+ QDir d;
+ for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) {
+ // Remove any leading or trailing ", this is commonly used in the environment
+ // variables
+ QString path = (*it);
+ if (path.startsWith("\""))
+ path = path.right(path.length() - 1);
+ if (path.endsWith("\""))
+ path = path.left(path.length() - 1);
+ if (d.exists(path + QDir::separator() + fileName)) {
+ return (path);
+ }
+ }
+ return QString();
+}
+
+QString Configure::locateFile(const QString &fileName)
+{
+ QString file = fileName.toLower();
+ QStringList paths;
+#if defined(Q_OS_WIN32)
+ QRegExp splitReg("[;,]");
+#else
+ QRegExp splitReg("[:]");
+#endif
+ if (file.endsWith(".h"))
+ paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts);
+ else if (file.endsWith(".lib"))
+ paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts);
+ else
+ paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts);
+ return locateFileInPaths(file, paths);
+}
+
+// Output helper functions ---------------------------------[ Stop ]-
+
+
+bool Configure::displayHelp()
+{
+ if (dictionary[ "HELP" ] == "yes") {
+ desc("Usage: configure [-buildkey <key>]\n"
+// desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n"
+// "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n"
+// "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n"
+// "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n"
+ "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n"
+ "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n"
+ "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n"
+ "[-no-stl] [-stl] [-no-sql-<driver>] [-qt-sql-<driver>]\n"
+ "[-plugin-sql-<driver>] [-system-sqlite] [-arch <arch>]\n"
+ "[-D <define>] [-I <includepath>] [-L <librarypath>]\n"
+ "[-help] [-no-dsp] [-dsp] [-no-vcproj] [-vcproj]\n"
+ "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
+ "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
+ "[-saveconfig <config>] [-loadconfig <config>]\n"
+ "[-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng]\n"
+ "[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
+ "[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
+ "[-no-libmng] [-qt-libmng] [-system-libmng] [-no-qt3support] [-mmx]\n"
+ "[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
+ "[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
+ "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
+ "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
+ "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
+ "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
+ "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
+ "[-no-webkit] [-webkit] [-webkit-debug]\n"
+ "[-graphicssystem raster|opengl|openvg]\n"
+ "[-no-directwrite] [-directwrite]\n\n", 0, 7);
+
+ desc("Installation options:\n\n");
+
+#if !defined(EVAL)
+/*
+ desc(" These are optional, but you may specify install directories.\n\n", 0, 1);
+
+ desc( "-prefix dir", "This will install everything relative to dir\n(default $QT_INSTALL_PREFIX)\n");
+
+ desc(" You may use these to separate different parts of the install:\n\n", 0, 1);
+
+ desc( "-bindir <dir>", "Executables will be installed to dir\n(default PREFIX/bin)");
+ desc( "-libdir <dir>", "Libraries will be installed to dir\n(default PREFIX/lib)");
+ desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)");
+ desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)");
+ desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)");
+ desc( "-importdir <dir>", "Imports for QML will be installed to dir\n(default PREFIX/imports)");
+ desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)");
+ desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n");
+ desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)");
+ desc( "-demosdir <dir>", "Demos will be installed to dir\n(default PREFIX/demos)");
+*/
+ desc(" You may use these options to turn on strict plugin loading:\n\n", 0, 1);
+
+ desc( "-buildkey <key>", "Build the Qt library and plugins using the specified <key>. "
+ "When the library loads plugins, it will only load those that have a matching <key>.\n");
+
+ desc("Configure options:\n\n");
+
+ desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
+ " that needs to be evaluated. If the evaluation succeeds, the feature is"
+ " included. Here is a short explanation of each option:\n\n", 0, 1);
+
+ desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
+ desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
+ desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
+
+ desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
+ desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
+
+ desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
+
+ desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
+ desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
+
+ desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
+ desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
+
+ desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files.");
+ desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and "
+ "subdirectory targets. All other Makefiles are created as wrappers "
+ "which will in turn run qmake\n");
+
+ desc("EXCEPTIONS", "no", "-no-exceptions", "Disable exceptions on platforms that support it.");
+ desc("EXCEPTIONS", "yes","-exceptions", "Enable exceptions on platforms that support it.\n");
+
+ desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
+ desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
+
+ desc("STL", "no", "-no-stl", "Do not compile STL support.");
+ desc("STL", "yes", "-stl", "Compile STL support.\n");
+
+ desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
+ desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
+ desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
+ "Available values for <driver>:");
+ desc("SQL_MYSQL", "auto", "", " mysql", ' ');
+ desc("SQL_PSQL", "auto", "", " psql", ' ');
+ desc("SQL_OCI", "auto", "", " oci", ' ');
+ desc("SQL_ODBC", "auto", "", " odbc", ' ');
+ desc("SQL_TDS", "auto", "", " tds", ' ');
+ desc("SQL_DB2", "auto", "", " db2", ' ');
+ desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
+ desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
+ desc("SQL_IBASE", "auto", "", " ibase", ' ');
+ desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
+
+ desc( "-system-sqlite", "Use sqlite from the operating system.\n");
+
+ desc("QT3SUPPORT", "no","-no-qt3support", "Disables the Qt 3 support functionality.\n");
+ desc("OPENGL", "no","-no-opengl", "Disables OpenGL functionality\n");
+ desc("OPENGL", "no","-opengl <api>", "Enable OpenGL support with specified API version.\n"
+ "Available values for <api>:");
+ desc("", "", "", " desktop - Enable support for Desktop OpenGL", ' ');
+ desc("OPENGL_ES_CM", "no", "", " es1 - Enable support for OpenGL ES Common Profile", ' ');
+ desc("OPENGL_ES_2", "no", "", " es2 - Enable support for OpenGL ES 2.0", ' ');
+
+ desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality\n");
+ desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality");
+ desc( "", "Requires EGL support, typically supplied by an OpenGL", false, ' ');
+ desc( "", "or other graphics implementation\n", false, ' ');
+
+#endif
+ desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
+ desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
+ desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
+
+#if !defined(EVAL)
+ desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}");
+ desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>\n");
+ desc( "-D <define>", "Add an explicit define to the preprocessor.");
+ desc( "-I <includepath>", "Add an explicit include path.");
+ desc( "-L <librarypath>", "Add an explicit library path.");
+ desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
+#endif
+ desc( "-graphicssystem <sys>", "Specify which graphicssystem should be used.\n"
+ "Available values for <sys>:");
+ desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' ');
+ desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' ');
+ desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!\n", ' ');
+
+ desc( "-help, -h, -?", "Display this information.\n");
+
+#if !defined(EVAL)
+ // 3rd party stuff options go below here --------------------------------------------------------------------------------
+ desc("Third Party Libraries:\n\n");
+
+ desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
+ desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
+
+ desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.");
+
+ desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
+ desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
+ desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
+
+ desc("LIBMNG", "no", "-no-libmng", "Do not compile MNG support.");
+ desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt.");
+ desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n");
+
+ desc("LIBTIFF", "no", "-no-libtiff", "Do not compile TIFF support.");
+ desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt.");
+ desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n");
+
+ desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
+ desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
+ desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
+
+#endif
+ // Qt\Windows only options go below here --------------------------------------------------------------------------------
+ desc("Qt for Windows only:\n\n");
+
+ desc("DSPFILES", "no", "-no-dsp", "Do not generate VC++ .dsp files.");
+ desc("DSPFILES", "yes", "-dsp", "Generate VC++ .dsp files, only if spec \"win32-msvc\".\n");
+
+ desc("VCPROJFILES", "no", "-no-vcproj", "Do not generate VC++ .vcproj files.");
+ desc("VCPROJFILES", "yes", "-vcproj", "Generate VC++ .vcproj files, only if platform \"win32-msvc.net\".\n");
+
+ desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
+ desc("INCREDIBUILD_XGE", "yes", "-incredibuild-xge", "Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.\n(The IncrediBuild distribution commands are only added to Visual Studio projects)\n");
+
+ desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
+ desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
+
+#if !defined(EVAL)
+ desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
+ desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
+
+ desc("NOPROCESS", "yes", "-dont-process", "Do not generate Makefiles/Project files. This will override -no-fast if specified.");
+ desc("NOPROCESS", "no", "-process", "Generate Makefiles/Project files.\n");
+
+ desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
+ desc("RTTI", "yes", "-rtti", "Compile runtime type information.\n");
+ desc("MMX", "no", "-no-mmx", "Do not compile with use of MMX instructions");
+ desc("MMX", "yes", "-mmx", "Compile with use of MMX instructions");
+ desc("3DNOW", "no", "-no-3dnow", "Do not compile with use of 3DNOW instructions");
+ desc("3DNOW", "yes", "-3dnow", "Compile with use of 3DNOW instructions");
+ desc("SSE", "no", "-no-sse", "Do not compile with use of SSE instructions");
+ desc("SSE", "yes", "-sse", "Compile with use of SSE instructions");
+ desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions");
+ desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions");
+ desc("OPENSSL", "no", "-no-openssl", "Do not compile in OpenSSL support");
+ desc("OPENSSL", "yes", "-openssl", "Compile in run-time OpenSSL support");
+ desc("OPENSSL", "linked","-openssl-linked", "Compile in linked OpenSSL support");
+ desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support");
+ desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1 dynamically");
+ desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1");
+ desc("PHONON", "no", "-no-phonon", "Do not compile in the Phonon module");
+ desc("PHONON", "yes", "-phonon", "Compile the Phonon module (Phonon is built if a decent C++ compiler is used.)");
+ desc("PHONON_BACKEND","no", "-no-phonon-backend","Do not compile the platform-specific Phonon backend-plugin");
+ desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
+ desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module");
+ desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module");
+ desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia");
+ desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia");
+ desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module");
+ desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
+ desc("WEBKIT", "debug", "-webkit-debug", "Compile in the WebKit module with debug symbols.");
+ desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module.");
+ desc("SCRIPT", "yes", "-script", "Build the QtScript module.");
+ desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module.");
+ desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module.");
+ desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module");
+ desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module");
+ desc("DECLARATIVE_DEBUG", "no", "-no-declarative-debug", "Do not build the declarative debugging support");
+ desc("DECLARATIVE_DEBUG", "yes", "-declarative-debug", "Build the declarative debugging support");
+ desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering");
+ desc("DIRECTWRITE", "yes", "-directwrite", "Build support for DirectWrite font rendering (experimental, requires DirectWrite availability on target systems, e.g. Windows Vista with Platform Update, Windows 7, etc.)");
+
+ desc( "-arch <arch>", "Specify an architecture.\n"
+ "Available values for <arch>:");
+ desc("ARCHITECTURE","windows", "", " windows", ' ');
+ desc("ARCHITECTURE","windowsce", "", " windowsce", ' ');
+ desc("ARCHITECTURE","symbian", "", " symbian", ' ');
+ desc("ARCHITECTURE","boundschecker", "", " boundschecker", ' ');
+ desc("ARCHITECTURE","generic", "", " generic\n", ' ');
+
+ desc( "-no-style-<style>", "Disable <style> entirely.");
+ desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
+
+ desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
+ desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
+ desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
+ desc("STYLE_PLASTIQUE", "yes", "", " plastique", ' ');
+ desc("STYLE_CLEANLOOKS", "yes", "", " cleanlooks", ' ');
+ desc("STYLE_MOTIF", "yes", "", " motif", ' ');
+ desc("STYLE_CDE", "yes", "", " cde", ' ');
+ desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' ');
+ desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile", ' ');
+ desc("STYLE_S60" , "yes", "", " s60\n", ' ');
+ desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
+ desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.");
+ desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
+ desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP)");
+
+/* We do not support -qconfig on Windows yet
+
+ desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
+ for (int i=0; i<allConfigs.size(); ++i)
+ desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
+ printf("\n");
+*/
+#endif
+ desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
+ desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
+ desc( "-redo", "Run configure with the same parameters as last time.\n");
+
+ // Qt\Windows CE only options go below here -----------------------------------------------------------------------------
+ desc("Qt for Windows CE only:\n\n");
+ desc("IWMMXT", "no", "-no-iwmmxt", "Do not compile with use of IWMMXT instructions");
+ desc("IWMMXT", "yes", "-iwmmxt", "Do compile with use of IWMMXT instructions (Qt for Windows CE on Arm only)");
+ desc("CE_CRT", "no", "-no-crt" , "Do not add the C runtime to default deployment rules");
+ desc("CE_CRT", "yes", "-qt-crt", "Qt identifies C runtime during project generation");
+ desc( "-crt <path>", "Specify path to C runtime used for project generation.");
+ desc("CETEST", "no", "-no-cetest", "Do not compile Windows CE remote test application");
+ desc("CETEST", "yes", "-cetest", "Compile Windows CE remote test application");
+ desc( "-signature <file>", "Use file for signing the target project");
+
+ desc("DIRECTSHOW", "no", "-phonon-wince-ds9", "Enable Phonon Direct Show 9 backend for Windows CE");
+
+ // Qt\Symbian only options go below here -----------------------------------------------------------------------------
+ desc("Qt for Symbian OS only:\n\n");
+ desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
+ desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
+ desc( "-fpu <flags>", "VFP type on ARM, supported options: softvfp(default) | vfpv2 | softvfp+vfpv2");
+ desc("S60", "no", "-no-s60", "Do not compile in S60 support.");
+ desc("S60", "yes", "-s60", "Compile with support for the S60 UI Framework");
+ desc("SYMBIAN_DEFFILES", "no", "-no-usedeffiles", "Disable the usage of DEF files.");
+ desc("SYMBIAN_DEFFILES", "yes", "-usedeffiles", "Enable the usage of DEF files.\n");
+ return true;
+ }
+ return false;
+}
+
+QString Configure::findFileInPaths(const QString &fileName, const QString &paths)
+{
+#if defined(Q_OS_WIN32)
+ QRegExp splitReg("[;,]");
+#else
+ QRegExp splitReg("[:]");
+#endif
+ QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts);
+ QDir d;
+ for (QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it) {
+ // Remove any leading or trailing ", this is commonly used in the environment
+ // variables
+ QString path = (*it);
+ if (path.startsWith('\"'))
+ path = path.right(path.length() - 1);
+ if (path.endsWith('\"'))
+ path = path.left(path.length() - 1);
+ if (d.exists(path + QDir::separator() + fileName))
+ return path;
+ }
+ return QString();
+}
+
+static QString mingwPaths(const QString &mingwPath, const QString &pathName)
+{
+ QString ret;
+ QDir mingwDir = QFileInfo(mingwPath).dir();
+ const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
+ for (int i = 0 ;i < subdirs.length(); ++i) {
+ const QFileInfo &fi = subdirs.at(i);
+ const QString name = fi.fileName();
+ if (name == pathName)
+ ret += fi.absoluteFilePath() + ';';
+ else if (name.contains("mingw"))
+ ret += fi.absoluteFilePath() + QDir::separator() + pathName + ';';
+ }
+ return ret;
+}
+
+bool Configure::findFile(const QString &fileName)
+{
+ const QString file = fileName.toLower();
+ const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH"));
+ const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ?
+ findFileInPaths("g++.exe", pathEnvVar) : QString();
+
+ QString paths;
+ if (file.endsWith(".h")) {
+ if (!mingwPath.isNull()) {
+ if (!findFileInPaths(file, mingwPaths(mingwPath, "include")).isNull())
+ return true;
+ //now let's try the additional compiler path
+
+ const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/../lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
+ for (int i = 0; i < mingwConfigs.length(); ++i) {
+ const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
+ foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
+ if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull())
+ return true;
+ }
+ }
+ }
+ paths = QString::fromLocal8Bit(getenv("INCLUDE"));
+ } else if (file.endsWith(".lib") || file.endsWith(".a")) {
+ if (!mingwPath.isNull() && !findFileInPaths(file, mingwPaths(mingwPath, "lib")).isNull())
+ return true;
+ paths = QString::fromLocal8Bit(getenv("LIB"));
+ } else {
+ paths = pathEnvVar;
+ }
+ return !findFileInPaths(file, paths).isNull();
+}
+
+/*!
+ Default value for options marked as "auto" if the test passes.
+ (Used both by the autoDetection() below, and the desc() function
+ to mark (+) the default option of autodetecting options.
+*/
+QString Configure::defaultTo(const QString &option)
+{
+ // We prefer using the system version of the 3rd party libs
+ if (option == "ZLIB"
+ || option == "LIBJPEG"
+ || option == "LIBPNG"
+ || option == "LIBMNG"
+ || option == "LIBTIFF")
+ return "system";
+
+ // PNG is always built-in, never a plugin
+ if (option == "PNG")
+ return "yes";
+
+ // These database drivers and image formats can be built-in or plugins.
+ // Prefer plugins when Qt is shared.
+ if (dictionary[ "SHARED" ] == "yes") {
+ if (option == "SQL_MYSQL"
+ || option == "SQL_MYSQL"
+ || option == "SQL_ODBC"
+ || option == "SQL_OCI"
+ || option == "SQL_PSQL"
+ || option == "SQL_TDS"
+ || option == "SQL_DB2"
+ || option == "SQL_SQLITE"
+ || option == "SQL_SQLITE2"
+ || option == "SQL_IBASE"
+ || option == "JPEG"
+ || option == "MNG"
+ || option == "TIFF"
+ || option == "GIF")
+ return "plugin";
+ }
+
+ // By default we do not want to compile OCI driver when compiling with
+ // MinGW, due to lack of such support from Oracle. It prob. wont work.
+ // (Customer may force the use though)
+ if (dictionary["QMAKESPEC"].endsWith("-g++")
+ && option == "SQL_OCI")
+ return "no";
+
+ if (option == "SYNCQT"
+ && (!QFile::exists(sourcePath + "/bin/syncqt") ||
+ !QFile::exists(sourcePath + "/bin/syncqt.bat")))
+ return "no";
+
+ return "yes";
+}
+
+/*!
+ Checks the system for the availability of a feature.
+ Returns true if the feature is available, else false.
+*/
+bool Configure::checkAvailability(const QString &part)
+{
+ bool available = false;
+ if (part == "STYLE_WINDOWSXP")
+ available = findFile("uxtheme.h");
+
+ else if (part == "ZLIB")
+ available = findFile("zlib.h");
+
+ else if (part == "LIBJPEG")
+ available = findFile("jpeglib.h");
+ else if (part == "LIBPNG")
+ available = findFile("png.h");
+ else if (part == "LIBMNG")
+ available = findFile("libmng.h");
+ else if (part == "LIBTIFF")
+ available = findFile("tiffio.h");
+ else if (part == "SQL_MYSQL")
+ available = findFile("mysql.h") && findFile("libmySQL.lib");
+ else if (part == "SQL_ODBC")
+ available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
+ else if (part == "SQL_OCI")
+ available = findFile("oci.h") && findFile("oci.lib");
+ else if (part == "SQL_PSQL")
+ available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
+ else if (part == "SQL_TDS")
+ available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
+ else if (part == "SQL_DB2")
+ available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
+ else if (part == "SQL_SQLITE")
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian"))
+ available = false; // In Symbian we only support system sqlite option
+ else
+ available = true; // Built in, we have a fork
+ else if (part == "SQL_SQLITE_LIB") {
+ if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
+ // Symbian has multiple .lib/.dll files we need to find
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ available = true; // There is sqlite_symbian plugin which exports the necessary stuff
+ dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3";
+ } else {
+ available = findFile("sqlite3.h") && findFile("sqlite3.lib");
+ if (available)
+ dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
+ }
+ } else
+ available = true;
+ } else if (part == "SQL_SQLITE2")
+ available = findFile("sqlite.h") && findFile("sqlite.lib");
+ else if (part == "SQL_IBASE")
+ available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
+ else if (part == "IWMMXT")
+ available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
+ else if (part == "OPENGL_ES_CM")
+ available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
+ else if (part == "OPENGL_ES_2")
+ available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
+ else if (part == "DIRECTSHOW")
+ available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
+ else if (part == "SSE2")
+ available = (dictionary.value("QMAKESPEC") != "win32-msvc");
+ else if (part == "3DNOW")
+ available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h");
+ else if (part == "MMX" || part == "SSE")
+ available = (dictionary.value("QMAKESPEC") != "win32-msvc");
+ else if (part == "OPENSSL")
+ available = findFile("openssl\\ssl.h");
+ else if (part == "DBUS")
+ available = findFile("dbus\\dbus.h");
+ else if (part == "CETEST") {
+ QString rapiHeader = locateFile("rapi.h");
+ QString rapiLib = locateFile("rapi.lib");
+ available = (dictionary[ "ARCHITECTURE" ] == "windowsce") && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
+ if (available) {
+ dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
+ dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
+ }
+ else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
+ cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
+ cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+ }
+ else if (part == "INCREDIBUILD_XGE")
+ available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
+ else if (part == "XMLPATTERNS")
+ available = dictionary.value("EXCEPTIONS") == "yes";
+ else if (part == "PHONON") {
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ available = true;
+ } else {
+ available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
+ && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
+ && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
+ && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
+ && findFile("d3d9.h");
+
+ if (!available) {
+ cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
+ << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
+ << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
+ if (!findFile("vmr9.h")) cout << "vmr9.h not found" << endl;
+ if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
+ if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
+ if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
+ if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
+ if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
+ }
+ }
+ } else if (part == "WMSDK") {
+ available = findFile("wmsdk.h");
+ } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS" || part == "DECLARATIVE") {
+ available = true;
+ } else if (part == "WEBKIT") {
+ available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-msvc2010") || (dictionary.value("QMAKESPEC") == "win32-g++");
+ if (dictionary[ "SHARED" ] == "no") {
+ cout << endl << "WARNING: Using static linking will disable the WebKit module." << endl
+ << endl;
+ available = false;
+ }
+ } else if (part == "AUDIO_BACKEND") {
+ available = true;
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ QString epocRoot = Environment::symbianEpocRoot();
+ const QDir epocRootDir(epocRoot);
+ if (epocRootDir.exists()) {
+ QStringList paths;
+ paths << "epoc32/release/armv5/lib/mmfdevsound.dso"
+ << "epoc32/release/armv5/lib/mmfdevsound.lib"
+ << "epoc32/release/winscw/udeb/mmfdevsound.dll"
+ << "epoc32/release/winscw/udeb/mmfdevsound.lib"
+ << "epoc32/include/mmf/server/sounddevice.h";
+
+ QStringList::iterator i = paths.begin();
+ while (i != paths.end()) {
+ const QString &path = epocRoot + *i;
+ if (QFile::exists(path))
+ i = paths.erase(i);
+ else
+ ++i;
+ }
+
+ available = (paths.size() == 0);
+ if (!available) {
+ if (epocRoot.isEmpty())
+ epocRoot = "<empty string>";
+ cout << endl
+ << "The QtMultimedia audio backend will not be built because required" << endl
+ << "support for CMMFDevSound was not found in the SDK." << endl
+ << "The SDK which was examined was located at the following path:" << endl
+ << " " << epocRoot << endl
+ << "The following required files were missing from the SDK:" << endl;
+ QString path;
+ foreach (path, paths)
+ cout << " " << path << endl;
+ cout << endl;
+ }
+ } else {
+ cout << endl
+ << "The SDK root was determined to be '" << epocRoot << "'." << endl
+ << "This directory was not found, so the SDK could not be checked for" << endl
+ << "CMMFDevSound support. The QtMultimedia audio backend will therefore" << endl
+ << "not be built." << endl << endl;
+ available = false;
+ }
+ }
+ } else if (part == "DIRECTWRITE") {
+ available = findFile("dwrite.h") && findFile("d2d1.h") && findFile("dwrite.lib");
+ }
+
+ return available;
+}
+
+/*
+ Autodetect options marked as "auto".
+*/
+void Configure::autoDetection()
+{
+ // Style detection
+ if (dictionary["STYLE_WINDOWSXP"] == "auto")
+ dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
+ if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
+ dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
+
+ // Compression detection
+ if (dictionary["ZLIB"] == "auto")
+ dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
+
+ // Image format detection
+ if (dictionary["GIF"] == "auto")
+ dictionary["GIF"] = defaultTo("GIF");
+ if (dictionary["JPEG"] == "auto")
+ dictionary["JPEG"] = defaultTo("JPEG");
+ if (dictionary["PNG"] == "auto")
+ dictionary["PNG"] = defaultTo("PNG");
+ if (dictionary["MNG"] == "auto")
+ dictionary["MNG"] = defaultTo("MNG");
+ if (dictionary["TIFF"] == "auto")
+ dictionary["TIFF"] = dictionary["ZLIB"] == "no" ? "no" : defaultTo("TIFF");
+ if (dictionary["LIBJPEG"] == "auto")
+ dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
+ if (dictionary["LIBPNG"] == "auto")
+ dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
+ if (dictionary["LIBMNG"] == "auto")
+ dictionary["LIBMNG"] = checkAvailability("LIBMNG") ? defaultTo("LIBMNG") : "qt";
+ if (dictionary["LIBTIFF"] == "auto")
+ dictionary["LIBTIFF"] = checkAvailability("LIBTIFF") ? defaultTo("LIBTIFF") : "qt";
+
+ // SQL detection (not on by default)
+ if (dictionary["SQL_MYSQL"] == "auto")
+ dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
+ if (dictionary["SQL_ODBC"] == "auto")
+ dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
+ if (dictionary["SQL_OCI"] == "auto")
+ dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
+ if (dictionary["SQL_PSQL"] == "auto")
+ dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
+ if (dictionary["SQL_TDS"] == "auto")
+ dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
+ if (dictionary["SQL_DB2"] == "auto")
+ dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
+ if (dictionary["SQL_SQLITE"] == "auto")
+ dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
+ if (dictionary["SQL_SQLITE_LIB"] == "system")
+ if (!checkAvailability("SQL_SQLITE_LIB"))
+ dictionary["SQL_SQLITE_LIB"] = "no";
+ if (dictionary["SQL_SQLITE2"] == "auto")
+ dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
+ if (dictionary["SQL_IBASE"] == "auto")
+ dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
+ if (dictionary["MMX"] == "auto")
+ dictionary["MMX"] = checkAvailability("MMX") ? "yes" : "no";
+ if (dictionary["3DNOW"] == "auto")
+ dictionary["3DNOW"] = checkAvailability("3DNOW") ? "yes" : "no";
+ if (dictionary["SSE"] == "auto")
+ dictionary["SSE"] = checkAvailability("SSE") ? "yes" : "no";
+ if (dictionary["SSE2"] == "auto")
+ dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
+ if (dictionary["IWMMXT"] == "auto")
+ dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
+ if (dictionary["OPENSSL"] == "auto")
+ dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
+ if (dictionary["DBUS"] == "auto")
+ dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
+ if (dictionary["SCRIPT"] == "auto")
+ dictionary["SCRIPT"] = checkAvailability("SCRIPT") ? "yes" : "no";
+ if (dictionary["SCRIPTTOOLS"] == "auto")
+ dictionary["SCRIPTTOOLS"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
+ if (dictionary["XMLPATTERNS"] == "auto")
+ dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
+ if (dictionary["PHONON"] == "auto")
+ dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
+ if (dictionary["WEBKIT"] == "auto")
+ dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
+ if (dictionary["DECLARATIVE"] == "auto")
+ dictionary["DECLARATIVE"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
+ if (dictionary["DECLARATIVE_DEBUG"] == "auto")
+ dictionary["DECLARATIVE_DEBUG"] = dictionary["DECLARATIVE"] == "yes" ? "yes" : "no";
+ if (dictionary["AUDIO_BACKEND"] == "auto")
+ dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
+ if (dictionary["WMSDK"] == "auto")
+ dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
+
+ // Qt/WinCE remote test application
+ if (dictionary["CETEST"] == "auto")
+ dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
+
+ // Detection of IncrediBuild buildconsole
+ if (dictionary["INCREDIBUILD_XGE"] == "auto")
+ dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
+
+ // Mark all unknown "auto" to the default value..
+ for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
+ if (i.value() == "auto")
+ i.value() = defaultTo(i.key());
+ }
+}
+
+bool Configure::verifyConfiguration()
+{
+ if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
+ cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
+ << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
+ << "(Press any key to continue..)";
+ if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+ exit(0); // Exit cleanly for Ctrl+C
+
+ dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
+ }
+ if (dictionary["QMAKESPEC"].endsWith("-g++")
+ && dictionary["SQL_OCI"] != "no") {
+ cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
+ << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
+ << "Oracle driver, as the current build will most likely fail." << endl;
+ cout << "(Press any key to continue..)";
+ if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+ exit(0); // Exit cleanly for Ctrl+C
+ }
+ if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
+ cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
+ << "win32-msvc2002 or win32-msvc2003 instead." << endl;
+ cout << "(Press any key to continue..)";
+ if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+ exit(0); // Exit cleanly for Ctrl+C
+ }
+ if (0 != dictionary["ARM_FPU_TYPE"].size()) {
+ QStringList l= QStringList()
+ << "softvfp"
+ << "softvfp+vfpv2"
+ << "vfpv2";
+ if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
+ cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
+ }
+ if (dictionary["DECLARATIVE"] == "yes" && dictionary["SCRIPT"] == "no") {
+ cout << "WARNING: To be able to compile QtDeclarative we need to also compile the" << endl
+ << "QtScript module. If you continue, we will turn on the QtScript module." << endl
+ << "(Press any key to continue..)";
+ if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+ exit(0); // Exit cleanly for Ctrl+C
+
+ dictionary["SCRIPT"] = "yes";
+ }
+
+ if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) {
+ cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl
+ << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl
+ << "files such as headers and libraries." << endl
+ << "(Press any key to continue..)";
+ if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+ exit(0); // Exit cleanly for Ctrl+C
+ }
+
+ return true;
+}
+
+/*
+ Things that affect the Qt API/ABI:
+ Options:
+ minimal-config small-config medium-config large-config full-config
+
+ Options:
+ debug release
+ stl
+
+ Things that do not affect the Qt API/ABI:
+ system-jpeg no-jpeg jpeg
+ system-mng no-mng mng
+ system-png no-png png
+ system-zlib no-zlib zlib
+ system-tiff no-tiff tiff
+ no-gif gif
+ dll staticlib
+
+ nocrosscompiler
+ GNUmake
+ largefile
+ nis
+ nas
+ tablet
+ ipv6
+
+ X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
+ Embedded: embedded freetype
+*/
+void Configure::generateBuildKey()
+{
+ QString spec = dictionary["QMAKESPEC"];
+
+ QString compiler = "msvc"; // ICC is compatible
+ if (spec.endsWith("-g++"))
+ compiler = "mingw";
+ else if (spec.endsWith("-borland"))
+ compiler = "borland";
+
+ // Build options which changes the Qt API/ABI
+ QStringList build_options;
+ if (!dictionary["QCONFIG"].isEmpty())
+ build_options += dictionary["QCONFIG"] + "-config ";
+ build_options.sort();
+
+ // Sorted defines that start with QT_NO_
+ QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
+ build_defines.sort();
+
+ // Build up the QT_BUILD_KEY ifdef
+ QString buildKey = "QT_BUILD_KEY \"";
+ if (!dictionary["USER_BUILD_KEY"].isEmpty())
+ buildKey += dictionary["USER_BUILD_KEY"] + " ";
+
+ QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
+ QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
+ QString buildSymbianKey = buildKey + "Symbian " + build_options.join(" ") + " " + build_defines.join(" ");
+ build32Key = build32Key.simplified();
+ build64Key = build64Key.simplified();
+ buildSymbianKey = buildSymbianKey.simplified();
+ build32Key.prepend("# define ");
+ build64Key.prepend("# define ");
+ buildSymbianKey.prepend("# define ");
+
+ QString buildkey = "#if defined(__SYMBIAN32__)\n"
+ + buildSymbianKey + "\"\n"
+ "#else\n"
+ // Debug builds
+ "# if !defined(QT_NO_DEBUG)\n"
+ "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
+ + build64Key.arg("debug") + "\"\n"
+ "# else\n"
+ + build32Key.arg("debug") + "\"\n"
+ "# endif\n"
+ "# else\n"
+ // Release builds
+ "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
+ + build64Key.arg("release") + "\"\n"
+ "# else\n"
+ + build32Key.arg("release") + "\"\n"
+ "# endif\n"
+ "# endif\n"
+ "#endif\n";
+
+ dictionary["BUILD_KEY"] = buildkey;
+}
+
+void Configure::generateOutputVars()
+{
+ // Generate variables for output
+ // Build key ----------------------------------------------------
+ if (dictionary.contains("BUILD_KEY")) {
+ qmakeVars += dictionary.value("BUILD_KEY");
+ }
+
+ QString build = dictionary[ "BUILD" ];
+ bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
+ if (build == "debug") {
+ if (buildAll)
+ qtConfig += "release";
+ qtConfig += "debug";
+ } else if (build == "release") {
+ if (buildAll)
+ qtConfig += "debug";
+ qtConfig += "release";
+ }
+
+ // Compression --------------------------------------------------
+ if (dictionary[ "ZLIB" ] == "qt")
+ qtConfig += "zlib";
+ else if (dictionary[ "ZLIB" ] == "system")
+ qtConfig += "system-zlib";
+
+ // Image formates -----------------------------------------------
+ if (dictionary[ "GIF" ] == "no")
+ qtConfig += "no-gif";
+ else if (dictionary[ "GIF" ] == "yes")
+ qtConfig += "gif";
+
+ if (dictionary[ "TIFF" ] == "no")
+ qtConfig += "no-tiff";
+ else if (dictionary[ "TIFF" ] == "yes")
+ qtConfig += "tiff";
+ if (dictionary[ "LIBTIFF" ] == "system")
+ qtConfig += "system-tiff";
+
+ if (dictionary[ "JPEG" ] == "no")
+ qtConfig += "no-jpeg";
+ else if (dictionary[ "JPEG" ] == "yes")
+ qtConfig += "jpeg";
+ if (dictionary[ "LIBJPEG" ] == "system")
+ qtConfig += "system-jpeg";
+
+ if (dictionary[ "PNG" ] == "no")
+ qtConfig += "no-png";
+ else if (dictionary[ "PNG" ] == "yes")
+ qtConfig += "png";
+ if (dictionary[ "LIBPNG" ] == "system")
+ qtConfig += "system-png";
+
+ if (dictionary[ "MNG" ] == "no")
+ qtConfig += "no-mng";
+ else if (dictionary[ "MNG" ] == "yes")
+ qtConfig += "mng";
+ if (dictionary[ "LIBMNG" ] == "system")
+ qtConfig += "system-mng";
+
+ // Text rendering --------------------------------------------------
+ if (dictionary[ "FREETYPE" ] == "yes")
+ qtConfig += "freetype";
+
+ // Styles -------------------------------------------------------
+ if (dictionary[ "STYLE_WINDOWS" ] == "yes")
+ qmakeStyles += "windows";
+
+ if (dictionary[ "STYLE_PLASTIQUE" ] == "yes")
+ qmakeStyles += "plastique";
+
+ if (dictionary[ "STYLE_CLEANLOOKS" ] == "yes")
+ qmakeStyles += "cleanlooks";
+
+ if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
+ qmakeStyles += "windowsxp";
+
+ if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
+ qmakeStyles += "windowsvista";
+
+ if (dictionary[ "STYLE_MOTIF" ] == "yes")
+ qmakeStyles += "motif";
+
+ if (dictionary[ "STYLE_SGI" ] == "yes")
+ qmakeStyles += "sgi";
+
+ if (dictionary[ "STYLE_WINDOWSCE" ] == "yes")
+ qmakeStyles += "windowsce";
+
+ if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
+ qmakeStyles += "windowsmobile";
+
+ if (dictionary[ "STYLE_CDE" ] == "yes")
+ qmakeStyles += "cde";
+
+ if (dictionary[ "STYLE_S60" ] == "yes")
+ qmakeStyles += "s60";
+
+ // Databases ----------------------------------------------------
+ if (dictionary[ "SQL_MYSQL" ] == "yes")
+ qmakeSql += "mysql";
+ else if (dictionary[ "SQL_MYSQL" ] == "plugin")
+ qmakeSqlPlugins += "mysql";
+
+ if (dictionary[ "SQL_ODBC" ] == "yes")
+ qmakeSql += "odbc";
+ else if (dictionary[ "SQL_ODBC" ] == "plugin")
+ qmakeSqlPlugins += "odbc";
+
+ if (dictionary[ "SQL_OCI" ] == "yes")
+ qmakeSql += "oci";
+ else if (dictionary[ "SQL_OCI" ] == "plugin")
+ qmakeSqlPlugins += "oci";
+
+ if (dictionary[ "SQL_PSQL" ] == "yes")
+ qmakeSql += "psql";
+ else if (dictionary[ "SQL_PSQL" ] == "plugin")
+ qmakeSqlPlugins += "psql";
+
+ if (dictionary[ "SQL_TDS" ] == "yes")
+ qmakeSql += "tds";
+ else if (dictionary[ "SQL_TDS" ] == "plugin")
+ qmakeSqlPlugins += "tds";
+
+ if (dictionary[ "SQL_DB2" ] == "yes")
+ qmakeSql += "db2";
+ else if (dictionary[ "SQL_DB2" ] == "plugin")
+ qmakeSqlPlugins += "db2";
+
+ if (dictionary[ "SQL_SQLITE" ] == "yes")
+ qmakeSql += "sqlite";
+ else if (dictionary[ "SQL_SQLITE" ] == "plugin")
+ qmakeSqlPlugins += "sqlite";
+
+ if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
+ qmakeConfig += "system-sqlite";
+
+ if (dictionary[ "SQL_SQLITE2" ] == "yes")
+ qmakeSql += "sqlite2";
+ else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
+ qmakeSqlPlugins += "sqlite2";
+
+ if (dictionary[ "SQL_IBASE" ] == "yes")
+ qmakeSql += "ibase";
+ else if (dictionary[ "SQL_IBASE" ] == "plugin")
+ qmakeSqlPlugins += "ibase";
+
+ // Other options ------------------------------------------------
+ if (dictionary[ "BUILDALL" ] == "yes") {
+ qmakeConfig += "build_all";
+ }
+ qmakeConfig += dictionary[ "BUILD" ];
+ dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
+
+ if (dictionary[ "SHARED" ] == "yes") {
+ QString version = dictionary[ "VERSION" ];
+ if (!version.isEmpty()) {
+ qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf("."));
+ version.remove(QLatin1Char('.'));
+ }
+ dictionary[ "QMAKE_OUTDIR" ] += "_shared";
+ } else {
+ dictionary[ "QMAKE_OUTDIR" ] += "_static";
+ }
+
+ if (dictionary[ "ACCESSIBILITY" ] == "yes")
+ qtConfig += "accessibility";
+
+ if (!qmakeLibs.isEmpty())
+ qmakeVars += "LIBS += " + escapeSeparators(qmakeLibs.join(" "));
+
+ if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
+ qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]);
+
+ if (dictionary[ "QT3SUPPORT" ] == "yes")
+ qtConfig += "qt3support";
+
+ if (dictionary[ "OPENGL" ] == "yes")
+ qtConfig += "opengl";
+
+ if (dictionary["OPENGL_ES_CM"] == "yes") {
+ qtConfig += "opengles1";
+ qtConfig += "egl";
+ }
+
+ if (dictionary["OPENGL_ES_2"] == "yes") {
+ qtConfig += "opengles2";
+ qtConfig += "egl";
+ }
+
+ if (dictionary["OPENVG"] == "yes") {
+ qtConfig += "openvg";
+ qtConfig += "egl";
+ }
+
+ if (dictionary["S60"] == "yes") {
+ qtConfig += "s60";
+ }
+
+ if (dictionary["DIRECTSHOW"] == "yes")
+ qtConfig += "directshow";
+
+ if (dictionary[ "OPENSSL" ] == "yes")
+ qtConfig += "openssl";
+ else if (dictionary[ "OPENSSL" ] == "linked")
+ qtConfig += "openssl-linked";
+
+ if (dictionary[ "DBUS" ] == "yes")
+ qtConfig += "dbus";
+ else if (dictionary[ "DBUS" ] == "linked")
+ qtConfig += "dbus dbus-linked";
+
+ if (dictionary["IPV6"] == "yes")
+ qtConfig += "ipv6";
+ else if (dictionary["IPV6"] == "no")
+ qtConfig += "no-ipv6";
+
+ if (dictionary[ "CETEST" ] == "yes")
+ qtConfig += "cetest";
+
+ if (dictionary[ "SCRIPT" ] == "yes")
+ qtConfig += "script";
+
+ if (dictionary[ "SCRIPTTOOLS" ] == "yes") {
+ if (dictionary[ "SCRIPT" ] == "no") {
+ cout << "QtScriptTools was requested, but it can't be built due to QtScript being "
+ "disabled." << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+ qtConfig += "scripttools";
+ }
+
+ if (dictionary[ "XMLPATTERNS" ] == "yes")
+ qtConfig += "xmlpatterns";
+
+ if (dictionary["PHONON"] == "yes") {
+ qtConfig += "phonon";
+ if (dictionary["PHONON_BACKEND"] == "yes")
+ qtConfig += "phonon-backend";
+ }
+
+ if (dictionary["MULTIMEDIA"] == "yes") {
+ qtConfig += "multimedia";
+ if (dictionary["AUDIO_BACKEND"] == "yes")
+ qtConfig += "audio-backend";
+ }
+
+ QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri";
+ QFile::remove(dst);
+ if (dictionary["WEBKIT"] != "no") {
+ // This include takes care of adding "webkit" to QT_CONFIG.
+ QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri";
+ QFile::copy(src, dst);
+ if (dictionary["WEBKIT"] == "debug")
+ qtConfig += "webkit-debug";
+ }
+
+ if (dictionary["DECLARATIVE"] == "yes") {
+ if (dictionary[ "SCRIPT" ] == "no") {
+ cout << "QtDeclarative was requested, but it can't be built due to QtScript being "
+ "disabled." << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+ qtConfig += "declarative";
+ }
+
+ if (dictionary["DIRECTWRITE"] == "yes")
+ qtConfig += "directwrite";
+
+ if (dictionary[ "NATIVE_GESTURES" ] == "yes")
+ qtConfig += "native-gestures";
+
+ // We currently have no switch for QtSvg, so add it unconditionally.
+ qtConfig += "svg";
+
+ // Add config levels --------------------------------------------
+ QStringList possible_configs = QStringList()
+ << "minimal"
+ << "small"
+ << "medium"
+ << "large"
+ << "full";
+
+ QString set_config = dictionary["QCONFIG"];
+ if (possible_configs.contains(set_config)) {
+ foreach (const QString &cfg, possible_configs) {
+ qtConfig += (cfg + "-config");
+ if (cfg == set_config)
+ break;
+ }
+ }
+
+ if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"]))
+ qmakeConfig += "cross_compile";
+
+ // Directories and settings for .qmake.cache --------------------
+
+ // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
+ // if prefix is empty (WINCE), make all of them empty, if they aren't set
+ bool qipempty = false;
+ if (dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
+ qipempty = true;
+
+ if (!dictionary[ "QT_INSTALL_DOCS" ].size())
+ dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/doc");
+ if (!dictionary[ "QT_INSTALL_HEADERS" ].size())
+ dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/include");
+ if (!dictionary[ "QT_INSTALL_LIBS" ].size())
+ dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/lib");
+ if (!dictionary[ "QT_INSTALL_BINS" ].size())
+ dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/bin");
+ if (!dictionary[ "QT_INSTALL_PLUGINS" ].size())
+ dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins");
+ if (!dictionary[ "QT_INSTALL_IMPORTS" ].size())
+ dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/imports");
+ if (!dictionary[ "QT_INSTALL_DATA" ].size())
+ dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ]);
+ if (!dictionary[ "QT_INSTALL_TRANSLATIONS" ].size())
+ dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/translations");
+ if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size())
+ dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
+ if (!dictionary[ "QT_INSTALL_DEMOS" ].size())
+ dictionary[ "QT_INSTALL_DEMOS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/demos");
+
+ if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
+ dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
+
+ qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true);
+ qmakeVars += QString("MOC_DIR = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true);
+ qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true);
+
+ if (!qmakeDefines.isEmpty())
+ qmakeVars += QString("DEFINES += ") + qmakeDefines.join(" ");
+ if (!qmakeIncludes.isEmpty())
+ qmakeVars += QString("INCLUDEPATH += ") + escapeSeparators(qmakeIncludes.join(" "));
+ if (!opensslLibs.isEmpty())
+ qmakeVars += opensslLibs;
+ else if (dictionary[ "OPENSSL" ] == "linked") {
+ if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("symbian"))
+ qmakeVars += QString("OPENSSL_LIBS = -llibssl -llibcrypto");
+ else
+ qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
+ }
+ if (!psqlLibs.isEmpty())
+ qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
+
+ {
+ QStringList lflagsTDS;
+ if (!sybase.isEmpty())
+ lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib");
+ if (!sybaseLibs.isEmpty())
+ lflagsTDS += sybaseLibs.section("=", 1);
+ if (!lflagsTDS.isEmpty())
+ qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" ");
+ }
+
+ if (!qmakeSql.isEmpty())
+ qmakeVars += QString("sql-drivers += ") + qmakeSql.join(" ");
+ if (!qmakeSqlPlugins.isEmpty())
+ qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(" ");
+ if (!qmakeStyles.isEmpty())
+ qmakeVars += QString("styles += ") + qmakeStyles.join(" ");
+ if (!qmakeStylePlugins.isEmpty())
+ qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(" ");
+
+ if (dictionary["QMAKESPEC"].endsWith("-g++")) {
+ QString includepath = qgetenv("INCLUDE");
+ bool hasSh = Environment::detectExecutable("sh.exe");
+ QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
+ qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
+ qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
+ qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
+ qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
+ }
+
+ if (!dictionary[ "QMAKESPEC" ].length()) {
+ cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
+ << "be defined as an environment variable, or specified as an" << endl
+ << "argument with -platform" << endl;
+ dictionary[ "HELP" ] = "yes";
+
+ QStringList winPlatforms;
+ QDir mkspecsDir(sourcePath + "/mkspecs");
+ const QFileInfoList &specsList = mkspecsDir.entryInfoList();
+ for (int i = 0; i < specsList.size(); ++i) {
+ const QFileInfo &fi = specsList.at(i);
+ if (fi.fileName().left(5) == "win32") {
+ winPlatforms += fi.fileName();
+ }
+ }
+ cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+}
+
+#if !defined(EVAL)
+void Configure::generateCachefile()
+{
+ // Generate .qmake.cache
+ QFile cacheFile(buildPath + "/.qmake.cache");
+ if (cacheFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
+ QTextStream cacheStream(&cacheFile);
+ for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) {
+ cacheStream << (*var) << endl;
+ }
+ cacheStream << "CONFIG += " << qmakeConfig.join(" ") << " incremental msvc_mp create_prl link_prl depend_includepath QTDIR_build" << endl;
+
+ QStringList buildParts;
+ buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations";
+ foreach (const QString &item, disabledBuildParts) {
+ buildParts.removeAll(item);
+ }
+ cacheStream << "QT_BUILD_PARTS = " << buildParts.join(" ") << endl;
+
+ QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
+ QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
+ if (QFile::exists(mkspec_path))
+ cacheStream << "QMAKESPEC = " << escapeSeparators(mkspec_path) << endl;
+ else
+ cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec, true) << endl;
+ cacheStream << "ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
+ cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl;
+ cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl;
+
+ if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
+ cacheStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
+
+ //so that we can build without an install first (which would be impossible)
+ cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe", true) << endl;
+ cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe", true) << endl;
+ cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe", true) << endl;
+ cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe", true) << endl;
+ cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe", true) << endl;
+ cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl;
+ cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl;
+ if (dictionary["CETEST"] == "yes") {
+ cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl;
+ cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl;
+ }
+
+ // embedded
+ if (!dictionary["KBD_DRIVERS"].isEmpty())
+ cacheStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
+ if (!dictionary["GFX_DRIVERS"].isEmpty())
+ cacheStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
+ if (!dictionary["MOUSE_DRIVERS"].isEmpty())
+ cacheStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
+ if (!dictionary["DECORATIONS"].isEmpty())
+ cacheStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
+
+ if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
+ cacheStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"];
+
+ cacheStream.flush();
+ cacheFile.close();
+ }
+ QFile configFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri");
+ if (configFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
+ QTextStream configStream(&configFile);
+ configStream << "CONFIG+= ";
+ configStream << dictionary[ "BUILD" ];
+ if (dictionary[ "SHARED" ] == "yes")
+ configStream << " shared";
+ else
+ configStream << " static";
+
+ if (dictionary[ "LTCG" ] == "yes")
+ configStream << " ltcg";
+ if (dictionary[ "MSVC_MP" ] == "yes")
+ configStream << " msvc_mp";
+ if (dictionary[ "STL" ] == "yes")
+ configStream << " stl";
+ if (dictionary[ "EXCEPTIONS" ] == "yes")
+ configStream << " exceptions";
+ if (dictionary[ "EXCEPTIONS" ] == "no")
+ configStream << " exceptions_off";
+ if (dictionary[ "RTTI" ] == "yes")
+ configStream << " rtti";
+ if (dictionary[ "MMX" ] == "yes")
+ configStream << " mmx";
+ if (dictionary[ "3DNOW" ] == "yes")
+ configStream << " 3dnow";
+ if (dictionary[ "SSE" ] == "yes")
+ configStream << " sse";
+ if (dictionary[ "SSE2" ] == "yes")
+ configStream << " sse2";
+ if (dictionary[ "IWMMXT" ] == "yes")
+ configStream << " iwmmxt";
+ if (dictionary["INCREDIBUILD_XGE"] == "yes")
+ configStream << " incredibuild_xge";
+ if (dictionary["PLUGIN_MANIFESTS"] == "no")
+ configStream << " no_plugin_manifest";
+
+ if (dictionary.contains("SYMBIAN_DEFFILES")) {
+ if (dictionary["SYMBIAN_DEFFILES"] == "yes") {
+ configStream << " def_files";
+ } else if (dictionary["SYMBIAN_DEFFILES"] == "no") {
+ configStream << " def_files_disabled";
+ }
+ }
+
+ if (dictionary["DIRECTWRITE"] == "yes")
+ configStream << "directwrite";
+
+ configStream << endl;
+ configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
+ if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
+ configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
+ else
+ configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
+ configStream << "QT_CONFIG += " << qtConfig.join(" ") << endl;
+
+ configStream << "#versioning " << endl
+ << "QT_VERSION = " << dictionary["VERSION"] << endl
+ << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
+ << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
+ << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
+
+ configStream << "#Qt for Windows CE c-runtime deployment" << endl
+ << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl;
+
+ if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
+ configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
+
+ if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
+ configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
+
+ if (!dictionary["QT_LIBINFIX"].isEmpty())
+ configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
+
+ configStream << "#Qt for Symbian FPU settings" << endl;
+ if (!dictionary["ARM_FPU_TYPE"].isEmpty()) {
+ configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\"";
+ }
+ if (!dictionary["QT_NAMESPACE"].isEmpty()) {
+ configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
+ }
+
+ configStream.flush();
+ configFile.close();
+ }
+}
+#endif
+
+QString Configure::addDefine(QString def)
+{
+ QString result, defNeg, defD = def;
+
+ defD.replace(QRegExp("=.*"), "");
+ def.replace(QRegExp("="), " ");
+
+ if (def.startsWith("QT_NO_")) {
+ defNeg = defD;
+ defNeg.replace("QT_NO_", "QT_");
+ } else if (def.startsWith("QT_")) {
+ defNeg = defD;
+ defNeg.replace("QT_", "QT_NO_");
+ }
+
+ if (defNeg.isEmpty()) {
+ result = "#ifndef $DEFD\n"
+ "# define $DEF\n"
+ "#endif\n\n";
+ } else {
+ result = "#if defined($DEFD) && defined($DEFNEG)\n"
+ "# undef $DEFD\n"
+ "#elif !defined($DEFD)\n"
+ "# define $DEF\n"
+ "#endif\n\n";
+ }
+ result.replace("$DEFNEG", defNeg);
+ result.replace("$DEFD", defD);
+ result.replace("$DEF", def);
+ return result;
+}
+
+#if !defined(EVAL)
+void Configure::generateConfigfiles()
+{
+ QDir(buildPath).mkpath("src/corelib/global");
+ QString outName(buildPath + "/src/corelib/global/qconfig.h");
+ QTemporaryFile tmpFile;
+ QTextStream tmpStream;
+
+ if (tmpFile.open()) {
+ tmpStream.setDevice(&tmpFile);
+
+ if (dictionary[ "QCONFIG" ] == "full") {
+ tmpStream << "/* Everything */" << endl;
+ } else {
+ QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
+ tmpStream << "/* Copied from " << configName << "*/" << endl;
+ tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
+ QFile inFile(sourcePath + "/src/corelib/global/" + configName);
+ if (inFile.open(QFile::ReadOnly)) {
+ QByteArray buffer = inFile.readAll();
+ tmpFile.write(buffer.constData(), buffer.size());
+ inFile.close();
+ }
+ tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
+ }
+ tmpStream << endl;
+
+ if (dictionary[ "SHARED" ] == "yes") {
+ tmpStream << "#ifndef QT_DLL" << endl;
+ tmpStream << "#define QT_DLL" << endl;
+ tmpStream << "#endif" << endl;
+ }
+ tmpStream << endl;
+ tmpStream << "/* License information */" << endl;
+ tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
+ tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
+ tmpStream << endl;
+ tmpStream << "// Qt Edition" << endl;
+ tmpStream << "#ifndef QT_EDITION" << endl;
+ tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
+ tmpStream << "#endif" << endl;
+ tmpStream << endl;
+ tmpStream << dictionary["BUILD_KEY"];
+ tmpStream << endl;
+ if (dictionary["BUILDDEV"] == "yes") {
+ dictionary["QMAKE_INTERNAL"] = "yes";
+ tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
+ tmpStream << "#define QT_BUILD_INTERNAL" << endl;
+ tmpStream << endl;
+ }
+ tmpStream << "/* Machine byte-order */" << endl;
+ tmpStream << "#define Q_BIG_ENDIAN 4321" << endl;
+ tmpStream << "#define Q_LITTLE_ENDIAN 1234" << endl;
+ tmpStream << "#define Q_BYTE_ORDER Q_LITTLE_ENDIAN" << endl;
+
+ tmpStream << endl << "// Compile time features" << endl;
+ tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl;
+ if (dictionary["GRAPHICS_SYSTEM"] == "runtime" && dictionary["RUNTIME_SYSTEM"] != "runtime")
+ tmpStream << "#define QT_DEFAULT_RUNTIME_SYSTEM \"" << dictionary["RUNTIME_SYSTEM"] << "\"" << endl;
+
+ QStringList qconfigList;
+ if (dictionary["STL"] == "no") qconfigList += "QT_NO_STL";
+ if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
+ if (dictionary["STYLE_PLASTIQUE"] != "yes") qconfigList += "QT_NO_STYLE_PLASTIQUE";
+ if (dictionary["STYLE_CLEANLOOKS"] != "yes") qconfigList += "QT_NO_STYLE_CLEANLOOKS";
+ if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
+ qconfigList += "QT_NO_STYLE_WINDOWSXP";
+ if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
+ if (dictionary["STYLE_MOTIF"] != "yes") qconfigList += "QT_NO_STYLE_MOTIF";
+ if (dictionary["STYLE_CDE"] != "yes") qconfigList += "QT_NO_STYLE_CDE";
+ if (dictionary["STYLE_S60"] != "yes") qconfigList += "QT_NO_STYLE_S60";
+ if (dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
+ if (dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
+ if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
+
+ if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
+ if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
+ if (dictionary["MNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_MNG";
+ if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
+ if (dictionary["TIFF"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
+ if (dictionary["ZLIB"] == "no") {
+ qconfigList += "QT_NO_ZLIB";
+ qconfigList += "QT_NO_COMPRESS";
+ }
+
+ if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
+ if (dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
+ if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
+ if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
+ if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
+ if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
+ if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
+ if (dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6";
+ if (dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT";
+ if (dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE";
+ if (dictionary["DECLARATIVE_DEBUG"] == "no") qconfigList += "QDECLARATIVE_NO_DEBUG_PROTOCOL";
+ if (dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON";
+ if (dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA";
+ if (dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS";
+ if (dictionary["SCRIPT"] == "no") qconfigList += "QT_NO_SCRIPT";
+ if (dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS";
+ if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
+ if (dictionary["S60"] == "no") qconfigList += "QT_NO_S60";
+ if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
+
+ if (dictionary["OPENGL_ES_CM"] == "no" &&
+ dictionary["OPENGL_ES_2"] == "no" &&
+ dictionary["OPENVG"] == "no") qconfigList += "QT_NO_EGL";
+
+ if (dictionary["OPENGL_ES_CM"] == "yes" ||
+ dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
+
+ if (dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
+ if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
+ if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
+ if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
+ if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
+ if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
+ if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
+ if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
+ if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
+ if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
+ if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
+
+ if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG";
+ if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL";
+ if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER";
+ if (dictionary["GRAPHICS_SYSTEM"] == "runtime") qconfigList += "QT_GRAPHICSSYSTEM_RUNTIME";
+
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ // These features are not ported to Symbian (yet)
+ qconfigList += "QT_NO_CONCURRENT";
+ qconfigList += "QT_NO_QFUTURE";
+ qconfigList += "QT_NO_CRASHHANDLER";
+ qconfigList += "QT_NO_PRINTER";
+ qconfigList += "QT_NO_SYSTEMTRAYICON";
+ if (dictionary.contains("QT_LIBINFIX"))
+ tmpStream << QString("#define QT_LIBINFIX \"%1\"").arg(dictionary["QT_LIBINFIX"]) << endl;
+ }
+
+ qconfigList.sort();
+ for (int i = 0; i < qconfigList.count(); ++i)
+ tmpStream << addDefine(qconfigList.at(i));
+
+ if (dictionary["EMBEDDED"] == "yes")
+ {
+ // Check for keyboard, mouse, gfx.
+ QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
+ QStringList allKbdDrivers;
+ allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
+ foreach (const QString &kbd, allKbdDrivers) {
+ if (!kbdDrivers.contains(kbd))
+ tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
+ }
+
+ QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
+ QStringList allMouseDrivers;
+ allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
+ foreach (const QString &mouse, allMouseDrivers) {
+ if (!mouseDrivers.contains(mouse))
+ tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
+ }
+
+ QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
+ QStringList allGfxDrivers;
+ allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
+ foreach (const QString &gfx, allGfxDrivers) {
+ if (!gfxDrivers.contains(gfx))
+ tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
+ }
+
+ tmpStream<<"#define Q_WS_QWS"<<endl;
+
+ QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
+ foreach (const QString &depth, depths)
+ tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
+ }
+
+ if (dictionary[ "QT_CUPS" ] == "no")
+ tmpStream<<"#define QT_NO_CUPS"<<endl;
+
+ if (dictionary[ "QT_ICONV" ] == "no")
+ tmpStream<<"#define QT_NO_ICONV"<<endl;
+
+ if (dictionary[ "QT_GLIB" ] == "no")
+ tmpStream<<"#define QT_NO_GLIB"<<endl;
+
+ if (dictionary[ "QT_LPR" ] == "no")
+ tmpStream<<"#define QT_NO_LPR"<<endl;
+
+ if (dictionary[ "QT_INOTIFY" ] == "no")
+ tmpStream<<"#define QT_NO_INOTIFY"<<endl;
+
+ if (dictionary[ "QT_SXE" ] == "no")
+ tmpStream<<"#define QT_NO_SXE"<<endl;
+
+ tmpStream.flush();
+ tmpFile.flush();
+
+ // Replace old qconfig.h with new one
+ ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
+ QFile::remove(outName);
+ tmpFile.copy(outName);
+ tmpFile.close();
+ }
+
+ // Copy configured mkspec to default directory, but remove the old one first, if there is any
+ QString defSpec = buildPath + "/mkspecs/default";
+ QFileInfo defSpecInfo(defSpec);
+ if (defSpecInfo.exists()) {
+ if (!Environment::rmdir(defSpec)) {
+ cout << "Couldn't update default mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
+ dictionary["DONE"] = "error";
+ return;
+ }
+ }
+
+ QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
+ QString pltSpec = sourcePath + "/mkspecs/" + spec;
+ QString includeSpec = buildPath + "/mkspecs/" + spec;
+ if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
+ cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
+ dictionary["DONE"] = "error";
+ return;
+ }
+
+ // Generate the new qconfig.cpp file
+ QDir(buildPath).mkpath("src/corelib/global");
+ outName = buildPath + "/src/corelib/global/qconfig.cpp";
+
+ QTemporaryFile tmpFile2;
+ if (tmpFile2.open()) {
+ tmpStream.setDevice(&tmpFile2);
+ tmpStream << "/* Licensed */" << endl
+ << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
+ << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
+ << endl
+ << "/* Build date */" << endl
+ << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
+ << endl;
+ if (!dictionary[ "QT_HOST_PREFIX" ].isNull())
+ tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
+ tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl
+ << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";" << endl
+ << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";" << endl
+ << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";" << endl
+ << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";" << endl
+ << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";" << endl
+ << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";" << endl
+ << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl
+ << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl
+ << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl
+ << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << escapeSeparators(dictionary["QT_INSTALL_DEMOS"]) << "\";" << endl
+ //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
+ ;
+ if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
+ tmpStream << "#else" << endl
+ << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl
+ << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";" << endl
+ << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";" << endl
+ << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";" << endl
+ << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";" << endl
+ << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";" << endl
+ << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";" << endl
+ << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl
+ << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl
+ << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl
+ << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos", true) <<"\";" << endl
+ << "#endif //QT_BOOTSTRAPPED" << endl;
+ }
+ tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
+ << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
+ << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
+ << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl
+ << "#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;" << endl
+ //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
+ << endl;
+
+ tmpStream.flush();
+ tmpFile2.flush();
+
+ // Replace old qconfig.cpp with new one
+ ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
+ QFile::remove(outName);
+ tmpFile2.copy(outName);
+ tmpFile2.close();
+ }
+
+ QTemporaryFile tmpFile3;
+ if (tmpFile3.open()) {
+ tmpStream.setDevice(&tmpFile3);
+ tmpStream << "/* Evaluation license key */" << endl
+ << "static const volatile char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
+
+ tmpStream.flush();
+ tmpFile3.flush();
+
+ outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
+ ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
+ QFile::remove(outName);
+
+ if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
+ tmpFile3.copy(outName);
+ tmpFile3.close();
+ }
+}
+#endif
+
+#if !defined(EVAL)
+void Configure::displayConfig()
+{
+ // Give some feedback
+ cout << "Environment:" << endl;
+ QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
+ if (env.isEmpty())
+ env = "Unset";
+ cout << " INCLUDE=\r\n " << env << endl;
+ env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
+ if (env.isEmpty())
+ env = "Unset";
+ cout << " LIB=\r\n " << env << endl;
+ env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
+ if (env.isEmpty())
+ env = "Unset";
+ cout << " PATH=\r\n " << env << endl;
+
+ if (dictionary["EDITION"] == "OpenSource") {
+ cout << "You are licensed to use this software under the terms of the GNU GPL version 3.";
+ cout << "You are licensed to use this software under the terms of the Lesser GNU LGPL version 2.1." << endl;
+ cout << "See " << dictionary["LICENSE FILE"] << "3" << endl << endl
+ << " or " << dictionary["LICENSE FILE"] << "L" << endl << endl;
+ } else {
+ QString l1 = licenseInfo[ "LICENSEE" ];
+ QString l2 = licenseInfo[ "LICENSEID" ];
+ QString l3 = dictionary["EDITION"] + ' ' + "Edition";
+ QString l4 = licenseInfo[ "EXPIRYDATE" ];
+ cout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
+ cout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
+ cout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
+ cout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
+ }
+
+ cout << "Configuration:" << endl;
+ cout << " " << qmakeConfig.join("\r\n ") << endl;
+ cout << "Qt Configuration:" << endl;
+ cout << " " << qtConfig.join("\r\n ") << endl;
+ cout << endl;
+
+ if (dictionary.contains("XQMAKESPEC"))
+ cout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
+ else
+ cout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
+ cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl;
+ cout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
+ cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
+ cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
+ cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
+ cout << "STL support................." << dictionary[ "STL" ] << endl;
+ cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl;
+ cout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
+ cout << "MMX support................." << dictionary[ "MMX" ] << endl;
+ cout << "3DNOW support..............." << dictionary[ "3DNOW" ] << endl;
+ cout << "SSE support................." << dictionary[ "SSE" ] << endl;
+ cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
+ cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
+ cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
+ cout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
+ cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
+ cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
+ cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
+ cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
+ cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl;
+ {
+ QString webkit = dictionary[ "WEBKIT" ];
+ if (webkit == "debug")
+ webkit = "yes (debug)";
+ cout << "WebKit support.............." << webkit << endl;
+ }
+ {
+ QString declarative = dictionary[ "DECLARATIVE" ];
+ cout << "Declarative support........." << declarative << endl;
+ if (declarative == "yes")
+ cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl;
+ }
+ cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
+ cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
+ cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl;
+ cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl;
+ cout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl;
+
+ cout << "Third Party Libraries:" << endl;
+ cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
+ cout << " GIF support............." << dictionary[ "GIF" ] << endl;
+ cout << " TIFF support............" << dictionary[ "TIFF" ] << endl;
+ cout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
+ cout << " PNG support............." << dictionary[ "PNG" ] << endl;
+ cout << " MNG support............." << dictionary[ "MNG" ] << endl;
+ cout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
+
+ cout << "Styles:" << endl;
+ cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
+ cout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
+ cout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
+ cout << " Plastique..............." << dictionary[ "STYLE_PLASTIQUE" ] << endl;
+ cout << " Cleanlooks.............." << dictionary[ "STYLE_CLEANLOOKS" ] << endl;
+ cout << " Motif..................." << dictionary[ "STYLE_MOTIF" ] << endl;
+ cout << " CDE....................." << dictionary[ "STYLE_CDE" ] << endl;
+ cout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
+ cout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl;
+ cout << " S60....................." << dictionary[ "STYLE_S60" ] << endl << endl;
+
+ cout << "Sql Drivers:" << endl;
+ cout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
+ cout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
+ cout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
+ cout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
+ cout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
+ cout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
+ cout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
+ cout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
+ cout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
+
+ cout << "Sources are in.............." << dictionary[ "QT_SOURCE_TREE" ] << endl;
+ cout << "Build is done in............" << dictionary[ "QT_BUILD_TREE" ] << endl;
+ cout << "Install prefix.............." << dictionary[ "QT_INSTALL_PREFIX" ] << endl;
+ cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl;
+ cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
+ cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
+ cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl;
+ cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
+ cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
+ cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
+ cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
+ cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
+ cout << "Demos installed to.........." << dictionary[ "QT_INSTALL_DEMOS" ] << endl << endl;
+
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
+ cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
+ cout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
+ cout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
+ }
+
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("symbian"))) {
+ cout << "Support for S60............." << dictionary[ "S60" ] << endl;
+ }
+
+ if (dictionary.contains("SYMBIAN_DEFFILES")) {
+ cout << "Symbian DEF files enabled..." << dictionary[ "SYMBIAN_DEFFILES" ] << endl;
+ if (dictionary["SYMBIAN_DEFFILES"] == "no") {
+ cout << "WARNING: Disabling DEF files will mean that Qt is NOT binary compatible with previous versions." << endl;
+ cout << " This feature is only intended for use during development, NEVER for release builds." << endl;
+ }
+ }
+
+ if (dictionary["ASSISTANT_WEBKIT"] == "yes")
+ cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
+
+ if (checkAvailability("INCREDIBUILD_XGE"))
+ cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
+ if (!qmakeDefines.isEmpty()) {
+ cout << "Defines.....................";
+ for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
+ cout << (*defs) << " ";
+ cout << endl;
+ }
+ if (!qmakeIncludes.isEmpty()) {
+ cout << "Include paths...............";
+ for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
+ cout << (*incs) << " ";
+ cout << endl;
+ }
+ if (!qmakeLibs.isEmpty()) {
+ cout << "Additional libraries........";
+ for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
+ cout << (*libs) << " ";
+ cout << endl;
+ }
+ if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
+ cout << "Using internal configuration." << endl;
+ }
+ if (dictionary[ "SHARED" ] == "no") {
+ cout << "WARNING: Using static linking will disable the use of plugins." << endl;
+ cout << " Make sure you compile ALL needed modules into the library." << endl;
+ }
+ if (dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty()) {
+ cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
+ cout << "library names through OPENSSL_LIBS." << endl;
+ cout << "For example:" << endl;
+ cout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
+ }
+ if (dictionary[ "ZLIB_FORCED" ] == "yes") {
+ QString which_zlib = "supplied";
+ if (dictionary[ "ZLIB" ] == "system")
+ which_zlib = "system";
+
+ cout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
+ << endl
+ << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
+ << "option was ignored. Qt will be built using the " << which_zlib
+ << "zlib" << endl;
+ }
+}
+#endif
+
+#if !defined(EVAL)
+void Configure::generateHeaders()
+{
+ if (dictionary["SYNCQT"] == "yes"
+ && findFile("perl.exe")) {
+ cout << "Running syncqt..." << endl;
+ QStringList args;
+ args += buildPath + "/bin/syncqt.bat";
+ QStringList env;
+ env += QString("QTDIR=" + sourcePath);
+ env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH"));
+ int retc = Environment::execute(args, env, QStringList());
+ if (retc) {
+ cout << "syncqt failed, return code " << retc << endl << endl;
+ dictionary["DONE"] = "error";
+ }
+ }
+}
+
+void Configure::buildQmake()
+{
+ if (dictionary[ "BUILD_QMAKE" ] == "yes") {
+ QStringList args;
+
+ // Build qmake
+ QString pwd = QDir::currentPath();
+ QDir::setCurrent(buildPath + "/qmake");
+
+ QString makefile = "Makefile";
+ {
+ QFile out(makefile);
+ if (out.open(QFile::WriteOnly | QFile::Text)) {
+ QTextStream stream(&out);
+ stream << "#AutoGenerated by configure.exe" << endl
+ << "BUILD_PATH = " << QDir::convertSeparators(buildPath) << endl
+ << "SOURCE_PATH = " << QDir::convertSeparators(sourcePath) << endl;
+ stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl;
+
+ if (dictionary["EDITION"] == "OpenSource" ||
+ dictionary["QT_EDITION"].contains("OPENSOURCE"))
+ stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
+ stream << "\n\n";
+
+ QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
+ if (in.open(QFile::ReadOnly | QFile::Text)) {
+ QString d = in.readAll();
+ //### need replaces (like configure.sh)? --Sam
+ stream << d << endl;
+ }
+ stream.flush();
+ out.close();
+ }
+ }
+
+ args += dictionary[ "MAKE" ];
+ args += "-f";
+ args += makefile;
+
+ cout << "Creating qmake..." << endl;
+ int exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ args.clear();
+ args += dictionary[ "MAKE" ];
+ args += "-f";
+ args += makefile;
+ args += "clean";
+ exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
+ dictionary[ "DONE" ] = "error";
+ } else {
+ args.clear();
+ args += dictionary[ "MAKE" ];
+ args += "-f";
+ args += makefile;
+ exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ cout << "Building qmake failed, return code " << exitCode << endl << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+ }
+ }
+ QDir::setCurrent(pwd);
+ }
+}
+#endif
+
+void Configure::buildHostTools()
+{
+ if (dictionary[ "NOPROCESS" ] == "yes")
+ dictionary[ "DONE" ] = "yes";
+
+ if (!dictionary.contains("XQMAKESPEC"))
+ return;
+
+ QString pwd = QDir::currentPath();
+ QStringList hostToolsDirs;
+ hostToolsDirs
+ << "src/tools"
+ << "tools/linguist/lrelease";
+
+ if (dictionary["XQMAKESPEC"].startsWith("wince"))
+ hostToolsDirs << "tools/checksdk";
+
+ if (dictionary[ "CETEST" ] == "yes")
+ hostToolsDirs << "tools/qtestlib/wince/cetest";
+
+ for (int i = 0; i < hostToolsDirs.count(); ++i) {
+ cout << "Creating " << hostToolsDirs.at(i) << " ..." << endl;
+ QString toolBuildPath = buildPath + "/" + hostToolsDirs.at(i);
+ QString toolSourcePath = sourcePath + "/" + hostToolsDirs.at(i);
+
+ // generate Makefile
+ QStringList args;
+ args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
+ // override .qmake.cache because we are not cross-building these.
+ // we need a full path so that a build with -prefix will still find it.
+ args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]);
+ args << "-r";
+ args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
+
+ QDir().mkpath(toolBuildPath);
+ QDir::setCurrent(toolSourcePath);
+ int exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ cout << "qmake failed, return code " << exitCode << endl << endl;
+ dictionary["DONE"] = "error";
+ break;
+ }
+
+ // build app
+ args.clear();
+ args += dictionary["MAKE"];
+ QDir::setCurrent(toolBuildPath);
+ exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ args.clear();
+ args += dictionary["MAKE"];
+ args += "clean";
+ exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
+ dictionary["DONE"] = "error";
+ break;
+ } else {
+ args.clear();
+ args += dictionary["MAKE"];
+ exitCode = Environment::execute(args, QStringList(), QStringList());
+ if (exitCode) {
+ cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
+ dictionary["DONE"] = "error";
+ break;
+ }
+ }
+ }
+ }
+ QDir::setCurrent(pwd);
+}
+
+void Configure::findProjects(const QString& dirName)
+{
+ if (dictionary[ "NOPROCESS" ] == "no") {
+ QDir dir(dirName);
+ QString entryName;
+ int makeListNumber;
+ ProjectType qmakeTemplate;
+ const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
+ QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+ for (int i = 0; i < list.size(); ++i) {
+ const QFileInfo &fi = list.at(i);
+ if (fi.fileName() != "qmake.pro") {
+ entryName = dirName + "/" + fi.fileName();
+ if (fi.isDir()) {
+ findProjects(entryName);
+ } else {
+ qmakeTemplate = projectType(fi.absoluteFilePath());
+ switch (qmakeTemplate) {
+ case Lib:
+ case Subdirs:
+ makeListNumber = 1;
+ break;
+ default:
+ makeListNumber = 2;
+ break;
+ }
+ makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
+ fi.fileName(),
+ "Makefile",
+ qmakeTemplate));
+ }
+ }
+
+ }
+ }
+}
+
+void Configure::appendMakeItem(int inList, const QString &item)
+{
+ QString dir;
+ if (item != "src")
+ dir = "/" + item;
+ dir.prepend("/src");
+ makeList[inList].append(new MakeItem(sourcePath + dir,
+ item + ".pro", buildPath + dir + "/Makefile", Lib));
+ if (dictionary[ "DSPFILES" ] == "yes") {
+ makeList[inList].append(new MakeItem(sourcePath + dir,
+ item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib));
+ }
+ if (dictionary[ "VCPFILES" ] == "yes") {
+ makeList[inList].append(new MakeItem(sourcePath + dir,
+ item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib));
+ }
+ if (dictionary[ "VCPROJFILES" ] == "yes") {
+ makeList[inList].append(new MakeItem(sourcePath + dir,
+ item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib));
+ }
+}
+
+void Configure::generateMakefiles()
+{
+ if (dictionary[ "NOPROCESS" ] == "no") {
+#if !defined(EVAL)
+ cout << "Creating makefiles in src..." << endl;
+#endif
+
+ QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
+ if (spec != "win32-msvc")
+ dictionary[ "DSPFILES" ] = "no";
+
+ if (spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
+ dictionary[ "VCPROJFILES" ] = "no";
+
+ int i = 0;
+ QString pwd = QDir::currentPath();
+ if (dictionary["FAST"] != "yes") {
+ QString dirName;
+ bool generate = true;
+ bool doDsp = (dictionary["DSPFILES"] == "yes" || dictionary["VCPFILES"] == "yes"
+ || dictionary["VCPROJFILES"] == "yes");
+ while (generate) {
+ QString pwd = QDir::currentPath();
+ QString dirPath = fixSeparators(buildPath + dirName);
+ QStringList args;
+
+ args << fixSeparators(buildPath + "/bin/qmake");
+
+ if (doDsp) {
+ if (dictionary[ "DEPENDENCIES" ] == "no")
+ args << "-nodepend";
+ args << "-tp" << "vc";
+ doDsp = false; // DSP files will be done
+ printf("Generating Visual Studio project files...\n");
+ } else {
+ printf("Generating Makefiles...\n");
+ generate = false; // Now Makefiles will be done
+ }
+ // don't pass -spec - .qmake.cache has it already
+ args << "-r";
+ args << (sourcePath + "/projects.pro");
+ args << "-o";
+ args << buildPath;
+ if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
+ args << dictionary[ "QMAKEADDITIONALARGS" ];
+
+ QDir::setCurrent(fixSeparators(dirPath));
+ if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
+ cout << "Qmake failed, return code " << exitCode << endl << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+ }
+ } else {
+ findProjects(sourcePath);
+ for (i=0; i<3; i++) {
+ for (int j=0; j<makeList[i].size(); ++j) {
+ MakeItem *it=makeList[i][j];
+ QString dirPath = fixSeparators(it->directory + "/");
+ QString projectName = it->proFile;
+ QString makefileName = buildPath + "/" + dirPath + it->target;
+
+ // For shadowbuilds, we need to create the path first
+ QDir buildPathDir(buildPath);
+ if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
+ buildPathDir.mkpath(dirPath);
+
+ QStringList args;
+
+ args << fixSeparators(buildPath + "/bin/qmake");
+ args << sourcePath + "/" + dirPath + projectName;
+ args << dictionary[ "QMAKE_ALL_ARGS" ];
+
+ cout << "For " << qPrintable(dirPath + projectName) << endl;
+ args << "-o";
+ args << it->target;
+ args << "-spec";
+ args << spec;
+ if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
+ args << dictionary[ "QMAKEADDITIONALARGS" ];
+
+ QDir::setCurrent(fixSeparators(dirPath));
+
+ QFile file(makefileName);
+ if (!file.open(QFile::WriteOnly)) {
+ printf("failed on dirPath=%s, makefile=%s\n",
+ qPrintable(dirPath), qPrintable(makefileName));
+ continue;
+ }
+ QTextStream txt(&file);
+ txt << "all:\n";
+ txt << "\t" << args.join(" ") << "\n";
+ txt << "\t\"$(MAKE)\" -$(MAKEFLAGS) -f " << it->target << "\n";
+ txt << "first: all\n";
+ txt << "qmake:\n";
+ txt << "\t" << args.join(" ") << "\n";
+ }
+ }
+ }
+ QDir::setCurrent(pwd);
+ } else {
+ cout << "Processing of project files have been disabled." << endl;
+ cout << "Only use this option if you really know what you're doing." << endl << endl;
+ return;
+ }
+}
+
+void Configure::showSummary()
+{
+ QString make = dictionary[ "MAKE" ];
+ if (!dictionary.contains("XQMAKESPEC")) {
+ cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
+ cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
+ } else if (dictionary.value("QMAKESPEC").startsWith("wince")) {
+ // we are cross compiling for Windows CE
+ cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
+ << "\tsetcepaths " << dictionary.value("XQMAKESPEC") << endl
+ << "\t" << qPrintable(make) << endl
+ << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
+ } else { // Compiling for Symbian OS
+ cout << endl << endl << "Qt is now configured for building. To start the build run:" << qPrintable(dictionary["QTBUILDINSTRUCTION"]) << "." << endl
+ << "To reconfigure, run '" << qPrintable(dictionary["CONFCLEANINSTRUCTION"]) << "' and configure." << endl;
+ }
+}
+
+Configure::ProjectType Configure::projectType(const QString& proFileName)
+{
+ QFile proFile(proFileName);
+ if (proFile.open(QFile::ReadOnly)) {
+ QString buffer = proFile.readLine(1024);
+ while (!buffer.isEmpty()) {
+ QStringList segments = buffer.split(QRegExp("\\s"));
+ QStringList::Iterator it = segments.begin();
+
+ if (segments.size() >= 3) {
+ QString keyword = (*it++);
+ QString operation = (*it++);
+ QString value = (*it++);
+
+ if (keyword == "TEMPLATE") {
+ if (value == "lib")
+ return Lib;
+ else if (value == "subdirs")
+ return Subdirs;
+ }
+ }
+ // read next line
+ buffer = proFile.readLine(1024);
+ }
+ proFile.close();
+ }
+ // Default to app handling
+ return App;
+}
+
+#if !defined(EVAL)
+
+bool Configure::showLicense(QString orgLicenseFile)
+{
+ if (dictionary["LICENSE_CONFIRMED"] == "yes") {
+ cout << "You have already accepted the terms of the license." << endl << endl;
+ return true;
+ }
+
+ bool haveGpl3 = false;
+ QString licenseFile = orgLicenseFile;
+ QString theLicense;
+ if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
+ haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
+ theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
+ if (haveGpl3)
+ theLicense += "\nor the GNU General Public License (GPL) version 3";
+ } else {
+ // the first line of the license file tells us which license it is
+ QFile file(licenseFile);
+ if (!file.open(QFile::ReadOnly)) {
+ cout << "Failed to load LICENSE file" << endl;
+ return false;
+ }
+ theLicense = file.readLine().trimmed();
+ }
+
+ forever {
+ char accept = '?';
+ cout << "You are licensed to use this software under the terms of" << endl
+ << "the " << theLicense << "." << endl
+ << endl;
+ if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
+ if (haveGpl3)
+ cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
+ cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
+ } else {
+ cout << "Type '?' to view the " << theLicense << "." << endl;
+ }
+ cout << "Type 'y' to accept this license offer." << endl
+ << "Type 'n' to decline this license offer." << endl
+ << endl
+ << "Do you accept the terms of the license?" << endl;
+ cin >> accept;
+ accept = tolower(accept);
+
+ if (accept == 'y') {
+ return true;
+ } else if (accept == 'n') {
+ return false;
+ } else {
+ if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
+ if (accept == '3')
+ licenseFile = orgLicenseFile + "/LICENSE.GPL3";
+ else
+ licenseFile = orgLicenseFile + "/LICENSE.LGPL";
+ }
+ // Get console line height, to fill the screen properly
+ int i = 0, screenHeight = 25; // default
+ CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
+ HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
+ screenHeight = consoleInfo.srWindow.Bottom
+ - consoleInfo.srWindow.Top
+ - 1; // Some overlap for context
+
+ // Prompt the license content to the user
+ QFile file(licenseFile);
+ if (!file.open(QFile::ReadOnly)) {
+ cout << "Failed to load LICENSE file" << licenseFile << endl;
+ return false;
+ }
+ QStringList licenseContent = QString(file.readAll()).split('\n');
+ while (i < licenseContent.size()) {
+ cout << licenseContent.at(i) << endl;
+ if (++i % screenHeight == 0) {
+ cout << "(Press any key for more..)";
+ if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+ exit(0); // Exit cleanly for Ctrl+C
+ cout << "\r"; // Overwrite text above
+ }
+ }
+ }
+ }
+}
+
+void Configure::readLicense()
+{
+ if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") &&
+ (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince")))
+ dictionary["PLATFORM NAME"] = "Qt for Windows CE";
+ else if (dictionary.value("XQMAKESPEC").startsWith("symbian"))
+ dictionary["PLATFORM NAME"] = "Qt for Symbian";
+ else
+ dictionary["PLATFORM NAME"] = "Qt for Windows";
+ dictionary["LICENSE FILE"] = sourcePath;
+
+ bool openSource = false;
+ bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
+ if (dictionary["BUILDNOKIA"] == "yes" || dictionary["BUILDTYPE"] == "commercial") {
+ openSource = false;
+ } else if (dictionary["BUILDTYPE"] == "opensource") {
+ openSource = true;
+ } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
+ forever {
+ char accept = '?';
+ cout << "Which edition of Qt do you want to use ?" << endl;
+ cout << "Type 'c' if you want to use the Commercial Edition." << endl;
+ cout << "Type 'o' if you want to use the Open Source Edition." << endl;
+ cin >> accept;
+ accept = tolower(accept);
+
+ if (accept == 'c') {
+ openSource = false;
+ break;
+ } else if (accept == 'o') {
+ openSource = true;
+ break;
+ }
+ }
+ }
+ if (hasOpenSource && openSource) {
+ cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
+ licenseInfo["LICENSEE"] = "Open Source";
+ dictionary["EDITION"] = "OpenSource";
+ dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
+ cout << endl;
+ if (!showLicense(dictionary["LICENSE FILE"])) {
+ cout << "Configuration aborted since license was not accepted";
+ dictionary["DONE"] = "error";
+ return;
+ }
+ } else if (openSource) {
+ cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
+ dictionary["DONE"] = "error";
+ }
+#ifdef COMMERCIAL_VERSION
+ else {
+ Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
+ if (dictionary["DONE"] != "error" && dictionary["BUILDNOKIA"] != "yes") {
+ // give the user some feedback, and prompt for license acceptance
+ cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
+ if (!showLicense(dictionary["LICENSE FILE"])) {
+ cout << "Configuration aborted since license was not accepted";
+ dictionary["DONE"] = "error";
+ return;
+ }
+ }
+ }
+#else // !COMMERCIAL_VERSION
+ else {
+ cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
+ dictionary["DONE"] = "error";
+ }
+#endif
+}
+
+void Configure::reloadCmdLine()
+{
+ if (dictionary[ "REDO" ] == "yes") {
+ QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
+ if (inFile.open(QFile::ReadOnly)) {
+ QTextStream inStream(&inFile);
+ QString buffer;
+ inStream >> buffer;
+ while (buffer.length()) {
+ configCmdLine += buffer;
+ inStream >> buffer;
+ }
+ inFile.close();
+ }
+ }
+}
+
+void Configure::saveCmdLine()
+{
+ if (dictionary[ "REDO" ] != "yes") {
+ QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
+ if (outFile.open(QFile::WriteOnly | QFile::Text)) {
+ QTextStream outStream(&outFile);
+ for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
+ outStream << (*it) << " " << endl;
+ }
+ outStream.flush();
+ outFile.close();
+ }
+ }
+}
+#endif // !EVAL
+
+bool Configure::isDone()
+{
+ return !dictionary["DONE"].isEmpty();
+}
+
+bool Configure::isOk()
+{
+ return (dictionary[ "DONE" ] != "error");
+}
+
+bool
+Configure::filesDiffer(const QString &fn1, const QString &fn2)
+{
+ QFile file1(fn1), file2(fn2);
+ if (!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
+ return true;
+ const int chunk = 2048;
+ int used1 = 0, used2 = 0;
+ char b1[chunk], b2[chunk];
+ while (!file1.atEnd() && !file2.atEnd()) {
+ if (!used1)
+ used1 = file1.read(b1, chunk);
+ if (!used2)
+ used2 = file2.read(b2, chunk);
+ if (used1 > 0 && used2 > 0) {
+ const int cmp = qMin(used1, used2);
+ if (memcmp(b1, b2, cmp))
+ return true;
+ if ((used1 -= cmp))
+ memcpy(b1, b1+cmp, used1);
+ if ((used2 -= cmp))
+ memcpy(b2, b2+cmp, used2);
+ }
+ }
+ return !file1.atEnd() || !file2.atEnd();
+}
+
+QT_END_NAMESPACE
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
new file mode 100644
index 0000000000..fa14f98b14
--- /dev/null
+++ b/tools/configure/configureapp.h
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qmap.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qlist.h>
+#include <qtextstream.h>
+#include <qdir.h>
+
+QT_BEGIN_NAMESPACE
+
+class MakeItem;
+
+class Configure
+{
+public:
+ Configure( int& argc, char** argv );
+ ~Configure();
+
+ void parseCmdLine();
+#if !defined(EVAL)
+ void validateArgs();
+#endif
+ bool displayHelp();
+
+ QString defaultTo(const QString &option);
+ bool checkAvailability(const QString &part);
+ void autoDetection();
+ bool verifyConfiguration();
+
+ void generateOutputVars();
+#if !defined(EVAL)
+ void generateHeaders();
+ void generateBuildKey();
+ void generateCachefile();
+ void displayConfig();
+ void buildQmake();
+ void buildHostTools();
+#endif
+ void generateMakefiles();
+ void appendMakeItem(int inList, const QString &item);
+#if !defined(EVAL)
+ void generateConfigfiles();
+#endif
+ void showSummary();
+ void findProjects( const QString& dirName );
+ QString firstLicensePath();
+
+#if !defined(EVAL)
+ bool showLicense(QString licenseFile);
+ void readLicense();
+#endif
+
+ QString addDefine(QString def);
+
+ enum ProjectType {
+ App,
+ Lib,
+ Subdirs
+ };
+
+ ProjectType projectType( const QString& proFileName );
+ bool isDone();
+ bool isOk();
+private:
+ // Our variable dictionaries
+ QMap<QString,QString> dictionary;
+ QStringList licensedModules;
+ QStringList allSqlDrivers;
+ QStringList allConfigs;
+ QStringList disabledModules;
+ QStringList enabledModules;
+ QStringList modules;
+ QStringList disabledBuildParts;
+// QStringList sqlDrivers;
+ QStringList configCmdLine;
+ QStringList qmakeConfig;
+ QStringList qtConfig;
+
+ QStringList qmakeSql;
+ QStringList qmakeSqlPlugins;
+
+ QStringList qmakeStyles;
+ QStringList qmakeStylePlugins;
+
+ QStringList qmakeVars;
+ QStringList qmakeDefines;
+ // makeList[0] for qt and qtmain
+ // makeList[1] for subdirs and libs
+ // makeList[2] for the rest
+ QList<MakeItem*> makeList[3];
+ QStringList qmakeIncludes;
+ QStringList qmakeLibs;
+ QString opensslLibs;
+ QString psqlLibs;
+ QString sybase;
+ QString sybaseLibs;
+
+ QMap<QString,QString> licenseInfo;
+ QString outputLine;
+
+ QTextStream outStream;
+ QString sourcePath, buildPath;
+ QDir sourceDir, buildDir;
+
+ // Variables for usage output
+ int optionIndent;
+ int descIndent;
+ int outputWidth;
+
+ bool useUnixSeparators;
+ QString fixSeparators(const QString &somePath, bool escape = false);
+ QString escapeSeparators(const QString &somePath);
+ bool filesDiffer(const QString &file1, const QString &file2);
+
+ bool findFile(const QString &fileName);
+ static QString findFileInPaths(const QString &fileName, const QString &paths);
+#if !defined(EVAL)
+ void reloadCmdLine();
+ void saveCmdLine();
+#endif
+
+ void desc(const char *description, int startingAt = 0, int wrapIndent = 0);
+ void desc(const char *option, const char *description, bool skipIndent = false, char fillChar = '.');
+ void desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar = '.');
+ void applySpecSpecifics();
+ static QString locateFile(const QString &fileName);
+ static QString locateFileInPaths(const QString &fileName, const QStringList &paths);
+};
+
+class MakeItem
+{
+public:
+ MakeItem( const QString &d, const QString &p, const QString &t, Configure::ProjectType qt )
+ : directory( d ),
+ proFile( p ),
+ target( t ),
+ qmakeTemplate( qt )
+ { }
+
+ QString directory;
+ QString proFile;
+ QString target;
+ Configure::ProjectType qmakeTemplate;
+};
+
+
+QT_END_NAMESPACE
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
new file mode 100644
index 0000000000..188595523a
--- /dev/null
+++ b/tools/configure/environment.cpp
@@ -0,0 +1,516 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "environment.h"
+
+#include <process.h>
+#include <iostream>
+#include <qdebug.h>
+#include <QDir>
+#include <QStringList>
+#include <QMap>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+
+//#define CONFIGURE_DEBUG_EXECUTE
+//#define CONFIGURE_DEBUG_CP_DIR
+
+using namespace std;
+
+#ifdef Q_OS_WIN32
+#include <qt_windows.h>
+#endif
+
+#include <symbian/epocroot_p.h> // from tools/shared
+#include <windows/registry_p.h> // from tools/shared
+
+QT_BEGIN_NAMESPACE
+
+struct CompilerInfo{
+ Compiler compiler;
+ const char *compilerStr;
+ const char *regKey;
+ const char *executable;
+} compiler_info[] = {
+ // The compilers here are sorted in a reversed-preferred order
+ {CC_BORLAND, "Borland C++", 0, "bcc32.exe"},
+ {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"},
+ {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe
+ {CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe
+ {CC_UNKNOWN, "Unknown", 0, 0},
+};
+
+
+// Initialize static variables
+Compiler Environment::detectedCompiler = CC_UNKNOWN;
+
+/*!
+ Returns the pointer to the CompilerInfo for a \a compiler.
+*/
+CompilerInfo *Environment::compilerInfo(Compiler compiler)
+{
+ int i = 0;
+ while(compiler_info[i].compiler != compiler && compiler_info[i].compiler != CC_UNKNOWN)
+ ++i;
+ return &(compiler_info[i]);
+}
+
+/*!
+ Returns the qmakespec for the compiler detected on the system.
+*/
+QString Environment::detectQMakeSpec()
+{
+ QString spec;
+ switch (detectCompiler()) {
+ case CC_NET2010:
+ spec = "win32-msvc2010";
+ break;
+ case CC_NET2008:
+ spec = "win32-msvc2008";
+ break;
+ case CC_NET2005:
+ spec = "win32-msvc2005";
+ break;
+ case CC_NET2003:
+ spec = "win32-msvc2003";
+ break;
+ case CC_INTEL:
+ spec = "win32-icc";
+ break;
+ case CC_MINGW:
+ spec = "win32-g++";
+ break;
+ case CC_BORLAND:
+ spec = "win32-borland";
+ break;
+ default:
+ break;
+ }
+
+ return spec;
+}
+
+/*!
+ Returns the enum of the compiler which was detected on the system.
+ The compilers are detected in the order as entered into the
+ compiler_info list.
+
+ If more than one compiler is found, CC_UNKNOWN is returned.
+*/
+Compiler Environment::detectCompiler()
+{
+#ifndef Q_OS_WIN32
+ return CC_UNKNOWN; // Always generate CC_UNKNOWN on other platforms
+#else
+ if(detectedCompiler != CC_UNKNOWN)
+ return detectedCompiler;
+
+ int installed = 0;
+
+ // Check for compilers in registry first, to see which version is in PATH
+ QString paths = qgetenv("PATH");
+ QStringList pathlist = paths.toLower().split(";");
+ for(int i = 0; compiler_info[i].compiler; ++i) {
+ QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();
+ if (productPath.length()) {
+ QStringList::iterator it;
+ for(it = pathlist.begin(); it != pathlist.end(); ++it) {
+ if((*it).contains(productPath)) {
+ ++installed;
+ detectedCompiler = compiler_info[i].compiler;
+ break;
+ }
+ }
+ }
+ }
+
+ // Now just go looking for the executables, and accept any executable as the lowest version
+ if (!installed) {
+ for(int i = 0; compiler_info[i].compiler; ++i) {
+ QString executable = QString(compiler_info[i].executable).toLower();
+ if (executable.length() && Environment::detectExecutable(executable)) {
+ ++installed;
+ detectedCompiler = compiler_info[i].compiler;
+ break;
+ }
+ }
+ }
+
+ if (installed > 1) {
+ cout << "Found more than one known compiler! Using \"" << compilerInfo(detectedCompiler)->compilerStr << "\"" << endl;
+ detectedCompiler = CC_UNKNOWN;
+ }
+ return detectedCompiler;
+#endif
+};
+
+/*!
+ Returns true if the \a executable could be loaded, else false.
+ This means that the executable either is in the current directory
+ or in the PATH.
+*/
+bool Environment::detectExecutable(const QString &executable)
+{
+ PROCESS_INFORMATION procInfo;
+ memset(&procInfo, 0, sizeof(procInfo));
+
+ STARTUPINFO startInfo;
+ memset(&startInfo, 0, sizeof(startInfo));
+ startInfo.cb = sizeof(startInfo);
+
+ bool couldExecute = CreateProcess(0, (wchar_t*)executable.utf16(),
+ 0, 0, false,
+ CREATE_NO_WINDOW | CREATE_SUSPENDED,
+ 0, 0, &startInfo, &procInfo);
+
+ if (couldExecute) {
+ CloseHandle(procInfo.hThread);
+ TerminateProcess(procInfo.hProcess, 0);
+ CloseHandle(procInfo.hProcess);
+ }
+ return couldExecute;
+}
+
+/*!
+ Creates a commandling from \a program and it \a arguments,
+ escaping characters that needs it.
+*/
+static QString qt_create_commandline(const QString &program, const QStringList &arguments)
+{
+ QString programName = program;
+ if (!programName.startsWith("\"") && !programName.endsWith("\"") && programName.contains(" "))
+ programName = "\"" + programName + "\"";
+ programName.replace("/", "\\");
+
+ QString args;
+ // add the prgram as the first arrg ... it works better
+ args = programName + " ";
+ for (int i=0; i<arguments.size(); ++i) {
+ QString tmp = arguments.at(i);
+ // in the case of \" already being in the string the \ must also be escaped
+ tmp.replace( "\\\"", "\\\\\"" );
+ // escape a single " because the arguments will be parsed
+ tmp.replace( "\"", "\\\"" );
+ if (tmp.isEmpty() || tmp.contains(' ') || tmp.contains('\t')) {
+ // The argument must not end with a \ since this would be interpreted
+ // as escaping the quote -- rather put the \ behind the quote: e.g.
+ // rather use "foo"\ than "foo\"
+ QString endQuote("\"");
+ int i = tmp.length();
+ while (i>0 && tmp.at(i-1) == '\\') {
+ --i;
+ endQuote += "\\";
+ }
+ args += QString(" \"") + tmp.left(i) + endQuote;
+ } else {
+ args += ' ' + tmp;
+ }
+ }
+ return args;
+}
+
+/*!
+ Creates a QByteArray of the \a environment.
+*/
+static QByteArray qt_create_environment(const QStringList &environment)
+{
+ QByteArray envlist;
+ if (environment.isEmpty())
+ return envlist;
+
+ int pos = 0;
+ // add PATH if necessary (for DLL loading)
+ QByteArray path = qgetenv("PATH");
+ if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) {
+ QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path));
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize(envlist.size() + tmpSize);
+ memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
+ pos += tmpSize;
+ }
+ // add the user environment
+ foreach (const QString &tmp, environment) {
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize(envlist.size() + tmpSize);
+ memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
+ pos += tmpSize;
+ }
+ // add the 2 terminating 0 (actually 4, just to be on the safe side)
+ envlist.resize(envlist.size() + 4);
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+
+ return envlist;
+}
+
+/*!
+ Executes the command described in \a arguments, in the
+ environment inherited from the parent process, with the
+ \a additionalEnv settings applied.
+ \a removeEnv removes the specified environment variables from
+ the environment of the executed process.
+
+ Returns the exit value of the process, or -1 if the command could
+ not be executed.
+
+ This function uses _(w)spawnvpe to spawn a process by searching
+ through the PATH environment variable.
+*/
+int Environment::execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv)
+{
+#ifdef CONFIGURE_DEBUG_EXECUTE
+ qDebug() << "About to Execute: " << arguments;
+ qDebug() << " " << QDir::currentPath();
+ qDebug() << " " << additionalEnv;
+ qDebug() << " " << removeEnv;
+#endif
+ // Create the full environment from the current environment and
+ // the additionalEnv strings, then remove all variables defined
+ // in removeEnv
+ QMap<QString, QString> fullEnvMap;
+ LPWSTR envStrings = GetEnvironmentStrings();
+ if (envStrings) {
+ int strLen = 0;
+ for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) {
+ strLen = wcslen(envString);
+ QString str = QString((const QChar*)envString, strLen);
+ if (!str.startsWith("=")) { // These are added by the system
+ int sepIndex = str.indexOf('=');
+ fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
+ }
+ }
+ }
+ FreeEnvironmentStrings(envStrings);
+
+ // Add additionalEnv variables
+ for (int i = 0; i < additionalEnv.count(); ++i) {
+ const QString &str = additionalEnv.at(i);
+ int sepIndex = str.indexOf('=');
+ fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
+ }
+
+ // Remove removeEnv variables
+ for (int j = 0; j < removeEnv.count(); ++j)
+ fullEnvMap.remove(removeEnv.at(j).toUpper());
+
+ // Add all variables to a QStringList
+ QStringList fullEnv;
+ QMapIterator<QString, QString> it(fullEnvMap);
+ while (it.hasNext()) {
+ it.next();
+ fullEnv += QString(it.key() + "=" + it.value());
+ }
+
+ // ----------------------------
+ QString program = arguments.takeAt(0);
+ QString args = qt_create_commandline(program, arguments);
+ QByteArray envlist = qt_create_environment(fullEnv);
+
+ DWORD exitCode = DWORD(-1);
+ PROCESS_INFORMATION procInfo;
+ memset(&procInfo, 0, sizeof(procInfo));
+
+ STARTUPINFO startInfo;
+ memset(&startInfo, 0, sizeof(startInfo));
+ startInfo.cb = sizeof(startInfo);
+
+ bool couldExecute = CreateProcess(0, (wchar_t*)args.utf16(),
+ 0, 0, true, CREATE_UNICODE_ENVIRONMENT,
+ envlist.isEmpty() ? 0 : envlist.data(),
+ 0, &startInfo, &procInfo);
+
+ if (couldExecute) {
+ WaitForSingleObject(procInfo.hProcess, INFINITE);
+ GetExitCodeProcess(procInfo.hProcess, &exitCode);
+ CloseHandle(procInfo.hThread);
+ CloseHandle(procInfo.hProcess);
+ }
+
+
+ if (exitCode == DWORD(-1)) {
+ switch(GetLastError()) {
+ case E2BIG:
+ cerr << "execute: Argument list exceeds 1024 bytes" << endl;
+ foreach (const QString &arg, arguments)
+ cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl;
+ break;
+ case ENOENT:
+ cerr << "execute: File or path is not found (" << program.toLocal8Bit().constData() << ")" << endl;
+ break;
+ case ENOEXEC:
+ cerr << "execute: Specified file is not executable or has invalid executable-file format (" << program.toLocal8Bit().constData() << ")" << endl;
+ break;
+ case ENOMEM:
+ cerr << "execute: Not enough memory is available to execute new process." << endl;
+ break;
+ default:
+ cerr << "execute: Unknown error" << endl;
+ foreach (const QString &arg, arguments)
+ cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl;
+ break;
+ }
+ }
+ return exitCode;
+}
+
+/*!
+ Copies the \a srcDir contents into \a destDir.
+
+ If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes
+ will not be copied over from \a srcDir. Instead a new file will be created
+ in \a destDir with the same name and that file will include a file with the
+ same name from the \a includeSrcDir using relative path and appropriate
+ syntax for the file type.
+
+ Returns true if copying was successful.
+*/
+bool Environment::cpdir(const QString &srcDir,
+ const QString &destDir,
+ const QString &includeSrcDir)
+{
+ QString cleanSrcName = QDir::cleanPath(srcDir);
+ QString cleanDstName = QDir::cleanPath(destDir);
+ QString cleanIncludeName = QDir::cleanPath(includeSrcDir);
+
+#ifdef CONFIGURE_DEBUG_CP_DIR
+ qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
+#endif
+ if(!QFile::exists(cleanDstName) && !QDir().mkpath(cleanDstName)) {
+ qDebug() << "cpdir: Failure to create " << cleanDstName;
+ return false;
+ }
+
+ bool result = true;
+ QDir dir = QDir(cleanSrcName);
+ QDir destinationDir = QDir(cleanDstName);
+ QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+ for (int i = 0; result && (i < allEntries.count()); ++i) {
+ QFileInfo entry = allEntries.at(i);
+ bool intermediate = true;
+ if (entry.isDir()) {
+ QString newIncSrcDir;
+ if (!includeSrcDir.isEmpty())
+ newIncSrcDir = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
+
+ intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
+ QString("%1/%2").arg(cleanDstName).arg(entry.fileName()),
+ newIncSrcDir);
+ } else {
+ QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
+#ifdef CONFIGURE_DEBUG_CP_DIR
+ qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile;
+#endif
+ QFile::remove(destFile);
+ QString suffix = entry.suffix();
+ if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) {
+ QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
+ relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath);
+#ifdef CONFIGURE_DEBUG_CP_DIR
+ qDebug() << "...instead generate relative include to" << relativeIncludeFilePath;
+#endif
+ QFile currentFile(destFile);
+ if (currentFile.open(QFile::WriteOnly | QFile::Text)) {
+ QTextStream fileStream;
+ fileStream.setDevice(&currentFile);
+
+ if (suffix == "prf" || suffix == "conf") {
+ if (entry.fileName() == "qmake.conf") {
+ // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the
+ // primary use of this variable by qmake to identify the original mkspec, the
+ // variable is also used for few special cases where the absolute path is required.
+ // Conversely, the include of the original qmake.conf must be done using relative path,
+ // as some Qt binary deployments are done in a manner that doesn't allow for patching
+ // the paths at the installation time.
+ fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl;
+ }
+ fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl;
+ } else if (suffix == "h") {
+ fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl;
+ }
+
+ fileStream.flush();
+ currentFile.close();
+ }
+ } else {
+ intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
+ SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
+ }
+ }
+ if(!intermediate) {
+ qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
+ result = false;
+ }
+ }
+ return result;
+}
+
+bool Environment::rmdir(const QString &name)
+{
+ bool result = true;
+ QString cleanName = QDir::cleanPath(name);
+
+ QDir dir = QDir(cleanName);
+ QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+ for (int i = 0; result && (i < allEntries.count()); ++i) {
+ QFileInfo entry = allEntries.at(i);
+ if (entry.isDir()) {
+ result &= rmdir(entry.absoluteFilePath());
+ } else {
+ result &= QFile::remove(entry.absoluteFilePath());
+ }
+ }
+ result &= dir.rmdir(cleanName);
+ return result;
+}
+
+QString Environment::symbianEpocRoot()
+{
+ // Call function defined in tools/shared/symbian/epocroot_p.h
+ return ::qt_epocRoot();
+}
+
+QT_END_NAMESPACE
diff --git a/tools/configure/environment.h b/tools/configure/environment.h
new file mode 100644
index 0000000000..faee63f435
--- /dev/null
+++ b/tools/configure/environment.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qstring.h>
+#include <qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+
+
+enum Compiler {
+ CC_UNKNOWN = 0,
+ CC_BORLAND = 0x01,
+ CC_MINGW = 0x02,
+ CC_INTEL = 0x03,
+ CC_NET2003 = 0x71,
+ CC_NET2005 = 0x80,
+ CC_NET2008 = 0x90,
+ CC_NET2010 = 0x91
+};
+
+struct CompilerInfo;
+class Environment
+{
+public:
+ static Compiler detectCompiler();
+ static QString detectQMakeSpec();
+ static bool detectExecutable(const QString &executable);
+
+ static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
+ static bool cpdir(const QString &srcDir,
+ const QString &destDir,
+ const QString &includeSrcDir = QString());
+ static bool rmdir(const QString &name);
+
+ static QString symbianEpocRoot();
+
+private:
+ static Compiler detectedCompiler;
+
+ static CompilerInfo *compilerInfo(Compiler compiler);
+};
+
+
+QT_END_NAMESPACE
diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp
new file mode 100644
index 0000000000..a2b7eb7881
--- /dev/null
+++ b/tools/configure/main.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+** Configure tool
+**
+*/
+
+#include "configureapp.h"
+
+QT_BEGIN_NAMESPACE
+
+int runConfigure( int argc, char** argv )
+{
+ Configure app( argc, argv );
+ if (!app.isOk())
+ return 3;
+
+ app.parseCmdLine();
+#if !defined(EVAL)
+ app.validateArgs();
+#endif
+ if( app.displayHelp() )
+ return 1;
+
+ // Read license now, and exit if it doesn't pass.
+ // This lets the user see the command-line options of configure
+ // without having to load and parse the license file.
+ app.readLicense();
+ if (!app.isOk())
+ return 3;
+
+ // Auto-detect modules and settings.
+ app.autoDetection();
+
+ // After reading all command-line arguments, and doing all the
+ // auto-detection, it's time to do some last minute validation.
+ // If the validation fails, we cannot continue.
+ if (!app.verifyConfiguration())
+ return 3;
+
+ app.generateOutputVars();
+
+#if !defined(EVAL)
+ if( !app.isDone() )
+ app.generateCachefile();
+ if( !app.isDone() )
+ app.generateBuildKey();
+ if( !app.isDone() )
+ app.generateConfigfiles();
+ if( !app.isDone() )
+ app.displayConfig();
+ if( !app.isDone() )
+ app.generateHeaders();
+ if( !app.isDone() )
+ app.buildQmake();
+#endif
+ if( !app.isDone() )
+ app.generateMakefiles();
+ if( !app.isDone() )
+ app.buildHostTools();
+ if( !app.isDone() )
+ app.showSummary();
+ if( !app.isOk() )
+ return 2;
+
+ return 0;
+}
+
+QT_END_NAMESPACE
+
+int main( int argc, char** argv )
+{
+ QT_USE_NAMESPACE
+ return runConfigure(argc, argv);
+}
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp
new file mode 100644
index 0000000000..ab724f9888
--- /dev/null
+++ b/tools/configure/tools.cpp
@@ -0,0 +1,249 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tools.h"
+
+#include <QDir>
+#include <QFile>
+#include <QByteArray>
+
+
+// std stuff ------------------------------------
+#include <iostream>
+#include <windows.h>
+#include <conio.h>
+#define NUMBER_OF_PARTS 7
+
+std::ostream &operator<<(std::ostream &s, const QString &val); // defined in configureapp.cpp
+using namespace std;
+
+void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString> &licenseInfo,
+ const QString &path)
+{
+ if (dictionary[ "BUILDNOKIA" ] == "yes") {
+ dictionary["EDITION"] = "NokiaInternalBuild";
+ dictionary["LICENSE_FILE"] = ""; // No License for nokia developers
+ dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
+ return; // No license key checking in internal builds
+ }
+
+ QString tpLicense = dictionary["QT_SOURCE_TREE"] + "/LICENSE.PREVIEW.OPENSOURCE";
+ if (QFile::exists(tpLicense)) {
+ dictionary["EDITION"] = "Preview";
+ dictionary["LICENSE FILE"] = tpLicense;
+ dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
+ return; // No license key checking in Tech Preview
+ }
+ tpLicense = dictionary["QT_SOURCE_TREE"] + "/LICENSE.PREVIEW.COMMERCIAL";
+ if (QFile::exists(tpLicense)) {
+ dictionary["EDITION"] = "Preview";
+ dictionary["LICENSE FILE"] = tpLicense;
+ dictionary["QT_EDITION"] = "QT_EDITION_DESKTOP";
+ return; // No license key checking in Tech Preview
+ }
+
+ // Read in the license file
+ QFile licenseFile(path);
+ if( !path.isEmpty() && licenseFile.open( QFile::ReadOnly ) ) {
+ cout << "Reading license file in....." << qPrintable(path) << endl;
+
+ QString buffer = licenseFile.readLine(1024);
+ while (!buffer.isEmpty()) {
+ if( buffer[ 0 ] != '#' ) {
+ QStringList components = buffer.split( '=' );
+ if ( components.size() >= 2 ) {
+ QStringList::Iterator it = components.begin();
+ QString key = (*it++).trimmed().remove('"').toUpper();
+ QString value = (*it++).trimmed().remove('"');
+ licenseInfo[ key ] = value;
+ }
+ }
+ // read next line
+ buffer = licenseFile.readLine(1024);
+ }
+ licenseFile.close();
+ } else {
+ cout << "License file not found in " << QDir::homePath() << endl;
+ cout << "Please put the Qt license file, '.qt-license' in your home "
+ << "directory and run configure again.";
+ dictionary["DONE"] = "error";
+ return;
+ }
+
+ // Verify license info...
+ QString licenseKey = licenseInfo["LICENSEKEYEXT"];
+ QByteArray clicenseKey = licenseKey.toLatin1();
+ //We check the license
+ static const char * const SEP = "-";
+ char *licenseParts[NUMBER_OF_PARTS];
+ int partNumber = 0;
+ for (char *part = strtok(clicenseKey.data(), SEP); part != 0; part = strtok(0, SEP))
+ licenseParts[partNumber++] = part;
+ if (partNumber < (NUMBER_OF_PARTS-1)) {
+ dictionary["DONE"] = "error";
+ cout << "License file does not contain proper license key." <<partNumber<< endl;
+ return;
+ }
+
+ char products = licenseParts[0][0];
+ char* platforms = licenseParts[1];
+ char* licenseSchema = licenseParts[2];
+ char licenseFeatures = licenseParts[3][0];
+
+ // Determine edition ---------------------------------------------------------------------------
+ QString licenseType;
+ if (strcmp(licenseSchema,"F4M") == 0) {
+ licenseType = "Commercial";
+ if (products == 'F') {
+ dictionary["EDITION"] = "Universal";
+ dictionary["QT_EDITION"] = "QT_EDITION_UNIVERSAL";
+ } else if (products == 'B') {
+ dictionary["EDITION"] = "FullFramework";
+ dictionary["QT_EDITION"] = "QT_EDITION_DESKTOP";
+ } else {
+ dictionary["EDITION"] = "GUIFramework";
+ dictionary["QT_EDITION"] = "QT_EDITION_DESKTOPLIGHT";
+ }
+ } else if (strcmp(licenseSchema,"Z4M") == 0 || strcmp(licenseSchema,"R4M") == 0 || strcmp(licenseSchema,"Q4M") == 0) {
+ if (products == 'B') {
+ dictionary["EDITION"] = "Evaluation";
+ dictionary["QT_EDITION"] = "QT_EDITION_EVALUATION";
+ licenseType = "Evaluation";
+ }
+ }
+
+ if (platforms[2] == 'L') {
+ static const char src[] = "8NPQRTZ";
+ static const char dst[] = "UCWX9M7";
+ const char *p = strchr(src, platforms[1]);
+ platforms[1] = dst[p - src];
+ }
+
+#define PL(a,b) (int(a)+int(b)*256)
+ int platformCode = PL(platforms[0],platforms[1]);
+ switch (platformCode) {
+ case PL('X','9'):
+ case PL('X','C'):
+ case PL('X','U'):
+ case PL('X','W'):
+ case PL('X','M'): // old license key
+ dictionary["LICENSE_EXTENSION"] = "-ALLOS";
+ break;
+
+ case PL('6', 'M'):
+ case PL('8', 'M'):
+ case PL('K', 'M'): // old license key
+ case PL('N', '7'):
+ case PL('N', '9'):
+ case PL('N', 'X'):
+ case PL('S', '9'):
+ case PL('S', 'C'):
+ case PL('S', 'U'):
+ case PL('S', 'W'):
+ dictionary["LICENSE_EXTENSION"] = "-EMBEDDED";
+ if (dictionary["PLATFORM NAME"].contains("Windows CE")
+ && platformCode != PL('6', 'M') && platformCode != PL('S', '9')
+ && platformCode != PL('S', 'C') && platformCode != PL('S', 'U')
+ && platformCode != PL('S', 'W') && platformCode != PL('K', 'M')) {
+ dictionary["DONE"] = "error";
+ } else if (dictionary["PLATFORM NAME"].contains("Symbian")
+ && platformCode != PL('N', '9') && platformCode != PL('S', '9')
+ && platformCode != PL('S', 'C') && platformCode != PL('S', 'U')
+ && platformCode != PL('S', 'W')) {
+ dictionary["DONE"] = "error";
+ }
+ break;
+ case PL('R', 'M'):
+ case PL('F', 'M'):
+ dictionary["LICENSE_EXTENSION"] = "-DESKTOP";
+ if (!dictionary["PLATFORM NAME"].endsWith("Windows")) {
+ dictionary["DONE"] = "error";
+ }
+ break;
+ default:
+ dictionary["DONE"] = "error";
+ break;
+ }
+#undef PL
+
+ if (dictionary.value("DONE") == "error") {
+ cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl;
+ cout << "Please contact qt-info@nokia.com to upgrade your license" << endl;
+ cout << "to include the " << dictionary["PLATFORM NAME"] << " platform, or install the" << endl;
+ cout << "Qt Open Source Edition if you intend to develop free software." << endl;
+ return;
+ }
+
+ // Override for evaluation licenses
+ if (dictionary["EDITION"] == "Evaluation")
+ dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
+
+ if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
+ // Generic, no-suffix license
+ dictionary["LICENSE_EXTENSION"].clear();
+ } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) {
+ cout << "License file does not contain proper license key." << endl;
+ dictionary["DONE"] = "error";
+ }
+ if (licenseType.isEmpty()
+ || dictionary["EDITION"].isEmpty()
+ || dictionary["QT_EDITION"].isEmpty()) {
+ cout << "License file does not contain proper license key." << endl;
+ dictionary["DONE"] = "error";
+ return;
+ }
+
+ // copy one of .LICENSE-*(-US) to LICENSE
+ QString toLicenseFile = dictionary["QT_SOURCE_TREE"] + "/LICENSE";
+ QString fromLicenseFile = dictionary["QT_SOURCE_TREE"] + "/.LICENSE" + dictionary["LICENSE_EXTENSION"];
+ if (licenseFeatures == 'B' || licenseFeatures == 'G'
+ || licenseFeatures == 'L' || licenseFeatures == 'Y')
+ fromLicenseFile += "-US";
+
+ if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
+ (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), false)) {
+ cout << "Failed to copy license file (" << fromLicenseFile << ")";
+ dictionary["DONE"] = "error";
+ return;
+ }
+ dictionary["LICENSE FILE"] = toLicenseFile;
+}
+
diff --git a/tools/configure/tools.h b/tools/configure/tools.h
new file mode 100644
index 0000000000..5ea25642ef
--- /dev/null
+++ b/tools/configure/tools.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _TOOLS_H_
+#define _TOOLS_H_
+
+#include <QString>
+#include <QStringList>
+#include <QMap>
+
+
+class Tools
+{
+public:
+ static void checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString> &licenseInfo,
+ const QString &path);
+};
+
+#endif // _TOOLS_H_
+
diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp
new file mode 100644
index 0000000000..5e6bc120cf
--- /dev/null
+++ b/tools/shared/symbian/epocroot.cpp
@@ -0,0 +1,227 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qdir.h>
+#include <QtCore/qxmlstream.h>
+
+#include "epocroot_p.h"
+#include "../windows/registry_p.h"
+
+QT_BEGIN_NAMESPACE
+
+// Registry key under which the location of the Symbian devices.xml file is
+// stored.
+// Note that, on 64-bit machines, this key is located under the 32-bit
+// compatibility key:
+// HKEY_LOCAL_MACHINE\Software\Wow6432Node
+#define SYMBIAN_SDKS_REG_SUBKEY "Software\\Symbian\\EPOC SDKs\\CommonPath"
+
+#ifdef Q_OS_WIN32
+# define SYMBIAN_SDKS_REG_HANDLE HKEY_LOCAL_MACHINE
+#else
+# define SYMBIAN_SDKS_REG_HANDLE 0
+#endif
+
+// Value which is populated and returned by the epocRoot() function.
+// Stored as a static value in order to avoid unnecessary re-evaluation.
+static QString epocRootValue;
+
+static QString getDevicesXmlPath()
+ {
+ // Note that the following call will return a null string on platforms other
+ // than Windows. If support is required on other platforms for devices.xml,
+ // an alternative mechanism for retrieving the location of this file will
+ // be required.
+ return qt_readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, QLatin1String(SYMBIAN_SDKS_REG_SUBKEY));
+ }
+
+/**
+ * Checks whether epocRootValue points to an existent directory.
+ * If not, epocRootValue is set to an empty string and an error message is printed.
+ */
+static void checkEpocRootExists(const QString &source)
+{
+ if (!epocRootValue.isEmpty()) {
+ QDir dir(epocRootValue);
+ if (!dir.exists()) {
+ qWarning("Warning: %s is set to an invalid path: '%s'", qPrintable(source),
+ qPrintable(epocRootValue));
+ epocRootValue = QString();
+ }
+ }
+}
+
+/**
+ * Translate path from Windows to Qt format.
+ */
+static void fixEpocRoot(QString &path)
+{
+ path.replace(QLatin1Char('\\'), QLatin1Char('/'));
+
+ if (!path.size() || path[path.size()-1] != QLatin1Char('/')) {
+ path += QLatin1Char('/');
+ }
+#ifdef Q_OS_WIN32
+ // Make sure we have drive letter in epocroot
+ if (path.startsWith(QLatin1Char('/')))
+ path.prepend(QDir::currentPath().left(2));
+#endif
+}
+
+/**
+ * Determine the epoc root for the currently active SDK.
+ */
+QString qt_epocRoot()
+{
+ if (epocRootValue.isEmpty()) {
+ // 1. If environment variable EPOCROOT is set and points to an existent
+ // directory, this is returned.
+ epocRootValue = QString::fromLocal8Bit(qgetenv("EPOCROOT").constData());
+ checkEpocRootExists(QLatin1String("EPOCROOT environment variable"));
+
+ if (epocRootValue.isEmpty()) {
+ // 2. The location of devices.xml is specified by a registry key. If this
+ // file exists, it is parsed.
+ QString devicesXmlPath = getDevicesXmlPath();
+ if (!devicesXmlPath.isEmpty()) {
+ devicesXmlPath += QLatin1String("/devices.xml");
+ QFile devicesFile(devicesXmlPath);
+ if (devicesFile.open(QIODevice::ReadOnly)) {
+
+ // 3. If the EPOCDEVICE environment variable is set and a corresponding
+ // entry is found in devices.xml, and its epocroot value points to an
+ // existent directory, it is returned.
+ // 4. If a device element marked as default is found in devices.xml and its
+ // epocroot value points to an existent directory, this is returned.
+
+ const QString epocDeviceValue = QString::fromLocal8Bit(qgetenv("EPOCDEVICE").constData());
+ bool epocDeviceFound = false;
+
+ QXmlStreamReader xml(&devicesFile);
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == QLatin1String("devices")) {
+ if (xml.attributes().value(QLatin1String("version")) == QLatin1String("1.0")) {
+ while (!(xml.isEndElement() && xml.name() == QLatin1String("devices")) && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == QLatin1String("device")) {
+ const bool isDefault = xml.attributes().value(QLatin1String("default")) == QLatin1String("yes");
+ const QString id = xml.attributes().value(QLatin1String("id")).toString();
+ const QString name = xml.attributes().value(QLatin1String("name")).toString();
+ const QString alias = xml.attributes().value(QLatin1String("alias")).toString();
+ bool epocDeviceMatch = QString(id + QLatin1String(":") + name) == epocDeviceValue;
+ if (!alias.isEmpty())
+ epocDeviceMatch |= alias == epocDeviceValue;
+ epocDeviceFound |= epocDeviceMatch;
+
+ if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) {
+ // Found a matching device
+ while (!(xml.isEndElement() && xml.name() == QLatin1String("device")) && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == QLatin1String("epocroot")) {
+ epocRootValue = xml.readElementText();
+ const QString deviceSource = epocDeviceValue.isEmpty()
+ ? QLatin1String("default device")
+ : QString(QLatin1String("EPOCDEVICE (") + epocDeviceValue + QLatin1String(")"));
+ checkEpocRootExists(deviceSource);
+ }
+ }
+
+ if (epocRootValue.isEmpty())
+ xml.raiseError(QLatin1String("No epocroot element found"));
+ }
+ }
+ }
+ } else {
+ xml.raiseError(QLatin1String("Invalid 'devices' element version"));
+ }
+ }
+ }
+ if (xml.hasError()) {
+ qWarning("Warning: Error \"%s\" when parsing devices.xml",
+ qPrintable(xml.errorString()));
+ } else {
+ if (epocRootValue.isEmpty()) {
+ if (!epocDeviceValue.isEmpty()) {
+ if (epocDeviceFound) {
+ qWarning("Warning: Missing or invalid epocroot attribute in device '%s' in devices.xml.",
+ qPrintable(epocDeviceValue));
+ } else {
+ qWarning("Warning: No device matching EPOCDEVICE (%s) in devices.xml.",
+ qPrintable(epocDeviceValue));
+ }
+ } else {
+ if (epocDeviceFound) {
+ qWarning("Warning: Missing or invalid epocroot attribute in default device in devices.xml.");
+ } else {
+ qWarning("Warning: No default device set in devices.xml.");
+ }
+ }
+ }
+ }
+ } else {
+ qWarning("Warning: Could not open file: '%s'.", qPrintable(devicesXmlPath));
+ }
+ }
+ }
+
+ if (epocRootValue.isEmpty()) {
+ // 5. An empty string is returned.
+ qWarning("Warning: failed to resolve epocroot."
+#ifdef Q_OS_WIN32
+ "\nEither\n"
+ " 1. Set EPOCROOT environment variable to a valid value.\n"
+ " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY
+ " registry key is set, and then\n"
+ " a. Set EPOCDEVICE environment variable to a valid device\n"
+ " or b. Specify a default device in the devices.xml file.");
+#else
+ " Set EPOCROOT environment variable to a valid value.");
+#endif
+ } else {
+ fixEpocRoot(epocRootValue);
+ }
+ }
+
+ return epocRootValue;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/shared/symbian/epocroot.pri b/tools/shared/symbian/epocroot.pri
new file mode 100644
index 0000000000..f0f0dab535
--- /dev/null
+++ b/tools/shared/symbian/epocroot.pri
@@ -0,0 +1,11 @@
+# Epocroot resolving is only required for tools, so omit it from all mobile/embedded builds
+!symbian:!wince*:!embedded {
+HEADERS += \
+ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h
+SOURCES += \
+ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp
+INCLUDEPATH += $$QT_SOURCE_TREE/tools/shared
+DEFINES += QLIBRARYINFO_EPOCROOT
+}
diff --git a/tools/shared/symbian/epocroot_p.h b/tools/shared/symbian/epocroot_p.h
new file mode 100644
index 0000000000..61197dc653
--- /dev/null
+++ b/tools/shared/symbian/epocroot_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_SYMBIAN_EPOCROOT_H
+#define QT_SYMBIAN_EPOCROOT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+/**
+ * Determine the epoc root for the currently active SDK.
+ *
+ * The algorithm used is as follows:
+ * 1. If environment variable EPOCROOT is set and points to an existent
+ * directory, this is returned.
+ * 2. The location of devices.xml is specified by a registry key. If this
+ * file exists, it is parsed.
+ * 3. If the EPOCDEVICE environment variable is set and a corresponding
+ * entry is found in devices.xml, and its epocroot value points to an
+ * existent directory, it is returned.
+ * 4. If a device element marked as default is found in devices.xml and its
+ * epocroot value points to an existent directory, this is returned.
+ * 5. An empty string is returned.
+ *
+ * Any return value other than the empty string therefore is guaranteed to
+ * point to an existent directory.
+ */
+QString qt_epocRoot();
+
+QT_END_NAMESPACE
+
+#endif // QT_SYMBIAN_EPOCROOT_H
+
diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp
new file mode 100644
index 0000000000..87808c4060
--- /dev/null
+++ b/tools/shared/windows/registry.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qstringlist.h>
+#include "registry_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#ifdef Q_OS_WIN32
+/*!
+ Returns the path part of a registry key.
+ e.g.
+ For a key
+ "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
+ it returns
+ "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\"
+*/
+static QString keyPath(const QString &rKey)
+{
+ int idx = rKey.lastIndexOf(QLatin1Char('\\'));
+ if (idx == -1)
+ return QString();
+ return rKey.left(idx + 1);
+}
+
+/*!
+ Returns the name part of a registry key.
+ e.g.
+ For a key
+ "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
+ it returns
+ "ProductDir"
+*/
+static QString keyName(const QString &rKey)
+{
+ int idx = rKey.lastIndexOf(QLatin1Char('\\'));
+ if (idx == -1)
+ return rKey;
+
+ QString res(rKey.mid(idx + 1));
+ if (res == QLatin1String("Default") || res == QLatin1String("."))
+ res = QString();
+ return res;
+}
+#endif
+
+QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey)
+{
+ QString result;
+
+#ifdef Q_OS_WIN32
+ QString rSubkeyName = keyName(rSubkey);
+ QString rSubkeyPath = keyPath(rSubkey);
+
+ HKEY handle = 0;
+ LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
+
+ if (res != ERROR_SUCCESS)
+ return QString();
+
+ // get the size and type of the value
+ DWORD dataType;
+ DWORD dataSize;
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
+ if (res != ERROR_SUCCESS) {
+ RegCloseKey(handle);
+ return QString();
+ }
+
+ // get the value
+ QByteArray data(dataSize, 0);
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
+ reinterpret_cast<unsigned char*>(data.data()), &dataSize);
+ if (res != ERROR_SUCCESS) {
+ RegCloseKey(handle);
+ return QString();
+ }
+
+ switch (dataType) {
+ case REG_EXPAND_SZ:
+ case REG_SZ: {
+ result = QString::fromWCharArray(((const wchar_t *)data.constData()));
+ break;
+ }
+
+ case REG_MULTI_SZ: {
+ QStringList l;
+ int i = 0;
+ for (;;) {
+ QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
+ i += s.length() + 1;
+
+ if (s.isEmpty())
+ break;
+ l.append(s);
+ }
+ result = l.join(QLatin1String(", "));
+ break;
+ }
+
+ case REG_NONE:
+ case REG_BINARY: {
+ result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
+ break;
+ }
+
+ case REG_DWORD_BIG_ENDIAN:
+ case REG_DWORD: {
+ Q_ASSERT(data.size() == sizeof(int));
+ int i;
+ memcpy((char*)&i, data.constData(), sizeof(int));
+ result = QString::number(i);
+ break;
+ }
+
+ default:
+ qWarning("QSettings: unknown data %u type in windows registry", quint32(dataType));
+ break;
+ }
+
+ RegCloseKey(handle);
+#else
+ Q_UNUSED(parentHandle);
+ Q_UNUSED(rSubkey)
+#endif
+
+ return result;
+}
+
+QT_END_NAMESPACE
+
diff --git a/tools/shared/windows/registry_p.h b/tools/shared/windows/registry_p.h
new file mode 100644
index 0000000000..226cedc49e
--- /dev/null
+++ b/tools/shared/windows/registry_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_WINDOWS_REGISTRY_H
+#define QT_WINDOWS_REGISTRY_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+#include <QtCore/qglobal.h>
+
+#ifdef Q_OS_WIN32
+ #include <QtCore/qt_windows.h>
+#else
+ typedef void* HKEY;
+#endif
+
+#include <QtCore/qstring.h>
+
+/**
+ * Read a value from the Windows registry.
+ *
+ * If the key is not found, or the registry cannot be accessed (for example
+ * if this code is compiled for a platform other than Windows), a null
+ * string is returned.
+ */
+QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey);
+
+QT_END_NAMESPACE
+
+#endif // QT_WINDOWS_REGISTRY_H
+
diff --git a/tools/uilib/abstractformbuilder.cpp b/tools/uilib/abstractformbuilder.cpp
new file mode 100644
index 0000000000..ecb43db89f
--- /dev/null
+++ b/tools/uilib/abstractformbuilder.cpp
@@ -0,0 +1,3209 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**sw
+****************************************************************************/
+
+#include "abstractformbuilder.h"
+#include "formbuilderextra_p.h"
+#include "resourcebuilder_p.h"
+#include "textbuilder_p.h"
+#include "ui4_p.h"
+#include "properties_p.h"
+
+#include <QtCore/QVariant>
+#include <QtCore/QMetaProperty>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDir>
+#include <QtCore/QQueue>
+#include <QtCore/QHash>
+#include <QtCore/qdebug.h>
+#include <QtCore/QCoreApplication>
+
+#include <QtGui/QAction>
+#include <QtGui/QActionGroup>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QComboBox>
+#include <QtGui/QFontComboBox>
+#include <QtGui/QGridLayout>
+#ifndef QT_NO_FORMLAYOUT
+# include <QtGui/QFormLayout>
+#endif
+#include <QtGui/QIcon>
+#include <QtGui/QListWidget>
+#include <QtGui/QMainWindow>
+#include <QtGui/QPixmap>
+#include <QtGui/QStatusBar>
+#include <QtGui/QTreeWidget>
+#include <QtGui/QTableWidget>
+#include <QtGui/QWidget>
+#include <QtGui/QSplitter>
+#include <QtGui/QScrollArea>
+#include <QtGui/QAbstractButton>
+#include <QtGui/QAbstractItemView>
+#include <QtGui/QHeaderView>
+#ifndef QFORMINTERNAL_NAMESPACE
+# include <private/qlayout_p.h> // Compiling within Designer
+#endif
+
+#include <QtXml/QXmlStreamReader>
+
+#include <QtGui/QDialog>
+
+// containers
+#include <QtGui/QToolBox>
+#include <QtGui/QStackedWidget>
+#include <QtGui/QTabWidget>
+#include <QtGui/QToolBar>
+#include <QtGui/QMenuBar>
+#include <QtGui/QDockWidget>
+#include <QtGui/QMdiArea>
+#include <QtGui/QWorkspace>
+#include <QtGui/QWizard>
+#include <QtGui/QWizardPage>
+
+#include <QtCore/qdebug.h>
+
+#include <limits.h>
+
+Q_DECLARE_METATYPE(QWidgetList)
+
+static const char *buttonGroupPropertyC = "buttonGroup";
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+using namespace QFormInternal;
+#endif
+
+class QFriendlyLayout: public QLayout
+{
+public:
+ inline QFriendlyLayout() { Q_ASSERT(0); }
+
+#ifdef QFORMINTERNAL_NAMESPACE
+ friend class QFormInternal::QAbstractFormBuilder;
+#else
+ friend class QAbstractFormBuilder;
+#endif
+};
+
+/*!
+ \class QAbstractFormBuilder
+
+ \brief The QAbstractFormBuilder class provides a default
+ implementation for classes that create user interfaces at
+ run-time.
+
+ \inmodule QtDesigner
+
+ QAbstractFormBuilder provides a standard interface and a default
+ implementation for constructing forms from user interface
+ files. It is not intended to be instantiated directly. Use the
+ QFormBuilder class to create user interfaces from UI files at
+ run-time. For example:
+
+ \snippet doc/src/snippets/code/tools_designer_src_lib_uilib_abstractformbuilder.cpp 0
+
+ To override certain aspects of the form builder's behavior,
+ subclass QAbstractFormBuilder and reimplement the relevant virtual
+ functions:
+
+ \list
+ \o load() handles reading of UI format files from arbitrary
+ QIODevices, and construction of widgets from the XML data
+ that they contain.
+ \o save() handles saving of widget details in UI format to
+ arbitrary QIODevices.
+ \o workingDirectory() and setWorkingDirectory() control the
+ directory in which forms are held. The form builder looks for
+ other resources on paths relative to this directory.
+ \endlist
+
+ The QFormBuilder class is typically used by custom components and
+ applications that embed \QD. Standalone applications that need to
+ dynamically generate user interfaces at run-time use the
+ QUiLoader, found in the QtUiTools module.
+
+ \sa {QtUiTools Module}
+*/
+
+/*!
+ Constructs a new form builder.*/
+QAbstractFormBuilder::QAbstractFormBuilder() :
+ m_defaultMargin(INT_MIN),
+ m_defaultSpacing(INT_MIN)
+{
+ setResourceBuilder(new QResourceBuilder());
+ setTextBuilder(new QTextBuilder());
+}
+
+/*!
+ Destroys the form builder.*/
+QAbstractFormBuilder::~QAbstractFormBuilder()
+{
+ QFormBuilderExtra::removeInstance(this);
+}
+
+
+/*!
+ \fn QWidget *QAbstractFormBuilder::load(QIODevice *device, QWidget *parent)
+
+ Loads an XML representation of a widget from the given \a device,
+ and constructs a new widget with the specified \a parent.
+
+ \sa save()
+*/
+QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
+{
+ QXmlStreamReader reader;
+ reader.setDevice(dev);
+ DomUI ui;
+ bool initialized = false;
+
+ const QString uiElement = QLatin1String("ui");
+ while (!reader.atEnd()) {
+ if (reader.readNext() == QXmlStreamReader::StartElement) {
+ if (reader.name().compare(uiElement, Qt::CaseInsensitive) == 0) {
+ ui.read(reader);
+ initialized = true;
+ } else {
+ reader.raiseError(QCoreApplication::translate("QAbstractFormBuilder", "Unexpected element <%1>").arg(reader.name().toString()));
+ }
+ }
+ }
+ if (reader.hasError()) {
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the UI file at line %1, column %2: %3")
+ .arg(reader.lineNumber()).arg(reader.columnNumber())
+ .arg(reader.errorString()));
+ return 0;
+ }
+ if (!initialized) {
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid UI file: The root element <ui> is missing."));
+ return 0;
+ }
+
+ QWidget *widget = create(&ui, parentWidget);
+ return widget;
+}
+
+/*!
+ \internal
+*/
+QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
+{
+ typedef QFormBuilderExtra::ButtonGroupHash ButtonGroupHash;
+
+ QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this);
+ formBuilderPrivate->clear();
+ if (const DomLayoutDefault *def = ui->elementLayoutDefault()) {
+ m_defaultMargin = def->hasAttributeMargin() ? def->attributeMargin() : INT_MIN;
+ m_defaultSpacing = def->hasAttributeSpacing() ? def->attributeSpacing() : INT_MIN;
+ }
+
+ DomWidget *ui_widget = ui->elementWidget();
+ if (!ui_widget)
+ return 0;
+
+ initialize(ui);
+
+ if (const DomButtonGroups *domButtonGroups = ui->elementButtonGroups())
+ formBuilderPrivate->registerButtonGroups(domButtonGroups);
+
+ if (QWidget *widget = create(ui_widget, parentWidget)) {
+ // Reparent button groups that were actually created to main container for them to be found in the signal/slot part
+ const ButtonGroupHash &buttonGroups = formBuilderPrivate->buttonGroups();
+ if (!buttonGroups.empty()) {
+ const ButtonGroupHash::const_iterator cend = buttonGroups.constEnd();
+ for (ButtonGroupHash::const_iterator it = buttonGroups.constBegin(); it != cend; ++it)
+ if (it.value().second)
+ it.value().second->setParent(widget);
+ }
+ createConnections(ui->elementConnections(), widget);
+ createResources(ui->elementResources()); // maybe this should go first, before create()...
+ applyTabStops(widget, ui->elementTabStops());
+ formBuilderPrivate->applyInternalProperties();
+ reset();
+ formBuilderPrivate->clear();
+ return widget;
+ }
+ formBuilderPrivate->clear();
+ return 0;
+}
+
+/*!
+ \internal
+ Retrieve relevant information from the custom widgets section.
+ Called by create(DomUI *, QWidget *); call manually if you
+ just use create(DomWidget *, QWidget *) on some child widget of DomUI.
+ */
+
+void QAbstractFormBuilder::initialize(const DomUI *ui)
+{
+ typedef QList<DomCustomWidget*> DomCustomWidgetList;
+
+ DomCustomWidgets *domCustomWidgets = ui->elementCustomWidgets();
+ createCustomWidgets(domCustomWidgets);
+
+ if (domCustomWidgets) {
+ const DomCustomWidgetList customWidgets = domCustomWidgets->elementCustomWidget();
+ if (!customWidgets.empty()) {
+ QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this);
+ const DomCustomWidgetList::const_iterator cend = customWidgets.constEnd();
+ for (DomCustomWidgetList::const_iterator it = customWidgets.constBegin(); it != cend; ++it)
+ formBuilderPrivate->storeCustomWidgetData((*it)->elementClass(), *it);
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
+{
+ QWidget *w = createWidget(ui_widget->attributeClass(), parentWidget, ui_widget->attributeName());
+ if (!w)
+ return 0;
+
+ applyProperties(w, ui_widget->elementProperty());
+
+ foreach (DomAction *ui_action, ui_widget->elementAction()) {
+ QAction *child_action = create(ui_action, w);
+ Q_UNUSED( child_action );
+ }
+
+ foreach (DomActionGroup *ui_action_group, ui_widget->elementActionGroup()) {
+ QActionGroup *child_action_group = create(ui_action_group, w);
+ Q_UNUSED( child_action_group );
+ }
+
+ QWidgetList children;
+ foreach (DomWidget *ui_child, ui_widget->elementWidget()) {
+ if (QWidget *child = create(ui_child, w)) {
+ children += child;
+ } else {
+ const QString className = ui_child->elementClass().empty() ? QString() : ui_child->elementClass().front();
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "The creation of a widget of the class '%1' failed.").arg(className));
+ }
+ }
+
+ foreach (DomLayout *ui_lay, ui_widget->elementLayout()) {
+ QLayout *child_lay = create(ui_lay, 0, w);
+ Q_UNUSED( child_lay );
+ }
+
+ const QList<DomActionRef *> addActions = ui_widget->elementAddAction();
+ if (!addActions.empty()) {
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ foreach (DomActionRef *ui_action_ref, addActions) {
+ const QString name = ui_action_ref->attributeName();
+ if (name == strings.separator) {
+ QAction *sep = new QAction(w);
+ sep->setSeparator(true);
+ w->addAction(sep);
+ addMenuAction(sep);
+ } else if (QAction *a = m_actions.value(name)) {
+ w->addAction(a);
+ } else if (QActionGroup *g = m_actionGroups.value(name)) {
+ w->addActions(g->actions());
+ } else if (QMenu *menu = w->findChild<QMenu*>(name)) {
+ w->addAction(menu->menuAction());
+ addMenuAction(menu->menuAction());
+ }
+ }
+ }
+
+ loadExtraInfo(ui_widget, w, parentWidget);
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+ QString scriptErrorMessage;
+ QFormBuilderExtra *extra = QFormBuilderExtra::instance(this);
+ extra->formScriptRunner().run(ui_widget,
+ extra->customWidgetScript(ui_widget->attributeClass()),
+ w, children, &scriptErrorMessage);
+#endif
+ addItem(ui_widget, w, parentWidget);
+
+ if (qobject_cast<QDialog *>(w) && parentWidget)
+ w->setAttribute(Qt::WA_Moved, false); // So that QDialog::setVisible(true) will center it
+
+ const QStringList zOrderNames = ui_widget->elementZOrder();
+ if (!zOrderNames.isEmpty()) {
+ QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(w->property("_q_zOrder"));
+ foreach (const QString &widgetName, zOrderNames) {
+ if (QWidget *child = w->findChild<QWidget*>(widgetName)) {
+ if (child->parentWidget() == w) {
+ zOrder.removeAll(child);
+ zOrder.append(child);
+ child->raise();
+ }
+ }
+ }
+ w->setProperty("_q_zOrder", QVariant::fromValue(zOrder));
+ }
+
+ return w;
+}
+
+/*!
+ \internal
+*/
+QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent)
+{
+ QAction *a = createAction(parent, ui_action->attributeName());
+ if (!a)
+ return 0;
+
+ m_actions.insert(ui_action->attributeName(), a);
+ applyProperties(a, ui_action->elementProperty());
+ return a;
+}
+
+/*!
+ \internal
+*/
+QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObject *parent)
+{
+ QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName());
+ if (!a)
+ return 0;
+ m_actionGroups.insert(ui_action_group->attributeName(), a);
+ applyProperties(a, ui_action_group->elementProperty());
+
+ foreach (DomAction *ui_action, ui_action_group->elementAction()) {
+ QAction *child_action = create(ui_action, a);
+ Q_UNUSED( child_action );
+ }
+
+ foreach (DomActionGroup *g, ui_action_group->elementActionGroup()) {
+ QActionGroup *child_action_group = create(g, parent);
+ Q_UNUSED( child_action_group );
+ }
+
+ return a;
+}
+
+// figure out the toolbar area of a DOM attrib list.
+// By legacy, it is stored as an integer. As of 4.3.0, it is the enumeration value.
+Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomPropertyHash &attributes) {
+ const DomProperty *attr = attributes.value(QFormBuilderStrings::instance().toolBarAreaAttribute);
+ if (!attr)
+ return Qt::TopToolBarArea;
+ switch(attr->kind()) {
+ case DomProperty::Number:
+ return static_cast<Qt::ToolBarArea>(attr->elementNumber());
+ case DomProperty::Enum:
+ return enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::ToolBarArea>("toolBarArea", attr->elementEnum().toLatin1());
+ default:
+ break;
+ }
+ return Qt::TopToolBarArea;
+}
+
+/*!
+ \internal
+*/
+bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
+{
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
+
+ if (parentWidget == 0)
+ return true;
+ // Check special cases. First: Custom container
+ const QString className = QLatin1String(parentWidget->metaObject()->className());
+ const QString addPageMethod = QFormBuilderExtra::instance(this)->customWidgetAddPageMethod(className);
+ if (!addPageMethod.isEmpty()) {
+ // If this fails ( non-existent or non-slot), use ContainerExtension in Designer, else it can't be helped
+ return QMetaObject::invokeMethod(parentWidget, addPageMethod.toUtf8().constData(), Qt::DirectConnection, Q_ARG(QWidget*, widget));
+ }
+
+ if (QMainWindow *mw = qobject_cast<QMainWindow*>(parentWidget)) {
+
+#ifndef QT_NO_MENUBAR
+ // the menubar
+ if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(widget)) {
+ mw->setMenuBar(menuBar);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_TOOLBAR
+ // apply the toolbar's attributes
+ else if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
+ mw->addToolBar(toolbarAreaFromDOMAttributes(attributes), toolBar);
+ // check break
+ if (const DomProperty *attr = attributes.value(strings.toolBarBreakAttribute))
+ if (attr->elementBool() == strings.trueValue)
+ mw->insertToolBarBreak (toolBar);
+
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_STATUSBAR
+ // statusBar
+ else if (QStatusBar *statusBar = qobject_cast<QStatusBar*>(widget)) {
+ mw->setStatusBar(statusBar);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_DOCKWIDGET
+ // apply the dockwidget's attributes
+ else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
+ if (const DomProperty *attr = attributes.value(strings.dockWidgetAreaAttribute)) {
+ Qt::DockWidgetArea area = static_cast<Qt::DockWidgetArea>(attr->elementNumber());
+ if (!dockWidget->isAreaAllowed(area)) {
+ if (dockWidget->isAreaAllowed(Qt::LeftDockWidgetArea))
+ area = Qt::LeftDockWidgetArea;
+ else if (dockWidget->isAreaAllowed(Qt::RightDockWidgetArea))
+ area = Qt::RightDockWidgetArea;
+ else if (dockWidget->isAreaAllowed(Qt::TopDockWidgetArea))
+ area = Qt::TopDockWidgetArea;
+ else if (dockWidget->isAreaAllowed(Qt::BottomDockWidgetArea))
+ area = Qt::BottomDockWidgetArea;
+ }
+ mw->addDockWidget(area, dockWidget);
+ } else {
+ mw->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
+ }
+ return true;
+ }
+#endif
+
+ else if (! mw->centralWidget()) {
+ mw->setCentralWidget(widget);
+ return true;
+ }
+ }
+
+#ifndef QT_NO_TABWIDGET
+ else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(parentWidget)) {
+ widget->setParent(0);
+
+ const int tabIndex = tabWidget->count();
+ if (const DomProperty *titleP = attributes.value(strings.titleAttribute, 0))
+ tabWidget->addTab(widget, toString(titleP->elementString()));
+ else
+ tabWidget->addTab(widget, strings.defaultTitle);
+
+ if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
+ QVariant nativeValue = resourceBuilder()->toNativeValue(v);
+ tabWidget->setTabIcon(tabIndex, qvariant_cast<QIcon>(nativeValue));
+ }
+
+#ifndef QT_NO_TOOLTIP
+ if (const DomProperty *ptoolTip = attributes.value(strings.toolTipAttribute)) {
+ tabWidget->setTabToolTip(tabIndex, toString(ptoolTip->elementString()));
+ }
+#endif
+
+#ifndef QT_NO_WHATSTHIS
+ if (const DomProperty *pwhatsThis = attributes.value(strings.whatsThisAttribute)) {
+ tabWidget->setTabWhatsThis(tabIndex, toString(pwhatsThis->elementString()));
+ }
+#endif
+
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_TOOLBOX
+ else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
+ const int tabIndex = toolBox->count();
+ if (const DomProperty *labelP = attributes.value(strings.labelAttribute, 0))
+ toolBox->addItem(widget, toString(labelP->elementString()));
+ else
+ toolBox->addItem(widget, strings.defaultTitle);
+
+ if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
+ QVariant nativeValue = resourceBuilder()->toNativeValue(v);
+ toolBox->setItemIcon(tabIndex, qvariant_cast<QIcon>(nativeValue));
+ }
+
+#ifndef QT_NO_TOOLTIP
+ if (const DomProperty *ptoolTip = attributes.value(strings.toolTipAttribute)) {
+ toolBox->setItemToolTip(tabIndex, toString(ptoolTip->elementString()));
+ }
+#endif
+
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_STACKEDWIDGET
+ else if (QStackedWidget *stackedWidget = qobject_cast<QStackedWidget*>(parentWidget)) {
+ stackedWidget->addWidget(widget);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_SPLITTER
+ else if (QSplitter *splitter = qobject_cast<QSplitter*>(parentWidget)) {
+ splitter->addWidget(widget);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_MDIAREA
+ else if (QMdiArea *mdiArea = qobject_cast<QMdiArea*>(parentWidget)) {
+ mdiArea->addSubWindow(widget);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_WORKSPACE
+ else if (QWorkspace *ws = qobject_cast<QWorkspace*>(parentWidget)) {
+ ws->addWindow(widget);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_DOCKWIDGET
+ else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(parentWidget)) {
+ dockWidget->setWidget(widget);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_SCROLLAREA
+ else if (QScrollArea *scrollArea = qobject_cast<QScrollArea*>(parentWidget)) {
+ scrollArea->setWidget(widget);
+ return true;
+ }
+#endif
+
+#ifndef QT_NO_WIZARD
+ else if (QWizard *wizard = qobject_cast<QWizard *>(parentWidget)) {
+ QWizardPage *page = qobject_cast<QWizardPage*>(widget);
+ if (!page) {
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Attempt to add child that is not of class QWizardPage to QWizard."));
+ return false;
+ }
+ wizard->addPage(page);
+ return true;
+ }
+#endif
+ return false;
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int *margin, int *spacing)
+{
+ Q_UNUSED(parent)
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
+
+ int mar = INT_MIN;
+ int spac = INT_MIN;
+ if (const DomProperty *p = properties.value(strings.marginProperty, 0))
+ mar = p->elementNumber();
+
+ if (const DomProperty *p = properties.value(strings.spacingProperty, 0))
+ spac = p->elementNumber();
+
+#ifdef Q_OS_MAC
+ // here we recognize UI file < 4.3 (no we don't store margin property)
+ if (mar != INT_MIN) {
+ const int defaultMargin = parent->inherits("QLayoutWidget") ? 0 : 9;
+ if (mar == defaultMargin)
+ mar = INT_MIN;
+ if (spac == 6)
+ spac = INT_MIN;
+
+ if (mar == INT_MIN || spac == INT_MIN) {
+ QList<DomProperty *> properties = ui_layout->elementProperty();
+ QMutableListIterator<DomProperty *> it(properties);
+ while (it.hasNext()) {
+ DomProperty *prop = it.next();
+ if ((mar == INT_MIN && prop->attributeName() == strings.marginProperty) ||
+ (spac == INT_MIN && prop->attributeName() == strings.spacingProperty)) {
+ it.remove();
+ delete prop;
+ }
+ }
+ ui_layout->setElementProperty(properties);
+ }
+ }
+#endif
+ if (margin)
+ *margin = mar;
+ if (spacing)
+ *spacing = spac;
+}
+
+/*!
+ \internal
+*/
+QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayout, QWidget *parentWidget)
+{
+ QObject *p = parentLayout;
+
+ if (p == 0)
+ p = parentWidget;
+
+ Q_ASSERT(p != 0);
+
+ bool tracking = false;
+
+ if (p == parentWidget && parentWidget->layout()) {
+ tracking = true;
+ p = parentWidget->layout();
+ }
+
+ QLayout *layout = createLayout(ui_layout->attributeClass(), p, ui_layout->hasAttributeName() ? ui_layout->attributeName() : QString());
+
+ if (layout == 0)
+ return 0;
+
+ if (tracking && layout->parent() == 0) {
+ QBoxLayout *box = qobject_cast<QBoxLayout*>(parentWidget->layout());
+ if (!box) { // only QBoxLayout is supported
+ const QString widgetClass = QString::fromUtf8(parentWidget->metaObject()->className());
+ const QString layoutClass = QString::fromUtf8(parentWidget->layout()->metaObject()->className());
+ const QString msg = QCoreApplication::translate("QAbstractFormBuilder", "Attempt to add a layout to a widget '%1' (%2) which already has a layout of non-box type %3.\n"
+ "This indicates an inconsistency in the ui-file.").
+ arg(parentWidget->objectName(), widgetClass, layoutClass);
+ uiLibWarning(msg);
+ return 0;
+ }
+ box->addLayout(layout);
+ }
+
+ int margin = INT_MIN, spacing = INT_MIN;
+ layoutInfo(ui_layout, p, &margin, &spacing);
+
+ if (margin != INT_MIN) {
+ layout->setMargin(margin);
+ } else {
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ int left, top, right, bottom;
+ left = top = right = bottom = -1;
+ layout->getContentsMargins(&left, &top, &right, &bottom);
+
+ const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
+
+ if (const DomProperty *p = properties.value(strings.leftMarginProperty, 0))
+ left = p->elementNumber();
+
+ if (const DomProperty *p = properties.value(strings.topMarginProperty, 0))
+ top = p->elementNumber();
+
+ if (const DomProperty *p = properties.value(strings.rightMarginProperty, 0))
+ right = p->elementNumber();
+
+ if (const DomProperty *p = properties.value(strings.bottomMarginProperty, 0))
+ bottom = p->elementNumber();
+
+ layout->setContentsMargins(left, top, right, bottom);
+ }
+
+ if (spacing != INT_MIN) {
+ layout->setSpacing(spacing);
+ } else {
+ QGridLayout *grid = qobject_cast<QGridLayout *>(layout);
+ if (grid) {
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
+
+ if (const DomProperty *p = properties.value(strings.horizontalSpacingProperty, 0))
+ grid->setHorizontalSpacing(p->elementNumber());
+ if (const DomProperty *p = properties.value(strings.verticalSpacingProperty, 0))
+ grid->setVerticalSpacing(p->elementNumber());
+ }
+ }
+
+ applyProperties(layout, ui_layout->elementProperty());
+
+ foreach (DomLayoutItem *ui_item, ui_layout->elementItem()) {
+ if (QLayoutItem *item = create(ui_item, layout, parentWidget)) {
+ addItem(ui_item, item, layout);
+ }
+ }
+ // Check the box stretch attributes
+ if (QBoxLayout *box = qobject_cast<QBoxLayout*>(layout)) {
+ const QString boxStretch = ui_layout->attributeStretch();
+ if (!boxStretch.isEmpty())
+ QFormBuilderExtra::setBoxLayoutStretch(boxStretch, box);
+ }
+ // Check the grid stretch/minimum size attributes
+ if (QGridLayout *grid = qobject_cast<QGridLayout*>(layout)) {
+ // Stretch
+ const QString gridRowStretch = ui_layout->attributeRowStretch();
+ if (!gridRowStretch.isEmpty())
+ QFormBuilderExtra::setGridLayoutRowStretch(gridRowStretch, grid);
+ const QString gridColumnStretch = ui_layout->attributeColumnStretch();
+ if (!gridColumnStretch.isEmpty())
+ QFormBuilderExtra::setGridLayoutColumnStretch(gridColumnStretch, grid);
+ // Minimum size
+ const QString gridColumnMinimumWidth = ui_layout->attributeColumnMinimumWidth();
+ if (!gridColumnMinimumWidth.isEmpty())
+ QFormBuilderExtra::setGridLayoutColumnMinimumWidth(gridColumnMinimumWidth, grid);
+ const QString gridRowMinimumHeight = ui_layout->attributeRowMinimumHeight();
+ if (!gridRowMinimumHeight.isEmpty())
+ QFormBuilderExtra::setGridLayoutRowMinimumHeight(gridRowMinimumHeight, grid);
+ }
+ return layout;
+}
+
+#ifndef QT_NO_FORMLAYOUT
+static inline QFormLayout::ItemRole formLayoutRole(int column, int colspan)
+{
+ if (colspan > 1)
+ return QFormLayout::SpanningRole;
+ return column == 0 ? QFormLayout::LabelRole : QFormLayout::FieldRole;
+}
+#endif
+
+static inline QString alignmentValue(Qt::Alignment a)
+{
+ QString h,v;
+ switch (a & Qt::AlignHorizontal_Mask) {
+ case Qt::AlignLeft:
+ h = QLatin1String("Qt::AlignLeft");
+ break;
+ case Qt::AlignRight:
+ h = QLatin1String("Qt::AlignRight");
+ break;
+ case Qt::AlignHCenter:
+ h = QLatin1String("Qt::AlignHCenter");
+ break;
+ case Qt::AlignJustify:
+ h = QLatin1String("Qt::AlignJustify");
+ break;
+ }
+ switch (a & Qt::AlignVertical_Mask) {
+ case Qt::AlignTop:
+ v = QLatin1String("Qt::AlignTop");
+ break;
+ case Qt::AlignBottom:
+ v = QLatin1String("Qt::AlignBottom");
+ break;
+ case Qt::AlignVCenter:
+ v = QLatin1String("Qt::AlignVCenter");
+ break;
+ }
+ if (h.isEmpty() && v.isEmpty())
+ return QString();
+ if (!v.isEmpty()) {
+ if (!h.isEmpty())
+ h += QLatin1Char('|');
+ h += v;
+ }
+ return h;
+}
+
+static inline Qt::Alignment alignmentFromDom(const QString &in)
+{
+ Qt::Alignment rc = 0;
+ if (!in.isEmpty()) {
+ foreach (const QString &f, in.split(QLatin1Char('|'))) {
+ if (f == QLatin1String("Qt::AlignLeft")) {
+ rc |= Qt::AlignLeft;
+ } else if (f == QLatin1String("Qt::AlignRight")) {
+ rc |= Qt::AlignRight;
+ } else if (f == QLatin1String("Qt::AlignHCenter")) {
+ rc |= Qt::AlignHCenter;
+ } else if (f == QLatin1String("Qt::AlignJustify")) {
+ rc |= Qt::AlignJustify;
+ } else if (f == QLatin1String("Qt::AlignTop")) {
+ rc |= Qt::AlignTop;
+ } else if (f == QLatin1String("Qt::AlignBottom")) {
+ rc |= Qt::AlignBottom;
+ } else if (f == QLatin1String("Qt::AlignVCenter")) {
+ rc |= Qt::AlignVCenter;
+ }
+ }
+ }
+ return rc;
+}
+
+/*!
+ \internal
+*/
+bool QAbstractFormBuilder::addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout)
+{
+ // Calling addChildWidget(), etc. is required to maintain consistency of the layouts,
+ // see documentation of addItem(), which should ideally not be used.
+ if (item->widget()) {
+ static_cast<QFriendlyLayout*>(layout)->addChildWidget(item->widget());
+ } else if (item->layout()) {
+ static_cast<QFriendlyLayout*>(layout)->addChildLayout(item->layout());
+ } else if (item->spacerItem()) {
+ // nothing to do
+ } else {
+ return false;
+ }
+
+ if (QGridLayout *grid = qobject_cast<QGridLayout*>(layout)) {
+ const int rowSpan = ui_item->hasAttributeRowSpan() ? ui_item->attributeRowSpan() : 1;
+ const int colSpan = ui_item->hasAttributeColSpan() ? ui_item->attributeColSpan() : 1;
+ grid->addItem(item, ui_item->attributeRow(), ui_item->attributeColumn(),
+ rowSpan, colSpan, item->alignment());
+ return true;
+ }
+#ifndef QT_NO_FORMLAYOUT
+ if (QFormLayout *form = qobject_cast<QFormLayout *>(layout)) {
+ const int row = ui_item->attributeRow();
+ const int colSpan = ui_item->hasAttributeColSpan() ? ui_item->attributeColSpan() : 1;
+ form->setItem(row, formLayoutRole(ui_item->attributeColumn(), colSpan), item);
+ return true;
+ }
+
+#endif
+ layout->addItem(item);
+ return true;
+}
+
+/*!
+ \internal
+*/
+QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout *layout, QWidget *parentWidget)
+{
+ switch (ui_layoutItem->kind()) {
+ case DomLayoutItem::Widget: {
+ if (QWidget *w = create(ui_layoutItem->elementWidget(), parentWidget)) {
+#ifdef QFORMINTERNAL_NAMESPACE // uilib
+ QWidgetItem *item = new QWidgetItemV2(w);
+#else // Within Designer: Use factory method that returns special items that refuse to shrink to 0,0
+ QWidgetItem *item = QLayoutPrivate::createWidgetItem(layout, w);
+#endif
+ item->setAlignment(alignmentFromDom(ui_layoutItem->attributeAlignment()));
+ return item;
+ }
+ qWarning() << QCoreApplication::translate("QAbstractFormBuilder", "Empty widget item in %1 '%2'.").arg(QString::fromUtf8(layout->metaObject()->className()), layout->objectName());
+ return 0;
+ }
+ case DomLayoutItem::Spacer: {
+ QSize size(0, 0);
+ QSizePolicy::Policy sizeType = QSizePolicy::Expanding;
+ bool isVspacer = false;
+
+ const DomSpacer *ui_spacer = ui_layoutItem->elementSpacer();
+
+ const QMetaEnum sizePolicy_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
+ const QMetaEnum orientation_enum = metaEnum<QAbstractFormBuilderGadget>("orientation");
+
+ const QList<DomProperty *> spacerProperties = ui_spacer->elementProperty();
+ if (!spacerProperties.empty()) {
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ foreach (DomProperty *p, spacerProperties) {
+ const QVariant v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p); // ### remove me
+ if (v.isNull())
+ continue;
+ if (p->attributeName() == strings.sizeHintProperty && p->kind() == DomProperty::Size) {
+ size = v.toSize(); // ### remove me
+ } else if (p->attributeName() == strings.sizeTypeProperty && p->kind() == DomProperty::Enum) {
+ sizeType = static_cast<QSizePolicy::Policy>(v.toInt());
+ } else if (p->attributeName() == strings.orientationProperty && p->kind() == DomProperty::Enum) {
+ const Qt::Orientation o = static_cast<Qt::Orientation>(v.toInt());
+ isVspacer = (o == Qt::Vertical);
+ }
+ }
+ }
+
+ QSpacerItem *spacer = 0;
+ if (isVspacer)
+ spacer = new QSpacerItem(size.width(), size.height(), QSizePolicy::Minimum, sizeType);
+ else
+ spacer = new QSpacerItem(size.width(), size.height(), sizeType, QSizePolicy::Minimum);
+ return spacer; }
+
+ case DomLayoutItem::Layout:
+ return create(ui_layoutItem->elementLayout(), layout, parentWidget);
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties)
+{
+ typedef QList<DomProperty*> DomPropertyList;
+
+ if (properties.empty())
+ return;
+
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+
+ const DomPropertyList::const_iterator cend = properties.constEnd();
+ for (DomPropertyList::const_iterator it = properties.constBegin(); it != cend; ++it) {
+ const QVariant v = toVariant(o->metaObject(), *it);
+ if (!v.isNull()) {
+ const QString attributeName = (*it)->attributeName();
+ if (!fb->applyPropertyInternally(o, attributeName, v))
+ o->setProperty(attributeName.toUtf8(), v);
+ }
+ }
+}
+
+
+/*!
+ \internal
+ Check whether a property is applied internally by QAbstractFormBuilder. Call this
+ from overwritten applyProperties().
+*/
+
+bool QAbstractFormBuilder::applyPropertyInternally(QObject *o, const QString &propertyName, const QVariant &value)
+{
+ return QFormBuilderExtra::instance(this)->applyPropertyInternally(o,propertyName, value);
+}
+
+/*!
+ \internal
+*/
+
+QVariant QAbstractFormBuilder::toVariant(const QMetaObject *meta, DomProperty *p)
+{
+ return domPropertyToVariant(this, meta, p);
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::setupColorGroup(QPalette &palette, QPalette::ColorGroup colorGroup,
+ DomColorGroup *group)
+{
+ // old format
+ const QList<DomColor*> colors = group->elementColor();
+ for (int role = 0; role < colors.size(); ++role) {
+ const DomColor *color = colors.at(role);
+ const QColor c(color->elementRed(), color->elementGreen(), color->elementBlue());
+ palette.setColor(colorGroup, QPalette::ColorRole(role), c);
+ }
+
+ // new format
+ const QMetaEnum colorRole_enum = metaEnum<QAbstractFormBuilderGadget>("colorRole");
+
+ const QList<DomColorRole*> colorRoles = group->elementColorRole();
+ for (int role = 0; role < colorRoles.size(); ++role) {
+ const DomColorRole *colorRole = colorRoles.at(role);
+
+ if (colorRole->hasAttributeRole()) {
+ const int r = colorRole_enum.keyToValue(colorRole->attributeRole().toLatin1());
+ if (r != -1) {
+ const QBrush br = setupBrush(colorRole->elementBrush());
+ palette.setBrush(colorGroup, static_cast<QPalette::ColorRole>(r), br);
+ }
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+DomColorGroup *QAbstractFormBuilder::saveColorGroup(const QPalette &palette)
+{
+
+ const QMetaEnum colorRole_enum = metaEnum<QAbstractFormBuilderGadget>("colorRole");
+
+ DomColorGroup *group = new DomColorGroup();
+ QList<DomColorRole*> colorRoles;
+
+ const uint mask = palette.resolve();
+ for (int role = QPalette::WindowText; role < QPalette::NColorRoles; ++role) {
+ if (mask & (1 << role)) {
+ QBrush br = palette.brush(QPalette::ColorRole(role));
+
+ DomColorRole *colorRole = new DomColorRole();
+ colorRole->setElementBrush(saveBrush(br));
+ colorRole->setAttributeRole(QLatin1String(colorRole_enum.valueToKey(role)));
+ colorRoles.append(colorRole);
+ }
+ }
+
+ group->setElementColorRole(colorRoles);
+ return group;
+}
+
+/*!
+ \internal
+*/
+QBrush QAbstractFormBuilder::setupBrush(DomBrush *brush)
+{
+ QBrush br;
+ if (!brush->hasAttributeBrushStyle())
+ return br;
+
+ const Qt::BrushStyle style = enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::BrushStyle>("brushStyle", brush->attributeBrushStyle().toLatin1());
+
+ if (style == Qt::LinearGradientPattern ||
+ style == Qt::RadialGradientPattern ||
+ style == Qt::ConicalGradientPattern) {
+ const QMetaEnum gradientType_enum = metaEnum<QAbstractFormBuilderGadget>("gradientType");
+ const QMetaEnum gradientSpread_enum = metaEnum<QAbstractFormBuilderGadget>("gradientSpread");
+ const QMetaEnum gradientCoordinate_enum = metaEnum<QAbstractFormBuilderGadget>("gradientCoordinate");
+
+ const DomGradient *gradient = brush->elementGradient();
+ const QGradient::Type type = enumKeyToValue<QGradient::Type>(gradientType_enum, gradient->attributeType().toLatin1());
+
+
+ QGradient *gr = 0;
+
+ if (type == QGradient::LinearGradient) {
+ gr = new QLinearGradient(QPointF(gradient->attributeStartX(), gradient->attributeStartY()),
+ QPointF(gradient->attributeEndX(), gradient->attributeEndY()));
+ } else if (type == QGradient::RadialGradient) {
+ gr = new QRadialGradient(QPointF(gradient->attributeCentralX(), gradient->attributeCentralY()),
+ gradient->attributeRadius(),
+ QPointF(gradient->attributeFocalX(), gradient->attributeFocalY()));
+ } else if (type == QGradient::ConicalGradient) {
+ gr = new QConicalGradient(QPointF(gradient->attributeCentralX(), gradient->attributeCentralY()),
+ gradient->attributeAngle());
+ }
+ if (!gr)
+ return br;
+
+ const QGradient::Spread spread = enumKeyToValue<QGradient::Spread>(gradientSpread_enum, gradient->attributeSpread().toLatin1());
+ gr->setSpread(spread);
+
+ const QGradient::CoordinateMode coord = enumKeyToValue<QGradient::CoordinateMode>(gradientCoordinate_enum, gradient->attributeCoordinateMode().toLatin1());
+ gr->setCoordinateMode(coord);
+
+ const QList<DomGradientStop *> stops = gradient->elementGradientStop();
+ QListIterator<DomGradientStop *> it(stops);
+ while (it.hasNext()) {
+ const DomGradientStop *stop = it.next();
+ const DomColor *color = stop->elementColor();
+ gr->setColorAt(stop->attributePosition(), QColor::fromRgb(color->elementRed(),
+ color->elementGreen(), color->elementBlue(), color->attributeAlpha()));
+ }
+ br = QBrush(*gr);
+ delete gr;
+ } else if (style == Qt::TexturePattern) {
+ const DomProperty *texture = brush->elementTexture();
+ if (texture && texture->kind() == DomProperty::Pixmap) {
+ br.setTexture(domPropertyToPixmap(texture));
+ }
+ } else {
+ const DomColor *color = brush->elementColor();
+ br.setColor(QColor::fromRgb(color->elementRed(),
+ color->elementGreen(), color->elementBlue(), color->attributeAlpha()));
+ br.setStyle((Qt::BrushStyle)style);
+ }
+ return br;
+}
+
+/*!
+ \internal
+*/
+DomBrush *QAbstractFormBuilder::saveBrush(const QBrush &br)
+{
+ const QMetaEnum brushStyle_enum = metaEnum<QAbstractFormBuilderGadget>("brushStyle");
+
+ DomBrush *brush = new DomBrush();
+ const Qt::BrushStyle style = br.style();
+ brush->setAttributeBrushStyle(QLatin1String(brushStyle_enum.valueToKey(style)));
+ if (style == Qt::LinearGradientPattern ||
+ style == Qt::RadialGradientPattern ||
+ style == Qt::ConicalGradientPattern) {
+ const QMetaEnum gradientType_enum = metaEnum<QAbstractFormBuilderGadget>("gradientType");
+ const QMetaEnum gradientSpread_enum = metaEnum<QAbstractFormBuilderGadget>("gradientSpread");
+ const QMetaEnum gradientCoordinate_enum = metaEnum<QAbstractFormBuilderGadget>("gradientCoordinate");
+
+ DomGradient *gradient = new DomGradient();
+ const QGradient *gr = br.gradient();
+ const QGradient::Type type = gr->type();
+ gradient->setAttributeType(QLatin1String(gradientType_enum.valueToKey(type)));
+ gradient->setAttributeSpread(QLatin1String(gradientSpread_enum.valueToKey(gr->spread())));
+ gradient->setAttributeCoordinateMode(QLatin1String(gradientCoordinate_enum.valueToKey(gr->coordinateMode())));
+ QList<DomGradientStop *> stops;
+ QGradientStops st = gr->stops();
+ QVectorIterator<QPair<qreal, QColor> > it(st);
+ while (it.hasNext()) {
+ const QPair<qreal, QColor> pair = it.next();
+ DomGradientStop *stop = new DomGradientStop();
+ stop->setAttributePosition(pair.first);
+ DomColor *color = new DomColor();
+ color->setElementRed(pair.second.red());
+ color->setElementGreen(pair.second.green());
+ color->setElementBlue(pair.second.blue());
+ color->setAttributeAlpha(pair.second.alpha());
+ stop->setElementColor(color);
+ stops.append(stop);
+ }
+ gradient->setElementGradientStop(stops);
+ if (type == QGradient::LinearGradient) {
+ QLinearGradient *lgr = (QLinearGradient *)(gr);
+ gradient->setAttributeStartX(lgr->start().x());
+ gradient->setAttributeStartY(lgr->start().y());
+ gradient->setAttributeEndX(lgr->finalStop().x());
+ gradient->setAttributeEndY(lgr->finalStop().y());
+ } else if (type == QGradient::RadialGradient) {
+ QRadialGradient *rgr = (QRadialGradient *)(gr);
+ gradient->setAttributeCentralX(rgr->center().x());
+ gradient->setAttributeCentralY(rgr->center().y());
+ gradient->setAttributeFocalX(rgr->focalPoint().x());
+ gradient->setAttributeFocalY(rgr->focalPoint().y());
+ gradient->setAttributeRadius(rgr->radius());
+ } else if (type == QGradient::ConicalGradient) {
+ QConicalGradient *cgr = (QConicalGradient *)(gr);
+ gradient->setAttributeCentralX(cgr->center().x());
+ gradient->setAttributeCentralY(cgr->center().y());
+ gradient->setAttributeAngle(cgr->angle());
+ }
+
+ brush->setElementGradient(gradient);
+ } else if (style == Qt::TexturePattern) {
+ const QPixmap pixmap = br.texture();
+ if (!pixmap.isNull()) {
+ DomProperty *p = new DomProperty;
+ setPixmapProperty(*p, pixmapPaths(pixmap));
+ brush->setElementTexture(p);
+ }
+ } else {
+ QColor c = br.color();
+ DomColor *color = new DomColor();
+ color->setElementRed(c.red());
+ color->setElementGreen(c.green());
+ color->setElementBlue(c.blue());
+ color->setAttributeAlpha(c.alpha());
+ brush->setElementColor(color);
+ }
+ return brush;
+}
+
+/*!
+ \internal
+*/
+QWidget *QAbstractFormBuilder::createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name)
+{
+ Q_UNUSED(widgetName);
+ Q_UNUSED(parentWidget);
+ Q_UNUSED(name);
+ return 0;
+}
+
+/*!
+ \internal
+*/
+QLayout *QAbstractFormBuilder::createLayout(const QString &layoutName, QObject *parent, const QString &name)
+{
+ Q_UNUSED(layoutName);
+ Q_UNUSED(parent);
+ Q_UNUSED(name);
+ return 0;
+}
+
+/*!
+ \internal
+*/
+QAction *QAbstractFormBuilder::createAction(QObject *parent, const QString &name)
+{
+ QAction *action = new QAction(parent);
+ action->setObjectName(name);
+ return action;
+}
+
+/*!
+ \internal
+*/
+QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QString &name)
+{
+ QActionGroup *g = new QActionGroup(parent);
+ g->setObjectName(name);
+ return g;
+}
+
+/*!
+ \fn void QAbstractFormBuilder::save(QIODevice *device, QWidget *widget)
+
+ Saves an XML representation of the given \a widget to the
+ specified \a device in the standard UI file format.
+
+ \sa load()*/
+void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
+{
+ DomWidget *ui_widget = createDom(widget, 0);
+ Q_ASSERT( ui_widget != 0 );
+
+ DomUI *ui = new DomUI();
+ ui->setAttributeVersion(QLatin1String("4.0"));
+ ui->setElementWidget(ui_widget);
+
+ saveDom(ui, widget);
+
+ QXmlStreamWriter writer(dev);
+ writer.setAutoFormatting(true);
+ writer.setAutoFormattingIndent(1);
+ writer.writeStartDocument();
+ ui->write(writer);
+ writer.writeEndDocument();
+
+ m_laidout.clear();
+
+ delete ui;
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::saveDom(DomUI *ui, QWidget *widget)
+{
+ ui->setElementClass(widget->objectName());
+
+ if (DomConnections *ui_connections = saveConnections()) {
+ ui->setElementConnections(ui_connections);
+ }
+
+ if (DomCustomWidgets *ui_customWidgets = saveCustomWidgets()) {
+ ui->setElementCustomWidgets(ui_customWidgets);
+ }
+
+ if (DomTabStops *ui_tabStops = saveTabStops()) {
+ ui->setElementTabStops(ui_tabStops);
+ }
+
+ if (DomResources *ui_resources = saveResources()) {
+ ui->setElementResources(ui_resources);
+ }
+ if (DomButtonGroups *ui_buttonGroups = saveButtonGroups(widget))
+ ui->setElementButtonGroups(ui_buttonGroups);
+}
+
+/*!
+ \internal
+*/
+DomConnections *QAbstractFormBuilder::saveConnections()
+{
+ return new DomConnections;
+}
+
+/*!
+ \internal
+*/
+
+DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parentWidget, bool recursive)
+{
+ DomWidget *ui_widget = new DomWidget();
+ ui_widget->setAttributeClass(QLatin1String(widget->metaObject()->className()));
+ ui_widget->setElementProperty(computeProperties(widget));
+
+ if (recursive) {
+ if (QLayout *layout = widget->layout()) {
+ if (DomLayout *ui_layout = createDom(layout, 0, ui_parentWidget)) {
+ QList<DomLayout*> ui_layouts;
+ ui_layouts.append(ui_layout);
+
+ ui_widget->setElementLayout(ui_layouts);
+ }
+ }
+ }
+
+ // widgets, actions and action groups
+ QList<DomWidget*> ui_widgets;
+ QList<DomAction*> ui_actions;
+ QList<DomActionGroup*> ui_action_groups;
+
+ QList<QObject*> children;
+
+ // splitters need to store their children in the order specified by child indexes,
+ // not the order of the child list.
+#ifndef QT_NO_SPLITTER
+ if (const QSplitter *splitter = qobject_cast<const QSplitter*>(widget)) {
+ const int count = splitter->count();
+ for (int i = 0; i < count; ++i)
+ children.append(splitter->widget(i));
+ } else
+#endif
+ {
+ QList<QObject *> childObjects = widget->children();
+
+ const QList<QWidget *> list = qvariant_cast<QWidgetList>(widget->property("_q_widgetOrder"));
+ foreach (QWidget *w, list) {
+ if (childObjects.contains(w)) {
+ children.append(w);
+ childObjects.removeAll(w);
+ }
+ }
+ children += childObjects;
+
+ const QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(widget->property("_q_zOrder"));
+ if (list != zOrder) {
+ QStringList zOrderList;
+ QListIterator<QWidget* > itZOrder(zOrder);
+ while (itZOrder.hasNext())
+ zOrderList.append(itZOrder.next()->objectName());
+ ui_widget->setElementZOrder(zOrderList);
+ }
+ }
+
+ foreach (QObject *obj, children) {
+ if (QWidget *childWidget = qobject_cast<QWidget*>(obj)) {
+ if (m_laidout.contains(childWidget) || recursive == false)
+ continue;
+
+ if (QMenu *menu = qobject_cast<QMenu *>(childWidget)) {
+ QList<QAction *> actions = menu->parentWidget()->actions();
+ QListIterator<QAction *> it(actions);
+ bool found = false;
+ while (it.hasNext()) {
+ if (it.next()->menu() == menu)
+ found = true;
+ }
+ if (!found)
+ continue;
+ }
+
+ if (DomWidget *ui_child = createDom(childWidget, ui_widget)) {
+ ui_widgets.append(ui_child);
+ }
+ } else if (QAction *childAction = qobject_cast<QAction*>(obj)) {
+ if (childAction->actionGroup() != 0) {
+ // it will be added later.
+ continue;
+ }
+
+ if (DomAction *ui_action = createDom(childAction)) {
+ ui_actions.append(ui_action);
+ }
+ } else if (QActionGroup *childActionGroup = qobject_cast<QActionGroup*>(obj)) {
+ if (DomActionGroup *ui_action_group = createDom(childActionGroup)) {
+ ui_action_groups.append(ui_action_group);
+ }
+ }
+ }
+
+ // add-action
+ QList<DomActionRef*> ui_action_refs;
+ foreach (QAction *action, widget->actions()) {
+ if (DomActionRef *ui_action_ref = createActionRefDom(action)) {
+ ui_action_refs.append(ui_action_ref);
+ }
+ }
+
+ if (recursive)
+ ui_widget->setElementWidget(ui_widgets);
+
+ ui_widget->setElementAction(ui_actions);
+ ui_widget->setElementActionGroup(ui_action_groups);
+ ui_widget->setElementAddAction(ui_action_refs);
+
+ saveExtraInfo(widget, ui_widget, ui_parentWidget);
+
+ return ui_widget;
+}
+
+/*!
+ \internal
+*/
+DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action)
+{
+ QString name = action->objectName();
+
+ if (action->menu() != 0)
+ name = action->menu()->objectName();
+
+ DomActionRef *ui_action_ref = new DomActionRef();
+ if (action->isSeparator())
+ ui_action_ref->setAttributeName(QFormBuilderStrings::instance().separator);
+ else
+ ui_action_ref->setAttributeName(name);
+
+ return ui_action_ref;
+}
+
+// Struct to store layout item parameters for saving layout items
+struct FormBuilderSaveLayoutEntry {
+ explicit FormBuilderSaveLayoutEntry(QLayoutItem *li = 0) :
+ item(li), row(-1), column(-1), rowSpan(0), columnSpan(0), alignment(0) {}
+
+ QLayoutItem *item;
+ int row;
+ int column;
+ int rowSpan;
+ int columnSpan;
+ Qt::Alignment alignment;
+};
+
+// Create list from standard box layout
+static QList<FormBuilderSaveLayoutEntry> saveLayoutEntries(const QLayout *layout)
+{
+ QList<FormBuilderSaveLayoutEntry> rc;
+ if (const int count = layout->count()) {
+ rc.reserve(count);
+ for (int idx = 0; idx < count; ++idx) {
+ QLayoutItem *item = layout->itemAt(idx);
+ FormBuilderSaveLayoutEntry entry(item);
+ entry.alignment = item->alignment();
+ rc.append(entry);
+ }
+ }
+ return rc;
+}
+
+// Create list from grid layout
+static QList<FormBuilderSaveLayoutEntry> saveGridLayoutEntries(QGridLayout *gridLayout)
+{
+ QList<FormBuilderSaveLayoutEntry> rc;
+ if (const int count = gridLayout->count()) {
+ rc.reserve(count);
+ for (int idx = 0; idx < count; ++idx) {
+ QLayoutItem *item = gridLayout->itemAt(idx);
+ FormBuilderSaveLayoutEntry entry(item);
+ gridLayout->getItemPosition(idx, &entry.row, &entry.column, &entry.rowSpan,&entry.columnSpan);
+ entry.alignment = item->alignment();
+ rc.append(entry);
+ }
+ }
+ return rc;
+}
+
+#ifndef QT_NO_FORMLAYOUT
+// Create list from form layout
+static QList<FormBuilderSaveLayoutEntry> saveFormLayoutEntries(const QFormLayout *formLayout)
+{
+ QList<FormBuilderSaveLayoutEntry> rc;
+ if (const int count = formLayout->count()) {
+ rc.reserve(count);
+ for (int idx = 0; idx < count; ++idx) {
+ QLayoutItem *item = formLayout->itemAt(idx);
+ QFormLayout::ItemRole role = QFormLayout::LabelRole;
+ FormBuilderSaveLayoutEntry entry(item);
+ formLayout->getItemPosition(idx, &entry.row, &role);
+ switch (role ) {
+ case QFormLayout::LabelRole:
+ entry.column = 0;
+ break;
+ case QFormLayout::FieldRole:
+ entry.column = 1;
+ break;
+ case QFormLayout::SpanningRole:
+ entry.column = 0;
+ entry.columnSpan = 2;
+ break;
+ }
+ rc.push_back(entry);
+ }
+ }
+ return rc;
+}
+#endif
+
+/*!
+ \internal
+*/
+
+DomLayout *QAbstractFormBuilder::createDom(QLayout *layout, DomLayout *ui_layout, DomWidget *ui_parentWidget)
+{
+ Q_UNUSED(ui_layout)
+ DomLayout *lay = new DomLayout();
+ lay->setAttributeClass(QLatin1String(layout->metaObject()->className()));
+ const QString objectName = layout->objectName();
+ if (!objectName.isEmpty())
+ lay->setAttributeName(objectName);
+ lay->setElementProperty(computeProperties(layout));
+
+ QList<FormBuilderSaveLayoutEntry> newList;
+ if (QGridLayout *gridLayout = qobject_cast<QGridLayout *>(layout)) {
+ newList = saveGridLayoutEntries(gridLayout);
+#ifndef QT_NO_FORMLAYOUT
+ } else if (const QFormLayout *formLayout = qobject_cast<const QFormLayout *>(layout)) {
+ newList = saveFormLayoutEntries(formLayout);
+#endif
+ } else {
+ newList = saveLayoutEntries(layout);
+ }
+
+ QList<DomLayoutItem*> ui_items;
+ foreach (const FormBuilderSaveLayoutEntry &item, newList) {
+ if (DomLayoutItem *ui_item = createDom(item.item, lay, ui_parentWidget)) {
+ if (item.row >= 0)
+ ui_item->setAttributeRow(item.row);
+ if (item.column >= 0)
+ ui_item->setAttributeColumn(item.column);
+ if (item.rowSpan > 1)
+ ui_item->setAttributeRowSpan(item.rowSpan);
+ if (item.columnSpan > 1)
+ ui_item->setAttributeColSpan(item.columnSpan);
+ if (item.alignment)
+ ui_item->setAttributeAlignment(alignmentValue(item.alignment));
+ ui_items.append(ui_item);
+ }
+ }
+
+ lay->setElementItem(ui_items);
+
+ return lay;
+}
+
+/*!
+ \internal
+*/
+DomLayoutItem *QAbstractFormBuilder::createDom(QLayoutItem *item, DomLayout *ui_layout, DomWidget *ui_parentWidget)
+{
+ DomLayoutItem *ui_item = new DomLayoutItem();
+
+ if (item->widget()) {
+ ui_item->setElementWidget(createDom(item->widget(), ui_parentWidget));
+ m_laidout.insert(item->widget(), true);
+ } else if (item->layout()) {
+ ui_item->setElementLayout(createDom(item->layout(), ui_layout, ui_parentWidget));
+ } else if (item->spacerItem()) {
+ ui_item->setElementSpacer(createDom(item->spacerItem(), ui_layout, ui_parentWidget));
+ }
+
+ return ui_item;
+}
+
+/*!
+ \internal
+*/
+DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_layout, DomWidget *ui_parentWidget)
+{
+ Q_UNUSED(ui_layout);
+ Q_UNUSED(ui_parentWidget);
+
+ DomSpacer *ui_spacer = new DomSpacer();
+ QList<DomProperty*> properties;
+
+ DomProperty *prop = 0;
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ // sizeHint property
+ prop = new DomProperty();
+ prop->setAttributeName(strings.sizeHintProperty);
+ prop->setElementSize(new DomSize());
+ prop->elementSize()->setElementWidth(spacer->sizeHint().width());
+ prop->elementSize()->setElementHeight(spacer->sizeHint().height());
+ properties.append(prop);
+
+ // orientation property
+ prop = new DomProperty(); // ### we don't implemented the case where expandingDirections() is both Vertical and Horizontal
+ prop->setAttributeName(strings.orientationProperty);
+ prop->setElementEnum((spacer->expandingDirections() & Qt::Horizontal) ? strings.qtHorizontal : strings.qtVertical);
+ properties.append(prop);
+
+ ui_spacer->setElementProperty(properties);
+ return ui_spacer;
+}
+
+/*!
+ \internal
+*/
+DomProperty *QAbstractFormBuilder::createProperty(QObject *obj, const QString &pname, const QVariant &v)
+{
+ if (!checkProperty(obj, pname)) {
+ return 0;
+ }
+ return variantToDomProperty(this, obj->metaObject(), pname, v);
+}
+
+/*!
+ \internal
+*/
+QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
+{
+ QList<DomProperty*> lst;
+
+ const QMetaObject *meta = obj->metaObject();
+
+ QHash<QByteArray, bool> properties;
+ const int propertyCount = meta->propertyCount();
+ for(int i=0; i < propertyCount; ++i)
+ properties.insert(meta->property(i).name(), true);
+
+ const QList<QByteArray> propertyNames = properties.keys();
+
+ const int propertyNamesCount = propertyNames.size();
+ for(int i=0; i<propertyNamesCount ; ++i) {
+ const QString pname = QString::fromUtf8(propertyNames.at(i));
+ const QMetaProperty prop = meta->property(meta->indexOfProperty(pname.toUtf8()));
+
+ if (!prop.isWritable() || !checkProperty(obj, QLatin1String(prop.name())))
+ continue;
+
+ const QVariant v = prop.read(obj);
+
+ DomProperty *dom_prop = 0;
+ if (v.type() == QVariant::Int) {
+ dom_prop = new DomProperty();
+
+ if (prop.isFlagType())
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Flags property are not supported yet."));
+
+ if (prop.isEnumType()) {
+ QString scope = QString::fromUtf8(prop.enumerator().scope());
+ if (scope.size())
+ scope += QString::fromUtf8("::");
+ const QString e = QString::fromUtf8(prop.enumerator().valueToKey(v.toInt()));
+ if (e.size())
+ dom_prop->setElementEnum(scope + e);
+ } else
+ dom_prop->setElementNumber(v.toInt());
+ dom_prop->setAttributeName(pname);
+ } else {
+ dom_prop = createProperty(obj, pname, v);
+ }
+
+ if (!dom_prop || dom_prop->kind() == DomProperty::Unknown)
+ delete dom_prop;
+ else
+ lst.append(dom_prop);
+ }
+
+ return lst;
+}
+
+
+/*!
+ \internal
+ \typedef QAbstractFormBuilder::DomPropertyHash
+ \typedef QAbstractFormBuilder::IconPaths
+*/
+
+
+/*!
+ \internal
+*/
+QAbstractFormBuilder::DomPropertyHash QAbstractFormBuilder::propertyMap(const QList<DomProperty*> &properties)
+{
+ DomPropertyHash map;
+
+ foreach (DomProperty *p, properties)
+ map.insert(p->attributeName(), p);
+
+ return map;
+}
+
+/*!
+ \internal
+*/
+bool QAbstractFormBuilder::checkProperty(QObject *obj, const QString &prop) const
+{
+ Q_UNUSED(obj);
+ Q_UNUSED(prop);
+
+ return true;
+}
+
+/*!
+ \internal
+*/
+QString QAbstractFormBuilder::toString(const DomString *str)
+{
+ return str ? str->text() : QString();
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::applyTabStops(QWidget *widget, DomTabStops *tabStops)
+{
+ if (!tabStops)
+ return;
+
+ QWidget *lastWidget = 0;
+
+ const QStringList l = tabStops->elementTabStop();
+ for (int i=0; i<l.size(); ++i) {
+ const QString name = l.at(i);
+
+ QWidget *child = widget->findChild<QWidget*>(name);
+ if (!child) {
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "While applying tab stops: The widget '%1' could not be found.").arg(name));
+ continue;
+ }
+
+ if (i == 0) {
+ lastWidget = widget->findChild<QWidget*>(name);
+ continue;
+ } else if (!child || !lastWidget) {
+ continue;
+ }
+
+ QWidget::setTabOrder(lastWidget, child);
+
+ lastWidget = widget->findChild<QWidget*>(name);
+ }
+}
+
+/*!
+ \internal
+*/
+DomCustomWidgets *QAbstractFormBuilder::saveCustomWidgets()
+{
+ return 0;
+}
+
+/*!
+ \internal
+*/
+DomTabStops *QAbstractFormBuilder::saveTabStops()
+{
+ return 0;
+}
+
+/*!
+ \internal
+*/
+DomResources *QAbstractFormBuilder::saveResources()
+{
+ return 0;
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+DomButtonGroups *QAbstractFormBuilder::saveButtonGroups(const QWidget *mainContainer)
+{
+ // Save fst order buttongroup children of maincontainer
+ typedef QList<QButtonGroup*> ButtonGroupList;
+ const QObjectList mchildren = mainContainer->children();
+ if (mchildren.empty())
+ return 0;
+ QList<DomButtonGroup*> domGroups;
+ const QObjectList::const_iterator cend = mchildren.constEnd();
+ for (QObjectList::const_iterator it = mchildren.constBegin(); it != cend; ++it)
+ if (QButtonGroup *bg = qobject_cast<QButtonGroup *>(*it))
+ if (DomButtonGroup* dg = createDom(bg))
+ domGroups.push_back(dg);
+
+ if (domGroups.empty())
+ return 0;
+ DomButtonGroups *rc = new DomButtonGroups;
+ rc->setElementButtonGroup(domGroups);
+ return rc;
+}
+
+// VC6 would not find templated members, so we use statics and this utter hack.
+class FriendlyFB : public QAbstractFormBuilder {
+public:
+ using QAbstractFormBuilder::saveResource;
+ using QAbstractFormBuilder::saveText;
+ using QAbstractFormBuilder::resourceBuilder;
+ using QAbstractFormBuilder::textBuilder;
+ using QAbstractFormBuilder::toVariant;
+};
+
+template<class T>
+static void storeItemFlags(const T *item, QList<DomProperty*> *properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ static const Qt::ItemFlags defaultFlags = T().flags();
+ static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
+
+ if (item->flags() != defaultFlags) {
+ DomProperty *p = new DomProperty;
+ p->setAttributeName(strings.flagsAttribute);
+ p->setElementSet(QString::fromAscii(itemFlags_enum.valueToKeys(item->flags())));
+ properties->append(p);
+ }
+}
+
+#ifndef Q_CC_RVCT
+// RVCT does not accept static inline functions if one argument is templated type
+// For this reason all necessary function variants are explicityly written for it.
+template<class T>
+static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const T *item,
+ QList<DomProperty*> *properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder);
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = formBuilder->saveText(it.second, item->data(it.first.second))))
+ properties->append(p);
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((v = item->data(it.first)).isValid() &&
+ (p = variantToDomProperty(abstractFormBuilder,
+ static_cast<const QMetaObject *>(&QAbstractFormBuilderGadget::staticMetaObject),
+ it.second, v)))
+ properties->append(p);
+
+ if ((p = formBuilder->saveResource(item->data(Qt::DecorationPropertyRole))))
+ properties->append(p);
+}
+
+template<class T>
+static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const T *item,
+ QList<DomProperty*> *properties)
+{
+ storeItemProps<T>(abstractFormBuilder, item, properties);
+ storeItemFlags<T>(item, properties);
+}
+
+template<class T>
+static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, T *item,
+ const QHash<QString, DomProperty*> &properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder);
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = properties.value(it.second))) {
+ v = formBuilder->textBuilder()->loadText(p);
+ QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v);
+ item->setData(it.first.first, qvariant_cast<QString>(nativeValue));
+ item->setData(it.first.second, v);
+ }
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((p = properties.value(it.second)) &&
+ (v = formBuilder->toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p)).isValid())
+ item->setData(it.first, v);
+
+ if ((p = properties.value(strings.iconAttribute))) {
+ v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p);
+ QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v);
+ item->setIcon(qvariant_cast<QIcon>(nativeValue));
+ item->setData(Qt::DecorationPropertyRole, v);
+ }
+}
+
+template<class T>
+static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, T *item,
+ const QHash<QString, DomProperty*> &properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
+
+ loadItemProps<T>(abstractFormBuilder, item, properties);
+
+ DomProperty *p;
+ if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set)
+ item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii()));
+}
+
+#else
+
+static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const QTableWidgetItem *item,
+ QList<DomProperty*> *properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder);
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = formBuilder->saveText(it.second, item->data(it.first.second))))
+ properties->append(p);
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((v = item->data(it.first)).isValid() &&
+ (p = variantToDomProperty(abstractFormBuilder,
+ static_cast<const QMetaObject *>(&QAbstractFormBuilderGadget::staticMetaObject),
+ it.second, v)))
+ properties->append(p);
+
+ if ((p = formBuilder->saveResource(item->data(Qt::DecorationPropertyRole))))
+ properties->append(p);
+}
+
+static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const QListWidgetItem *item,
+ QList<DomProperty*> *properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder);
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = formBuilder->saveText(it.second, item->data(it.first.second))))
+ properties->append(p);
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((v = item->data(it.first)).isValid() &&
+ (p = variantToDomProperty(abstractFormBuilder,
+ static_cast<const QMetaObject *>(&QAbstractFormBuilderGadget::staticMetaObject),
+ it.second, v)))
+ properties->append(p);
+
+ if ((p = formBuilder->saveResource(item->data(Qt::DecorationPropertyRole))))
+ properties->append(p);
+}
+
+static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const QTableWidgetItem *item,
+ QList<DomProperty*> *properties)
+{
+ storeItemProps(abstractFormBuilder, item, properties);
+ storeItemFlags(item, properties);
+}
+
+static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const QListWidgetItem *item,
+ QList<DomProperty*> *properties)
+{
+ storeItemProps(abstractFormBuilder, item, properties);
+ storeItemFlags(item, properties);
+}
+
+static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QTableWidgetItem *item,
+ const QHash<QString, DomProperty*> &properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder);
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = properties.value(it.second))) {
+ v = formBuilder->textBuilder()->loadText(p);
+ QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v);
+ item->setData(it.first.first, qvariant_cast<QString>(nativeValue));
+ item->setData(it.first.second, v);
+ }
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((p = properties.value(it.second)) &&
+ (v = formBuilder->toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p)).isValid())
+ item->setData(it.first, v);
+
+ if ((p = properties.value(strings.iconAttribute))) {
+ v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p);
+ QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v);
+ item->setIcon(qvariant_cast<QIcon>(nativeValue));
+ item->setData(Qt::DecorationPropertyRole, v);
+ }
+}
+
+static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QListWidgetItem *item,
+ const QHash<QString, DomProperty*> &properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder);
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = properties.value(it.second))) {
+ v = formBuilder->textBuilder()->loadText(p);
+ QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v);
+ item->setData(it.first.first, qvariant_cast<QString>(nativeValue));
+ item->setData(it.first.second, v);
+ }
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((p = properties.value(it.second)) &&
+ (v = formBuilder->toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p)).isValid())
+ item->setData(it.first, v);
+
+ if ((p = properties.value(strings.iconAttribute))) {
+ v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p);
+ QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v);
+ item->setIcon(qvariant_cast<QIcon>(nativeValue));
+ item->setData(Qt::DecorationPropertyRole, v);
+ }
+}
+
+static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, QTableWidgetItem *item,
+ const QHash<QString, DomProperty*> &properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
+
+ loadItemProps(abstractFormBuilder, item, properties);
+
+ DomProperty *p;
+ if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set)
+ item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii()));
+}
+
+static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, QListWidgetItem *item,
+ const QHash<QString, DomProperty*> &properties)
+{
+ static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
+
+ loadItemProps(abstractFormBuilder, item, properties);
+
+ DomProperty *p;
+ if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set)
+ item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii()));
+}
+
+#endif
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomWidget *ui_widget, DomWidget *ui_parentWidget)
+{
+ Q_UNUSED(ui_parentWidget);
+
+ QList<DomColumn*> columns;
+ DomProperty *p;
+ QVariant v;
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ // save the header
+ for (int c = 0; c<treeWidget->columnCount(); ++c) {
+ DomColumn *column = new DomColumn;
+
+ QList<DomProperty*> properties;
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles) {
+ p = saveText(it.second, treeWidget->headerItem()->data(c, it.first.second));
+ // Prevent uic 4.4.X from crashing if it cannot find a column text
+ if (!p && it.first.first == Qt::EditRole && it.second == QLatin1String("text")) {
+ DomString *defaultHeader = new DomString;
+ defaultHeader->setText(QString::number(c + 1));
+ defaultHeader->setAttributeNotr(QLatin1String("true"));
+ p = new DomProperty;
+ p->setAttributeName(it.second);
+ p->setElementString(defaultHeader);
+ }
+ if (p)
+ properties.append(p);
+ }
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((v = treeWidget->headerItem()->data(c, it.first)).isValid() &&
+ (p = variantToDomProperty(this, &QAbstractFormBuilderGadget::staticMetaObject, it.second, v)))
+ properties.append(p);
+
+ if ((p = saveResource(treeWidget->headerItem()->data(c, Qt::DecorationPropertyRole))))
+ properties.append(p);
+
+ column->setElementProperty(properties);
+ columns.append(column);
+ }
+
+ ui_widget->setElementColumn(columns);
+
+ QList<DomItem *> items = ui_widget->elementItem();
+
+ QQueue<QPair<QTreeWidgetItem *, DomItem *> > pendingQueue;
+ for (int i = 0; i < treeWidget->topLevelItemCount(); i++)
+ pendingQueue.enqueue(qMakePair(treeWidget->topLevelItem(i), (DomItem *)0));
+
+ while (!pendingQueue.isEmpty()) {
+ const QPair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue();
+ QTreeWidgetItem *item = pair.first;
+ DomItem *parentDomItem = pair.second;
+
+ DomItem *currentDomItem = new DomItem;
+
+ QList<DomProperty*> properties;
+ for (int c = 0; c < treeWidget->columnCount(); c++) {
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = saveText(it.second, item->data(c, it.first.second))))
+ properties.append(p);
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((v = item->data(c, it.first)).isValid() &&
+ (p = variantToDomProperty(this, &QAbstractFormBuilderGadget::staticMetaObject, it.second, v)))
+ properties.append(p);
+
+ if ((p = saveResource(item->data(c, Qt::DecorationPropertyRole))))
+ properties.append(p);
+ }
+ storeItemFlags(item, &properties);
+ currentDomItem->setElementProperty(properties);
+
+ if (parentDomItem) {
+ QList<DomItem *> childrenItems = parentDomItem->elementItem();
+ childrenItems.append(currentDomItem);
+ parentDomItem->setElementItem(childrenItems);
+ } else
+ items.append(currentDomItem);
+
+ for (int i = 0; i < item->childCount(); i++)
+ pendingQueue.enqueue(qMakePair(item->child(i), currentDomItem));
+ }
+
+ ui_widget->setElementItem(items);
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::saveTableWidgetExtraInfo(QTableWidget *tableWidget, DomWidget *ui_widget, DomWidget *ui_parentWidget)
+{
+ Q_UNUSED(ui_parentWidget);
+
+ // save the horizontal header
+ QList<DomColumn*> columns;
+ for (int c = 0; c < tableWidget->columnCount(); c++) {
+ QList<DomProperty*> properties;
+ QTableWidgetItem *item = tableWidget->horizontalHeaderItem(c);
+ if (item)
+ storeItemProps(this, item, &properties);
+
+ DomColumn *column = new DomColumn;
+ column->setElementProperty(properties);
+ columns.append(column);
+ }
+ ui_widget->setElementColumn(columns);
+
+ // save the vertical header
+ QList<DomRow*> rows;
+ for (int r = 0; r < tableWidget->rowCount(); r++) {
+ QList<DomProperty*> properties;
+ QTableWidgetItem *item = tableWidget->verticalHeaderItem(r);
+ if (item)
+ storeItemProps(this, item, &properties);
+
+ DomRow *row = new DomRow;
+ row->setElementProperty(properties);
+ rows.append(row);
+ }
+ ui_widget->setElementRow(rows);
+
+ QList<DomItem *> items = ui_widget->elementItem();
+ for (int r = 0; r < tableWidget->rowCount(); r++)
+ for (int c = 0; c < tableWidget->columnCount(); c++) {
+ QTableWidgetItem *item = tableWidget->item(r, c);
+ if (item) {
+ QList<DomProperty*> properties;
+ storeItemPropsNFlags(this, item, &properties);
+
+ DomItem *domItem = new DomItem;
+ domItem->setAttributeRow(r);
+ domItem->setAttributeColumn(c);
+ domItem->setElementProperty(properties);
+ items.append(domItem);
+ }
+ }
+
+ ui_widget->setElementItem(items);
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::saveListWidgetExtraInfo(QListWidget *listWidget, DomWidget *ui_widget, DomWidget *ui_parentWidget)
+{
+ Q_UNUSED(ui_parentWidget);
+
+ QList<DomItem*> ui_items = ui_widget->elementItem();
+ for (int i=0; i<listWidget->count(); ++i) {
+ QList<DomProperty*> properties;
+ storeItemPropsNFlags(this, listWidget->item(i), &properties);
+
+ DomItem *ui_item = new DomItem();
+ ui_item->setElementProperty(properties);
+ ui_items.append(ui_item);
+ }
+
+ ui_widget->setElementItem(ui_items);
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget *ui_widget, DomWidget *ui_parentWidget)
+{
+ Q_UNUSED(ui_parentWidget);
+ QList<DomItem*> ui_items = ui_widget->elementItem();
+
+ const int count = comboBox->count();
+ for (int i=0; i < count; ++i) {
+ // We might encounter items for which both builders return 0 in Designer
+ // (indicating a custom combo adding items in the constructor). Ignore those.
+ DomProperty *textProperty = saveText(QFormBuilderStrings::instance().textAttribute,
+ comboBox->itemData(i, Qt::DisplayPropertyRole));
+ DomProperty *iconProperty = saveResource(comboBox->itemData(i, Qt::DecorationPropertyRole));
+ if (textProperty || iconProperty) {
+ QList<DomProperty*> properties;
+ if (textProperty)
+ properties.push_back(textProperty);
+ if (iconProperty)
+ properties.push_back(iconProperty);
+
+ DomItem *ui_item = new DomItem();
+ ui_item->setElementProperty(properties);
+ ui_items.push_back(ui_item);
+ }
+ }
+
+ ui_widget->setElementItem(ui_items);
+}
+
+// Return the buttongroups assigned to a button except the internal one
+// (with empty object name) used by Q3ButtonGroup.
+static inline const QButtonGroup *formButtonGroup(const QAbstractButton *widget)
+{
+ const QButtonGroup *buttonGroup = widget->group();
+ if (!buttonGroup)
+ return 0;
+ if (buttonGroup->objectName().isEmpty()) {
+ if (const QWidget *parent = widget->parentWidget())
+ if (!qstrcmp(parent->metaObject()->className(), "Q3ButtonGroup"))
+ return 0;
+ }
+ return buttonGroup;
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, DomWidget *ui_widget, DomWidget *)
+{
+ typedef QList<DomProperty*> DomPropertyList;
+ if (const QButtonGroup *buttonGroup = formButtonGroup(widget)) {
+ DomPropertyList attributes = ui_widget->elementAttribute();
+ DomString *domString = new DomString();
+ domString->setText(buttonGroup->objectName());
+ domString->setAttributeNotr(QLatin1String("true"));
+ DomProperty *domProperty = new DomProperty();
+ domProperty->setAttributeName(QLatin1String(buttonGroupPropertyC));
+ domProperty->setElementString(domString);
+ attributes += domProperty;
+ ui_widget->setElementAttribute(attributes);
+ }
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+void QAbstractFormBuilder::saveItemViewExtraInfo(const QAbstractItemView *itemView,
+ DomWidget *ui_widget, DomWidget *)
+{
+ //
+ // Special handling for qtableview/qtreeview fake header attributes
+ //
+ static QStringList realPropertyNames =
+ (QStringList() << QLatin1String("visible")
+ << QLatin1String("cascadingSectionResizes")
+ << QLatin1String("defaultSectionSize")
+ << QLatin1String("highlightSections")
+ << QLatin1String("minimumSectionSize")
+ << QLatin1String("showSortIndicator")
+ << QLatin1String("stretchLastSection"));
+
+ if (const QTreeView *treeView = qobject_cast<const QTreeView*>(itemView)) {
+ QList<DomProperty*> viewProperties = ui_widget->elementAttribute();
+ QList<DomProperty*> headerProperties = computeProperties(treeView->header());
+ foreach (const QString &realPropertyName, realPropertyNames) {
+ const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ + realPropertyName.mid(1);
+ const QString fakePropertyName = QLatin1String("header") + upperPropertyName;
+ foreach (DomProperty *property, headerProperties) {
+ if (property->attributeName() == realPropertyName) {
+ property->setAttributeName(fakePropertyName);
+ viewProperties << property;
+ }
+ }
+ }
+ ui_widget->setElementAttribute(viewProperties);
+ } else if (const QTableView *tableView = qobject_cast<const QTableView*>(itemView)) {
+ static QStringList headerPrefixes =
+ (QStringList() << QLatin1String("horizontalHeader")
+ << QLatin1String("verticalHeader"));
+
+ QList<DomProperty*> viewProperties = ui_widget->elementAttribute();
+ foreach (const QString &headerPrefix, headerPrefixes) {
+ QList<DomProperty*> headerProperties;
+ if (headerPrefix == QLatin1String("horizontalHeader"))
+ headerProperties = computeProperties(tableView->horizontalHeader());
+ else
+ headerProperties = computeProperties(tableView->verticalHeader());
+ foreach (const QString &realPropertyName, realPropertyNames) {
+ const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ + realPropertyName.mid(1);
+ const QString fakePropertyName = headerPrefix + upperPropertyName;
+ foreach (DomProperty *property, headerProperties) {
+ if (property->attributeName() == realPropertyName) {
+ property->setAttributeName(fakePropertyName);
+ viewProperties << property;
+ }
+ }
+ }
+ }
+ ui_widget->setElementAttribute(viewProperties);
+ }
+}
+
+/*!
+ \internal
+ \since 4.4
+*/
+
+void QAbstractFormBuilder::setResourceBuilder(QResourceBuilder *builder)
+{
+ QFormBuilderExtra::instance(this)->setResourceBuilder(builder);
+}
+
+/*!
+ \internal
+ \since 4.4
+*/
+
+QResourceBuilder *QAbstractFormBuilder::resourceBuilder() const
+{
+ return QFormBuilderExtra::instance(this)->resourceBuilder();
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+void QAbstractFormBuilder::setTextBuilder(QTextBuilder *builder)
+{
+ QFormBuilderExtra::instance(this)->setTextBuilder(builder);
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+QTextBuilder *QAbstractFormBuilder::textBuilder() const
+{
+ return QFormBuilderExtra::instance(this)->textBuilder();
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::saveExtraInfo(QWidget *widget, DomWidget *ui_widget,
+ DomWidget *ui_parentWidget)
+{
+ if (QListWidget *listWidget = qobject_cast<QListWidget*>(widget)) {
+ saveListWidgetExtraInfo(listWidget, ui_widget, ui_parentWidget);
+ } else if (QTreeWidget *treeWidget = qobject_cast<QTreeWidget*>(widget)) {
+ saveTreeWidgetExtraInfo(treeWidget, ui_widget, ui_parentWidget);
+ } else if (QTableWidget *tableWidget = qobject_cast<QTableWidget*>(widget)) {
+ saveTableWidgetExtraInfo(tableWidget, ui_widget, ui_parentWidget);
+ } else if (QComboBox *comboBox = qobject_cast<QComboBox*>(widget)) {
+ if (!qobject_cast<QFontComboBox*>(widget))
+ saveComboBoxExtraInfo(comboBox, ui_widget, ui_parentWidget);
+ } else if(QAbstractButton *ab = qobject_cast<QAbstractButton *>(widget)) {
+ saveButtonExtraInfo(ab, ui_widget, ui_parentWidget);
+ }
+ if (QAbstractItemView *itemView = qobject_cast<QAbstractItemView *>(widget)) {
+ saveItemViewExtraInfo(itemView, ui_widget, ui_parentWidget);
+ }
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::loadListWidgetExtraInfo(DomWidget *ui_widget, QListWidget *listWidget, QWidget *parentWidget)
+{
+ Q_UNUSED(parentWidget);
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
+
+ foreach (DomItem *ui_item, ui_widget->elementItem()) {
+ const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
+ QListWidgetItem *item = new QListWidgetItem(listWidget);
+#ifndef Q_CC_RVCT
+ loadItemPropsNFlags<QListWidgetItem>(this, item, properties);
+#else
+ loadItemPropsNFlags(this, item, properties);
+#endif
+ }
+
+ DomProperty *currentRow = propertyMap(ui_widget->elementProperty()).value(strings.currentRowProperty);
+ if (currentRow)
+ listWidget->setCurrentRow(currentRow->elementNumber());
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWidget *treeWidget, QWidget *parentWidget)
+{
+ Q_UNUSED(parentWidget);
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
+ const QList<DomColumn*> columns = ui_widget->elementColumn();
+ if (columns.count() > 0)
+ treeWidget->setColumnCount(columns.count());
+
+ for (int i = 0; i<columns.count(); ++i) {
+ const DomColumn *c = columns.at(i);
+ const DomPropertyHash properties = propertyMap(c->elementProperty());
+
+ DomProperty *p;
+ QVariant v;
+
+ foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles)
+ if ((p = properties.value(it.second)) &&
+ (v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p)).isValid())
+ treeWidget->headerItem()->setData(i, it.first, v);
+
+ foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles)
+ if ((p = properties.value(it.second))) {
+ v = textBuilder()->loadText(p);
+ QVariant nativeValue = textBuilder()->toNativeValue(v);
+ treeWidget->headerItem()->setData(i, it.first.first, qvariant_cast<QString>(nativeValue));
+ treeWidget->headerItem()->setData(i, it.first.second, v);
+ }
+
+ if ((p = properties.value(strings.iconAttribute))) {
+ v = resourceBuilder()->loadResource(workingDirectory(), p);
+ QVariant nativeValue = resourceBuilder()->toNativeValue(v);
+ treeWidget->headerItem()->setIcon(i, qvariant_cast<QIcon>(nativeValue));
+ treeWidget->headerItem()->setData(i, Qt::DecorationPropertyRole, v);
+ }
+ }
+
+ QQueue<QPair<DomItem *, QTreeWidgetItem *> > pendingQueue;
+ foreach (DomItem *ui_item, ui_widget->elementItem())
+ pendingQueue.enqueue(qMakePair(ui_item, (QTreeWidgetItem *)0));
+
+ while (!pendingQueue.isEmpty()) {
+ const QPair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue();
+ const DomItem *domItem = pair.first;
+ QTreeWidgetItem *parentItem = pair.second;
+
+ QTreeWidgetItem *currentItem = 0;
+
+ if (parentItem)
+ currentItem = new QTreeWidgetItem(parentItem);
+ else
+ currentItem = new QTreeWidgetItem(treeWidget);
+
+ const QList<DomProperty *> properties = domItem->elementProperty();
+ int col = -1;
+ foreach (DomProperty *property, properties) {
+ if (property->attributeName() == strings.flagsAttribute && !property->elementSet().isEmpty()) {
+ currentItem->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, property->elementSet().toAscii()));
+ } else if (property->attributeName() == strings.textAttribute && property->elementString()) {
+ col++;
+ QVariant textV = textBuilder()->loadText(property);
+ QVariant nativeValue = textBuilder()->toNativeValue(textV);
+ currentItem->setText(col, qvariant_cast<QString>(nativeValue));
+ currentItem->setData(col, Qt::DisplayPropertyRole, textV);
+ } else if (col >= 0) {
+ if (property->attributeName() == strings.iconAttribute) {
+ QVariant v = resourceBuilder()->loadResource(workingDirectory(), property);
+ if (v.isValid()) {
+ QVariant nativeValue = resourceBuilder()->toNativeValue(v);
+ currentItem->setIcon(col, qvariant_cast<QIcon>(nativeValue));
+ currentItem->setData(col, Qt::DecorationPropertyRole, v);
+ }
+ } else {
+ QVariant v;
+ int role = strings.treeItemRoleHash.value(property->attributeName(), (Qt::ItemDataRole)-1);
+ if (role >= 0) {
+ if ((v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, property)).isValid())
+ currentItem->setData(col, role, v);
+ } else {
+ QPair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair =
+ strings.treeItemTextRoleHash.value(property->attributeName(),
+ qMakePair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1));
+ if (rolePair.first >= 0) {
+ QVariant textV = textBuilder()->loadText(property);
+ QVariant nativeValue = textBuilder()->toNativeValue(textV);
+ currentItem->setData(col, rolePair.first, qvariant_cast<QString>(nativeValue));
+ currentItem->setData(col, rolePair.second, textV);
+ }
+ }
+ }
+ }
+ }
+
+ foreach (DomItem *childItem, domItem->elementItem())
+ pendingQueue.enqueue(qMakePair(childItem, currentItem));
+
+ }
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTableWidget *tableWidget, QWidget *parentWidget)
+{
+ Q_UNUSED(parentWidget);
+
+ const QList<DomColumn*> columns = ui_widget->elementColumn();
+ if (columns.count() > 0)
+ tableWidget->setColumnCount(columns.count());
+ for (int i = 0; i< columns.count(); i++) {
+ DomColumn *c = columns.at(i);
+ const DomPropertyHash properties = propertyMap(c->elementProperty());
+
+ if (!properties.isEmpty()) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ loadItemProps(this, item, properties);
+ tableWidget->setHorizontalHeaderItem(i, item);
+ }
+ }
+
+ const QList<DomRow*> rows = ui_widget->elementRow();
+ if (rows.count() > 0)
+ tableWidget->setRowCount(rows.count());
+ for (int i = 0; i< rows.count(); i++) {
+ const DomRow *r = rows.at(i);
+ const DomPropertyHash properties = propertyMap(r->elementProperty());
+
+ if (!properties.isEmpty()) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ loadItemProps(this, item, properties);
+ tableWidget->setVerticalHeaderItem(i, item);
+ }
+ }
+
+ foreach (DomItem *ui_item, ui_widget->elementItem()) {
+ if (ui_item->hasAttributeRow() && ui_item->hasAttributeColumn()) {
+ const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
+ QTableWidgetItem *item = new QTableWidgetItem;
+ loadItemPropsNFlags(this, item, properties);
+ tableWidget->setItem(ui_item->attributeRow(), ui_item->attributeColumn(), item);
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox *comboBox, QWidget *parentWidget)
+{
+ Q_UNUSED(parentWidget);
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ foreach (DomItem *ui_item, ui_widget->elementItem()) {
+ const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
+ QString text;
+ QIcon icon;
+ QVariant textData;
+ QVariant iconData;
+
+ DomProperty *p = 0;
+
+ p = properties.value(strings.textAttribute);
+ if (p && p->elementString()) {
+ textData = textBuilder()->loadText(p);
+ text = qvariant_cast<QString>(textBuilder()->toNativeValue(textData));
+ }
+
+ p = properties.value(strings.iconAttribute);
+ if (p) {
+ iconData = resourceBuilder()->loadResource(workingDirectory(), p);
+ icon = qvariant_cast<QIcon>(resourceBuilder()->toNativeValue(iconData));
+ }
+
+ comboBox->addItem(icon, text);
+ comboBox->setItemData((comboBox->count()-1), iconData, Qt::DecorationPropertyRole);
+ comboBox->setItemData((comboBox->count()-1), textData, Qt::DisplayPropertyRole);
+ }
+
+ DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
+ if (currentIndex)
+ comboBox->setCurrentIndex(currentIndex->elementNumber());
+}
+
+// Get the button group name out of a widget's attribute list
+static QString buttonGroupName(const DomWidget *ui_widget)
+{
+ typedef QList<DomProperty*> DomPropertyList;
+ const DomPropertyList attributes = ui_widget->elementAttribute();
+ if (attributes.empty())
+ return QString();
+ const QString buttonGroupProperty = QLatin1String(buttonGroupPropertyC);
+ const DomPropertyList::const_iterator cend = attributes.constEnd();
+ for (DomPropertyList::const_iterator it = attributes.constBegin(); it != cend; ++it)
+ if ( (*it)->attributeName() == buttonGroupProperty)
+ return (*it)->elementString()->text();
+ return QString();
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbstractButton *button, QWidget *)
+{
+ typedef QFormBuilderExtra::ButtonGroupEntry ButtonGroupEntry;
+ typedef QFormBuilderExtra::ButtonGroupHash ButtonGroupHash;
+
+ const QString groupName = buttonGroupName(ui_widget);
+ if (groupName.isEmpty())
+ return;
+ // Find entry
+ QFormBuilderExtra *extra = QFormBuilderExtra::instance(this);
+ ButtonGroupHash &buttonGroups = extra->buttonGroups();
+ ButtonGroupHash::iterator it = buttonGroups.find(groupName);
+ if (it == buttonGroups.end()) {
+#ifdef QFORMINTERNAL_NAMESPACE // Suppress the warning when copying in Designer
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid QButtonGroup reference '%1' referenced by '%2'.").arg(groupName, button->objectName()));
+#endif
+ return;
+ }
+ // Create button group on demand?
+ QButtonGroup *&group = it.value().second;
+ if (group == 0) {
+ group = new QButtonGroup;
+ group->setObjectName(groupName);
+ applyProperties(group, it.value().first->elementProperty());
+ }
+ group->addButton(button);
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstractItemView *itemView,
+ QWidget *)
+{
+ //
+ // Special handling for qtableview/qtreeview fake header attributes
+ //
+ static QStringList realPropertyNames =
+ (QStringList() << QLatin1String("visible")
+ << QLatin1String("cascadingSectionResizes")
+ << QLatin1String("defaultSectionSize")
+ << QLatin1String("highlightSections")
+ << QLatin1String("minimumSectionSize")
+ << QLatin1String("showSortIndicator")
+ << QLatin1String("stretchLastSection"));
+
+ if (QTreeView *treeView = qobject_cast<QTreeView*>(itemView)) {
+ QList<DomProperty*> allAttributes = ui_widget->elementAttribute();
+ QList<DomProperty*> headerProperties;
+ foreach (const QString &realPropertyName, realPropertyNames) {
+ const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ + realPropertyName.mid(1);
+ const QString fakePropertyName = QLatin1String("header") + upperPropertyName;
+ foreach (DomProperty *attr, allAttributes) {
+ if (attr->attributeName() == fakePropertyName) {
+ attr->setAttributeName(realPropertyName);
+ headerProperties << attr;
+ }
+ }
+ }
+ applyProperties(treeView->header(), headerProperties);
+ } else if (QTableView *tableView = qobject_cast<QTableView*>(itemView)) {
+ static QStringList headerPrefixes =
+ (QStringList() << QLatin1String("horizontalHeader")
+ << QLatin1String("verticalHeader"));
+
+ QList<DomProperty*> allAttributes = ui_widget->elementAttribute();
+ foreach (const QString &headerPrefix, headerPrefixes) {
+ QList<DomProperty*> headerProperties;
+ foreach (const QString &realPropertyName, realPropertyNames) {
+ const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ + realPropertyName.mid(1);
+ const QString fakePropertyName = headerPrefix + upperPropertyName;
+ foreach (DomProperty *attr, allAttributes) {
+ if (attr->attributeName() == fakePropertyName) {
+ attr->setAttributeName(realPropertyName);
+ headerProperties << attr;
+ }
+ }
+ }
+ if (headerPrefix == QLatin1String("horizontalHeader"))
+ applyProperties(tableView->horizontalHeader(), headerProperties);
+ else
+ applyProperties(tableView->verticalHeader(), headerProperties);
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
+{
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ if (0) {
+#ifndef QT_NO_LISTWIDGET
+ } else if (QListWidget *listWidget = qobject_cast<QListWidget*>(widget)) {
+ loadListWidgetExtraInfo(ui_widget, listWidget, parentWidget);
+#endif
+#ifndef QT_NO_TREEWIDGET
+ } else if (QTreeWidget *treeWidget = qobject_cast<QTreeWidget*>(widget)) {
+ loadTreeWidgetExtraInfo(ui_widget, treeWidget, parentWidget);
+#endif
+#ifndef QT_NO_TABLEWIDGET
+ } else if (QTableWidget *tableWidget = qobject_cast<QTableWidget*>(widget)) {
+ loadTableWidgetExtraInfo(ui_widget, tableWidget, parentWidget);
+#endif
+#ifndef QT_NO_COMBOBOX
+ } else if (QComboBox *comboBox = qobject_cast<QComboBox*>(widget)) {
+ if (!qobject_cast<QFontComboBox *>(widget))
+ loadComboBoxExtraInfo(ui_widget, comboBox, parentWidget);
+#endif
+#ifndef QT_NO_TABWIDGET
+ } else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(widget)) {
+ const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
+ if (currentIndex)
+ tabWidget->setCurrentIndex(currentIndex->elementNumber());
+#endif
+#ifndef QT_NO_STACKEDWIDGET
+ } else if (QStackedWidget *stackedWidget = qobject_cast<QStackedWidget*>(widget)) {
+ const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
+ if (currentIndex)
+ stackedWidget->setCurrentIndex(currentIndex->elementNumber());
+#endif
+#ifndef QT_NO_TOOLBOX
+ } else if (QToolBox *toolBox = qobject_cast<QToolBox*>(widget)) {
+ const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
+ if (currentIndex)
+ toolBox->setCurrentIndex(currentIndex->elementNumber());
+ const DomProperty *tabSpacing = propertyMap(ui_widget->elementProperty()).value(strings.tabSpacingProperty);
+ if (tabSpacing)
+ toolBox->layout()->setSpacing(tabSpacing->elementNumber());
+#endif
+ } else if (QAbstractButton *ab = qobject_cast<QAbstractButton *>(widget)) {
+ loadButtonExtraInfo(ui_widget, ab, parentWidget);
+ }
+ if (QAbstractItemView *itemView = qobject_cast<QAbstractItemView *>(widget)) {
+ loadItemViewExtraInfo(ui_widget, itemView, parentWidget);
+ }
+}
+
+/*!
+ \internal
+*/
+QIcon QAbstractFormBuilder::nameToIcon(const QString &filePath, const QString &qrcPath)
+{
+ Q_UNUSED(filePath)
+ Q_UNUSED(qrcPath)
+ qWarning() << "QAbstractFormBuilder::nameToIcon() is obsoleted";
+ return QIcon();
+}
+
+/*!
+ \internal
+*/
+QString QAbstractFormBuilder::iconToFilePath(const QIcon &pm) const
+{
+ Q_UNUSED(pm)
+ qWarning() << "QAbstractFormBuilder::iconToFilePath() is obsoleted";
+ return QString();
+}
+
+/*!
+ \internal
+*/
+QString QAbstractFormBuilder::iconToQrcPath(const QIcon &pm) const
+{
+ Q_UNUSED(pm)
+ qWarning() << "QAbstractFormBuilder::iconToQrcPath() is obsoleted";
+ return QString();
+}
+
+/*!
+ \internal
+*/
+QPixmap QAbstractFormBuilder::nameToPixmap(const QString &filePath, const QString &qrcPath)
+{
+ Q_UNUSED(filePath)
+ Q_UNUSED(qrcPath)
+ qWarning() << "QAbstractFormBuilder::nameToPixmap() is obsoleted";
+ return QPixmap();
+}
+
+/*!
+ \internal
+*/
+QString QAbstractFormBuilder::pixmapToFilePath(const QPixmap &pm) const
+{
+ Q_UNUSED(pm)
+ qWarning() << "QAbstractFormBuilder::pixmapToFilePath() is obsoleted";
+ return QString();
+}
+
+/*!
+ \internal
+*/
+QString QAbstractFormBuilder::pixmapToQrcPath(const QPixmap &pm) const
+{
+ Q_UNUSED(pm)
+ qWarning() << "QAbstractFormBuilder::pixmapToQrcPath() is obsoleted";
+ return QString();
+}
+
+/*!
+ Returns the current working directory of the form builder.
+
+ \sa setWorkingDirectory() */
+QDir QAbstractFormBuilder::workingDirectory() const
+{
+ return m_workingDirectory;
+}
+
+/*!
+ Sets the current working directory of the form builder to the
+ specified \a directory.
+
+ \sa workingDirectory()*/
+void QAbstractFormBuilder::setWorkingDirectory(const QDir &directory)
+{
+ m_workingDirectory = directory;
+}
+
+/*!
+ \internal
+*/
+DomAction *QAbstractFormBuilder::createDom(QAction *action)
+{
+ if (action->parentWidget() == action->menu() || action->isSeparator())
+ return 0;
+
+ DomAction *ui_action = new DomAction;
+ ui_action->setAttributeName(action->objectName());
+
+ const QList<DomProperty*> properties = computeProperties(action);
+ ui_action->setElementProperty(properties);
+
+ return ui_action;
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+DomButtonGroup *QAbstractFormBuilder::createDom(QButtonGroup *buttonGroup)
+{
+ if (buttonGroup->buttons().count() == 0) // Empty group left over on form?
+ return 0;
+ DomButtonGroup *domButtonGroup = new DomButtonGroup;
+ domButtonGroup->setAttributeName(buttonGroup->objectName());
+
+ QList<DomProperty*> properties = computeProperties(buttonGroup);
+ domButtonGroup->setElementProperty(properties);
+ return domButtonGroup;
+}
+
+/*!
+ \internal
+*/
+DomActionGroup *QAbstractFormBuilder::createDom(QActionGroup *actionGroup)
+{
+ DomActionGroup *ui_action_group = new DomActionGroup;
+ ui_action_group->setAttributeName(actionGroup->objectName());
+
+ QList<DomProperty*> properties = computeProperties(actionGroup);
+ ui_action_group->setElementProperty(properties);
+
+ QList<DomAction*> ui_actions;
+
+ foreach (QAction *action, actionGroup->actions()) {
+ if (DomAction *ui_action = createDom(action)) {
+ ui_actions.append(ui_action);
+ }
+ }
+
+ ui_action_group->setElementAction(ui_actions);
+
+ return ui_action_group;
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::addMenuAction(QAction *action)
+{
+ Q_UNUSED(action);
+}
+
+/*!
+ \internal
+*/
+void QAbstractFormBuilder::reset()
+{
+ m_laidout.clear();
+ m_actions.clear();
+ m_actionGroups.clear();
+ m_defaultMargin = INT_MIN;
+ m_defaultSpacing = INT_MIN;
+}
+
+/*!
+ \internal
+ Access meta enumeration for Qt::ToolBarArea
+*/
+
+QMetaEnum QAbstractFormBuilder::toolBarAreaMetaEnum()
+{
+ return metaEnum<QAbstractFormBuilderGadget>("toolBarArea");
+}
+
+/*!
+ \internal
+ Return paths of an icon.
+*/
+
+QAbstractFormBuilder::IconPaths QAbstractFormBuilder::iconPaths(const QIcon &icon) const
+{
+ Q_UNUSED(icon);
+ qWarning() << "QAbstractFormBuilder::iconPaths() is obsoleted";
+ return IconPaths();
+}
+
+/*!
+ \internal
+ Return paths of a pixmap.
+*/
+
+QAbstractFormBuilder::IconPaths QAbstractFormBuilder::pixmapPaths(const QPixmap &pixmap) const
+{
+ Q_UNUSED(pixmap);
+ qWarning() << "QAbstractFormBuilder::pixmapPaths() is obsoleted";
+ return IconPaths();
+}
+
+/*!
+ \internal
+ Set up a DOM property with icon.
+*/
+
+void QAbstractFormBuilder::setIconProperty(DomProperty &p, const IconPaths &ip) const
+{
+ DomResourceIcon *dpi = new DomResourceIcon;
+
+ /* TODO
+ if (!ip.second.isEmpty())
+ pix->setAttributeResource(ip.second);
+*/
+ dpi->setText(ip.first);
+
+ p.setAttributeName(QFormBuilderStrings::instance().iconAttribute);
+ p.setElementIconSet(dpi);
+}
+
+/*!
+ \internal
+ Set up a DOM property with pixmap.
+*/
+
+void QAbstractFormBuilder::setPixmapProperty(DomProperty &p, const IconPaths &ip) const
+{
+ DomResourcePixmap *pix = new DomResourcePixmap;
+ if (!ip.second.isEmpty())
+ pix->setAttributeResource(ip.second);
+
+ pix->setText(ip.first);
+
+ p.setAttributeName(QFormBuilderStrings::instance().pixmapAttribute);
+ p.setElementPixmap(pix);
+}
+
+/*!
+ \internal
+ Convenience. Return DOM property for icon; 0 if icon.isNull().
+*/
+
+DomProperty* QAbstractFormBuilder::iconToDomProperty(const QIcon &icon) const
+{
+ Q_UNUSED(icon);
+ qWarning() << "QAbstractFormBuilder::iconToDomProperty() is obsoleted";
+ return 0;
+}
+
+/*!
+ \internal
+ \since 4.4
+*/
+
+DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const
+{
+ if (v.isNull())
+ return 0;
+
+ DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), v);
+ if (p)
+ p->setAttributeName(QFormBuilderStrings::instance().iconAttribute);
+ return p;
+}
+
+/*!
+ \internal
+ \since 4.5
+*/
+
+DomProperty *QAbstractFormBuilder::saveText(const QString &attributeName, const QVariant &v) const
+{
+ if (v.isNull())
+ return 0;
+
+ DomProperty *p = textBuilder()->saveText(v);
+ if (p)
+ p->setAttributeName(attributeName);
+ return p;
+}
+
+/*!
+ \internal
+ Return the appropriate DOM pixmap for an image dom property.
+ From 4.4 - unused
+*/
+
+const DomResourcePixmap *QAbstractFormBuilder::domPixmap(const DomProperty* p) {
+ switch (p->kind()) {
+ case DomProperty::IconSet:
+ qDebug() << "** WARNING QAbstractFormBuilder::domPixmap() called for icon set!";
+ break;
+ case DomProperty::Pixmap:
+ return p->elementPixmap();
+ default:
+ break;
+ }
+ return 0;
+}
+
+/*!
+ \internal
+ Create icon from DOM.
+ From 4.4 - unused
+*/
+
+QIcon QAbstractFormBuilder::domPropertyToIcon(const DomResourcePixmap *icon)
+{
+ Q_UNUSED(icon);
+ qWarning() << "QAbstractFormBuilder::domPropertyToIcon() is obsoleted";
+ return QIcon();
+}
+
+/*!
+ \internal
+ Create icon from DOM. Assert if !domPixmap
+ From 4.4 - unused
+*/
+
+QIcon QAbstractFormBuilder::domPropertyToIcon(const DomProperty* p)
+{
+ Q_UNUSED(p);
+ qWarning() << "QAbstractFormBuilder::domPropertyToIcon() is obsoleted";
+ return QIcon();
+}
+
+
+/*!
+ \internal
+ Create pixmap from DOM.
+ From 4.4 - unused
+*/
+
+QPixmap QAbstractFormBuilder::domPropertyToPixmap(const DomResourcePixmap* pixmap)
+{
+ Q_UNUSED(pixmap);
+ qWarning() << "QAbstractFormBuilder::domPropertyToPixmap() is obsoleted";
+ return QPixmap();
+}
+
+
+/*!
+ \internal
+ Create pixmap from DOM. Assert if !domPixmap
+ From 4.4 - unused
+*/
+
+QPixmap QAbstractFormBuilder::domPropertyToPixmap(const DomProperty* p)
+{
+ Q_UNUSED(p);
+ qWarning() << "QAbstractFormBuilder::domPropertyToPixmap() is obsoleted";
+ return QPixmap();
+}
+
+/*!
+ \fn void QAbstractFormBuilder::createConnections ( DomConnections *, QWidget * )
+ \internal
+*/
+
+/*!
+ \fn void QAbstractFormBuilder::createCustomWidgets ( DomCustomWidgets * )
+ \internal
+*/
+
+/*!
+ \fn void QAbstractFormBuilder::createResources ( DomResources * )
+ \internal
+*/
+
+/*!
+ \fn QFormScriptRunner *QAbstractFormBuilder::formScriptRunner() const
+ \internal
+ \since 4.3
+*/
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+QFormScriptRunner *QAbstractFormBuilder::formScriptRunner() const
+{
+ return &(QFormBuilderExtra::instance(this)->formScriptRunner());
+}
+#endif
+
+/*!
+ Sets whether the execution of scripts is enabled to \a enabled.
+ \since 4.3
+ \internal
+*/
+
+void QAbstractFormBuilder::setScriptingEnabled(bool enabled)
+{
+#ifdef QT_FORMBUILDER_NO_SCRIPT
+ if (enabled)
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "This version of the uitools library is linked without script support."));
+#else
+ QFormScriptRunner::Options options = formScriptRunner()->options();
+ if (enabled)
+ options &= ~QFormScriptRunner::DisableScripts;
+ else
+ options |= QFormScriptRunner::DisableScripts;
+ formScriptRunner()->setOptions(options);
+#endif
+}
+
+/*!
+ Returns whether the execution of scripts is enabled.
+ \sa setScriptingEnabled()
+ \since 4.3
+ \internal
+*/
+
+bool QAbstractFormBuilder::isScriptingEnabled() const
+{
+#ifdef QT_FORMBUILDER_NO_SCRIPT
+ return false;
+#else
+ return !(formScriptRunner()->options() & QFormScriptRunner::DisableScripts);
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/abstractformbuilder.h b/tools/uilib/abstractformbuilder.h
new file mode 100644
index 0000000000..b76f0e42b2
--- /dev/null
+++ b/tools/uilib/abstractformbuilder.h
@@ -0,0 +1,290 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ABSTRACTFORMBUILDER_H
+#define ABSTRACTFORMBUILDER_H
+
+#include <QtDesigner/uilib_global.h>
+
+#include <QtCore/QList>
+#include <QtCore/QHash>
+#include <QtCore/QDir>
+
+#include <QtGui/QSizePolicy>
+#include <QtGui/QPalette>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+#if 0
+// pragma for syncqt, don't remove.
+
+#pragma qt_class(QAbstractFormBuilder)
+#endif
+
+class QAction;
+class QButtonGroup;
+class QActionGroup;
+class QComboBox;
+class QIODevice;
+class QIcon;
+class QLayout;
+class QLayoutItem;
+class QListWidget;
+class QObject;
+class QSpacerItem;
+class QTreeWidget;
+class QTableWidget;
+class QVariant;
+class QWidget;
+class QAbstractButton;
+class QAbstractItemView;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class DomAction;
+class DomActionGroup;
+class DomButtonGroup;
+class DomButtonGroups;
+class DomActionRef;
+class DomBrush;
+class DomColorGroup;
+class DomConnections;
+class DomCustomWidgets;
+class DomLayout;
+class DomLayoutItem;
+class DomProperty;
+class DomResources;
+class DomSpacer;
+class DomString;
+class DomTabStops;
+class DomUI;
+class DomWidget;
+class DomResourcePixmap;
+
+class QResourceBuilder;
+class QTextBuilder;
+
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+class QFormScriptRunner;
+#endif
+
+class QDESIGNER_UILIB_EXPORT QAbstractFormBuilder
+{
+public:
+ QAbstractFormBuilder();
+ virtual ~QAbstractFormBuilder();
+
+ QDir workingDirectory() const;
+ void setWorkingDirectory(const QDir &directory);
+
+ virtual QWidget *load(QIODevice *dev, QWidget *parentWidget=0);
+ virtual void save(QIODevice *dev, QWidget *widget);
+
+ void setScriptingEnabled(bool enabled);
+ bool isScriptingEnabled() const;
+
+protected:
+//
+// load
+//
+ virtual void loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget);
+
+ virtual QWidget *create(DomUI *ui, QWidget *parentWidget);
+ virtual QWidget *create(DomWidget *ui_widget, QWidget *parentWidget);
+ virtual QLayout *create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget);
+ virtual QLayoutItem *create(DomLayoutItem *ui_layoutItem, QLayout *layout, QWidget *parentWidget);
+
+ virtual QAction *create(DomAction *ui_action, QObject *parent);
+ virtual QActionGroup *create(DomActionGroup *ui_action_group, QObject *parent);
+ virtual void addMenuAction(QAction *action);
+
+ virtual void applyProperties(QObject *o, const QList<DomProperty*> &properties);
+ bool applyPropertyInternally(QObject *o, const QString &propertyName, const QVariant &value);
+
+ virtual void applyTabStops(QWidget *widget, DomTabStops *tabStops);
+
+ virtual QWidget *createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name);
+ virtual QLayout *createLayout(const QString &layoutName, QObject *parent, const QString &name);
+ virtual QAction *createAction(QObject *parent, const QString &name);
+ virtual QActionGroup *createActionGroup(QObject *parent, const QString &name);
+
+ virtual void createCustomWidgets(DomCustomWidgets *) {}
+ virtual void createConnections(DomConnections *, QWidget *) {}
+ virtual void createResources(DomResources*) {}
+
+ virtual bool addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout);
+ virtual bool addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget);
+
+//
+// save
+//
+ virtual void saveExtraInfo(QWidget *widget, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+
+ virtual void saveDom(DomUI *ui, QWidget *widget);
+
+ virtual DomActionRef *createActionRefDom(QAction *action);
+
+ virtual DomWidget *createDom(QWidget *widget, DomWidget *ui_parentWidget, bool recursive = true);
+ virtual DomLayout *createDom(QLayout *layout, DomLayout *ui_layout, DomWidget *ui_parentWidget);
+ virtual DomLayoutItem *createDom(QLayoutItem *item, DomLayout *ui_parentLayout, DomWidget *ui_parentWidget);
+ virtual DomSpacer *createDom(QSpacerItem *spacer, DomLayout *ui_parentLayout, DomWidget *ui_parentWidget);
+
+ virtual DomAction *createDom(QAction *action);
+ virtual DomActionGroup *createDom(QActionGroup *actionGroup);
+ DomButtonGroup *createDom(QButtonGroup *buttonGroup);
+
+ virtual DomConnections *saveConnections();
+ virtual DomCustomWidgets *saveCustomWidgets();
+ virtual DomTabStops *saveTabStops();
+ virtual DomResources *saveResources();
+ DomButtonGroups *saveButtonGroups(const QWidget *mainContainer);
+ virtual QList<DomProperty*> computeProperties(QObject *obj);
+ virtual bool checkProperty(QObject *obj, const QString &prop) const;
+ virtual DomProperty *createProperty(QObject *object, const QString &propertyName, const QVariant &value);
+
+ virtual void layoutInfo(DomLayout *layout, QObject *parent, int *margin, int *spacing);
+
+ virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath);
+ virtual QString iconToFilePath(const QIcon &pm) const;
+ virtual QString iconToQrcPath(const QIcon &pm) const;
+ virtual QPixmap nameToPixmap(const QString &filePath, const QString &qrcPath);
+ virtual QString pixmapToFilePath(const QPixmap &pm) const;
+ virtual QString pixmapToQrcPath(const QPixmap &pm) const;
+
+ void loadListWidgetExtraInfo(DomWidget *ui_widget, QListWidget *listWidget, QWidget *parentWidget);
+ void loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWidget *treeWidget, QWidget *parentWidget);
+ void loadTableWidgetExtraInfo(DomWidget *ui_widget, QTableWidget *tableWidget, QWidget *parentWidget);
+ void loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox *comboBox, QWidget *parentWidget);
+ void loadButtonExtraInfo(const DomWidget *ui_widget, QAbstractButton *button, QWidget *parentWidget);
+ void loadItemViewExtraInfo(DomWidget *ui_widget, QAbstractItemView *itemView, QWidget *parentWidget);
+
+ void saveListWidgetExtraInfo(QListWidget *widget, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+ void saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+ void saveTableWidgetExtraInfo(QTableWidget *tablWidget, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+ void saveComboBoxExtraInfo(QComboBox *widget, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+ void saveButtonExtraInfo(const QAbstractButton *widget, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+ void saveItemViewExtraInfo(const QAbstractItemView *itemView, DomWidget *ui_widget, DomWidget *ui_parentWidget);
+
+ void setResourceBuilder(QResourceBuilder *builder);
+ QResourceBuilder *resourceBuilder() const;
+ DomProperty *saveResource(const QVariant &v) const;
+
+ void setTextBuilder(QTextBuilder *builder);
+ QTextBuilder *textBuilder() const;
+ DomProperty *saveText(const QString &attributeName, const QVariant &v) const;
+//
+// utils
+//
+
+ QVariant toVariant(const QMetaObject *meta, DomProperty *property);
+ static QString toString(const DomString *str);
+
+ typedef QHash<QString, DomProperty*> DomPropertyHash;
+ static DomPropertyHash propertyMap(const QList<DomProperty*> &properties);
+
+ void setupColorGroup(QPalette &palette, QPalette::ColorGroup colorGroup, DomColorGroup *group);
+ DomColorGroup *saveColorGroup(const QPalette &palette);
+ QBrush setupBrush(DomBrush *brush);
+ DomBrush *saveBrush(const QBrush &brush);
+
+ void reset();
+ void initialize(const DomUI *ui);
+
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+ QFormScriptRunner *formScriptRunner() const;
+#endif
+//
+// utils
+//
+
+ static QMetaEnum toolBarAreaMetaEnum();
+
+//
+// Icon/pixmap stuff
+//
+ // A Pair of icon path/qrc path.
+ typedef QPair<QString, QString> IconPaths;
+
+ IconPaths iconPaths(const QIcon &) const;
+ IconPaths pixmapPaths(const QPixmap &) const;
+ void setIconProperty(DomProperty &, const IconPaths &) const;
+ void setPixmapProperty(DomProperty &, const IconPaths &) const;
+ DomProperty* iconToDomProperty(const QIcon &) const;
+
+ static const DomResourcePixmap *domPixmap(const DomProperty* p);
+ QIcon domPropertyToIcon(const DomResourcePixmap *);
+ QIcon domPropertyToIcon(const DomProperty* p);
+ QPixmap domPropertyToPixmap(const DomResourcePixmap* p);
+ QPixmap domPropertyToPixmap(const DomProperty* p);
+
+ QHash<QObject*, bool> m_laidout;
+ QHash<QString, QAction*> m_actions;
+ QHash<QString, QActionGroup*> m_actionGroups;
+ int m_defaultMargin;
+ int m_defaultSpacing;
+ QDir m_workingDirectory;
+
+private:
+//
+// utils
+//
+ static Qt::ToolBarArea toolbarAreaFromDOMAttributes(const DomPropertyHash &attributeMap);
+
+ QAbstractFormBuilder(const QAbstractFormBuilder &other);
+ void operator = (const QAbstractFormBuilder &other);
+
+ friend QDESIGNER_UILIB_EXPORT DomProperty *variantToDomProperty(QAbstractFormBuilder *abstractFormBuilder, const QMetaObject *meta, const QString &propertyName, const QVariant &value);
+ friend QDESIGNER_UILIB_EXPORT QVariant domPropertyToVariant(QAbstractFormBuilder *abstractFormBuilder,const QMetaObject *meta, const DomProperty *property);
+};
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // ABSTRACTFORMBUILDER_H
diff --git a/tools/uilib/container.h b/tools/uilib/container.h
new file mode 100644
index 0000000000..89df461e02
--- /dev/null
+++ b/tools/uilib/container.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONTAINER_H
+#define CONTAINER_H
+
+#include <QtDesigner/extension.h>
+#include <QtCore/QObject>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QWidget;
+
+class QDesignerContainerExtension
+{
+public:
+ virtual ~QDesignerContainerExtension() {}
+
+ virtual int count() const = 0;
+ virtual QWidget *widget(int index) const = 0;
+
+ virtual int currentIndex() const = 0;
+ virtual void setCurrentIndex(int index) = 0;
+
+ virtual void addWidget(QWidget *widget) = 0;
+ virtual void insertWidget(int index, QWidget *widget) = 0;
+ virtual void remove(int index) = 0;
+};
+Q_DECLARE_EXTENSION_INTERFACE(QDesignerContainerExtension, "com.trolltech.Qt.Designer.Container")
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // CONTAINER_H
diff --git a/tools/uilib/container.qdoc b/tools/uilib/container.qdoc
new file mode 100644
index 0000000000..d9310515d3
--- /dev/null
+++ b/tools/uilib/container.qdoc
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QDesignerContainerExtension
+ \brief The QDesignerContainerExtension class allows you to add pages to
+ a custom multi-page container in Qt Designer's workspace.
+ \inmodule QtDesigner
+
+ QDesignerContainerExtension provide an interface for creating
+ custom container extensions. A container extension consists of a
+ collection of functions that \QD needs to manage a multi-page
+ container plugin, and a list of the container's pages.
+
+ \image containerextension-example.png
+
+ \warning This is \e not an extension for container plugins in
+ general, only custom \e multi-page containers.
+
+ To create a container extension, your extension class must inherit
+ from both QObject and QDesignerContainerExtension. For example:
+
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 6
+
+ Since we are implementing an interface, we must ensure that it's
+ made known to the meta object system using the Q_INTERFACES()
+ macro. This enables \QD to use the qobject_cast() function to
+ query for supported interfaces using nothing but a QObject
+ pointer.
+
+ You must reimplement several functions to enable \QD to manage a
+ custom multi-page container widget: \QD uses count() to keep track
+ of the number pages in your container, widget() to return the page
+ at a given index in the list of the container's pages, and
+ currentIndex() to return the list index of the selected page. \QD
+ uses the addWidget() function to add a given page to the
+ container, expecting it to be appended to the list of pages, while
+ it expects the insertWidget() function to add a given page to the
+ container by inserting it at a given index.
+
+ In \QD the extensions are not created until they are
+ required. For that reason you must also create a
+ QExtensionFactory, i.e a class that is able to make an instance of
+ your extension, and register it using \QD's \l
+ {QExtensionManager}{extension manager}.
+
+ When a container extension is required, \QD's \l
+ {QExtensionManager}{extension manager} will run through all its
+ registered factories calling QExtensionFactory::createExtension()
+ for each until the first one that is able to create a container
+ extension, is found. This factory will then create the extension
+ for the plugin.
+
+ There are four available types of extensions in \QD:
+ QDesignerContainerExtension , QDesignerMemberSheetExtension,
+ QDesignerPropertySheetExtension and QDesignerTaskMenuExtension.
+ \QD's behavior is the same whether the requested extension is
+ associated with a multi page container, a member sheet, a property
+ sheet or a task menu.
+
+ The QExtensionFactory class provides a standard extension factory,
+ and can also be used as an interface for custom extension
+ factories. You can either create a new QExtensionFactory and
+ reimplement the QExtensionFactory::createExtension() function. For
+ example:
+
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 7
+
+ Or you can use an existing factory, expanding the
+ QExtensionFactory::createExtension() function to make the factory
+ able to create a container extension as well. For example:
+
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 8
+
+ For a complete example using the QDesignerContainerExtension
+ class, see the \l {designer/containerextension}{Container
+ Extension example}. The example shows how to create a custom
+ multi-page plugin for \QD.
+
+ \sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
+ Extensions}
+*/
+
+/*!
+ \fn QDesignerContainerExtension::~QDesignerContainerExtension()
+
+ Destroys the extension.
+*/
+
+/*!
+ \fn int QDesignerContainerExtension::count() const
+
+ Returns the number of pages in the container.
+*/
+
+/*!
+ \fn QWidget *QDesignerContainerExtension::widget(int index) const
+
+ Returns the page at the given \a index in the extension's list of
+ pages.
+
+ \sa addWidget(), insertWidget()
+*/
+
+/*!
+ \fn int QDesignerContainerExtension::currentIndex() const
+
+ Returns the index of the currently selected page in the
+ container.
+
+ \sa setCurrentIndex()
+*/
+
+/*!
+ \fn void QDesignerContainerExtension::setCurrentIndex(int index)
+
+ Sets the currently selected page in the container to be the
+ page at the given \a index in the extension's list of pages.
+
+ \sa currentIndex()
+*/
+
+/*!
+ \fn void QDesignerContainerExtension::addWidget(QWidget *page)
+
+ Adds the given \a page to the container by appending it to the
+ extension's list of pages.
+
+ \sa insertWidget(), remove(), widget()
+*/
+
+/*!
+ \fn void QDesignerContainerExtension::insertWidget(int index, QWidget *page)
+
+ Adds the given \a page to the container by inserting it at the
+ given \a index in the extension's list of pages.
+
+ \sa addWidget(), remove(), widget()
+*/
+
+/*!
+ \fn void QDesignerContainerExtension::remove(int index)
+
+ Removes the page at the given \a index from the extension's list
+ of pages.
+
+ \sa addWidget(), insertWidget()
+*/
diff --git a/tools/uilib/customwidget.h b/tools/uilib/customwidget.h
new file mode 100644
index 0000000000..52c234207c
--- /dev/null
+++ b/tools/uilib/customwidget.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMWIDGET_H
+#define CUSTOMWIDGET_H
+
+#include <QtDesigner/extension.h>
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtGui/QIcon>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QWidget;
+class QDesignerFormEditorInterface;
+
+class QDesignerCustomWidgetInterface
+{
+public:
+ virtual ~QDesignerCustomWidgetInterface() {}
+
+ virtual QString name() const = 0;
+ virtual QString group() const = 0;
+ virtual QString toolTip() const = 0;
+ virtual QString whatsThis() const = 0;
+ virtual QString includeFile() const = 0;
+ virtual QIcon icon() const = 0;
+
+ virtual bool isContainer() const = 0;
+
+ virtual QWidget *createWidget(QWidget *parent) = 0;
+
+ virtual bool isInitialized() const { return false; }
+ virtual void initialize(QDesignerFormEditorInterface *core) { Q_UNUSED(core); }
+
+ virtual QString domXml() const
+ {
+ return QString::fromUtf8("<widget class=\"%1\" name=\"%2\"/>")
+ .arg(name()).arg(name().toLower());
+ }
+
+ virtual QString codeTemplate() const { return QString(); }
+};
+Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, "com.trolltech.Qt.Designer.CustomWidget")
+
+
+class QDesignerCustomWidgetCollectionInterface
+{
+public:
+ virtual ~QDesignerCustomWidgetCollectionInterface() {}
+
+ virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0;
+};
+Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface,
+ "com.trolltech.Qt.Designer.CustomWidgetCollection")
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // CUSTOMWIDGET_H
diff --git a/tools/uilib/customwidget.qdoc b/tools/uilib/customwidget.qdoc
new file mode 100644
index 0000000000..d5ddaa7d30
--- /dev/null
+++ b/tools/uilib/customwidget.qdoc
@@ -0,0 +1,295 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QDesignerCustomWidgetInterface
+
+ \brief The QDesignerCustomWidgetInterface class enables Qt Designer
+ to access and construct custom widgets.
+
+ \inmodule QtDesigner
+
+ QDesignerCustomWidgetInterface provides a custom widget with an
+ interface. The class contains a set of functions that must be subclassed
+ to return basic information about the widget, such as its class name and
+ the name of its header file. Other functions must be implemented to
+ initialize the plugin when it is loaded, and to construct instances of
+ the custom widget for \QD to use.
+
+ When implementing a custom widget you must subclass
+ QDesignerCustomWidgetInterface to expose your widget to \QD. For
+ example, this is the declaration for the plugin used in the
+ \l{Custom Widget Plugin Example}{Custom Widget Plugin example} that
+ enables an analog clock custom widget to be used by \QD:
+
+ \snippet examples/designer/customwidgetplugin/customwidgetplugin.h 0
+
+ Note that the only part of the class definition that is specific
+ to this particular custom widget is the class name. In addition,
+ since we are implementing an interface, we must ensure that it's
+ made known to the meta object system using the Q_INTERFACES()
+ macro. This enables \QD to use the qobject_cast() function to
+ query for supported interfaces using nothing but a QObject
+ pointer.
+
+ After \QD loads a custom widget plugin, it calls the interface's
+ initialize() function to enable it to set up any resources that it
+ may need. This function is called with a QDesignerFormEditorInterface
+ parameter that provides the plugin with a gateway to all of \QD's API.
+
+ \QD constructs instances of the custom widget by calling the plugin's
+ createWidget() function with a suitable parent widget. Plugins must
+ construct and return an instance of a custom widget with the specified
+ parent widget.
+
+ In the implementation of the class you must remember to export
+ your custom widget plugin to \QD using the Q_EXPORT_PLUGIN2()
+ macro. For example, if a library called \c libcustomwidgetplugin.so
+ (on Unix) or \c libcustomwidget.dll (on Windows) contains a widget
+ class called \c MyCustomWidget, we can export it by adding the
+ following line to the file containing the plugin implementation:
+
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 14
+
+ This macro ensures that \QD can access and construct the custom widget.
+ Without this macro, there is no way for \QD to use it.
+
+ When implementing a custom widget plugin, you build it as a
+ separate library. If you want to include several custom widget
+ plugins in the same library, you must in addition subclass
+ QDesignerCustomWidgetCollectionInterface.
+
+ \warning If your custom widget plugin contains QVariant
+ properties, be aware that only the following \l
+ {QVariant::Type}{types} are supported:
+
+ \list
+ \o QVariant::ByteArray
+ \o QVariant::Bool
+ \o QVariant::Color
+ \o QVariant::Cursor
+ \o QVariant::Date
+ \o QVariant::DateTime
+ \o QVariant::Double
+ \o QVariant::Int
+ \o QVariant::Point
+ \o QVariant::Rect
+ \o QVariant::Size
+ \o QVariant::SizePolicy
+ \o QVariant::String
+ \o QVariant::Time
+ \o QVariant::UInt
+ \endlist
+
+ For a complete example using the QDesignerCustomWidgetInterface
+ class, see the \l {designer/customwidgetplugin}{Custom Widget
+ Example}. The example shows how to create a custom widget plugin
+ for \QD.
+
+ \sa QDesignerCustomWidgetCollectionInterface {Creating Custom
+ Widgets for Qt Designer}
+*/
+
+/*!
+ \fn QDesignerCustomWidgetInterface::~QDesignerCustomWidgetInterface()
+
+ Destroys the custom widget interface.
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::name() const
+
+ Returns the class name of the custom widget supplied by the interface.
+
+ The name returned \e must be identical to the class name used for the
+ custom widget.
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::group() const
+
+ Returns the name of the group to which the custom widget belongs.
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::toolTip() const
+
+ Returns a short description of the widget that can be used by \QD
+ in a tool tip.
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::whatsThis() const
+
+ Returns a description of the widget that can be used by \QD in
+ "What's This?" help for the widget.
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::includeFile() const
+
+ Returns the path to the include file that \l uic uses when
+ creating code for the custom widget.
+*/
+
+/*!
+ \fn QIcon QDesignerCustomWidgetInterface::icon() const
+
+ Returns the icon used to represent the custom widget in \QD's
+ widget box.
+*/
+
+/*!
+ \fn bool QDesignerCustomWidgetInterface::isContainer() const
+
+ Returns true if the custom widget is intended to be used as a
+ container; otherwise returns false.
+
+ Most custom widgets are not used to hold other widgets, so their
+ implementations of this function will return false, but custom
+ containers will return true to ensure that they behave correctly
+ in \QD.
+*/
+
+/*!
+ \fn QWidget *QDesignerCustomWidgetInterface::createWidget(QWidget *parent)
+
+ Returns a new instance of the custom widget, with the given \a
+ parent.
+*/
+
+/*!
+ \fn bool QDesignerCustomWidgetInterface::isInitialized() const
+
+ Returns true if the widget has been initialized; otherwise returns
+ false.
+
+ \sa initialize()
+*/
+
+/*!
+ \fn void QDesignerCustomWidgetInterface::initialize(QDesignerFormEditorInterface *formEditor)
+
+ Initializes the widget for use with the specified \a formEditor
+ interface.
+
+ \sa isInitialized()
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::domXml() const
+
+ Returns the XML that is used to describe the custom widget's
+ properties to \QD.
+*/
+
+/*!
+ \fn QString QDesignerCustomWidgetInterface::codeTemplate() const
+
+ This function is reserved for future use by \QD.
+
+ \omit
+ Returns the code template that \QD includes in forms that contain
+ the custom widget when they are saved.
+ \endomit
+*/
+
+/*!
+ \macro QDESIGNER_WIDGET_EXPORT
+ \relates QDesignerCustomWidgetInterface
+ \since 4.1
+
+ This macro is used when defining custom widgets to ensure that they are
+ correctly exported from plugins for use with \QD.
+
+ On some platforms, the symbols required by \QD to create new widgets
+ are removed from plugins by the build system, making them unusable.
+ Using this macro ensures that the symbols are retained on those platforms,
+ and has no side effects on other platforms.
+
+ For example, the \l{designer/worldtimeclockplugin}{World Time Clock Plugin}
+ example exports a custom widget class with the following declaration:
+
+ \snippet examples/designer/worldtimeclockplugin/worldtimeclock.h 0
+ \dots
+ \snippet examples/designer/worldtimeclockplugin/worldtimeclock.h 2
+
+ \sa {Creating Custom Widgets for Qt Designer}
+*/
+
+
+
+
+
+/*!
+ \class QDesignerCustomWidgetCollectionInterface
+
+ \brief The QDesignerCustomWidgetCollectionInterface class allows
+ you to include several custom widgets in one single library.
+
+ \inmodule QtDesigner
+
+ When implementing a custom widget plugin, you build it as a
+ separate library. If you want to include several custom widget
+ plugins in the same library, you must in addition subclass
+ QDesignerCustomWidgetCollectionInterface.
+
+ QDesignerCustomWidgetCollectionInterface contains one single
+ function returning a list of the collection's
+ QDesignerCustomWidgetInterface objects. For example, if you have
+ several custom widgets \c CustomWidgetOne, \c CustomWidgetTwo and
+ \c CustomWidgetThree, the class definition may look like this:
+
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 12
+
+ In the class constructor you add the interfaces to your custom
+ widgets to the list which you return in the customWidgets()
+ function:
+
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 13
+
+ Note that instead of exporting each custom widget plugin using the
+ Q_EXPORT_PLUGIN2() macro, you export the entire collection. The
+ Q_EXPORT_PLUGIN2() macro ensures that \QD can access and construct
+ the custom widgets. Without this macro, there is no way for \QD to
+ use them.
+
+ \sa QDesignerCustomWidgetInterface, {Creating Custom Widgets for
+ Qt Designer}
+*/
+
+/*!
+ \fn QDesignerCustomWidgetCollectionInterface::~QDesignerCustomWidgetCollectionInterface() {
+
+ Destroys the custom widget collection interface.
+*/
+
+/*!
+ \fn QList<QDesignerCustomWidgetInterface*> QDesignerCustomWidgetCollectionInterface::customWidgets() const
+
+ Returns a list of interfaces to the collection's custom widgets.
+*/
diff --git a/tools/uilib/formbuilder.cpp b/tools/uilib/formbuilder.cpp
new file mode 100644
index 0000000000..b997cc9bc0
--- /dev/null
+++ b/tools/uilib/formbuilder.cpp
@@ -0,0 +1,570 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "customwidget.h"
+#include "formbuilder.h"
+#include "formbuilderextra_p.h"
+#include "ui4_p.h"
+
+#include <QtGui/QtGui>
+#include <QtCore/QCoreApplication>
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal {
+#endif
+
+/*!
+ \class QFormBuilder
+
+ \brief The QFormBuilder class is used to dynamically construct
+ user interfaces from UI files at run-time.
+
+ \inmodule QtDesigner
+
+ The QFormBuilder class provides a mechanism for dynamically
+ creating user interfaces at run-time, based on UI files
+ created with \QD. For example:
+
+ \snippet doc/src/snippets/code/tools_designer_src_lib_uilib_formbuilder.cpp 0
+
+ By including the user interface in the example's resources (\c
+ myForm.qrc), we ensure that it will be present when the example is
+ run:
+
+ \snippet doc/src/snippets/code/tools_designer_src_lib_uilib_formbuilder.cpp 1
+
+ QFormBuilder extends the QAbstractFormBuilder base class with a
+ number of functions that are used to support custom widget
+ plugins:
+
+ \list
+ \o pluginPaths() returns the list of paths that the form builder
+ searches when loading custom widget plugins.
+ \o addPluginPath() allows additional paths to be registered with
+ the form builder.
+ \o setPluginPath() is used to replace the existing list of paths
+ with a list obtained from some other source.
+ \o clearPluginPaths() removes all paths registered with the form
+ builder.
+ \o customWidgets() returns a list of interfaces to plugins that
+ can be used to create new instances of registered custom widgets.
+ \endlist
+
+ The QFormBuilder class is typically used by custom components and
+ applications that embed \QD. Standalone applications that need to
+ dynamically generate user interfaces at run-time use the
+ QUiLoader class, found in the QtUiTools module.
+
+ \sa QAbstractFormBuilder, {QtUiTools Module}
+*/
+
+/*!
+ \fn QFormBuilder::QFormBuilder()
+
+ Constructs a new form builder.
+*/
+
+QFormBuilder::QFormBuilder() : QAbstractFormBuilder()
+{
+}
+
+/*!
+ Destroys the form builder.
+*/
+QFormBuilder::~QFormBuilder()
+{
+}
+
+/*!
+ \internal
+*/
+QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
+{
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+ if (!fb->parentWidgetIsSet())
+ fb->setParentWidget(parentWidget);
+ // Is this a QLayoutWidget with a margin of 0: Not a known page-based
+ // container and no method for adding pages registered.
+ fb->setProcessingLayoutWidget(false);
+ if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative()
+ && parentWidget
+#ifndef QT_NO_MAINWINDOW
+ && !qobject_cast<QMainWindow *>(parentWidget)
+#endif
+#ifndef QT_NO_TOOLBOX
+ && !qobject_cast<QToolBox *>(parentWidget)
+#endif
+#ifndef QT_NO_STACKEDWIDGET
+ && !qobject_cast<QStackedWidget *>(parentWidget)
+#endif
+#ifndef QT_NO_STACKEDWIDGET
+ && !qobject_cast<QTabWidget *>(parentWidget)
+#endif
+#ifndef QT_NO_SCROLLAREA
+ && !qobject_cast<QScrollArea *>(parentWidget)
+#endif
+#ifndef QT_NO_MDIAREA
+ && !qobject_cast<QMdiArea *>(parentWidget)
+#endif
+#ifndef QT_NO_DOCKWIDGET
+ && !qobject_cast<QDockWidget *>(parentWidget)
+#endif
+ ) {
+ const QString parentClassName = QLatin1String(parentWidget->metaObject()->className());
+ if (!fb->isCustomWidgetContainer(parentClassName))
+ fb->setProcessingLayoutWidget(true);
+ }
+ return QAbstractFormBuilder::create(ui_widget, parentWidget);
+}
+
+
+/*!
+ \internal
+*/
+QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name)
+{
+ if (widgetName.isEmpty()) {
+ //: Empty class name passed to widget factory method
+ qWarning() << QCoreApplication::translate("QFormBuilder", "An empty class name was passed on to %1 (object name: '%2').").arg(QString::fromUtf8(Q_FUNC_INFO), name);
+ return 0;
+ }
+
+ QWidget *w = 0;
+
+#ifndef QT_NO_TABWIDGET
+ if (qobject_cast<QTabWidget*>(parentWidget))
+ parentWidget = 0;
+#endif
+#ifndef QT_NO_STACKEDWIDGET
+ if (qobject_cast<QStackedWidget*>(parentWidget))
+ parentWidget = 0;
+#endif
+#ifndef QT_NO_TOOLBOX
+ if (qobject_cast<QToolBox*>(parentWidget))
+ parentWidget = 0;
+#endif
+
+ // ### special-casing for Line (QFrame) -- fix for 4.2
+ do {
+ if (widgetName == QFormBuilderStrings::instance().lineClass) {
+ w = new QFrame(parentWidget);
+ static_cast<QFrame*>(w)->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+ break;
+ }
+ const QByteArray widgetNameBA = widgetName.toUtf8();
+ const char *widgetNameC = widgetNameBA.constData();
+ if (w) { // symmetry for macro
+ }
+
+#define DECLARE_LAYOUT(L, C)
+#define DECLARE_COMPAT_WIDGET(W, C)
+#define DECLARE_WIDGET(W, C) else if (!qstrcmp(widgetNameC, #W)) { Q_ASSERT(w == 0); w = new W(parentWidget); }
+#define DECLARE_WIDGET_1(W, C) else if (!qstrcmp(widgetNameC, #W)) { Q_ASSERT(w == 0); w = new W(0, parentWidget); }
+
+#include "widgets.table"
+
+#undef DECLARE_COMPAT_WIDGET
+#undef DECLARE_LAYOUT
+#undef DECLARE_WIDGET
+#undef DECLARE_WIDGET_1
+
+ if (w)
+ break;
+
+ // try with a registered custom widget
+ QDesignerCustomWidgetInterface *factory = m_customWidgets.value(widgetName);
+ if (factory != 0)
+ w = factory->createWidget(parentWidget);
+ } while(false);
+
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+ if (w == 0) { // Attempt to instantiate base class of promoted/custom widgets
+ const QString baseClassName = fb->customWidgetBaseClass(widgetName);
+ if (!baseClassName.isEmpty()) {
+ qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a custom widget of the class '%1'; defaulting to base class '%2'.").arg(widgetName, baseClassName);
+ return createWidget(baseClassName, parentWidget, name);
+ }
+ }
+
+ if (w == 0) { // nothing to do
+ qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a widget of the class '%1'.").arg(widgetName);
+ return 0;
+ }
+
+ w->setObjectName(name);
+
+ if (qobject_cast<QDialog *>(w))
+ w->setParent(parentWidget);
+
+ return w;
+}
+
+/*!
+ \internal
+*/
+QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent, const QString &name)
+{
+ QLayout *l = 0;
+
+ QWidget *parentWidget = qobject_cast<QWidget*>(parent);
+ QLayout *parentLayout = qobject_cast<QLayout*>(parent);
+
+ Q_ASSERT(parentWidget || parentLayout);
+
+#define DECLARE_WIDGET(W, C)
+#define DECLARE_COMPAT_WIDGET(W, C)
+
+#define DECLARE_LAYOUT(L, C) \
+ if (layoutName == QLatin1String(#L)) { \
+ Q_ASSERT(l == 0); \
+ l = parentLayout \
+ ? new L() \
+ : new L(parentWidget); \
+ }
+
+#include "widgets.table"
+
+#undef DECLARE_LAYOUT
+#undef DECLARE_COMPAT_WIDGET
+#undef DECLARE_WIDGET
+
+ if (l) {
+ l->setObjectName(name);
+ if (parentLayout) {
+ QWidget *w = qobject_cast<QWidget *>(parentLayout->parent());
+ if (w && w->inherits("Q3GroupBox")) {
+ l->setContentsMargins(w->style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
+ w->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
+ w->style()->pixelMetric(QStyle::PM_LayoutRightMargin),
+ w->style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
+ QGridLayout *grid = qobject_cast<QGridLayout *>(l);
+ if (grid) {
+ grid->setHorizontalSpacing(-1);
+ grid->setVerticalSpacing(-1);
+ } else {
+ l->setSpacing(-1);
+ }
+ l->setAlignment(Qt::AlignTop);
+ }
+ }
+ } else {
+ qWarning() << QCoreApplication::translate("QFormBuilder", "The layout type `%1' is not supported.").arg(layoutName);
+ }
+
+ return l;
+}
+
+/*!
+ \internal
+*/
+bool QFormBuilder::addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout)
+{
+ return QAbstractFormBuilder::addItem(ui_item, item, layout);
+}
+
+/*!
+ \internal
+*/
+bool QFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
+{
+ return QAbstractFormBuilder::addItem(ui_widget, widget, parentWidget);
+}
+
+/*!
+ \internal
+*/
+QWidget *QFormBuilder::widgetByName(QWidget *topLevel, const QString &name)
+{
+ Q_ASSERT(topLevel);
+ if (topLevel->objectName() == name)
+ return topLevel;
+
+ return topLevel->findChild<QWidget*>(name);
+}
+
+static QObject *objectByName(QWidget *topLevel, const QString &name)
+{
+ Q_ASSERT(topLevel);
+ if (topLevel->objectName() == name)
+ return topLevel;
+
+ return topLevel->findChild<QObject*>(name);
+}
+
+/*!
+ \internal
+*/
+void QFormBuilder::createConnections(DomConnections *ui_connections, QWidget *widget)
+{
+ typedef QList<DomConnection*> DomConnectionList;
+ Q_ASSERT(widget != 0);
+
+ if (ui_connections == 0)
+ return;
+
+ const DomConnectionList connections = ui_connections->elementConnection();
+ if (!connections.empty()) {
+ const DomConnectionList::const_iterator cend = connections.constEnd();
+ for (DomConnectionList::const_iterator it = connections.constBegin(); it != cend; ++it) {
+
+ QObject *sender = objectByName(widget, (*it)->elementSender());
+ QObject *receiver = objectByName(widget, (*it)->elementReceiver());
+ if (!sender || !receiver)
+ continue;
+
+ QByteArray sig = (*it)->elementSignal().toUtf8();
+ sig.prepend("2");
+ QByteArray sl = (*it)->elementSlot().toUtf8();
+ sl.prepend("1");
+ QObject::connect(sender, sig, receiver, sl);
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+QWidget *QFormBuilder::create(DomUI *ui, QWidget *parentWidget)
+{
+ return QAbstractFormBuilder::create(ui, parentWidget);
+}
+
+/*!
+ \internal
+*/
+QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget)
+{
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+ // Is this a temporary layout widget used to represent QLayout hierarchies in Designer?
+ // Set its margins to 0.
+ bool layoutWidget = fb->processingLayoutWidget();
+ QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
+ if (layoutWidget) {
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ int left, top, right, bottom;
+ left = top = right = bottom = 0;
+ const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
+
+ if (DomProperty *prop = properties.value(strings.leftMarginProperty))
+ left = prop->elementNumber();
+
+ if (DomProperty *prop = properties.value(strings.topMarginProperty))
+ top = prop->elementNumber();
+
+ if (DomProperty *prop = properties.value(strings.rightMarginProperty))
+ right = prop->elementNumber();
+
+ if (DomProperty *prop = properties.value(strings.bottomMarginProperty))
+ bottom = prop->elementNumber();
+
+ l->setContentsMargins(left, top, right, bottom);
+ fb->setProcessingLayoutWidget(false);
+ }
+ return l;
+}
+
+/*!
+ \internal
+*/
+QLayoutItem *QFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout *layout, QWidget *parentWidget)
+{
+ return QAbstractFormBuilder::create(ui_layoutItem, layout, parentWidget);
+}
+
+/*!
+ \internal
+*/
+QAction *QFormBuilder::create(DomAction *ui_action, QObject *parent)
+{
+ return QAbstractFormBuilder::create(ui_action, parent);
+}
+
+/*!
+ \internal
+*/
+QActionGroup *QFormBuilder::create(DomActionGroup *ui_action_group, QObject *parent)
+{
+ return QAbstractFormBuilder::create(ui_action_group, parent);
+}
+
+/*!
+ Returns the list of paths the form builder searches for plugins.
+
+ \sa addPluginPath()
+*/
+QStringList QFormBuilder::pluginPaths() const
+{
+ return m_pluginPaths;
+}
+
+/*!
+ Clears the list of paths that the form builder uses to search for
+ custom widget plugins.
+
+ \sa pluginPaths()
+*/
+void QFormBuilder::clearPluginPaths()
+{
+ m_pluginPaths.clear();
+ updateCustomWidgets();
+}
+
+/*!
+ Adds a new plugin path specified by \a pluginPath to the list of
+ paths that will be searched by the form builder when loading a
+ custom widget plugin.
+
+ \sa setPluginPath(), clearPluginPaths()
+*/
+void QFormBuilder::addPluginPath(const QString &pluginPath)
+{
+ m_pluginPaths.append(pluginPath);
+ updateCustomWidgets();
+}
+
+/*!
+ Sets the list of plugin paths to the list specified by \a pluginPaths.
+
+ \sa addPluginPath()
+*/
+void QFormBuilder::setPluginPath(const QStringList &pluginPaths)
+{
+ m_pluginPaths = pluginPaths;
+ updateCustomWidgets();
+}
+
+static void insertPlugins(QObject *o, QMap<QString, QDesignerCustomWidgetInterface*> *customWidgets)
+{
+ // step 1) try with a normal plugin
+ if (QDesignerCustomWidgetInterface *iface = qobject_cast<QDesignerCustomWidgetInterface *>(o)) {
+ customWidgets->insert(iface->name(), iface);
+ return;
+ }
+ // step 2) try with a collection of plugins
+ if (QDesignerCustomWidgetCollectionInterface *c = qobject_cast<QDesignerCustomWidgetCollectionInterface *>(o)) {
+ foreach (QDesignerCustomWidgetInterface *iface, c->customWidgets())
+ customWidgets->insert(iface->name(), iface);
+ }
+}
+
+/*!
+ \internal
+*/
+void QFormBuilder::updateCustomWidgets()
+{
+ m_customWidgets.clear();
+
+ foreach (const QString &path, m_pluginPaths) {
+ const QDir dir(path);
+ const QStringList candidates = dir.entryList(QDir::Files);
+
+ foreach (const QString &plugin, candidates) {
+ if (!QLibrary::isLibrary(plugin))
+ continue;
+
+ QString loaderPath = path;
+ loaderPath += QLatin1Char('/');
+ loaderPath += plugin;
+
+ QPluginLoader loader(loaderPath);
+ if (loader.load())
+ insertPlugins(loader.instance(), &m_customWidgets);
+ }
+ }
+ // Check statically linked plugins
+ const QObjectList staticPlugins = QPluginLoader::staticInstances();
+ if (!staticPlugins.empty())
+ foreach (QObject *o, staticPlugins)
+ insertPlugins(o, &m_customWidgets);
+}
+
+/*!
+ \fn QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
+
+ Returns a list of the available plugins.
+*/
+QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
+{
+ return m_customWidgets.values();
+}
+
+/*!
+ \internal
+*/
+
+void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties)
+{
+ typedef QList<DomProperty*> DomPropertyList;
+
+ if (properties.empty())
+ return;
+
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+
+ const DomPropertyList::const_iterator cend = properties.constEnd();
+ for (DomPropertyList::const_iterator it = properties.constBegin(); it != cend; ++it) {
+ const QVariant v = toVariant(o->metaObject(), *it);
+ if (v.isNull())
+ continue;
+
+ const QString attributeName = (*it)->attributeName();
+ const bool isWidget = o->isWidgetType();
+ if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) {
+ // apply only the size part of a geometry for the root widget
+ static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size());
+ } else if (fb->applyPropertyInternally(o, attributeName, v)) {
+ } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
+ // ### special-casing for Line (QFrame) -- try to fix me
+ o->setProperty("frameShape", v); // v is of QFrame::Shape enum
+ } else {
+ o->setProperty(attributeName.toUtf8(), v);
+ }
+ }
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+} // namespace QFormInternal
+#endif
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/formbuilder.h b/tools/uilib/formbuilder.h
new file mode 100644
index 0000000000..01aeb16a09
--- /dev/null
+++ b/tools/uilib/formbuilder.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FORMBUILDER_H
+#define FORMBUILDER_H
+
+#include <QtDesigner/uilib_global.h>
+#include <QtDesigner/QAbstractFormBuilder>
+
+#include <QtCore/QStringList>
+#include <QtCore/QMap>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+#if 0
+// pragma for syncqt, don't remove.
+
+#pragma qt_class(QFormBuilder)
+#endif
+
+class QDesignerCustomWidgetInterface;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class QDESIGNER_UILIB_EXPORT QFormBuilder: public QAbstractFormBuilder
+{
+public:
+ QFormBuilder();
+ virtual ~QFormBuilder();
+
+ QStringList pluginPaths() const;
+
+ void clearPluginPaths();
+ void addPluginPath(const QString &pluginPath);
+ void setPluginPath(const QStringList &pluginPaths);
+
+ QList<QDesignerCustomWidgetInterface*> customWidgets() const;
+
+protected:
+ virtual QWidget *create(DomUI *ui, QWidget *parentWidget);
+ virtual QWidget *create(DomWidget *ui_widget, QWidget *parentWidget);
+ virtual QLayout *create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget);
+ virtual QLayoutItem *create(DomLayoutItem *ui_layoutItem, QLayout *layout, QWidget *parentWidget);
+ virtual QAction *create(DomAction *ui_action, QObject *parent);
+ virtual QActionGroup *create(DomActionGroup *ui_action_group, QObject *parent);
+
+ virtual QWidget *createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name);
+ virtual QLayout *createLayout(const QString &layoutName, QObject *parent, const QString &name);
+
+ virtual void createConnections(DomConnections *connections, QWidget *widget);
+
+ virtual bool addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout);
+ virtual bool addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget);
+
+ virtual void updateCustomWidgets();
+ virtual void applyProperties(QObject *o, const QList<DomProperty*> &properties);
+
+ static QWidget *widgetByName(QWidget *topLevel, const QString &name);
+
+private:
+ QStringList m_pluginPaths;
+ QMap<QString, QDesignerCustomWidgetInterface*> m_customWidgets;
+};
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // FORMBUILDER_H
diff --git a/tools/uilib/formbuilderextra.cpp b/tools/uilib/formbuilderextra.cpp
new file mode 100644
index 0000000000..ecc62886b9
--- /dev/null
+++ b/tools/uilib/formbuilderextra.cpp
@@ -0,0 +1,555 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "formbuilderextra_p.h"
+#include "abstractformbuilder.h"
+#include "resourcebuilder_p.h"
+#include "textbuilder_p.h"
+#include "ui4_p.h"
+
+#include <QtGui/QLabel>
+#include <QtGui/QBoxLayout>
+#include <QtGui/QGridLayout>
+
+#include <QtCore/QVariant>
+#include <QtCore/qdebug.h>
+#include <QtCore/QTextStream>
+#include <QtCore/QStringList>
+#include <QtCore/QCoreApplication>
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal {
+#endif
+
+void uiLibWarning(const QString &message) {
+ qWarning("Designer: %s", qPrintable(message));
+}
+
+
+QFormBuilderExtra::CustomWidgetData::CustomWidgetData() :
+ isContainer(false)
+{
+}
+
+QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw) :
+ addPageMethod(dcw->elementAddPageMethod()),
+ baseClass(dcw->elementExtends()),
+ isContainer(dcw->hasElementContainer() && dcw->elementContainer() != 0)
+{
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+ if (const DomScript *domScript = dcw->elementScript())
+ script = domScript->text();
+#endif
+}
+
+QFormBuilderExtra::QFormBuilderExtra() :
+ m_layoutWidget(false),
+ m_resourceBuilder(0),
+ m_textBuilder(0)
+{
+}
+
+QFormBuilderExtra::~QFormBuilderExtra()
+{
+ clearResourceBuilder();
+ clearTextBuilder();
+}
+
+void QFormBuilderExtra::clear()
+{
+ m_buddies.clear();
+ m_parentWidget = 0;
+ m_parentWidgetIsSet = false;
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+ m_FormScriptRunner.clearErrors();
+#endif
+ m_customWidgetDataHash.clear();
+ m_buttonGroups.clear();
+}
+
+
+bool QFormBuilderExtra::applyPropertyInternally(QObject *o, const QString &propertyName, const QVariant &value)
+{
+ // Store buddies and apply them later on as the widgets might not exist yet.
+ QLabel *label = qobject_cast<QLabel*>(o);
+ if (!label || propertyName != QFormBuilderStrings::instance().buddyProperty)
+ return false;
+
+ m_buddies.insert(label, value.toString());
+ return true;
+}
+
+void QFormBuilderExtra::applyInternalProperties() const
+{
+ if (m_buddies.empty())
+ return;
+
+ const BuddyHash::const_iterator cend = m_buddies.constEnd();
+ for (BuddyHash::const_iterator it = m_buddies.constBegin(); it != cend; ++it )
+ applyBuddy(it.value(), BuddyApplyAll, it.key());
+}
+
+bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label)
+{
+ if (buddyName.isEmpty()) {
+ label->setBuddy(0);
+ return false;
+ }
+
+ const QWidgetList widgets = label->topLevelWidget()->findChildren<QWidget*>(buddyName);
+ if (widgets.empty()) {
+ label->setBuddy(0);
+ return false;
+ }
+
+ const QWidgetList::const_iterator cend = widgets.constEnd();
+ for ( QWidgetList::const_iterator it = widgets.constBegin(); it != cend; ++it) {
+ if (applyMode == BuddyApplyAll || !(*it)->isHidden()) {
+ label->setBuddy(*it);
+ return true;
+ }
+ }
+
+ label->setBuddy(0);
+ return false;
+}
+
+const QPointer<QWidget> &QFormBuilderExtra::parentWidget() const
+{
+ return m_parentWidget;
+}
+
+bool QFormBuilderExtra::parentWidgetIsSet() const
+{
+ return m_parentWidgetIsSet;
+}
+
+void QFormBuilderExtra::setParentWidget(const QPointer<QWidget> &w)
+{
+ // Parent widget requires special handling of the geometry property.
+ m_parentWidget = w;
+ m_parentWidgetIsSet = true;
+}
+
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+QFormScriptRunner &QFormBuilderExtra::formScriptRunner()
+{
+ return m_FormScriptRunner;
+}
+
+QString QFormBuilderExtra::customWidgetScript(const QString &className) const
+{
+ const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ if (it != m_customWidgetDataHash.constEnd())
+ return it.value().script;
+ return QString();
+}
+
+#endif
+
+void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const DomCustomWidget *d)
+{
+ if (d)
+ m_customWidgetDataHash.insert(className, CustomWidgetData(d));
+}
+
+QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const
+{
+ const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ if (it != m_customWidgetDataHash.constEnd())
+ return it.value().baseClass;
+ return QString();
+}
+
+QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const
+{
+ const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ if (it != m_customWidgetDataHash.constEnd())
+ return it.value().addPageMethod;
+ return QString();
+}
+
+bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const
+{
+ const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ if (it != m_customWidgetDataHash.constEnd())
+ return it.value().isContainer;
+ return false;
+}
+
+namespace {
+ typedef QHash<const QAbstractFormBuilder *, QFormBuilderExtra *> FormBuilderPrivateHash;
+}
+
+Q_GLOBAL_STATIC(FormBuilderPrivateHash, g_FormBuilderPrivateHash)
+
+QFormBuilderExtra *QFormBuilderExtra::instance(const QAbstractFormBuilder *afb)
+{
+ FormBuilderPrivateHash &fbHash = *g_FormBuilderPrivateHash();
+
+ FormBuilderPrivateHash::iterator it = fbHash.find(afb);
+ if (it == fbHash.end())
+ it = fbHash.insert(afb, new QFormBuilderExtra);
+ return it.value();
+}
+
+void QFormBuilderExtra::removeInstance(const QAbstractFormBuilder *afb)
+{
+ FormBuilderPrivateHash &fbHash = *g_FormBuilderPrivateHash();
+
+ FormBuilderPrivateHash::iterator it = fbHash.find(afb);
+ if (it != fbHash.end()) {
+ delete it.value();
+ fbHash.erase(it);
+ }
+}
+
+void QFormBuilderExtra::setProcessingLayoutWidget(bool processing)
+{
+ m_layoutWidget = processing;
+}
+
+ bool QFormBuilderExtra::processingLayoutWidget() const
+{
+ return m_layoutWidget;
+}
+void QFormBuilderExtra::setResourceBuilder(QResourceBuilder *builder)
+{
+ if (m_resourceBuilder == builder)
+ return;
+ clearResourceBuilder();
+ m_resourceBuilder = builder;
+}
+
+QResourceBuilder *QFormBuilderExtra::resourceBuilder() const
+{
+ return m_resourceBuilder;
+}
+
+void QFormBuilderExtra::clearResourceBuilder()
+{
+ if (m_resourceBuilder) {
+ delete m_resourceBuilder;
+ m_resourceBuilder = 0;
+ }
+}
+
+void QFormBuilderExtra::setTextBuilder(QTextBuilder *builder)
+{
+ if (m_textBuilder == builder)
+ return;
+ clearTextBuilder();
+ m_textBuilder = builder;
+}
+
+QTextBuilder *QFormBuilderExtra::textBuilder() const
+{
+ return m_textBuilder;
+}
+
+void QFormBuilderExtra::clearTextBuilder()
+{
+ if (m_textBuilder) {
+ delete m_textBuilder;
+ m_textBuilder = 0;
+ }
+}
+
+void QFormBuilderExtra::registerButtonGroups(const DomButtonGroups *domGroups)
+{
+ typedef QList<DomButtonGroup*> DomButtonGroupList;
+ const DomButtonGroupList domGroupList = domGroups->elementButtonGroup();
+ const DomButtonGroupList::const_iterator cend = domGroupList.constEnd();
+ for (DomButtonGroupList::const_iterator it = domGroupList.constBegin(); it != cend; ++it) {
+ DomButtonGroup *domGroup = *it;
+ m_buttonGroups.insert(domGroup->attributeName(), ButtonGroupEntry(domGroup, 0));
+ }
+}
+
+// Utilities for parsing per-cell integer properties that have setters and
+// getters of the form 'setX(int idx, int value)' and 'x(int index)'
+// (converting them to comma-separated string lists and back).
+// Used for layout stretch and grid per-row/column properties.
+
+// Format a list of cell-properties of one dimension as a ','-separated list
+template <class Layout>
+inline QString perCellPropertyToString(const Layout *l, int count, int (Layout::*getter)(int) const)
+{
+ if (count == 0)
+ return QString();
+ QString rc;
+ {
+ QTextStream str(&rc);
+ for (int i = 0; i < count; i++) {
+ if (i)
+ str << QLatin1Char(',');
+ str << (l->*getter)(i);
+ }
+ }
+ return rc;
+}
+
+// Clear the property, set all cells to 0
+
+template <class Layout>
+inline void clearPerCellValue(Layout *l, int count, void (Layout::*setter)(int,int), int value = 0)
+{
+ for (int i = 0; i < count; i++)
+ (l->*setter)(i, value);
+}
+
+// Parse and set the property from a comma-separated list
+
+template <class Layout>
+inline bool parsePerCellProperty(Layout *l, int count, void (Layout::*setter)(int,int), const QString &s, int defaultValue = 0)
+{
+ if (s.isEmpty()) {
+ clearPerCellValue(l, count, setter, defaultValue);
+ return true;
+ }
+ const QStringList list = s.split(QLatin1Char(','));
+ if (list.empty()) {
+ clearPerCellValue(l, count, setter, defaultValue);
+ return true;
+ }
+ // Apply all values contained in list
+ const int ac = qMin(count, list.size());
+ bool ok;
+ int i = 0;
+ for ( ; i < ac; i++) {
+ const int value = list.at(i).toInt(&ok);
+ if (!ok || value < 0)
+ return false;
+ (l->*setter)(i, value);
+ }
+ // Clear rest
+ for ( ; i < count; i++)
+ (l->*setter)(i, defaultValue);
+ return true;
+}
+
+// Read and write stretch
+static QString msgInvalidStretch(const QString &objectName, const QString &stretch)
+{
+ //: Parsing layout stretch values
+ return QCoreApplication::translate("FormBuilder", "Invalid stretch value for '%1': '%2'").arg(objectName, stretch);
+}
+
+QString QFormBuilderExtra::boxLayoutStretch(const QBoxLayout *box)
+{
+ return perCellPropertyToString(box, box->count(), &QBoxLayout::stretch);
+}
+
+bool QFormBuilderExtra::setBoxLayoutStretch(const QString &s, QBoxLayout *box)
+{
+ const bool rc = parsePerCellProperty(box, box->count(), &QBoxLayout::setStretch, s);
+ if (!rc)
+ uiLibWarning(msgInvalidStretch(box->objectName(), s));
+ return rc;
+}
+
+void QFormBuilderExtra::clearBoxLayoutStretch(QBoxLayout *box)
+{
+ clearPerCellValue(box, box->count(), &QBoxLayout::setStretch);
+}
+
+QString QFormBuilderExtra::gridLayoutRowStretch(const QGridLayout *grid)
+{
+ return perCellPropertyToString(grid, grid->rowCount(), &QGridLayout::rowStretch);
+}
+
+bool QFormBuilderExtra::setGridLayoutRowStretch(const QString &s, QGridLayout *grid)
+{
+ const bool rc = parsePerCellProperty(grid, grid->rowCount(), &QGridLayout::setRowStretch, s);
+ if (!rc)
+ uiLibWarning(msgInvalidStretch(grid->objectName(), s));
+ return rc;
+}
+
+void QFormBuilderExtra::clearGridLayoutRowStretch(QGridLayout *grid)
+{
+ clearPerCellValue(grid, grid->rowCount(), &QGridLayout::setRowStretch);
+}
+
+QString QFormBuilderExtra::gridLayoutColumnStretch(const QGridLayout *grid)
+{
+ return perCellPropertyToString(grid, grid->columnCount(), &QGridLayout::columnStretch);
+}
+
+bool QFormBuilderExtra::setGridLayoutColumnStretch(const QString &s, QGridLayout *grid)
+{
+ const bool rc = parsePerCellProperty(grid, grid->columnCount(), &QGridLayout::setColumnStretch, s);
+ if (!rc)
+ uiLibWarning(msgInvalidStretch(grid->objectName(), s));
+ return rc;
+}
+
+void QFormBuilderExtra::clearGridLayoutColumnStretch(QGridLayout *grid)
+{
+ clearPerCellValue(grid, grid->columnCount(), &QGridLayout::setColumnStretch);
+}
+
+// Read and write grid layout row/column size limits
+
+static QString msgInvalidMinimumSize(const QString &objectName, const QString &ms)
+{
+ //: Parsing grid layout minimum size values
+ return QCoreApplication::translate("FormBuilder", "Invalid minimum size for '%1': '%2'").arg(objectName, ms);
+}
+
+QString QFormBuilderExtra::gridLayoutRowMinimumHeight(const QGridLayout *grid)
+{
+ return perCellPropertyToString(grid, grid->rowCount(), &QGridLayout::rowMinimumHeight);
+}
+
+bool QFormBuilderExtra::setGridLayoutRowMinimumHeight(const QString &s, QGridLayout *grid)
+{
+ const bool rc = parsePerCellProperty(grid, grid->rowCount(), &QGridLayout::setRowMinimumHeight, s);
+ if (!rc)
+ uiLibWarning(msgInvalidMinimumSize(grid->objectName(), s));
+ return rc;
+}
+
+void QFormBuilderExtra::clearGridLayoutRowMinimumHeight(QGridLayout *grid)
+{
+ clearPerCellValue(grid, grid->rowCount(), &QGridLayout::setRowMinimumHeight);
+}
+
+QString QFormBuilderExtra::gridLayoutColumnMinimumWidth(const QGridLayout *grid)
+{
+ return perCellPropertyToString(grid, grid->columnCount(), &QGridLayout::columnMinimumWidth);
+}
+
+bool QFormBuilderExtra::setGridLayoutColumnMinimumWidth(const QString &s, QGridLayout *grid)
+{
+ const bool rc = parsePerCellProperty(grid, grid->columnCount(), &QGridLayout::setColumnMinimumWidth, s);
+ if (!rc)
+ uiLibWarning(msgInvalidMinimumSize(grid->objectName(), s));
+ return rc;
+}
+
+void QFormBuilderExtra::clearGridLayoutColumnMinimumWidth(QGridLayout *grid)
+{
+ clearPerCellValue(grid, grid->columnCount(), &QGridLayout::setColumnMinimumWidth);
+}
+
+// ------------ QFormBuilderStrings
+
+QFormBuilderStrings::QFormBuilderStrings() :
+ buddyProperty(QLatin1String("buddy")),
+ cursorProperty(QLatin1String("cursor")),
+ objectNameProperty(QLatin1String("objectName")),
+ trueValue(QLatin1String("true")),
+ falseValue(QLatin1String("false")),
+ horizontalPostFix(QLatin1String("Horizontal")),
+ separator(QLatin1String("separator")),
+ defaultTitle(QLatin1String("Page")),
+ titleAttribute(QLatin1String("title")),
+ labelAttribute(QLatin1String("label")),
+ toolTipAttribute(QLatin1String("toolTip")),
+ whatsThisAttribute(QLatin1String("whatsThis")),
+ flagsAttribute(QLatin1String("flags")),
+ iconAttribute(QLatin1String("icon")),
+ pixmapAttribute(QLatin1String("pixmap")),
+ textAttribute(QLatin1String("text")),
+ currentIndexProperty(QLatin1String("currentIndex")),
+ toolBarAreaAttribute(QLatin1String("toolBarArea")),
+ toolBarBreakAttribute(QLatin1String("toolBarBreak")),
+ dockWidgetAreaAttribute(QLatin1String("dockWidgetArea")),
+ marginProperty(QLatin1String("margin")),
+ spacingProperty(QLatin1String("spacing")),
+ leftMarginProperty(QLatin1String("leftMargin")),
+ topMarginProperty(QLatin1String("topMargin")),
+ rightMarginProperty(QLatin1String("rightMargin")),
+ bottomMarginProperty(QLatin1String("bottomMargin")),
+ horizontalSpacingProperty(QLatin1String("horizontalSpacing")),
+ verticalSpacingProperty(QLatin1String("verticalSpacing")),
+ sizeHintProperty(QLatin1String("sizeHint")),
+ sizeTypeProperty(QLatin1String("sizeType")),
+ orientationProperty(QLatin1String("orientation")),
+ styleSheetProperty(QLatin1String("styleSheet")),
+ qtHorizontal(QLatin1String("Qt::Horizontal")),
+ qtVertical(QLatin1String("Qt::Vertical")),
+ currentRowProperty(QLatin1String("currentRow")),
+ tabSpacingProperty(QLatin1String("tabSpacing")),
+ qWidgetClass(QLatin1String("QWidget")),
+ lineClass(QLatin1String("Line")),
+ geometryProperty(QLatin1String("geometry")),
+ scriptWidgetVariable(QLatin1String("widget")),
+ scriptChildWidgetsVariable(QLatin1String("childWidgets"))
+{
+ itemRoles.append(qMakePair(Qt::FontRole, QString::fromLatin1("font")));
+ itemRoles.append(qMakePair(Qt::TextAlignmentRole, QString::fromLatin1("textAlignment")));
+ itemRoles.append(qMakePair(Qt::BackgroundRole, QString::fromLatin1("background")));
+ itemRoles.append(qMakePair(Qt::ForegroundRole, QString::fromLatin1("foreground")));
+ itemRoles.append(qMakePair(Qt::CheckStateRole, QString::fromLatin1("checkState")));
+
+ foreach (const RoleNName &it, itemRoles)
+ treeItemRoleHash.insert(it.second, it.first);
+
+ itemTextRoles.append(qMakePair(qMakePair(Qt::EditRole, Qt::DisplayPropertyRole),
+ textAttribute)); // This must be first for the loop below
+ itemTextRoles.append(qMakePair(qMakePair(Qt::ToolTipRole, Qt::ToolTipPropertyRole),
+ toolTipAttribute));
+ itemTextRoles.append(qMakePair(qMakePair(Qt::StatusTipRole, Qt::StatusTipPropertyRole),
+ QString::fromLatin1("statusTip")));
+ itemTextRoles.append(qMakePair(qMakePair(Qt::WhatsThisRole, Qt::WhatsThisPropertyRole),
+ whatsThisAttribute));
+
+ // Note: this skips the first item!
+ QList<TextRoleNName>::const_iterator it = itemTextRoles.constBegin(), end = itemTextRoles.constEnd();
+ while (++it != end)
+ treeItemTextRoleHash.insert(it->second, it->first);
+}
+
+const QFormBuilderStrings &QFormBuilderStrings::instance()
+{
+ static const QFormBuilderStrings rc;
+ return rc;
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+} // namespace QFormInternal
+#endif
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/formbuilderextra_p.h b/tools/uilib/formbuilderextra_p.h
new file mode 100644
index 0000000000..cac882b8d8
--- /dev/null
+++ b/tools/uilib/formbuilderextra_p.h
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ABSTRACTFORMBUILDERPRIVATE_H
+#define ABSTRACTFORMBUILDERPRIVATE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "uilib_global.h"
+
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+# include "formscriptrunner_p.h"
+#endif
+
+#include <QtCore/QHash>
+#include <QtCore/QPointer>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+class QObject;
+class QVariant;
+class QWidget;
+class QObject;
+class QLabel;
+class QButtonGroup;
+
+class QBoxLayout;
+class QGridLayout;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class DomButtonGroups;
+class DomButtonGroup;
+class DomCustomWidget;
+
+class QAbstractFormBuilder;
+class QResourceBuilder;
+class QTextBuilder;
+
+class QDESIGNER_UILIB_EXPORT QFormBuilderExtra
+{
+ QFormBuilderExtra();
+ ~QFormBuilderExtra();
+public:
+ struct CustomWidgetData {
+ CustomWidgetData();
+ explicit CustomWidgetData(const DomCustomWidget *dc);
+
+ QString addPageMethod;
+ QString script;
+ QString baseClass;
+ bool isContainer;
+ };
+
+ void clear();
+
+ bool applyPropertyInternally(QObject *o, const QString &propertyName, const QVariant &value);
+
+ enum BuddyMode { BuddyApplyAll, BuddyApplyVisibleOnly };
+
+ void applyInternalProperties() const;
+ static bool applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label);
+
+ const QPointer<QWidget> &parentWidget() const;
+ bool parentWidgetIsSet() const;
+ void setParentWidget(const QPointer<QWidget> &w);
+
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+ QFormScriptRunner &formScriptRunner();
+ QString customWidgetScript(const QString &className) const;
+#endif
+
+ void setProcessingLayoutWidget(bool processing);
+ bool processingLayoutWidget() const;
+
+ void setResourceBuilder(QResourceBuilder *builder);
+ QResourceBuilder *resourceBuilder() const;
+
+ void setTextBuilder(QTextBuilder *builder);
+ QTextBuilder *textBuilder() const;
+
+ static QFormBuilderExtra *instance(const QAbstractFormBuilder *afb);
+ static void removeInstance(const QAbstractFormBuilder *afb);
+
+ void storeCustomWidgetData(const QString &className, const DomCustomWidget *d);
+ QString customWidgetAddPageMethod(const QString &className) const;
+ QString customWidgetBaseClass(const QString &className) const;
+ bool isCustomWidgetContainer(const QString &className) const;
+
+ // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group
+ void registerButtonGroups(const DomButtonGroups *groups);
+
+ typedef QPair<DomButtonGroup *, QButtonGroup*> ButtonGroupEntry;
+ typedef QHash<QString, ButtonGroupEntry> ButtonGroupHash;
+ const ButtonGroupHash &buttonGroups() const { return m_buttonGroups; }
+ ButtonGroupHash &buttonGroups() { return m_buttonGroups; }
+
+ // return stretch as a comma-separated list
+ static QString boxLayoutStretch(const QBoxLayout*);
+ // apply stretch
+ static bool setBoxLayoutStretch(const QString &, QBoxLayout*);
+ static void clearBoxLayoutStretch(QBoxLayout*);
+
+ static QString gridLayoutRowStretch(const QGridLayout *);
+ static bool setGridLayoutRowStretch(const QString &, QGridLayout *);
+ static void clearGridLayoutRowStretch(QGridLayout *);
+
+ static QString gridLayoutColumnStretch(const QGridLayout *);
+ static bool setGridLayoutColumnStretch(const QString &, QGridLayout *);
+ static void clearGridLayoutColumnStretch(QGridLayout *);
+
+ // return the row/column sizes as comma-separated lists
+ static QString gridLayoutRowMinimumHeight(const QGridLayout *);
+ static bool setGridLayoutRowMinimumHeight(const QString &, QGridLayout *);
+ static void clearGridLayoutRowMinimumHeight(QGridLayout *);
+
+ static QString gridLayoutColumnMinimumWidth(const QGridLayout *);
+ static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *);
+ static void clearGridLayoutColumnMinimumWidth(QGridLayout *);
+
+private:
+ void clearResourceBuilder();
+ void clearTextBuilder();
+
+ typedef QHash<QLabel*, QString> BuddyHash;
+ BuddyHash m_buddies;
+
+#ifndef QT_FORMBUILDER_NO_SCRIPT
+ QFormScriptRunner m_FormScriptRunner;
+#endif
+
+ QHash<QString, CustomWidgetData> m_customWidgetDataHash;
+
+ ButtonGroupHash m_buttonGroups;
+
+ bool m_layoutWidget;
+ QResourceBuilder *m_resourceBuilder;
+ QTextBuilder *m_textBuilder;
+
+ QPointer<QWidget> m_parentWidget;
+ bool m_parentWidgetIsSet;
+};
+
+void uiLibWarning(const QString &message);
+
+// Struct with static accessor that provides most strings used in the form builder.
+struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings {
+ QFormBuilderStrings();
+
+ static const QFormBuilderStrings &instance();
+
+ const QString buddyProperty;
+ const QString cursorProperty;
+ const QString objectNameProperty;
+ const QString trueValue;
+ const QString falseValue;
+ const QString horizontalPostFix;
+ const QString separator;
+ const QString defaultTitle;
+ const QString titleAttribute;
+ const QString labelAttribute;
+ const QString toolTipAttribute;
+ const QString whatsThisAttribute;
+ const QString flagsAttribute;
+ const QString iconAttribute;
+ const QString pixmapAttribute;
+ const QString textAttribute;
+ const QString currentIndexProperty;
+ const QString toolBarAreaAttribute;
+ const QString toolBarBreakAttribute;
+ const QString dockWidgetAreaAttribute;
+ const QString marginProperty;
+ const QString spacingProperty;
+ const QString leftMarginProperty;
+ const QString topMarginProperty;
+ const QString rightMarginProperty;
+ const QString bottomMarginProperty;
+ const QString horizontalSpacingProperty;
+ const QString verticalSpacingProperty;
+ const QString sizeHintProperty;
+ const QString sizeTypeProperty;
+ const QString orientationProperty;
+ const QString styleSheetProperty;
+ const QString qtHorizontal;
+ const QString qtVertical;
+ const QString currentRowProperty;
+ const QString tabSpacingProperty;
+ const QString qWidgetClass;
+ const QString lineClass;
+ const QString geometryProperty;
+ const QString scriptWidgetVariable;
+ const QString scriptChildWidgetsVariable;
+
+ typedef QPair<Qt::ItemDataRole, QString> RoleNName;
+ QList<RoleNName> itemRoles;
+ QHash<QString, Qt::ItemDataRole> treeItemRoleHash;
+
+ // first.first is primary role, first.second is shadow role.
+ // Shadow is used for either the translation source or the designer
+ // representation of the string value.
+ typedef QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString> TextRoleNName;
+ QList<TextRoleNName> itemTextRoles;
+ QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
+};
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+#endif // ABSTRACTFORMBUILDERPRIVATE_H
diff --git a/tools/uilib/formscriptrunner.cpp b/tools/uilib/formscriptrunner.cpp
new file mode 100644
index 0000000000..e349f6b318
--- /dev/null
+++ b/tools/uilib/formscriptrunner.cpp
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "formscriptrunner_p.h"
+#include "formbuilderextra_p.h"
+#include "ui4_p.h"
+
+#include <QtScript/QScriptEngine>
+#include <QtGui/QWidget>
+#include <QtCore/QDebug>
+#include <QtCore/QCoreApplication>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+ enum { debugFormScriptRunner = 0 };
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal {
+#endif
+
+class QFormScriptRunner::QFormScriptRunnerPrivate {
+public:
+ QFormScriptRunnerPrivate() : m_options(DisableScripts) {}
+ void clearErrors() { m_errors.clear(); }
+
+ bool run(const QString &script, QWidget *widget, const WidgetList &children, QString *errorMessage);
+
+ static void initializeEngine(QWidget *w, const WidgetList &children, QScriptEngine &scriptEngine);
+ static QString engineError(QScriptEngine &scriptEngine);
+
+ Options options() const { return m_options; }
+ void setOptions(Options options) { m_options = options; }
+
+ Errors errors() const { return m_errors; }
+private:
+ QScriptEngine m_scriptEngine;
+ Options m_options;
+ Errors m_errors;
+};
+
+bool QFormScriptRunner::QFormScriptRunnerPrivate::run(const QString &script, QWidget *widget, const WidgetList &children, QString *errorMessage) {
+ bool rc = false;
+ initializeEngine(widget, children, m_scriptEngine);
+
+ do {
+ m_scriptEngine.evaluate(script);
+ if (m_scriptEngine.hasUncaughtException ()) {
+ *errorMessage = QCoreApplication::tr("Exception at line %1: %2").arg(m_scriptEngine.uncaughtExceptionLineNumber()).arg(engineError(m_scriptEngine));
+ break;
+ }
+ rc = true;
+ } while (false);
+ m_scriptEngine.popContext();
+
+ if (!rc) {
+ Error error;
+ error.objectName = widget->objectName();
+ error.script = script;
+ error.errorMessage = *errorMessage;
+ m_errors.push_back(error);
+ }
+ return rc;
+}
+
+void QFormScriptRunner::QFormScriptRunnerPrivate::initializeEngine(QWidget *w, const WidgetList &children, QScriptEngine &scriptEngine) {
+ // Populate the script variables. This pushes a context which must be popped.
+ QScriptContext *ctx = scriptEngine.pushContext();
+ QScriptValue widgetObject = scriptEngine.newQObject(w);
+ QScriptValue childrenArray = scriptEngine.newArray (children.size());
+
+ for(int i = 0; i < children.size(); i++) {
+ childrenArray.setProperty(i, scriptEngine.newQObject(children[i]));
+ }
+
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ ctx ->activationObject().setProperty(strings.scriptWidgetVariable, widgetObject);
+ ctx ->activationObject().setProperty(strings.scriptChildWidgetsVariable, childrenArray);
+}
+
+QString QFormScriptRunner::QFormScriptRunnerPrivate::engineError(QScriptEngine &scriptEngine) {
+ QScriptValue error = scriptEngine.evaluate(QLatin1String("Error"));
+ if (error.isValid())
+ return error.toString();
+ return QCoreApplication::tr("Unknown error");
+}
+// -- QFormScriptRunner
+
+QFormScriptRunner::QFormScriptRunner() : m_impl(new QFormScriptRunnerPrivate)
+{
+}
+
+QFormScriptRunner::~QFormScriptRunner()
+{
+ delete m_impl;
+}
+
+bool QFormScriptRunner::run(const DomWidget *domWidget,
+ const QString &customWidgetScript,
+ QWidget *widget, const WidgetList &children,
+ QString *errorMessage)
+{
+ typedef QList<DomScript*> DomScripts;
+
+ const Options scriptOptions = m_impl->options();
+ if (scriptOptions & DisableScripts)
+ return true;
+ // get list
+ const DomScripts domScripts = domWidget->elementScript();
+ // Concatenate snippets, starting with custom widget script
+ QString script = customWidgetScript;
+ if (script.isEmpty() && domScripts.empty())
+ return true;
+
+ foreach (const DomScript *scriptSnippet, domScripts) {
+ // Ensure new line
+ if (!script.isEmpty() && !script.endsWith(QLatin1Char('\n')))
+ script += QLatin1Char('\n');
+ script += scriptSnippet->text();
+ }
+
+ if (script.isEmpty())
+ return true;
+
+ const bool rc = m_impl->run(script, widget, children, errorMessage);
+
+ if (debugFormScriptRunner) {
+ qDebug() << "For " << widget << " with " << children.size() << " children, ran: " << script;
+ if (!rc)
+ qDebug() << *errorMessage;
+ }
+
+ if (!rc) {
+ if (!(scriptOptions & DisableWarnings)) {
+ const QString message = QCoreApplication::tr("An error occurred while running the script for %1: %2\nScript: %3").
+ arg(widget->objectName()).arg(*errorMessage).arg(script);
+ qWarning() << message;
+ }
+ }
+ return rc;
+}
+
+QFormScriptRunner::Options QFormScriptRunner::options() const
+{
+ return m_impl->options();
+}
+
+void QFormScriptRunner::setOptions(Options options)
+{
+ m_impl->setOptions(options);
+}
+
+
+QFormScriptRunner::Errors QFormScriptRunner::errors() const
+{
+ return m_impl->errors();
+}
+
+void QFormScriptRunner::clearErrors()
+{
+ m_impl->clearErrors();
+}
+
+
+#ifdef QFORMINTERNAL_NAMESPACE
+} // namespace QFormInternal
+#endif
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/formscriptrunner_p.h b/tools/uilib/formscriptrunner_p.h
new file mode 100644
index 0000000000..117b4e88ee
--- /dev/null
+++ b/tools/uilib/formscriptrunner_p.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FORMSCRIPTRUNNER_H
+#define FORMSCRIPTRUNNER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtDesigner/uilib_global.h>
+#include <QtCore/QList>
+#include <QtCore/QFlags>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+class QWidget;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class DomWidget;
+
+class QDESIGNER_UILIB_EXPORT QFormScriptRunner
+{
+public:
+ QFormScriptRunner();
+ ~QFormScriptRunner();
+
+ typedef QList<QWidget*> WidgetList;
+
+ bool run(const DomWidget *domWidget,
+ const QString &customWidgetScript,
+ QWidget *widget, const WidgetList &children,
+ QString *errorMessage);
+
+ struct Error {
+ QString objectName;
+ QString script;
+ QString errorMessage;
+ };
+ typedef QList<Error> Errors;
+ Errors errors() const;
+ void clearErrors();
+
+ enum Option {
+ NoOptions = 0x0,
+ DisableWarnings = 0x1,
+ DisableScripts = 02
+ };
+ Q_DECLARE_FLAGS(Options, Option)
+
+ Options options() const;
+ void setOptions(Options options);
+
+private:
+ class QFormScriptRunnerPrivate;
+ QFormScriptRunnerPrivate *m_impl;
+
+ QFormScriptRunner(const QFormScriptRunner &);
+ void operator = (const QFormScriptRunner &);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QFormScriptRunner::Options)
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+#endif // FORMSCRIPTRUNNER_H
diff --git a/tools/uilib/properties.cpp b/tools/uilib/properties.cpp
new file mode 100644
index 0000000000..67f4d11d22
--- /dev/null
+++ b/tools/uilib/properties.cpp
@@ -0,0 +1,681 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "properties_p.h"
+#include "ui4_p.h"
+#include "abstractformbuilder.h"
+#include "formbuilderextra_p.h"
+#include "resourcebuilder_p.h"
+
+#include <QtCore/QDateTime>
+#include <QtCore/QUrl>
+#include <QtCore/qdebug.h>
+
+#include <QtGui/QIcon>
+#include <QtGui/QPixmap>
+#include <QtGui/QFont>
+#include <QtGui/QFrame>
+#include <QtGui/QAbstractScrollArea>
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+static inline void fixEnum(QString &s)
+{
+ int qualifierIndex = s.lastIndexOf(QLatin1Char(':'));
+ if (qualifierIndex == -1)
+ qualifierIndex = s.lastIndexOf(QLatin1Char('.'));
+ if (qualifierIndex != -1)
+ s.remove(0, qualifierIndex + 1);
+}
+// Convert complex DOM types with the help of QAbstractFormBuilder
+QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,const DomProperty *p)
+{
+ // Complex types that need functions from QAbstractFormBuilder
+ switch(p->kind()) {
+ case DomProperty::String: {
+ const int index = meta->indexOfProperty(p->attributeName().toUtf8());
+ if (index != -1 && meta->property(index).type() == QVariant::KeySequence)
+ return QVariant::fromValue(QKeySequence(p->elementString()->text()));
+ }
+ break;
+
+ case DomProperty::Palette: {
+ const DomPalette *dom = p->elementPalette();
+ QPalette palette;
+
+ if (dom->elementActive())
+ afb->setupColorGroup(palette, QPalette::Active, dom->elementActive());
+
+ if (dom->elementInactive())
+ afb->setupColorGroup(palette, QPalette::Inactive, dom->elementInactive());
+
+ if (dom->elementDisabled())
+ afb->setupColorGroup(palette, QPalette::Disabled, dom->elementDisabled());
+
+ palette.setCurrentColorGroup(QPalette::Active);
+ return QVariant::fromValue(palette);
+ }
+
+ case DomProperty::Set: {
+ const QByteArray pname = p->attributeName().toUtf8();
+ const int index = meta->indexOfProperty(pname);
+ if (index == -1) {
+ uiLibWarning(QCoreApplication::translate("QFormBuilder", "The set-type property %1 could not be read.").arg(p->attributeName()));
+ return QVariant();
+ }
+
+ const QMetaEnum e = meta->property(index).enumerator();
+ Q_ASSERT(e.isFlag() == true);
+ return QVariant(e.keysToValue(p->elementSet().toUtf8()));
+ }
+
+ case DomProperty::Enum: {
+ const QByteArray pname = p->attributeName().toUtf8();
+ const int index = meta->indexOfProperty(pname);
+ QString enumValue = p->elementEnum();
+ // Triggers in case of objects in Designer like Spacer/Line for which properties
+ // are serialized using language introspection. On preview, however, these objects are
+ // emulated by hacks in the formbuilder (size policy/orientation)
+ fixEnum(enumValue);
+ if (index == -1) {
+ // ### special-casing for Line (QFrame) -- fix for 4.2. Jambi hack for enumerations
+ if (!qstrcmp(meta->className(), "QFrame")
+ && (pname == QByteArray("orientation"))) {
+ return QVariant(enumValue == QFormBuilderStrings::instance().horizontalPostFix ? QFrame::HLine : QFrame::VLine);
+ } else {
+ uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-type property %1 could not be read.").arg(p->attributeName()));
+ return QVariant();
+ }
+ }
+
+ const QMetaEnum e = meta->property(index).enumerator();
+ return QVariant(e.keyToValue(enumValue.toUtf8()));
+ }
+ case DomProperty::Brush:
+ return QVariant::fromValue(afb->setupBrush(p->elementBrush()));
+ default:
+ if (afb->resourceBuilder()->isResourceProperty(p)) {
+ return afb->resourceBuilder()->loadResource(afb->workingDirectory(), p);
+ }
+
+ break;
+ }
+
+ // simple type
+ return domPropertyToVariant(p);
+}
+
+// Convert simple DOM types
+QVariant domPropertyToVariant(const DomProperty *p)
+{
+ // requires non-const virtual nameToIcon, etc.
+ switch(p->kind()) {
+ case DomProperty::Bool:
+ return QVariant(p->elementBool() == QFormBuilderStrings::instance().trueValue);
+
+ case DomProperty::Cstring:
+ return QVariant(p->elementCstring().toUtf8());
+
+ case DomProperty::Point: {
+ const DomPoint *point = p->elementPoint();
+ return QVariant(QPoint(point->elementX(), point->elementY()));
+ }
+
+ case DomProperty::PointF: {
+ const DomPointF *pointf = p->elementPointF();
+ return QVariant(QPointF(pointf->elementX(), pointf->elementY()));
+ }
+
+ case DomProperty::Size: {
+ const DomSize *size = p->elementSize();
+ return QVariant(QSize(size->elementWidth(), size->elementHeight()));
+ }
+
+ case DomProperty::SizeF: {
+ const DomSizeF *sizef = p->elementSizeF();
+ return QVariant(QSizeF(sizef->elementWidth(), sizef->elementHeight()));
+ }
+
+ case DomProperty::Rect: {
+ const DomRect *rc = p->elementRect();
+ const QRect g(rc->elementX(), rc->elementY(), rc->elementWidth(), rc->elementHeight());
+ return QVariant(g);
+ }
+
+ case DomProperty::RectF: {
+ const DomRectF *rcf = p->elementRectF();
+ const QRectF g(rcf->elementX(), rcf->elementY(), rcf->elementWidth(), rcf->elementHeight());
+ return QVariant(g);
+ }
+
+ case DomProperty::String:
+ return QVariant(p->elementString()->text());
+
+ case DomProperty::Number:
+ return QVariant(p->elementNumber());
+
+ case DomProperty::UInt:
+ return QVariant(p->elementUInt());
+
+ case DomProperty::LongLong:
+ return QVariant(p->elementLongLong());
+
+ case DomProperty::ULongLong:
+ return QVariant(p->elementULongLong());
+
+ case DomProperty::Double:
+ return QVariant(p->elementDouble());
+
+ case DomProperty::Char: {
+ const DomChar *character = p->elementChar();
+ const QChar c(character->elementUnicode());
+ return QVariant::fromValue(c);
+ }
+
+ case DomProperty::Color: {
+ const DomColor *color = p->elementColor();
+ QColor c(color->elementRed(), color->elementGreen(), color->elementBlue());
+ if (color->hasAttributeAlpha())
+ c.setAlpha(color->attributeAlpha());
+ return QVariant::fromValue(c);
+ }
+
+ case DomProperty::Font: {
+ const DomFont *font = p->elementFont();
+
+ QFont f;
+ if (font->hasElementFamily() && !font->elementFamily().isEmpty())
+ f.setFamily(font->elementFamily());
+ if (font->hasElementPointSize() && font->elementPointSize() > 0)
+ f.setPointSize(font->elementPointSize());
+ if (font->hasElementWeight() && font->elementWeight() > 0)
+ f.setWeight(font->elementWeight());
+ if (font->hasElementItalic())
+ f.setItalic(font->elementItalic());
+ if (font->hasElementBold())
+ f.setBold(font->elementBold());
+ if (font->hasElementUnderline())
+ f.setUnderline(font->elementUnderline());
+ if (font->hasElementStrikeOut())
+ f.setStrikeOut(font->elementStrikeOut());
+ if (font->hasElementKerning())
+ f.setKerning(font->elementKerning());
+ if (font->hasElementAntialiasing())
+ f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
+ if (font->hasElementStyleStrategy()) {
+ f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
+ }
+ return QVariant::fromValue(f);
+ }
+
+ case DomProperty::Date: {
+ const DomDate *date = p->elementDate();
+ return QVariant(QDate(date->elementYear(), date->elementMonth(), date->elementDay()));
+ }
+
+ case DomProperty::Time: {
+ const DomTime *t = p->elementTime();
+ return QVariant(QTime(t->elementHour(), t->elementMinute(), t->elementSecond()));
+ }
+
+ case DomProperty::DateTime: {
+ const DomDateTime *dateTime = p->elementDateTime();
+ const QDate d(dateTime->elementYear(), dateTime->elementMonth(), dateTime->elementDay());
+ const QTime tm(dateTime->elementHour(), dateTime->elementMinute(), dateTime->elementSecond());
+ return QVariant(QDateTime(d, tm));
+ }
+
+ case DomProperty::Url: {
+ const DomUrl *url = p->elementUrl();
+ return QVariant(QUrl(url->elementString()->text()));
+ }
+
+#ifndef QT_NO_CURSOR
+ case DomProperty::Cursor:
+ return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));
+
+ case DomProperty::CursorShape:
+ return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
+#endif
+
+ case DomProperty::Locale: {
+ const DomLocale *locale = p->elementLocale();
+ return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
+ enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
+ }
+ case DomProperty::SizePolicy: {
+ const DomSizePolicy *sizep = p->elementSizePolicy();
+
+ QSizePolicy sizePolicy;
+ sizePolicy.setHorizontalStretch(sizep->elementHorStretch());
+ sizePolicy.setVerticalStretch(sizep->elementVerStretch());
+
+ const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
+
+ if (sizep->hasElementHSizeType()) {
+ sizePolicy.setHorizontalPolicy((QSizePolicy::Policy) sizep->elementHSizeType());
+ } else if (sizep->hasAttributeHSizeType()) {
+ const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeHSizeType().toLatin1());
+ sizePolicy.setHorizontalPolicy(sp);
+ }
+
+ if (sizep->hasElementVSizeType()) {
+ sizePolicy.setVerticalPolicy((QSizePolicy::Policy) sizep->elementVSizeType());
+ } else if (sizep->hasAttributeVSizeType()) {
+ const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeVSizeType().toLatin1());
+ sizePolicy.setVerticalPolicy(sp);
+ }
+
+ return QVariant::fromValue(sizePolicy);
+ }
+
+ case DomProperty::StringList:
+ return QVariant(p->elementStringList()->elementString());
+
+ default:
+ uiLibWarning(QCoreApplication::translate("QFormBuilder", "Reading properties of the type %1 is not supported yet.").arg(p->kind()));
+ break;
+ }
+
+ return QVariant();
+}
+
+// Apply a simple variant type to a DOM property
+static bool applySimpleProperty(const QVariant &v, bool translateString, DomProperty *dom_prop)
+{
+ switch (v.type()) {
+ case QVariant::String: {
+ DomString *str = new DomString();
+ str->setText(v.toString());
+ if (!translateString)
+ str->setAttributeNotr(QLatin1String("true"));
+ dom_prop->setElementString(str);
+ }
+ return true;
+
+ case QVariant::ByteArray:
+ dom_prop->setElementCstring(QString::fromUtf8(v.toByteArray()));
+ return true;
+
+ case QVariant::Int:
+ dom_prop->setElementNumber(v.toInt());
+ return true;
+
+ case QVariant::UInt:
+ dom_prop->setElementUInt(v.toUInt());
+ return true;
+
+ case QVariant::LongLong:
+ dom_prop->setElementLongLong(v.toLongLong());
+ return true;
+
+ case QVariant::ULongLong:
+ dom_prop->setElementULongLong(v.toULongLong());
+ return true;
+
+ case QVariant::Double:
+ dom_prop->setElementDouble(v.toDouble());
+ return true;
+
+ case QVariant::Bool:
+ dom_prop->setElementBool(v.toBool() ? QFormBuilderStrings::instance().trueValue : QFormBuilderStrings::instance().falseValue);
+ return true;
+
+ case QVariant::Char: {
+ DomChar *ch = new DomChar();
+ const QChar character = v.toChar();
+ ch->setElementUnicode(character.unicode());
+ dom_prop->setElementChar(ch);
+ }
+ return true;
+
+ case QVariant::Point: {
+ DomPoint *pt = new DomPoint();
+ const QPoint point = v.toPoint();
+ pt->setElementX(point.x());
+ pt->setElementY(point.y());
+ dom_prop->setElementPoint(pt);
+ }
+ return true;
+
+ case QVariant::PointF: {
+ DomPointF *ptf = new DomPointF();
+ const QPointF pointf = v.toPointF();
+ ptf->setElementX(pointf.x());
+ ptf->setElementY(pointf.y());
+ dom_prop->setElementPointF(ptf);
+ }
+ return true;
+
+ case QVariant::Color: {
+ DomColor *clr = new DomColor();
+ const QColor color = qvariant_cast<QColor>(v);
+ clr->setElementRed(color.red());
+ clr->setElementGreen(color.green());
+ clr->setElementBlue(color.blue());
+ const int alphaChannel = color.alpha();
+ if (alphaChannel != 255)
+ clr->setAttributeAlpha(alphaChannel);
+ dom_prop->setElementColor(clr);
+ }
+ return true;
+
+ case QVariant::Size: {
+ DomSize *sz = new DomSize();
+ const QSize size = v.toSize();
+ sz->setElementWidth(size.width());
+ sz->setElementHeight(size.height());
+ dom_prop->setElementSize(sz);
+ }
+ return true;
+
+ case QVariant::SizeF: {
+ DomSizeF *szf = new DomSizeF();
+ const QSizeF sizef = v.toSizeF();
+ szf->setElementWidth(sizef.width());
+ szf->setElementHeight(sizef.height());
+ dom_prop->setElementSizeF(szf);
+ }
+ return true;
+
+ case QVariant::Rect: {
+ DomRect *rc = new DomRect();
+ const QRect rect = v.toRect();
+ rc->setElementX(rect.x());
+ rc->setElementY(rect.y());
+ rc->setElementWidth(rect.width());
+ rc->setElementHeight(rect.height());
+ dom_prop->setElementRect(rc);
+ }
+ return true;
+
+ case QVariant::RectF: {
+ DomRectF *rcf = new DomRectF();
+ const QRectF rectf = v.toRectF();
+ rcf->setElementX(rectf.x());
+ rcf->setElementY(rectf.y());
+ rcf->setElementWidth(rectf.width());
+ rcf->setElementHeight(rectf.height());
+ dom_prop->setElementRectF(rcf);
+ }
+ return true;
+
+ case QVariant::Font: {
+ DomFont *fnt = new DomFont();
+ const QFont font = qvariant_cast<QFont>(v);
+ const uint mask = font.resolve();
+ if (mask & QFont::WeightResolved) {
+ fnt->setElementBold(font.bold());
+ fnt->setElementWeight(font.weight());
+ }
+ if (mask & QFont::FamilyResolved)
+ fnt->setElementFamily(font.family());
+ if (mask & QFont::StyleResolved)
+ fnt->setElementItalic(font.italic());
+ if (mask & QFont::SizeResolved)
+ fnt->setElementPointSize(font.pointSize());
+ if (mask & QFont::StrikeOutResolved)
+ fnt->setElementStrikeOut(font.strikeOut());
+ if (mask & QFont::UnderlineResolved)
+ fnt->setElementUnderline(font.underline());
+ if (mask & QFont::KerningResolved)
+ fnt->setElementKerning(font.kerning());
+ if (mask & QFont::StyleStrategyResolved) {
+ const QMetaEnum styleStrategy_enum = metaEnum<QAbstractFormBuilderGadget>("styleStrategy");
+ fnt->setElementStyleStrategy(QLatin1String(styleStrategy_enum.valueToKey(font.styleStrategy())));
+ }
+ dom_prop->setElementFont(fnt);
+ }
+ return true;
+
+#ifndef QT_NO_CURSOR
+ case QVariant::Cursor: {
+ const QMetaEnum cursorShape_enum = metaEnum<QAbstractFormBuilderGadget>("cursorShape");
+ dom_prop->setElementCursorShape(QLatin1String(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
+ }
+ return true;
+#endif
+
+ case QVariant::KeySequence: {
+ DomString *s = new DomString();
+ s->setText(qvariant_cast<QKeySequence>(v).toString(QKeySequence::PortableText));
+ dom_prop->setElementString(s);
+ }
+ return true;
+
+ case QVariant::Locale: {
+ DomLocale *dom = new DomLocale();
+ const QLocale locale = qvariant_cast<QLocale>(v);
+
+ const QMetaEnum language_enum = metaEnum<QAbstractFormBuilderGadget>("language");
+ const QMetaEnum country_enum = metaEnum<QAbstractFormBuilderGadget>("country");
+
+ dom->setAttributeLanguage(QLatin1String(language_enum.valueToKey(locale.language())));
+ dom->setAttributeCountry(QLatin1String(country_enum.valueToKey(locale.country())));
+
+ dom_prop->setElementLocale(dom);
+ }
+ return true;
+
+ case QVariant::SizePolicy: {
+ DomSizePolicy *dom = new DomSizePolicy();
+ const QSizePolicy sizePolicy = qvariant_cast<QSizePolicy>(v);
+
+ dom->setElementHorStretch(sizePolicy.horizontalStretch());
+ dom->setElementVerStretch(sizePolicy.verticalStretch());
+
+ const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
+
+ dom->setAttributeHSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.horizontalPolicy())));
+ dom->setAttributeVSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.verticalPolicy())));
+
+ dom_prop->setElementSizePolicy(dom);
+ }
+ return true;
+
+ case QVariant::Date: {
+ DomDate *dom = new DomDate();
+ const QDate date = qvariant_cast<QDate>(v);
+
+ dom->setElementYear(date.year());
+ dom->setElementMonth(date.month());
+ dom->setElementDay(date.day());
+
+ dom_prop->setElementDate(dom);
+ }
+ return true;
+
+ case QVariant::Time: {
+ DomTime *dom = new DomTime();
+ const QTime time = qvariant_cast<QTime>(v);
+
+ dom->setElementHour(time.hour());
+ dom->setElementMinute(time.minute());
+ dom->setElementSecond(time.second());
+
+ dom_prop->setElementTime(dom);
+ }
+ return true;
+
+ case QVariant::DateTime: {
+ DomDateTime *dom = new DomDateTime();
+ const QDateTime dateTime = qvariant_cast<QDateTime>(v);
+
+ dom->setElementHour(dateTime.time().hour());
+ dom->setElementMinute(dateTime.time().minute());
+ dom->setElementSecond(dateTime.time().second());
+ dom->setElementYear(dateTime.date().year());
+ dom->setElementMonth(dateTime.date().month());
+ dom->setElementDay(dateTime.date().day());
+
+ dom_prop->setElementDateTime(dom);
+ }
+ return true;
+
+ case QVariant::Url: {
+ DomUrl *dom = new DomUrl();
+ const QUrl url = v.toUrl();
+
+ DomString *str = new DomString();
+ str->setText(url.toString());
+ dom->setElementString(str);
+
+ dom_prop->setElementUrl(dom);
+ }
+ return true;
+
+ case QVariant::StringList: {
+ DomStringList *sl = new DomStringList;
+ sl->setElementString(qvariant_cast<QStringList>(v));
+ dom_prop->setElementStringList(sl);
+ }
+ return true;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+static QString msgCannotWriteProperty(const QString &pname, const QVariant &v)
+{
+ return QCoreApplication::translate("QFormBuilder", "The property %1 could not be written. The type %2 is not supported yet.").
+ arg(pname).arg(QLatin1String(v.typeName()));
+
+}
+
+static bool isOfType(const QMetaObject *what, const QMetaObject *type)
+{
+ do {
+ if (what == type)
+ return true;
+ } while ((what = what->superClass()));
+ return false;
+}
+
+static bool isTranslatable(const QString &pname, const QVariant &v, const QMetaObject *meta)
+{
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+ if (pname == strings.objectNameProperty)
+ return false;
+ if (pname == strings.styleSheetProperty && v.type() == QVariant::String && isOfType(meta, &QWidget::staticMetaObject))
+ return false;
+ return true;
+}
+
+// Convert complex variant types to DOM properties with the help of QAbstractFormBuilder
+// Does not perform a check using QAbstractFormBuilder::checkProperty().
+DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *meta,
+ const QString &pname, const QVariant &v)
+{
+ const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
+
+ DomProperty *dom_prop = new DomProperty();
+ dom_prop->setAttributeName(pname);
+
+ const int pindex = meta->indexOfProperty(pname.toLatin1());
+ if (pindex != -1) {
+ QMetaProperty meta_property = meta->property(pindex);
+ if ((v.type() == QVariant::Int || v.type() == QVariant::UInt) && meta_property.isEnumType()) {
+ const QMetaEnum e = meta_property.enumerator();
+ if (e.isFlag())
+ dom_prop->setElementSet(QString::fromAscii(e.valueToKeys(v.toInt())));
+ else
+ dom_prop->setElementEnum(QString::fromAscii(e.valueToKey(v.toInt())));
+ return dom_prop;
+ }
+ if (!meta_property.hasStdCppSet() || (isOfType(meta, &QAbstractScrollArea::staticMetaObject) && pname == strings.cursorProperty))
+ dom_prop->setAttributeStdset(0);
+ }
+
+ // Try simple properties
+ if (applySimpleProperty(v, isTranslatable(pname, v, meta), dom_prop))
+ return dom_prop;
+
+ // Complex properties
+ switch (v.type()) {
+ case QVariant::Palette: {
+ DomPalette *dom = new DomPalette();
+ QPalette palette = qvariant_cast<QPalette>(v);
+
+ palette.setCurrentColorGroup(QPalette::Active);
+ dom->setElementActive(afb->saveColorGroup(palette));
+
+ palette.setCurrentColorGroup(QPalette::Inactive);
+ dom->setElementInactive(afb->saveColorGroup(palette));
+
+ palette.setCurrentColorGroup(QPalette::Disabled);
+ dom->setElementDisabled(afb->saveColorGroup(palette));
+
+ dom_prop->setElementPalette(dom);
+ } break;
+ case QVariant::Brush:
+ dom_prop->setElementBrush(afb->saveBrush(qvariant_cast<QBrush>(v)));
+ break;
+ default: {
+ const bool hadAttributeStdset = dom_prop->hasAttributeStdset();
+ const bool attributeStdset = dom_prop->attributeStdset();
+ delete dom_prop;
+ if (afb->resourceBuilder()->isResourceType(v)) {
+ dom_prop = afb->resourceBuilder()->saveResource(afb->workingDirectory(), v);
+ if (dom_prop) {
+ dom_prop->setAttributeName(pname);
+ if (hadAttributeStdset)
+ dom_prop->setAttributeStdset(attributeStdset);
+ }
+ break;
+ }
+ uiLibWarning(msgCannotWriteProperty(pname, v));
+ } return 0;
+ }
+ return dom_prop;
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/properties_p.h b/tools/uilib/properties_p.h
new file mode 100644
index 0000000000..5f40f87d32
--- /dev/null
+++ b/tools/uilib/properties_p.h
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of Qt Designer. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef UILIBPROPERTIES_H
+#define UILIBPROPERTIES_H
+
+#include <QtDesigner/uilib_global.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QMetaProperty>
+#include <QtCore/QLocale>
+#include <QtCore/QCoreApplication>
+
+#include <QtGui/QWidget>
+
+#include "formbuilderextra_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class QAbstractFormBuilder;
+class DomProperty;
+
+QDESIGNER_UILIB_EXPORT DomProperty *variantToDomProperty(QAbstractFormBuilder *abstractFormBuilder, const QMetaObject *meta, const QString &propertyName, const QVariant &value);
+
+
+QDESIGNER_UILIB_EXPORT QVariant domPropertyToVariant(const DomProperty *property);
+QDESIGNER_UILIB_EXPORT QVariant domPropertyToVariant(QAbstractFormBuilder *abstractFormBuilder, const QMetaObject *meta, const DomProperty *property);
+
+// This class exists to provide meta information
+// for enumerations only.
+class QAbstractFormBuilderGadget: public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::ItemFlags itemFlags READ fakeItemFlags)
+ Q_PROPERTY(Qt::CheckState checkState READ fakeCheckState)
+ Q_PROPERTY(Qt::Alignment textAlignment READ fakeAlignment)
+ Q_PROPERTY(Qt::Orientation orientation READ fakeOrientation)
+ Q_PROPERTY(QSizePolicy::Policy sizeType READ fakeSizeType)
+ Q_PROPERTY(QPalette::ColorRole colorRole READ fakeColorRole)
+ Q_PROPERTY(QPalette::ColorGroup colorGroup READ fakeColorGroup)
+ Q_PROPERTY(QFont::StyleStrategy styleStrategy READ fakeStyleStrategy)
+ Q_PROPERTY(Qt::CursorShape cursorShape READ fakeCursorShape)
+ Q_PROPERTY(Qt::BrushStyle brushStyle READ fakeBrushStyle)
+ Q_PROPERTY(Qt::ToolBarArea toolBarArea READ fakeToolBarArea)
+ Q_PROPERTY(QGradient::Type gradientType READ fakeGradientType)
+ Q_PROPERTY(QGradient::Spread gradientSpread READ fakeGradientSpread)
+ Q_PROPERTY(QGradient::CoordinateMode gradientCoordinate READ fakeGradientCoordinate)
+ Q_PROPERTY(QLocale::Language language READ fakeLanguage)
+ Q_PROPERTY(QLocale::Country country READ fakeCountry)
+public:
+ QAbstractFormBuilderGadget() { Q_ASSERT(0); }
+
+ Qt::Orientation fakeOrientation() const { Q_ASSERT(0); return Qt::Horizontal; }
+ QSizePolicy::Policy fakeSizeType() const { Q_ASSERT(0); return QSizePolicy::Expanding; }
+ QPalette::ColorGroup fakeColorGroup() const { Q_ASSERT(0); return static_cast<QPalette::ColorGroup>(0); }
+ QPalette::ColorRole fakeColorRole() const { Q_ASSERT(0); return static_cast<QPalette::ColorRole>(0); }
+ QFont::StyleStrategy fakeStyleStrategy() const { Q_ASSERT(0); return QFont::PreferDefault; }
+ Qt::CursorShape fakeCursorShape() const { Q_ASSERT(0); return Qt::ArrowCursor; }
+ Qt::BrushStyle fakeBrushStyle() const { Q_ASSERT(0); return Qt::NoBrush; }
+ Qt::ToolBarArea fakeToolBarArea() const { Q_ASSERT(0); return Qt::NoToolBarArea; }
+ QGradient::Type fakeGradientType() const { Q_ASSERT(0); return QGradient::NoGradient; }
+ QGradient::Spread fakeGradientSpread() const { Q_ASSERT(0); return QGradient::PadSpread; }
+ QGradient::CoordinateMode fakeGradientCoordinate() const { Q_ASSERT(0); return QGradient::LogicalMode; }
+ QLocale::Language fakeLanguage() const { Q_ASSERT(0); return QLocale::C; }
+ QLocale::Country fakeCountry() const { Q_ASSERT(0); return QLocale::AnyCountry; }
+ Qt::ItemFlags fakeItemFlags() const { Q_ASSERT(0); return Qt::NoItemFlags; }
+ Qt::CheckState fakeCheckState() const { Q_ASSERT(0); return Qt::Unchecked; }
+ Qt::Alignment fakeAlignment() const { Q_ASSERT(0); return Qt::AlignLeft; }
+};
+
+// Convert key to value for a given QMetaEnum
+template <class EnumType>
+inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const EnumType* = 0)
+{
+ int val = metaEnum.keyToValue(key);
+ if (val == -1) {
+
+ uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-value '%1' is invalid. The default value '%2' will be used instead.")
+ .arg(QString::fromUtf8(key)).arg(QString::fromUtf8(metaEnum.key(0))));
+ val = metaEnum.value(0);
+ }
+ return static_cast<EnumType>(val);
+}
+
+// Convert keys to value for a given QMetaEnum
+template <class EnumType>
+inline EnumType enumKeysToValue(const QMetaEnum &metaEnum,const char *keys, const EnumType* = 0)
+{
+ int val = metaEnum.keysToValue(keys);
+ if (val == -1) {
+
+ uiLibWarning(QCoreApplication::translate("QFormBuilder", "The flag-value '%1' is invalid. Zero will be used instead.")
+ .arg(QString::fromUtf8(keys)));
+ val = 0;
+ }
+ return static_cast<EnumType>(QFlag(val));
+}
+
+// Access meta enumeration object of a qobject
+template <class QObjectType>
+inline QMetaEnum metaEnum(const char *name, const QObjectType* = 0)
+{
+ const int e_index = QObjectType::staticMetaObject.indexOfProperty(name);
+ Q_ASSERT(e_index != -1);
+ return QObjectType::staticMetaObject.property(e_index).enumerator();
+}
+
+// Convert key to value for enumeration by name
+template <class QObjectType, class EnumType>
+inline EnumType enumKeyOfObjectToValue(const char *enumName, const char *key, const QObjectType* = 0, const EnumType* = 0)
+{
+ const QMetaEnum me = metaEnum<QObjectType>(enumName);
+ return enumKeyToValue<EnumType>(me, key);
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+#endif // UILIBPROPERTIES_H
diff --git a/tools/uilib/qdesignerexportwidget.h b/tools/uilib/qdesignerexportwidget.h
new file mode 100644
index 0000000000..a6f0f64426
--- /dev/null
+++ b/tools/uilib/qdesignerexportwidget.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDESIGNEREXPORTWIDGET_H
+#define QDESIGNEREXPORTWIDGET_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+#if 0
+// pragma for syncqt, don't remove.
+#pragma qt_class(QDesignerExportWidget)
+#endif
+
+#if defined(QDESIGNER_EXPORT_WIDGETS)
+# define QDESIGNER_WIDGET_EXPORT Q_DECL_EXPORT
+#else
+# define QDESIGNER_WIDGET_EXPORT Q_DECL_IMPORT
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif //QDESIGNEREXPORTWIDGET_H
diff --git a/tools/uilib/resourcebuilder.cpp b/tools/uilib/resourcebuilder.cpp
new file mode 100644
index 0000000000..0ea5d4cf75
--- /dev/null
+++ b/tools/uilib/resourcebuilder.cpp
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "resourcebuilder_p.h"
+#include "ui4_p.h"
+#include <QtCore/QVariant>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDir>
+#include <QtCore/QDebug>
+#include <QtGui/QPixmap>
+#include <QtGui/QIcon>
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal {
+#endif
+
+enum { themeDebug = 0 };
+
+QResourceBuilder::QResourceBuilder()
+{
+
+}
+
+QResourceBuilder::~QResourceBuilder()
+{
+
+}
+
+int QResourceBuilder::iconStateFlags(const DomResourceIcon *dpi)
+{
+ int rc = 0;
+ if (dpi->hasElementNormalOff())
+ rc |= NormalOff;
+ if (dpi->hasElementNormalOn())
+ rc |= NormalOn;
+ if (dpi->hasElementDisabledOff())
+ rc |= DisabledOff;
+ if (dpi->hasElementDisabledOn())
+ rc |= DisabledOn;
+ if (dpi->hasElementActiveOff())
+ rc |= ActiveOff;
+ if (dpi->hasElementActiveOn())
+ rc |= ActiveOn;
+ if (dpi->hasElementSelectedOff())
+ rc |= SelectedOff;
+ if (dpi->hasElementSelectedOn())
+ rc |= SelectedOn;
+ return rc;
+}
+
+QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomProperty *property) const
+{
+ switch (property->kind()) {
+ case DomProperty::Pixmap: {
+ const DomResourcePixmap *dpx = property->elementPixmap();
+ QPixmap pixmap(QFileInfo(workingDirectory, dpx->text()).absoluteFilePath());
+ return QVariant::fromValue(pixmap);
+ }
+ case DomProperty::IconSet: {
+ const DomResourceIcon *dpi = property->elementIconSet();
+ if (!dpi->attributeTheme().isEmpty()) {
+ const QString theme = dpi->attributeTheme();
+ const bool known = QIcon::hasThemeIcon(theme);
+ if (themeDebug)
+ qDebug("Theme %s known %d", qPrintable(theme), known);
+ if (known)
+ return qVariantFromValue(QIcon::fromTheme(dpi->attributeTheme()));
+ } // non-empty theme
+ if (const int flags = iconStateFlags(dpi)) { // new, post 4.4 format
+ QIcon icon;
+ if (flags & NormalOff)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::Off);
+ if (flags & NormalOn)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::On);
+ if (flags & DisabledOff)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::Off);
+ if (flags & DisabledOn)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::On);
+ if (flags & ActiveOff)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::Off);
+ if (flags & ActiveOn)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::On);
+ if (flags & SelectedOff)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::Off);
+ if (flags & SelectedOn)
+ icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::On);
+ return QVariant::fromValue(icon);
+ } else { // 4.3 legacy
+ const QIcon icon(QFileInfo(workingDirectory, dpi->text()).absoluteFilePath());
+ return QVariant::fromValue(icon);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return QVariant();
+}
+
+QVariant QResourceBuilder::toNativeValue(const QVariant &value) const
+{
+ return value;
+}
+
+DomProperty *QResourceBuilder::saveResource(const QDir &workingDirectory, const QVariant &value) const
+{
+ Q_UNUSED(workingDirectory)
+ Q_UNUSED(value)
+ return 0;
+}
+
+bool QResourceBuilder::isResourceProperty(const DomProperty *p) const
+{
+ switch (p->kind()) {
+ case DomProperty::Pixmap:
+ case DomProperty::IconSet:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+bool QResourceBuilder::isResourceType(const QVariant &value) const
+{
+ switch (value.type()) {
+ case QVariant::Pixmap:
+ case QVariant::Icon:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+} // namespace QFormInternal
+#endif
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/resourcebuilder_p.h b/tools/uilib/resourcebuilder_p.h
new file mode 100644
index 0000000000..a3ccbf8168
--- /dev/null
+++ b/tools/uilib/resourcebuilder_p.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RESOURCEBUILDER_H
+#define RESOURCEBUILDER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtDesigner/uilib_global.h>
+#include <QtCore/QList>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+class QDir;
+class QVariant;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class DomProperty;
+class DomResourceIcon;
+
+class QDESIGNER_UILIB_EXPORT QResourceBuilder
+{
+public:
+ enum IconStateFlags {
+ NormalOff = 0x1, NormalOn = 0x2, DisabledOff = 0x4, DisabledOn = 0x8,
+ ActiveOff = 0x10, ActiveOn = 0x20, SelectedOff = 0x40, SelectedOn = 0x80
+ };
+
+ QResourceBuilder();
+ virtual ~QResourceBuilder();
+
+ virtual QVariant loadResource(const QDir &workingDirectory, const DomProperty *property) const;
+
+ virtual QVariant toNativeValue(const QVariant &value) const;
+
+ virtual DomProperty *saveResource(const QDir &workingDirectory, const QVariant &value) const;
+
+ virtual bool isResourceProperty(const DomProperty *p) const;
+
+ virtual bool isResourceType(const QVariant &value) const;
+
+ static int iconStateFlags(const DomResourceIcon *resIcon);
+};
+
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+#endif // RESOURCEBUILDER_H
diff --git a/tools/uilib/textbuilder.cpp b/tools/uilib/textbuilder.cpp
new file mode 100644
index 0000000000..2006a43806
--- /dev/null
+++ b/tools/uilib/textbuilder.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "textbuilder_p.h"
+#include "ui4_p.h"
+#include <QtCore/QVariant>
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal {
+#endif
+
+QTextBuilder::QTextBuilder()
+{
+
+}
+
+QTextBuilder::~QTextBuilder()
+{
+
+}
+
+QVariant QTextBuilder::loadText(const DomProperty *property) const
+{
+ if (property->kind() == DomProperty::String)
+ return property->elementString()->text();
+ return QVariant();
+}
+
+QVariant QTextBuilder::toNativeValue(const QVariant &value) const
+{
+ return value;
+}
+
+DomProperty *QTextBuilder::saveText(const QVariant &value) const
+{
+ Q_UNUSED(value)
+ return 0;
+}
+
+#ifdef QFORMINTERNAL_NAMESPACE
+} // namespace QFormInternal
+#endif
+
+QT_END_NAMESPACE
diff --git a/tools/uilib/textbuilder_p.h b/tools/uilib/textbuilder_p.h
new file mode 100644
index 0000000000..8da296d041
--- /dev/null
+++ b/tools/uilib/textbuilder_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEXTBUILDER_H
+#define TEXTBUILDER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtDesigner/uilib_global.h>
+#include <QtCore/QList>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+class QDir;
+class QVariant;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class DomProperty;
+class DomString;
+
+class QDESIGNER_UILIB_EXPORT QTextBuilder
+{
+public:
+ QTextBuilder();
+ virtual ~QTextBuilder();
+
+ virtual QVariant loadText(const DomProperty *property) const;
+
+ virtual QVariant toNativeValue(const QVariant &value) const;
+
+ virtual DomProperty *saveText(const QVariant &value) const;
+};
+
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+#endif // TEXTBUILDER_H
diff --git a/tools/uilib/ui4.cpp b/tools/uilib/ui4.cpp
new file mode 100644
index 0000000000..f79543f4a2
--- /dev/null
+++ b/tools/uilib/ui4.cpp
@@ -0,0 +1,11154 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "ui4_p.h"
+
+#ifdef QUILOADER_QDOM_READ
+#include <QtXml/QDomElement>
+#endif
+
+QT_BEGIN_NAMESPACE
+#ifdef QFORMINTERNAL_NAMESPACE
+using namespace QFormInternal;
+#endif
+
+/*******************************************************************************
+** Implementations
+*/
+
+void DomUI::clear(bool clear_all)
+{
+ delete m_widget;
+ delete m_layoutDefault;
+ delete m_layoutFunction;
+ delete m_customWidgets;
+ delete m_tabStops;
+ delete m_images;
+ delete m_includes;
+ delete m_resources;
+ delete m_connections;
+ delete m_designerdata;
+ delete m_slots;
+ delete m_buttonGroups;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_version = false;
+ m_has_attr_language = false;
+ m_has_attr_displayname = false;
+ m_has_attr_stdsetdef = false;
+ m_attr_stdsetdef = 0;
+ m_has_attr_stdSetDef = false;
+ m_attr_stdSetDef = 0;
+ }
+
+ m_children = 0;
+ m_widget = 0;
+ m_layoutDefault = 0;
+ m_layoutFunction = 0;
+ m_customWidgets = 0;
+ m_tabStops = 0;
+ m_images = 0;
+ m_includes = 0;
+ m_resources = 0;
+ m_connections = 0;
+ m_designerdata = 0;
+ m_slots = 0;
+ m_buttonGroups = 0;
+}
+
+DomUI::DomUI()
+{
+ m_children = 0;
+ m_has_attr_version = false;
+ m_has_attr_language = false;
+ m_has_attr_displayname = false;
+ m_has_attr_stdsetdef = false;
+ m_attr_stdsetdef = 0;
+ m_has_attr_stdSetDef = false;
+ m_attr_stdSetDef = 0;
+ m_widget = 0;
+ m_layoutDefault = 0;
+ m_layoutFunction = 0;
+ m_customWidgets = 0;
+ m_tabStops = 0;
+ m_images = 0;
+ m_includes = 0;
+ m_resources = 0;
+ m_connections = 0;
+ m_designerdata = 0;
+ m_slots = 0;
+ m_buttonGroups = 0;
+}
+
+DomUI::~DomUI()
+{
+ delete m_widget;
+ delete m_layoutDefault;
+ delete m_layoutFunction;
+ delete m_customWidgets;
+ delete m_tabStops;
+ delete m_images;
+ delete m_includes;
+ delete m_resources;
+ delete m_connections;
+ delete m_designerdata;
+ delete m_slots;
+ delete m_buttonGroups;
+}
+
+void DomUI::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("version")) {
+ setAttributeVersion(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("language")) {
+ setAttributeLanguage(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("displayname")) {
+ setAttributeDisplayname(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("stdsetdef")) {
+ setAttributeStdsetdef(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("stdSetDef")) {
+ setAttributeStdSetDef(attribute.value().toString().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("author")) {
+ setElementAuthor(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("comment")) {
+ setElementComment(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("exportmacro")) {
+ setElementExportMacro(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("class")) {
+ setElementClass(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("widget")) {
+ DomWidget *v = new DomWidget();
+ v->read(reader);
+ setElementWidget(v);
+ continue;
+ }
+ if (tag == QLatin1String("layoutdefault")) {
+ DomLayoutDefault *v = new DomLayoutDefault();
+ v->read(reader);
+ setElementLayoutDefault(v);
+ continue;
+ }
+ if (tag == QLatin1String("layoutfunction")) {
+ DomLayoutFunction *v = new DomLayoutFunction();
+ v->read(reader);
+ setElementLayoutFunction(v);
+ continue;
+ }
+ if (tag == QLatin1String("pixmapfunction")) {
+ setElementPixmapFunction(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("customwidgets")) {
+ DomCustomWidgets *v = new DomCustomWidgets();
+ v->read(reader);
+ setElementCustomWidgets(v);
+ continue;
+ }
+ if (tag == QLatin1String("tabstops")) {
+ DomTabStops *v = new DomTabStops();
+ v->read(reader);
+ setElementTabStops(v);
+ continue;
+ }
+ if (tag == QLatin1String("images")) {
+ DomImages *v = new DomImages();
+ v->read(reader);
+ setElementImages(v);
+ continue;
+ }
+ if (tag == QLatin1String("includes")) {
+ DomIncludes *v = new DomIncludes();
+ v->read(reader);
+ setElementIncludes(v);
+ continue;
+ }
+ if (tag == QLatin1String("resources")) {
+ DomResources *v = new DomResources();
+ v->read(reader);
+ setElementResources(v);
+ continue;
+ }
+ if (tag == QLatin1String("connections")) {
+ DomConnections *v = new DomConnections();
+ v->read(reader);
+ setElementConnections(v);
+ continue;
+ }
+ if (tag == QLatin1String("designerdata")) {
+ DomDesignerData *v = new DomDesignerData();
+ v->read(reader);
+ setElementDesignerdata(v);
+ continue;
+ }
+ if (tag == QLatin1String("slots")) {
+ DomSlots *v = new DomSlots();
+ v->read(reader);
+ setElementSlots(v);
+ continue;
+ }
+ if (tag == QLatin1String("buttongroups")) {
+ DomButtonGroups *v = new DomButtonGroups();
+ v->read(reader);
+ setElementButtonGroups(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomUI::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("version")))
+ setAttributeVersion(node.attribute(QLatin1String("version")));
+ if (node.hasAttribute(QLatin1String("language")))
+ setAttributeLanguage(node.attribute(QLatin1String("language")));
+ if (node.hasAttribute(QLatin1String("displayname")))
+ setAttributeDisplayname(node.attribute(QLatin1String("displayname")));
+ if (node.hasAttribute(QLatin1String("stdsetdef")))
+ setAttributeStdsetdef(node.attribute(QLatin1String("stdsetdef")).toInt());
+ if (node.hasAttribute(QLatin1String("stdSetDef")))
+ setAttributeStdSetDef(node.attribute(QLatin1String("stdSetDef")).toInt());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("author")) {
+ setElementAuthor(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("comment")) {
+ setElementComment(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("exportmacro")) {
+ setElementExportMacro(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("class")) {
+ setElementClass(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("widget")) {
+ DomWidget *v = new DomWidget();
+ v->read(e);
+ setElementWidget(v);
+ continue;
+ }
+ if (tag == QLatin1String("layoutdefault")) {
+ DomLayoutDefault *v = new DomLayoutDefault();
+ v->read(e);
+ setElementLayoutDefault(v);
+ continue;
+ }
+ if (tag == QLatin1String("layoutfunction")) {
+ DomLayoutFunction *v = new DomLayoutFunction();
+ v->read(e);
+ setElementLayoutFunction(v);
+ continue;
+ }
+ if (tag == QLatin1String("pixmapfunction")) {
+ setElementPixmapFunction(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("customwidgets")) {
+ DomCustomWidgets *v = new DomCustomWidgets();
+ v->read(e);
+ setElementCustomWidgets(v);
+ continue;
+ }
+ if (tag == QLatin1String("tabstops")) {
+ DomTabStops *v = new DomTabStops();
+ v->read(e);
+ setElementTabStops(v);
+ continue;
+ }
+ if (tag == QLatin1String("images")) {
+ DomImages *v = new DomImages();
+ v->read(e);
+ setElementImages(v);
+ continue;
+ }
+ if (tag == QLatin1String("includes")) {
+ DomIncludes *v = new DomIncludes();
+ v->read(e);
+ setElementIncludes(v);
+ continue;
+ }
+ if (tag == QLatin1String("resources")) {
+ DomResources *v = new DomResources();
+ v->read(e);
+ setElementResources(v);
+ continue;
+ }
+ if (tag == QLatin1String("connections")) {
+ DomConnections *v = new DomConnections();
+ v->read(e);
+ setElementConnections(v);
+ continue;
+ }
+ if (tag == QLatin1String("designerdata")) {
+ DomDesignerData *v = new DomDesignerData();
+ v->read(e);
+ setElementDesignerdata(v);
+ continue;
+ }
+ if (tag == QLatin1String("slots")) {
+ DomSlots *v = new DomSlots();
+ v->read(e);
+ setElementSlots(v);
+ continue;
+ }
+ if (tag == QLatin1String("buttongroups")) {
+ DomButtonGroups *v = new DomButtonGroups();
+ v->read(e);
+ setElementButtonGroups(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("ui") : tagName.toLower());
+
+ if (hasAttributeVersion())
+ writer.writeAttribute(QLatin1String("version"), attributeVersion());
+
+ if (hasAttributeLanguage())
+ writer.writeAttribute(QLatin1String("language"), attributeLanguage());
+
+ if (hasAttributeDisplayname())
+ writer.writeAttribute(QLatin1String("displayname"), attributeDisplayname());
+
+ if (hasAttributeStdsetdef())
+ writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdsetdef()));
+
+ if (hasAttributeStdSetDef())
+ writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdSetDef()));
+
+ if (m_children & Author) {
+ writer.writeTextElement(QLatin1String("author"), m_author);
+ }
+
+ if (m_children & Comment) {
+ writer.writeTextElement(QLatin1String("comment"), m_comment);
+ }
+
+ if (m_children & ExportMacro) {
+ writer.writeTextElement(QLatin1String("exportmacro"), m_exportMacro);
+ }
+
+ if (m_children & Class) {
+ writer.writeTextElement(QLatin1String("class"), m_class);
+ }
+
+ if (m_children & Widget) {
+ m_widget->write(writer, QLatin1String("widget"));
+ }
+
+ if (m_children & LayoutDefault) {
+ m_layoutDefault->write(writer, QLatin1String("layoutdefault"));
+ }
+
+ if (m_children & LayoutFunction) {
+ m_layoutFunction->write(writer, QLatin1String("layoutfunction"));
+ }
+
+ if (m_children & PixmapFunction) {
+ writer.writeTextElement(QLatin1String("pixmapfunction"), m_pixmapFunction);
+ }
+
+ if (m_children & CustomWidgets) {
+ m_customWidgets->write(writer, QLatin1String("customwidgets"));
+ }
+
+ if (m_children & TabStops) {
+ m_tabStops->write(writer, QLatin1String("tabstops"));
+ }
+
+ if (m_children & Images) {
+ m_images->write(writer, QLatin1String("images"));
+ }
+
+ if (m_children & Includes) {
+ m_includes->write(writer, QLatin1String("includes"));
+ }
+
+ if (m_children & Resources) {
+ m_resources->write(writer, QLatin1String("resources"));
+ }
+
+ if (m_children & Connections) {
+ m_connections->write(writer, QLatin1String("connections"));
+ }
+
+ if (m_children & Designerdata) {
+ m_designerdata->write(writer, QLatin1String("designerdata"));
+ }
+
+ if (m_children & Slots) {
+ m_slots->write(writer, QLatin1String("slots"));
+ }
+
+ if (m_children & ButtonGroups) {
+ m_buttonGroups->write(writer, QLatin1String("buttongroups"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomUI::setElementAuthor(const QString& a)
+{
+ m_children |= Author;
+ m_author = a;
+}
+
+void DomUI::setElementComment(const QString& a)
+{
+ m_children |= Comment;
+ m_comment = a;
+}
+
+void DomUI::setElementExportMacro(const QString& a)
+{
+ m_children |= ExportMacro;
+ m_exportMacro = a;
+}
+
+void DomUI::setElementClass(const QString& a)
+{
+ m_children |= Class;
+ m_class = a;
+}
+
+DomWidget* DomUI::takeElementWidget()
+{
+ DomWidget* a = m_widget;
+ m_widget = 0;
+ m_children ^= Widget;
+ return a;
+}
+
+void DomUI::setElementWidget(DomWidget* a)
+{
+ delete m_widget;
+ m_children |= Widget;
+ m_widget = a;
+}
+
+DomLayoutDefault* DomUI::takeElementLayoutDefault()
+{
+ DomLayoutDefault* a = m_layoutDefault;
+ m_layoutDefault = 0;
+ m_children ^= LayoutDefault;
+ return a;
+}
+
+void DomUI::setElementLayoutDefault(DomLayoutDefault* a)
+{
+ delete m_layoutDefault;
+ m_children |= LayoutDefault;
+ m_layoutDefault = a;
+}
+
+DomLayoutFunction* DomUI::takeElementLayoutFunction()
+{
+ DomLayoutFunction* a = m_layoutFunction;
+ m_layoutFunction = 0;
+ m_children ^= LayoutFunction;
+ return a;
+}
+
+void DomUI::setElementLayoutFunction(DomLayoutFunction* a)
+{
+ delete m_layoutFunction;
+ m_children |= LayoutFunction;
+ m_layoutFunction = a;
+}
+
+void DomUI::setElementPixmapFunction(const QString& a)
+{
+ m_children |= PixmapFunction;
+ m_pixmapFunction = a;
+}
+
+DomCustomWidgets* DomUI::takeElementCustomWidgets()
+{
+ DomCustomWidgets* a = m_customWidgets;
+ m_customWidgets = 0;
+ m_children ^= CustomWidgets;
+ return a;
+}
+
+void DomUI::setElementCustomWidgets(DomCustomWidgets* a)
+{
+ delete m_customWidgets;
+ m_children |= CustomWidgets;
+ m_customWidgets = a;
+}
+
+DomTabStops* DomUI::takeElementTabStops()
+{
+ DomTabStops* a = m_tabStops;
+ m_tabStops = 0;
+ m_children ^= TabStops;
+ return a;
+}
+
+void DomUI::setElementTabStops(DomTabStops* a)
+{
+ delete m_tabStops;
+ m_children |= TabStops;
+ m_tabStops = a;
+}
+
+DomImages* DomUI::takeElementImages()
+{
+ DomImages* a = m_images;
+ m_images = 0;
+ m_children ^= Images;
+ return a;
+}
+
+void DomUI::setElementImages(DomImages* a)
+{
+ delete m_images;
+ m_children |= Images;
+ m_images = a;
+}
+
+DomIncludes* DomUI::takeElementIncludes()
+{
+ DomIncludes* a = m_includes;
+ m_includes = 0;
+ m_children ^= Includes;
+ return a;
+}
+
+void DomUI::setElementIncludes(DomIncludes* a)
+{
+ delete m_includes;
+ m_children |= Includes;
+ m_includes = a;
+}
+
+DomResources* DomUI::takeElementResources()
+{
+ DomResources* a = m_resources;
+ m_resources = 0;
+ m_children ^= Resources;
+ return a;
+}
+
+void DomUI::setElementResources(DomResources* a)
+{
+ delete m_resources;
+ m_children |= Resources;
+ m_resources = a;
+}
+
+DomConnections* DomUI::takeElementConnections()
+{
+ DomConnections* a = m_connections;
+ m_connections = 0;
+ m_children ^= Connections;
+ return a;
+}
+
+void DomUI::setElementConnections(DomConnections* a)
+{
+ delete m_connections;
+ m_children |= Connections;
+ m_connections = a;
+}
+
+DomDesignerData* DomUI::takeElementDesignerdata()
+{
+ DomDesignerData* a = m_designerdata;
+ m_designerdata = 0;
+ m_children ^= Designerdata;
+ return a;
+}
+
+void DomUI::setElementDesignerdata(DomDesignerData* a)
+{
+ delete m_designerdata;
+ m_children |= Designerdata;
+ m_designerdata = a;
+}
+
+DomSlots* DomUI::takeElementSlots()
+{
+ DomSlots* a = m_slots;
+ m_slots = 0;
+ m_children ^= Slots;
+ return a;
+}
+
+void DomUI::setElementSlots(DomSlots* a)
+{
+ delete m_slots;
+ m_children |= Slots;
+ m_slots = a;
+}
+
+DomButtonGroups* DomUI::takeElementButtonGroups()
+{
+ DomButtonGroups* a = m_buttonGroups;
+ m_buttonGroups = 0;
+ m_children ^= ButtonGroups;
+ return a;
+}
+
+void DomUI::setElementButtonGroups(DomButtonGroups* a)
+{
+ delete m_buttonGroups;
+ m_children |= ButtonGroups;
+ m_buttonGroups = a;
+}
+
+void DomUI::clearElementAuthor()
+{
+ m_children &= ~Author;
+}
+
+void DomUI::clearElementComment()
+{
+ m_children &= ~Comment;
+}
+
+void DomUI::clearElementExportMacro()
+{
+ m_children &= ~ExportMacro;
+}
+
+void DomUI::clearElementClass()
+{
+ m_children &= ~Class;
+}
+
+void DomUI::clearElementWidget()
+{
+ delete m_widget;
+ m_widget = 0;
+ m_children &= ~Widget;
+}
+
+void DomUI::clearElementLayoutDefault()
+{
+ delete m_layoutDefault;
+ m_layoutDefault = 0;
+ m_children &= ~LayoutDefault;
+}
+
+void DomUI::clearElementLayoutFunction()
+{
+ delete m_layoutFunction;
+ m_layoutFunction = 0;
+ m_children &= ~LayoutFunction;
+}
+
+void DomUI::clearElementPixmapFunction()
+{
+ m_children &= ~PixmapFunction;
+}
+
+void DomUI::clearElementCustomWidgets()
+{
+ delete m_customWidgets;
+ m_customWidgets = 0;
+ m_children &= ~CustomWidgets;
+}
+
+void DomUI::clearElementTabStops()
+{
+ delete m_tabStops;
+ m_tabStops = 0;
+ m_children &= ~TabStops;
+}
+
+void DomUI::clearElementImages()
+{
+ delete m_images;
+ m_images = 0;
+ m_children &= ~Images;
+}
+
+void DomUI::clearElementIncludes()
+{
+ delete m_includes;
+ m_includes = 0;
+ m_children &= ~Includes;
+}
+
+void DomUI::clearElementResources()
+{
+ delete m_resources;
+ m_resources = 0;
+ m_children &= ~Resources;
+}
+
+void DomUI::clearElementConnections()
+{
+ delete m_connections;
+ m_connections = 0;
+ m_children &= ~Connections;
+}
+
+void DomUI::clearElementDesignerdata()
+{
+ delete m_designerdata;
+ m_designerdata = 0;
+ m_children &= ~Designerdata;
+}
+
+void DomUI::clearElementSlots()
+{
+ delete m_slots;
+ m_slots = 0;
+ m_children &= ~Slots;
+}
+
+void DomUI::clearElementButtonGroups()
+{
+ delete m_buttonGroups;
+ m_buttonGroups = 0;
+ m_children &= ~ButtonGroups;
+}
+
+void DomIncludes::clear(bool clear_all)
+{
+ qDeleteAll(m_include);
+ m_include.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomIncludes::DomIncludes()
+{
+ m_children = 0;
+}
+
+DomIncludes::~DomIncludes()
+{
+ qDeleteAll(m_include);
+ m_include.clear();
+}
+
+void DomIncludes::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("include")) {
+ DomInclude *v = new DomInclude();
+ v->read(reader);
+ m_include.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomIncludes::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("include")) {
+ DomInclude *v = new DomInclude();
+ v->read(e);
+ m_include.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("includes") : tagName.toLower());
+
+ for (int i = 0; i < m_include.size(); ++i) {
+ DomInclude* v = m_include[i];
+ v->write(writer, QLatin1String("include"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomIncludes::setElementInclude(const QList<DomInclude*>& a)
+{
+ m_children |= Include;
+ m_include = a;
+}
+
+void DomInclude::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text = QLatin1String("");
+ m_has_attr_location = false;
+ m_has_attr_impldecl = false;
+ }
+
+ m_children = 0;
+}
+
+DomInclude::DomInclude()
+{
+ m_children = 0;
+ m_has_attr_location = false;
+ m_has_attr_impldecl = false;
+ m_text = QLatin1String("");
+}
+
+DomInclude::~DomInclude()
+{
+}
+
+void DomInclude::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("location")) {
+ setAttributeLocation(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("impldecl")) {
+ setAttributeImpldecl(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomInclude::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("location")))
+ setAttributeLocation(node.attribute(QLatin1String("location")));
+ if (node.hasAttribute(QLatin1String("impldecl")))
+ setAttributeImpldecl(node.attribute(QLatin1String("impldecl")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text = QLatin1String("");
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("include") : tagName.toLower());
+
+ if (hasAttributeLocation())
+ writer.writeAttribute(QLatin1String("location"), attributeLocation());
+
+ if (hasAttributeImpldecl())
+ writer.writeAttribute(QLatin1String("impldecl"), attributeImpldecl());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomResources::clear(bool clear_all)
+{
+ qDeleteAll(m_include);
+ m_include.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ }
+
+ m_children = 0;
+}
+
+DomResources::DomResources()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+}
+
+DomResources::~DomResources()
+{
+ qDeleteAll(m_include);
+ m_include.clear();
+}
+
+void DomResources::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("include")) {
+ DomResource *v = new DomResource();
+ v->read(reader);
+ m_include.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomResources::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("include")) {
+ DomResource *v = new DomResource();
+ v->read(e);
+ m_include.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resources") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ for (int i = 0; i < m_include.size(); ++i) {
+ DomResource* v = m_include[i];
+ v->write(writer, QLatin1String("include"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomResources::setElementInclude(const QList<DomResource*>& a)
+{
+ m_children |= Include;
+ m_include = a;
+}
+
+void DomResource::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_location = false;
+ }
+
+ m_children = 0;
+}
+
+DomResource::DomResource()
+{
+ m_children = 0;
+ m_has_attr_location = false;
+}
+
+DomResource::~DomResource()
+{
+}
+
+void DomResource::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("location")) {
+ setAttributeLocation(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomResource::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("location")))
+ setAttributeLocation(node.attribute(QLatin1String("location")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resource") : tagName.toLower());
+
+ if (hasAttributeLocation())
+ writer.writeAttribute(QLatin1String("location"), attributeLocation());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomActionGroup::clear(bool clear_all)
+{
+ qDeleteAll(m_action);
+ m_action.clear();
+ qDeleteAll(m_actionGroup);
+ m_actionGroup.clear();
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ }
+
+ m_children = 0;
+}
+
+DomActionGroup::DomActionGroup()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+}
+
+DomActionGroup::~DomActionGroup()
+{
+ qDeleteAll(m_action);
+ m_action.clear();
+ qDeleteAll(m_actionGroup);
+ m_actionGroup.clear();
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+}
+
+void DomActionGroup::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("action")) {
+ DomAction *v = new DomAction();
+ v->read(reader);
+ m_action.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("actiongroup")) {
+ DomActionGroup *v = new DomActionGroup();
+ v->read(reader);
+ m_actionGroup.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_attribute.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomActionGroup::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("action")) {
+ DomAction *v = new DomAction();
+ v->read(e);
+ m_action.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("actiongroup")) {
+ DomActionGroup *v = new DomActionGroup();
+ v->read(e);
+ m_actionGroup.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_attribute.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actiongroup") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ for (int i = 0; i < m_action.size(); ++i) {
+ DomAction* v = m_action[i];
+ v->write(writer, QLatin1String("action"));
+ }
+ for (int i = 0; i < m_actionGroup.size(); ++i) {
+ DomActionGroup* v = m_actionGroup[i];
+ v->write(writer, QLatin1String("actiongroup"));
+ }
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ for (int i = 0; i < m_attribute.size(); ++i) {
+ DomProperty* v = m_attribute[i];
+ v->write(writer, QLatin1String("attribute"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomActionGroup::setElementAction(const QList<DomAction*>& a)
+{
+ m_children |= Action;
+ m_action = a;
+}
+
+void DomActionGroup::setElementActionGroup(const QList<DomActionGroup*>& a)
+{
+ m_children |= ActionGroup;
+ m_actionGroup = a;
+}
+
+void DomActionGroup::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomActionGroup::setElementAttribute(const QList<DomProperty*>& a)
+{
+ m_children |= Attribute;
+ m_attribute = a;
+}
+
+void DomAction::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ m_has_attr_menu = false;
+ }
+
+ m_children = 0;
+}
+
+DomAction::DomAction()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+ m_has_attr_menu = false;
+}
+
+DomAction::~DomAction()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+}
+
+void DomAction::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("menu")) {
+ setAttributeMenu(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_attribute.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomAction::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+ if (node.hasAttribute(QLatin1String("menu")))
+ setAttributeMenu(node.attribute(QLatin1String("menu")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_attribute.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("action") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (hasAttributeMenu())
+ writer.writeAttribute(QLatin1String("menu"), attributeMenu());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ for (int i = 0; i < m_attribute.size(); ++i) {
+ DomProperty* v = m_attribute[i];
+ v->write(writer, QLatin1String("attribute"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomAction::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomAction::setElementAttribute(const QList<DomProperty*>& a)
+{
+ m_children |= Attribute;
+ m_attribute = a;
+}
+
+void DomActionRef::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ }
+
+ m_children = 0;
+}
+
+DomActionRef::DomActionRef()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+}
+
+DomActionRef::~DomActionRef()
+{
+}
+
+void DomActionRef::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomActionRef::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actionref") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomButtonGroup::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ }
+
+ m_children = 0;
+}
+
+DomButtonGroup::DomButtonGroup()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+}
+
+DomButtonGroup::~DomButtonGroup()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+}
+
+void DomButtonGroup::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_attribute.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomButtonGroup::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_attribute.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroup") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ for (int i = 0; i < m_attribute.size(); ++i) {
+ DomProperty* v = m_attribute[i];
+ v->write(writer, QLatin1String("attribute"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomButtonGroup::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomButtonGroup::setElementAttribute(const QList<DomProperty*>& a)
+{
+ m_children |= Attribute;
+ m_attribute = a;
+}
+
+void DomButtonGroups::clear(bool clear_all)
+{
+ qDeleteAll(m_buttonGroup);
+ m_buttonGroup.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomButtonGroups::DomButtonGroups()
+{
+ m_children = 0;
+}
+
+DomButtonGroups::~DomButtonGroups()
+{
+ qDeleteAll(m_buttonGroup);
+ m_buttonGroup.clear();
+}
+
+void DomButtonGroups::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("buttongroup")) {
+ DomButtonGroup *v = new DomButtonGroup();
+ v->read(reader);
+ m_buttonGroup.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomButtonGroups::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("buttongroup")) {
+ DomButtonGroup *v = new DomButtonGroup();
+ v->read(e);
+ m_buttonGroup.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroups") : tagName.toLower());
+
+ for (int i = 0; i < m_buttonGroup.size(); ++i) {
+ DomButtonGroup* v = m_buttonGroup[i];
+ v->write(writer, QLatin1String("buttongroup"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomButtonGroups::setElementButtonGroup(const QList<DomButtonGroup*>& a)
+{
+ m_children |= ButtonGroup;
+ m_buttonGroup = a;
+}
+
+void DomImages::clear(bool clear_all)
+{
+ qDeleteAll(m_image);
+ m_image.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomImages::DomImages()
+{
+ m_children = 0;
+}
+
+DomImages::~DomImages()
+{
+ qDeleteAll(m_image);
+ m_image.clear();
+}
+
+void DomImages::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("image")) {
+ DomImage *v = new DomImage();
+ v->read(reader);
+ m_image.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomImages::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("image")) {
+ DomImage *v = new DomImage();
+ v->read(e);
+ m_image.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("images") : tagName.toLower());
+
+ for (int i = 0; i < m_image.size(); ++i) {
+ DomImage* v = m_image[i];
+ v->write(writer, QLatin1String("image"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomImages::setElementImage(const QList<DomImage*>& a)
+{
+ m_children |= Image;
+ m_image = a;
+}
+
+void DomImage::clear(bool clear_all)
+{
+ delete m_data;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ }
+
+ m_children = 0;
+ m_data = 0;
+}
+
+DomImage::DomImage()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+ m_data = 0;
+}
+
+DomImage::~DomImage()
+{
+ delete m_data;
+}
+
+void DomImage::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("data")) {
+ DomImageData *v = new DomImageData();
+ v->read(reader);
+ setElementData(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomImage::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("data")) {
+ DomImageData *v = new DomImageData();
+ v->read(e);
+ setElementData(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("image") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (m_children & Data) {
+ m_data->write(writer, QLatin1String("data"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomImageData* DomImage::takeElementData()
+{
+ DomImageData* a = m_data;
+ m_data = 0;
+ m_children ^= Data;
+ return a;
+}
+
+void DomImage::setElementData(DomImageData* a)
+{
+ delete m_data;
+ m_children |= Data;
+ m_data = a;
+}
+
+void DomImage::clearElementData()
+{
+ delete m_data;
+ m_data = 0;
+ m_children &= ~Data;
+}
+
+void DomImageData::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text = QLatin1String("");
+ m_has_attr_format = false;
+ m_has_attr_length = false;
+ m_attr_length = 0;
+ }
+
+ m_children = 0;
+}
+
+DomImageData::DomImageData()
+{
+ m_children = 0;
+ m_has_attr_format = false;
+ m_has_attr_length = false;
+ m_attr_length = 0;
+ m_text = QLatin1String("");
+}
+
+DomImageData::~DomImageData()
+{
+}
+
+void DomImageData::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("format")) {
+ setAttributeFormat(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("length")) {
+ setAttributeLength(attribute.value().toString().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomImageData::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("format")))
+ setAttributeFormat(node.attribute(QLatin1String("format")));
+ if (node.hasAttribute(QLatin1String("length")))
+ setAttributeLength(node.attribute(QLatin1String("length")).toInt());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text = QLatin1String("");
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("imagedata") : tagName.toLower());
+
+ if (hasAttributeFormat())
+ writer.writeAttribute(QLatin1String("format"), attributeFormat());
+
+ if (hasAttributeLength())
+ writer.writeAttribute(QLatin1String("length"), QString::number(attributeLength()));
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomCustomWidgets::clear(bool clear_all)
+{
+ qDeleteAll(m_customWidget);
+ m_customWidget.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomCustomWidgets::DomCustomWidgets()
+{
+ m_children = 0;
+}
+
+DomCustomWidgets::~DomCustomWidgets()
+{
+ qDeleteAll(m_customWidget);
+ m_customWidget.clear();
+}
+
+void DomCustomWidgets::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("customwidget")) {
+ DomCustomWidget *v = new DomCustomWidget();
+ v->read(reader);
+ m_customWidget.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomCustomWidgets::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("customwidget")) {
+ DomCustomWidget *v = new DomCustomWidget();
+ v->read(e);
+ m_customWidget.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidgets") : tagName.toLower());
+
+ for (int i = 0; i < m_customWidget.size(); ++i) {
+ DomCustomWidget* v = m_customWidget[i];
+ v->write(writer, QLatin1String("customwidget"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomCustomWidgets::setElementCustomWidget(const QList<DomCustomWidget*>& a)
+{
+ m_children |= CustomWidget;
+ m_customWidget = a;
+}
+
+void DomHeader::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text = QLatin1String("");
+ m_has_attr_location = false;
+ }
+
+ m_children = 0;
+}
+
+DomHeader::DomHeader()
+{
+ m_children = 0;
+ m_has_attr_location = false;
+ m_text = QLatin1String("");
+}
+
+DomHeader::~DomHeader()
+{
+}
+
+void DomHeader::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("location")) {
+ setAttributeLocation(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomHeader::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("location")))
+ setAttributeLocation(node.attribute(QLatin1String("location")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text = QLatin1String("");
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("header") : tagName.toLower());
+
+ if (hasAttributeLocation())
+ writer.writeAttribute(QLatin1String("location"), attributeLocation());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomCustomWidget::clear(bool clear_all)
+{
+ delete m_header;
+ delete m_sizeHint;
+ delete m_sizePolicy;
+ delete m_script;
+ delete m_properties;
+ delete m_slots;
+ delete m_propertyspecifications;
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_header = 0;
+ m_sizeHint = 0;
+ m_container = 0;
+ m_sizePolicy = 0;
+ m_script = 0;
+ m_properties = 0;
+ m_slots = 0;
+ m_propertyspecifications = 0;
+}
+
+DomCustomWidget::DomCustomWidget()
+{
+ m_children = 0;
+ m_header = 0;
+ m_sizeHint = 0;
+ m_container = 0;
+ m_sizePolicy = 0;
+ m_script = 0;
+ m_properties = 0;
+ m_slots = 0;
+ m_propertyspecifications = 0;
+}
+
+DomCustomWidget::~DomCustomWidget()
+{
+ delete m_header;
+ delete m_sizeHint;
+ delete m_sizePolicy;
+ delete m_script;
+ delete m_properties;
+ delete m_slots;
+ delete m_propertyspecifications;
+}
+
+void DomCustomWidget::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("class")) {
+ setElementClass(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("extends")) {
+ setElementExtends(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("header")) {
+ DomHeader *v = new DomHeader();
+ v->read(reader);
+ setElementHeader(v);
+ continue;
+ }
+ if (tag == QLatin1String("sizehint")) {
+ DomSize *v = new DomSize();
+ v->read(reader);
+ setElementSizeHint(v);
+ continue;
+ }
+ if (tag == QLatin1String("addpagemethod")) {
+ setElementAddPageMethod(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("container")) {
+ setElementContainer(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("sizepolicy")) {
+ DomSizePolicyData *v = new DomSizePolicyData();
+ v->read(reader);
+ setElementSizePolicy(v);
+ continue;
+ }
+ if (tag == QLatin1String("pixmap")) {
+ setElementPixmap(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("script")) {
+ DomScript *v = new DomScript();
+ v->read(reader);
+ setElementScript(v);
+ continue;
+ }
+ if (tag == QLatin1String("properties")) {
+ DomProperties *v = new DomProperties();
+ v->read(reader);
+ setElementProperties(v);
+ continue;
+ }
+ if (tag == QLatin1String("slots")) {
+ DomSlots *v = new DomSlots();
+ v->read(reader);
+ setElementSlots(v);
+ continue;
+ }
+ if (tag == QLatin1String("propertyspecifications")) {
+ DomPropertySpecifications *v = new DomPropertySpecifications();
+ v->read(reader);
+ setElementPropertyspecifications(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomCustomWidget::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("class")) {
+ setElementClass(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("extends")) {
+ setElementExtends(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("header")) {
+ DomHeader *v = new DomHeader();
+ v->read(e);
+ setElementHeader(v);
+ continue;
+ }
+ if (tag == QLatin1String("sizehint")) {
+ DomSize *v = new DomSize();
+ v->read(e);
+ setElementSizeHint(v);
+ continue;
+ }
+ if (tag == QLatin1String("addpagemethod")) {
+ setElementAddPageMethod(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("container")) {
+ setElementContainer(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("sizepolicy")) {
+ DomSizePolicyData *v = new DomSizePolicyData();
+ v->read(e);
+ setElementSizePolicy(v);
+ continue;
+ }
+ if (tag == QLatin1String("pixmap")) {
+ setElementPixmap(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("script")) {
+ DomScript *v = new DomScript();
+ v->read(e);
+ setElementScript(v);
+ continue;
+ }
+ if (tag == QLatin1String("properties")) {
+ DomProperties *v = new DomProperties();
+ v->read(e);
+ setElementProperties(v);
+ continue;
+ }
+ if (tag == QLatin1String("slots")) {
+ DomSlots *v = new DomSlots();
+ v->read(e);
+ setElementSlots(v);
+ continue;
+ }
+ if (tag == QLatin1String("propertyspecifications")) {
+ DomPropertySpecifications *v = new DomPropertySpecifications();
+ v->read(e);
+ setElementPropertyspecifications(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidget") : tagName.toLower());
+
+ if (m_children & Class) {
+ writer.writeTextElement(QLatin1String("class"), m_class);
+ }
+
+ if (m_children & Extends) {
+ writer.writeTextElement(QLatin1String("extends"), m_extends);
+ }
+
+ if (m_children & Header) {
+ m_header->write(writer, QLatin1String("header"));
+ }
+
+ if (m_children & SizeHint) {
+ m_sizeHint->write(writer, QLatin1String("sizehint"));
+ }
+
+ if (m_children & AddPageMethod) {
+ writer.writeTextElement(QLatin1String("addpagemethod"), m_addPageMethod);
+ }
+
+ if (m_children & Container) {
+ writer.writeTextElement(QLatin1String("container"), QString::number(m_container));
+ }
+
+ if (m_children & SizePolicy) {
+ m_sizePolicy->write(writer, QLatin1String("sizepolicy"));
+ }
+
+ if (m_children & Pixmap) {
+ writer.writeTextElement(QLatin1String("pixmap"), m_pixmap);
+ }
+
+ if (m_children & Script) {
+ m_script->write(writer, QLatin1String("script"));
+ }
+
+ if (m_children & Properties) {
+ m_properties->write(writer, QLatin1String("properties"));
+ }
+
+ if (m_children & Slots) {
+ m_slots->write(writer, QLatin1String("slots"));
+ }
+
+ if (m_children & Propertyspecifications) {
+ m_propertyspecifications->write(writer, QLatin1String("propertyspecifications"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomCustomWidget::setElementClass(const QString& a)
+{
+ m_children |= Class;
+ m_class = a;
+}
+
+void DomCustomWidget::setElementExtends(const QString& a)
+{
+ m_children |= Extends;
+ m_extends = a;
+}
+
+DomHeader* DomCustomWidget::takeElementHeader()
+{
+ DomHeader* a = m_header;
+ m_header = 0;
+ m_children ^= Header;
+ return a;
+}
+
+void DomCustomWidget::setElementHeader(DomHeader* a)
+{
+ delete m_header;
+ m_children |= Header;
+ m_header = a;
+}
+
+DomSize* DomCustomWidget::takeElementSizeHint()
+{
+ DomSize* a = m_sizeHint;
+ m_sizeHint = 0;
+ m_children ^= SizeHint;
+ return a;
+}
+
+void DomCustomWidget::setElementSizeHint(DomSize* a)
+{
+ delete m_sizeHint;
+ m_children |= SizeHint;
+ m_sizeHint = a;
+}
+
+void DomCustomWidget::setElementAddPageMethod(const QString& a)
+{
+ m_children |= AddPageMethod;
+ m_addPageMethod = a;
+}
+
+void DomCustomWidget::setElementContainer(int a)
+{
+ m_children |= Container;
+ m_container = a;
+}
+
+DomSizePolicyData* DomCustomWidget::takeElementSizePolicy()
+{
+ DomSizePolicyData* a = m_sizePolicy;
+ m_sizePolicy = 0;
+ m_children ^= SizePolicy;
+ return a;
+}
+
+void DomCustomWidget::setElementSizePolicy(DomSizePolicyData* a)
+{
+ delete m_sizePolicy;
+ m_children |= SizePolicy;
+ m_sizePolicy = a;
+}
+
+void DomCustomWidget::setElementPixmap(const QString& a)
+{
+ m_children |= Pixmap;
+ m_pixmap = a;
+}
+
+DomScript* DomCustomWidget::takeElementScript()
+{
+ DomScript* a = m_script;
+ m_script = 0;
+ m_children ^= Script;
+ return a;
+}
+
+void DomCustomWidget::setElementScript(DomScript* a)
+{
+ delete m_script;
+ m_children |= Script;
+ m_script = a;
+}
+
+DomProperties* DomCustomWidget::takeElementProperties()
+{
+ DomProperties* a = m_properties;
+ m_properties = 0;
+ m_children ^= Properties;
+ return a;
+}
+
+void DomCustomWidget::setElementProperties(DomProperties* a)
+{
+ delete m_properties;
+ m_children |= Properties;
+ m_properties = a;
+}
+
+DomSlots* DomCustomWidget::takeElementSlots()
+{
+ DomSlots* a = m_slots;
+ m_slots = 0;
+ m_children ^= Slots;
+ return a;
+}
+
+void DomCustomWidget::setElementSlots(DomSlots* a)
+{
+ delete m_slots;
+ m_children |= Slots;
+ m_slots = a;
+}
+
+DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications()
+{
+ DomPropertySpecifications* a = m_propertyspecifications;
+ m_propertyspecifications = 0;
+ m_children ^= Propertyspecifications;
+ return a;
+}
+
+void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a)
+{
+ delete m_propertyspecifications;
+ m_children |= Propertyspecifications;
+ m_propertyspecifications = a;
+}
+
+void DomCustomWidget::clearElementClass()
+{
+ m_children &= ~Class;
+}
+
+void DomCustomWidget::clearElementExtends()
+{
+ m_children &= ~Extends;
+}
+
+void DomCustomWidget::clearElementHeader()
+{
+ delete m_header;
+ m_header = 0;
+ m_children &= ~Header;
+}
+
+void DomCustomWidget::clearElementSizeHint()
+{
+ delete m_sizeHint;
+ m_sizeHint = 0;
+ m_children &= ~SizeHint;
+}
+
+void DomCustomWidget::clearElementAddPageMethod()
+{
+ m_children &= ~AddPageMethod;
+}
+
+void DomCustomWidget::clearElementContainer()
+{
+ m_children &= ~Container;
+}
+
+void DomCustomWidget::clearElementSizePolicy()
+{
+ delete m_sizePolicy;
+ m_sizePolicy = 0;
+ m_children &= ~SizePolicy;
+}
+
+void DomCustomWidget::clearElementPixmap()
+{
+ m_children &= ~Pixmap;
+}
+
+void DomCustomWidget::clearElementScript()
+{
+ delete m_script;
+ m_script = 0;
+ m_children &= ~Script;
+}
+
+void DomCustomWidget::clearElementProperties()
+{
+ delete m_properties;
+ m_properties = 0;
+ m_children &= ~Properties;
+}
+
+void DomCustomWidget::clearElementSlots()
+{
+ delete m_slots;
+ m_slots = 0;
+ m_children &= ~Slots;
+}
+
+void DomCustomWidget::clearElementPropertyspecifications()
+{
+ delete m_propertyspecifications;
+ m_propertyspecifications = 0;
+ m_children &= ~Propertyspecifications;
+}
+
+void DomProperties::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomProperties::DomProperties()
+{
+ m_children = 0;
+}
+
+DomProperties::~DomProperties()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+}
+
+void DomProperties::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomPropertyData *v = new DomPropertyData();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomProperties::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomPropertyData *v = new DomPropertyData();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("properties") : tagName.toLower());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomPropertyData* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomProperties::setElementProperty(const QList<DomPropertyData*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomPropertyData::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_type = false;
+ }
+
+ m_children = 0;
+}
+
+DomPropertyData::DomPropertyData()
+{
+ m_children = 0;
+ m_has_attr_type = false;
+}
+
+DomPropertyData::~DomPropertyData()
+{
+}
+
+void DomPropertyData::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("type")) {
+ setAttributeType(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomPropertyData::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("type")))
+ setAttributeType(node.attribute(QLatin1String("type")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertydata") : tagName.toLower());
+
+ if (hasAttributeType())
+ writer.writeAttribute(QLatin1String("type"), attributeType());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSizePolicyData::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_horData = 0;
+ m_verData = 0;
+}
+
+DomSizePolicyData::DomSizePolicyData()
+{
+ m_children = 0;
+ m_horData = 0;
+ m_verData = 0;
+}
+
+DomSizePolicyData::~DomSizePolicyData()
+{
+}
+
+void DomSizePolicyData::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("hordata")) {
+ setElementHorData(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("verdata")) {
+ setElementVerData(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomSizePolicyData::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("hordata")) {
+ setElementHorData(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("verdata")) {
+ setElementVerData(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicydata") : tagName.toLower());
+
+ if (m_children & HorData) {
+ writer.writeTextElement(QLatin1String("hordata"), QString::number(m_horData));
+ }
+
+ if (m_children & VerData) {
+ writer.writeTextElement(QLatin1String("verdata"), QString::number(m_verData));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSizePolicyData::setElementHorData(int a)
+{
+ m_children |= HorData;
+ m_horData = a;
+}
+
+void DomSizePolicyData::setElementVerData(int a)
+{
+ m_children |= VerData;
+ m_verData = a;
+}
+
+void DomSizePolicyData::clearElementHorData()
+{
+ m_children &= ~HorData;
+}
+
+void DomSizePolicyData::clearElementVerData()
+{
+ m_children &= ~VerData;
+}
+
+void DomLayoutDefault::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_spacing = false;
+ m_attr_spacing = 0;
+ m_has_attr_margin = false;
+ m_attr_margin = 0;
+ }
+
+ m_children = 0;
+}
+
+DomLayoutDefault::DomLayoutDefault()
+{
+ m_children = 0;
+ m_has_attr_spacing = false;
+ m_attr_spacing = 0;
+ m_has_attr_margin = false;
+ m_attr_margin = 0;
+}
+
+DomLayoutDefault::~DomLayoutDefault()
+{
+}
+
+void DomLayoutDefault::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("spacing")) {
+ setAttributeSpacing(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("margin")) {
+ setAttributeMargin(attribute.value().toString().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomLayoutDefault::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("spacing")))
+ setAttributeSpacing(node.attribute(QLatin1String("spacing")).toInt());
+ if (node.hasAttribute(QLatin1String("margin")))
+ setAttributeMargin(node.attribute(QLatin1String("margin")).toInt());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutdefault") : tagName.toLower());
+
+ if (hasAttributeSpacing())
+ writer.writeAttribute(QLatin1String("spacing"), QString::number(attributeSpacing()));
+
+ if (hasAttributeMargin())
+ writer.writeAttribute(QLatin1String("margin"), QString::number(attributeMargin()));
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomLayoutFunction::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_spacing = false;
+ m_has_attr_margin = false;
+ }
+
+ m_children = 0;
+}
+
+DomLayoutFunction::DomLayoutFunction()
+{
+ m_children = 0;
+ m_has_attr_spacing = false;
+ m_has_attr_margin = false;
+}
+
+DomLayoutFunction::~DomLayoutFunction()
+{
+}
+
+void DomLayoutFunction::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("spacing")) {
+ setAttributeSpacing(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("margin")) {
+ setAttributeMargin(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomLayoutFunction::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("spacing")))
+ setAttributeSpacing(node.attribute(QLatin1String("spacing")));
+ if (node.hasAttribute(QLatin1String("margin")))
+ setAttributeMargin(node.attribute(QLatin1String("margin")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutfunction") : tagName.toLower());
+
+ if (hasAttributeSpacing())
+ writer.writeAttribute(QLatin1String("spacing"), attributeSpacing());
+
+ if (hasAttributeMargin())
+ writer.writeAttribute(QLatin1String("margin"), attributeMargin());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomTabStops::clear(bool clear_all)
+{
+ m_tabStop.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomTabStops::DomTabStops()
+{
+ m_children = 0;
+}
+
+DomTabStops::~DomTabStops()
+{
+ m_tabStop.clear();
+}
+
+void DomTabStops::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("tabstop")) {
+ m_tabStop.append(reader.readElementText());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomTabStops::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("tabstop")) {
+ m_tabStop.append(e.text());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("tabstops") : tagName.toLower());
+
+ for (int i = 0; i < m_tabStop.size(); ++i) {
+ QString v = m_tabStop[i];
+ writer.writeTextElement(QLatin1String("tabstop"), v);
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomTabStops::setElementTabStop(const QStringList& a)
+{
+ m_children |= TabStop;
+ m_tabStop = a;
+}
+
+void DomLayout::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+ qDeleteAll(m_item);
+ m_item.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_class = false;
+ m_has_attr_name = false;
+ m_has_attr_stretch = false;
+ m_has_attr_rowStretch = false;
+ m_has_attr_columnStretch = false;
+ m_has_attr_rowMinimumHeight = false;
+ m_has_attr_columnMinimumWidth = false;
+ }
+
+ m_children = 0;
+}
+
+DomLayout::DomLayout()
+{
+ m_children = 0;
+ m_has_attr_class = false;
+ m_has_attr_name = false;
+ m_has_attr_stretch = false;
+ m_has_attr_rowStretch = false;
+ m_has_attr_columnStretch = false;
+ m_has_attr_rowMinimumHeight = false;
+ m_has_attr_columnMinimumWidth = false;
+}
+
+DomLayout::~DomLayout()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+ qDeleteAll(m_item);
+ m_item.clear();
+}
+
+void DomLayout::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("class")) {
+ setAttributeClass(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("stretch")) {
+ setAttributeStretch(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("rowstretch")) {
+ setAttributeRowStretch(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("columnstretch")) {
+ setAttributeColumnStretch(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("rowminimumheight")) {
+ setAttributeRowMinimumHeight(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("columnminimumwidth")) {
+ setAttributeColumnMinimumWidth(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_attribute.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("item")) {
+ DomLayoutItem *v = new DomLayoutItem();
+ v->read(reader);
+ m_item.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomLayout::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("class")))
+ setAttributeClass(node.attribute(QLatin1String("class")));
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+ if (node.hasAttribute(QLatin1String("stretch")))
+ setAttributeStretch(node.attribute(QLatin1String("stretch")));
+ if (node.hasAttribute(QLatin1String("rowstretch")))
+ setAttributeRowStretch(node.attribute(QLatin1String("rowstretch")));
+ if (node.hasAttribute(QLatin1String("columnstretch")))
+ setAttributeColumnStretch(node.attribute(QLatin1String("columnstretch")));
+ if (node.hasAttribute(QLatin1String("rowminimumheight")))
+ setAttributeRowMinimumHeight(node.attribute(QLatin1String("rowminimumheight")));
+ if (node.hasAttribute(QLatin1String("columnminimumwidth")))
+ setAttributeColumnMinimumWidth(node.attribute(QLatin1String("columnminimumwidth")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_attribute.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("item")) {
+ DomLayoutItem *v = new DomLayoutItem();
+ v->read(e);
+ m_item.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layout") : tagName.toLower());
+
+ if (hasAttributeClass())
+ writer.writeAttribute(QLatin1String("class"), attributeClass());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (hasAttributeStretch())
+ writer.writeAttribute(QLatin1String("stretch"), attributeStretch());
+
+ if (hasAttributeRowStretch())
+ writer.writeAttribute(QLatin1String("rowstretch"), attributeRowStretch());
+
+ if (hasAttributeColumnStretch())
+ writer.writeAttribute(QLatin1String("columnstretch"), attributeColumnStretch());
+
+ if (hasAttributeRowMinimumHeight())
+ writer.writeAttribute(QLatin1String("rowminimumheight"), attributeRowMinimumHeight());
+
+ if (hasAttributeColumnMinimumWidth())
+ writer.writeAttribute(QLatin1String("columnminimumwidth"), attributeColumnMinimumWidth());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ for (int i = 0; i < m_attribute.size(); ++i) {
+ DomProperty* v = m_attribute[i];
+ v->write(writer, QLatin1String("attribute"));
+ }
+ for (int i = 0; i < m_item.size(); ++i) {
+ DomLayoutItem* v = m_item[i];
+ v->write(writer, QLatin1String("item"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomLayout::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomLayout::setElementAttribute(const QList<DomProperty*>& a)
+{
+ m_children |= Attribute;
+ m_attribute = a;
+}
+
+void DomLayout::setElementItem(const QList<DomLayoutItem*>& a)
+{
+ m_children |= Item;
+ m_item = a;
+}
+
+void DomLayoutItem::clear(bool clear_all)
+{
+ delete m_widget;
+ delete m_layout;
+ delete m_spacer;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_row = false;
+ m_attr_row = 0;
+ m_has_attr_column = false;
+ m_attr_column = 0;
+ m_has_attr_rowSpan = false;
+ m_attr_rowSpan = 0;
+ m_has_attr_colSpan = false;
+ m_attr_colSpan = 0;
+ m_has_attr_alignment = false;
+ }
+
+ m_kind = Unknown;
+
+ m_widget = 0;
+ m_layout = 0;
+ m_spacer = 0;
+}
+
+DomLayoutItem::DomLayoutItem()
+{
+ m_kind = Unknown;
+
+ m_has_attr_row = false;
+ m_attr_row = 0;
+ m_has_attr_column = false;
+ m_attr_column = 0;
+ m_has_attr_rowSpan = false;
+ m_attr_rowSpan = 0;
+ m_has_attr_colSpan = false;
+ m_attr_colSpan = 0;
+ m_has_attr_alignment = false;
+ m_widget = 0;
+ m_layout = 0;
+ m_spacer = 0;
+}
+
+DomLayoutItem::~DomLayoutItem()
+{
+ delete m_widget;
+ delete m_layout;
+ delete m_spacer;
+}
+
+void DomLayoutItem::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("row")) {
+ setAttributeRow(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("column")) {
+ setAttributeColumn(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("rowspan")) {
+ setAttributeRowSpan(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("colspan")) {
+ setAttributeColSpan(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("alignment")) {
+ setAttributeAlignment(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("widget")) {
+ DomWidget *v = new DomWidget();
+ v->read(reader);
+ setElementWidget(v);
+ continue;
+ }
+ if (tag == QLatin1String("layout")) {
+ DomLayout *v = new DomLayout();
+ v->read(reader);
+ setElementLayout(v);
+ continue;
+ }
+ if (tag == QLatin1String("spacer")) {
+ DomSpacer *v = new DomSpacer();
+ v->read(reader);
+ setElementSpacer(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomLayoutItem::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("row")))
+ setAttributeRow(node.attribute(QLatin1String("row")).toInt());
+ if (node.hasAttribute(QLatin1String("column")))
+ setAttributeColumn(node.attribute(QLatin1String("column")).toInt());
+ if (node.hasAttribute(QLatin1String("rowspan")))
+ setAttributeRowSpan(node.attribute(QLatin1String("rowspan")).toInt());
+ if (node.hasAttribute(QLatin1String("colspan")))
+ setAttributeColSpan(node.attribute(QLatin1String("colspan")).toInt());
+ if (node.hasAttribute(QLatin1String("alignment")))
+ setAttributeAlignment(node.attribute(QLatin1String("alignment")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("widget")) {
+ DomWidget *v = new DomWidget();
+ v->read(e);
+ setElementWidget(v);
+ continue;
+ }
+ if (tag == QLatin1String("layout")) {
+ DomLayout *v = new DomLayout();
+ v->read(e);
+ setElementLayout(v);
+ continue;
+ }
+ if (tag == QLatin1String("spacer")) {
+ DomSpacer *v = new DomSpacer();
+ v->read(e);
+ setElementSpacer(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutitem") : tagName.toLower());
+
+ if (hasAttributeRow())
+ writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow()));
+
+ if (hasAttributeColumn())
+ writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn()));
+
+ if (hasAttributeRowSpan())
+ writer.writeAttribute(QLatin1String("rowspan"), QString::number(attributeRowSpan()));
+
+ if (hasAttributeColSpan())
+ writer.writeAttribute(QLatin1String("colspan"), QString::number(attributeColSpan()));
+
+ if (hasAttributeAlignment())
+ writer.writeAttribute(QLatin1String("alignment"), attributeAlignment());
+
+ switch (kind()) {
+ case Widget: {
+ DomWidget* v = elementWidget();
+ if (v != 0) {
+ v->write(writer, QLatin1String("widget"));
+ }
+ break;
+ }
+ case Layout: {
+ DomLayout* v = elementLayout();
+ if (v != 0) {
+ v->write(writer, QLatin1String("layout"));
+ }
+ break;
+ }
+ case Spacer: {
+ DomSpacer* v = elementSpacer();
+ if (v != 0) {
+ v->write(writer, QLatin1String("spacer"));
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomWidget* DomLayoutItem::takeElementWidget()
+{
+ DomWidget* a = m_widget;
+ m_widget = 0;
+ return a;
+}
+
+void DomLayoutItem::setElementWidget(DomWidget* a)
+{
+ clear(false);
+ m_kind = Widget;
+ m_widget = a;
+}
+
+DomLayout* DomLayoutItem::takeElementLayout()
+{
+ DomLayout* a = m_layout;
+ m_layout = 0;
+ return a;
+}
+
+void DomLayoutItem::setElementLayout(DomLayout* a)
+{
+ clear(false);
+ m_kind = Layout;
+ m_layout = a;
+}
+
+DomSpacer* DomLayoutItem::takeElementSpacer()
+{
+ DomSpacer* a = m_spacer;
+ m_spacer = 0;
+ return a;
+}
+
+void DomLayoutItem::setElementSpacer(DomSpacer* a)
+{
+ clear(false);
+ m_kind = Spacer;
+ m_spacer = a;
+}
+
+void DomRow::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomRow::DomRow()
+{
+ m_children = 0;
+}
+
+DomRow::~DomRow()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+}
+
+void DomRow::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomRow::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("row") : tagName.toLower());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomRow::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomColumn::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomColumn::DomColumn()
+{
+ m_children = 0;
+}
+
+DomColumn::~DomColumn()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+}
+
+void DomColumn::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomColumn::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("column") : tagName.toLower());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomColumn::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomItem::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_item);
+ m_item.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_row = false;
+ m_attr_row = 0;
+ m_has_attr_column = false;
+ m_attr_column = 0;
+ }
+
+ m_children = 0;
+}
+
+DomItem::DomItem()
+{
+ m_children = 0;
+ m_has_attr_row = false;
+ m_attr_row = 0;
+ m_has_attr_column = false;
+ m_attr_column = 0;
+}
+
+DomItem::~DomItem()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_item);
+ m_item.clear();
+}
+
+void DomItem::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("row")) {
+ setAttributeRow(attribute.value().toString().toInt());
+ continue;
+ }
+ if (name == QLatin1String("column")) {
+ setAttributeColumn(attribute.value().toString().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("item")) {
+ DomItem *v = new DomItem();
+ v->read(reader);
+ m_item.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomItem::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("row")))
+ setAttributeRow(node.attribute(QLatin1String("row")).toInt());
+ if (node.hasAttribute(QLatin1String("column")))
+ setAttributeColumn(node.attribute(QLatin1String("column")).toInt());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("item")) {
+ DomItem *v = new DomItem();
+ v->read(e);
+ m_item.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("item") : tagName.toLower());
+
+ if (hasAttributeRow())
+ writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow()));
+
+ if (hasAttributeColumn())
+ writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn()));
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ for (int i = 0; i < m_item.size(); ++i) {
+ DomItem* v = m_item[i];
+ v->write(writer, QLatin1String("item"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomItem::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomItem::setElementItem(const QList<DomItem*>& a)
+{
+ m_children |= Item;
+ m_item = a;
+}
+
+void DomWidget::clear(bool clear_all)
+{
+ m_class.clear();
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_script);
+ m_script.clear();
+ qDeleteAll(m_widgetData);
+ m_widgetData.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+ qDeleteAll(m_row);
+ m_row.clear();
+ qDeleteAll(m_column);
+ m_column.clear();
+ qDeleteAll(m_item);
+ m_item.clear();
+ qDeleteAll(m_layout);
+ m_layout.clear();
+ qDeleteAll(m_widget);
+ m_widget.clear();
+ qDeleteAll(m_action);
+ m_action.clear();
+ qDeleteAll(m_actionGroup);
+ m_actionGroup.clear();
+ qDeleteAll(m_addAction);
+ m_addAction.clear();
+ m_zOrder.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_class = false;
+ m_has_attr_name = false;
+ m_has_attr_native = false;
+ m_attr_native = false;
+ }
+
+ m_children = 0;
+}
+
+DomWidget::DomWidget()
+{
+ m_children = 0;
+ m_has_attr_class = false;
+ m_has_attr_name = false;
+ m_has_attr_native = false;
+ m_attr_native = false;
+}
+
+DomWidget::~DomWidget()
+{
+ m_class.clear();
+ qDeleteAll(m_property);
+ m_property.clear();
+ qDeleteAll(m_script);
+ m_script.clear();
+ qDeleteAll(m_widgetData);
+ m_widgetData.clear();
+ qDeleteAll(m_attribute);
+ m_attribute.clear();
+ qDeleteAll(m_row);
+ m_row.clear();
+ qDeleteAll(m_column);
+ m_column.clear();
+ qDeleteAll(m_item);
+ m_item.clear();
+ qDeleteAll(m_layout);
+ m_layout.clear();
+ qDeleteAll(m_widget);
+ m_widget.clear();
+ qDeleteAll(m_action);
+ m_action.clear();
+ qDeleteAll(m_actionGroup);
+ m_actionGroup.clear();
+ qDeleteAll(m_addAction);
+ m_addAction.clear();
+ m_zOrder.clear();
+}
+
+void DomWidget::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("class")) {
+ setAttributeClass(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("native")) {
+ setAttributeNative((attribute.value().toString() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("class")) {
+ m_class.append(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("script")) {
+ DomScript *v = new DomScript();
+ v->read(reader);
+ m_script.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("widgetdata")) {
+ DomWidgetData *v = new DomWidgetData();
+ v->read(reader);
+ m_widgetData.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_attribute.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("row")) {
+ DomRow *v = new DomRow();
+ v->read(reader);
+ m_row.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("column")) {
+ DomColumn *v = new DomColumn();
+ v->read(reader);
+ m_column.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("item")) {
+ DomItem *v = new DomItem();
+ v->read(reader);
+ m_item.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("layout")) {
+ DomLayout *v = new DomLayout();
+ v->read(reader);
+ m_layout.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("widget")) {
+ DomWidget *v = new DomWidget();
+ v->read(reader);
+ m_widget.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("action")) {
+ DomAction *v = new DomAction();
+ v->read(reader);
+ m_action.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("actiongroup")) {
+ DomActionGroup *v = new DomActionGroup();
+ v->read(reader);
+ m_actionGroup.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("addaction")) {
+ DomActionRef *v = new DomActionRef();
+ v->read(reader);
+ m_addAction.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("zorder")) {
+ m_zOrder.append(reader.readElementText());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomWidget::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("class")))
+ setAttributeClass(node.attribute(QLatin1String("class")));
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+ if (node.hasAttribute(QLatin1String("native")))
+ setAttributeNative((node.attribute(QLatin1String("native")) == QLatin1String("true") ? true : false));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("class")) {
+ m_class.append(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("script")) {
+ DomScript *v = new DomScript();
+ v->read(e);
+ m_script.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("widgetdata")) {
+ DomWidgetData *v = new DomWidgetData();
+ v->read(e);
+ m_widgetData.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("attribute")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_attribute.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("row")) {
+ DomRow *v = new DomRow();
+ v->read(e);
+ m_row.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("column")) {
+ DomColumn *v = new DomColumn();
+ v->read(e);
+ m_column.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("item")) {
+ DomItem *v = new DomItem();
+ v->read(e);
+ m_item.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("layout")) {
+ DomLayout *v = new DomLayout();
+ v->read(e);
+ m_layout.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("widget")) {
+ DomWidget *v = new DomWidget();
+ v->read(e);
+ m_widget.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("action")) {
+ DomAction *v = new DomAction();
+ v->read(e);
+ m_action.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("actiongroup")) {
+ DomActionGroup *v = new DomActionGroup();
+ v->read(e);
+ m_actionGroup.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("addaction")) {
+ DomActionRef *v = new DomActionRef();
+ v->read(e);
+ m_addAction.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("zorder")) {
+ m_zOrder.append(e.text());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widget") : tagName.toLower());
+
+ if (hasAttributeClass())
+ writer.writeAttribute(QLatin1String("class"), attributeClass());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (hasAttributeNative())
+ writer.writeAttribute(QLatin1String("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false")));
+
+ for (int i = 0; i < m_class.size(); ++i) {
+ QString v = m_class[i];
+ writer.writeTextElement(QLatin1String("class"), v);
+ }
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ for (int i = 0; i < m_script.size(); ++i) {
+ DomScript* v = m_script[i];
+ v->write(writer, QLatin1String("script"));
+ }
+ for (int i = 0; i < m_widgetData.size(); ++i) {
+ DomWidgetData* v = m_widgetData[i];
+ v->write(writer, QLatin1String("widgetdata"));
+ }
+ for (int i = 0; i < m_attribute.size(); ++i) {
+ DomProperty* v = m_attribute[i];
+ v->write(writer, QLatin1String("attribute"));
+ }
+ for (int i = 0; i < m_row.size(); ++i) {
+ DomRow* v = m_row[i];
+ v->write(writer, QLatin1String("row"));
+ }
+ for (int i = 0; i < m_column.size(); ++i) {
+ DomColumn* v = m_column[i];
+ v->write(writer, QLatin1String("column"));
+ }
+ for (int i = 0; i < m_item.size(); ++i) {
+ DomItem* v = m_item[i];
+ v->write(writer, QLatin1String("item"));
+ }
+ for (int i = 0; i < m_layout.size(); ++i) {
+ DomLayout* v = m_layout[i];
+ v->write(writer, QLatin1String("layout"));
+ }
+ for (int i = 0; i < m_widget.size(); ++i) {
+ DomWidget* v = m_widget[i];
+ v->write(writer, QLatin1String("widget"));
+ }
+ for (int i = 0; i < m_action.size(); ++i) {
+ DomAction* v = m_action[i];
+ v->write(writer, QLatin1String("action"));
+ }
+ for (int i = 0; i < m_actionGroup.size(); ++i) {
+ DomActionGroup* v = m_actionGroup[i];
+ v->write(writer, QLatin1String("actiongroup"));
+ }
+ for (int i = 0; i < m_addAction.size(); ++i) {
+ DomActionRef* v = m_addAction[i];
+ v->write(writer, QLatin1String("addaction"));
+ }
+ for (int i = 0; i < m_zOrder.size(); ++i) {
+ QString v = m_zOrder[i];
+ writer.writeTextElement(QLatin1String("zorder"), v);
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomWidget::setElementClass(const QStringList& a)
+{
+ m_children |= Class;
+ m_class = a;
+}
+
+void DomWidget::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomWidget::setElementScript(const QList<DomScript*>& a)
+{
+ m_children |= Script;
+ m_script = a;
+}
+
+void DomWidget::setElementWidgetData(const QList<DomWidgetData*>& a)
+{
+ m_children |= WidgetData;
+ m_widgetData = a;
+}
+
+void DomWidget::setElementAttribute(const QList<DomProperty*>& a)
+{
+ m_children |= Attribute;
+ m_attribute = a;
+}
+
+void DomWidget::setElementRow(const QList<DomRow*>& a)
+{
+ m_children |= Row;
+ m_row = a;
+}
+
+void DomWidget::setElementColumn(const QList<DomColumn*>& a)
+{
+ m_children |= Column;
+ m_column = a;
+}
+
+void DomWidget::setElementItem(const QList<DomItem*>& a)
+{
+ m_children |= Item;
+ m_item = a;
+}
+
+void DomWidget::setElementLayout(const QList<DomLayout*>& a)
+{
+ m_children |= Layout;
+ m_layout = a;
+}
+
+void DomWidget::setElementWidget(const QList<DomWidget*>& a)
+{
+ m_children |= Widget;
+ m_widget = a;
+}
+
+void DomWidget::setElementAction(const QList<DomAction*>& a)
+{
+ m_children |= Action;
+ m_action = a;
+}
+
+void DomWidget::setElementActionGroup(const QList<DomActionGroup*>& a)
+{
+ m_children |= ActionGroup;
+ m_actionGroup = a;
+}
+
+void DomWidget::setElementAddAction(const QList<DomActionRef*>& a)
+{
+ m_children |= AddAction;
+ m_addAction = a;
+}
+
+void DomWidget::setElementZOrder(const QStringList& a)
+{
+ m_children |= ZOrder;
+ m_zOrder = a;
+}
+
+void DomSpacer::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ }
+
+ m_children = 0;
+}
+
+DomSpacer::DomSpacer()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+}
+
+DomSpacer::~DomSpacer()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+}
+
+void DomSpacer::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomSpacer::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("spacer") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSpacer::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomColor::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_alpha = false;
+ m_attr_alpha = 0;
+ }
+
+ m_children = 0;
+ m_red = 0;
+ m_green = 0;
+ m_blue = 0;
+}
+
+DomColor::DomColor()
+{
+ m_children = 0;
+ m_has_attr_alpha = false;
+ m_attr_alpha = 0;
+ m_red = 0;
+ m_green = 0;
+ m_blue = 0;
+}
+
+DomColor::~DomColor()
+{
+}
+
+void DomColor::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("alpha")) {
+ setAttributeAlpha(attribute.value().toString().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("red")) {
+ setElementRed(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("green")) {
+ setElementGreen(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("blue")) {
+ setElementBlue(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomColor::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("alpha")))
+ setAttributeAlpha(node.attribute(QLatin1String("alpha")).toInt());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("red")) {
+ setElementRed(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("green")) {
+ setElementGreen(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("blue")) {
+ setElementBlue(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("color") : tagName.toLower());
+
+ if (hasAttributeAlpha())
+ writer.writeAttribute(QLatin1String("alpha"), QString::number(attributeAlpha()));
+
+ if (m_children & Red) {
+ writer.writeTextElement(QLatin1String("red"), QString::number(m_red));
+ }
+
+ if (m_children & Green) {
+ writer.writeTextElement(QLatin1String("green"), QString::number(m_green));
+ }
+
+ if (m_children & Blue) {
+ writer.writeTextElement(QLatin1String("blue"), QString::number(m_blue));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomColor::setElementRed(int a)
+{
+ m_children |= Red;
+ m_red = a;
+}
+
+void DomColor::setElementGreen(int a)
+{
+ m_children |= Green;
+ m_green = a;
+}
+
+void DomColor::setElementBlue(int a)
+{
+ m_children |= Blue;
+ m_blue = a;
+}
+
+void DomColor::clearElementRed()
+{
+ m_children &= ~Red;
+}
+
+void DomColor::clearElementGreen()
+{
+ m_children &= ~Green;
+}
+
+void DomColor::clearElementBlue()
+{
+ m_children &= ~Blue;
+}
+
+void DomGradientStop::clear(bool clear_all)
+{
+ delete m_color;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_position = false;
+ m_attr_position = 0.0;
+ }
+
+ m_children = 0;
+ m_color = 0;
+}
+
+DomGradientStop::DomGradientStop()
+{
+ m_children = 0;
+ m_has_attr_position = false;
+ m_attr_position = 0.0;
+ m_color = 0;
+}
+
+DomGradientStop::~DomGradientStop()
+{
+ delete m_color;
+}
+
+void DomGradientStop::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("position")) {
+ setAttributePosition(attribute.value().toString().toDouble());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(reader);
+ setElementColor(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomGradientStop::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("position")))
+ setAttributePosition(node.attribute(QLatin1String("position")).toDouble());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(e);
+ setElementColor(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradientstop") : tagName.toLower());
+
+ if (hasAttributePosition())
+ writer.writeAttribute(QLatin1String("position"), QString::number(attributePosition(), 'f', 15));
+
+ if (m_children & Color) {
+ m_color->write(writer, QLatin1String("color"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomColor* DomGradientStop::takeElementColor()
+{
+ DomColor* a = m_color;
+ m_color = 0;
+ m_children ^= Color;
+ return a;
+}
+
+void DomGradientStop::setElementColor(DomColor* a)
+{
+ delete m_color;
+ m_children |= Color;
+ m_color = a;
+}
+
+void DomGradientStop::clearElementColor()
+{
+ delete m_color;
+ m_color = 0;
+ m_children &= ~Color;
+}
+
+void DomGradient::clear(bool clear_all)
+{
+ qDeleteAll(m_gradientStop);
+ m_gradientStop.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_startX = false;
+ m_attr_startX = 0.0;
+ m_has_attr_startY = false;
+ m_attr_startY = 0.0;
+ m_has_attr_endX = false;
+ m_attr_endX = 0.0;
+ m_has_attr_endY = false;
+ m_attr_endY = 0.0;
+ m_has_attr_centralX = false;
+ m_attr_centralX = 0.0;
+ m_has_attr_centralY = false;
+ m_attr_centralY = 0.0;
+ m_has_attr_focalX = false;
+ m_attr_focalX = 0.0;
+ m_has_attr_focalY = false;
+ m_attr_focalY = 0.0;
+ m_has_attr_radius = false;
+ m_attr_radius = 0.0;
+ m_has_attr_angle = false;
+ m_attr_angle = 0.0;
+ m_has_attr_type = false;
+ m_has_attr_spread = false;
+ m_has_attr_coordinateMode = false;
+ }
+
+ m_children = 0;
+}
+
+DomGradient::DomGradient()
+{
+ m_children = 0;
+ m_has_attr_startX = false;
+ m_attr_startX = 0.0;
+ m_has_attr_startY = false;
+ m_attr_startY = 0.0;
+ m_has_attr_endX = false;
+ m_attr_endX = 0.0;
+ m_has_attr_endY = false;
+ m_attr_endY = 0.0;
+ m_has_attr_centralX = false;
+ m_attr_centralX = 0.0;
+ m_has_attr_centralY = false;
+ m_attr_centralY = 0.0;
+ m_has_attr_focalX = false;
+ m_attr_focalX = 0.0;
+ m_has_attr_focalY = false;
+ m_attr_focalY = 0.0;
+ m_has_attr_radius = false;
+ m_attr_radius = 0.0;
+ m_has_attr_angle = false;
+ m_attr_angle = 0.0;
+ m_has_attr_type = false;
+ m_has_attr_spread = false;
+ m_has_attr_coordinateMode = false;
+}
+
+DomGradient::~DomGradient()
+{
+ qDeleteAll(m_gradientStop);
+ m_gradientStop.clear();
+}
+
+void DomGradient::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("startx")) {
+ setAttributeStartX(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("starty")) {
+ setAttributeStartY(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("endx")) {
+ setAttributeEndX(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("endy")) {
+ setAttributeEndY(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("centralx")) {
+ setAttributeCentralX(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("centraly")) {
+ setAttributeCentralY(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("focalx")) {
+ setAttributeFocalX(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("focaly")) {
+ setAttributeFocalY(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("radius")) {
+ setAttributeRadius(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("angle")) {
+ setAttributeAngle(attribute.value().toString().toDouble());
+ continue;
+ }
+ if (name == QLatin1String("type")) {
+ setAttributeType(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("spread")) {
+ setAttributeSpread(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("coordinatemode")) {
+ setAttributeCoordinateMode(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("gradientstop")) {
+ DomGradientStop *v = new DomGradientStop();
+ v->read(reader);
+ m_gradientStop.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomGradient::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("startx")))
+ setAttributeStartX(node.attribute(QLatin1String("startx")).toDouble());
+ if (node.hasAttribute(QLatin1String("starty")))
+ setAttributeStartY(node.attribute(QLatin1String("starty")).toDouble());
+ if (node.hasAttribute(QLatin1String("endx")))
+ setAttributeEndX(node.attribute(QLatin1String("endx")).toDouble());
+ if (node.hasAttribute(QLatin1String("endy")))
+ setAttributeEndY(node.attribute(QLatin1String("endy")).toDouble());
+ if (node.hasAttribute(QLatin1String("centralx")))
+ setAttributeCentralX(node.attribute(QLatin1String("centralx")).toDouble());
+ if (node.hasAttribute(QLatin1String("centraly")))
+ setAttributeCentralY(node.attribute(QLatin1String("centraly")).toDouble());
+ if (node.hasAttribute(QLatin1String("focalx")))
+ setAttributeFocalX(node.attribute(QLatin1String("focalx")).toDouble());
+ if (node.hasAttribute(QLatin1String("focaly")))
+ setAttributeFocalY(node.attribute(QLatin1String("focaly")).toDouble());
+ if (node.hasAttribute(QLatin1String("radius")))
+ setAttributeRadius(node.attribute(QLatin1String("radius")).toDouble());
+ if (node.hasAttribute(QLatin1String("angle")))
+ setAttributeAngle(node.attribute(QLatin1String("angle")).toDouble());
+ if (node.hasAttribute(QLatin1String("type")))
+ setAttributeType(node.attribute(QLatin1String("type")));
+ if (node.hasAttribute(QLatin1String("spread")))
+ setAttributeSpread(node.attribute(QLatin1String("spread")));
+ if (node.hasAttribute(QLatin1String("coordinatemode")))
+ setAttributeCoordinateMode(node.attribute(QLatin1String("coordinatemode")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("gradientstop")) {
+ DomGradientStop *v = new DomGradientStop();
+ v->read(e);
+ m_gradientStop.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradient") : tagName.toLower());
+
+ if (hasAttributeStartX())
+ writer.writeAttribute(QLatin1String("startx"), QString::number(attributeStartX(), 'f', 15));
+
+ if (hasAttributeStartY())
+ writer.writeAttribute(QLatin1String("starty"), QString::number(attributeStartY(), 'f', 15));
+
+ if (hasAttributeEndX())
+ writer.writeAttribute(QLatin1String("endx"), QString::number(attributeEndX(), 'f', 15));
+
+ if (hasAttributeEndY())
+ writer.writeAttribute(QLatin1String("endy"), QString::number(attributeEndY(), 'f', 15));
+
+ if (hasAttributeCentralX())
+ writer.writeAttribute(QLatin1String("centralx"), QString::number(attributeCentralX(), 'f', 15));
+
+ if (hasAttributeCentralY())
+ writer.writeAttribute(QLatin1String("centraly"), QString::number(attributeCentralY(), 'f', 15));
+
+ if (hasAttributeFocalX())
+ writer.writeAttribute(QLatin1String("focalx"), QString::number(attributeFocalX(), 'f', 15));
+
+ if (hasAttributeFocalY())
+ writer.writeAttribute(QLatin1String("focaly"), QString::number(attributeFocalY(), 'f', 15));
+
+ if (hasAttributeRadius())
+ writer.writeAttribute(QLatin1String("radius"), QString::number(attributeRadius(), 'f', 15));
+
+ if (hasAttributeAngle())
+ writer.writeAttribute(QLatin1String("angle"), QString::number(attributeAngle(), 'f', 15));
+
+ if (hasAttributeType())
+ writer.writeAttribute(QLatin1String("type"), attributeType());
+
+ if (hasAttributeSpread())
+ writer.writeAttribute(QLatin1String("spread"), attributeSpread());
+
+ if (hasAttributeCoordinateMode())
+ writer.writeAttribute(QLatin1String("coordinatemode"), attributeCoordinateMode());
+
+ for (int i = 0; i < m_gradientStop.size(); ++i) {
+ DomGradientStop* v = m_gradientStop[i];
+ v->write(writer, QLatin1String("gradientstop"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomGradient::setElementGradientStop(const QList<DomGradientStop*>& a)
+{
+ m_children |= GradientStop;
+ m_gradientStop = a;
+}
+
+void DomBrush::clear(bool clear_all)
+{
+ delete m_color;
+ delete m_texture;
+ delete m_gradient;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_brushStyle = false;
+ }
+
+ m_kind = Unknown;
+
+ m_color = 0;
+ m_texture = 0;
+ m_gradient = 0;
+}
+
+DomBrush::DomBrush()
+{
+ m_kind = Unknown;
+
+ m_has_attr_brushStyle = false;
+ m_color = 0;
+ m_texture = 0;
+ m_gradient = 0;
+}
+
+DomBrush::~DomBrush()
+{
+ delete m_color;
+ delete m_texture;
+ delete m_gradient;
+}
+
+void DomBrush::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("brushstyle")) {
+ setAttributeBrushStyle(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(reader);
+ setElementColor(v);
+ continue;
+ }
+ if (tag == QLatin1String("texture")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ setElementTexture(v);
+ continue;
+ }
+ if (tag == QLatin1String("gradient")) {
+ DomGradient *v = new DomGradient();
+ v->read(reader);
+ setElementGradient(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomBrush::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("brushstyle")))
+ setAttributeBrushStyle(node.attribute(QLatin1String("brushstyle")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(e);
+ setElementColor(v);
+ continue;
+ }
+ if (tag == QLatin1String("texture")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ setElementTexture(v);
+ continue;
+ }
+ if (tag == QLatin1String("gradient")) {
+ DomGradient *v = new DomGradient();
+ v->read(e);
+ setElementGradient(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("brush") : tagName.toLower());
+
+ if (hasAttributeBrushStyle())
+ writer.writeAttribute(QLatin1String("brushstyle"), attributeBrushStyle());
+
+ switch (kind()) {
+ case Color: {
+ DomColor* v = elementColor();
+ if (v != 0) {
+ v->write(writer, QLatin1String("color"));
+ }
+ break;
+ }
+ case Texture: {
+ DomProperty* v = elementTexture();
+ if (v != 0) {
+ v->write(writer, QLatin1String("texture"));
+ }
+ break;
+ }
+ case Gradient: {
+ DomGradient* v = elementGradient();
+ if (v != 0) {
+ v->write(writer, QLatin1String("gradient"));
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomColor* DomBrush::takeElementColor()
+{
+ DomColor* a = m_color;
+ m_color = 0;
+ return a;
+}
+
+void DomBrush::setElementColor(DomColor* a)
+{
+ clear(false);
+ m_kind = Color;
+ m_color = a;
+}
+
+DomProperty* DomBrush::takeElementTexture()
+{
+ DomProperty* a = m_texture;
+ m_texture = 0;
+ return a;
+}
+
+void DomBrush::setElementTexture(DomProperty* a)
+{
+ clear(false);
+ m_kind = Texture;
+ m_texture = a;
+}
+
+DomGradient* DomBrush::takeElementGradient()
+{
+ DomGradient* a = m_gradient;
+ m_gradient = 0;
+ return a;
+}
+
+void DomBrush::setElementGradient(DomGradient* a)
+{
+ clear(false);
+ m_kind = Gradient;
+ m_gradient = a;
+}
+
+void DomColorRole::clear(bool clear_all)
+{
+ delete m_brush;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_role = false;
+ }
+
+ m_children = 0;
+ m_brush = 0;
+}
+
+DomColorRole::DomColorRole()
+{
+ m_children = 0;
+ m_has_attr_role = false;
+ m_brush = 0;
+}
+
+DomColorRole::~DomColorRole()
+{
+ delete m_brush;
+}
+
+void DomColorRole::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("role")) {
+ setAttributeRole(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("brush")) {
+ DomBrush *v = new DomBrush();
+ v->read(reader);
+ setElementBrush(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomColorRole::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("role")))
+ setAttributeRole(node.attribute(QLatin1String("role")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("brush")) {
+ DomBrush *v = new DomBrush();
+ v->read(e);
+ setElementBrush(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorrole") : tagName.toLower());
+
+ if (hasAttributeRole())
+ writer.writeAttribute(QLatin1String("role"), attributeRole());
+
+ if (m_children & Brush) {
+ m_brush->write(writer, QLatin1String("brush"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomBrush* DomColorRole::takeElementBrush()
+{
+ DomBrush* a = m_brush;
+ m_brush = 0;
+ m_children ^= Brush;
+ return a;
+}
+
+void DomColorRole::setElementBrush(DomBrush* a)
+{
+ delete m_brush;
+ m_children |= Brush;
+ m_brush = a;
+}
+
+void DomColorRole::clearElementBrush()
+{
+ delete m_brush;
+ m_brush = 0;
+ m_children &= ~Brush;
+}
+
+void DomColorGroup::clear(bool clear_all)
+{
+ qDeleteAll(m_colorRole);
+ m_colorRole.clear();
+ qDeleteAll(m_color);
+ m_color.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomColorGroup::DomColorGroup()
+{
+ m_children = 0;
+}
+
+DomColorGroup::~DomColorGroup()
+{
+ qDeleteAll(m_colorRole);
+ m_colorRole.clear();
+ qDeleteAll(m_color);
+ m_color.clear();
+}
+
+void DomColorGroup::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("colorrole")) {
+ DomColorRole *v = new DomColorRole();
+ v->read(reader);
+ m_colorRole.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(reader);
+ m_color.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomColorGroup::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("colorrole")) {
+ DomColorRole *v = new DomColorRole();
+ v->read(e);
+ m_colorRole.append(v);
+ continue;
+ }
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(e);
+ m_color.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorgroup") : tagName.toLower());
+
+ for (int i = 0; i < m_colorRole.size(); ++i) {
+ DomColorRole* v = m_colorRole[i];
+ v->write(writer, QLatin1String("colorrole"));
+ }
+ for (int i = 0; i < m_color.size(); ++i) {
+ DomColor* v = m_color[i];
+ v->write(writer, QLatin1String("color"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomColorGroup::setElementColorRole(const QList<DomColorRole*>& a)
+{
+ m_children |= ColorRole;
+ m_colorRole = a;
+}
+
+void DomColorGroup::setElementColor(const QList<DomColor*>& a)
+{
+ m_children |= Color;
+ m_color = a;
+}
+
+void DomPalette::clear(bool clear_all)
+{
+ delete m_active;
+ delete m_inactive;
+ delete m_disabled;
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_active = 0;
+ m_inactive = 0;
+ m_disabled = 0;
+}
+
+DomPalette::DomPalette()
+{
+ m_children = 0;
+ m_active = 0;
+ m_inactive = 0;
+ m_disabled = 0;
+}
+
+DomPalette::~DomPalette()
+{
+ delete m_active;
+ delete m_inactive;
+ delete m_disabled;
+}
+
+void DomPalette::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("active")) {
+ DomColorGroup *v = new DomColorGroup();
+ v->read(reader);
+ setElementActive(v);
+ continue;
+ }
+ if (tag == QLatin1String("inactive")) {
+ DomColorGroup *v = new DomColorGroup();
+ v->read(reader);
+ setElementInactive(v);
+ continue;
+ }
+ if (tag == QLatin1String("disabled")) {
+ DomColorGroup *v = new DomColorGroup();
+ v->read(reader);
+ setElementDisabled(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomPalette::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("active")) {
+ DomColorGroup *v = new DomColorGroup();
+ v->read(e);
+ setElementActive(v);
+ continue;
+ }
+ if (tag == QLatin1String("inactive")) {
+ DomColorGroup *v = new DomColorGroup();
+ v->read(e);
+ setElementInactive(v);
+ continue;
+ }
+ if (tag == QLatin1String("disabled")) {
+ DomColorGroup *v = new DomColorGroup();
+ v->read(e);
+ setElementDisabled(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("palette") : tagName.toLower());
+
+ if (m_children & Active) {
+ m_active->write(writer, QLatin1String("active"));
+ }
+
+ if (m_children & Inactive) {
+ m_inactive->write(writer, QLatin1String("inactive"));
+ }
+
+ if (m_children & Disabled) {
+ m_disabled->write(writer, QLatin1String("disabled"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomColorGroup* DomPalette::takeElementActive()
+{
+ DomColorGroup* a = m_active;
+ m_active = 0;
+ m_children ^= Active;
+ return a;
+}
+
+void DomPalette::setElementActive(DomColorGroup* a)
+{
+ delete m_active;
+ m_children |= Active;
+ m_active = a;
+}
+
+DomColorGroup* DomPalette::takeElementInactive()
+{
+ DomColorGroup* a = m_inactive;
+ m_inactive = 0;
+ m_children ^= Inactive;
+ return a;
+}
+
+void DomPalette::setElementInactive(DomColorGroup* a)
+{
+ delete m_inactive;
+ m_children |= Inactive;
+ m_inactive = a;
+}
+
+DomColorGroup* DomPalette::takeElementDisabled()
+{
+ DomColorGroup* a = m_disabled;
+ m_disabled = 0;
+ m_children ^= Disabled;
+ return a;
+}
+
+void DomPalette::setElementDisabled(DomColorGroup* a)
+{
+ delete m_disabled;
+ m_children |= Disabled;
+ m_disabled = a;
+}
+
+void DomPalette::clearElementActive()
+{
+ delete m_active;
+ m_active = 0;
+ m_children &= ~Active;
+}
+
+void DomPalette::clearElementInactive()
+{
+ delete m_inactive;
+ m_inactive = 0;
+ m_children &= ~Inactive;
+}
+
+void DomPalette::clearElementDisabled()
+{
+ delete m_disabled;
+ m_disabled = 0;
+ m_children &= ~Disabled;
+}
+
+void DomFont::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_pointSize = 0;
+ m_weight = 0;
+ m_italic = false;
+ m_bold = false;
+ m_underline = false;
+ m_strikeOut = false;
+ m_antialiasing = false;
+ m_kerning = false;
+}
+
+DomFont::DomFont()
+{
+ m_children = 0;
+ m_pointSize = 0;
+ m_weight = 0;
+ m_italic = false;
+ m_bold = false;
+ m_underline = false;
+ m_strikeOut = false;
+ m_antialiasing = false;
+ m_kerning = false;
+}
+
+DomFont::~DomFont()
+{
+}
+
+void DomFont::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("family")) {
+ setElementFamily(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("pointsize")) {
+ setElementPointSize(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("weight")) {
+ setElementWeight(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("italic")) {
+ setElementItalic((reader.readElementText() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("bold")) {
+ setElementBold((reader.readElementText() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("underline")) {
+ setElementUnderline((reader.readElementText() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("strikeout")) {
+ setElementStrikeOut((reader.readElementText() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("antialiasing")) {
+ setElementAntialiasing((reader.readElementText() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("stylestrategy")) {
+ setElementStyleStrategy(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("kerning")) {
+ setElementKerning((reader.readElementText() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomFont::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("family")) {
+ setElementFamily(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("pointsize")) {
+ setElementPointSize(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("weight")) {
+ setElementWeight(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("italic")) {
+ setElementItalic((e.text() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("bold")) {
+ setElementBold((e.text() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("underline")) {
+ setElementUnderline((e.text() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("strikeout")) {
+ setElementStrikeOut((e.text() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("antialiasing")) {
+ setElementAntialiasing((e.text() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ if (tag == QLatin1String("stylestrategy")) {
+ setElementStyleStrategy(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("kerning")) {
+ setElementKerning((e.text() == QLatin1String("true") ? true : false));
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("font") : tagName.toLower());
+
+ if (m_children & Family) {
+ writer.writeTextElement(QLatin1String("family"), m_family);
+ }
+
+ if (m_children & PointSize) {
+ writer.writeTextElement(QLatin1String("pointsize"), QString::number(m_pointSize));
+ }
+
+ if (m_children & Weight) {
+ writer.writeTextElement(QLatin1String("weight"), QString::number(m_weight));
+ }
+
+ if (m_children & Italic) {
+ writer.writeTextElement(QLatin1String("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false")));
+ }
+
+ if (m_children & Bold) {
+ writer.writeTextElement(QLatin1String("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false")));
+ }
+
+ if (m_children & Underline) {
+ writer.writeTextElement(QLatin1String("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false")));
+ }
+
+ if (m_children & StrikeOut) {
+ writer.writeTextElement(QLatin1String("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false")));
+ }
+
+ if (m_children & Antialiasing) {
+ writer.writeTextElement(QLatin1String("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false")));
+ }
+
+ if (m_children & StyleStrategy) {
+ writer.writeTextElement(QLatin1String("stylestrategy"), m_styleStrategy);
+ }
+
+ if (m_children & Kerning) {
+ writer.writeTextElement(QLatin1String("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false")));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomFont::setElementFamily(const QString& a)
+{
+ m_children |= Family;
+ m_family = a;
+}
+
+void DomFont::setElementPointSize(int a)
+{
+ m_children |= PointSize;
+ m_pointSize = a;
+}
+
+void DomFont::setElementWeight(int a)
+{
+ m_children |= Weight;
+ m_weight = a;
+}
+
+void DomFont::setElementItalic(bool a)
+{
+ m_children |= Italic;
+ m_italic = a;
+}
+
+void DomFont::setElementBold(bool a)
+{
+ m_children |= Bold;
+ m_bold = a;
+}
+
+void DomFont::setElementUnderline(bool a)
+{
+ m_children |= Underline;
+ m_underline = a;
+}
+
+void DomFont::setElementStrikeOut(bool a)
+{
+ m_children |= StrikeOut;
+ m_strikeOut = a;
+}
+
+void DomFont::setElementAntialiasing(bool a)
+{
+ m_children |= Antialiasing;
+ m_antialiasing = a;
+}
+
+void DomFont::setElementStyleStrategy(const QString& a)
+{
+ m_children |= StyleStrategy;
+ m_styleStrategy = a;
+}
+
+void DomFont::setElementKerning(bool a)
+{
+ m_children |= Kerning;
+ m_kerning = a;
+}
+
+void DomFont::clearElementFamily()
+{
+ m_children &= ~Family;
+}
+
+void DomFont::clearElementPointSize()
+{
+ m_children &= ~PointSize;
+}
+
+void DomFont::clearElementWeight()
+{
+ m_children &= ~Weight;
+}
+
+void DomFont::clearElementItalic()
+{
+ m_children &= ~Italic;
+}
+
+void DomFont::clearElementBold()
+{
+ m_children &= ~Bold;
+}
+
+void DomFont::clearElementUnderline()
+{
+ m_children &= ~Underline;
+}
+
+void DomFont::clearElementStrikeOut()
+{
+ m_children &= ~StrikeOut;
+}
+
+void DomFont::clearElementAntialiasing()
+{
+ m_children &= ~Antialiasing;
+}
+
+void DomFont::clearElementStyleStrategy()
+{
+ m_children &= ~StyleStrategy;
+}
+
+void DomFont::clearElementKerning()
+{
+ m_children &= ~Kerning;
+}
+
+void DomPoint::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+}
+
+DomPoint::DomPoint()
+{
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+}
+
+DomPoint::~DomPoint()
+{
+}
+
+void DomPoint::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomPoint::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(e.text().toInt());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("point") : tagName.toLower());
+
+ if (m_children & X) {
+ writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ }
+
+ if (m_children & Y) {
+ writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomPoint::setElementX(int a)
+{
+ m_children |= X;
+ m_x = a;
+}
+
+void DomPoint::setElementY(int a)
+{
+ m_children |= Y;
+ m_y = a;
+}
+
+void DomPoint::clearElementX()
+{
+ m_children &= ~X;
+}
+
+void DomPoint::clearElementY()
+{
+ m_children &= ~Y;
+}
+
+void DomRect::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomRect::DomRect()
+{
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomRect::~DomRect()
+{
+}
+
+void DomRect::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("width")) {
+ setElementWidth(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomRect::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(e.text().toInt());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("width")) {
+ setElementWidth(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rect") : tagName.toLower());
+
+ if (m_children & X) {
+ writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ }
+
+ if (m_children & Y) {
+ writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ }
+
+ if (m_children & Width) {
+ writer.writeTextElement(QLatin1String("width"), QString::number(m_width));
+ }
+
+ if (m_children & Height) {
+ writer.writeTextElement(QLatin1String("height"), QString::number(m_height));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomRect::setElementX(int a)
+{
+ m_children |= X;
+ m_x = a;
+}
+
+void DomRect::setElementY(int a)
+{
+ m_children |= Y;
+ m_y = a;
+}
+
+void DomRect::setElementWidth(int a)
+{
+ m_children |= Width;
+ m_width = a;
+}
+
+void DomRect::setElementHeight(int a)
+{
+ m_children |= Height;
+ m_height = a;
+}
+
+void DomRect::clearElementX()
+{
+ m_children &= ~X;
+}
+
+void DomRect::clearElementY()
+{
+ m_children &= ~Y;
+}
+
+void DomRect::clearElementWidth()
+{
+ m_children &= ~Width;
+}
+
+void DomRect::clearElementHeight()
+{
+ m_children &= ~Height;
+}
+
+void DomLocale::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_language = false;
+ m_has_attr_country = false;
+ }
+
+ m_children = 0;
+}
+
+DomLocale::DomLocale()
+{
+ m_children = 0;
+ m_has_attr_language = false;
+ m_has_attr_country = false;
+}
+
+DomLocale::~DomLocale()
+{
+}
+
+void DomLocale::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("language")) {
+ setAttributeLanguage(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("country")) {
+ setAttributeCountry(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomLocale::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("language")))
+ setAttributeLanguage(node.attribute(QLatin1String("language")));
+ if (node.hasAttribute(QLatin1String("country")))
+ setAttributeCountry(node.attribute(QLatin1String("country")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("locale") : tagName.toLower());
+
+ if (hasAttributeLanguage())
+ writer.writeAttribute(QLatin1String("language"), attributeLanguage());
+
+ if (hasAttributeCountry())
+ writer.writeAttribute(QLatin1String("country"), attributeCountry());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSizePolicy::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_hSizeType = false;
+ m_has_attr_vSizeType = false;
+ }
+
+ m_children = 0;
+ m_hSizeType = 0;
+ m_vSizeType = 0;
+ m_horStretch = 0;
+ m_verStretch = 0;
+}
+
+DomSizePolicy::DomSizePolicy()
+{
+ m_children = 0;
+ m_has_attr_hSizeType = false;
+ m_has_attr_vSizeType = false;
+ m_hSizeType = 0;
+ m_vSizeType = 0;
+ m_horStretch = 0;
+ m_verStretch = 0;
+}
+
+DomSizePolicy::~DomSizePolicy()
+{
+}
+
+void DomSizePolicy::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("hsizetype")) {
+ setAttributeHSizeType(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("vsizetype")) {
+ setAttributeVSizeType(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("hsizetype")) {
+ setElementHSizeType(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("vsizetype")) {
+ setElementVSizeType(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("horstretch")) {
+ setElementHorStretch(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("verstretch")) {
+ setElementVerStretch(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomSizePolicy::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("hsizetype")))
+ setAttributeHSizeType(node.attribute(QLatin1String("hsizetype")));
+ if (node.hasAttribute(QLatin1String("vsizetype")))
+ setAttributeVSizeType(node.attribute(QLatin1String("vsizetype")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("hsizetype")) {
+ setElementHSizeType(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("vsizetype")) {
+ setElementVSizeType(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("horstretch")) {
+ setElementHorStretch(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("verstretch")) {
+ setElementVerStretch(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicy") : tagName.toLower());
+
+ if (hasAttributeHSizeType())
+ writer.writeAttribute(QLatin1String("hsizetype"), attributeHSizeType());
+
+ if (hasAttributeVSizeType())
+ writer.writeAttribute(QLatin1String("vsizetype"), attributeVSizeType());
+
+ if (m_children & HSizeType) {
+ writer.writeTextElement(QLatin1String("hsizetype"), QString::number(m_hSizeType));
+ }
+
+ if (m_children & VSizeType) {
+ writer.writeTextElement(QLatin1String("vsizetype"), QString::number(m_vSizeType));
+ }
+
+ if (m_children & HorStretch) {
+ writer.writeTextElement(QLatin1String("horstretch"), QString::number(m_horStretch));
+ }
+
+ if (m_children & VerStretch) {
+ writer.writeTextElement(QLatin1String("verstretch"), QString::number(m_verStretch));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSizePolicy::setElementHSizeType(int a)
+{
+ m_children |= HSizeType;
+ m_hSizeType = a;
+}
+
+void DomSizePolicy::setElementVSizeType(int a)
+{
+ m_children |= VSizeType;
+ m_vSizeType = a;
+}
+
+void DomSizePolicy::setElementHorStretch(int a)
+{
+ m_children |= HorStretch;
+ m_horStretch = a;
+}
+
+void DomSizePolicy::setElementVerStretch(int a)
+{
+ m_children |= VerStretch;
+ m_verStretch = a;
+}
+
+void DomSizePolicy::clearElementHSizeType()
+{
+ m_children &= ~HSizeType;
+}
+
+void DomSizePolicy::clearElementVSizeType()
+{
+ m_children &= ~VSizeType;
+}
+
+void DomSizePolicy::clearElementHorStretch()
+{
+ m_children &= ~HorStretch;
+}
+
+void DomSizePolicy::clearElementVerStretch()
+{
+ m_children &= ~VerStretch;
+}
+
+void DomSize::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomSize::DomSize()
+{
+ m_children = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomSize::~DomSize()
+{
+}
+
+void DomSize::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("width")) {
+ setElementWidth(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomSize::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("width")) {
+ setElementWidth(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("size") : tagName.toLower());
+
+ if (m_children & Width) {
+ writer.writeTextElement(QLatin1String("width"), QString::number(m_width));
+ }
+
+ if (m_children & Height) {
+ writer.writeTextElement(QLatin1String("height"), QString::number(m_height));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSize::setElementWidth(int a)
+{
+ m_children |= Width;
+ m_width = a;
+}
+
+void DomSize::setElementHeight(int a)
+{
+ m_children |= Height;
+ m_height = a;
+}
+
+void DomSize::clearElementWidth()
+{
+ m_children &= ~Width;
+}
+
+void DomSize::clearElementHeight()
+{
+ m_children &= ~Height;
+}
+
+void DomDate::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_year = 0;
+ m_month = 0;
+ m_day = 0;
+}
+
+DomDate::DomDate()
+{
+ m_children = 0;
+ m_year = 0;
+ m_month = 0;
+ m_day = 0;
+}
+
+DomDate::~DomDate()
+{
+}
+
+void DomDate::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("year")) {
+ setElementYear(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("month")) {
+ setElementMonth(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("day")) {
+ setElementDay(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomDate::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("year")) {
+ setElementYear(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("month")) {
+ setElementMonth(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("day")) {
+ setElementDay(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("date") : tagName.toLower());
+
+ if (m_children & Year) {
+ writer.writeTextElement(QLatin1String("year"), QString::number(m_year));
+ }
+
+ if (m_children & Month) {
+ writer.writeTextElement(QLatin1String("month"), QString::number(m_month));
+ }
+
+ if (m_children & Day) {
+ writer.writeTextElement(QLatin1String("day"), QString::number(m_day));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomDate::setElementYear(int a)
+{
+ m_children |= Year;
+ m_year = a;
+}
+
+void DomDate::setElementMonth(int a)
+{
+ m_children |= Month;
+ m_month = a;
+}
+
+void DomDate::setElementDay(int a)
+{
+ m_children |= Day;
+ m_day = a;
+}
+
+void DomDate::clearElementYear()
+{
+ m_children &= ~Year;
+}
+
+void DomDate::clearElementMonth()
+{
+ m_children &= ~Month;
+}
+
+void DomDate::clearElementDay()
+{
+ m_children &= ~Day;
+}
+
+void DomTime::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_hour = 0;
+ m_minute = 0;
+ m_second = 0;
+}
+
+DomTime::DomTime()
+{
+ m_children = 0;
+ m_hour = 0;
+ m_minute = 0;
+ m_second = 0;
+}
+
+DomTime::~DomTime()
+{
+}
+
+void DomTime::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("hour")) {
+ setElementHour(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("minute")) {
+ setElementMinute(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("second")) {
+ setElementSecond(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomTime::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("hour")) {
+ setElementHour(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("minute")) {
+ setElementMinute(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("second")) {
+ setElementSecond(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("time") : tagName.toLower());
+
+ if (m_children & Hour) {
+ writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour));
+ }
+
+ if (m_children & Minute) {
+ writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute));
+ }
+
+ if (m_children & Second) {
+ writer.writeTextElement(QLatin1String("second"), QString::number(m_second));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomTime::setElementHour(int a)
+{
+ m_children |= Hour;
+ m_hour = a;
+}
+
+void DomTime::setElementMinute(int a)
+{
+ m_children |= Minute;
+ m_minute = a;
+}
+
+void DomTime::setElementSecond(int a)
+{
+ m_children |= Second;
+ m_second = a;
+}
+
+void DomTime::clearElementHour()
+{
+ m_children &= ~Hour;
+}
+
+void DomTime::clearElementMinute()
+{
+ m_children &= ~Minute;
+}
+
+void DomTime::clearElementSecond()
+{
+ m_children &= ~Second;
+}
+
+void DomDateTime::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_hour = 0;
+ m_minute = 0;
+ m_second = 0;
+ m_year = 0;
+ m_month = 0;
+ m_day = 0;
+}
+
+DomDateTime::DomDateTime()
+{
+ m_children = 0;
+ m_hour = 0;
+ m_minute = 0;
+ m_second = 0;
+ m_year = 0;
+ m_month = 0;
+ m_day = 0;
+}
+
+DomDateTime::~DomDateTime()
+{
+}
+
+void DomDateTime::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("hour")) {
+ setElementHour(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("minute")) {
+ setElementMinute(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("second")) {
+ setElementSecond(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("year")) {
+ setElementYear(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("month")) {
+ setElementMonth(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("day")) {
+ setElementDay(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomDateTime::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("hour")) {
+ setElementHour(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("minute")) {
+ setElementMinute(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("second")) {
+ setElementSecond(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("year")) {
+ setElementYear(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("month")) {
+ setElementMonth(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("day")) {
+ setElementDay(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("datetime") : tagName.toLower());
+
+ if (m_children & Hour) {
+ writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour));
+ }
+
+ if (m_children & Minute) {
+ writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute));
+ }
+
+ if (m_children & Second) {
+ writer.writeTextElement(QLatin1String("second"), QString::number(m_second));
+ }
+
+ if (m_children & Year) {
+ writer.writeTextElement(QLatin1String("year"), QString::number(m_year));
+ }
+
+ if (m_children & Month) {
+ writer.writeTextElement(QLatin1String("month"), QString::number(m_month));
+ }
+
+ if (m_children & Day) {
+ writer.writeTextElement(QLatin1String("day"), QString::number(m_day));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomDateTime::setElementHour(int a)
+{
+ m_children |= Hour;
+ m_hour = a;
+}
+
+void DomDateTime::setElementMinute(int a)
+{
+ m_children |= Minute;
+ m_minute = a;
+}
+
+void DomDateTime::setElementSecond(int a)
+{
+ m_children |= Second;
+ m_second = a;
+}
+
+void DomDateTime::setElementYear(int a)
+{
+ m_children |= Year;
+ m_year = a;
+}
+
+void DomDateTime::setElementMonth(int a)
+{
+ m_children |= Month;
+ m_month = a;
+}
+
+void DomDateTime::setElementDay(int a)
+{
+ m_children |= Day;
+ m_day = a;
+}
+
+void DomDateTime::clearElementHour()
+{
+ m_children &= ~Hour;
+}
+
+void DomDateTime::clearElementMinute()
+{
+ m_children &= ~Minute;
+}
+
+void DomDateTime::clearElementSecond()
+{
+ m_children &= ~Second;
+}
+
+void DomDateTime::clearElementYear()
+{
+ m_children &= ~Year;
+}
+
+void DomDateTime::clearElementMonth()
+{
+ m_children &= ~Month;
+}
+
+void DomDateTime::clearElementDay()
+{
+ m_children &= ~Day;
+}
+
+void DomStringList::clear(bool clear_all)
+{
+ m_string.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomStringList::DomStringList()
+{
+ m_children = 0;
+}
+
+DomStringList::~DomStringList()
+{
+ m_string.clear();
+}
+
+void DomStringList::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("string")) {
+ m_string.append(reader.readElementText());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomStringList::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("string")) {
+ m_string.append(e.text());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringlist") : tagName.toLower());
+
+ for (int i = 0; i < m_string.size(); ++i) {
+ QString v = m_string[i];
+ writer.writeTextElement(QLatin1String("string"), v);
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomStringList::setElementString(const QStringList& a)
+{
+ m_children |= String;
+ m_string = a;
+}
+
+void DomResourcePixmap::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text = QLatin1String("");
+ m_has_attr_resource = false;
+ m_has_attr_alias = false;
+ }
+
+ m_children = 0;
+}
+
+DomResourcePixmap::DomResourcePixmap()
+{
+ m_children = 0;
+ m_has_attr_resource = false;
+ m_has_attr_alias = false;
+ m_text = QLatin1String("");
+}
+
+DomResourcePixmap::~DomResourcePixmap()
+{
+}
+
+void DomResourcePixmap::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("resource")) {
+ setAttributeResource(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("alias")) {
+ setAttributeAlias(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomResourcePixmap::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("resource")))
+ setAttributeResource(node.attribute(QLatin1String("resource")));
+ if (node.hasAttribute(QLatin1String("alias")))
+ setAttributeAlias(node.attribute(QLatin1String("alias")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text = QLatin1String("");
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourcepixmap") : tagName.toLower());
+
+ if (hasAttributeResource())
+ writer.writeAttribute(QLatin1String("resource"), attributeResource());
+
+ if (hasAttributeAlias())
+ writer.writeAttribute(QLatin1String("alias"), attributeAlias());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomResourceIcon::clear(bool clear_all)
+{
+ delete m_normalOff;
+ delete m_normalOn;
+ delete m_disabledOff;
+ delete m_disabledOn;
+ delete m_activeOff;
+ delete m_activeOn;
+ delete m_selectedOff;
+ delete m_selectedOn;
+
+ if (clear_all) {
+ m_text = QLatin1String("");
+ m_has_attr_theme = false;
+ m_has_attr_resource = false;
+ }
+
+ m_children = 0;
+ m_normalOff = 0;
+ m_normalOn = 0;
+ m_disabledOff = 0;
+ m_disabledOn = 0;
+ m_activeOff = 0;
+ m_activeOn = 0;
+ m_selectedOff = 0;
+ m_selectedOn = 0;
+}
+
+DomResourceIcon::DomResourceIcon()
+{
+ m_children = 0;
+ m_has_attr_theme = false;
+ m_has_attr_resource = false;
+ m_text = QLatin1String("");
+ m_normalOff = 0;
+ m_normalOn = 0;
+ m_disabledOff = 0;
+ m_disabledOn = 0;
+ m_activeOff = 0;
+ m_activeOn = 0;
+ m_selectedOff = 0;
+ m_selectedOn = 0;
+}
+
+DomResourceIcon::~DomResourceIcon()
+{
+ delete m_normalOff;
+ delete m_normalOn;
+ delete m_disabledOff;
+ delete m_disabledOn;
+ delete m_activeOff;
+ delete m_activeOn;
+ delete m_selectedOff;
+ delete m_selectedOn;
+}
+
+void DomResourceIcon::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("theme")) {
+ setAttributeTheme(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("resource")) {
+ setAttributeResource(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("normaloff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementNormalOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("normalon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementNormalOn(v);
+ continue;
+ }
+ if (tag == QLatin1String("disabledoff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementDisabledOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("disabledon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementDisabledOn(v);
+ continue;
+ }
+ if (tag == QLatin1String("activeoff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementActiveOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("activeon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementActiveOn(v);
+ continue;
+ }
+ if (tag == QLatin1String("selectedoff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementSelectedOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("selectedon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementSelectedOn(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomResourceIcon::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("theme")))
+ setAttributeTheme(node.attribute(QLatin1String("theme")));
+ if (node.hasAttribute(QLatin1String("resource")))
+ setAttributeResource(node.attribute(QLatin1String("resource")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("normaloff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementNormalOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("normalon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementNormalOn(v);
+ continue;
+ }
+ if (tag == QLatin1String("disabledoff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementDisabledOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("disabledon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementDisabledOn(v);
+ continue;
+ }
+ if (tag == QLatin1String("activeoff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementActiveOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("activeon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementActiveOn(v);
+ continue;
+ }
+ if (tag == QLatin1String("selectedoff")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementSelectedOff(v);
+ continue;
+ }
+ if (tag == QLatin1String("selectedon")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementSelectedOn(v);
+ continue;
+ }
+ }
+ m_text = QLatin1String("");
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourceicon") : tagName.toLower());
+
+ if (hasAttributeTheme())
+ writer.writeAttribute(QLatin1String("theme"), attributeTheme());
+
+ if (hasAttributeResource())
+ writer.writeAttribute(QLatin1String("resource"), attributeResource());
+
+ if (m_children & NormalOff) {
+ m_normalOff->write(writer, QLatin1String("normaloff"));
+ }
+
+ if (m_children & NormalOn) {
+ m_normalOn->write(writer, QLatin1String("normalon"));
+ }
+
+ if (m_children & DisabledOff) {
+ m_disabledOff->write(writer, QLatin1String("disabledoff"));
+ }
+
+ if (m_children & DisabledOn) {
+ m_disabledOn->write(writer, QLatin1String("disabledon"));
+ }
+
+ if (m_children & ActiveOff) {
+ m_activeOff->write(writer, QLatin1String("activeoff"));
+ }
+
+ if (m_children & ActiveOn) {
+ m_activeOn->write(writer, QLatin1String("activeon"));
+ }
+
+ if (m_children & SelectedOff) {
+ m_selectedOff->write(writer, QLatin1String("selectedoff"));
+ }
+
+ if (m_children & SelectedOn) {
+ m_selectedOn->write(writer, QLatin1String("selectedon"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementNormalOff()
+{
+ DomResourcePixmap* a = m_normalOff;
+ m_normalOff = 0;
+ m_children ^= NormalOff;
+ return a;
+}
+
+void DomResourceIcon::setElementNormalOff(DomResourcePixmap* a)
+{
+ delete m_normalOff;
+ m_children |= NormalOff;
+ m_normalOff = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementNormalOn()
+{
+ DomResourcePixmap* a = m_normalOn;
+ m_normalOn = 0;
+ m_children ^= NormalOn;
+ return a;
+}
+
+void DomResourceIcon::setElementNormalOn(DomResourcePixmap* a)
+{
+ delete m_normalOn;
+ m_children |= NormalOn;
+ m_normalOn = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementDisabledOff()
+{
+ DomResourcePixmap* a = m_disabledOff;
+ m_disabledOff = 0;
+ m_children ^= DisabledOff;
+ return a;
+}
+
+void DomResourceIcon::setElementDisabledOff(DomResourcePixmap* a)
+{
+ delete m_disabledOff;
+ m_children |= DisabledOff;
+ m_disabledOff = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementDisabledOn()
+{
+ DomResourcePixmap* a = m_disabledOn;
+ m_disabledOn = 0;
+ m_children ^= DisabledOn;
+ return a;
+}
+
+void DomResourceIcon::setElementDisabledOn(DomResourcePixmap* a)
+{
+ delete m_disabledOn;
+ m_children |= DisabledOn;
+ m_disabledOn = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementActiveOff()
+{
+ DomResourcePixmap* a = m_activeOff;
+ m_activeOff = 0;
+ m_children ^= ActiveOff;
+ return a;
+}
+
+void DomResourceIcon::setElementActiveOff(DomResourcePixmap* a)
+{
+ delete m_activeOff;
+ m_children |= ActiveOff;
+ m_activeOff = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementActiveOn()
+{
+ DomResourcePixmap* a = m_activeOn;
+ m_activeOn = 0;
+ m_children ^= ActiveOn;
+ return a;
+}
+
+void DomResourceIcon::setElementActiveOn(DomResourcePixmap* a)
+{
+ delete m_activeOn;
+ m_children |= ActiveOn;
+ m_activeOn = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementSelectedOff()
+{
+ DomResourcePixmap* a = m_selectedOff;
+ m_selectedOff = 0;
+ m_children ^= SelectedOff;
+ return a;
+}
+
+void DomResourceIcon::setElementSelectedOff(DomResourcePixmap* a)
+{
+ delete m_selectedOff;
+ m_children |= SelectedOff;
+ m_selectedOff = a;
+}
+
+DomResourcePixmap* DomResourceIcon::takeElementSelectedOn()
+{
+ DomResourcePixmap* a = m_selectedOn;
+ m_selectedOn = 0;
+ m_children ^= SelectedOn;
+ return a;
+}
+
+void DomResourceIcon::setElementSelectedOn(DomResourcePixmap* a)
+{
+ delete m_selectedOn;
+ m_children |= SelectedOn;
+ m_selectedOn = a;
+}
+
+void DomResourceIcon::clearElementNormalOff()
+{
+ delete m_normalOff;
+ m_normalOff = 0;
+ m_children &= ~NormalOff;
+}
+
+void DomResourceIcon::clearElementNormalOn()
+{
+ delete m_normalOn;
+ m_normalOn = 0;
+ m_children &= ~NormalOn;
+}
+
+void DomResourceIcon::clearElementDisabledOff()
+{
+ delete m_disabledOff;
+ m_disabledOff = 0;
+ m_children &= ~DisabledOff;
+}
+
+void DomResourceIcon::clearElementDisabledOn()
+{
+ delete m_disabledOn;
+ m_disabledOn = 0;
+ m_children &= ~DisabledOn;
+}
+
+void DomResourceIcon::clearElementActiveOff()
+{
+ delete m_activeOff;
+ m_activeOff = 0;
+ m_children &= ~ActiveOff;
+}
+
+void DomResourceIcon::clearElementActiveOn()
+{
+ delete m_activeOn;
+ m_activeOn = 0;
+ m_children &= ~ActiveOn;
+}
+
+void DomResourceIcon::clearElementSelectedOff()
+{
+ delete m_selectedOff;
+ m_selectedOff = 0;
+ m_children &= ~SelectedOff;
+}
+
+void DomResourceIcon::clearElementSelectedOn()
+{
+ delete m_selectedOn;
+ m_selectedOn = 0;
+ m_children &= ~SelectedOn;
+}
+
+void DomString::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text = QLatin1String("");
+ m_has_attr_notr = false;
+ m_has_attr_comment = false;
+ m_has_attr_extraComment = false;
+ }
+
+ m_children = 0;
+}
+
+DomString::DomString()
+{
+ m_children = 0;
+ m_has_attr_notr = false;
+ m_has_attr_comment = false;
+ m_has_attr_extraComment = false;
+ m_text = QLatin1String("");
+}
+
+DomString::~DomString()
+{
+}
+
+void DomString::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("notr")) {
+ setAttributeNotr(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("comment")) {
+ setAttributeComment(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("extracomment")) {
+ setAttributeExtraComment(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomString::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("notr")))
+ setAttributeNotr(node.attribute(QLatin1String("notr")));
+ if (node.hasAttribute(QLatin1String("comment")))
+ setAttributeComment(node.attribute(QLatin1String("comment")));
+ if (node.hasAttribute(QLatin1String("extracomment")))
+ setAttributeExtraComment(node.attribute(QLatin1String("extracomment")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text = QLatin1String("");
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("string") : tagName.toLower());
+
+ if (hasAttributeNotr())
+ writer.writeAttribute(QLatin1String("notr"), attributeNotr());
+
+ if (hasAttributeComment())
+ writer.writeAttribute(QLatin1String("comment"), attributeComment());
+
+ if (hasAttributeExtraComment())
+ writer.writeAttribute(QLatin1String("extracomment"), attributeExtraComment());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomPointF::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+}
+
+DomPointF::DomPointF()
+{
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+}
+
+DomPointF::~DomPointF()
+{
+}
+
+void DomPointF::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(reader.readElementText().toDouble());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(reader.readElementText().toDouble());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomPointF::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(e.text().toDouble());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(e.text().toDouble());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("pointf") : tagName.toLower());
+
+ if (m_children & X) {
+ writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
+ }
+
+ if (m_children & Y) {
+ writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomPointF::setElementX(double a)
+{
+ m_children |= X;
+ m_x = a;
+}
+
+void DomPointF::setElementY(double a)
+{
+ m_children |= Y;
+ m_y = a;
+}
+
+void DomPointF::clearElementX()
+{
+ m_children &= ~X;
+}
+
+void DomPointF::clearElementY()
+{
+ m_children &= ~Y;
+}
+
+void DomRectF::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomRectF::DomRectF()
+{
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomRectF::~DomRectF()
+{
+}
+
+void DomRectF::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(reader.readElementText().toDouble());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(reader.readElementText().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("width")) {
+ setElementWidth(reader.readElementText().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(reader.readElementText().toDouble());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomRectF::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(e.text().toDouble());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(e.text().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("width")) {
+ setElementWidth(e.text().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(e.text().toDouble());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rectf") : tagName.toLower());
+
+ if (m_children & X) {
+ writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
+ }
+
+ if (m_children & Y) {
+ writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
+ }
+
+ if (m_children & Width) {
+ writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15));
+ }
+
+ if (m_children & Height) {
+ writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomRectF::setElementX(double a)
+{
+ m_children |= X;
+ m_x = a;
+}
+
+void DomRectF::setElementY(double a)
+{
+ m_children |= Y;
+ m_y = a;
+}
+
+void DomRectF::setElementWidth(double a)
+{
+ m_children |= Width;
+ m_width = a;
+}
+
+void DomRectF::setElementHeight(double a)
+{
+ m_children |= Height;
+ m_height = a;
+}
+
+void DomRectF::clearElementX()
+{
+ m_children &= ~X;
+}
+
+void DomRectF::clearElementY()
+{
+ m_children &= ~Y;
+}
+
+void DomRectF::clearElementWidth()
+{
+ m_children &= ~Width;
+}
+
+void DomRectF::clearElementHeight()
+{
+ m_children &= ~Height;
+}
+
+void DomSizeF::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomSizeF::DomSizeF()
+{
+ m_children = 0;
+ m_width = 0;
+ m_height = 0;
+}
+
+DomSizeF::~DomSizeF()
+{
+}
+
+void DomSizeF::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("width")) {
+ setElementWidth(reader.readElementText().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(reader.readElementText().toDouble());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomSizeF::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("width")) {
+ setElementWidth(e.text().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("height")) {
+ setElementHeight(e.text().toDouble());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizef") : tagName.toLower());
+
+ if (m_children & Width) {
+ writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15));
+ }
+
+ if (m_children & Height) {
+ writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSizeF::setElementWidth(double a)
+{
+ m_children |= Width;
+ m_width = a;
+}
+
+void DomSizeF::setElementHeight(double a)
+{
+ m_children |= Height;
+ m_height = a;
+}
+
+void DomSizeF::clearElementWidth()
+{
+ m_children &= ~Width;
+}
+
+void DomSizeF::clearElementHeight()
+{
+ m_children &= ~Height;
+}
+
+void DomChar::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_unicode = 0;
+}
+
+DomChar::DomChar()
+{
+ m_children = 0;
+ m_unicode = 0;
+}
+
+DomChar::~DomChar()
+{
+}
+
+void DomChar::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("unicode")) {
+ setElementUnicode(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomChar::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("unicode")) {
+ setElementUnicode(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("char") : tagName.toLower());
+
+ if (m_children & Unicode) {
+ writer.writeTextElement(QLatin1String("unicode"), QString::number(m_unicode));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomChar::setElementUnicode(int a)
+{
+ m_children |= Unicode;
+ m_unicode = a;
+}
+
+void DomChar::clearElementUnicode()
+{
+ m_children &= ~Unicode;
+}
+
+void DomUrl::clear(bool clear_all)
+{
+ delete m_string;
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_string = 0;
+}
+
+DomUrl::DomUrl()
+{
+ m_children = 0;
+ m_string = 0;
+}
+
+DomUrl::~DomUrl()
+{
+ delete m_string;
+}
+
+void DomUrl::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("string")) {
+ DomString *v = new DomString();
+ v->read(reader);
+ setElementString(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomUrl::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("string")) {
+ DomString *v = new DomString();
+ v->read(e);
+ setElementString(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("url") : tagName.toLower());
+
+ if (m_children & String) {
+ m_string->write(writer, QLatin1String("string"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+DomString* DomUrl::takeElementString()
+{
+ DomString* a = m_string;
+ m_string = 0;
+ m_children ^= String;
+ return a;
+}
+
+void DomUrl::setElementString(DomString* a)
+{
+ delete m_string;
+ m_children |= String;
+ m_string = a;
+}
+
+void DomUrl::clearElementString()
+{
+ delete m_string;
+ m_string = 0;
+ m_children &= ~String;
+}
+
+void DomProperty::clear(bool clear_all)
+{
+ delete m_color;
+ delete m_font;
+ delete m_iconSet;
+ delete m_pixmap;
+ delete m_palette;
+ delete m_point;
+ delete m_rect;
+ delete m_locale;
+ delete m_sizePolicy;
+ delete m_size;
+ delete m_string;
+ delete m_stringList;
+ delete m_date;
+ delete m_time;
+ delete m_dateTime;
+ delete m_pointF;
+ delete m_rectF;
+ delete m_sizeF;
+ delete m_char;
+ delete m_url;
+ delete m_brush;
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ m_has_attr_stdset = false;
+ m_attr_stdset = 0;
+ }
+
+ m_kind = Unknown;
+
+ m_color = 0;
+ m_cursor = 0;
+ m_font = 0;
+ m_iconSet = 0;
+ m_pixmap = 0;
+ m_palette = 0;
+ m_point = 0;
+ m_rect = 0;
+ m_locale = 0;
+ m_sizePolicy = 0;
+ m_size = 0;
+ m_string = 0;
+ m_stringList = 0;
+ m_number = 0;
+ m_float = 0.0;
+ m_double = 0;
+ m_date = 0;
+ m_time = 0;
+ m_dateTime = 0;
+ m_pointF = 0;
+ m_rectF = 0;
+ m_sizeF = 0;
+ m_longLong = 0;
+ m_char = 0;
+ m_url = 0;
+ m_UInt = 0;
+ m_uLongLong = 0;
+ m_brush = 0;
+}
+
+DomProperty::DomProperty()
+{
+ m_kind = Unknown;
+
+ m_has_attr_name = false;
+ m_has_attr_stdset = false;
+ m_attr_stdset = 0;
+ m_color = 0;
+ m_cursor = 0;
+ m_font = 0;
+ m_iconSet = 0;
+ m_pixmap = 0;
+ m_palette = 0;
+ m_point = 0;
+ m_rect = 0;
+ m_locale = 0;
+ m_sizePolicy = 0;
+ m_size = 0;
+ m_string = 0;
+ m_stringList = 0;
+ m_number = 0;
+ m_float = 0.0;
+ m_double = 0;
+ m_date = 0;
+ m_time = 0;
+ m_dateTime = 0;
+ m_pointF = 0;
+ m_rectF = 0;
+ m_sizeF = 0;
+ m_longLong = 0;
+ m_char = 0;
+ m_url = 0;
+ m_UInt = 0;
+ m_uLongLong = 0;
+ m_brush = 0;
+}
+
+DomProperty::~DomProperty()
+{
+ delete m_color;
+ delete m_font;
+ delete m_iconSet;
+ delete m_pixmap;
+ delete m_palette;
+ delete m_point;
+ delete m_rect;
+ delete m_locale;
+ delete m_sizePolicy;
+ delete m_size;
+ delete m_string;
+ delete m_stringList;
+ delete m_date;
+ delete m_time;
+ delete m_dateTime;
+ delete m_pointF;
+ delete m_rectF;
+ delete m_sizeF;
+ delete m_char;
+ delete m_url;
+ delete m_brush;
+}
+
+void DomProperty::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("stdset")) {
+ setAttributeStdset(attribute.value().toString().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("bool")) {
+ setElementBool(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(reader);
+ setElementColor(v);
+ continue;
+ }
+ if (tag == QLatin1String("cstring")) {
+ setElementCstring(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("cursor")) {
+ setElementCursor(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("cursorshape")) {
+ setElementCursorShape(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("enum")) {
+ setElementEnum(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("font")) {
+ DomFont *v = new DomFont();
+ v->read(reader);
+ setElementFont(v);
+ continue;
+ }
+ if (tag == QLatin1String("iconset")) {
+ DomResourceIcon *v = new DomResourceIcon();
+ v->read(reader);
+ setElementIconSet(v);
+ continue;
+ }
+ if (tag == QLatin1String("pixmap")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(reader);
+ setElementPixmap(v);
+ continue;
+ }
+ if (tag == QLatin1String("palette")) {
+ DomPalette *v = new DomPalette();
+ v->read(reader);
+ setElementPalette(v);
+ continue;
+ }
+ if (tag == QLatin1String("point")) {
+ DomPoint *v = new DomPoint();
+ v->read(reader);
+ setElementPoint(v);
+ continue;
+ }
+ if (tag == QLatin1String("rect")) {
+ DomRect *v = new DomRect();
+ v->read(reader);
+ setElementRect(v);
+ continue;
+ }
+ if (tag == QLatin1String("set")) {
+ setElementSet(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("locale")) {
+ DomLocale *v = new DomLocale();
+ v->read(reader);
+ setElementLocale(v);
+ continue;
+ }
+ if (tag == QLatin1String("sizepolicy")) {
+ DomSizePolicy *v = new DomSizePolicy();
+ v->read(reader);
+ setElementSizePolicy(v);
+ continue;
+ }
+ if (tag == QLatin1String("size")) {
+ DomSize *v = new DomSize();
+ v->read(reader);
+ setElementSize(v);
+ continue;
+ }
+ if (tag == QLatin1String("string")) {
+ DomString *v = new DomString();
+ v->read(reader);
+ setElementString(v);
+ continue;
+ }
+ if (tag == QLatin1String("stringlist")) {
+ DomStringList *v = new DomStringList();
+ v->read(reader);
+ setElementStringList(v);
+ continue;
+ }
+ if (tag == QLatin1String("number")) {
+ setElementNumber(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("float")) {
+ setElementFloat(reader.readElementText().toFloat());
+ continue;
+ }
+ if (tag == QLatin1String("double")) {
+ setElementDouble(reader.readElementText().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("date")) {
+ DomDate *v = new DomDate();
+ v->read(reader);
+ setElementDate(v);
+ continue;
+ }
+ if (tag == QLatin1String("time")) {
+ DomTime *v = new DomTime();
+ v->read(reader);
+ setElementTime(v);
+ continue;
+ }
+ if (tag == QLatin1String("datetime")) {
+ DomDateTime *v = new DomDateTime();
+ v->read(reader);
+ setElementDateTime(v);
+ continue;
+ }
+ if (tag == QLatin1String("pointf")) {
+ DomPointF *v = new DomPointF();
+ v->read(reader);
+ setElementPointF(v);
+ continue;
+ }
+ if (tag == QLatin1String("rectf")) {
+ DomRectF *v = new DomRectF();
+ v->read(reader);
+ setElementRectF(v);
+ continue;
+ }
+ if (tag == QLatin1String("sizef")) {
+ DomSizeF *v = new DomSizeF();
+ v->read(reader);
+ setElementSizeF(v);
+ continue;
+ }
+ if (tag == QLatin1String("longlong")) {
+ setElementLongLong(reader.readElementText().toLongLong());
+ continue;
+ }
+ if (tag == QLatin1String("char")) {
+ DomChar *v = new DomChar();
+ v->read(reader);
+ setElementChar(v);
+ continue;
+ }
+ if (tag == QLatin1String("url")) {
+ DomUrl *v = new DomUrl();
+ v->read(reader);
+ setElementUrl(v);
+ continue;
+ }
+ if (tag == QLatin1String("uint")) {
+ setElementUInt(reader.readElementText().toUInt());
+ continue;
+ }
+ if (tag == QLatin1String("ulonglong")) {
+ setElementULongLong(reader.readElementText().toULongLong());
+ continue;
+ }
+ if (tag == QLatin1String("brush")) {
+ DomBrush *v = new DomBrush();
+ v->read(reader);
+ setElementBrush(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomProperty::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+ if (node.hasAttribute(QLatin1String("stdset")))
+ setAttributeStdset(node.attribute(QLatin1String("stdset")).toInt());
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("bool")) {
+ setElementBool(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("color")) {
+ DomColor *v = new DomColor();
+ v->read(e);
+ setElementColor(v);
+ continue;
+ }
+ if (tag == QLatin1String("cstring")) {
+ setElementCstring(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("cursor")) {
+ setElementCursor(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("cursorshape")) {
+ setElementCursorShape(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("enum")) {
+ setElementEnum(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("font")) {
+ DomFont *v = new DomFont();
+ v->read(e);
+ setElementFont(v);
+ continue;
+ }
+ if (tag == QLatin1String("iconset")) {
+ DomResourceIcon *v = new DomResourceIcon();
+ v->read(e);
+ setElementIconSet(v);
+ continue;
+ }
+ if (tag == QLatin1String("pixmap")) {
+ DomResourcePixmap *v = new DomResourcePixmap();
+ v->read(e);
+ setElementPixmap(v);
+ continue;
+ }
+ if (tag == QLatin1String("palette")) {
+ DomPalette *v = new DomPalette();
+ v->read(e);
+ setElementPalette(v);
+ continue;
+ }
+ if (tag == QLatin1String("point")) {
+ DomPoint *v = new DomPoint();
+ v->read(e);
+ setElementPoint(v);
+ continue;
+ }
+ if (tag == QLatin1String("rect")) {
+ DomRect *v = new DomRect();
+ v->read(e);
+ setElementRect(v);
+ continue;
+ }
+ if (tag == QLatin1String("set")) {
+ setElementSet(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("locale")) {
+ DomLocale *v = new DomLocale();
+ v->read(e);
+ setElementLocale(v);
+ continue;
+ }
+ if (tag == QLatin1String("sizepolicy")) {
+ DomSizePolicy *v = new DomSizePolicy();
+ v->read(e);
+ setElementSizePolicy(v);
+ continue;
+ }
+ if (tag == QLatin1String("size")) {
+ DomSize *v = new DomSize();
+ v->read(e);
+ setElementSize(v);
+ continue;
+ }
+ if (tag == QLatin1String("string")) {
+ DomString *v = new DomString();
+ v->read(e);
+ setElementString(v);
+ continue;
+ }
+ if (tag == QLatin1String("stringlist")) {
+ DomStringList *v = new DomStringList();
+ v->read(e);
+ setElementStringList(v);
+ continue;
+ }
+ if (tag == QLatin1String("number")) {
+ setElementNumber(e.text().toInt());
+ continue;
+ }
+ if (tag == QLatin1String("float")) {
+ setElementFloat(e.text().toFloat());
+ continue;
+ }
+ if (tag == QLatin1String("double")) {
+ setElementDouble(e.text().toDouble());
+ continue;
+ }
+ if (tag == QLatin1String("date")) {
+ DomDate *v = new DomDate();
+ v->read(e);
+ setElementDate(v);
+ continue;
+ }
+ if (tag == QLatin1String("time")) {
+ DomTime *v = new DomTime();
+ v->read(e);
+ setElementTime(v);
+ continue;
+ }
+ if (tag == QLatin1String("datetime")) {
+ DomDateTime *v = new DomDateTime();
+ v->read(e);
+ setElementDateTime(v);
+ continue;
+ }
+ if (tag == QLatin1String("pointf")) {
+ DomPointF *v = new DomPointF();
+ v->read(e);
+ setElementPointF(v);
+ continue;
+ }
+ if (tag == QLatin1String("rectf")) {
+ DomRectF *v = new DomRectF();
+ v->read(e);
+ setElementRectF(v);
+ continue;
+ }
+ if (tag == QLatin1String("sizef")) {
+ DomSizeF *v = new DomSizeF();
+ v->read(e);
+ setElementSizeF(v);
+ continue;
+ }
+ if (tag == QLatin1String("longlong")) {
+ setElementLongLong(e.text().toLongLong());
+ continue;
+ }
+ if (tag == QLatin1String("char")) {
+ DomChar *v = new DomChar();
+ v->read(e);
+ setElementChar(v);
+ continue;
+ }
+ if (tag == QLatin1String("url")) {
+ DomUrl *v = new DomUrl();
+ v->read(e);
+ setElementUrl(v);
+ continue;
+ }
+ if (tag == QLatin1String("uint")) {
+ setElementUInt(e.text().toUInt());
+ continue;
+ }
+ if (tag == QLatin1String("ulonglong")) {
+ setElementULongLong(e.text().toULongLong());
+ continue;
+ }
+ if (tag == QLatin1String("brush")) {
+ DomBrush *v = new DomBrush();
+ v->read(e);
+ setElementBrush(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("property") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (hasAttributeStdset())
+ writer.writeAttribute(QLatin1String("stdset"), QString::number(attributeStdset()));
+
+ switch (kind()) {
+ case Bool: {
+ writer.writeTextElement(QLatin1String("bool"), elementBool());
+ break;
+ }
+ case Color: {
+ DomColor* v = elementColor();
+ if (v != 0) {
+ v->write(writer, QLatin1String("color"));
+ }
+ break;
+ }
+ case Cstring: {
+ writer.writeTextElement(QLatin1String("cstring"), elementCstring());
+ break;
+ }
+ case Cursor: {
+ writer.writeTextElement(QLatin1String("cursor"), QString::number(elementCursor()));
+ break;
+ }
+ case CursorShape: {
+ writer.writeTextElement(QLatin1String("cursorShape"), elementCursorShape());
+ break;
+ }
+ case Enum: {
+ writer.writeTextElement(QLatin1String("enum"), elementEnum());
+ break;
+ }
+ case Font: {
+ DomFont* v = elementFont();
+ if (v != 0) {
+ v->write(writer, QLatin1String("font"));
+ }
+ break;
+ }
+ case IconSet: {
+ DomResourceIcon* v = elementIconSet();
+ if (v != 0) {
+ v->write(writer, QLatin1String("iconset"));
+ }
+ break;
+ }
+ case Pixmap: {
+ DomResourcePixmap* v = elementPixmap();
+ if (v != 0) {
+ v->write(writer, QLatin1String("pixmap"));
+ }
+ break;
+ }
+ case Palette: {
+ DomPalette* v = elementPalette();
+ if (v != 0) {
+ v->write(writer, QLatin1String("palette"));
+ }
+ break;
+ }
+ case Point: {
+ DomPoint* v = elementPoint();
+ if (v != 0) {
+ v->write(writer, QLatin1String("point"));
+ }
+ break;
+ }
+ case Rect: {
+ DomRect* v = elementRect();
+ if (v != 0) {
+ v->write(writer, QLatin1String("rect"));
+ }
+ break;
+ }
+ case Set: {
+ writer.writeTextElement(QLatin1String("set"), elementSet());
+ break;
+ }
+ case Locale: {
+ DomLocale* v = elementLocale();
+ if (v != 0) {
+ v->write(writer, QLatin1String("locale"));
+ }
+ break;
+ }
+ case SizePolicy: {
+ DomSizePolicy* v = elementSizePolicy();
+ if (v != 0) {
+ v->write(writer, QLatin1String("sizepolicy"));
+ }
+ break;
+ }
+ case Size: {
+ DomSize* v = elementSize();
+ if (v != 0) {
+ v->write(writer, QLatin1String("size"));
+ }
+ break;
+ }
+ case String: {
+ DomString* v = elementString();
+ if (v != 0) {
+ v->write(writer, QLatin1String("string"));
+ }
+ break;
+ }
+ case StringList: {
+ DomStringList* v = elementStringList();
+ if (v != 0) {
+ v->write(writer, QLatin1String("stringlist"));
+ }
+ break;
+ }
+ case Number: {
+ writer.writeTextElement(QLatin1String("number"), QString::number(elementNumber()));
+ break;
+ }
+ case Float: {
+ writer.writeTextElement(QLatin1String("float"), QString::number(elementFloat(), 'f', 8));
+ break;
+ }
+ case Double: {
+ writer.writeTextElement(QLatin1String("double"), QString::number(elementDouble(), 'f', 15));
+ break;
+ }
+ case Date: {
+ DomDate* v = elementDate();
+ if (v != 0) {
+ v->write(writer, QLatin1String("date"));
+ }
+ break;
+ }
+ case Time: {
+ DomTime* v = elementTime();
+ if (v != 0) {
+ v->write(writer, QLatin1String("time"));
+ }
+ break;
+ }
+ case DateTime: {
+ DomDateTime* v = elementDateTime();
+ if (v != 0) {
+ v->write(writer, QLatin1String("datetime"));
+ }
+ break;
+ }
+ case PointF: {
+ DomPointF* v = elementPointF();
+ if (v != 0) {
+ v->write(writer, QLatin1String("pointf"));
+ }
+ break;
+ }
+ case RectF: {
+ DomRectF* v = elementRectF();
+ if (v != 0) {
+ v->write(writer, QLatin1String("rectf"));
+ }
+ break;
+ }
+ case SizeF: {
+ DomSizeF* v = elementSizeF();
+ if (v != 0) {
+ v->write(writer, QLatin1String("sizef"));
+ }
+ break;
+ }
+ case LongLong: {
+ writer.writeTextElement(QLatin1String("longLong"), QString::number(elementLongLong()));
+ break;
+ }
+ case Char: {
+ DomChar* v = elementChar();
+ if (v != 0) {
+ v->write(writer, QLatin1String("char"));
+ }
+ break;
+ }
+ case Url: {
+ DomUrl* v = elementUrl();
+ if (v != 0) {
+ v->write(writer, QLatin1String("url"));
+ }
+ break;
+ }
+ case UInt: {
+ writer.writeTextElement(QLatin1String("UInt"), QString::number(elementUInt()));
+ break;
+ }
+ case ULongLong: {
+ writer.writeTextElement(QLatin1String("uLongLong"), QString::number(elementULongLong()));
+ break;
+ }
+ case Brush: {
+ DomBrush* v = elementBrush();
+ if (v != 0) {
+ v->write(writer, QLatin1String("brush"));
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomProperty::setElementBool(const QString& a)
+{
+ clear(false);
+ m_kind = Bool;
+ m_bool = a;
+}
+
+DomColor* DomProperty::takeElementColor()
+{
+ DomColor* a = m_color;
+ m_color = 0;
+ return a;
+}
+
+void DomProperty::setElementColor(DomColor* a)
+{
+ clear(false);
+ m_kind = Color;
+ m_color = a;
+}
+
+void DomProperty::setElementCstring(const QString& a)
+{
+ clear(false);
+ m_kind = Cstring;
+ m_cstring = a;
+}
+
+void DomProperty::setElementCursor(int a)
+{
+ clear(false);
+ m_kind = Cursor;
+ m_cursor = a;
+}
+
+void DomProperty::setElementCursorShape(const QString& a)
+{
+ clear(false);
+ m_kind = CursorShape;
+ m_cursorShape = a;
+}
+
+void DomProperty::setElementEnum(const QString& a)
+{
+ clear(false);
+ m_kind = Enum;
+ m_enum = a;
+}
+
+DomFont* DomProperty::takeElementFont()
+{
+ DomFont* a = m_font;
+ m_font = 0;
+ return a;
+}
+
+void DomProperty::setElementFont(DomFont* a)
+{
+ clear(false);
+ m_kind = Font;
+ m_font = a;
+}
+
+DomResourceIcon* DomProperty::takeElementIconSet()
+{
+ DomResourceIcon* a = m_iconSet;
+ m_iconSet = 0;
+ return a;
+}
+
+void DomProperty::setElementIconSet(DomResourceIcon* a)
+{
+ clear(false);
+ m_kind = IconSet;
+ m_iconSet = a;
+}
+
+DomResourcePixmap* DomProperty::takeElementPixmap()
+{
+ DomResourcePixmap* a = m_pixmap;
+ m_pixmap = 0;
+ return a;
+}
+
+void DomProperty::setElementPixmap(DomResourcePixmap* a)
+{
+ clear(false);
+ m_kind = Pixmap;
+ m_pixmap = a;
+}
+
+DomPalette* DomProperty::takeElementPalette()
+{
+ DomPalette* a = m_palette;
+ m_palette = 0;
+ return a;
+}
+
+void DomProperty::setElementPalette(DomPalette* a)
+{
+ clear(false);
+ m_kind = Palette;
+ m_palette = a;
+}
+
+DomPoint* DomProperty::takeElementPoint()
+{
+ DomPoint* a = m_point;
+ m_point = 0;
+ return a;
+}
+
+void DomProperty::setElementPoint(DomPoint* a)
+{
+ clear(false);
+ m_kind = Point;
+ m_point = a;
+}
+
+DomRect* DomProperty::takeElementRect()
+{
+ DomRect* a = m_rect;
+ m_rect = 0;
+ return a;
+}
+
+void DomProperty::setElementRect(DomRect* a)
+{
+ clear(false);
+ m_kind = Rect;
+ m_rect = a;
+}
+
+void DomProperty::setElementSet(const QString& a)
+{
+ clear(false);
+ m_kind = Set;
+ m_set = a;
+}
+
+DomLocale* DomProperty::takeElementLocale()
+{
+ DomLocale* a = m_locale;
+ m_locale = 0;
+ return a;
+}
+
+void DomProperty::setElementLocale(DomLocale* a)
+{
+ clear(false);
+ m_kind = Locale;
+ m_locale = a;
+}
+
+DomSizePolicy* DomProperty::takeElementSizePolicy()
+{
+ DomSizePolicy* a = m_sizePolicy;
+ m_sizePolicy = 0;
+ return a;
+}
+
+void DomProperty::setElementSizePolicy(DomSizePolicy* a)
+{
+ clear(false);
+ m_kind = SizePolicy;
+ m_sizePolicy = a;
+}
+
+DomSize* DomProperty::takeElementSize()
+{
+ DomSize* a = m_size;
+ m_size = 0;
+ return a;
+}
+
+void DomProperty::setElementSize(DomSize* a)
+{
+ clear(false);
+ m_kind = Size;
+ m_size = a;
+}
+
+DomString* DomProperty::takeElementString()
+{
+ DomString* a = m_string;
+ m_string = 0;
+ return a;
+}
+
+void DomProperty::setElementString(DomString* a)
+{
+ clear(false);
+ m_kind = String;
+ m_string = a;
+}
+
+DomStringList* DomProperty::takeElementStringList()
+{
+ DomStringList* a = m_stringList;
+ m_stringList = 0;
+ return a;
+}
+
+void DomProperty::setElementStringList(DomStringList* a)
+{
+ clear(false);
+ m_kind = StringList;
+ m_stringList = a;
+}
+
+void DomProperty::setElementNumber(int a)
+{
+ clear(false);
+ m_kind = Number;
+ m_number = a;
+}
+
+void DomProperty::setElementFloat(float a)
+{
+ clear(false);
+ m_kind = Float;
+ m_float = a;
+}
+
+void DomProperty::setElementDouble(double a)
+{
+ clear(false);
+ m_kind = Double;
+ m_double = a;
+}
+
+DomDate* DomProperty::takeElementDate()
+{
+ DomDate* a = m_date;
+ m_date = 0;
+ return a;
+}
+
+void DomProperty::setElementDate(DomDate* a)
+{
+ clear(false);
+ m_kind = Date;
+ m_date = a;
+}
+
+DomTime* DomProperty::takeElementTime()
+{
+ DomTime* a = m_time;
+ m_time = 0;
+ return a;
+}
+
+void DomProperty::setElementTime(DomTime* a)
+{
+ clear(false);
+ m_kind = Time;
+ m_time = a;
+}
+
+DomDateTime* DomProperty::takeElementDateTime()
+{
+ DomDateTime* a = m_dateTime;
+ m_dateTime = 0;
+ return a;
+}
+
+void DomProperty::setElementDateTime(DomDateTime* a)
+{
+ clear(false);
+ m_kind = DateTime;
+ m_dateTime = a;
+}
+
+DomPointF* DomProperty::takeElementPointF()
+{
+ DomPointF* a = m_pointF;
+ m_pointF = 0;
+ return a;
+}
+
+void DomProperty::setElementPointF(DomPointF* a)
+{
+ clear(false);
+ m_kind = PointF;
+ m_pointF = a;
+}
+
+DomRectF* DomProperty::takeElementRectF()
+{
+ DomRectF* a = m_rectF;
+ m_rectF = 0;
+ return a;
+}
+
+void DomProperty::setElementRectF(DomRectF* a)
+{
+ clear(false);
+ m_kind = RectF;
+ m_rectF = a;
+}
+
+DomSizeF* DomProperty::takeElementSizeF()
+{
+ DomSizeF* a = m_sizeF;
+ m_sizeF = 0;
+ return a;
+}
+
+void DomProperty::setElementSizeF(DomSizeF* a)
+{
+ clear(false);
+ m_kind = SizeF;
+ m_sizeF = a;
+}
+
+void DomProperty::setElementLongLong(qlonglong a)
+{
+ clear(false);
+ m_kind = LongLong;
+ m_longLong = a;
+}
+
+DomChar* DomProperty::takeElementChar()
+{
+ DomChar* a = m_char;
+ m_char = 0;
+ return a;
+}
+
+void DomProperty::setElementChar(DomChar* a)
+{
+ clear(false);
+ m_kind = Char;
+ m_char = a;
+}
+
+DomUrl* DomProperty::takeElementUrl()
+{
+ DomUrl* a = m_url;
+ m_url = 0;
+ return a;
+}
+
+void DomProperty::setElementUrl(DomUrl* a)
+{
+ clear(false);
+ m_kind = Url;
+ m_url = a;
+}
+
+void DomProperty::setElementUInt(uint a)
+{
+ clear(false);
+ m_kind = UInt;
+ m_UInt = a;
+}
+
+void DomProperty::setElementULongLong(qulonglong a)
+{
+ clear(false);
+ m_kind = ULongLong;
+ m_uLongLong = a;
+}
+
+DomBrush* DomProperty::takeElementBrush()
+{
+ DomBrush* a = m_brush;
+ m_brush = 0;
+ return a;
+}
+
+void DomProperty::setElementBrush(DomBrush* a)
+{
+ clear(false);
+ m_kind = Brush;
+ m_brush = a;
+}
+
+void DomConnections::clear(bool clear_all)
+{
+ qDeleteAll(m_connection);
+ m_connection.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomConnections::DomConnections()
+{
+ m_children = 0;
+}
+
+DomConnections::~DomConnections()
+{
+ qDeleteAll(m_connection);
+ m_connection.clear();
+}
+
+void DomConnections::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("connection")) {
+ DomConnection *v = new DomConnection();
+ v->read(reader);
+ m_connection.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomConnections::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("connection")) {
+ DomConnection *v = new DomConnection();
+ v->read(e);
+ m_connection.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connections") : tagName.toLower());
+
+ for (int i = 0; i < m_connection.size(); ++i) {
+ DomConnection* v = m_connection[i];
+ v->write(writer, QLatin1String("connection"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomConnections::setElementConnection(const QList<DomConnection*>& a)
+{
+ m_children |= Connection;
+ m_connection = a;
+}
+
+void DomConnection::clear(bool clear_all)
+{
+ delete m_hints;
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+ m_hints = 0;
+}
+
+DomConnection::DomConnection()
+{
+ m_children = 0;
+ m_hints = 0;
+}
+
+DomConnection::~DomConnection()
+{
+ delete m_hints;
+}
+
+void DomConnection::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("sender")) {
+ setElementSender(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("signal")) {
+ setElementSignal(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("receiver")) {
+ setElementReceiver(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("slot")) {
+ setElementSlot(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("hints")) {
+ DomConnectionHints *v = new DomConnectionHints();
+ v->read(reader);
+ setElementHints(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomConnection::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("sender")) {
+ setElementSender(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("signal")) {
+ setElementSignal(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("receiver")) {
+ setElementReceiver(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("slot")) {
+ setElementSlot(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("hints")) {
+ DomConnectionHints *v = new DomConnectionHints();
+ v->read(e);
+ setElementHints(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connection") : tagName.toLower());
+
+ if (m_children & Sender) {
+ writer.writeTextElement(QLatin1String("sender"), m_sender);
+ }
+
+ if (m_children & Signal) {
+ writer.writeTextElement(QLatin1String("signal"), m_signal);
+ }
+
+ if (m_children & Receiver) {
+ writer.writeTextElement(QLatin1String("receiver"), m_receiver);
+ }
+
+ if (m_children & Slot) {
+ writer.writeTextElement(QLatin1String("slot"), m_slot);
+ }
+
+ if (m_children & Hints) {
+ m_hints->write(writer, QLatin1String("hints"));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomConnection::setElementSender(const QString& a)
+{
+ m_children |= Sender;
+ m_sender = a;
+}
+
+void DomConnection::setElementSignal(const QString& a)
+{
+ m_children |= Signal;
+ m_signal = a;
+}
+
+void DomConnection::setElementReceiver(const QString& a)
+{
+ m_children |= Receiver;
+ m_receiver = a;
+}
+
+void DomConnection::setElementSlot(const QString& a)
+{
+ m_children |= Slot;
+ m_slot = a;
+}
+
+DomConnectionHints* DomConnection::takeElementHints()
+{
+ DomConnectionHints* a = m_hints;
+ m_hints = 0;
+ m_children ^= Hints;
+ return a;
+}
+
+void DomConnection::setElementHints(DomConnectionHints* a)
+{
+ delete m_hints;
+ m_children |= Hints;
+ m_hints = a;
+}
+
+void DomConnection::clearElementSender()
+{
+ m_children &= ~Sender;
+}
+
+void DomConnection::clearElementSignal()
+{
+ m_children &= ~Signal;
+}
+
+void DomConnection::clearElementReceiver()
+{
+ m_children &= ~Receiver;
+}
+
+void DomConnection::clearElementSlot()
+{
+ m_children &= ~Slot;
+}
+
+void DomConnection::clearElementHints()
+{
+ delete m_hints;
+ m_hints = 0;
+ m_children &= ~Hints;
+}
+
+void DomConnectionHints::clear(bool clear_all)
+{
+ qDeleteAll(m_hint);
+ m_hint.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomConnectionHints::DomConnectionHints()
+{
+ m_children = 0;
+}
+
+DomConnectionHints::~DomConnectionHints()
+{
+ qDeleteAll(m_hint);
+ m_hint.clear();
+}
+
+void DomConnectionHints::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("hint")) {
+ DomConnectionHint *v = new DomConnectionHint();
+ v->read(reader);
+ m_hint.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomConnectionHints::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("hint")) {
+ DomConnectionHint *v = new DomConnectionHint();
+ v->read(e);
+ m_hint.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhints") : tagName.toLower());
+
+ for (int i = 0; i < m_hint.size(); ++i) {
+ DomConnectionHint* v = m_hint[i];
+ v->write(writer, QLatin1String("hint"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomConnectionHints::setElementHint(const QList<DomConnectionHint*>& a)
+{
+ m_children |= Hint;
+ m_hint = a;
+}
+
+void DomConnectionHint::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_type = false;
+ }
+
+ m_children = 0;
+ m_x = 0;
+ m_y = 0;
+}
+
+DomConnectionHint::DomConnectionHint()
+{
+ m_children = 0;
+ m_has_attr_type = false;
+ m_x = 0;
+ m_y = 0;
+}
+
+DomConnectionHint::~DomConnectionHint()
+{
+}
+
+void DomConnectionHint::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("type")) {
+ setAttributeType(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(reader.readElementText().toInt());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(reader.readElementText().toInt());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomConnectionHint::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("type")))
+ setAttributeType(node.attribute(QLatin1String("type")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QString(QLatin1Char('x'))) {
+ setElementX(e.text().toInt());
+ continue;
+ }
+ if (tag == QString(QLatin1Char('y'))) {
+ setElementY(e.text().toInt());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhint") : tagName.toLower());
+
+ if (hasAttributeType())
+ writer.writeAttribute(QLatin1String("type"), attributeType());
+
+ if (m_children & X) {
+ writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ }
+
+ if (m_children & Y) {
+ writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ }
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomConnectionHint::setElementX(int a)
+{
+ m_children |= X;
+ m_x = a;
+}
+
+void DomConnectionHint::setElementY(int a)
+{
+ m_children |= Y;
+ m_y = a;
+}
+
+void DomConnectionHint::clearElementX()
+{
+ m_children &= ~X;
+}
+
+void DomConnectionHint::clearElementY()
+{
+ m_children &= ~Y;
+}
+
+void DomScript::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_source = false;
+ m_has_attr_language = false;
+ }
+
+ m_children = 0;
+}
+
+DomScript::DomScript()
+{
+ m_children = 0;
+ m_has_attr_source = false;
+ m_has_attr_language = false;
+}
+
+DomScript::~DomScript()
+{
+}
+
+void DomScript::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("source")) {
+ setAttributeSource(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("language")) {
+ setAttributeLanguage(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomScript::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("source")))
+ setAttributeSource(node.attribute(QLatin1String("source")));
+ if (node.hasAttribute(QLatin1String("language")))
+ setAttributeLanguage(node.attribute(QLatin1String("language")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("script") : tagName.toLower());
+
+ if (hasAttributeSource())
+ writer.writeAttribute(QLatin1String("source"), attributeSource());
+
+ if (hasAttributeLanguage())
+ writer.writeAttribute(QLatin1String("language"), attributeLanguage());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomWidgetData::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomWidgetData::DomWidgetData()
+{
+ m_children = 0;
+}
+
+DomWidgetData::~DomWidgetData()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+}
+
+void DomWidgetData::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomWidgetData::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widgetdata") : tagName.toLower());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomWidgetData::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomDesignerData::clear(bool clear_all)
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomDesignerData::DomDesignerData()
+{
+ m_children = 0;
+}
+
+DomDesignerData::~DomDesignerData()
+{
+ qDeleteAll(m_property);
+ m_property.clear();
+}
+
+void DomDesignerData::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(reader);
+ m_property.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomDesignerData::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("property")) {
+ DomProperty *v = new DomProperty();
+ v->read(e);
+ m_property.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("designerdata") : tagName.toLower());
+
+ for (int i = 0; i < m_property.size(); ++i) {
+ DomProperty* v = m_property[i];
+ v->write(writer, QLatin1String("property"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomDesignerData::setElementProperty(const QList<DomProperty*>& a)
+{
+ m_children |= Property;
+ m_property = a;
+}
+
+void DomSlots::clear(bool clear_all)
+{
+ m_signal.clear();
+ m_slot.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomSlots::DomSlots()
+{
+ m_children = 0;
+}
+
+DomSlots::~DomSlots()
+{
+ m_signal.clear();
+ m_slot.clear();
+}
+
+void DomSlots::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("signal")) {
+ m_signal.append(reader.readElementText());
+ continue;
+ }
+ if (tag == QLatin1String("slot")) {
+ m_slot.append(reader.readElementText());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomSlots::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("signal")) {
+ m_signal.append(e.text());
+ continue;
+ }
+ if (tag == QLatin1String("slot")) {
+ m_slot.append(e.text());
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("slots") : tagName.toLower());
+
+ for (int i = 0; i < m_signal.size(); ++i) {
+ QString v = m_signal[i];
+ writer.writeTextElement(QLatin1String("signal"), v);
+ }
+ for (int i = 0; i < m_slot.size(); ++i) {
+ QString v = m_slot[i];
+ writer.writeTextElement(QLatin1String("slot"), v);
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomSlots::setElementSignal(const QStringList& a)
+{
+ m_children |= Signal;
+ m_signal = a;
+}
+
+void DomSlots::setElementSlot(const QStringList& a)
+{
+ m_children |= Slot;
+ m_slot = a;
+}
+
+void DomPropertySpecifications::clear(bool clear_all)
+{
+ qDeleteAll(m_stringpropertyspecification);
+ m_stringpropertyspecification.clear();
+
+ if (clear_all) {
+ m_text.clear();
+ }
+
+ m_children = 0;
+}
+
+DomPropertySpecifications::DomPropertySpecifications()
+{
+ m_children = 0;
+}
+
+DomPropertySpecifications::~DomPropertySpecifications()
+{
+ qDeleteAll(m_stringpropertyspecification);
+ m_stringpropertyspecification.clear();
+}
+
+void DomPropertySpecifications::read(QXmlStreamReader &reader)
+{
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ if (tag == QLatin1String("stringpropertyspecification")) {
+ DomStringPropertySpecification *v = new DomStringPropertySpecification();
+ v->read(reader);
+ m_stringpropertyspecification.append(v);
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomPropertySpecifications::read(const QDomElement &node)
+{
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ if (tag == QLatin1String("stringpropertyspecification")) {
+ DomStringPropertySpecification *v = new DomStringPropertySpecification();
+ v->read(e);
+ m_stringpropertyspecification.append(v);
+ continue;
+ }
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower());
+
+ for (int i = 0; i < m_stringpropertyspecification.size(); ++i) {
+ DomStringPropertySpecification* v = m_stringpropertyspecification[i];
+ v->write(writer, QLatin1String("stringpropertyspecification"));
+ }
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a)
+{
+ m_children |= Stringpropertyspecification;
+ m_stringpropertyspecification = a;
+}
+
+void DomStringPropertySpecification::clear(bool clear_all)
+{
+
+ if (clear_all) {
+ m_text.clear();
+ m_has_attr_name = false;
+ m_has_attr_type = false;
+ m_has_attr_notr = false;
+ }
+
+ m_children = 0;
+}
+
+DomStringPropertySpecification::DomStringPropertySpecification()
+{
+ m_children = 0;
+ m_has_attr_name = false;
+ m_has_attr_type = false;
+ m_has_attr_notr = false;
+}
+
+DomStringPropertySpecification::~DomStringPropertySpecification()
+{
+}
+
+void DomStringPropertySpecification::read(QXmlStreamReader &reader)
+{
+
+ foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
+ QStringRef name = attribute.name();
+ if (name == QLatin1String("name")) {
+ setAttributeName(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("type")) {
+ setAttributeType(attribute.value().toString());
+ continue;
+ }
+ if (name == QLatin1String("notr")) {
+ setAttributeNotr(attribute.value().toString());
+ continue;
+ }
+ reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ }
+
+ for (bool finished = false; !finished && !reader.hasError();) {
+ switch (reader.readNext()) {
+ case QXmlStreamReader::StartElement : {
+ const QString tag = reader.name().toString().toLower();
+ reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ }
+ break;
+ case QXmlStreamReader::EndElement :
+ finished = true;
+ break;
+ case QXmlStreamReader::Characters :
+ if (!reader.isWhitespace())
+ m_text.append(reader.text().toString());
+ break;
+ default :
+ break;
+ }
+ }
+}
+
+#ifdef QUILOADER_QDOM_READ
+void DomStringPropertySpecification::read(const QDomElement &node)
+{
+ if (node.hasAttribute(QLatin1String("name")))
+ setAttributeName(node.attribute(QLatin1String("name")));
+ if (node.hasAttribute(QLatin1String("type")))
+ setAttributeType(node.attribute(QLatin1String("type")));
+ if (node.hasAttribute(QLatin1String("notr")))
+ setAttributeNotr(node.attribute(QLatin1String("notr")));
+
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ if (!n.isElement())
+ continue;
+ QDomElement e = n.toElement();
+ QString tag = e.tagName().toLower();
+ }
+ m_text.clear();
+ for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
+ if (child.isText())
+ m_text.append(child.nodeValue());
+ }
+}
+#endif
+
+void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
+{
+ writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower());
+
+ if (hasAttributeName())
+ writer.writeAttribute(QLatin1String("name"), attributeName());
+
+ if (hasAttributeType())
+ writer.writeAttribute(QLatin1String("type"), attributeType());
+
+ if (hasAttributeNotr())
+ writer.writeAttribute(QLatin1String("notr"), attributeNotr());
+
+ if (!m_text.isEmpty())
+ writer.writeCharacters(m_text);
+
+ writer.writeEndElement();
+}
+
+QT_END_NAMESPACE
+
diff --git a/tools/uilib/ui4_p.h b/tools/uilib/ui4_p.h
new file mode 100644
index 0000000000..6caf515893
--- /dev/null
+++ b/tools/uilib/ui4_p.h
@@ -0,0 +1,3807 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of Qt Designer. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// THIS FILE IS AUTOMATICALLY GENERATED
+
+#ifndef UI4_H
+#define UI4_H
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QXmlStreamReader>
+#include <QtCore/QXmlStreamWriter>
+#include <QtCore/qglobal.h>
+
+#if defined(QT_UIC3)
+ #define QUILOADER_QDOM_READ
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QUILOADER_QDOM_READ
+ class QDomElement;
+#endif
+
+
+#define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT
+#define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT
+
+#if defined(QT_DESIGNER_STATIC) || defined(QT_UIC) || defined(QT_UIC3)
+# define QDESIGNER_UILIB_EXPORT
+#elif defined(QDESIGNER_UILIB_LIBRARY)
+# define QDESIGNER_UILIB_EXPORT QDESIGNER_UILIB_EXTERN
+#else
+# define QDESIGNER_UILIB_EXPORT QDESIGNER_UILIB_IMPORT
+#endif
+
+#ifndef QDESIGNER_UILIB_EXPORT
+# define QDESIGNER_UILIB_EXPORT
+#endif
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+
+/*******************************************************************************
+** Forward declarations
+*/
+
+class DomUI;
+class DomIncludes;
+class DomInclude;
+class DomResources;
+class DomResource;
+class DomActionGroup;
+class DomAction;
+class DomActionRef;
+class DomButtonGroup;
+class DomButtonGroups;
+class DomImages;
+class DomImage;
+class DomImageData;
+class DomCustomWidgets;
+class DomHeader;
+class DomCustomWidget;
+class DomProperties;
+class DomPropertyData;
+class DomSizePolicyData;
+class DomLayoutDefault;
+class DomLayoutFunction;
+class DomTabStops;
+class DomLayout;
+class DomLayoutItem;
+class DomRow;
+class DomColumn;
+class DomItem;
+class DomWidget;
+class DomSpacer;
+class DomColor;
+class DomGradientStop;
+class DomGradient;
+class DomBrush;
+class DomColorRole;
+class DomColorGroup;
+class DomPalette;
+class DomFont;
+class DomPoint;
+class DomRect;
+class DomLocale;
+class DomSizePolicy;
+class DomSize;
+class DomDate;
+class DomTime;
+class DomDateTime;
+class DomStringList;
+class DomResourcePixmap;
+class DomResourceIcon;
+class DomString;
+class DomPointF;
+class DomRectF;
+class DomSizeF;
+class DomChar;
+class DomUrl;
+class DomProperty;
+class DomConnections;
+class DomConnection;
+class DomConnectionHints;
+class DomConnectionHint;
+class DomScript;
+class DomWidgetData;
+class DomDesignerData;
+class DomSlots;
+class DomPropertySpecifications;
+class DomStringPropertySpecification;
+
+/*******************************************************************************
+** Declarations
+*/
+
+class QDESIGNER_UILIB_EXPORT DomUI {
+public:
+ DomUI();
+ ~DomUI();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeVersion() const { return m_has_attr_version; }
+ inline QString attributeVersion() const { return m_attr_version; }
+ inline void setAttributeVersion(const QString& a) { m_attr_version = a; m_has_attr_version = true; }
+ inline void clearAttributeVersion() { m_has_attr_version = false; }
+
+ inline bool hasAttributeLanguage() const { return m_has_attr_language; }
+ inline QString attributeLanguage() const { return m_attr_language; }
+ inline void setAttributeLanguage(const QString& a) { m_attr_language = a; m_has_attr_language = true; }
+ inline void clearAttributeLanguage() { m_has_attr_language = false; }
+
+ inline bool hasAttributeDisplayname() const { return m_has_attr_displayname; }
+ inline QString attributeDisplayname() const { return m_attr_displayname; }
+ inline void setAttributeDisplayname(const QString& a) { m_attr_displayname = a; m_has_attr_displayname = true; }
+ inline void clearAttributeDisplayname() { m_has_attr_displayname = false; }
+
+ inline bool hasAttributeStdsetdef() const { return m_has_attr_stdsetdef; }
+ inline int attributeStdsetdef() const { return m_attr_stdsetdef; }
+ inline void setAttributeStdsetdef(int a) { m_attr_stdsetdef = a; m_has_attr_stdsetdef = true; }
+ inline void clearAttributeStdsetdef() { m_has_attr_stdsetdef = false; }
+
+ inline bool hasAttributeStdSetDef() const { return m_has_attr_stdSetDef; }
+ inline int attributeStdSetDef() const { return m_attr_stdSetDef; }
+ inline void setAttributeStdSetDef(int a) { m_attr_stdSetDef = a; m_has_attr_stdSetDef = true; }
+ inline void clearAttributeStdSetDef() { m_has_attr_stdSetDef = false; }
+
+ // child element accessors
+ inline QString elementAuthor() const { return m_author; }
+ void setElementAuthor(const QString& a);
+ inline bool hasElementAuthor() const { return m_children & Author; }
+ void clearElementAuthor();
+
+ inline QString elementComment() const { return m_comment; }
+ void setElementComment(const QString& a);
+ inline bool hasElementComment() const { return m_children & Comment; }
+ void clearElementComment();
+
+ inline QString elementExportMacro() const { return m_exportMacro; }
+ void setElementExportMacro(const QString& a);
+ inline bool hasElementExportMacro() const { return m_children & ExportMacro; }
+ void clearElementExportMacro();
+
+ inline QString elementClass() const { return m_class; }
+ void setElementClass(const QString& a);
+ inline bool hasElementClass() const { return m_children & Class; }
+ void clearElementClass();
+
+ inline DomWidget* elementWidget() const { return m_widget; }
+ DomWidget* takeElementWidget();
+ void setElementWidget(DomWidget* a);
+ inline bool hasElementWidget() const { return m_children & Widget; }
+ void clearElementWidget();
+
+ inline DomLayoutDefault* elementLayoutDefault() const { return m_layoutDefault; }
+ DomLayoutDefault* takeElementLayoutDefault();
+ void setElementLayoutDefault(DomLayoutDefault* a);
+ inline bool hasElementLayoutDefault() const { return m_children & LayoutDefault; }
+ void clearElementLayoutDefault();
+
+ inline DomLayoutFunction* elementLayoutFunction() const { return m_layoutFunction; }
+ DomLayoutFunction* takeElementLayoutFunction();
+ void setElementLayoutFunction(DomLayoutFunction* a);
+ inline bool hasElementLayoutFunction() const { return m_children & LayoutFunction; }
+ void clearElementLayoutFunction();
+
+ inline QString elementPixmapFunction() const { return m_pixmapFunction; }
+ void setElementPixmapFunction(const QString& a);
+ inline bool hasElementPixmapFunction() const { return m_children & PixmapFunction; }
+ void clearElementPixmapFunction();
+
+ inline DomCustomWidgets* elementCustomWidgets() const { return m_customWidgets; }
+ DomCustomWidgets* takeElementCustomWidgets();
+ void setElementCustomWidgets(DomCustomWidgets* a);
+ inline bool hasElementCustomWidgets() const { return m_children & CustomWidgets; }
+ void clearElementCustomWidgets();
+
+ inline DomTabStops* elementTabStops() const { return m_tabStops; }
+ DomTabStops* takeElementTabStops();
+ void setElementTabStops(DomTabStops* a);
+ inline bool hasElementTabStops() const { return m_children & TabStops; }
+ void clearElementTabStops();
+
+ inline DomImages* elementImages() const { return m_images; }
+ DomImages* takeElementImages();
+ void setElementImages(DomImages* a);
+ inline bool hasElementImages() const { return m_children & Images; }
+ void clearElementImages();
+
+ inline DomIncludes* elementIncludes() const { return m_includes; }
+ DomIncludes* takeElementIncludes();
+ void setElementIncludes(DomIncludes* a);
+ inline bool hasElementIncludes() const { return m_children & Includes; }
+ void clearElementIncludes();
+
+ inline DomResources* elementResources() const { return m_resources; }
+ DomResources* takeElementResources();
+ void setElementResources(DomResources* a);
+ inline bool hasElementResources() const { return m_children & Resources; }
+ void clearElementResources();
+
+ inline DomConnections* elementConnections() const { return m_connections; }
+ DomConnections* takeElementConnections();
+ void setElementConnections(DomConnections* a);
+ inline bool hasElementConnections() const { return m_children & Connections; }
+ void clearElementConnections();
+
+ inline DomDesignerData* elementDesignerdata() const { return m_designerdata; }
+ DomDesignerData* takeElementDesignerdata();
+ void setElementDesignerdata(DomDesignerData* a);
+ inline bool hasElementDesignerdata() const { return m_children & Designerdata; }
+ void clearElementDesignerdata();
+
+ inline DomSlots* elementSlots() const { return m_slots; }
+ DomSlots* takeElementSlots();
+ void setElementSlots(DomSlots* a);
+ inline bool hasElementSlots() const { return m_children & Slots; }
+ void clearElementSlots();
+
+ inline DomButtonGroups* elementButtonGroups() const { return m_buttonGroups; }
+ DomButtonGroups* takeElementButtonGroups();
+ void setElementButtonGroups(DomButtonGroups* a);
+ inline bool hasElementButtonGroups() const { return m_children & ButtonGroups; }
+ void clearElementButtonGroups();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_version;
+ bool m_has_attr_version;
+
+ QString m_attr_language;
+ bool m_has_attr_language;
+
+ QString m_attr_displayname;
+ bool m_has_attr_displayname;
+
+ int m_attr_stdsetdef;
+ bool m_has_attr_stdsetdef;
+
+ int m_attr_stdSetDef;
+ bool m_has_attr_stdSetDef;
+
+ // child element data
+ uint m_children;
+ QString m_author;
+ QString m_comment;
+ QString m_exportMacro;
+ QString m_class;
+ DomWidget* m_widget;
+ DomLayoutDefault* m_layoutDefault;
+ DomLayoutFunction* m_layoutFunction;
+ QString m_pixmapFunction;
+ DomCustomWidgets* m_customWidgets;
+ DomTabStops* m_tabStops;
+ DomImages* m_images;
+ DomIncludes* m_includes;
+ DomResources* m_resources;
+ DomConnections* m_connections;
+ DomDesignerData* m_designerdata;
+ DomSlots* m_slots;
+ DomButtonGroups* m_buttonGroups;
+ enum Child {
+ Author = 1,
+ Comment = 2,
+ ExportMacro = 4,
+ Class = 8,
+ Widget = 16,
+ LayoutDefault = 32,
+ LayoutFunction = 64,
+ PixmapFunction = 128,
+ CustomWidgets = 256,
+ TabStops = 512,
+ Images = 1024,
+ Includes = 2048,
+ Resources = 4096,
+ Connections = 8192,
+ Designerdata = 16384,
+ Slots = 32768,
+ ButtonGroups = 65536
+ };
+
+ DomUI(const DomUI &other);
+ void operator = (const DomUI&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomIncludes {
+public:
+ DomIncludes();
+ ~DomIncludes();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomInclude*> elementInclude() const { return m_include; }
+ void setElementInclude(const QList<DomInclude*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomInclude*> m_include;
+ enum Child {
+ Include = 1
+ };
+
+ DomIncludes(const DomIncludes &other);
+ void operator = (const DomIncludes&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomInclude {
+public:
+ DomInclude();
+ ~DomInclude();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeLocation() const { return m_has_attr_location; }
+ inline QString attributeLocation() const { return m_attr_location; }
+ inline void setAttributeLocation(const QString& a) { m_attr_location = a; m_has_attr_location = true; }
+ inline void clearAttributeLocation() { m_has_attr_location = false; }
+
+ inline bool hasAttributeImpldecl() const { return m_has_attr_impldecl; }
+ inline QString attributeImpldecl() const { return m_attr_impldecl; }
+ inline void setAttributeImpldecl(const QString& a) { m_attr_impldecl = a; m_has_attr_impldecl = true; }
+ inline void clearAttributeImpldecl() { m_has_attr_impldecl = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_location;
+ bool m_has_attr_location;
+
+ QString m_attr_impldecl;
+ bool m_has_attr_impldecl;
+
+ // child element data
+ uint m_children;
+
+ DomInclude(const DomInclude &other);
+ void operator = (const DomInclude&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomResources {
+public:
+ DomResources();
+ ~DomResources();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ // child element accessors
+ inline QList<DomResource*> elementInclude() const { return m_include; }
+ void setElementInclude(const QList<DomResource*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ // child element data
+ uint m_children;
+ QList<DomResource*> m_include;
+ enum Child {
+ Include = 1
+ };
+
+ DomResources(const DomResources &other);
+ void operator = (const DomResources&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomResource {
+public:
+ DomResource();
+ ~DomResource();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeLocation() const { return m_has_attr_location; }
+ inline QString attributeLocation() const { return m_attr_location; }
+ inline void setAttributeLocation(const QString& a) { m_attr_location = a; m_has_attr_location = true; }
+ inline void clearAttributeLocation() { m_has_attr_location = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_location;
+ bool m_has_attr_location;
+
+ // child element data
+ uint m_children;
+
+ DomResource(const DomResource &other);
+ void operator = (const DomResource&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomActionGroup {
+public:
+ DomActionGroup();
+ ~DomActionGroup();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ // child element accessors
+ inline QList<DomAction*> elementAction() const { return m_action; }
+ void setElementAction(const QList<DomAction*>& a);
+
+ inline QList<DomActionGroup*> elementActionGroup() const { return m_actionGroup; }
+ void setElementActionGroup(const QList<DomActionGroup*>& a);
+
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+ inline QList<DomProperty*> elementAttribute() const { return m_attribute; }
+ void setElementAttribute(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ // child element data
+ uint m_children;
+ QList<DomAction*> m_action;
+ QList<DomActionGroup*> m_actionGroup;
+ QList<DomProperty*> m_property;
+ QList<DomProperty*> m_attribute;
+ enum Child {
+ Action = 1,
+ ActionGroup = 2,
+ Property = 4,
+ Attribute = 8
+ };
+
+ DomActionGroup(const DomActionGroup &other);
+ void operator = (const DomActionGroup&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomAction {
+public:
+ DomAction();
+ ~DomAction();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ inline bool hasAttributeMenu() const { return m_has_attr_menu; }
+ inline QString attributeMenu() const { return m_attr_menu; }
+ inline void setAttributeMenu(const QString& a) { m_attr_menu = a; m_has_attr_menu = true; }
+ inline void clearAttributeMenu() { m_has_attr_menu = false; }
+
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+ inline QList<DomProperty*> elementAttribute() const { return m_attribute; }
+ void setElementAttribute(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ QString m_attr_menu;
+ bool m_has_attr_menu;
+
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ QList<DomProperty*> m_attribute;
+ enum Child {
+ Property = 1,
+ Attribute = 2
+ };
+
+ DomAction(const DomAction &other);
+ void operator = (const DomAction&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomActionRef {
+public:
+ DomActionRef();
+ ~DomActionRef();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ // child element data
+ uint m_children;
+
+ DomActionRef(const DomActionRef &other);
+ void operator = (const DomActionRef&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomButtonGroup {
+public:
+ DomButtonGroup();
+ ~DomButtonGroup();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+ inline QList<DomProperty*> elementAttribute() const { return m_attribute; }
+ void setElementAttribute(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ QList<DomProperty*> m_attribute;
+ enum Child {
+ Property = 1,
+ Attribute = 2
+ };
+
+ DomButtonGroup(const DomButtonGroup &other);
+ void operator = (const DomButtonGroup&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomButtonGroups {
+public:
+ DomButtonGroups();
+ ~DomButtonGroups();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomButtonGroup*> elementButtonGroup() const { return m_buttonGroup; }
+ void setElementButtonGroup(const QList<DomButtonGroup*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomButtonGroup*> m_buttonGroup;
+ enum Child {
+ ButtonGroup = 1
+ };
+
+ DomButtonGroups(const DomButtonGroups &other);
+ void operator = (const DomButtonGroups&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomImages {
+public:
+ DomImages();
+ ~DomImages();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomImage*> elementImage() const { return m_image; }
+ void setElementImage(const QList<DomImage*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomImage*> m_image;
+ enum Child {
+ Image = 1
+ };
+
+ DomImages(const DomImages &other);
+ void operator = (const DomImages&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomImage {
+public:
+ DomImage();
+ ~DomImage();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ // child element accessors
+ inline DomImageData* elementData() const { return m_data; }
+ DomImageData* takeElementData();
+ void setElementData(DomImageData* a);
+ inline bool hasElementData() const { return m_children & Data; }
+ void clearElementData();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ // child element data
+ uint m_children;
+ DomImageData* m_data;
+ enum Child {
+ Data = 1
+ };
+
+ DomImage(const DomImage &other);
+ void operator = (const DomImage&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomImageData {
+public:
+ DomImageData();
+ ~DomImageData();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeFormat() const { return m_has_attr_format; }
+ inline QString attributeFormat() const { return m_attr_format; }
+ inline void setAttributeFormat(const QString& a) { m_attr_format = a; m_has_attr_format = true; }
+ inline void clearAttributeFormat() { m_has_attr_format = false; }
+
+ inline bool hasAttributeLength() const { return m_has_attr_length; }
+ inline int attributeLength() const { return m_attr_length; }
+ inline void setAttributeLength(int a) { m_attr_length = a; m_has_attr_length = true; }
+ inline void clearAttributeLength() { m_has_attr_length = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_format;
+ bool m_has_attr_format;
+
+ int m_attr_length;
+ bool m_has_attr_length;
+
+ // child element data
+ uint m_children;
+
+ DomImageData(const DomImageData &other);
+ void operator = (const DomImageData&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomCustomWidgets {
+public:
+ DomCustomWidgets();
+ ~DomCustomWidgets();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomCustomWidget*> elementCustomWidget() const { return m_customWidget; }
+ void setElementCustomWidget(const QList<DomCustomWidget*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomCustomWidget*> m_customWidget;
+ enum Child {
+ CustomWidget = 1
+ };
+
+ DomCustomWidgets(const DomCustomWidgets &other);
+ void operator = (const DomCustomWidgets&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomHeader {
+public:
+ DomHeader();
+ ~DomHeader();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeLocation() const { return m_has_attr_location; }
+ inline QString attributeLocation() const { return m_attr_location; }
+ inline void setAttributeLocation(const QString& a) { m_attr_location = a; m_has_attr_location = true; }
+ inline void clearAttributeLocation() { m_has_attr_location = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_location;
+ bool m_has_attr_location;
+
+ // child element data
+ uint m_children;
+
+ DomHeader(const DomHeader &other);
+ void operator = (const DomHeader&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomCustomWidget {
+public:
+ DomCustomWidget();
+ ~DomCustomWidget();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QString elementClass() const { return m_class; }
+ void setElementClass(const QString& a);
+ inline bool hasElementClass() const { return m_children & Class; }
+ void clearElementClass();
+
+ inline QString elementExtends() const { return m_extends; }
+ void setElementExtends(const QString& a);
+ inline bool hasElementExtends() const { return m_children & Extends; }
+ void clearElementExtends();
+
+ inline DomHeader* elementHeader() const { return m_header; }
+ DomHeader* takeElementHeader();
+ void setElementHeader(DomHeader* a);
+ inline bool hasElementHeader() const { return m_children & Header; }
+ void clearElementHeader();
+
+ inline DomSize* elementSizeHint() const { return m_sizeHint; }
+ DomSize* takeElementSizeHint();
+ void setElementSizeHint(DomSize* a);
+ inline bool hasElementSizeHint() const { return m_children & SizeHint; }
+ void clearElementSizeHint();
+
+ inline QString elementAddPageMethod() const { return m_addPageMethod; }
+ void setElementAddPageMethod(const QString& a);
+ inline bool hasElementAddPageMethod() const { return m_children & AddPageMethod; }
+ void clearElementAddPageMethod();
+
+ inline int elementContainer() const { return m_container; }
+ void setElementContainer(int a);
+ inline bool hasElementContainer() const { return m_children & Container; }
+ void clearElementContainer();
+
+ inline DomSizePolicyData* elementSizePolicy() const { return m_sizePolicy; }
+ DomSizePolicyData* takeElementSizePolicy();
+ void setElementSizePolicy(DomSizePolicyData* a);
+ inline bool hasElementSizePolicy() const { return m_children & SizePolicy; }
+ void clearElementSizePolicy();
+
+ inline QString elementPixmap() const { return m_pixmap; }
+ void setElementPixmap(const QString& a);
+ inline bool hasElementPixmap() const { return m_children & Pixmap; }
+ void clearElementPixmap();
+
+ inline DomScript* elementScript() const { return m_script; }
+ DomScript* takeElementScript();
+ void setElementScript(DomScript* a);
+ inline bool hasElementScript() const { return m_children & Script; }
+ void clearElementScript();
+
+ inline DomProperties* elementProperties() const { return m_properties; }
+ DomProperties* takeElementProperties();
+ void setElementProperties(DomProperties* a);
+ inline bool hasElementProperties() const { return m_children & Properties; }
+ void clearElementProperties();
+
+ inline DomSlots* elementSlots() const { return m_slots; }
+ DomSlots* takeElementSlots();
+ void setElementSlots(DomSlots* a);
+ inline bool hasElementSlots() const { return m_children & Slots; }
+ void clearElementSlots();
+
+ inline DomPropertySpecifications* elementPropertyspecifications() const { return m_propertyspecifications; }
+ DomPropertySpecifications* takeElementPropertyspecifications();
+ void setElementPropertyspecifications(DomPropertySpecifications* a);
+ inline bool hasElementPropertyspecifications() const { return m_children & Propertyspecifications; }
+ void clearElementPropertyspecifications();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QString m_class;
+ QString m_extends;
+ DomHeader* m_header;
+ DomSize* m_sizeHint;
+ QString m_addPageMethod;
+ int m_container;
+ DomSizePolicyData* m_sizePolicy;
+ QString m_pixmap;
+ DomScript* m_script;
+ DomProperties* m_properties;
+ DomSlots* m_slots;
+ DomPropertySpecifications* m_propertyspecifications;
+ enum Child {
+ Class = 1,
+ Extends = 2,
+ Header = 4,
+ SizeHint = 8,
+ AddPageMethod = 16,
+ Container = 32,
+ SizePolicy = 64,
+ Pixmap = 128,
+ Script = 256,
+ Properties = 512,
+ Slots = 1024,
+ Propertyspecifications = 2048
+ };
+
+ DomCustomWidget(const DomCustomWidget &other);
+ void operator = (const DomCustomWidget&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomProperties {
+public:
+ DomProperties();
+ ~DomProperties();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomPropertyData*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomPropertyData*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomPropertyData*> m_property;
+ enum Child {
+ Property = 1
+ };
+
+ DomProperties(const DomProperties &other);
+ void operator = (const DomProperties&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomPropertyData {
+public:
+ DomPropertyData();
+ ~DomPropertyData();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeType() const { return m_has_attr_type; }
+ inline QString attributeType() const { return m_attr_type; }
+ inline void setAttributeType(const QString& a) { m_attr_type = a; m_has_attr_type = true; }
+ inline void clearAttributeType() { m_has_attr_type = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_type;
+ bool m_has_attr_type;
+
+ // child element data
+ uint m_children;
+
+ DomPropertyData(const DomPropertyData &other);
+ void operator = (const DomPropertyData&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomSizePolicyData {
+public:
+ DomSizePolicyData();
+ ~DomSizePolicyData();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementHorData() const { return m_horData; }
+ void setElementHorData(int a);
+ inline bool hasElementHorData() const { return m_children & HorData; }
+ void clearElementHorData();
+
+ inline int elementVerData() const { return m_verData; }
+ void setElementVerData(int a);
+ inline bool hasElementVerData() const { return m_children & VerData; }
+ void clearElementVerData();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_horData;
+ int m_verData;
+ enum Child {
+ HorData = 1,
+ VerData = 2
+ };
+
+ DomSizePolicyData(const DomSizePolicyData &other);
+ void operator = (const DomSizePolicyData&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomLayoutDefault {
+public:
+ DomLayoutDefault();
+ ~DomLayoutDefault();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeSpacing() const { return m_has_attr_spacing; }
+ inline int attributeSpacing() const { return m_attr_spacing; }
+ inline void setAttributeSpacing(int a) { m_attr_spacing = a; m_has_attr_spacing = true; }
+ inline void clearAttributeSpacing() { m_has_attr_spacing = false; }
+
+ inline bool hasAttributeMargin() const { return m_has_attr_margin; }
+ inline int attributeMargin() const { return m_attr_margin; }
+ inline void setAttributeMargin(int a) { m_attr_margin = a; m_has_attr_margin = true; }
+ inline void clearAttributeMargin() { m_has_attr_margin = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ int m_attr_spacing;
+ bool m_has_attr_spacing;
+
+ int m_attr_margin;
+ bool m_has_attr_margin;
+
+ // child element data
+ uint m_children;
+
+ DomLayoutDefault(const DomLayoutDefault &other);
+ void operator = (const DomLayoutDefault&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomLayoutFunction {
+public:
+ DomLayoutFunction();
+ ~DomLayoutFunction();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeSpacing() const { return m_has_attr_spacing; }
+ inline QString attributeSpacing() const { return m_attr_spacing; }
+ inline void setAttributeSpacing(const QString& a) { m_attr_spacing = a; m_has_attr_spacing = true; }
+ inline void clearAttributeSpacing() { m_has_attr_spacing = false; }
+
+ inline bool hasAttributeMargin() const { return m_has_attr_margin; }
+ inline QString attributeMargin() const { return m_attr_margin; }
+ inline void setAttributeMargin(const QString& a) { m_attr_margin = a; m_has_attr_margin = true; }
+ inline void clearAttributeMargin() { m_has_attr_margin = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_spacing;
+ bool m_has_attr_spacing;
+
+ QString m_attr_margin;
+ bool m_has_attr_margin;
+
+ // child element data
+ uint m_children;
+
+ DomLayoutFunction(const DomLayoutFunction &other);
+ void operator = (const DomLayoutFunction&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomTabStops {
+public:
+ DomTabStops();
+ ~DomTabStops();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QStringList elementTabStop() const { return m_tabStop; }
+ void setElementTabStop(const QStringList& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QStringList m_tabStop;
+ enum Child {
+ TabStop = 1
+ };
+
+ DomTabStops(const DomTabStops &other);
+ void operator = (const DomTabStops&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomLayout {
+public:
+ DomLayout();
+ ~DomLayout();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeClass() const { return m_has_attr_class; }
+ inline QString attributeClass() const { return m_attr_class; }
+ inline void setAttributeClass(const QString& a) { m_attr_class = a; m_has_attr_class = true; }
+ inline void clearAttributeClass() { m_has_attr_class = false; }
+
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ inline bool hasAttributeStretch() const { return m_has_attr_stretch; }
+ inline QString attributeStretch() const { return m_attr_stretch; }
+ inline void setAttributeStretch(const QString& a) { m_attr_stretch = a; m_has_attr_stretch = true; }
+ inline void clearAttributeStretch() { m_has_attr_stretch = false; }
+
+ inline bool hasAttributeRowStretch() const { return m_has_attr_rowStretch; }
+ inline QString attributeRowStretch() const { return m_attr_rowStretch; }
+ inline void setAttributeRowStretch(const QString& a) { m_attr_rowStretch = a; m_has_attr_rowStretch = true; }
+ inline void clearAttributeRowStretch() { m_has_attr_rowStretch = false; }
+
+ inline bool hasAttributeColumnStretch() const { return m_has_attr_columnStretch; }
+ inline QString attributeColumnStretch() const { return m_attr_columnStretch; }
+ inline void setAttributeColumnStretch(const QString& a) { m_attr_columnStretch = a; m_has_attr_columnStretch = true; }
+ inline void clearAttributeColumnStretch() { m_has_attr_columnStretch = false; }
+
+ inline bool hasAttributeRowMinimumHeight() const { return m_has_attr_rowMinimumHeight; }
+ inline QString attributeRowMinimumHeight() const { return m_attr_rowMinimumHeight; }
+ inline void setAttributeRowMinimumHeight(const QString& a) { m_attr_rowMinimumHeight = a; m_has_attr_rowMinimumHeight = true; }
+ inline void clearAttributeRowMinimumHeight() { m_has_attr_rowMinimumHeight = false; }
+
+ inline bool hasAttributeColumnMinimumWidth() const { return m_has_attr_columnMinimumWidth; }
+ inline QString attributeColumnMinimumWidth() const { return m_attr_columnMinimumWidth; }
+ inline void setAttributeColumnMinimumWidth(const QString& a) { m_attr_columnMinimumWidth = a; m_has_attr_columnMinimumWidth = true; }
+ inline void clearAttributeColumnMinimumWidth() { m_has_attr_columnMinimumWidth = false; }
+
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+ inline QList<DomProperty*> elementAttribute() const { return m_attribute; }
+ void setElementAttribute(const QList<DomProperty*>& a);
+
+ inline QList<DomLayoutItem*> elementItem() const { return m_item; }
+ void setElementItem(const QList<DomLayoutItem*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_class;
+ bool m_has_attr_class;
+
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ QString m_attr_stretch;
+ bool m_has_attr_stretch;
+
+ QString m_attr_rowStretch;
+ bool m_has_attr_rowStretch;
+
+ QString m_attr_columnStretch;
+ bool m_has_attr_columnStretch;
+
+ QString m_attr_rowMinimumHeight;
+ bool m_has_attr_rowMinimumHeight;
+
+ QString m_attr_columnMinimumWidth;
+ bool m_has_attr_columnMinimumWidth;
+
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ QList<DomProperty*> m_attribute;
+ QList<DomLayoutItem*> m_item;
+ enum Child {
+ Property = 1,
+ Attribute = 2,
+ Item = 4
+ };
+
+ DomLayout(const DomLayout &other);
+ void operator = (const DomLayout&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomLayoutItem {
+public:
+ DomLayoutItem();
+ ~DomLayoutItem();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeRow() const { return m_has_attr_row; }
+ inline int attributeRow() const { return m_attr_row; }
+ inline void setAttributeRow(int a) { m_attr_row = a; m_has_attr_row = true; }
+ inline void clearAttributeRow() { m_has_attr_row = false; }
+
+ inline bool hasAttributeColumn() const { return m_has_attr_column; }
+ inline int attributeColumn() const { return m_attr_column; }
+ inline void setAttributeColumn(int a) { m_attr_column = a; m_has_attr_column = true; }
+ inline void clearAttributeColumn() { m_has_attr_column = false; }
+
+ inline bool hasAttributeRowSpan() const { return m_has_attr_rowSpan; }
+ inline int attributeRowSpan() const { return m_attr_rowSpan; }
+ inline void setAttributeRowSpan(int a) { m_attr_rowSpan = a; m_has_attr_rowSpan = true; }
+ inline void clearAttributeRowSpan() { m_has_attr_rowSpan = false; }
+
+ inline bool hasAttributeColSpan() const { return m_has_attr_colSpan; }
+ inline int attributeColSpan() const { return m_attr_colSpan; }
+ inline void setAttributeColSpan(int a) { m_attr_colSpan = a; m_has_attr_colSpan = true; }
+ inline void clearAttributeColSpan() { m_has_attr_colSpan = false; }
+
+ inline bool hasAttributeAlignment() const { return m_has_attr_alignment; }
+ inline QString attributeAlignment() const { return m_attr_alignment; }
+ inline void setAttributeAlignment(const QString& a) { m_attr_alignment = a; m_has_attr_alignment = true; }
+ inline void clearAttributeAlignment() { m_has_attr_alignment = false; }
+
+ // child element accessors
+ enum Kind { Unknown = 0, Widget, Layout, Spacer };
+ inline Kind kind() const { return m_kind; }
+
+ inline DomWidget* elementWidget() const { return m_widget; }
+ DomWidget* takeElementWidget();
+ void setElementWidget(DomWidget* a);
+
+ inline DomLayout* elementLayout() const { return m_layout; }
+ DomLayout* takeElementLayout();
+ void setElementLayout(DomLayout* a);
+
+ inline DomSpacer* elementSpacer() const { return m_spacer; }
+ DomSpacer* takeElementSpacer();
+ void setElementSpacer(DomSpacer* a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ int m_attr_row;
+ bool m_has_attr_row;
+
+ int m_attr_column;
+ bool m_has_attr_column;
+
+ int m_attr_rowSpan;
+ bool m_has_attr_rowSpan;
+
+ int m_attr_colSpan;
+ bool m_has_attr_colSpan;
+
+ QString m_attr_alignment;
+ bool m_has_attr_alignment;
+
+ // child element data
+ Kind m_kind;
+ DomWidget* m_widget;
+ DomLayout* m_layout;
+ DomSpacer* m_spacer;
+
+ DomLayoutItem(const DomLayoutItem &other);
+ void operator = (const DomLayoutItem&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomRow {
+public:
+ DomRow();
+ ~DomRow();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ enum Child {
+ Property = 1
+ };
+
+ DomRow(const DomRow &other);
+ void operator = (const DomRow&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomColumn {
+public:
+ DomColumn();
+ ~DomColumn();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ enum Child {
+ Property = 1
+ };
+
+ DomColumn(const DomColumn &other);
+ void operator = (const DomColumn&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomItem {
+public:
+ DomItem();
+ ~DomItem();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeRow() const { return m_has_attr_row; }
+ inline int attributeRow() const { return m_attr_row; }
+ inline void setAttributeRow(int a) { m_attr_row = a; m_has_attr_row = true; }
+ inline void clearAttributeRow() { m_has_attr_row = false; }
+
+ inline bool hasAttributeColumn() const { return m_has_attr_column; }
+ inline int attributeColumn() const { return m_attr_column; }
+ inline void setAttributeColumn(int a) { m_attr_column = a; m_has_attr_column = true; }
+ inline void clearAttributeColumn() { m_has_attr_column = false; }
+
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+ inline QList<DomItem*> elementItem() const { return m_item; }
+ void setElementItem(const QList<DomItem*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ int m_attr_row;
+ bool m_has_attr_row;
+
+ int m_attr_column;
+ bool m_has_attr_column;
+
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ QList<DomItem*> m_item;
+ enum Child {
+ Property = 1,
+ Item = 2
+ };
+
+ DomItem(const DomItem &other);
+ void operator = (const DomItem&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomWidget {
+public:
+ DomWidget();
+ ~DomWidget();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeClass() const { return m_has_attr_class; }
+ inline QString attributeClass() const { return m_attr_class; }
+ inline void setAttributeClass(const QString& a) { m_attr_class = a; m_has_attr_class = true; }
+ inline void clearAttributeClass() { m_has_attr_class = false; }
+
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ inline bool hasAttributeNative() const { return m_has_attr_native; }
+ inline bool attributeNative() const { return m_attr_native; }
+ inline void setAttributeNative(bool a) { m_attr_native = a; m_has_attr_native = true; }
+ inline void clearAttributeNative() { m_has_attr_native = false; }
+
+ // child element accessors
+ inline QStringList elementClass() const { return m_class; }
+ void setElementClass(const QStringList& a);
+
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+ inline QList<DomScript*> elementScript() const { return m_script; }
+ void setElementScript(const QList<DomScript*>& a);
+
+ inline QList<DomWidgetData*> elementWidgetData() const { return m_widgetData; }
+ void setElementWidgetData(const QList<DomWidgetData*>& a);
+
+ inline QList<DomProperty*> elementAttribute() const { return m_attribute; }
+ void setElementAttribute(const QList<DomProperty*>& a);
+
+ inline QList<DomRow*> elementRow() const { return m_row; }
+ void setElementRow(const QList<DomRow*>& a);
+
+ inline QList<DomColumn*> elementColumn() const { return m_column; }
+ void setElementColumn(const QList<DomColumn*>& a);
+
+ inline QList<DomItem*> elementItem() const { return m_item; }
+ void setElementItem(const QList<DomItem*>& a);
+
+ inline QList<DomLayout*> elementLayout() const { return m_layout; }
+ void setElementLayout(const QList<DomLayout*>& a);
+
+ inline QList<DomWidget*> elementWidget() const { return m_widget; }
+ void setElementWidget(const QList<DomWidget*>& a);
+
+ inline QList<DomAction*> elementAction() const { return m_action; }
+ void setElementAction(const QList<DomAction*>& a);
+
+ inline QList<DomActionGroup*> elementActionGroup() const { return m_actionGroup; }
+ void setElementActionGroup(const QList<DomActionGroup*>& a);
+
+ inline QList<DomActionRef*> elementAddAction() const { return m_addAction; }
+ void setElementAddAction(const QList<DomActionRef*>& a);
+
+ inline QStringList elementZOrder() const { return m_zOrder; }
+ void setElementZOrder(const QStringList& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_class;
+ bool m_has_attr_class;
+
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ bool m_attr_native;
+ bool m_has_attr_native;
+
+ // child element data
+ uint m_children;
+ QStringList m_class;
+ QList<DomProperty*> m_property;
+ QList<DomScript*> m_script;
+ QList<DomWidgetData*> m_widgetData;
+ QList<DomProperty*> m_attribute;
+ QList<DomRow*> m_row;
+ QList<DomColumn*> m_column;
+ QList<DomItem*> m_item;
+ QList<DomLayout*> m_layout;
+ QList<DomWidget*> m_widget;
+ QList<DomAction*> m_action;
+ QList<DomActionGroup*> m_actionGroup;
+ QList<DomActionRef*> m_addAction;
+ QStringList m_zOrder;
+ enum Child {
+ Class = 1,
+ Property = 2,
+ Script = 4,
+ WidgetData = 8,
+ Attribute = 16,
+ Row = 32,
+ Column = 64,
+ Item = 128,
+ Layout = 256,
+ Widget = 512,
+ Action = 1024,
+ ActionGroup = 2048,
+ AddAction = 4096,
+ ZOrder = 8192
+ };
+
+ DomWidget(const DomWidget &other);
+ void operator = (const DomWidget&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomSpacer {
+public:
+ DomSpacer();
+ ~DomSpacer();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ enum Child {
+ Property = 1
+ };
+
+ DomSpacer(const DomSpacer &other);
+ void operator = (const DomSpacer&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomColor {
+public:
+ DomColor();
+ ~DomColor();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeAlpha() const { return m_has_attr_alpha; }
+ inline int attributeAlpha() const { return m_attr_alpha; }
+ inline void setAttributeAlpha(int a) { m_attr_alpha = a; m_has_attr_alpha = true; }
+ inline void clearAttributeAlpha() { m_has_attr_alpha = false; }
+
+ // child element accessors
+ inline int elementRed() const { return m_red; }
+ void setElementRed(int a);
+ inline bool hasElementRed() const { return m_children & Red; }
+ void clearElementRed();
+
+ inline int elementGreen() const { return m_green; }
+ void setElementGreen(int a);
+ inline bool hasElementGreen() const { return m_children & Green; }
+ void clearElementGreen();
+
+ inline int elementBlue() const { return m_blue; }
+ void setElementBlue(int a);
+ inline bool hasElementBlue() const { return m_children & Blue; }
+ void clearElementBlue();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ int m_attr_alpha;
+ bool m_has_attr_alpha;
+
+ // child element data
+ uint m_children;
+ int m_red;
+ int m_green;
+ int m_blue;
+ enum Child {
+ Red = 1,
+ Green = 2,
+ Blue = 4
+ };
+
+ DomColor(const DomColor &other);
+ void operator = (const DomColor&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomGradientStop {
+public:
+ DomGradientStop();
+ ~DomGradientStop();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributePosition() const { return m_has_attr_position; }
+ inline double attributePosition() const { return m_attr_position; }
+ inline void setAttributePosition(double a) { m_attr_position = a; m_has_attr_position = true; }
+ inline void clearAttributePosition() { m_has_attr_position = false; }
+
+ // child element accessors
+ inline DomColor* elementColor() const { return m_color; }
+ DomColor* takeElementColor();
+ void setElementColor(DomColor* a);
+ inline bool hasElementColor() const { return m_children & Color; }
+ void clearElementColor();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ double m_attr_position;
+ bool m_has_attr_position;
+
+ // child element data
+ uint m_children;
+ DomColor* m_color;
+ enum Child {
+ Color = 1
+ };
+
+ DomGradientStop(const DomGradientStop &other);
+ void operator = (const DomGradientStop&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomGradient {
+public:
+ DomGradient();
+ ~DomGradient();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeStartX() const { return m_has_attr_startX; }
+ inline double attributeStartX() const { return m_attr_startX; }
+ inline void setAttributeStartX(double a) { m_attr_startX = a; m_has_attr_startX = true; }
+ inline void clearAttributeStartX() { m_has_attr_startX = false; }
+
+ inline bool hasAttributeStartY() const { return m_has_attr_startY; }
+ inline double attributeStartY() const { return m_attr_startY; }
+ inline void setAttributeStartY(double a) { m_attr_startY = a; m_has_attr_startY = true; }
+ inline void clearAttributeStartY() { m_has_attr_startY = false; }
+
+ inline bool hasAttributeEndX() const { return m_has_attr_endX; }
+ inline double attributeEndX() const { return m_attr_endX; }
+ inline void setAttributeEndX(double a) { m_attr_endX = a; m_has_attr_endX = true; }
+ inline void clearAttributeEndX() { m_has_attr_endX = false; }
+
+ inline bool hasAttributeEndY() const { return m_has_attr_endY; }
+ inline double attributeEndY() const { return m_attr_endY; }
+ inline void setAttributeEndY(double a) { m_attr_endY = a; m_has_attr_endY = true; }
+ inline void clearAttributeEndY() { m_has_attr_endY = false; }
+
+ inline bool hasAttributeCentralX() const { return m_has_attr_centralX; }
+ inline double attributeCentralX() const { return m_attr_centralX; }
+ inline void setAttributeCentralX(double a) { m_attr_centralX = a; m_has_attr_centralX = true; }
+ inline void clearAttributeCentralX() { m_has_attr_centralX = false; }
+
+ inline bool hasAttributeCentralY() const { return m_has_attr_centralY; }
+ inline double attributeCentralY() const { return m_attr_centralY; }
+ inline void setAttributeCentralY(double a) { m_attr_centralY = a; m_has_attr_centralY = true; }
+ inline void clearAttributeCentralY() { m_has_attr_centralY = false; }
+
+ inline bool hasAttributeFocalX() const { return m_has_attr_focalX; }
+ inline double attributeFocalX() const { return m_attr_focalX; }
+ inline void setAttributeFocalX(double a) { m_attr_focalX = a; m_has_attr_focalX = true; }
+ inline void clearAttributeFocalX() { m_has_attr_focalX = false; }
+
+ inline bool hasAttributeFocalY() const { return m_has_attr_focalY; }
+ inline double attributeFocalY() const { return m_attr_focalY; }
+ inline void setAttributeFocalY(double a) { m_attr_focalY = a; m_has_attr_focalY = true; }
+ inline void clearAttributeFocalY() { m_has_attr_focalY = false; }
+
+ inline bool hasAttributeRadius() const { return m_has_attr_radius; }
+ inline double attributeRadius() const { return m_attr_radius; }
+ inline void setAttributeRadius(double a) { m_attr_radius = a; m_has_attr_radius = true; }
+ inline void clearAttributeRadius() { m_has_attr_radius = false; }
+
+ inline bool hasAttributeAngle() const { return m_has_attr_angle; }
+ inline double attributeAngle() const { return m_attr_angle; }
+ inline void setAttributeAngle(double a) { m_attr_angle = a; m_has_attr_angle = true; }
+ inline void clearAttributeAngle() { m_has_attr_angle = false; }
+
+ inline bool hasAttributeType() const { return m_has_attr_type; }
+ inline QString attributeType() const { return m_attr_type; }
+ inline void setAttributeType(const QString& a) { m_attr_type = a; m_has_attr_type = true; }
+ inline void clearAttributeType() { m_has_attr_type = false; }
+
+ inline bool hasAttributeSpread() const { return m_has_attr_spread; }
+ inline QString attributeSpread() const { return m_attr_spread; }
+ inline void setAttributeSpread(const QString& a) { m_attr_spread = a; m_has_attr_spread = true; }
+ inline void clearAttributeSpread() { m_has_attr_spread = false; }
+
+ inline bool hasAttributeCoordinateMode() const { return m_has_attr_coordinateMode; }
+ inline QString attributeCoordinateMode() const { return m_attr_coordinateMode; }
+ inline void setAttributeCoordinateMode(const QString& a) { m_attr_coordinateMode = a; m_has_attr_coordinateMode = true; }
+ inline void clearAttributeCoordinateMode() { m_has_attr_coordinateMode = false; }
+
+ // child element accessors
+ inline QList<DomGradientStop*> elementGradientStop() const { return m_gradientStop; }
+ void setElementGradientStop(const QList<DomGradientStop*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ double m_attr_startX;
+ bool m_has_attr_startX;
+
+ double m_attr_startY;
+ bool m_has_attr_startY;
+
+ double m_attr_endX;
+ bool m_has_attr_endX;
+
+ double m_attr_endY;
+ bool m_has_attr_endY;
+
+ double m_attr_centralX;
+ bool m_has_attr_centralX;
+
+ double m_attr_centralY;
+ bool m_has_attr_centralY;
+
+ double m_attr_focalX;
+ bool m_has_attr_focalX;
+
+ double m_attr_focalY;
+ bool m_has_attr_focalY;
+
+ double m_attr_radius;
+ bool m_has_attr_radius;
+
+ double m_attr_angle;
+ bool m_has_attr_angle;
+
+ QString m_attr_type;
+ bool m_has_attr_type;
+
+ QString m_attr_spread;
+ bool m_has_attr_spread;
+
+ QString m_attr_coordinateMode;
+ bool m_has_attr_coordinateMode;
+
+ // child element data
+ uint m_children;
+ QList<DomGradientStop*> m_gradientStop;
+ enum Child {
+ GradientStop = 1
+ };
+
+ DomGradient(const DomGradient &other);
+ void operator = (const DomGradient&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomBrush {
+public:
+ DomBrush();
+ ~DomBrush();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeBrushStyle() const { return m_has_attr_brushStyle; }
+ inline QString attributeBrushStyle() const { return m_attr_brushStyle; }
+ inline void setAttributeBrushStyle(const QString& a) { m_attr_brushStyle = a; m_has_attr_brushStyle = true; }
+ inline void clearAttributeBrushStyle() { m_has_attr_brushStyle = false; }
+
+ // child element accessors
+ enum Kind { Unknown = 0, Color, Texture, Gradient };
+ inline Kind kind() const { return m_kind; }
+
+ inline DomColor* elementColor() const { return m_color; }
+ DomColor* takeElementColor();
+ void setElementColor(DomColor* a);
+
+ inline DomProperty* elementTexture() const { return m_texture; }
+ DomProperty* takeElementTexture();
+ void setElementTexture(DomProperty* a);
+
+ inline DomGradient* elementGradient() const { return m_gradient; }
+ DomGradient* takeElementGradient();
+ void setElementGradient(DomGradient* a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_brushStyle;
+ bool m_has_attr_brushStyle;
+
+ // child element data
+ Kind m_kind;
+ DomColor* m_color;
+ DomProperty* m_texture;
+ DomGradient* m_gradient;
+
+ DomBrush(const DomBrush &other);
+ void operator = (const DomBrush&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomColorRole {
+public:
+ DomColorRole();
+ ~DomColorRole();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeRole() const { return m_has_attr_role; }
+ inline QString attributeRole() const { return m_attr_role; }
+ inline void setAttributeRole(const QString& a) { m_attr_role = a; m_has_attr_role = true; }
+ inline void clearAttributeRole() { m_has_attr_role = false; }
+
+ // child element accessors
+ inline DomBrush* elementBrush() const { return m_brush; }
+ DomBrush* takeElementBrush();
+ void setElementBrush(DomBrush* a);
+ inline bool hasElementBrush() const { return m_children & Brush; }
+ void clearElementBrush();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_role;
+ bool m_has_attr_role;
+
+ // child element data
+ uint m_children;
+ DomBrush* m_brush;
+ enum Child {
+ Brush = 1
+ };
+
+ DomColorRole(const DomColorRole &other);
+ void operator = (const DomColorRole&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomColorGroup {
+public:
+ DomColorGroup();
+ ~DomColorGroup();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomColorRole*> elementColorRole() const { return m_colorRole; }
+ void setElementColorRole(const QList<DomColorRole*>& a);
+
+ inline QList<DomColor*> elementColor() const { return m_color; }
+ void setElementColor(const QList<DomColor*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomColorRole*> m_colorRole;
+ QList<DomColor*> m_color;
+ enum Child {
+ ColorRole = 1,
+ Color = 2
+ };
+
+ DomColorGroup(const DomColorGroup &other);
+ void operator = (const DomColorGroup&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomPalette {
+public:
+ DomPalette();
+ ~DomPalette();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline DomColorGroup* elementActive() const { return m_active; }
+ DomColorGroup* takeElementActive();
+ void setElementActive(DomColorGroup* a);
+ inline bool hasElementActive() const { return m_children & Active; }
+ void clearElementActive();
+
+ inline DomColorGroup* elementInactive() const { return m_inactive; }
+ DomColorGroup* takeElementInactive();
+ void setElementInactive(DomColorGroup* a);
+ inline bool hasElementInactive() const { return m_children & Inactive; }
+ void clearElementInactive();
+
+ inline DomColorGroup* elementDisabled() const { return m_disabled; }
+ DomColorGroup* takeElementDisabled();
+ void setElementDisabled(DomColorGroup* a);
+ inline bool hasElementDisabled() const { return m_children & Disabled; }
+ void clearElementDisabled();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ DomColorGroup* m_active;
+ DomColorGroup* m_inactive;
+ DomColorGroup* m_disabled;
+ enum Child {
+ Active = 1,
+ Inactive = 2,
+ Disabled = 4
+ };
+
+ DomPalette(const DomPalette &other);
+ void operator = (const DomPalette&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomFont {
+public:
+ DomFont();
+ ~DomFont();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QString elementFamily() const { return m_family; }
+ void setElementFamily(const QString& a);
+ inline bool hasElementFamily() const { return m_children & Family; }
+ void clearElementFamily();
+
+ inline int elementPointSize() const { return m_pointSize; }
+ void setElementPointSize(int a);
+ inline bool hasElementPointSize() const { return m_children & PointSize; }
+ void clearElementPointSize();
+
+ inline int elementWeight() const { return m_weight; }
+ void setElementWeight(int a);
+ inline bool hasElementWeight() const { return m_children & Weight; }
+ void clearElementWeight();
+
+ inline bool elementItalic() const { return m_italic; }
+ void setElementItalic(bool a);
+ inline bool hasElementItalic() const { return m_children & Italic; }
+ void clearElementItalic();
+
+ inline bool elementBold() const { return m_bold; }
+ void setElementBold(bool a);
+ inline bool hasElementBold() const { return m_children & Bold; }
+ void clearElementBold();
+
+ inline bool elementUnderline() const { return m_underline; }
+ void setElementUnderline(bool a);
+ inline bool hasElementUnderline() const { return m_children & Underline; }
+ void clearElementUnderline();
+
+ inline bool elementStrikeOut() const { return m_strikeOut; }
+ void setElementStrikeOut(bool a);
+ inline bool hasElementStrikeOut() const { return m_children & StrikeOut; }
+ void clearElementStrikeOut();
+
+ inline bool elementAntialiasing() const { return m_antialiasing; }
+ void setElementAntialiasing(bool a);
+ inline bool hasElementAntialiasing() const { return m_children & Antialiasing; }
+ void clearElementAntialiasing();
+
+ inline QString elementStyleStrategy() const { return m_styleStrategy; }
+ void setElementStyleStrategy(const QString& a);
+ inline bool hasElementStyleStrategy() const { return m_children & StyleStrategy; }
+ void clearElementStyleStrategy();
+
+ inline bool elementKerning() const { return m_kerning; }
+ void setElementKerning(bool a);
+ inline bool hasElementKerning() const { return m_children & Kerning; }
+ void clearElementKerning();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QString m_family;
+ int m_pointSize;
+ int m_weight;
+ bool m_italic;
+ bool m_bold;
+ bool m_underline;
+ bool m_strikeOut;
+ bool m_antialiasing;
+ QString m_styleStrategy;
+ bool m_kerning;
+ enum Child {
+ Family = 1,
+ PointSize = 2,
+ Weight = 4,
+ Italic = 8,
+ Bold = 16,
+ Underline = 32,
+ StrikeOut = 64,
+ Antialiasing = 128,
+ StyleStrategy = 256,
+ Kerning = 512
+ };
+
+ DomFont(const DomFont &other);
+ void operator = (const DomFont&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomPoint {
+public:
+ DomPoint();
+ ~DomPoint();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementX() const { return m_x; }
+ void setElementX(int a);
+ inline bool hasElementX() const { return m_children & X; }
+ void clearElementX();
+
+ inline int elementY() const { return m_y; }
+ void setElementY(int a);
+ inline bool hasElementY() const { return m_children & Y; }
+ void clearElementY();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_x;
+ int m_y;
+ enum Child {
+ X = 1,
+ Y = 2
+ };
+
+ DomPoint(const DomPoint &other);
+ void operator = (const DomPoint&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomRect {
+public:
+ DomRect();
+ ~DomRect();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementX() const { return m_x; }
+ void setElementX(int a);
+ inline bool hasElementX() const { return m_children & X; }
+ void clearElementX();
+
+ inline int elementY() const { return m_y; }
+ void setElementY(int a);
+ inline bool hasElementY() const { return m_children & Y; }
+ void clearElementY();
+
+ inline int elementWidth() const { return m_width; }
+ void setElementWidth(int a);
+ inline bool hasElementWidth() const { return m_children & Width; }
+ void clearElementWidth();
+
+ inline int elementHeight() const { return m_height; }
+ void setElementHeight(int a);
+ inline bool hasElementHeight() const { return m_children & Height; }
+ void clearElementHeight();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_x;
+ int m_y;
+ int m_width;
+ int m_height;
+ enum Child {
+ X = 1,
+ Y = 2,
+ Width = 4,
+ Height = 8
+ };
+
+ DomRect(const DomRect &other);
+ void operator = (const DomRect&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomLocale {
+public:
+ DomLocale();
+ ~DomLocale();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeLanguage() const { return m_has_attr_language; }
+ inline QString attributeLanguage() const { return m_attr_language; }
+ inline void setAttributeLanguage(const QString& a) { m_attr_language = a; m_has_attr_language = true; }
+ inline void clearAttributeLanguage() { m_has_attr_language = false; }
+
+ inline bool hasAttributeCountry() const { return m_has_attr_country; }
+ inline QString attributeCountry() const { return m_attr_country; }
+ inline void setAttributeCountry(const QString& a) { m_attr_country = a; m_has_attr_country = true; }
+ inline void clearAttributeCountry() { m_has_attr_country = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_language;
+ bool m_has_attr_language;
+
+ QString m_attr_country;
+ bool m_has_attr_country;
+
+ // child element data
+ uint m_children;
+
+ DomLocale(const DomLocale &other);
+ void operator = (const DomLocale&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomSizePolicy {
+public:
+ DomSizePolicy();
+ ~DomSizePolicy();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeHSizeType() const { return m_has_attr_hSizeType; }
+ inline QString attributeHSizeType() const { return m_attr_hSizeType; }
+ inline void setAttributeHSizeType(const QString& a) { m_attr_hSizeType = a; m_has_attr_hSizeType = true; }
+ inline void clearAttributeHSizeType() { m_has_attr_hSizeType = false; }
+
+ inline bool hasAttributeVSizeType() const { return m_has_attr_vSizeType; }
+ inline QString attributeVSizeType() const { return m_attr_vSizeType; }
+ inline void setAttributeVSizeType(const QString& a) { m_attr_vSizeType = a; m_has_attr_vSizeType = true; }
+ inline void clearAttributeVSizeType() { m_has_attr_vSizeType = false; }
+
+ // child element accessors
+ inline int elementHSizeType() const { return m_hSizeType; }
+ void setElementHSizeType(int a);
+ inline bool hasElementHSizeType() const { return m_children & HSizeType; }
+ void clearElementHSizeType();
+
+ inline int elementVSizeType() const { return m_vSizeType; }
+ void setElementVSizeType(int a);
+ inline bool hasElementVSizeType() const { return m_children & VSizeType; }
+ void clearElementVSizeType();
+
+ inline int elementHorStretch() const { return m_horStretch; }
+ void setElementHorStretch(int a);
+ inline bool hasElementHorStretch() const { return m_children & HorStretch; }
+ void clearElementHorStretch();
+
+ inline int elementVerStretch() const { return m_verStretch; }
+ void setElementVerStretch(int a);
+ inline bool hasElementVerStretch() const { return m_children & VerStretch; }
+ void clearElementVerStretch();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_hSizeType;
+ bool m_has_attr_hSizeType;
+
+ QString m_attr_vSizeType;
+ bool m_has_attr_vSizeType;
+
+ // child element data
+ uint m_children;
+ int m_hSizeType;
+ int m_vSizeType;
+ int m_horStretch;
+ int m_verStretch;
+ enum Child {
+ HSizeType = 1,
+ VSizeType = 2,
+ HorStretch = 4,
+ VerStretch = 8
+ };
+
+ DomSizePolicy(const DomSizePolicy &other);
+ void operator = (const DomSizePolicy&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomSize {
+public:
+ DomSize();
+ ~DomSize();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementWidth() const { return m_width; }
+ void setElementWidth(int a);
+ inline bool hasElementWidth() const { return m_children & Width; }
+ void clearElementWidth();
+
+ inline int elementHeight() const { return m_height; }
+ void setElementHeight(int a);
+ inline bool hasElementHeight() const { return m_children & Height; }
+ void clearElementHeight();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_width;
+ int m_height;
+ enum Child {
+ Width = 1,
+ Height = 2
+ };
+
+ DomSize(const DomSize &other);
+ void operator = (const DomSize&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomDate {
+public:
+ DomDate();
+ ~DomDate();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementYear() const { return m_year; }
+ void setElementYear(int a);
+ inline bool hasElementYear() const { return m_children & Year; }
+ void clearElementYear();
+
+ inline int elementMonth() const { return m_month; }
+ void setElementMonth(int a);
+ inline bool hasElementMonth() const { return m_children & Month; }
+ void clearElementMonth();
+
+ inline int elementDay() const { return m_day; }
+ void setElementDay(int a);
+ inline bool hasElementDay() const { return m_children & Day; }
+ void clearElementDay();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_year;
+ int m_month;
+ int m_day;
+ enum Child {
+ Year = 1,
+ Month = 2,
+ Day = 4
+ };
+
+ DomDate(const DomDate &other);
+ void operator = (const DomDate&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomTime {
+public:
+ DomTime();
+ ~DomTime();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementHour() const { return m_hour; }
+ void setElementHour(int a);
+ inline bool hasElementHour() const { return m_children & Hour; }
+ void clearElementHour();
+
+ inline int elementMinute() const { return m_minute; }
+ void setElementMinute(int a);
+ inline bool hasElementMinute() const { return m_children & Minute; }
+ void clearElementMinute();
+
+ inline int elementSecond() const { return m_second; }
+ void setElementSecond(int a);
+ inline bool hasElementSecond() const { return m_children & Second; }
+ void clearElementSecond();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_hour;
+ int m_minute;
+ int m_second;
+ enum Child {
+ Hour = 1,
+ Minute = 2,
+ Second = 4
+ };
+
+ DomTime(const DomTime &other);
+ void operator = (const DomTime&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomDateTime {
+public:
+ DomDateTime();
+ ~DomDateTime();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementHour() const { return m_hour; }
+ void setElementHour(int a);
+ inline bool hasElementHour() const { return m_children & Hour; }
+ void clearElementHour();
+
+ inline int elementMinute() const { return m_minute; }
+ void setElementMinute(int a);
+ inline bool hasElementMinute() const { return m_children & Minute; }
+ void clearElementMinute();
+
+ inline int elementSecond() const { return m_second; }
+ void setElementSecond(int a);
+ inline bool hasElementSecond() const { return m_children & Second; }
+ void clearElementSecond();
+
+ inline int elementYear() const { return m_year; }
+ void setElementYear(int a);
+ inline bool hasElementYear() const { return m_children & Year; }
+ void clearElementYear();
+
+ inline int elementMonth() const { return m_month; }
+ void setElementMonth(int a);
+ inline bool hasElementMonth() const { return m_children & Month; }
+ void clearElementMonth();
+
+ inline int elementDay() const { return m_day; }
+ void setElementDay(int a);
+ inline bool hasElementDay() const { return m_children & Day; }
+ void clearElementDay();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_hour;
+ int m_minute;
+ int m_second;
+ int m_year;
+ int m_month;
+ int m_day;
+ enum Child {
+ Hour = 1,
+ Minute = 2,
+ Second = 4,
+ Year = 8,
+ Month = 16,
+ Day = 32
+ };
+
+ DomDateTime(const DomDateTime &other);
+ void operator = (const DomDateTime&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomStringList {
+public:
+ DomStringList();
+ ~DomStringList();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QStringList elementString() const { return m_string; }
+ void setElementString(const QStringList& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QStringList m_string;
+ enum Child {
+ String = 1
+ };
+
+ DomStringList(const DomStringList &other);
+ void operator = (const DomStringList&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomResourcePixmap {
+public:
+ DomResourcePixmap();
+ ~DomResourcePixmap();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeResource() const { return m_has_attr_resource; }
+ inline QString attributeResource() const { return m_attr_resource; }
+ inline void setAttributeResource(const QString& a) { m_attr_resource = a; m_has_attr_resource = true; }
+ inline void clearAttributeResource() { m_has_attr_resource = false; }
+
+ inline bool hasAttributeAlias() const { return m_has_attr_alias; }
+ inline QString attributeAlias() const { return m_attr_alias; }
+ inline void setAttributeAlias(const QString& a) { m_attr_alias = a; m_has_attr_alias = true; }
+ inline void clearAttributeAlias() { m_has_attr_alias = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_resource;
+ bool m_has_attr_resource;
+
+ QString m_attr_alias;
+ bool m_has_attr_alias;
+
+ // child element data
+ uint m_children;
+
+ DomResourcePixmap(const DomResourcePixmap &other);
+ void operator = (const DomResourcePixmap&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomResourceIcon {
+public:
+ DomResourceIcon();
+ ~DomResourceIcon();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeTheme() const { return m_has_attr_theme; }
+ inline QString attributeTheme() const { return m_attr_theme; }
+ inline void setAttributeTheme(const QString& a) { m_attr_theme = a; m_has_attr_theme = true; }
+ inline void clearAttributeTheme() { m_has_attr_theme = false; }
+
+ inline bool hasAttributeResource() const { return m_has_attr_resource; }
+ inline QString attributeResource() const { return m_attr_resource; }
+ inline void setAttributeResource(const QString& a) { m_attr_resource = a; m_has_attr_resource = true; }
+ inline void clearAttributeResource() { m_has_attr_resource = false; }
+
+ // child element accessors
+ inline DomResourcePixmap* elementNormalOff() const { return m_normalOff; }
+ DomResourcePixmap* takeElementNormalOff();
+ void setElementNormalOff(DomResourcePixmap* a);
+ inline bool hasElementNormalOff() const { return m_children & NormalOff; }
+ void clearElementNormalOff();
+
+ inline DomResourcePixmap* elementNormalOn() const { return m_normalOn; }
+ DomResourcePixmap* takeElementNormalOn();
+ void setElementNormalOn(DomResourcePixmap* a);
+ inline bool hasElementNormalOn() const { return m_children & NormalOn; }
+ void clearElementNormalOn();
+
+ inline DomResourcePixmap* elementDisabledOff() const { return m_disabledOff; }
+ DomResourcePixmap* takeElementDisabledOff();
+ void setElementDisabledOff(DomResourcePixmap* a);
+ inline bool hasElementDisabledOff() const { return m_children & DisabledOff; }
+ void clearElementDisabledOff();
+
+ inline DomResourcePixmap* elementDisabledOn() const { return m_disabledOn; }
+ DomResourcePixmap* takeElementDisabledOn();
+ void setElementDisabledOn(DomResourcePixmap* a);
+ inline bool hasElementDisabledOn() const { return m_children & DisabledOn; }
+ void clearElementDisabledOn();
+
+ inline DomResourcePixmap* elementActiveOff() const { return m_activeOff; }
+ DomResourcePixmap* takeElementActiveOff();
+ void setElementActiveOff(DomResourcePixmap* a);
+ inline bool hasElementActiveOff() const { return m_children & ActiveOff; }
+ void clearElementActiveOff();
+
+ inline DomResourcePixmap* elementActiveOn() const { return m_activeOn; }
+ DomResourcePixmap* takeElementActiveOn();
+ void setElementActiveOn(DomResourcePixmap* a);
+ inline bool hasElementActiveOn() const { return m_children & ActiveOn; }
+ void clearElementActiveOn();
+
+ inline DomResourcePixmap* elementSelectedOff() const { return m_selectedOff; }
+ DomResourcePixmap* takeElementSelectedOff();
+ void setElementSelectedOff(DomResourcePixmap* a);
+ inline bool hasElementSelectedOff() const { return m_children & SelectedOff; }
+ void clearElementSelectedOff();
+
+ inline DomResourcePixmap* elementSelectedOn() const { return m_selectedOn; }
+ DomResourcePixmap* takeElementSelectedOn();
+ void setElementSelectedOn(DomResourcePixmap* a);
+ inline bool hasElementSelectedOn() const { return m_children & SelectedOn; }
+ void clearElementSelectedOn();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_theme;
+ bool m_has_attr_theme;
+
+ QString m_attr_resource;
+ bool m_has_attr_resource;
+
+ // child element data
+ uint m_children;
+ DomResourcePixmap* m_normalOff;
+ DomResourcePixmap* m_normalOn;
+ DomResourcePixmap* m_disabledOff;
+ DomResourcePixmap* m_disabledOn;
+ DomResourcePixmap* m_activeOff;
+ DomResourcePixmap* m_activeOn;
+ DomResourcePixmap* m_selectedOff;
+ DomResourcePixmap* m_selectedOn;
+ enum Child {
+ NormalOff = 1,
+ NormalOn = 2,
+ DisabledOff = 4,
+ DisabledOn = 8,
+ ActiveOff = 16,
+ ActiveOn = 32,
+ SelectedOff = 64,
+ SelectedOn = 128
+ };
+
+ DomResourceIcon(const DomResourceIcon &other);
+ void operator = (const DomResourceIcon&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomString {
+public:
+ DomString();
+ ~DomString();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeNotr() const { return m_has_attr_notr; }
+ inline QString attributeNotr() const { return m_attr_notr; }
+ inline void setAttributeNotr(const QString& a) { m_attr_notr = a; m_has_attr_notr = true; }
+ inline void clearAttributeNotr() { m_has_attr_notr = false; }
+
+ inline bool hasAttributeComment() const { return m_has_attr_comment; }
+ inline QString attributeComment() const { return m_attr_comment; }
+ inline void setAttributeComment(const QString& a) { m_attr_comment = a; m_has_attr_comment = true; }
+ inline void clearAttributeComment() { m_has_attr_comment = false; }
+
+ inline bool hasAttributeExtraComment() const { return m_has_attr_extraComment; }
+ inline QString attributeExtraComment() const { return m_attr_extraComment; }
+ inline void setAttributeExtraComment(const QString& a) { m_attr_extraComment = a; m_has_attr_extraComment = true; }
+ inline void clearAttributeExtraComment() { m_has_attr_extraComment = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_notr;
+ bool m_has_attr_notr;
+
+ QString m_attr_comment;
+ bool m_has_attr_comment;
+
+ QString m_attr_extraComment;
+ bool m_has_attr_extraComment;
+
+ // child element data
+ uint m_children;
+
+ DomString(const DomString &other);
+ void operator = (const DomString&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomPointF {
+public:
+ DomPointF();
+ ~DomPointF();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline double elementX() const { return m_x; }
+ void setElementX(double a);
+ inline bool hasElementX() const { return m_children & X; }
+ void clearElementX();
+
+ inline double elementY() const { return m_y; }
+ void setElementY(double a);
+ inline bool hasElementY() const { return m_children & Y; }
+ void clearElementY();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ double m_x;
+ double m_y;
+ enum Child {
+ X = 1,
+ Y = 2
+ };
+
+ DomPointF(const DomPointF &other);
+ void operator = (const DomPointF&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomRectF {
+public:
+ DomRectF();
+ ~DomRectF();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline double elementX() const { return m_x; }
+ void setElementX(double a);
+ inline bool hasElementX() const { return m_children & X; }
+ void clearElementX();
+
+ inline double elementY() const { return m_y; }
+ void setElementY(double a);
+ inline bool hasElementY() const { return m_children & Y; }
+ void clearElementY();
+
+ inline double elementWidth() const { return m_width; }
+ void setElementWidth(double a);
+ inline bool hasElementWidth() const { return m_children & Width; }
+ void clearElementWidth();
+
+ inline double elementHeight() const { return m_height; }
+ void setElementHeight(double a);
+ inline bool hasElementHeight() const { return m_children & Height; }
+ void clearElementHeight();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ double m_x;
+ double m_y;
+ double m_width;
+ double m_height;
+ enum Child {
+ X = 1,
+ Y = 2,
+ Width = 4,
+ Height = 8
+ };
+
+ DomRectF(const DomRectF &other);
+ void operator = (const DomRectF&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomSizeF {
+public:
+ DomSizeF();
+ ~DomSizeF();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline double elementWidth() const { return m_width; }
+ void setElementWidth(double a);
+ inline bool hasElementWidth() const { return m_children & Width; }
+ void clearElementWidth();
+
+ inline double elementHeight() const { return m_height; }
+ void setElementHeight(double a);
+ inline bool hasElementHeight() const { return m_children & Height; }
+ void clearElementHeight();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ double m_width;
+ double m_height;
+ enum Child {
+ Width = 1,
+ Height = 2
+ };
+
+ DomSizeF(const DomSizeF &other);
+ void operator = (const DomSizeF&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomChar {
+public:
+ DomChar();
+ ~DomChar();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline int elementUnicode() const { return m_unicode; }
+ void setElementUnicode(int a);
+ inline bool hasElementUnicode() const { return m_children & Unicode; }
+ void clearElementUnicode();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ int m_unicode;
+ enum Child {
+ Unicode = 1
+ };
+
+ DomChar(const DomChar &other);
+ void operator = (const DomChar&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomUrl {
+public:
+ DomUrl();
+ ~DomUrl();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline DomString* elementString() const { return m_string; }
+ DomString* takeElementString();
+ void setElementString(DomString* a);
+ inline bool hasElementString() const { return m_children & String; }
+ void clearElementString();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ DomString* m_string;
+ enum Child {
+ String = 1
+ };
+
+ DomUrl(const DomUrl &other);
+ void operator = (const DomUrl&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomProperty {
+public:
+ DomProperty();
+ ~DomProperty();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ inline bool hasAttributeStdset() const { return m_has_attr_stdset; }
+ inline int attributeStdset() const { return m_attr_stdset; }
+ inline void setAttributeStdset(int a) { m_attr_stdset = a; m_has_attr_stdset = true; }
+ inline void clearAttributeStdset() { m_has_attr_stdset = false; }
+
+ // child element accessors
+ enum Kind { Unknown = 0, Bool, Color, Cstring, Cursor, CursorShape, Enum, Font, IconSet, Pixmap, Palette, Point, Rect, Set, Locale, SizePolicy, Size, String, StringList, Number, Float, Double, Date, Time, DateTime, PointF, RectF, SizeF, LongLong, Char, Url, UInt, ULongLong, Brush };
+ inline Kind kind() const { return m_kind; }
+
+ inline QString elementBool() const { return m_bool; }
+ void setElementBool(const QString& a);
+
+ inline DomColor* elementColor() const { return m_color; }
+ DomColor* takeElementColor();
+ void setElementColor(DomColor* a);
+
+ inline QString elementCstring() const { return m_cstring; }
+ void setElementCstring(const QString& a);
+
+ inline int elementCursor() const { return m_cursor; }
+ void setElementCursor(int a);
+
+ inline QString elementCursorShape() const { return m_cursorShape; }
+ void setElementCursorShape(const QString& a);
+
+ inline QString elementEnum() const { return m_enum; }
+ void setElementEnum(const QString& a);
+
+ inline DomFont* elementFont() const { return m_font; }
+ DomFont* takeElementFont();
+ void setElementFont(DomFont* a);
+
+ inline DomResourceIcon* elementIconSet() const { return m_iconSet; }
+ DomResourceIcon* takeElementIconSet();
+ void setElementIconSet(DomResourceIcon* a);
+
+ inline DomResourcePixmap* elementPixmap() const { return m_pixmap; }
+ DomResourcePixmap* takeElementPixmap();
+ void setElementPixmap(DomResourcePixmap* a);
+
+ inline DomPalette* elementPalette() const { return m_palette; }
+ DomPalette* takeElementPalette();
+ void setElementPalette(DomPalette* a);
+
+ inline DomPoint* elementPoint() const { return m_point; }
+ DomPoint* takeElementPoint();
+ void setElementPoint(DomPoint* a);
+
+ inline DomRect* elementRect() const { return m_rect; }
+ DomRect* takeElementRect();
+ void setElementRect(DomRect* a);
+
+ inline QString elementSet() const { return m_set; }
+ void setElementSet(const QString& a);
+
+ inline DomLocale* elementLocale() const { return m_locale; }
+ DomLocale* takeElementLocale();
+ void setElementLocale(DomLocale* a);
+
+ inline DomSizePolicy* elementSizePolicy() const { return m_sizePolicy; }
+ DomSizePolicy* takeElementSizePolicy();
+ void setElementSizePolicy(DomSizePolicy* a);
+
+ inline DomSize* elementSize() const { return m_size; }
+ DomSize* takeElementSize();
+ void setElementSize(DomSize* a);
+
+ inline DomString* elementString() const { return m_string; }
+ DomString* takeElementString();
+ void setElementString(DomString* a);
+
+ inline DomStringList* elementStringList() const { return m_stringList; }
+ DomStringList* takeElementStringList();
+ void setElementStringList(DomStringList* a);
+
+ inline int elementNumber() const { return m_number; }
+ void setElementNumber(int a);
+
+ inline float elementFloat() const { return m_float; }
+ void setElementFloat(float a);
+
+ inline double elementDouble() const { return m_double; }
+ void setElementDouble(double a);
+
+ inline DomDate* elementDate() const { return m_date; }
+ DomDate* takeElementDate();
+ void setElementDate(DomDate* a);
+
+ inline DomTime* elementTime() const { return m_time; }
+ DomTime* takeElementTime();
+ void setElementTime(DomTime* a);
+
+ inline DomDateTime* elementDateTime() const { return m_dateTime; }
+ DomDateTime* takeElementDateTime();
+ void setElementDateTime(DomDateTime* a);
+
+ inline DomPointF* elementPointF() const { return m_pointF; }
+ DomPointF* takeElementPointF();
+ void setElementPointF(DomPointF* a);
+
+ inline DomRectF* elementRectF() const { return m_rectF; }
+ DomRectF* takeElementRectF();
+ void setElementRectF(DomRectF* a);
+
+ inline DomSizeF* elementSizeF() const { return m_sizeF; }
+ DomSizeF* takeElementSizeF();
+ void setElementSizeF(DomSizeF* a);
+
+ inline qlonglong elementLongLong() const { return m_longLong; }
+ void setElementLongLong(qlonglong a);
+
+ inline DomChar* elementChar() const { return m_char; }
+ DomChar* takeElementChar();
+ void setElementChar(DomChar* a);
+
+ inline DomUrl* elementUrl() const { return m_url; }
+ DomUrl* takeElementUrl();
+ void setElementUrl(DomUrl* a);
+
+ inline uint elementUInt() const { return m_UInt; }
+ void setElementUInt(uint a);
+
+ inline qulonglong elementULongLong() const { return m_uLongLong; }
+ void setElementULongLong(qulonglong a);
+
+ inline DomBrush* elementBrush() const { return m_brush; }
+ DomBrush* takeElementBrush();
+ void setElementBrush(DomBrush* a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ int m_attr_stdset;
+ bool m_has_attr_stdset;
+
+ // child element data
+ Kind m_kind;
+ QString m_bool;
+ DomColor* m_color;
+ QString m_cstring;
+ int m_cursor;
+ QString m_cursorShape;
+ QString m_enum;
+ DomFont* m_font;
+ DomResourceIcon* m_iconSet;
+ DomResourcePixmap* m_pixmap;
+ DomPalette* m_palette;
+ DomPoint* m_point;
+ DomRect* m_rect;
+ QString m_set;
+ DomLocale* m_locale;
+ DomSizePolicy* m_sizePolicy;
+ DomSize* m_size;
+ DomString* m_string;
+ DomStringList* m_stringList;
+ int m_number;
+ float m_float;
+ double m_double;
+ DomDate* m_date;
+ DomTime* m_time;
+ DomDateTime* m_dateTime;
+ DomPointF* m_pointF;
+ DomRectF* m_rectF;
+ DomSizeF* m_sizeF;
+ qlonglong m_longLong;
+ DomChar* m_char;
+ DomUrl* m_url;
+ uint m_UInt;
+ qulonglong m_uLongLong;
+ DomBrush* m_brush;
+
+ DomProperty(const DomProperty &other);
+ void operator = (const DomProperty&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomConnections {
+public:
+ DomConnections();
+ ~DomConnections();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomConnection*> elementConnection() const { return m_connection; }
+ void setElementConnection(const QList<DomConnection*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomConnection*> m_connection;
+ enum Child {
+ Connection = 1
+ };
+
+ DomConnections(const DomConnections &other);
+ void operator = (const DomConnections&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomConnection {
+public:
+ DomConnection();
+ ~DomConnection();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QString elementSender() const { return m_sender; }
+ void setElementSender(const QString& a);
+ inline bool hasElementSender() const { return m_children & Sender; }
+ void clearElementSender();
+
+ inline QString elementSignal() const { return m_signal; }
+ void setElementSignal(const QString& a);
+ inline bool hasElementSignal() const { return m_children & Signal; }
+ void clearElementSignal();
+
+ inline QString elementReceiver() const { return m_receiver; }
+ void setElementReceiver(const QString& a);
+ inline bool hasElementReceiver() const { return m_children & Receiver; }
+ void clearElementReceiver();
+
+ inline QString elementSlot() const { return m_slot; }
+ void setElementSlot(const QString& a);
+ inline bool hasElementSlot() const { return m_children & Slot; }
+ void clearElementSlot();
+
+ inline DomConnectionHints* elementHints() const { return m_hints; }
+ DomConnectionHints* takeElementHints();
+ void setElementHints(DomConnectionHints* a);
+ inline bool hasElementHints() const { return m_children & Hints; }
+ void clearElementHints();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QString m_sender;
+ QString m_signal;
+ QString m_receiver;
+ QString m_slot;
+ DomConnectionHints* m_hints;
+ enum Child {
+ Sender = 1,
+ Signal = 2,
+ Receiver = 4,
+ Slot = 8,
+ Hints = 16
+ };
+
+ DomConnection(const DomConnection &other);
+ void operator = (const DomConnection&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomConnectionHints {
+public:
+ DomConnectionHints();
+ ~DomConnectionHints();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomConnectionHint*> elementHint() const { return m_hint; }
+ void setElementHint(const QList<DomConnectionHint*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomConnectionHint*> m_hint;
+ enum Child {
+ Hint = 1
+ };
+
+ DomConnectionHints(const DomConnectionHints &other);
+ void operator = (const DomConnectionHints&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomConnectionHint {
+public:
+ DomConnectionHint();
+ ~DomConnectionHint();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeType() const { return m_has_attr_type; }
+ inline QString attributeType() const { return m_attr_type; }
+ inline void setAttributeType(const QString& a) { m_attr_type = a; m_has_attr_type = true; }
+ inline void clearAttributeType() { m_has_attr_type = false; }
+
+ // child element accessors
+ inline int elementX() const { return m_x; }
+ void setElementX(int a);
+ inline bool hasElementX() const { return m_children & X; }
+ void clearElementX();
+
+ inline int elementY() const { return m_y; }
+ void setElementY(int a);
+ inline bool hasElementY() const { return m_children & Y; }
+ void clearElementY();
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_type;
+ bool m_has_attr_type;
+
+ // child element data
+ uint m_children;
+ int m_x;
+ int m_y;
+ enum Child {
+ X = 1,
+ Y = 2
+ };
+
+ DomConnectionHint(const DomConnectionHint &other);
+ void operator = (const DomConnectionHint&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomScript {
+public:
+ DomScript();
+ ~DomScript();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeSource() const { return m_has_attr_source; }
+ inline QString attributeSource() const { return m_attr_source; }
+ inline void setAttributeSource(const QString& a) { m_attr_source = a; m_has_attr_source = true; }
+ inline void clearAttributeSource() { m_has_attr_source = false; }
+
+ inline bool hasAttributeLanguage() const { return m_has_attr_language; }
+ inline QString attributeLanguage() const { return m_attr_language; }
+ inline void setAttributeLanguage(const QString& a) { m_attr_language = a; m_has_attr_language = true; }
+ inline void clearAttributeLanguage() { m_has_attr_language = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_source;
+ bool m_has_attr_source;
+
+ QString m_attr_language;
+ bool m_has_attr_language;
+
+ // child element data
+ uint m_children;
+
+ DomScript(const DomScript &other);
+ void operator = (const DomScript&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomWidgetData {
+public:
+ DomWidgetData();
+ ~DomWidgetData();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ enum Child {
+ Property = 1
+ };
+
+ DomWidgetData(const DomWidgetData &other);
+ void operator = (const DomWidgetData&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomDesignerData {
+public:
+ DomDesignerData();
+ ~DomDesignerData();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomProperty*> elementProperty() const { return m_property; }
+ void setElementProperty(const QList<DomProperty*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomProperty*> m_property;
+ enum Child {
+ Property = 1
+ };
+
+ DomDesignerData(const DomDesignerData &other);
+ void operator = (const DomDesignerData&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomSlots {
+public:
+ DomSlots();
+ ~DomSlots();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QStringList elementSignal() const { return m_signal; }
+ void setElementSignal(const QStringList& a);
+
+ inline QStringList elementSlot() const { return m_slot; }
+ void setElementSlot(const QStringList& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QStringList m_signal;
+ QStringList m_slot;
+ enum Child {
+ Signal = 1,
+ Slot = 2
+ };
+
+ DomSlots(const DomSlots &other);
+ void operator = (const DomSlots&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomPropertySpecifications {
+public:
+ DomPropertySpecifications();
+ ~DomPropertySpecifications();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ // child element accessors
+ inline QList<DomStringPropertySpecification*> elementStringpropertyspecification() const { return m_stringpropertyspecification; }
+ void setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a);
+
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ // child element data
+ uint m_children;
+ QList<DomStringPropertySpecification*> m_stringpropertyspecification;
+ enum Child {
+ Stringpropertyspecification = 1
+ };
+
+ DomPropertySpecifications(const DomPropertySpecifications &other);
+ void operator = (const DomPropertySpecifications&other);
+};
+
+class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification {
+public:
+ DomStringPropertySpecification();
+ ~DomStringPropertySpecification();
+
+ void read(QXmlStreamReader &reader);
+#ifdef QUILOADER_QDOM_READ
+ void read(const QDomElement &node);
+#endif
+ void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
+ inline QString text() const { return m_text; }
+ inline void setText(const QString &s) { m_text = s; }
+
+ // attribute accessors
+ inline bool hasAttributeName() const { return m_has_attr_name; }
+ inline QString attributeName() const { return m_attr_name; }
+ inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; }
+ inline void clearAttributeName() { m_has_attr_name = false; }
+
+ inline bool hasAttributeType() const { return m_has_attr_type; }
+ inline QString attributeType() const { return m_attr_type; }
+ inline void setAttributeType(const QString& a) { m_attr_type = a; m_has_attr_type = true; }
+ inline void clearAttributeType() { m_has_attr_type = false; }
+
+ inline bool hasAttributeNotr() const { return m_has_attr_notr; }
+ inline QString attributeNotr() const { return m_attr_notr; }
+ inline void setAttributeNotr(const QString& a) { m_attr_notr = a; m_has_attr_notr = true; }
+ inline void clearAttributeNotr() { m_has_attr_notr = false; }
+
+ // child element accessors
+private:
+ QString m_text;
+ void clear(bool clear_all = true);
+
+ // attribute data
+ QString m_attr_name;
+ bool m_has_attr_name;
+
+ QString m_attr_type;
+ bool m_has_attr_type;
+
+ QString m_attr_notr;
+ bool m_has_attr_notr;
+
+ // child element data
+ uint m_children;
+
+ DomStringPropertySpecification(const DomStringPropertySpecification &other);
+ void operator = (const DomStringPropertySpecification&other);
+};
+
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+QT_END_NAMESPACE
+
+#endif // UI4_H
diff --git a/tools/uilib/uilib.pri b/tools/uilib/uilib.pri
new file mode 100644
index 0000000000..2072fbce8f
--- /dev/null
+++ b/tools/uilib/uilib.pri
@@ -0,0 +1,32 @@
+
+INCLUDEPATH += $$PWD
+
+DEFINES += QT_DESIGNER
+!contains(QT_CONFIG, script): DEFINES += QT_FORMBUILDER_NO_SCRIPT
+
+# Input
+HEADERS += \
+ $$PWD/ui4_p.h \
+ $$PWD/abstractformbuilder.h \
+ $$PWD/formbuilder.h \
+ $$PWD/container.h \
+ $$PWD/customwidget.h \
+ $$PWD/properties_p.h \
+ $$PWD/formbuilderextra_p.h \
+ $$PWD/resourcebuilder_p.h \
+ $$PWD/textbuilder_p.h
+
+SOURCES += \
+ $$PWD/abstractformbuilder.cpp \
+ $$PWD/formbuilder.cpp \
+ $$PWD/ui4.cpp \
+ $$PWD/properties.cpp \
+ $$PWD/formbuilderextra.cpp \
+ $$PWD/resourcebuilder.cpp \
+ $$PWD/textbuilder.cpp
+
+!contains(DEFINES, QT_FORMBUILDER_NO_SCRIPT) {
+ QT += script
+ HEADERS += $$PWD/formscriptrunner_p.h
+ SOURCES += $$PWD/formscriptrunner.cpp
+}
diff --git a/tools/uilib/uilib_global.h b/tools/uilib/uilib_global.h
new file mode 100644
index 0000000000..04d0dc603a
--- /dev/null
+++ b/tools/uilib/uilib_global.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UILIB_GLOBAL_H
+#define UILIB_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+#define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT
+#define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT
+
+#ifdef QT_DESIGNER_STATIC
+# define QDESIGNER_UILIB_EXPORT
+#elif defined(QDESIGNER_UILIB_LIBRARY)
+# define QDESIGNER_UILIB_EXPORT QDESIGNER_UILIB_EXTERN
+#else
+# define QDESIGNER_UILIB_EXPORT QDESIGNER_UILIB_IMPORT
+#endif
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif // UILIB_GLOBAL_H
diff --git a/tools/uilib/widgets.table b/tools/uilib/widgets.table
new file mode 100644
index 0000000000..9b8727849b
--- /dev/null
+++ b/tools/uilib/widgets.table
@@ -0,0 +1,148 @@
+
+#ifndef DECLARE_WIDGET_1
+# define DECLARE_WIDGET_1(a,b) DECLARE_WIDGET(a,b)
+#endif
+
+// widgets
+#ifndef QT_NO_CHECKBOX
+DECLARE_WIDGET(QCheckBox, "text")
+#endif
+#ifndef QT_NO_COMBOBOX
+DECLARE_WIDGET(QComboBox, "")
+#endif
+#ifndef QT_NO_DATETIMEEDIT
+DECLARE_WIDGET(QDateTimeEdit, "")
+#endif
+#ifndef QT_NO_DATEEDIT
+DECLARE_WIDGET(QDateEdit, "")
+#endif
+#ifndef QT_NO_TIMEEDIT
+DECLARE_WIDGET(QTimeEdit, "")
+#endif
+#ifndef QT_NO_DIAL
+DECLARE_WIDGET(QDial, "")
+#endif
+DECLARE_WIDGET(QDialog, "")
+#ifndef QT_NO_DOCKWIDGET
+DECLARE_WIDGET(QDockWidget, "")
+#endif
+DECLARE_WIDGET(QFrame, "")
+#ifndef QT_NO_GROUPBOX
+DECLARE_WIDGET(QGroupBox, "")
+#endif
+#ifndef QT_NO_SCROLLAREA
+DECLARE_WIDGET(QScrollArea, "")
+#endif
+#ifndef QT_NO_LCDNUMBER
+DECLARE_WIDGET(QLCDNumber, "")
+#endif
+DECLARE_WIDGET(QLabel, "")
+#ifndef QT_NO_LINEEDIT
+DECLARE_WIDGET(QLineEdit, "")
+#endif
+#ifndef QT_NO_LISTVIEW
+DECLARE_WIDGET(QListView, "")
+#endif
+#ifndef QT_NO_LISTWIDGET
+DECLARE_WIDGET(QListWidget, "")
+#endif
+#ifndef QT_NO_MAINWINDOW
+DECLARE_WIDGET(QMainWindow, "")
+#endif
+#ifndef QT_NO_MDIAREA
+DECLARE_WIDGET(QMdiArea, "")
+#endif
+#ifndef QT_NO_MENU
+DECLARE_WIDGET(QMenu, "")
+#endif
+#ifndef QT_NO_MENUBAR
+DECLARE_WIDGET(QMenuBar, "")
+#endif
+#ifndef QT_NO_PROGRESSBAR
+DECLARE_WIDGET(QProgressBar, "")
+#endif
+DECLARE_WIDGET(QPushButton, "text")
+DECLARE_WIDGET(QRadioButton, "text")
+DECLARE_WIDGET(QCommandLinkButton, "text")
+#ifndef QT_NO_SCROLLBAR
+DECLARE_WIDGET(QScrollBar, "")
+#endif
+#ifndef QT_NO_SLIDER
+DECLARE_WIDGET(QSlider, "")
+#endif
+#ifndef QT_NO_SPINBOX
+DECLARE_WIDGET(QSpinBox, "")
+DECLARE_WIDGET(QDoubleSpinBox, "")
+#endif
+#ifndef QT_NO_TABWIDGET
+DECLARE_WIDGET(QTabWidget, "")
+#endif
+#ifndef QT_NO_TABLEVIEW
+DECLARE_WIDGET(QTableView, "")
+#endif
+#ifndef QT_NO_TABLEWIDGET
+DECLARE_WIDGET(QTableWidget, "")
+#endif
+#ifndef QT_NO_TEXTBROWSER
+DECLARE_WIDGET(QTextBrowser, "")
+#endif
+#ifndef QT_NO_TEXTEDIT
+DECLARE_WIDGET(QTextEdit, "")
+DECLARE_WIDGET(QPlainTextEdit, "")
+#endif
+#ifndef QT_NO_TOOLBAR
+DECLARE_WIDGET(QToolBar, "")
+#endif
+#ifndef QT_NO_TOOLBOX
+DECLARE_WIDGET(QToolBox, "")
+#endif
+#ifndef QT_NO_TOOLBUTTON
+DECLARE_WIDGET(QToolButton, "text")
+#endif
+#ifndef QT_NO_TREEVIEW
+DECLARE_WIDGET(QTreeView, "")
+#endif
+#ifndef QT_NO_TREEWIDGET
+DECLARE_WIDGET(QTreeWidget, "")
+#endif
+DECLARE_WIDGET(QWidget, "")
+#ifndef QT_NO_WORKSPACE
+DECLARE_WIDGET(QWorkspace, "")
+#endif
+#ifndef QT_NO_SPLITTER
+DECLARE_WIDGET(QSplitter, "")
+#endif
+#ifndef QT_NO_STACKEDWIDGET
+DECLARE_WIDGET(QStackedWidget, "")
+#endif
+#ifndef QT_NO_STATUSBAR
+DECLARE_WIDGET(QStatusBar, "")
+#endif
+DECLARE_WIDGET(QDialogButtonBox, "")
+#ifndef QT_NO_FONTCOMBOBOX
+DECLARE_WIDGET(QFontComboBox, "")
+#endif
+#ifndef QT_NO_CALENDARWIDGET
+DECLARE_WIDGET(QCalendarWidget, "")
+#endif
+#ifndef QT_NO_COLUMNVIEW
+DECLARE_WIDGET(QColumnView, "")
+#endif
+
+#ifndef QT_NO_WIZARD
+DECLARE_WIDGET(QWizard, "")
+DECLARE_WIDGET(QWizardPage, "")
+#endif
+
+#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+DECLARE_WIDGET_1(QGraphicsView, "")
+#endif
+
+// layouts
+DECLARE_LAYOUT(QGridLayout, "")
+DECLARE_LAYOUT(QHBoxLayout, "")
+DECLARE_LAYOUT(QStackedLayout, "")
+DECLARE_LAYOUT(QVBoxLayout, "")
+#ifndef QT_NO_FORMLAYOUT
+DECLARE_LAYOUT(QFormLayout, "")
+#endif