summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/uncompressor.cpp
blob: afb88e69af11449388eaaebfae8a861ea0f4bee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/****************************************************************************
**
** 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 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$
**
****************************************************************************/

/*
  uncompressor.cpp
*/

#include "uncompressor.h"

QT_BEGIN_NAMESPACE

QList<Uncompressor *> Uncompressor::uncompressors;


/*!
  \class Uncompressor
  
  \brief The Uncompressor class is a base class for classes that
  know how to uncompress a certain kind of compressed file.

  The uncompressor contains a list of the filename extensions
  of the file types that the uncompressor knows how to uncompress.

  It maintains a static list of all the instances of Uncompressor
  that have been created. It also has a static function for searching
  that list to find the uncompressor to use for uncompressing a file
  with a certain extension.
 */

/*!
  The constructor takes a list of filename extensions, which it
  copies and saves internally. This uncompressor is prepended
  to the stack list.
 */
Uncompressor::Uncompressor( const QStringList& extensions )
    : fileExts( extensions )
{
    uncompressors.prepend( this );
}

/*!
  The destructor deletes all the filename extensions.
 */
Uncompressor::~Uncompressor()
{
    uncompressors.removeAll( this );
}

/*!
  This function searches the static list of uncompressors to find the
  first one that can handle \a fileName. If it finds an acceptable
  uncompressor, it returns a pointer to it. Otherwise it returns null.
*/
Uncompressor*
Uncompressor::uncompressorForFileName( const QString& fileName )
{
    int dot = -1;
    while ( (dot = fileName.indexOf(".", dot + 1)) != -1 ) {
        QString ext = fileName.mid( dot + 1 );
        QList<Uncompressor *>::ConstIterator u = uncompressors.begin();
        while ( u != uncompressors.end() ) {
            if ( (*u)->fileExtensions().contains(ext) )
                return *u;
            ++u;
        }
    }
    return 0;
}

