summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-20 13:41:40 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-20 13:41:40 (GMT)
commit5c4234aa7499d879f50d1475aff8cce7d3ff6c11 (patch)
tree10c930f9d1526cb2bc779469e7b97cebc21619a0 /tools
parentd05f83919949fd9604e6d96858a8404c9a580def (diff)
parentc9d73831910d4959e17899497335bd7fc4e08935 (diff)
downloadQt-5c4234aa7499d879f50d1475aff8cce7d3ff6c11.zip
Qt-5c4234aa7499d879f50d1475aff8cce7d3ff6c11.tar.gz
Qt-5c4234aa7499d879f50d1475aff8cce7d3ff6c11.tar.bz2
Merge branch 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (323 commits) Doc: these files are NOT part of the test suite of the Qt toolkit Autotest: make the licenseCheck test also check .qdoc files use egl properties when creating surfaces on symbian work around the current include file structure on Symbian^3 Get rid of the dependency on the Symbian app layer Fix incorrect license headers Fix incorrect license headers tst_qnetworkreply: Check if TCP/HTTP connection got re-used Fix bad conflict resolution from 4baa9dfb5273d7b501dcb3f456983262c53cc8d1 Fix building in a namespace on Windows Supressed Icon sizes on QPushButton in QS60Style Ensure that posted events are sent on Windows Fixed off-by-one blending errors in the NEON drawhelper code. Fixed libstdcpp.dll version autodetection for Symbian Fixed linkage failure when building qmake on Unix platforms Factored epocRoot implementation out of qmake Factored readRegistryKey implementation out of qmake Cetest extensions for Windows Mobile device power operations. Remote lib extensions for Windows Mobile device power operations. ColorDialog is always shown as stripped-down version (for QVGA) ...
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/lib/qhelpsearchengine.cpp6
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader.cpp6
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default_p.h10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_p.h6
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h9
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_default.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_default_p.h10
-rw-r--r--tools/configure/configure.pro17
-rw-r--r--tools/configure/configureapp.cpp77
-rw-r--r--tools/configure/environment.cpp128
-rw-r--r--tools/configure/environment.h5
-rw-r--r--tools/configure/tools.cpp3
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.cpp139
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.h3
-rw-r--r--tools/qtestlib/wince/cetest/main.cpp48
-rw-r--r--tools/qtestlib/wince/remotelib/commands.cpp86
-rw-r--r--tools/qtestlib/wince/remotelib/commands.h3
-rw-r--r--tools/shared/symbian/epocroot.cpp230
-rw-r--r--tools/shared/symbian/epocroot.h67
-rw-r--r--tools/shared/windows/registry.cpp161
-rw-r--r--tools/shared/windows/registry.h64
24 files changed, 927 insertions, 191 deletions
diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp
index 7c2635d..9914efa 100644
--- a/tools/assistant/lib/qhelpsearchengine.cpp
+++ b/tools/assistant/lib/qhelpsearchengine.cpp
@@ -63,9 +63,9 @@
QT_BEGIN_NAMESPACE
#if defined(QT_CLUCENE_SUPPORT)
- using namespace qt::fulltextsearch::clucene;
+ using namespace fulltextsearch::clucene;
#else
- using namespace qt::fulltextsearch::std;
+ using namespace fulltextsearch::std;
#endif
class QHelpSearchEnginePrivate : public QObject
@@ -195,7 +195,7 @@ private:
QHelpSearchQueryWidget *queryWidget;
QHelpSearchResultWidget *resultWidget;
- qt::fulltextsearch::QHelpSearchIndexReader *indexReader;
+ fulltextsearch::QHelpSearchIndexReader *indexReader;
QHelpSearchIndexWriter *indexWriter;
QPointer<QHelpEngineCore> helpEngine;
diff --git a/tools/assistant/lib/qhelpsearchindexreader.cpp b/tools/assistant/lib/qhelpsearchindexreader.cpp
index 92d7658..e79fca6 100644
--- a/tools/assistant/lib/qhelpsearchindexreader.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader.cpp
@@ -43,8 +43,7 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
+namespace fulltextsearch {
QHelpSearchIndexReader::QHelpSearchIndexReader()
: QThread()
@@ -100,7 +99,6 @@ QList<QHelpSearchEngine::SearchHit> QHelpSearchIndexReader::hits(int start,
}
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
index ee6dcfb..c2274c4 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
@@ -58,9 +58,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
QHelpSearchIndexReaderClucene::QHelpSearchIndexReaderClucene()
: QHelpSearchIndexReader()
@@ -476,8 +475,7 @@ void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engin
}
}
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default.cpp b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
index d2241a5..11a50d9 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
@@ -52,9 +52,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
namespace {
QStringList split( const QString &str )
@@ -607,8 +606,7 @@ void QHelpSearchIndexReaderDefault::run()
emit searchingFinished(hitList.count());
}
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default_p.h b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
index 8c80608..b30fa4b 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
@@ -64,9 +64,8 @@ QT_BEGIN_NAMESPACE
struct Entry;
struct PosEntry;
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
class Reader
{
@@ -127,9 +126,8 @@ private:
Reader m_reader;
};
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_p.h b/tools/assistant/lib/qhelpsearchindexreader_p.h
index b309f46..4d27c0f 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_p.h
@@ -66,8 +66,7 @@ QT_BEGIN_NAMESPACE
class QHelpEngineCore;
-namespace qt {
- namespace fulltextsearch {
+namespace fulltextsearch {
class QHelpSearchIndexReader : public QThread
{
@@ -100,8 +99,7 @@ private:
virtual void run()=0;
};
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
index 6e49e54..d9dcec5 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
@@ -64,9 +64,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
// taken from qtexthtmlparser
static const struct QTextHtmlEntity
@@ -893,8 +892,7 @@ void QHelpSearchIndexWriter::closeIndexWriter(QCLuceneIndexWriter *writer)
#endif
}
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h b/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
index 91b8abd..db1e533 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
@@ -69,9 +69,8 @@ QT_BEGIN_NAMESPACE
class QCLuceneIndexWriter;
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
class QHelpSearchIndexWriter : public QThread
{
@@ -116,9 +115,9 @@ private:
QString m_indexFilesFolder;
};
- } // namespace clucene
- } // namespace fulltextsearch
} // namespace clucene
+} // namespace fulltextsearch
+
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
index 6d09fb8..cb3e49c 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
@@ -55,9 +55,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
Writer::Writer(const QString &path)
: indexPath(path)
@@ -379,8 +378,7 @@ QString QHelpSearchIndexWriter::removeNamespace(const QString namespaces,
return value;
}
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default_p.h b/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
index b222203..625cb84 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
@@ -65,9 +65,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
class Writer
{
@@ -123,9 +122,8 @@ private:
QString m_indexFilesFolder;
};
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro
index 243183c..91de7c2 100644
--- a/tools/configure/configure.pro
+++ b/tools/configure/configure.pro
@@ -3,8 +3,8 @@ DESTDIR = ../..
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_BUILD_QMAKE QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE
-
+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
@@ -27,6 +27,7 @@ INCPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \
$$QT_SOURCE_TREE/src/corelib/global \
$$QT_BUILD_TREE/include \
$$QT_BUILD_TREE/include/QtCore \
+ $$QT_BUILD_TREE/tools/shared
HEADERS = configureapp.h environment.h tools.h\
$$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \
@@ -58,7 +59,11 @@ HEADERS = configureapp.h environment.h tools.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/tools/qunicodetables_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.h \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry.h
SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \
@@ -102,7 +107,11 @@ SOURCES = main.cpp configureapp.cpp environment.cpp tools.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/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
win32:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_win.cpp
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 77b2f66..8c2a015 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -247,7 +247,7 @@ Configure::Configure( int& argc, char** argv )
dictionary[ "PHONON" ] = "auto";
dictionary[ "PHONON_BACKEND" ] = "yes";
dictionary[ "MULTIMEDIA" ] = "yes";
- dictionary[ "AUDIO_BACKEND" ] = "yes";
+ dictionary[ "AUDIO_BACKEND" ] = "auto";
dictionary[ "DIRECTSHOW" ] = "no";
dictionary[ "WEBKIT" ] = "auto";
dictionary[ "DECLARATIVE" ] = "auto";
@@ -2068,6 +2068,52 @@ bool Configure::checkAvailability(const QString &part)
available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
} else if (part == "DECLARATIVE") {
available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h");
+ } 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.isNull() || epocRoot == "")
+ 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;
+ }
+ }
}
return available;
@@ -2156,6 +2202,8 @@ void Configure::autoDetection()
dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
if (dictionary["DECLARATIVE"] == "auto")
dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no";
+ if (dictionary["AUDIO_BACKEND"] == "auto")
+ dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
// Qt/WinCE remote test application
if (dictionary["CETEST"] == "auto")
@@ -2268,24 +2316,31 @@ void Configure::generateBuildKey()
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();
- build32Key.prepend("# define ");
- build64Key.prepend("# define ");
+ buildSymbianKey = buildSymbianKey.simplified();
+ build32Key.prepend("# define ");
+ build64Key.prepend("# define ");
+ buildSymbianKey.prepend("# define ");
- QString buildkey = // Debug builds
- "#if (defined(_DEBUG) || defined(DEBUG))\n"
- "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
+ QString buildkey = "#if defined(__SYMBIAN32__)\n"
+ + buildSymbianKey + "\"\n"
+ "#else\n"
+ // Debug builds
+ "# if (defined(_DEBUG) || defined(DEBUG))\n"
+ "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
+ build64Key.arg("debug") + "\"\n"
- "# else\n"
+ "# else\n"
+ build32Key.arg("debug") + "\"\n"
- "# endif\n"
- "#else\n"
+ "# endif\n"
+ "# else\n"
// Release builds
- "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
+ "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
+ build64Key.arg("release") + "\"\n"
- "# else\n"
+ "# else\n"
+ build32Key.arg("release") + "\"\n"
+ "# endif\n"
"# endif\n"
"#endif\n";
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index af6f9e5..e93f9a0 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -60,6 +60,8 @@ using namespace std;
#include <qt_windows.h>
#endif
+#include <symbian/epocroot.h> // from tools/shared
+#include <windows/registry.h> // from tools/shared
QT_BEGIN_NAMESPACE
@@ -97,126 +99,6 @@ CompilerInfo *Environment::compilerInfo(Compiler compiler)
}
/*!
- Returns the path part of a registry key.
- Ei.
- For a key
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
- it returns
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\"
-*/
-QString Environment::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.
- Ei.
- For a key
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
- it returns
- "ProductDir"
-*/
-QString Environment::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;
-}
-
-/*!
- Returns a registry keys value in string form.
- If the registry key does not exist, or cannot be accessed, a
- QString() is returned.
-*/
-QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
-{
-#ifndef Q_OS_WIN32
- return QString();
-#else
- 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;
-#endif
-}
-
-/*!
Returns the qmakespec for the compiler detected on the system.
*/
QString Environment::detectQMakeSpec()
@@ -579,4 +461,10 @@ bool Environment::rmdir(const QString &name)
return result;
}
+QString Environment::symbianEpocRoot()
+{
+ // Call function defined in tools/shared/symbian/epocroot.h
+ return ::epocRoot();
+}
+
QT_END_NAMESPACE
diff --git a/tools/configure/environment.h b/tools/configure/environment.h
index 2d0eafd..b1cbe3a 100644
--- a/tools/configure/environment.h
+++ b/tools/configure/environment.h
@@ -71,13 +71,12 @@ public:
static bool cpdir(const QString &srcDir, const QString &destDir);
static bool rmdir(const QString &name);
+ static QString symbianEpocRoot();
+
private:
static Compiler detectedCompiler;
static CompilerInfo *compilerInfo(Compiler compiler);
- static QString keyPath(const QString &rKey);
- static QString keyName(const QString &rKey);
- static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey);
};
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp
index aea2713..c4625af 100644
--- a/tools/configure/tools.cpp
+++ b/tools/configure/tools.cpp
@@ -146,6 +146,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
if (products == 'B') {
dictionary["EDITION"] = "Evaluation";
dictionary["QT_EDITION"] = "QT_EDITION_EVALUATION";
+ licenseType = "Evaluation";
}
}
@@ -212,7 +213,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
}
// Override for evaluation licenses
- if (dictionary["Edition"] == "Evaluation")
+ if (dictionary["EDITION"] == "Evaluation")
dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
index 56fb173..98062ed 100644
--- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp
+++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
@@ -443,6 +443,145 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo
return result;
}
+bool ActiveSyncConnection::setDeviceAwake(bool activate, int *returnValue)
+{
+ if (!isConnected()) {
+ qWarning("Cannot execute, connect to device first!");
+ return false;
+ }
+ bool result = false;
+
+ // If we want to wait, we have to use CeRapiInvoke, as CeCreateProcess has no way to wait
+ // until the process ends. The lib must have been build and also deployed already.
+ if (!isConnected() && !connect())
+ return false;
+
+ HRESULT res = S_OK;
+
+ //SYSTEM_POWER_STATUS_EX systemPowerState;
+
+ //res = CeGetSystemPowerStatusEx(&systemPowerState, true);
+
+ QString dllLocation = "\\Windows\\QtRemote.dll";
+ QString functionName = "qRemoteToggleUnattendedPowerMode";
+
+ DWORD outputSize;
+ BYTE* output;
+ IRAPIStream *stream;
+ int returned = 0;
+ int toggle = int(activate);
+
+ res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
+ if (S_OK != res) {
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
+ } else {
+ DWORD written;
+
+ if (S_OK != stream->Write(&toggle, sizeof(toggle), &written)) {
+ qWarning(" Could not write toggle option to process");
+ return false;
+ }
+
+ if (S_OK != stream->Read(&returned, sizeof(returned), &written)) {
+ qWarning(" Could not access return value of process");
+ }
+ else
+ result = true;
+ }
+
+ if (returnValue)
+ *returnValue = returned;
+
+ return result;
+}
+
+bool ActiveSyncConnection::resetDevice()
+{
+ if (!isConnected()) {
+ qWarning("Cannot execute, connect to device first!");
+ return false;
+ }
+
+ bool result = false;
+ if (!isConnected() && !connect())
+ return false;
+
+ QString dllLocation = "\\Windows\\QtRemote.dll";
+ QString functionName = "qRemoteSoftReset";
+
+ DWORD outputSize;
+ BYTE* output;
+ IRAPIStream *stream;
+
+ int returned = 0;
+
+ HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
+ if (S_OK != res) {
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
+ } else {
+ result = true;
+ }
+ return result;
+}
+
+bool ActiveSyncConnection::toggleDevicePower(int *returnValue)
+{
+ if (!isConnected()) {
+ qWarning("Cannot execute, connect to device first!");
+ return false;
+ }
+
+ bool result = false;
+ if (!isConnected() && !connect())
+ return false;
+
+ QString dllLocation = "\\Windows\\QtRemote.dll";
+ QString functionName = "qRemotePowerButton";
+
+ DWORD outputSize;
+ BYTE* output;
+ IRAPIStream *stream;
+ int returned = 0;
+
+ HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
+ if (S_OK != res) {
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
+ } else {
+ DWORD written;
+ if (S_OK != stream->Read(&returned, sizeof(returned), &written)) {
+ qWarning(" Could not access return value of process");
+ }
+ else {
+ result = true;
+ }
+ }
+
+ if (returnValue)
+ *returnValue = returned;
+ return result;
+}
+
bool ActiveSyncConnection::createDirectory(const QString &path, bool deleteBefore)
{
if (deleteBefore)
diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.h b/tools/qtestlib/wince/cetest/activesyncconnection.h
index 1891514..4502fc7 100644
--- a/tools/qtestlib/wince/cetest/activesyncconnection.h
+++ b/tools/qtestlib/wince/cetest/activesyncconnection.h
@@ -79,6 +79,9 @@ public:
bool createDirectory(const QString&, bool deleteBefore=false);
bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL);
+ bool resetDevice();
+ bool toggleDevicePower(int *returnValue = NULL);
+ bool setDeviceAwake(bool activate, int *returnValue = NULL);
private:
bool connected;
};
diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp
index 146cc5a..9fe5f02 100644
--- a/tools/qtestlib/wince/cetest/main.cpp
+++ b/tools/qtestlib/wince/cetest/main.cpp
@@ -45,6 +45,9 @@
# include "activesyncconnection.h"
#endif
+const int SLEEP_AFTER_RESET = 60000; // sleep for 1 minute
+const int SLEEP_RECONNECT = 2000; // sleep for 2 seconds before trying another reconnect
+
#include "deployment.h"
#include <option.h>
#include <project.h>
@@ -123,6 +126,8 @@ void usage()
" -debug : Test debug version[default]\n"
" -release : Test release version\n"
" -libpath <path> : Remote path to deploy Qt libraries to\n"
+ " -reset : Reset device before starting a test\n"
+ " -awake : Device does not go sleep mode\n"
" -qt-delete : Delete the Qt libraries after execution\n"
" -project-delete : Delete the project file(s) after execution\n"
" -delete : Delete everything deployed after execution\n"
@@ -152,6 +157,8 @@ int main(int argc, char **argv)
int timeout = -1;
bool cleanupQt = false;
bool cleanupProject = false;
+ bool deviceReset = false;
+ bool keepAwake = false;
for (int i=1; i<arguments.size(); ++i) {
if (arguments.at(i).toLower() == QLatin1String("-help")
@@ -196,6 +203,10 @@ int main(int argc, char **argv)
} else if (arguments.at(i).toLower() == QLatin1String("-delete")) {
cleanupQt = true;
cleanupProject = true;
+ } else if (arguments.at(i).toLower() == QLatin1String("-reset")) {
+ deviceReset = true;
+ } else if (arguments.at(i).toLower() == QLatin1String("-awake")) {
+ keepAwake = true;
} else if (arguments.at(i).toLower() == QLatin1String("-conf")) {
if (++i == arguments.size()) {
cout << "Error: No qt.conf file specified!" << endl;
@@ -353,6 +364,43 @@ int main(int argc, char **argv)
cout << "Error: Could not copy file(s) to device" << endl;
return -1;
}
+ // device power mode
+ if (keepAwake)
+ {
+ int retVal = 0;
+ if (!connection.setDeviceAwake(true, &retVal)) {
+ cout << "Error: Could not set unattended mode on device" << endl;
+ return -1;
+ }
+ }
+
+ // reset device
+ if (deviceReset)
+ {
+ if (!connection.resetDevice()) {
+ //if (!connection.toggleDevicePower( &retVal)) {
+ cout << "Error: Could not reset the device" << endl;
+ return -1;
+ }
+ cout << " Entering sleep after reset for " << SLEEP_AFTER_RESET / 1000 << " seconds ... " << endl;
+ Sleep(SLEEP_AFTER_RESET);
+ cout << " ... woke up. " << endl;
+ connection.disconnect();
+ // reconnect after reset
+ int retryCount = 21;
+ while (--retryCount)
+ {
+ if (!connection.connect())
+ Sleep(SLEEP_RECONNECT);
+ else
+ break;
+ }
+ if (!connection.isConnected())
+ {
+ cout << "Error: Could not connect to device!" << endl;
+ return -1;
+ }
+ }
// launch
launchArguments.append("-o");
diff --git a/tools/qtestlib/wince/remotelib/commands.cpp b/tools/qtestlib/wince/remotelib/commands.cpp
index 4244424..88bf9e6 100644
--- a/tools/qtestlib/wince/remotelib/commands.cpp
+++ b/tools/qtestlib/wince/remotelib/commands.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
#include "commands.h"
+#include <Pm.h>
+#include <Pmpolicy.h>
+
#define CLEAN_FAIL(a) {delete appName; \
delete arguments; \
@@ -124,3 +127,86 @@ bool qRemoteExecute(const wchar_t* program, const wchar_t* arguments, int *retur
}
return true;
}
+/**
+\brief Reset the device.
+*/
+int qRemoteSoftReset(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
+{
+ //POWER_STATE_ON On state
+ //POWER_STATE_OFF Off state
+ //POWER_STATE_CRITICAL Critical state
+ //POWER_STATE_BOOT Boot state
+ //POWER_STATE_IDLE Idle state
+ //POWER_STATE_SUSPEND Suspend state
+ //POWER_STATE_RESET Reset state
+
+ DWORD returnValue = SetSystemPowerState(0, POWER_STATE_RESET, POWER_FORCE);
+ return returnValue;
+}
+
+/**
+\brief Toggle the unattended powermode of the device
+*/
+int qRemoteToggleUnattendedPowerMode(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
+{
+ if (!stream)
+ return -1;
+
+ DWORD bytesRead;
+ int toggleVal = 0;
+ int returnValue = S_OK;
+
+ if (S_OK != stream->Read(&toggleVal, sizeof(toggleVal), &bytesRead))
+ return -2;
+
+ //PPN_REEVALUATESTATE 0x0001 Reserved. Set dwData to zero (0).
+ //PPN_POWERCHANGE 0x0002 Reserved. Set dwData to zero (0).
+ //PPN_UNATTENDEDMODE 0x0003 Set dwData to TRUE or FALSE.
+ //PPN_SUSPENDKEYPRESSED or
+ //PPN_POWERBUTTONPRESSED 0x0004 Reserved. Set dwData to zero (0).
+ //PPN_SUSPENDKEYRELEASED 0x0005 Reserved. Set dwData to zero (0).
+ //PPN_APPBUTTONPRESSED 0x0006 Reserved. Set dwData to zero (0).
+ //PPN_OEMBASE Greater than or equal to 0x10000
+ //You can define higher values, such as 0x10001, 0x10002, and so on.
+ // Reserved. Set dwData to zero (0).
+ returnValue = PowerPolicyNotify(PPN_UNATTENDEDMODE, toggleVal);
+
+ if (S_OK != stream->Write(&returnValue, sizeof(returnValue), &bytesRead))
+ return -3;
+ else
+ return S_OK;
+}
+
+/**
+\brief Virtually press the power button of the device
+*/
+int qRemotePowerButton(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
+{
+ if (!stream)
+ return -1;
+
+ DWORD bytesRead;
+ int toggleVal = 0;
+ int returnValue = S_OK;
+
+ if (S_OK != stream->Read(&toggleVal, sizeof(toggleVal), &bytesRead))
+ return -2;
+
+ //PPN_REEVALUATESTATE 0x0001 Reserved. Set dwData to zero (0).
+ //PPN_POWERCHANGE 0x0002 Reserved. Set dwData to zero (0).
+ //PPN_UNATTENDEDMODE 0x0003 Set dwData to TRUE or FALSE.
+ //PPN_SUSPENDKEYPRESSED or
+ //PPN_POWERBUTTONPRESSED 0x0004 Reserved. Set dwData to zero (0).
+ //PPN_SUSPENDKEYRELEASED 0x0005 Reserved. Set dwData to zero (0).
+ //PPN_APPBUTTONPRESSED 0x0006 Reserved. Set dwData to zero (0).
+ //PPN_OEMBASE Greater than or equal to 0x10000
+ //You can define higher values, such as 0x10001, 0x10002, and so on.
+ // Reserved. Set dwData to zero (0).
+ returnValue = PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0);
+
+ if (S_OK != stream->Write(&returnValue, sizeof(returnValue), &bytesRead))
+ return -3;
+ else
+ return S_OK;
+}
+
diff --git a/tools/qtestlib/wince/remotelib/commands.h b/tools/qtestlib/wince/remotelib/commands.h
index c5cc926..8f202c8 100644
--- a/tools/qtestlib/wince/remotelib/commands.h
+++ b/tools/qtestlib/wince/remotelib/commands.h
@@ -45,6 +45,9 @@
extern "C" {
int __declspec(dllexport) qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream*);
+ int __declspec(dllexport) qRemoteSoftReset(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream);
+ int __declspec(dllexport) qRemoteToggleUnattendedPowerMode(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream);
+ int __declspec(dllexport) qRemotePowerButton(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream);
bool __declspec(dllexport) qRemoteExecute(const wchar_t* program, const wchar_t* arguments = NULL, int *returnValue = NULL , DWORD* error = NULL, int timeout = -1);
}
diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp
new file mode 100644
index 0000000..071477d
--- /dev/null
+++ b/tools/shared/symbian/epocroot.cpp
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 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 <iostream>
+
+#include <QtCore/qdir.h>
+#include <QtCore/qxmlstream.h>
+
+#include "epocroot.h"
+#include "../windows/registry.h"
+
+// 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;
+
+#ifdef QT_BUILD_QMAKE
+std::ostream &operator<<(std::ostream &s, const QString &val) {
+ s << val.toLocal8Bit().data();
+ return s;
+}
+#else
+// Operator implemented in configureapp.cpp
+std::ostream &operator<<(std::ostream &s, const QString &val);
+#endif
+
+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 readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, 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.
+ */
+void checkEpocRootExists(const QString &source)
+{
+ if (!epocRootValue.isEmpty()) {
+ QDir dir(epocRootValue);
+ if (!dir.exists()) {
+ std::cerr << "Warning: " << source << " is set to an invalid path: " << epocRootValue << std::endl;
+ epocRootValue = QString();
+ }
+ }
+}
+
+/**
+ * Translate path from Windows to Qt format.
+ */
+static void fixEpocRoot(QString &path)
+{
+ path.replace("\\", "/");
+
+ if (path.size() > 1 && path[1] == QChar(':')) {
+ path = path.mid(2);
+ }
+
+ if (!path.size() || path[path.size()-1] != QChar('/')) {
+ path += QChar('/');
+ }
+}
+
+/**
+ * Determine the epoc root for the currently active SDK.
+ */
+QString epocRoot()
+{
+ if (epocRootValue.isEmpty()) {
+ // 1. If environment variable EPOCROOT is set and points to an existent
+ // directory, this is returned.
+ epocRootValue = qgetenv("EPOCROOT");
+ checkEpocRootExists("EPOCROOT");
+
+ 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()) {
+ std::cerr << "Error: Symbian SDK registry key not found" << std::endl;
+ } else {
+ devicesXmlPath += "/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 = qgetenv("EPOCDEVICE");
+ bool epocDeviceFound = false;
+
+ QXmlStreamReader xml(&devicesFile);
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "devices") {
+ if (xml.attributes().value("version") == "1.0") {
+ while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "device") {
+ const bool isDefault = xml.attributes().value("default") == "yes";
+ const QString id = xml.attributes().value("id").toString();
+ const QString name = xml.attributes().value("name").toString();
+ const bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue;
+ epocDeviceFound |= epocDeviceMatch;
+
+ if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) {
+ // Found a matching device
+ while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "epocroot") {
+ epocRootValue = xml.readElementText();
+ const QString deviceSource = epocDeviceValue.isEmpty()
+ ? "default device"
+ : "EPOCDEVICE (" + epocDeviceValue + ")";
+ checkEpocRootExists(deviceSource);
+ }
+ }
+
+ if (epocRootValue.isEmpty())
+ xml.raiseError("No epocroot element found");
+ }
+ }
+ }
+ } else {
+ xml.raiseError("Invalid 'devices' element version");
+ }
+ }
+ }
+ if (xml.hasError()) {
+ std::cerr << "Error: \"" << xml.errorString() << "\" when parsing devices.xml" << std::endl;
+ } else {
+ if (epocRootValue.isEmpty()) {
+ if (!epocDeviceValue.isEmpty()) {
+ if (epocDeviceFound) {
+ std::cerr << "Error: missing or invalid epocroot attribute "
+ << "in device '" << epocDeviceValue << "'";
+ } else {
+ std::cerr << "Error: no device matching EPOCDEVICE ("
+ << epocDeviceValue << ")";
+ }
+ } else {
+ if (epocDeviceFound) {
+ std::cerr << "Error: missing or invalid epocroot attribute "
+ << "in default device";
+ } else {
+ std::cerr << "Error: no default device";
+ }
+ }
+ std::cerr << " found in devices.xml file." << std::endl;
+ }
+ }
+ } else {
+ std::cerr << "Error: could not open file " << devicesXmlPath << std::endl;
+ }
+ }
+ }
+
+ if (epocRootValue.isEmpty()) {
+ // 5. An empty string is returned.
+ std::cerr << "Error: failed to find epoc root" << std::endl
+ << "Either" << std::endl
+ << " 1. Set EPOCROOT environment variable to a valid value" << std::endl
+ << " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY
+ " registry key is set, and then" << std::endl
+ << " a. Set EPOCDEVICE environment variable to a valid device" << std::endl
+ << " or b. Specify a default device in the devices.xml file." << std::endl;
+ } else {
+ fixEpocRoot(epocRootValue);
+ }
+ }
+
+ return epocRootValue;
+}
+
diff --git a/tools/shared/symbian/epocroot.h b/tools/shared/symbian/epocroot.h
new file mode 100644
index 0000000..9846485
--- /dev/null
+++ b/tools/shared/symbian/epocroot.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 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 SYMBIAN_EPOCROOT_H
+#define SYMBIAN_EPOCROOT_H
+
+#include <QtCore/qstring.h>
+
+/**
+ * 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 epocRoot();
+
+#endif // EPOCROOT_H
diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp
new file mode 100644
index 0000000..d342d78
--- /dev/null
+++ b/tools/shared/windows/registry.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 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.h"
+
+/*!
+ 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 == "Default" || res == ".")
+ res = "";
+ return res;
+}
+
+QString 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(", ");
+ 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);
+#endif
+
+ return result;
+}
+
+
diff --git a/tools/shared/windows/registry.h b/tools/shared/windows/registry.h
new file mode 100644
index 0000000..3896527
--- /dev/null
+++ b/tools/shared/windows/registry.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 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 WINDOWS_REGISTRY_H
+#define WINDOWS_REGISTRY_H
+
+#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 readRegistryKey(HKEY parentHandle, const QString &rSubkey);
+
+#endif // WINDOWS_REGISTRY_H