summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-06 20:57:24 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-06 20:57:24 (GMT)
commit1d222c8b93fd37921fdcf2baa69c5dc110fdc31f (patch)
tree55966841b5802fafaf793d7a9c75adf88fc08a3e /src
parent9aef5ac9fd2452657ca018325db54e374bdeb164 (diff)
parent2fa8b39c8a687550934e9668384f0bbe9f56f550 (diff)
downloadQt-1d222c8b93fd37921fdcf2baa69c5dc110fdc31f.zip
Qt-1d222c8b93fd37921fdcf2baa69c5dc110fdc31f.tar.gz
Qt-1d222c8b93fd37921fdcf2baa69c5dc110fdc31f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: fix autotest Adapt the TapAndHold recognizer to non-touch too add setNativeArguments() and nativeArguments() fix bogus return value from qprocess::execute() qdoc: Simplified code to enable fixing of QTBUG-6340. Doc: fixing img style
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess.cpp58
-rw-r--r--src/corelib/io/qprocess.h5
-rw-r--r--src/corelib/io/qprocess_p.h3
-rw-r--r--src/corelib/io/qprocess_symbian.cpp17
-rw-r--r--src/corelib/io/qprocess_win.cpp5
-rw-r--r--src/gui/kernel/qstandardgestures.cpp63
-rw-r--r--src/s60installs/bwins/QtCoreu.def2
-rw-r--r--src/s60installs/eabi/QtCoreu.def2
8 files changed, 121 insertions, 34 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 8eba2b0..9bc4063 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1377,6 +1377,50 @@ void QProcess::setStandardOutputProcess(QProcess *destination)
dto->stdinChannel.pipeFrom(dfrom);
}
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+
+/*!
+ \since 4.7
+
+ Returns the additional native command line arguments for the program.
+
+ \note This function is available only on the Windows and Symbian
+ platforms.
+
+ \sa setNativeArguments()
+*/
+QString QProcess::nativeArguments() const
+{
+ Q_D(const QProcess);
+ return d->nativeArguments;
+}
+
+/*!
+ \since 4.7
+ \overload
+
+ Sets additional native command line arguments for the program.
+
+ On operating systems where the system API for passing command line
+ arguments to a subprocess natively uses a single string, one can
+ conceive command lines which cannot be passed via QProcess's portable
+ list-based API. In such cases this function must be used to set a
+ string which is \e appended to the string composed from the usual
+ argument list, with a delimiting space.
+
+ \note This function is available only on the Windows and Symbian
+ platforms.
+
+ \sa nativeArguments()
+*/
+void QProcess::setNativeArguments(const QString &arguments)
+{
+ Q_D(QProcess);
+ d->nativeArguments = arguments;
+}
+
+#endif
+
/*!
If QProcess has been assigned a working directory, this function returns
the working directory that the QProcess will enter before the program has
@@ -2082,14 +2126,19 @@ QProcess::ExitStatus QProcess::exitStatus() const
process.
On Windows, arguments that contain spaces are wrapped in quotes.
+
+ If the process cannot be started, -2 is returned. If the process
+ crashes, -1 is returned. Otherwise, the process' exit code is
+ returned.
*/
int QProcess::execute(const QString &program, const QStringList &arguments)
{
QProcess process;
process.setReadChannelMode(ForwardedChannels);
process.start(program, arguments);
- process.waitForFinished(-1);
- return process.exitCode();
+ if (!process.waitForFinished(-1))
+ return -2;
+ return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
}
/*!
@@ -2104,8 +2153,9 @@ int QProcess::execute(const QString &program)
QProcess process;
process.setReadChannelMode(ForwardedChannels);
process.start(program);
- process.waitForFinished(-1);
- return process.exitCode();
+ if (!process.waitForFinished(-1))
+ return -2;
+ return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
}
/*!
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index f84b855..b07d742 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -148,6 +148,11 @@ public:
void setStandardErrorFile(const QString &fileName, OpenMode mode = Truncate);
void setStandardOutputProcess(QProcess *destination);
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QString nativeArguments() const;
+ void setNativeArguments(const QString &arguments);
+#endif
+
QString workingDirectory() const;
void setWorkingDirectory(const QString &dir);
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 60b7b5a..8b7e3ff 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -181,6 +181,9 @@ public:
QString program;
QStringList arguments;
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QString nativeArguments;
+#endif
QProcessEnvironment environment;
QRingBuffer outputReadBuffer;
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index 92212fe..af657b2 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -219,7 +219,8 @@ static bool qt_rprocess_running(RProcess *proc)
return false;
}
-static void qt_create_symbian_commandline(const QStringList &arguments, QString &commandLine)
+static void qt_create_symbian_commandline(
+ const QStringList &arguments, const QString &nativeArguments, QString &commandLine)
{
for (int i = 0; i < arguments.size(); ++i) {
QString tmp = arguments.at(i);
@@ -243,12 +244,14 @@ static void qt_create_symbian_commandline(const QStringList &arguments, QString
}
}
- // Chop the extra trailing space if any arguments were appended
- if (arguments.size())
+ if (!nativeArguments.isEmpty())
+ commandLine += nativeArguments;
+ else if (!commandLine.isEmpty()) // Chop the extra trailing space if any arguments were appended
commandLine.chop(1);
}
-static TInt qt_create_symbian_process(RProcess **proc, const QString &programName, const QStringList &arguments)
+static TInt qt_create_symbian_process(RProcess **proc,
+ const QString &programName, const QStringList &arguments, const QString &nativeArguments)
{
RProcess *newProc = NULL;
newProc = new RProcess();
@@ -257,7 +260,7 @@ static TInt qt_create_symbian_process(RProcess **proc, const QString &programNam
return KErrNoMemory;
QString commandLine;
- qt_create_symbian_commandline(arguments, commandLine);
+ qt_create_symbian_commandline(arguments, nativeArguments, commandLine);
TPtrC program_ptr(reinterpret_cast<const TText*>(programName.constData()));
TPtrC cmdline_ptr(reinterpret_cast<const TText*>(commandLine.constData()));
@@ -794,7 +797,7 @@ void QProcessPrivate::startProcess()
q, SLOT(_q_processDied()));
}
- TInt err = qt_create_symbian_process(&symbianProcess, program, arguments);
+ TInt err = qt_create_symbian_process(&symbianProcess, program, arguments, nativeArguments);
if (err == KErrNone) {
pid = symbianProcess->Id().Id();
@@ -1030,7 +1033,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
RProcess *newProc = NULL;
- TInt err = qt_create_symbian_process(&newProc, program, arguments);
+ TInt err = qt_create_symbian_process(&newProc, program, arguments, QString());
if (err == KErrNone) {
if (pid)
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index cb25a58..702349f 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -366,6 +366,11 @@ void QProcessPrivate::startProcess()
if (environment.d.constData())
envlist = qt_create_environment(environment.d.constData()->hash);
#endif
+ if (!nativeArguments.isEmpty()) {
+ if (!args.isEmpty())
+ args += QLatin1Char(' ');
+ args += nativeArguments;
+ }
#if defined QPROCESS_DEBUG
qDebug("Creating process");
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 8a3e89e..62d8a53 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -45,6 +45,7 @@
#include "qevent.h"
#include "qwidget.h"
#include "qabstractscrollarea.h"
+#include <qgraphicssceneevent.h>
#include "qdebug.h"
#ifndef QT_NO_GESTURES
@@ -509,49 +510,65 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
if (object == state && event->type() == QEvent::Timer) {
q->killTimer(d->timerId);
d->timerId = 0;
- return QGestureRecognizer::Ignore | QGestureRecognizer::ConsumeEventHint;
+ return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
}
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
-
- QGestureRecognizer::Result result = QGestureRecognizer::CancelGesture;
+ const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
+ const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
enum { TimerInterval = 2000 };
enum { TapRadius = 40 };
switch (event->type()) {
+ case QEvent::GraphicsSceneMousePress:
+ d->position = gsme->screenPos();
+ q->setHotSpot(d->position);
+ if (d->timerId)
+ q->killTimer(d->timerId);
+ d->timerId = q->startTimer(TimerInterval);
+ return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+ case QEvent::MouseButtonPress:
+ d->position = me->globalPos();
+ q->setHotSpot(d->position);
+ if (d->timerId)
+ q->killTimer(d->timerId);
+ d->timerId = q->startTimer(TimerInterval);
+ return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
case QEvent::TouchBegin:
- d->position = ev->touchPoints().at(0).pos();
+ d->position = ev->touchPoints().at(0).startScreenPos();
+ q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(TimerInterval);
- q->setHotSpot(ev->touchPoints().at(0).startScreenPos());
- result = QGestureRecognizer::TriggerGesture;
- break;
+ return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+ case QEvent::GraphicsSceneMouseRelease:
+ case QEvent::MouseButtonRelease:
case QEvent::TouchEnd:
- if (d->timerId)
- result = QGestureRecognizer::CancelGesture;
- else
- result = QGestureRecognizer::FinishGesture;
- break;
+ return QGestureRecognizer::CancelGesture; // get out of the MayBeGesture state
case QEvent::TouchUpdate:
- if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) {
+ if (d->timerId && ev->touchPoints().size() == 1) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
if (delta.manhattanLength() <= TapRadius)
- result = QGestureRecognizer::TriggerGesture;
+ return QGestureRecognizer::MayBeGesture;
}
- break;
- case QEvent::MouseButtonPress:
- case QEvent::MouseMove:
- case QEvent::MouseButtonRelease:
- result = QGestureRecognizer::Ignore;
- break;
+ return QGestureRecognizer::CancelGesture;
+ case QEvent::MouseMove: {
+ QPoint delta = me->globalPos() - d->position.toPoint();
+ if (d->timerId && delta.manhattanLength() <= TapRadius)
+ return QGestureRecognizer::MayBeGesture;
+ return QGestureRecognizer::CancelGesture;
+ }
+ case QEvent::GraphicsSceneMouseMove: {
+ QPoint delta = gsme->screenPos() - d->position.toPoint();
+ if (d->timerId && delta.manhattanLength() <= TapRadius)
+ return QGestureRecognizer::MayBeGesture;
+ return QGestureRecognizer::CancelGesture;
+ }
default:
- result = QGestureRecognizer::Ignore;
- break;
+ return QGestureRecognizer::Ignore;
}
- return result;
}
void QTapAndHoldGestureRecognizer::reset(QGesture *state)
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index 101c6a8..94be1bb 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -4482,4 +4482,6 @@ EXPORTS
?textDirection@QLocale@@QBE?AW4LayoutDirection@Qt@@XZ @ 4481 NONAME ; enum Qt::LayoutDirection QLocale::textDirection(void) const
?peek@QIODevicePrivate@@UAE_JPAD_J@Z @ 4482 NONAME ; long long QIODevicePrivate::peek(char *, long long)
?peek@QIODevicePrivate@@UAE?AVQByteArray@@_J@Z @ 4483 NONAME ; class QByteArray QIODevicePrivate::peek(long long)
+ ?nativeArguments@QProcess@@QBE?AVQString@@XZ @ 4484 NONAME ; class QString QProcess::nativeArguments(void) const
+ ?setNativeArguments@QProcess@@QAEXABVQString@@@Z @ 4485 NONAME ; void QProcess::setNativeArguments(class QString const &)
diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
index 7b9e777..46c4885 100644
--- a/src/s60installs/eabi/QtCoreu.def
+++ b/src/s60installs/eabi/QtCoreu.def
@@ -3709,4 +3709,6 @@ EXPORTS
_ZNK7QString13isRightToLeftEv @ 3708 NONAME
_ZN16QIODevicePrivate4peekEPcx @ 3709 NONAME
_ZN16QIODevicePrivate4peekEx @ 3710 NONAME
+ _ZN8QProcess18setNativeArgumentsERK7QString @ 3711 NONAME
+ _ZNK8QProcess15nativeArgumentsEv @ 3712 NONAME