diff options
author | axis <qt-info@nokia.com> | 2010-02-19 08:56:47 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-02-19 08:56:47 (GMT) |
commit | f5309598ddb3bf0f9e3bc182e78f1b2062540c98 (patch) | |
tree | f354072272452c8659e0cf21600c38136599d8b5 /qmake | |
parent | 603dc7d659084c5d092de79fec08a0baca8eaa59 (diff) | |
download | Qt-f5309598ddb3bf0f9e3bc182e78f1b2062540c98.zip Qt-f5309598ddb3bf0f9e3bc182e78f1b2062540c98.tar.gz Qt-f5309598ddb3bf0f9e3bc182e78f1b2062540c98.tar.bz2 |
Revert "Factored readRegistryKey implementation out of qmake"
This reverts commit f641369ceb7b7e2f95b9d0656b34c0517c5b95f7.
It breaks non-Symbian platforms.
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/Makefile.unix | 9 | ||||
-rw-r--r-- | qmake/Makefile.win32 | 7 | ||||
-rw-r--r-- | qmake/Makefile.win32-g++ | 5 | ||||
-rw-r--r-- | qmake/Makefile.win32-g++-sh | 5 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 97 | ||||
-rw-r--r-- | qmake/qmake.pri | 7 | ||||
-rw-r--r-- | qmake/qmake.pro | 4 |
7 files changed, 100 insertions, 34 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index e343803..fcf43c8 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -10,8 +10,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ mingw_make.o option.o winmakefile.o projectgenerator.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_dsp.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \ - symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \ - registry.o + symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ @@ -21,7 +20,6 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qgl qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o \ qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o \ qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \ - registry.o \ $(QTOBJS) @@ -34,7 +32,6 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge generators/makefiledeps.cpp option.cpp generators/win32/mingw_make.cpp generators/makefile.cpp \ generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \ - $(SOURCE_PATH)/tools/shared/windows/registry.cpp \ generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ @@ -65,7 +62,6 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ - -I$(BUILD_PATH)/tools/shared \ -DQT_NO_PCRE \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \ @@ -285,9 +281,6 @@ symmake_sbsv2.o: generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.o: generators/symbian/initprojectdeploy_symbian.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp -registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp - projectgenerator.o: generators/projectgenerator.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 3cd180c..e6bbcd5 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -34,7 +34,6 @@ CFLAGS = -c -Fo$@ \ -I$(BUILD_PATH)\src\corelib\global \ -I$(BUILD_PATH)\src\corelib\xml \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ - -I$(SOURCE_PATH)\tools\shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \ -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \ -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED \ @@ -60,7 +59,6 @@ CFLAGS = -c -o$@ \ -I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ - -I$(SOURCE_PATH)\tools\shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \ -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \ -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT @@ -77,7 +75,6 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \ borland_bmake.obj msvc_nmake.obj msvc_dsp.obj msvc_vcproj.obj \ msvc_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \ - registry.obj \ symmake_abld.obj symmake_sbsv2.obj !IFDEF QMAKE_OPENSOURCE_EDITION @@ -201,7 +198,6 @@ clean:: -del symmake_abld.obj -del symmake_sbsv2.obj -del initprojectdeploy_symbian.obj - -del registry.obj -del pbuilder_pbx.obj -del qxmlstream.obj -del qxmlutils.obj @@ -401,9 +397,6 @@ symmake_sbsv2.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.obj: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp -registry.obj: $(SOURCE_PATH)/tools/shared/windows/registry.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp - md5.obj: $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index ebc7fe2..ade379b 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -21,7 +21,6 @@ CFLAGS = -c -o$@ -O \ -I$(BUILD_PATH)/src/corelib/global \ -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ - -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ @@ -39,7 +38,6 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \ msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ - registry.o \ symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION @@ -280,9 +278,6 @@ symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp -registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp - project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 1d55da2..8d2723c 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -21,7 +21,6 @@ CFLAGS = -c -o$@ -O \ -I$(BUILD_PATH)/src/corelib/global \ -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ - -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ @@ -39,7 +38,6 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \ msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ - registry.o \ symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION @@ -279,9 +277,6 @@ symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp -registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp - project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 58f95e9..47986f5 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -67,7 +67,6 @@ QT_END_NAMESPACE #ifdef Q_OS_WIN32 #include <qt_windows.h> -#include <windows/registry.h> QT_BEGIN_NAMESPACE @@ -94,6 +93,102 @@ struct { {NETUnknown, "", ""}, }; +static QString keyPath(const QString &rKey) +{ + int idx = rKey.lastIndexOf(QLatin1Char('\\')); + if (idx == -1) + return QString(); + return rKey.left(idx + 1); +} + +static QString keyName(const QString &rKey) +{ + int idx = rKey.lastIndexOf(QLatin1Char('\\')); + if (idx == -1) + return rKey; + + QString res(rKey.mid(idx + 1)); + if (res == "Default" || res == ".") + res = ""; + return res; +} + +static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) +{ + + 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(); + } + + QString result; + 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(", "); + 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 %d type in windows registry", dataType); + break; + } + + RegCloseKey(handle); + return result; +} QT_END_NAMESPACE #endif diff --git a/qmake/qmake.pri b/qmake/qmake.pri index a2ffe15..efe4f36 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -17,8 +17,7 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \ generators/symbian/symmake.cpp \ generators/symbian/symmake_abld.cpp \ generators/symbian/symmake_sbsv2.cpp \ - generators/symbian/initprojectdeploy_symbian.cpp \ - windows/registry.cpp + generators/symbian/initprojectdeploy_symbian.cpp HEADERS += project.h property.h generators/makefile.h \ generators/unix/unixmake.h meta.h option.h cachekeys.h \ @@ -30,8 +29,8 @@ HEADERS += project.h property.h generators/makefile.h \ generators/symbian/symmake.h \ generators/symbian/symmake_abld.h \ generators/symbian/symmake_sbsv2.h \ - generators/symbian/initprojectdeploy_symbian.h \ - windows/registry.h + generators/symbian/epocroot.h \ + generators/symbian/initprojectdeploy_symbian.h contains(QT_EDITION, OpenSource) { DEFINES += QMAKE_OPENSOURCE_EDITION diff --git a/qmake/qmake.pro b/qmake/qmake.pro index f3f9d53..00dcbce 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -27,9 +27,5 @@ INCPATH += generators \ $$QT_SOURCE_TREE/include \ $$QT_SOURCE_TREE/include/QtCore \ $$QT_SOURCE_TREE/qmake - -VPATH += $$QT_SOURCE_TREE/tools/shared -INCPATH += $$QT_SOURCE_TREE/tools/shared - include(qmake.pri) |