QT_END_NAMESPACE
6e3ca4d00e1f5'>tools/runonphone/symbianutils/launcher.h15
-rw-r--r--tools/runonphone/symbianutils/symbiandevicemanager.cpp194
-rw-r--r--tools/runonphone/symbianutils/symbiandevicemanager.h47
-rw-r--r--tools/runonphone/symbianutils/trkdevice.cpp111
-rw-r--r--tools/runonphone/symbianutils/trkdevice.h11
-rw-r--r--tools/runonphone/trksignalhandler.cpp11
26 files changed, 636 insertions, 187 deletions
diff --git a/configure b/configure
index f95760f..f41f6e1 100755
--- a/configure
+++ b/configure
@@ -725,6 +725,7 @@ CFG_DBUS=auto
CFG_GLIB=auto
CFG_GSTREAMER=auto
CFG_QGTKSTYLE=auto
+CFG_QS60STYLE=auto
CFG_LARGEFILE=yes
CFG_OPENSSL=auto
CFG_PTMALLOC=no
@@ -1798,6 +1799,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ style-s60)
+ if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ]; then
+ CFG_QS60STYLE="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
qdbus|dbus)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
CFG_DBUS="$VAL"
@@ -3353,7 +3361,6 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
[-no-openssl] [-openssl] [-openssl-linked]
[-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
[-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]
- [-no-s60] [-s60] [-no-usedeffiles] [-usedeffiles]
[additional platform specific options (see below)]
@@ -3537,11 +3544,6 @@ EOF
fi
cat << EOF
- -no-s60 ............ Do not compile in S60 support.
- + -s60 ............... Compile with support for the S60 UI Framework.
- -no-usedeffiles .... Disable the usage of DEF files.
- * -usedeffiles ....... Enable the usage of DEF files.
-
-no-mmx ............ Do not compile with use of MMX instructions.
-no-3dnow .......... Do not compile with use of 3DNOW instructions.
-no-sse ............ Do not compile with use of SSE instructions.
@@ -3992,6 +3994,20 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
EOF
fi
+if echo "$XPLATFORM" | grep symbian > /dev/null ; then
+ cat << EOF
+
+Qt for Symbian only:
+ -no-s60 ............ Do not compile in S60 support.
+ + -s60 ............... Compile with support for the S60 UI Framework.
+ -no-style-s60....... Disable s60 style
+ + -qt-style-s60....... Enable s60 style in the Qt Library
+
+ -no-usedeffiles .... Disable the usage of DEF files.
+ * -usedeffiles ....... Enable the usage of DEF files.
+EOF
+fi
+
[ "x$ERROR" = "xyes" ] && exit 1
exit 0
fi # Help
@@ -4005,6 +4021,8 @@ if [ "$PLATFORM_QWS" = "yes" ]; then
Platform="Qt for Embedded Linux"
elif [ "$PLATFORM_MAC" = "yes" ]; then
Platform="Qt for Mac OS X"
+elif echo "$XPLATFORM" | grep "symbian" > /dev/null ; then
+ Platform="Qt for Symbian"
elif [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ]; then
PLATFORM_X11=yes
Platform="Qt for Linux/X11"
@@ -4630,15 +4648,23 @@ if [ "$CFG_ZLIB" = "auto" ]; then
fi
if [ "$CFG_S60" = "auto" ]; then
- if echo "$XQMAKESPEC" | grep symbian > /dev/null; then
+ if echo "$XPLATFORM" | grep symbian > /dev/null; then
CFG_S60=yes
else
CFG_S60=no
fi
fi
+if [ "$CFG_QS60STYLE" = "auto" ]; then
+ if echo "$XPLATFORM" | grep symbian > /dev/null; then
+ CFG_QS60STYLE=qt
+ else
+ CFG_QS60STYLE=no
+ fi
+fi
+
if [ "$CFG_SYMBIAN_DEFFILES" = "auto" ]; then
- if echo "$XQMAKESPEC" | grep symbian > /dev/null && [ "$CFG_DEV" = "no" ]; then
+ if echo "$XPLATFORM" | grep symbian > /dev/null && [ "$CFG_DEV" = "no" ]; then
CFG_SYMBIAN_DEFFILES=yes
else
CFG_SYMBIAN_DEFFILES=no
@@ -5671,6 +5697,8 @@ fi
if [ "$CFG_ENDIAN" = "auto" ]; then
if [ "$PLATFORM_MAC" = "yes" ]; then
true #leave as auto
+ elif [ "$XPLATFORM" = "symbian-sbsv2" ]; then
+ CFG_ENDIAN="Q_LITTLE_ENDIAN"
else
"$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
F="$?"
@@ -5756,7 +5784,7 @@ if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
fi
HAVE_STL=no
-if echo "$XQMAKESPEC" | grep symbian > /dev/null || "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
+if echo "$XPLATFORM" | grep symbian > /dev/null || "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
HAVE_STL=yes
fi
@@ -5910,7 +5938,7 @@ if [ "$CFG_OPENSSL" != "no" ]; then
fi
# detect OpenVG support
-if [ "$CFG_OPENVG" != "no" ]; then
+if [ "$CFG_OPENVG" != "no" ] && [ "$XPLATFORM" != "symbian-sbsv2" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
if [ "$CFG_OPENVG" = "auto" ]; then
CFG_OPENVG=yes
@@ -5994,7 +6022,7 @@ elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
fi
if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
- if echo "$XQMAKESPEC" | grep symbian > /dev/null 2>&1; then
+ if echo "$XPLATFORM" | grep symbian > /dev/null 2>&1; then
"$symbiantests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/symbian/audio "audio" $L_FLAGS $I_FLAGS $l_FLAGS
else
CFG_AUDIO_BACKEND=yes
@@ -6172,6 +6200,12 @@ else
fi
fi
+if [ "$CFG_QS60STYLE" = "no" ]; then
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_S60"
+else
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_STYLE_S60"
+fi
+
# Disable OpenGL on Symbian.
case "$XPLATFORM" in
symbian*)
diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf
index 1109060..9979f40 100644
--- a/mkspecs/features/symbian/application_icon.prf
+++ b/mkspecs/features/symbian/application_icon.prf
@@ -31,9 +31,9 @@ contains( CONFIG, no_icon ) {
# Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code
!symbian-sbsv2 {
+ !contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON #absolute path
#Makefile: requires paths with backslash
ICON_backslashed = $$ICON
- contains(QMAKE_HOST.os, "Windows"):ICON_backslashed = $$replace( ICON_backslashed, /, \\)
symbian-abld {
mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR
@@ -47,9 +47,14 @@ contains( CONFIG, no_icon ) {
# Extra compiler rules for mifconv
mifconv.target = $$mifIconZDir/$${baseTarget}.mif
+ contains(QMAKE_HOST.os, "Windows") {
+ ICON_backslashed = $$replace(ICON_backslashed, /, \\)
+ mifconv.target = $$replace(mifconv.target, /, \\)
+ }
# Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library
# svg-t icons should always use /c32 depth
mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed
+
mifconv.depends = $$ICON
PRE_TARGETDEPS += $$mifconv.target
QMAKE_EXTRA_TARGETS += mifconv
diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf
index 2dc614f..0d2e6eb 100644
--- a/mkspecs/features/symbian/qt.prf
+++ b/mkspecs/features/symbian/qt.prf
@@ -43,5 +43,5 @@ isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000
# Workaround for the fact that Gnupoc and Symbian chose different approaches to
# the letter casing of headers.
contains(CONFIG, is_using_gnupoc) {
- INCLUDEPATH += $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/header-wrappers
+ INCLUDEPATH += $$QMAKESPEC/../../common/symbian/header-wrappers
}
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
index 5fb7fe3..5b655e8 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
@@ -75,7 +75,7 @@
#include <libkern/OSAtomic.h>
#elif OS(ANDROID)
#include <cutils/atomic.h>
-#elif COMPILER(GCC) && !PLATFORM(SYMBIAN)
+#elif COMPILER(GCC) && !defined(__SYMBIAN32__)
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#include <ext/atomicity.h>
#else
@@ -239,7 +239,7 @@ inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Bar
inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); }
inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); }
-#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !PLATFORM(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
index 52a24f6..3e25c95 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
@@ -73,7 +73,7 @@
#include <windows.h>
#elif PLATFORM(DARWIN)
#include <libkern/OSAtomic.h>
-#elif COMPILER(GCC) && !PLATFORM(SYMBIAN)
+#elif COMPILER(GCC) && !defined(__SYMBIAN32__)
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#include <ext/atomicity.h>
#else
@@ -232,7 +232,7 @@ inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r
inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
-#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !PLATFORM(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 7617c1f..5ca30e6 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -464,12 +464,7 @@ void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool inter
void QSequentialAnimationGroupPrivate::activateCurrentAnimation(bool intermediate)
{
- Q_Q(QSequentialAnimationGroup);
-
- if (!currentAnimation)
- return;
-
- if (state == QSequentialAnimationGroup::Stopped)
+ if (!currentAnimation || state == QSequentialAnimationGroup::Stopped)
return;
currentAnimation->stop();
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 312c4b2..4ad78fd 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -483,38 +483,37 @@ int QMetaObject::classInfoCount() const
}
/** \internal
-* helper class for indexOf{Method,Slot,Signal}, returns the relative index of the method within
+* helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within
* the baseObject
* \a MethodType might be MethodSignal or MethodSlot, or 0 to match everything.
+* \a normalizeStringData set to true if we should do a second pass for old moc generated files normalizing all the symbols.
*/
template<int MethodType>
static inline int indexOfMethodRelative(const QMetaObject **baseObject,
const char *method,
bool normalizeStringData)
{
- const QMetaObject *m;
- for (m = *baseObject; m; m = *baseObject = m->d.superdata) {
- const QMetaObject *const m = *baseObject;
+ for (const QMetaObject *m = *baseObject; m; m = m->d.superdata) {
int i = (MethodType == MethodSignal && priv(m->d.data)->revision >= 4)
? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1);
- if (i < 0)
- continue;
-
const int end = (MethodType == MethodSlot && priv(m->d.data)->revision >= 4)
? (priv(m->d.data)->signalCount) : 0;
if (!normalizeStringData) {
for (; i >= end; --i) {
- if ((MethodType == 0 || (m->d.data[priv(m->d.data)->methodData + 5*i + 4] & MethodTypeMask) == MethodType)
- && strcmp(method, m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5*i]) == 0)
+ const char *stringdata = m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5*i];
+ if (method[0] == stringdata[0] && strcmp(method + 1, stringdata + 1) == 0) {
+ *baseObject = m;
return i;
+ }
}
} else if (priv(m->d.data)->revision < 5) {
- const char *stringdata = (m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5 * i]);
- const QByteArray normalizedSignature = QMetaObject::normalizedSignature(stringdata);
for (; i >= end; --i) {
- if ((MethodType == 0|| (m->d.data[priv(m->d.data)->methodData + 5*i + 4] & MethodTypeMask) == MethodType)
- && normalizedSignature == method)
+ const char *stringdata = (m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5 * i]);
+ const QByteArray normalizedSignature = QMetaObject::normalizedSignature(stringdata);
+ if (normalizedSignature == method) {
+ *baseObject = m;
return i;
+ }
}
}
}
@@ -537,8 +536,8 @@ int QMetaObject::indexOfConstructor(const char *constructor) const
if (priv(d.data)->revision < 2)
return -1;
for (int i = priv(d.data)->constructorCount-1; i >= 0; --i) {
- if (strcmp(constructor, d.stringdata
- + d.data[priv(d.data)->constructorData + 5*i]) == 0) {
+ const char *data = d.stringdata + d.data[priv(d.data)->constructorData + 5*i];
+ if (data[0] == constructor[0] && strcmp(constructor + 1, data + 1) == 0) {
return i;
}
}
@@ -682,18 +681,19 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co
*/
int QMetaObject::indexOfEnumerator(const char *name) const
{
- int i = -1;
const QMetaObject *m = this;
- while (m && i < 0) {
- for (i = priv(m->d.data)->enumeratorCount-1; i >= 0; --i)
- if (strcmp(name, m->d.stringdata
- + m->d.data[priv(m->d.data)->enumeratorData + 4*i]) == 0) {
+ while (m) {
+ const QMetaObjectPrivate *d = priv(m->d.data);
+ for (int i = d->enumeratorCount - 1; i >= 0; --i) {
+ const char *prop = m->d.stringdata + m->d.data[d->enumeratorData + 4*i];
+ if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) {
i += m->enumeratorOffset();
- break;
+ return i;
}
+ }
m = m->d.superdata;
}
- return i;
+ return -1;
}
/*!
@@ -704,26 +704,27 @@ int QMetaObject::indexOfEnumerator(const char *name) const
*/
int QMetaObject::indexOfProperty(const char *name) const
{
- int i = -1;
const QMetaObject *m = this;
- while (m && i < 0) {
- for (i = priv(m->d.data)->propertyCount-1; i >= 0; --i)
- if (strcmp(name, m->d.stringdata
- + m->d.data[priv(m->d.data)->propertyData + 3*i]) == 0) {
+ while (m) {
+ const QMetaObjectPrivate *d = priv(m->d.data);
+ for (int i = d->propertyCount-1; i >= 0; --i) {
+ const char *prop = m->d.stringdata + m->d.data[d->propertyData + 3*i];
+ if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) {
i += m->propertyOffset();
- break;
+ return i;
}
+ }
m = m->d.superdata;
}
- if (i == -1 && priv(this->d.data)->revision >= 3 && (priv(this->d.data)->flags & DynamicMetaObject)){
+ if (priv(this->d.data)->revision >= 3 && (priv(this->d.data)->flags & DynamicMetaObject)) {
QAbstractDynamicMetaObject *me =
const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this));
- i = me->createProperty(name, 0);
+ return me->createProperty(name, 0);
}
- return i;
+ return -1;
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 3c255ef..948ff28 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3482,7 +3482,7 @@ void QGraphicsItem::setX(qreal x)
if (qIsNaN(x))
return;
- d_ptr->setPosHelper(QPointF(x, d_ptr->pos.y()));
+ setPos(QPointF(x, d_ptr->pos.y()));
}
/*!
@@ -3509,7 +3509,7 @@ void QGraphicsItem::setY(qreal y)
if (qIsNaN(y))
return;
- d_ptr->setPosHelper(QPointF(d_ptr->pos.x(), y));
+ setPos(QPointF(d_ptr->pos.x(), y));
}
/*!
@@ -3577,7 +3577,7 @@ void QGraphicsItem::setPos(const QPointF &pos)
return;
// Update and repositition.
- if (!(d_ptr->flags & ItemSendsGeometryChanges)) {
+ if (!(d_ptr->flags & ItemSendsGeometryChanges) && !(d_ptr->flags & ItemSendsScenePositionChanges)) {
d_ptr->setPosHelper(pos);
return;
}
@@ -10936,7 +10936,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
// Item coordinates with info.
QTransform newEffectTransform = info->transformPtr->inverted();
newEffectTransform *= effectTransform;
- scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, info->exposedRegion,
+ scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform,
info->drawItem);
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index bcdc7d3..29a4be8 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4721,7 +4721,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) {
ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp,
- painter, opacity, wasDirtyParentSceneTransform, drawItem);
+ painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent);
QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source;
QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *>
(source->d_func());
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 61ad79d..4636c50 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -674,15 +674,19 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
// refresh the height cache here; we don't really lose anything by getting the size hint,
// since QAbstractItemView::dataChanged() will get the visualRect for the items anyway
- int topViewIndex = d->viewIndex(topLeft);
- if (topViewIndex == 0)
- d->defaultItemHeight = indexRowSizeHint(topLeft);
bool sizeChanged = false;
+ int topViewIndex = d->viewIndex(topLeft);
+ if (topViewIndex == 0) {
+ int newDefaultItemHeight = indexRowSizeHint(topLeft);
+ sizeChanged = d->defaultItemHeight != newDefaultItemHeight;
+ d->defaultItemHeight = newDefaultItemHeight;
+ }
+
if (topViewIndex != -1) {
if (topLeft.row() == bottomRight.row()) {
int oldHeight = d->itemHeight(topViewIndex);
d->invalidateHeightCache(topViewIndex);
- sizeChanged = (oldHeight != d->itemHeight(topViewIndex));
+ sizeChanged |= (oldHeight != d->itemHeight(topViewIndex));
if (topLeft.column() == 0)
d->viewItems[topViewIndex].hasChildren = d->hasVisibleChildren(topLeft);
} else {
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index db4ace4..1c528fe 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7999,7 +7999,7 @@ start_lengthVariant:
for (int i = 0; i < textLayout.lineCount(); i++) {
QTextLine line = textLayout.lineAt(i);
- qreal advance = textLayout.engine()->lines[i].textAdvance.toReal();
+ qreal advance = line.horizontalAdvance();
if (tf & Qt::AlignRight)
xoff = r.width() - advance;
else if (tf & Qt::AlignHCenter)
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 6138e85..4a279a7 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -63,7 +63,7 @@
#include <AknUtils.h>
#include <aknnavi.h>
#include <gulicon.h>
-#include <AknBitmapAnimation.h>
+#include <aknbitmapanimation.h>
#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 766053c..2fc5d1a 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1570,6 +1570,20 @@ qreal QTextLine::naturalTextWidth() const
return eng->lines[i].textWidth.toReal();
}
+/*! \since 4.7
+ Returns the horizontal advance of the text. The advance of the text
+ is the distance from its position to the next position at which
+ text would naturally be drawn.
+
+ By adding the advance to the position of the text line and using this
+ as the position of a second text line, you will be able to position
+ the two lines side-by-side without gaps in-between.
+*/
+qreal QTextLine::horizontalAdvance() const
+{
+ return eng->lines[i].textAdvance.toReal();
+}
+
/*!
Lays out the line with the given \a width. The line is filled from
its starting position with as many characters as will fit into
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index edae7de..8c93ed6 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -202,6 +202,7 @@ public:
bool leadingIncluded() const;
qreal naturalTextWidth() const;
+ qreal horizontalAdvance() const;
QRectF naturalTextRect() const;
enum Edge {
diff --git a/src/qt3support/network/q3socketdevice_win.cpp b/src/qt3support/network/q3socketdevice_win.cpp
index 528b50a..1354cfa 100644
--- a/src/qt3support/network/q3socketdevice_win.cpp
+++ b/src/qt3support/network/q3socketdevice_win.cpp
@@ -47,7 +47,6 @@
#include <string.h>
-# include <qt_windows.h>
#if defined (QT_NO_IPV6)
# include <winsock.h>
#else
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index c0ad8bf..92a7f2e 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -7719,7 +7719,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
QTest::qWait(50);
// Make sure all visible items are repainted.
- QCOMPARE(item1->repaints, 0);
+ QCOMPARE(item1->repaints, 1);
QCOMPARE(item2->repaints, 1);
QCOMPARE(item3->repaints, 1);
@@ -9819,6 +9819,16 @@ void tst_QGraphicsItem::scenePosChange()
QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 4);
QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+
+ root->setX(1);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 5);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+
+ root->setY(1);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 6);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
}
void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor()
diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 6ef4305..3b2a716 100644
--- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -93,6 +93,7 @@ private slots:
void task232634_childrenDeselectionSignal();
void task260134_layoutChangedWithAllSelected();
void QTBUG5671_layoutChangedWithAllSelected();
+ void QTBUG2804_layoutChangedTreeSelection();
private:
QAbstractItemModel *model;
@@ -2327,5 +2328,31 @@ void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected()
QVERIFY(selection.isSelected(index));
}
+void tst_QItemSelectionModel::QTBUG2804_layoutChangedTreeSelection()
+{
+ QStandardItemModel model;
+ QStandardItem top1("Child1"), top2("Child2"), top3("Child3");
+ QStandardItem sub11("Alpha"), sub12("Beta"), sub13("Gamma"), sub14("Delta"),
+ sub21("Alpha"), sub22("Beta"), sub23("Gamma"), sub24("Delta");
+ top1.appendColumn(QList<QStandardItem*>() << &sub11 << &sub12 << &sub13 << &sub14);
+ top2.appendColumn(QList<QStandardItem*>() << &sub21 << &sub22 << &sub23 << &sub24);
+ model.appendColumn(QList<QStandardItem*>() << &top1 << &top2 << &top3);
+
+ QItemSelectionModel selModel(&model);
+
+ selModel.select(sub11.index(), QItemSelectionModel::Select);
+ selModel.select(sub12.index(), QItemSelectionModel::Select);
+ selModel.select(sub21.index(), QItemSelectionModel::Select);
+ selModel.select(sub23.index(), QItemSelectionModel::Select);
+
+ QModelIndexList list = selModel.selectedIndexes();
+ QCOMPARE(list.count(), 4);
+
+ model.sort(0); //this will provoke a relayout
+
+ QCOMPARE(selModel.selectedIndexes().count(), 4);
+}
+
+
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 0161a68..8da3484 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -128,6 +128,7 @@ private slots:
void isSignalConnected();
void qMetaObjectConnect();
void qMetaObjectDisconnectOne();
+ void sameName();
protected:
};
@@ -162,7 +163,7 @@ class SenderObject : public QObject
Q_OBJECT
public:
- SenderObject() : recursionCount(0) {}
+ SenderObject() : aPublicSlotCalled(0), recursionCount(0) {}
void emitSignal1AfterRecursion()
{
@@ -185,11 +186,12 @@ signals:
QT_MOC_COMPAT void signal5();
public slots:
- void aPublicSlot(){}
+ void aPublicSlot() { aPublicSlotCalled++; }
public:
Q_INVOKABLE void invoke1(){}
Q_SCRIPTABLE void sinvoke1(){}
+ int aPublicSlotCalled;
protected:
Q_INVOKABLE QT_MOC_COMPAT void invoke2(){}
Q_INVOKABLE QT_MOC_COMPAT void invoke2(int){}
@@ -429,12 +431,14 @@ public:
public slots:
void on_Sender_signalNoParams() { ++called_slot1; }
- void on_Sender_signalWithParams(int i = 0) { ++called_slot2; }
- void on_Sender_signalWithParams(int i, QString string) { ++called_slot3; }
+ void on_Sender_signalWithParams(int i = 0) { ++called_slot2; Q_UNUSED(i); }
+ void on_Sender_signalWithParams(int i, QString string) { ++called_slot3; Q_UNUSED(i);Q_UNUSED(string); }
void on_Sender_signalManyParams() { ++called_slot4; }
- void on_Sender_signalManyParams(int i1, int i2, int i3, QString string, bool onoff) { ++called_slot5; }
- void on_Sender_signalManyParams(int i1, int i2, int i3, QString string, bool onoff, bool dummy) { ++called_slot6; }
- void on_Sender_signalManyParams2(int i1, int i2, int i3, QString string, bool onoff) { ++called_slot7; }
+ void on_Sender_signalManyParams(int i1, int i2, int i3, QString string, bool onoff) { ++called_slot5; Q_UNUSED(i1);Q_UNUSED(i2);Q_UNUSED(i3);Q_UNUSED(string);Q_UNUSED(onoff); }
+ void on_Sender_signalManyParams(int i1, int i2, int i3, QString string, bool onoff, bool dummy)
+ { ++called_slot6; Q_UNUSED(i1);Q_UNUSED(i2);Q_UNUSED(i3);Q_UNUSED(string);Q_UNUSED(onoff); Q_UNUSED(dummy);}
+ void on_Sender_signalManyParams2(int i1, int i2, int i3, QString string, bool onoff)
+ { ++called_slot7; Q_UNUSED(i1);Q_UNUSED(i2);Q_UNUSED(i3);Q_UNUSED(string);Q_UNUSED(onoff); }
void slotLoopBack() { ++called_slot8; }
protected slots:
@@ -2090,21 +2094,21 @@ public slots:
void constUintPointerSlot(const uint *) { }
void constUlongPointerSlot(const ulong *) { }
- void structSlot(Struct s) { }
- void classSlot(Class c) { }
- void enumSlot(Enum e) { }
+ void structSlot(Struct s) { Q_UNUSED(s); }
+ void classSlot(Class c) { Q_UNUSED(c); }
+ void enumSlot(Enum e) { Q_UNUSED(e); }
- void structPointerSlot(Struct *s) { }
- void classPointerSlot(Class *c) { }
- void enumPointerSlot(Enum *e) { }
+ void structPointerSlot(Struct *s) { Q_UNUSED(s); }
+ void classPointerSlot(Class *c) { Q_UNUSED(c); }
+ void enumPointerSlot(Enum *e) { Q_UNUSED(e); }
- void constStructPointerSlot(const Struct *s) { }
- void constClassPointerSlot(const Class *c) { }
- void constEnumPointerSlot(const Enum *e) { }
+ void constStructPointerSlot(const Struct *s) { Q_UNUSED(s); }
+ void constClassPointerSlot(const Class *c) { Q_UNUSED(c); }
+ void constEnumPointerSlot(const Enum *e) { Q_UNUSED(e); }
- void constStructPointerConstPointerSlot(const Struct * const *s) { }
- void constClassPointerConstPointerSlot(const Class * const *c) { }
- void constEnumPointerConstPointerSlot(const Enum * const *e) { }
+ void constStructPointerConstPointerSlot(const Struct * const *s) { Q_UNUSED(s); }
+ void constClassPointerConstPointerSlot(const Class * const *c) { Q_UNUSED(c); }
+ void constEnumPointerConstPointerSlot(const Enum * const *e) { Q_UNUSED(e); }
void uintSlot(uint) {};
void unsignedintSlot(unsigned int) {};
@@ -3550,5 +3554,41 @@ void tst_QObject::qMetaObjectDisconnectOne()
delete r1;
}
+class ConfusingObject : public SenderObject
+{ Q_OBJECT
+public slots:
+ void signal1() { s++; }
+signals:
+ void aPublicSlot();
+public:
+ int s;
+ ConfusingObject() : s(0) {}
+ friend class tst_QObject;
+};
+
+void tst_QObject::sameName()
+{
+ ConfusingObject c1, c2;
+ QVERIFY(connect(&c1, SIGNAL(signal1()), &c1, SLOT(signal1())));
+ c1.emitSignal1();
+ QCOMPARE(c1.s, 1);
+
+ QVERIFY(connect(&c2, SIGNAL(signal1()), &c1, SIGNAL(signal1())));
+ c2.emitSignal1();
+ QCOMPARE(c1.s, 2);
+
+ QVERIFY(connect(&c2, SIGNAL(aPublicSlot()), &c1, SLOT(signal1())));
+ c2.aPublicSlot();
+ QCOMPARE(c2.aPublicSlotCalled, 0);
+ QCOMPARE(c1.aPublicSlotCalled, 0);
+ QCOMPARE(c1.s, 3);
+
+ QVERIFY(connect(&c2, SIGNAL(aPublicSlot()), &c1, SLOT(aPublicSlot())));
+ c2.aPublicSlot();
+ QCOMPARE(c2.aPublicSlotCalled, 0);
+ QCOMPARE(c1.aPublicSlotCalled, 1);
+ QCOMPARE(c1.s, 4);
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index af08777..80e5e34 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -44,6 +44,7 @@
#include <QStringList>
#include <QScopedPointer>
#include <QTimer>
+#include <QFileInfo>
#include "symbianutils/trkutils.h"
#include "symbianutils/trkdevice.h"
#include "symbianutils/launcher.h"
@@ -51,9 +52,9 @@
#include "trksignalhandler.h"
#include "serenum.h"
-void printUsage(QTextStream& outstream)
+void printUsage(QTextStream& outstream, QString exeName)
{
- outstream << "runtest [options] <program> [program arguments]" << endl
+ outstream << exeName << " [options] [program] [program arguments]" << endl
<< "-s, --sis <file> specify sis file to install" << endl
<< "-p, --portname <COMx> specify COM port to use by device name" << endl
<< "-f, --portfriendlyname <substring> specify COM port to use by friendly name" << endl
@@ -61,7 +62,9 @@ void printUsage(QTextStream& outstream)
<< "-v, --verbose show debugging output" << endl
<< "-q, --quiet hide progress messages" << endl
<< endl
- << "USB COM ports can usually be autodetected" << endl;
+ << "USB COM ports can usually be autodetected, use -p or -f to force a specific port." << endl
+ << "If using System TRK, it is possible to copy the program directly to sys/bin on the phone." << endl
+ << "-s can be used with both System and Application TRK to install the program" << endl;
}
int main(int argc, char *argv[])
@@ -86,22 +89,22 @@ int main(int argc, char *argv[])
return 1;
}
QString param = args.at(i+1);
- if(arg.compare("--portname", Qt::CaseSensitive) == 0
+ if (arg.compare("--portname", Qt::CaseSensitive) == 0
|| arg.compare("-p", Qt::CaseSensitive) == 0) {
serialPortName = param;
i++;
}
- else if(arg.compare("--portfriendlyname", Qt::CaseSensitive) == 0
+ else if (arg.compare("--portfriendlyname", Qt::CaseSensitive) == 0
|| arg.compare("-f", Qt::CaseSensitive) == 0) {
serialPortFriendlyName = param;
i++;
}
- else if(arg.compare("--sis", Qt::CaseSensitive) == 0
+ else if (arg.compare("--sis", Qt::CaseSensitive) == 0
|| arg.compare("-s", Qt::CaseSensitive) == 0) {
sisFile = param;
i++;
}
- else if(arg.compare("--timeout", Qt::CaseSensitive) == 0
+ else if (arg.compare("--timeout", Qt::CaseSensitive) == 0
|| arg.compare("-t", Qt::CaseSensitive) == 0) {
bool ok;
timeout = param.toInt(&ok);
@@ -111,10 +114,10 @@ int main(int argc, char *argv[])
}
i++;
}
- else if(arg.compare("--verbose", Qt::CaseSensitive) == 0
+ else if (arg.compare("--verbose", Qt::CaseSensitive) == 0
|| arg.compare("-v", Qt::CaseSensitive) == 0)
loglevel=2;
- else if(arg.compare("--quiet", Qt::CaseSensitive) == 0
+ else if (arg.compare("--quiet", Qt::CaseSensitive) == 0
|| arg.compare("-q", Qt::CaseSensitive) == 0)
loglevel=0;
else
@@ -128,8 +131,8 @@ int main(int argc, char *argv[])
}
}
- if(exeFile.isEmpty()) {
- printUsage(outstream);
+ if (exeFile.isEmpty() && sisFile.isEmpty()) {
+ printUsage(outstream, args[0]);
return 1;
}
@@ -161,24 +164,26 @@ int main(int argc, char *argv[])
}
QScopedPointer<trk::Launcher> launcher;
-
- if (sisFile.isEmpty()) {
- launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun));
- launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile);
- errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl;
- } else {
- launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyInstallRun));
- launcher->addStartupActions(trk::Launcher::ActionInstall);
+ launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly));
+ QFileInfo info(exeFile);
+ if (!sisFile.isEmpty()) {
+ launcher->addStartupActions(trk::Launcher::ActionCopyInstall);
launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis");
launcher->setInstallFileName("c:\\data\\testtemp.sis");
}
+ else if (info.exists()) {
+ launcher->addStartupActions(trk::Launcher::ActionCopy);
+ launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + info.fileName());
+ }
+ if (!exeFile.isEmpty()) {
+ launcher->addStartupActions(trk::Launcher::ActionRun);
+ launcher->setFileName(QString("c:\\sys\\bin\\") + info.fileName());
+ launcher->setCommandLineArgs(cmdLine);
+ }
if (loglevel > 0)
outstream << "Connecting to target via " << serialPortName << endl;
launcher->setTrkServerName(serialPortName);
- launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile);
- launcher->setCommandLineArgs(cmdLine);
-
if (loglevel > 1)
launcher->setVerbose(1);
diff --git a/tools/runonphone/symbianutils/launcher.cpp b/tools/runonphone/symbianutils/launcher.cpp
index 408829b..92b494a 100644
--- a/tools/runonphone/symbianutils/launcher.cpp
+++ b/tools/runonphone/symbianutils/launcher.cpp
@@ -44,6 +44,7 @@
#include "trkutils_p.h"
#include "trkdevice.h"
#include "bluetoothlistener.h"
+#include "symbiandevicemanager.h"
#include <QtCore/QTimer>
#include <QtCore/QDateTime>
@@ -100,12 +101,15 @@ Launcher::Launcher(Actions startupActions,
d(new LauncherPrivate(dev))
{
d->m_startupActions = startupActions;
- connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));
- connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
+ connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));
}
Launcher::~Launcher()
{
+ // Destroyed before protocol was through: Close
+ if (d->m_closeDevice && d->m_device->isOpen())
+ d->m_device->close();
+ emit destroyed(d->m_device->port());
logMessage("Shutting down.\n");
delete d;
}
@@ -214,11 +218,6 @@ bool Launcher::startServer(QString *errorMessage)
}
if (!d->m_device->isOpen() && !d->m_device->open(errorMessage))
return false;
- if (d->m_closeDevice) {
- connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
- } else {
- disconnect(this, SIGNAL(finished()), d->m_device.data(), 0);
- }
setState(Connecting);
// Set up the temporary 'waiting' state if we do not get immediate connection
QTimer::singleShot(1000, this, SLOT(slotWaitingForTrk()));
@@ -266,6 +265,13 @@ void Launcher::logMessage(const QString &msg)
qDebug() << "LAUNCHER: " << qPrintable(msg);
}
+void Launcher::handleFinished()
+{
+ if (d->m_closeDevice)
+ d->m_device->close();
+ emit finished();
+}
+
void Launcher::terminate()
{
switch (state()) {
@@ -287,7 +293,7 @@ void Launcher::terminate()
case Connecting:
case WaitingForTrk:
setState(Disconnected);
- emit finished();
+ handleFinished();
break;
}
}
@@ -446,7 +452,7 @@ void Launcher::handleTrkVersion(const TrkResult &result)
if (result.errorCode() || result.data.size() < 5) {
if (d->m_startupActions == ActionPingOnly) {
setState(Disconnected);
- emit finished();
+ handleFinished();
}
return;
}
@@ -455,11 +461,13 @@ void Launcher::handleTrkVersion(const TrkResult &result)
d->m_session.trkAppVersion.protocolMajor = result.data.at(3);
d->m_session.trkAppVersion.protocolMinor = result.data.at(4);
setState(DeviceDescriptionReceived);
+ const QString msg = deviceDescription();
+ emit deviceDescriptionReceived(trkServerName(), msg);
// Ping mode: Log & Terminate
if (d->m_startupActions == ActionPingOnly) {
- qWarning("%s", qPrintable(deviceDescription()));
+ qWarning("%s", qPrintable(msg));
setState(Disconnected);
- emit finished();
+ handleFinished();
}
}
@@ -586,7 +594,7 @@ void Launcher::handleWaitForFinished(const TrkResult &result)
{
logMessage(" FINISHED: " + stringFromArray(result.data));
setState(Disconnected);
- emit finished();
+ handleFinished();
}
void Launcher::handleSupportMask(const TrkResult &result)
@@ -704,18 +712,14 @@ QByteArray Launcher::startProcessMessage(const QString &executable,
{
// It's not started yet
QByteArray ba;
- appendShort(&ba, 0, TargetByteOrder); // create new process
+ appendShort(&ba, 0, TargetByteOrder); // create new process (kDSOSProcessItem)
ba.append(char(0)); // options - currently unused
- if(arguments.isEmpty()) {
- appendString(&ba, executable.toLocal8Bit(), TargetByteOrder);
- return ba;
- }
- // Append full command line as one string (leading length information).
- QByteArray commandLineBa;
- commandLineBa.append(executable.toLocal8Bit());
- commandLineBa.append('\0');
- commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit());
- appendString(&ba, commandLineBa, TargetByteOrder);
+ // One string consisting of binary terminated by '\0' and arguments terminated by '\0'
+ QByteArray commandLineBa = executable.toLocal8Bit();
+ commandLineBa.append(char(0));
+ if (!arguments.isEmpty())
+ commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit());
+ appendString(&ba, commandLineBa, TargetByteOrder, true);
return ba;
}
@@ -737,4 +741,37 @@ void Launcher::resumeProcess(uint pid, uint tid)
appendInt(&ba, tid, BigEndian);
d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
}
+
+// Acquire a device from SymbianDeviceManager, return 0 if not available.
+Launcher *Launcher::acquireFromDeviceManager(const QString &serverName,
+ QObject *parent,
+ QString *errorMessage)
+{
+ SymbianUtils::SymbianDeviceManager *sdm = SymbianUtils::SymbianDeviceManager::instance();
+ const QSharedPointer<trk::TrkDevice> device = sdm->acquireDevice(serverName);
+ if (device.isNull()) {
+ *errorMessage = tr("Unable to acquire a device for port '%1'. It appears to be in use.").arg(serverName);
+ return 0;
+ }
+ // Wire release signal.
+ Launcher *rc = new Launcher(trk::Launcher::ActionPingOnly, device, parent);
+ connect(rc, SIGNAL(deviceDescriptionReceived(QString,QString)),
+ sdm, SLOT(setAdditionalInformation(QString,QString)));
+ connect(rc, SIGNAL(destroyed(QString)), sdm, SLOT(releaseDevice(QString)));
+ return rc;
+}
+
+// Preliminary release of device, disconnecting the signal.
+void Launcher::releaseToDeviceManager(Launcher *launcher)
+{
+ SymbianUtils::SymbianDeviceManager *sdm = SymbianUtils::SymbianDeviceManager::instance();
+ // Disentangle launcher and its device, remove connection from destroyed
+ launcher->setCloseDevice(false);
+ TrkDevice *device = launcher->trkDevice().data();
+ launcher->disconnect(device);
+ device->disconnect(launcher);
+ launcher->disconnect(sdm);
+ sdm->releaseDevice(launcher->trkServerName());
+}
+
} // namespace trk
diff --git a/tools/runonphone/symbianutils/launcher.h b/tools/runonphone/symbianutils/launcher.h