summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-09-25 10:55:05 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-09-25 10:55:05 (GMT)
commit1694e404916d1dc275da17f9cc433338e0db7714 (patch)
tree4b578434e67adf05a1da69fa7847116563e522d1
parent165767d7ca890e9da9c660034fd76393fe7e87e1 (diff)
parent17387e79ddfc867feb8f65f18b6ad49e6403d0e7 (diff)
downloadQt-1694e404916d1dc275da17f9cc433338e0db7714.zip
Qt-1694e404916d1dc275da17f9cc433338e0db7714.tar.gz
Qt-1694e404916d1dc275da17f9cc433338e0db7714.tar.bz2
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
-rwxr-xr-xbin/patch_capabilities.pl4
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.cpp27
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.h5
-rw-r--r--demos/embedded/fluidlauncher/slideshow.cpp5
-rw-r--r--demos/embedded/fluidlauncher/slideshow.h2
-rw-r--r--demos/embedded/raycasting/raycasting.cpp86
-rw-r--r--examples/animation/animatedtiles/main.cpp34
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp133
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex_p.h4
-rw-r--r--src/gui/graphicsview/qsimplex_p.cpp151
-rw-r--r--src/gui/kernel/qapplication_s60.cpp19
-rw-r--r--tests/auto/networkselftest/networkselftest.pro15
-rw-r--r--tests/auto/networkselftest/rfc3252.txt899
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp34
-rw-r--r--tests/auto/qfocusevent/tst_qfocusevent.cpp10
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp47
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp6
-rw-r--r--tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp10
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp79
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp10
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp11
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar.cpp2
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertysheet.cpp11
-rw-r--r--tools/designer/translations/translations.pro2
-rw-r--r--tools/linguist/linguist/linguist.pro3
-rw-r--r--tools/linguist/phrasebooks/russian.qph92
30 files changed, 1558 insertions, 162 deletions
diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl
index 2fcf703..bfd34f0 100755
--- a/bin/patch_capabilities.pl
+++ b/bin/patch_capabilities.pl
@@ -51,8 +51,8 @@ sub Usage() {
print("specified for deployment in a .pkg file.\n");
print("If no capabilities are given, the binaries will be given the\n");
print("capabilities supported by self-signed certificates.\n");
- print("\nUsage: patch_capabilities.pl pkg_filename [target-platform] [capability list]\n");
- print(" If template .pkg file is given, next agrument must be 'target-platform'.\n");
+ print("\n *** NOTE: If *_template.pkg file is given, 'target-platform' is REQUIRED. ***\n");
+ print("\nUsage: patch_capabilities.pl pkg_filename <target-platform> [capability list]\n");
print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n");
exit();
}
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.cpp b/demos/embedded/fluidlauncher/fluidlauncher.cpp
index 808f362..3cd3f3c 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.cpp
+++ b/demos/embedded/fluidlauncher/fluidlauncher.cpp
@@ -54,6 +54,10 @@ FluidLauncher::FluidLauncher(QStringList* args)
slideShowWidget = new SlideShow();
inputTimer = new QTimer();
+ addWidget(pictureFlowWidget);
+ addWidget(slideShowWidget);
+ setCurrentWidget(pictureFlowWidget);
+
QRect screen_size = QApplication::desktop()->screenGeometry();
QObject::connect(pictureFlowWidget, SIGNAL(itemActivated(int)), this, SLOT(launchApplication(int)));
@@ -80,7 +84,7 @@ FluidLauncher::FluidLauncher(QStringList* args)
if (success) {
populatePictureFlow();
- pictureFlowWidget->showFullScreen();
+ showFullScreen();
inputTimer->start();
} else {
pictureFlowWidget->setAttribute(Qt::WA_DeleteOnClose, true);
@@ -222,7 +226,6 @@ void FluidLauncher::launchApplication(int index)
}
inputTimer->stop();
- pictureFlowWidget->hide();
QObject::connect(demoList[index], SIGNAL(demoFinished()), this, SLOT(demoFinished()));
@@ -234,6 +237,7 @@ void FluidLauncher::switchToLauncher()
{
slideShowWidget->stopShow();
inputTimer->start();
+ setCurrentWidget(pictureFlowWidget);
}
@@ -253,11 +257,28 @@ void FluidLauncher::switchToSlideshow()
{
inputTimer->stop();
slideShowWidget->startShow();
+ setCurrentWidget(slideShowWidget);
}
void FluidLauncher::demoFinished()
{
- pictureFlowWidget->showFullScreen();
+ setCurrentWidget(pictureFlowWidget);
inputTimer->start();
}
+void FluidLauncher::changeEvent(QEvent* event)
+{
+ if (event->type() == QEvent::ActivationChange) {
+ if (isActiveWindow()) {
+ if(currentWidget() == pictureFlowWidget) {
+ resetInputTimeout();
+ } else {
+ slideShowWidget->startShow();
+ }
+ } else {
+ inputTimer->stop();
+ slideShowWidget->stopShow();
+ }
+ }
+ QStackedWidget::changeEvent(event);
+}
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.h b/demos/embedded/fluidlauncher/fluidlauncher.h
index 2c40526..ff742e2 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.h
+++ b/demos/embedded/fluidlauncher/fluidlauncher.h
@@ -50,7 +50,7 @@
#include "slideshow.h"
#include "demoapplication.h"
-class FluidLauncher : public QObject
+class FluidLauncher : public QStackedWidget
{
Q_OBJECT
@@ -65,6 +65,9 @@ public slots:
void inputTimedout();
void demoFinished();
+protected:
+ void changeEvent(QEvent *event);
+
private:
PictureFlow* pictureFlowWidget;
SlideShow* slideShowWidget;
diff --git a/demos/embedded/fluidlauncher/slideshow.cpp b/demos/embedded/fluidlauncher/slideshow.cpp
index a397c2b..55daedf 100644
--- a/demos/embedded/fluidlauncher/slideshow.cpp
+++ b/demos/embedded/fluidlauncher/slideshow.cpp
@@ -83,7 +83,8 @@ void SlideShowPrivate::showNextSlide()
-SlideShow::SlideShow()
+SlideShow::SlideShow(QWidget* parent) :
+ QWidget(parent)
{
d = new SlideShowPrivate;
@@ -125,7 +126,6 @@ void SlideShow::clearImages()
void SlideShow::startShow()
{
- showFullScreen();
d->interSlideTimer.start(d->slideInterval, this);
d->showNextSlide();
update();
@@ -134,7 +134,6 @@ void SlideShow::startShow()
void SlideShow::stopShow()
{
- hide();
d->interSlideTimer.stop();
}
diff --git a/demos/embedded/fluidlauncher/slideshow.h b/demos/embedded/fluidlauncher/slideshow.h
index 6d51662..214652e 100644
--- a/demos/embedded/fluidlauncher/slideshow.h
+++ b/demos/embedded/fluidlauncher/slideshow.h
@@ -53,7 +53,7 @@ class SlideShow : public QWidget
Q_PROPERTY(int slideInterval READ slideInterval WRITE setSlideInterval)
public:
- SlideShow();
+ SlideShow(QWidget* parent = 0);
~SlideShow();
void addImage(QString filename);
void addImageDir(QString dirName);
diff --git a/demos/embedded/raycasting/raycasting.cpp b/demos/embedded/raycasting/raycasting.cpp
index 3836dc1..c3b21b6 100644
--- a/demos/embedded/raycasting/raycasting.cpp
+++ b/demos/embedded/raycasting/raycasting.cpp
@@ -71,7 +71,8 @@ public:
, angle(0.5)
, playerPos(1.5, 1.5)
, angleDelta(0)
- , moveDelta(0) {
+ , moveDelta(0)
+ , touchDevice(false) {
// http://www.areyep.com/RIPandMCS-TextureLibrary.html
textureImg.load(":/textures.png");
@@ -83,6 +84,7 @@ public:
watch.start();
ticker.start(25, this);
setAttribute(Qt::WA_OpaquePaintEvent, true);
+ setMouseTracking(false);
}
void updatePlayer() {
@@ -114,10 +116,12 @@ public:
void render() {
// setup the screen surface
- if (buffer.size() != size())
- buffer = QImage(size(), QImage::Format_ARGB32);
+ if (buffer.size() != bufferSize)
+ buffer = QImage(bufferSize, QImage::Format_ARGB32);
int bufw = buffer.width();
int bufh = buffer.height();
+ if (bufw <= 0 || bufh <= 0)
+ return;
// we intentionally cheat here, to avoid detach
const uchar *ptr = buffer.bits();
@@ -241,11 +245,36 @@ public:
*pixel2 = qRgb(96, 96, 96);
}
- update();
+ update(QRect(QPoint(0, 0), bufferSize));
}
protected:
+ void resizeEvent(QResizeEvent*) {
+#if defined(Q_OS_SYMBIAN)
+ // FIXME: use HAL
+ if (width() > 480 || height() > 480)
+ touchDevice = true;
+#else
+ touchDevice = false;
+#endif
+ if (touchDevice) {
+ if (width() < height()) {
+ trackPad = QRect(0, height() / 2, width(), height() / 2);
+ centerPad = QPoint(width() / 2, height() * 3 / 4);
+ bufferSize = QSize(width(), height() / 2);
+ } else {
+ trackPad = QRect(width() / 2, 0, width() / 2, height());
+ centerPad = QPoint(width() * 3 / 4, height() / 2);
+ bufferSize = QSize(width() / 2, height());
+ }
+ } else {
+ trackPad = QRect();
+ bufferSize = size();
+ }
+ update();
+ }
+
void timerEvent(QTimerEvent*) {
updatePlayer();
render();
@@ -255,7 +284,33 @@ protected:
void paintEvent(QPaintEvent *event) {
QPainter p(this);
p.setCompositionMode(QPainter::CompositionMode_Source);
+
p.drawImage(event->rect(), buffer, event->rect());
+
+ if (touchDevice && event->rect().intersects(trackPad)) {
+ p.fillRect(trackPad, Qt::white);
+ p.setPen(QPen(QColor(224, 224, 224), 6));
+ int rad = qMin(trackPad.width(), trackPad.height()) * 0.3;
+ p.drawEllipse(centerPad, rad, rad);
+
+ p.setPen(Qt::NoPen);
+ p.setBrush(Qt::gray);
+
+ QPolygon poly;
+ poly << QPoint(-30, 0);
+ poly << QPoint(0, -40);
+ poly << QPoint(30, 0);
+
+ p.translate(centerPad);
+ for (int i = 0; i < 4; ++i) {
+ p.rotate(90);
+ p.translate(0, 20 - rad);
+ p.drawPolygon(poly);
+ p.translate(0, rad - 20);
+ }
+ }
+
+ p.end();
}
void keyPressEvent(QKeyEvent *event) {
@@ -282,6 +337,25 @@ protected:
moveDelta = (moveDelta < 0) ? 0 : moveDelta;
}
+ void mousePressEvent(QMouseEvent *event) {
+ qreal dx = centerPad.x() - event->pos().x();
+ qreal dy = centerPad.y() - event->pos().y();
+ angleDelta = dx * 2 * M_PI / width();
+ moveDelta = dy * 10 / height();
+ }
+
+ void mouseMoveEvent(QMouseEvent *event) {
+ qreal dx = centerPad.x() - event->pos().x();
+ qreal dy = centerPad.y() - event->pos().y();
+ angleDelta = dx * 2 * M_PI / width();
+ moveDelta = dy * 10 / height();
+ }
+
+ void mouseReleaseEvent(QMouseEvent*) {
+ angleDelta = 0;
+ moveDelta = 0;
+ }
+
private:
QTime watch;
QBasicTimer ticker;
@@ -292,6 +366,10 @@ private:
qreal moveDelta;
QImage textureImg;
int textureCount;
+ bool touchDevice;
+ QRect trackPad;
+ QPoint centerPad;
+ QSize bufferSize;
};
int main(int argc, char **argv)
diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp
index ca52f47..74164d3 100644
--- a/examples/animation/animatedtiles/main.cpp
+++ b/examples/animation/animatedtiles/main.cpp
@@ -228,51 +228,25 @@ int main(int argc, char **argv)
QAbstractTransition *trans = rootState->addTransition(ellipseButton, SIGNAL(pressed()), ellipseState);
trans->addAnimation(group);
- group = new QParallelAnimationGroup;
- for (int i = 0; i < items.count(); ++i) {
- QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
- anim->setDuration(750 + i * 25);
- anim->setEasingCurve(QEasingCurve::InOutBack);
- group->addAnimation(anim);
- }
trans = rootState->addTransition(figure8Button, SIGNAL(pressed()), figure8State);
trans->addAnimation(group);
- group = new QParallelAnimationGroup;
- for (int i = 0; i < items.count(); ++i) {
- QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
- anim->setDuration(750 + i * 25);
- anim->setEasingCurve(QEasingCurve::InOutBack);
- group->addAnimation(anim);
- }
trans = rootState->addTransition(randomButton, SIGNAL(pressed()), randomState);
trans->addAnimation(group);
- group = new QParallelAnimationGroup;
- for (int i = 0; i < items.count(); ++i) {
- QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
- anim->setDuration(750 + i * 25);
- anim->setEasingCurve(QEasingCurve::InOutBack);
- group->addAnimation(anim);
- }
trans = rootState->addTransition(tiledButton, SIGNAL(pressed()), tiledState);
trans->addAnimation(group);
- group = new QParallelAnimationGroup;
- for (int i = 0; i < items.count(); ++i) {
- QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
- anim->setDuration(750 + i * 25);
- anim->setEasingCurve(QEasingCurve::InOutBack);
- group->addAnimation(anim);
- }
trans = rootState->addTransition(centeredButton, SIGNAL(pressed()), centeredState);
trans->addAnimation(group);
- states.start();
QTimer timer;
timer.start(125);
timer.setSingleShot(true);
- rootState->addTransition(&timer, SIGNAL(timeout()), ellipseState);
+ trans = rootState->addTransition(&timer, SIGNAL(timeout()), ellipseState);
+ trans->addAnimation(group);
+
+ states.start();
#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 6e457f4..665b73e 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -127,16 +127,11 @@ struct GTimerSource
GSource source;
QTimerInfoList timerList;
QEventLoop::ProcessEventsFlags processEventsFlags;
+ bool runWithIdlePriority;
};
-static gboolean timerSourcePrepare(GSource *source, gint *timeout)
+static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout)
{
- gint dummy;
- if (!timeout)
- timeout = &dummy;
-
- GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
-
timeval tv = { 0l, 0l };
if (!(src->processEventsFlags & QEventLoop::X11ExcludeTimers) && src->timerList.timerWait(tv))
*timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
@@ -146,10 +141,8 @@ static gboolean timerSourcePrepare(GSource *source, gint *timeout)
return (*timeout == 0);
}
-static gboolean timerSourceCheck(GSource *source)
+static gboolean timerSourceCheckHelper(GTimerSource *src)
{
- GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
-
if (src->timerList.isEmpty()
|| (src->processEventsFlags & QEventLoop::X11ExcludeTimers))
return false;
@@ -160,9 +153,35 @@ static gboolean timerSourceCheck(GSource *source)
return true;
}
+static gboolean timerSourcePrepare(GSource *source, gint *timeout)
+{
+ gint dummy;
+ if (!timeout)
+ timeout = &dummy;
+
+ GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
+ if (src->runWithIdlePriority) {
+ if (timeout)
+ *timeout = -1;
+ return false;
+ }
+
+ return timerSourcePrepareHelper(src, timeout);
+}
+
+static gboolean timerSourceCheck(GSource *source)
+{
+ GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
+ if (src->runWithIdlePriority)
+ return false;
+ return timerSourceCheckHelper(src);
+}
+
static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer)
{
- (void) reinterpret_cast<GTimerSource *>(source)->timerList.activateTimers();
+ GTimerSource *timerSource = reinterpret_cast<GTimerSource *>(source);
+ timerSource->runWithIdlePriority = true;
+ (void) timerSource->timerList.activateTimers();
return true; // ??? don't remove, right again?
}
@@ -175,6 +194,53 @@ static GSourceFuncs timerSourceFuncs = {
NULL
};
+struct GIdleTimerSource
+{
+ GSource source;
+ GTimerSource *timerSource;
+};
+
+static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout)
+{
+ GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
+ GTimerSource *timerSource = idleTimerSource->timerSource;
+ if (!timerSource->runWithIdlePriority) {
+ // Yield to the normal priority timer source
+ if (timeout)
+ *timeout = -1;
+ return false;
+ }
+
+ return timerSourcePrepareHelper(timerSource, timeout);
+}
+
+static gboolean idleTimerSourceCheck(GSource *source)
+{
+ GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
+ GTimerSource *timerSource = idleTimerSource->timerSource;
+ if (!timerSource->runWithIdlePriority) {
+ // Yield to the normal priority timer source
+ return false;
+ }
+ return timerSourceCheckHelper(timerSource);
+}
+
+static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
+{
+ GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource;
+ (void) timerSourceDispatch(&timerSource->source, 0, 0);
+ return true;
+}
+
+static GSourceFuncs idleTimerSourceFuncs = {
+ idleTimerSourcePrepare,
+ idleTimerSourceCheck,
+ idleTimerSourceDispatch,
+ NULL,
+ NULL,
+ NULL
+};
+
struct GPostEventSource
{
GSource source;
@@ -235,14 +301,15 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_main_context_ref(mainContext);
} else {
QCoreApplication *app = QCoreApplication::instance();
- if (app && QThread::currentThread() == app->thread()) {
- mainContext = g_main_context_default();
- g_main_context_ref(mainContext);
- } else {
- mainContext = g_main_context_new();
- }
+ if (app && QThread::currentThread() == app->thread()) {
+ mainContext = g_main_context_default();
+ g_main_context_ref(mainContext);
+ } else {
+ mainContext = g_main_context_new();
+ }
}
+ // setup post event source
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
postEventSource->serialNumber = 1;
@@ -257,14 +324,21 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_source_set_can_recurse(&socketNotifierSource->source, true);
g_source_attach(&socketNotifierSource->source, mainContext);
- // setup timerSource
+ // setup normal and idle timer sources
timerSource = reinterpret_cast<GTimerSource *>(g_source_new(&timerSourceFuncs,
sizeof(GTimerSource)));
(void) new (&timerSource->timerList) QTimerInfoList();
timerSource->processEventsFlags = QEventLoop::AllEvents;
+ timerSource->runWithIdlePriority = false;
g_source_set_can_recurse(&timerSource->source, true);
- g_source_set_priority(&timerSource->source, G_PRIORITY_DEFAULT_IDLE);
g_source_attach(&timerSource->source, mainContext);
+
+ idleTimerSource = reinterpret_cast<GIdleTimerSource *>(g_source_new(&idleTimerSourceFuncs,
+ sizeof(GIdleTimerSource)));
+ idleTimerSource->timerSource = timerSource;
+ g_source_set_can_recurse(&idleTimerSource->source, true);
+ g_source_set_priority(&idleTimerSource->source, G_PRIORITY_DEFAULT_IDLE);
+ g_source_attach(&idleTimerSource->source, mainContext);
}
QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
@@ -272,12 +346,9 @@ QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
{
}
-QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext,
- QObject *parent)
- : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)),
- parent)
-{
-}
+QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext, QObject *parent)
+ : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)), parent)
+{ }
QEventDispatcherGlib::~QEventDispatcherGlib()
{
@@ -289,6 +360,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
g_source_destroy(&d->timerSource->source);
g_source_unref(&d->timerSource->source);
d->timerSource = 0;
+ g_source_destroy(&d->idleTimerSource->source);
+ g_source_unref(&d->idleTimerSource->source);
+ d->idleTimerSource = 0;
// destroy socket notifier source
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
@@ -324,11 +398,16 @@ bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
// tell postEventSourcePrepare() and timerSource about any new flags
QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
d->timerSource->processEventsFlags = flags;
-
+
+ if (!(flags & QEventLoop::EventLoopExec)) {
+ // force timers to be sent at normal priority
+ d->timerSource->runWithIdlePriority = false;
+ }
+
bool result = g_main_context_iteration(d->mainContext, canWait);
while (!result && canWait)
result = g_main_context_iteration(d->mainContext, canWait);
-
+
d->timerSource->processEventsFlags = savedFlags;
if (canWait)
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 8dbc44d..6a4e726 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -98,6 +98,7 @@ protected:
struct GPostEventSource;
struct GSocketNotifierSource;
struct GTimerSource;
+struct GIdleTimerSource;
class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatcherPrivate
{
@@ -108,6 +109,7 @@ public:
GPostEventSource *postEventSource;
GSocketNotifierSource *socketNotifierSource;
GTimerSource *timerSource;
+ GIdleTimerSource *idleTimerSource;
};
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index a912971..5a0afb8 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -446,10 +446,10 @@ bool QTimerInfoList::timerWait(timeval &tm)
// Find first waiting timer not already active
QTimerInfo *t = 0;
for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
- if (!(*it)->inTimerEvent) {
- t = *it;
- break;
- }
+ if (!(*it)->inTimerEvent) {
+ t = *it;
+ break;
+ }
}
if (!t)
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 7041d58..49aabf5 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -542,7 +542,7 @@ static bool simplifySequentialChunk(Graph<AnchorVertex, AnchorData> *graph,
void QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
{
static bool noSimplification = !qgetenv("QT_ANCHORLAYOUT_NO_SIMPLIFICATION").isEmpty();
- if (noSimplification)
+ if (noSimplification || items.isEmpty())
return;
if (graphSimplified[orientation])
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
index 3ea957f..f0404fd 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.cpp
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -265,12 +265,13 @@ bool QGraphicsSceneIndexPrivate::itemCollidesWithPath(const QGraphicsItem *item,
/*!
\internal
+ This function returns the items in ascending order.
*/
void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF exposeRect,
QGraphicsSceneIndexIntersector *intersector,
QList<QGraphicsItem *> *items,
const QTransform &viewTransform,
- Qt::ItemSelectionMode mode, Qt::SortOrder order,
+ Qt::ItemSelectionMode mode,
qreal parentOpacity) const
{
Q_ASSERT(item);
@@ -326,7 +327,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe
if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity))
continue;
recursive_items_helper(child, exposeRect, intersector, items, viewTransform,
- mode, order, opacity);
+ mode, opacity);
}
}
@@ -343,7 +344,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe
if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity))
continue;
recursive_items_helper(child, exposeRect, intersector, items, viewTransform,
- mode, order, opacity);
+ mode, opacity);
}
}
}
diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h
index 768c724..adebfde 100644
--- a/src/gui/graphicsview/qgraphicssceneindex_p.h
+++ b/src/gui/graphicsview/qgraphicssceneindex_p.h
@@ -138,7 +138,7 @@ public:
void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect,
QGraphicsSceneIndexIntersector *intersector, QList<QGraphicsItem *> *items,
const QTransform &viewTransform,
- Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const;
+ Qt::ItemSelectionMode mode, qreal parentOpacity = 1.0) const;
inline void items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector *intersector,
QList<QGraphicsItem *> *items, const QTransform &viewTransform,
Qt::ItemSelectionMode mode, Qt::SortOrder order) const;
@@ -156,7 +156,7 @@ inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphi
Q_Q(const QGraphicsSceneIndex);
const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::AscendingOrder);
for (int i = 0; i < tli.size(); ++i)
- recursive_items_helper(tli.at(i), rect, intersector, items, viewTransform, mode, order);
+ recursive_items_helper(tli.at(i), rect, intersector, items, viewTransform, mode);
if (order == Qt::DescendingOrder) {
const int n = items->size();
for (int i = 0; i < n / 2; ++i)
diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp
index e3a991e..94eb5c0 100644
--- a/src/gui/graphicsview/qsimplex_p.cpp
+++ b/src/gui/graphicsview/qsimplex_p.cpp
@@ -48,6 +48,32 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QSimplex
+
+ The QSimplex class is a Linear Programming problem solver based on the two-phase
+ simplex method.
+
+ It takes a set of QSimplexConstraints as its restrictive constraints and an
+ additional QSimplexConstraint as its objective function. Then methods to maximize
+ and minimize the problem solution are provided.
+
+ The two-phase simplex method is based on the following steps:
+ First phase:
+ 1.a) Modify the original, complex, and possibly not feasible problem, into a new,
+ easy to solve problem.
+ 1.b) Set as the objective of the new problem, a feasible solution for the original
+ complex problem.
+ 1.c) Run simplex to optimize the modified problem and check whether a solution for
+ the original problem exists.
+
+ Second phase:
+ 2.a) Go back to the original problem with the feasibl (but not optimal) solution
+ found in the first phase.
+ 2.b) Set the original objective.
+ 3.c) Run simplex to optimize the original problem towards its optimal solution.
+*/
+
QSimplex::QSimplex() : objective(0), rows(0), columns(0), firstArtificial(0), matrix(0)
{
}
@@ -84,15 +110,31 @@ void QSimplex::clearDataStructures()
objective = 0;
}
+/*!
+ Sets the new constraints in the simplex solver and returns whether the problem
+ is feasible.
+
+ This method sets the new constraints, normalizes them, creates the simplex matrix
+ and runs the first simplex phase.
+*/
bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
{
+ ////////////////////////////
+ // Reset to initial state //
+ ////////////////////////////
clearDataStructures();
if (newConstraints.isEmpty())
return true; // we are ok with no constraints
constraints = newConstraints;
- // Set Variables direct mapping
+ ///////////////////////////////////////
+ // Prepare variables and constraints //
+ ///////////////////////////////////////
+
+ // Set Variables direct mapping.
+ // "variables" is a list that provides a stable, indexed list of all variables
+ // used in this problem.
QSet<QSimplexVariable *> variablesSet;
for (int i = 0; i < constraints.size(); ++i)
variablesSet += \
@@ -100,12 +142,25 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
variables = variablesSet.toList();
// Set Variables reverse mapping
+ // We also need to be able to find the index for a given variable, to do that
+ // we store in each variable its index.
for (int i = 0; i < variables.size(); ++i) {
// The variable "0" goes at the column "1", etc...
variables[i]->index = i + 1;
}
// Normalize Constraints
+ // In this step, we prepare the constraints in two ways:
+ // Firstly, we modify all constraints of type "LessOrEqual" or "MoreOrEqual"
+ // by the adding slack or surplus variables and making them "Equal" constraints.
+ // Secondly, we need every single constraint to have a direct, easy feasible
+ // solution. Constraints that have slack variables are already easy to solve,
+ // to all the others we add artificial variables.
+ //
+ // At the end we modify the constraints as follows:
+ // - LessOrEqual: SLACK variable is added.
+ // - Equal: ARTIFICIAL variable is added.
+ // - More or Equal: ARTIFICIAL and SURPLUS variables are added.
int variableIndex = variables.size();
QList <QSimplexVariable *> artificialList;
@@ -138,12 +193,18 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
}
}
+ // All original, slack and surplus have already had its index set
+ // at this point. We now set the index of the artificial variables
+ // as to ensure they are at the end of the variable list and therefore
+ // can be easily removed at the end of this method.
firstArtificial = variableIndex + 1;
for (int i = 0; i < artificialList.size(); ++i)
artificialList[i]->index = ++variableIndex;
artificialList.clear();
- // Matrix
+ /////////////////////////////
+ // Fill the Simplex matrix //
+ /////////////////////////////
// One for each variable plus the Basic and BFS columns (first and last)
columns = variableIndex + 2;
@@ -188,24 +249,61 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
setValueAt(i, columns - 1, c->constant);
}
- // Set temporary objective: -1 * sum_of_artificial_vars
+ // Set objective for the first-phase Simplex.
+ // Z = -1 * sum_of_artificial_vars
for (int j = firstArtificial; j < columns - 1; ++j)
setValueAt(0, j, 1.0);
// Maximize our objective (artificial vars go to zero)
solveMaxHelper();
+ // If there is a solution where the sum of all artificial
+ // variables is zero, then all of them can be removed and yet
+ // we will have a feasible (but not optimal) solution for the
+ // original problem.
+ // Otherwise, we clean up our structures and report there is
+ // no feasible solution.
if (valueAt(0, columns - 1) != 0.0) {
qWarning() << "QSimplex: No feasible solution!";
clearDataStructures();
return false;
}
- // Remove artificial variables
+ // Remove artificial variables. We already have a feasible
+ // solution for the first problem, thus we don't need them
+ // anymore.
clearColumns(firstArtificial, columns - 2);
+
+ #ifdef QT_DEBUG
+ // Ensure that at the end of the simplex each row should either:
+ // - Have a positive value on the column associated to its variable, or
+ // - Have zero values in all columns.
+ //
+ // This avoids a regression where restrictions would be lost
+ // due to randomness in the pivotRowForColumn method.
+ for (int i = 1; i < rows; ++i) {
+ int variableIndex = valueAt(i, 0);
+ if (valueAt(i, variableIndex) > 0)
+ continue;
+
+ for (int j = 1; j < columns; ++j) {
+ Q_ASSERT(valueAt(i, j) == 0);
+ }
+ }
+ #endif
+
return true;
}
+/*!
+ \internal
+
+ Run simplex on the current matrix with the current objective.
+
+ This is the iterative method. The matrix lines are combined
+ as to modify the variable values towards the best solution possible.
+ The method returns when the matrix is in the optimal state.
+*/
void QSimplex::solveMaxHelper()
{
reducedRowEchelon();
@@ -292,6 +390,23 @@ int QSimplex::findPivotColumn()
return minIndex;
}
+/*!
+ \internal
+
+ For a given pivot column, find the pivot row. That is, the row with the
+ minimum associated "quotient" where:
+
+ - quotient is the division of the value in the last column by the value
+ in the pivot column.
+ - rows with value less or equal to zero are ignored
+ - if two rows have the same quotient, lines are chosen based on the
+ highest variable index (value in the first column)
+
+ The last condition avoids a bug where artificial variables would be
+ left behind for the second-phase simplex, and with 'good'
+ constraints would be removed before it, what would lead to incorrect
+ results.
+*/
int QSimplex::pivotRowForColumn(int column)
{
qreal min = qreal(999999999999.0); // ###
@@ -306,6 +421,8 @@ int QSimplex::pivotRowForColumn(int column)
if (quotient < min) {
min = quotient;
minIndex = i;
+ } else if ((quotient == min) && (valueAt(i, 0) > valueAt(minIndex, 0))) {
+ minIndex = i;
}
}
@@ -320,6 +437,12 @@ void QSimplex::reducedRowEchelon()
}
}
+/*!
+ \internal
+
+ Does one iteration towards a better solution for the problem.
+ See 'solveMaxHelper'.
+*/
bool QSimplex::iterate()
{
// Find Pivot column
@@ -361,7 +484,13 @@ bool QSimplex::iterate()
Both solveMin and solveMax are interfaces to this method.
The enum solverFactor admits 2 values: Minimum (-1) and Maximum (+1).
- */
+
+ This method sets the original objective and runs the second phase
+ Simplex to obtain the optimal solution for the problem. As the internal
+ simplex solver is only able to _maximize_ objectives, we handle the
+ minimization case by inverting the original objective and then
+ maximizing it.
+*/
qreal QSimplex::solver(solverFactor factor)
{
// Remove old objective
@@ -381,16 +510,28 @@ qreal QSimplex::solver(solverFactor factor)
return factor * valueAt(0, columns - 1);
}
+/*!
+ Minimize the original objective.
+*/
qreal QSimplex::solveMin()
{
return solver(Minimum);
}
+/*!
+ Maximize the original objective.
+*/
qreal QSimplex::solveMax()
{
return solver(Maximum);
}
+/*!
+ \internal
+
+ Reads results from the simplified matrix and saves them in the
+ "result" member of each QSimplexVariable.
+*/
void QSimplex::collectResults()
{
// All variables are zero unless overridden below.
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 27e8602..8daac42 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -480,7 +480,7 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
alienWidget = qwidget;
S60->mousePressTarget = alienWidget;
}
-
+
alienWidget = S60->mousePressTarget;
if (alienWidget != S60->lastPointerEventTarget)
@@ -600,7 +600,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
if (keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down || keyCode == Qt::Key_Select) {
/*Explanation about virtualMouseAccel:
Tapping an arrow key allows precise pixel positioning
- Holding an arrow key down, acceleration is applied to allow cursor
+ Holding an arrow key down, acceleration is applied to allow cursor
to be quickly moved to another part of the screen by key repeats.
*/
if (S60->virtualMouseLastKey == keyCode) {
@@ -668,7 +668,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
}
}
#endif
-
+
Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode,
mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
@@ -993,13 +993,13 @@ void qt_init(QApplicationPrivate * /* priv */, int)
S60->hasTouchscreen = true;
S60->virtualMouseRequired = false;
}
-
+
if (touch) {
QApplicationPrivate::navigationMode = Qt::NavigationModeNone;
} else {
QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
}
-
+
#ifndef QT_NO_CURSOR
//Check if window server pointer cursors are supported or not
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
@@ -1063,7 +1063,7 @@ void qt_cleanup()
// it dies.
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = 0;
-
+
//Change mouse pointer back
S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
@@ -1383,7 +1383,8 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
} else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
&& !w->d_func()->maybeBackingStore()) {
w->d_func()->topData()->backingStore = new QWidgetBackingStore(w);
- w->update();
+ w->d_func()->invalidateBuffer(w->rect());
+ w->repaint();
}
return 1;
}
@@ -1599,7 +1600,7 @@ void QApplicationPrivate::setNavigationMode(Qt::NavigationMode mode)
const bool isCursorOn = (mode == Qt::NavigationModeCursorAuto
&& !S60->hasTouchscreen)
|| mode == Qt::NavigationModeCursorForceVisible;
-
+
if (!wasCursorOn && isCursorOn) {
//Show the cursor, when changing from another mode to cursor mode
qt_symbian_set_cursor_visible(true);
@@ -1629,7 +1630,7 @@ void QApplication::restoreOverrideCursor()
if (qApp->d_func()->cursor_list.isEmpty())
return;
qApp->d_func()->cursor_list.removeFirst();
-
+
if (!qApp->d_func()->cursor_list.isEmpty()) {
qt_symbian_setGlobalCursor(qApp->d_func()->cursor_list.first());
}
diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro
index ac610de..b0d537a 100644
--- a/tests/auto/networkselftest/networkselftest.pro
+++ b/tests/auto/networkselftest/networkselftest.pro
@@ -3,3 +3,18 @@ load(qttest_p4)
SOURCES += tst_networkselftest.cpp
QT = core network
+wince*: {
+ addFiles.sources = rfc3252.txt
+ addFiles.path = .
+ DEPLOYMENT = addFiles
+ DEFINES += SRCDIR=\\\"\\\"
+} else:symbian* {
+ addFiles.sources = rfc3252.txt
+ addFiles.path = .
+ DEPLOYMENT = addFiles
+} else:vxworks*: {
+ DEFINES += SRCDIR=\\\"\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
+
diff --git a/tests/auto/networkselftest/rfc3252.txt b/tests/auto/networkselftest/rfc3252.txt
new file mode 100644
index 0000000..b80c61b
--- /dev/null
+++ b/tests/auto/networkselftest/rfc3252.txt
@@ -0,0 +1,899 @@
+
+
+
+
+
+
+Network Working Group H. Kennedy
+Request for Comments: 3252 Mimezine
+Category: Informational 1 April 2002
+
+
+ Binary Lexical Octet Ad-hoc Transport
+
+Status of this Memo
+
+ This memo provides information for the Internet community. It does
+ not specify an Internet standard of any kind. Distribution of this
+ memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2002). All Rights Reserved.
+
+Abstract
+
+ This document defines a reformulation of IP and two transport layer
+ protocols (TCP and UDP) as XML applications.
+
+1. Introduction
+
+1.1. Overview
+
+ This document describes the Binary Lexical Octet Ad-hoc Transport
+ (BLOAT): a reformulation of a widely-deployed network-layer protocol
+ (IP [RFC791]), and two associated transport layer protocols (TCP
+ [RFC793] and UDP [RFC768]) as XML [XML] applications. It also
+ describes methods for transporting BLOAT over Ethernet and IEEE 802
+ networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
+ across the public Internet.
+
+1.2. Motivation
+
+ The wild popularity of XML as a basis for application-level protocols
+ such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
+ Object Access Protocol [SOAP], and Jabber [JABBER] prompted
+ investigation into the possibility of extending the use of XML in the
+ protocol stack. Using XML at both the transport and network layer in
+ addition to the application layer would provide for an amazing amount
+ of power and flexibility while removing dependencies on proprietary
+ and hard-to-understand binary protocols. This protocol unification
+ would also allow applications to use a single XML parser for all
+ aspects of their operation, eliminating developer time spent figuring
+ out the intricacies of each new protocol, and moving the hard work of
+
+
+
+
+Kennedy Informational [Page 1]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ parsing to the XML toolset. The use of XML also mitigates concerns
+ over "network vs. host" byte ordering which is at the root of many
+ network application bugs.
+
+1.3. Relation to Existing Protocols
+
+ The reformulations specified in this RFC follow as closely as
+ possible the spirit of the RFCs on which they are based, and so MAY
+ contain elements or attributes that would not be needed in a pure
+ reworking (e.g. length attributes, which are implicit in XML.)
+
+ The layering of network and transport protocols are maintained in
+ this RFC despite the optimizations that could be made if the line
+ were somewhat blurred (i.e. merging TCP and IP into a single, larger
+ element in the DTD) in order to foster future use of this protocol as
+ a basis for reformulating other protocols (such as ICMP.)
+
+ Other than the encoding, the behavioral aspects of each of the
+ existing protocols remain unchanged. Routing, address spaces, TCP
+ congestion control, etc. behave as specified in the extant standards.
+ Adapting to new standards and experimental algorithm heuristics for
+ improving performance will become much easier once the move to BLOAT
+ has been completed.
+
+1.4. Requirement Levels
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
+ document are to be interpreted as described in BCP 14, RFC 2119
+ [RFC2119].
+
+2. IPoXML
+
+ This protocol MUST be implemented to be compliant with this RFC.
+ IPoXML is the root protocol REQUIRED for effective use of TCPoXML
+ (section 3.) and higher-level application protocols.
+
+ The DTD for this document type can be found in section 7.1.
+
+ The routing of IPoXML can be easily implemented on hosts with an XML
+ parser, as the regular structure lends itself handily to parsing and
+ validation of the document/datagram and then processing the
+ destination address, TTL, and checksum before sending it on to its
+ next-hop.
+
+ The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
+ wider deployment of IPv4 and the fact that implementing IPv6 as XML
+ would have exceeded the 1500 byte Ethernet MTU.
+
+
+
+Kennedy Informational [Page 2]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ All BLOAT implementations MUST use - and specify - the UTF-8 encoding
+ of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
+ formed and include the XMLDecl.
+
+2.1. IP Description
+
+ A number of items have changed (for the better) from the original IP
+ specification. Bit-masks, where present have been converted into
+ human-readable values. IP addresses are listed in their dotted-
+ decimal notation [RFC1123]. Length and checksum values are present
+ as decimal integers.
+
+ To calculate the length and checksum fields of the IP element, a
+ canonicalized form of the element MUST be used. The canonical form
+ SHALL have no whitespace (including newline characters) between
+ elements and only one space character between attributes. There
+ SHALL NOT be a space following the last attribute in an element.
+
+ An iterative method SHOULD be used to calculate checksums, as the
+ length field will vary based on the size of the checksum.
+
+ The payload element bears special attention. Due to the character
+ set restrictions of XML, the payload of IP datagrams (which MAY
+ contain arbitrary data) MUST be encoded for transport. This RFC
+ REQUIRES the contents of the payload to be encoded in the base-64
+ encoding of RFC 2045 [RFC2045], but removes the requirement that the
+ encoded output MUST be wrapped on 76-character lines.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Kennedy Informational [Page 3]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+2.2. Example Datagram
+
+ The following is an example IPoXML datagram with an empty payload:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
+ <ip>
+ <header length="474">
+ <version value="4"/>
+ <tos precedence="Routine" delay="Normal" throughput="Normal"
+ relibility="Normal" reserved="0"/>
+ <total.length value="461"/>
+ <id value="1"/>
+ <flags reserved="0" df="dont" mf="last"/>
+ <offset value="0"/>
+ <ttl value="255"/>
+ <protocol value="6"/>
+ <checksum value="8707"/>
+ <source address="10.0.0.22"/>
+ <destination address="10.0.0.1"/>
+ <options>
+ <end copied="0" class="0" number="0"/>
+ </options>
+ <padding pad="0"/>
+ </header>
+ <payload>
+ </payload>
+ </ip>
+
+3. TCPoXML
+
+ This protocol MUST be implemented to be compliant with this RFC. The
+ DTD for this document type can be found in section 7.2.
+
+3.1. TCP Description
+
+ A number of items have changed from the original TCP specification.
+ Bit-masks, where present have been converted into human-readable
+ values. Length and checksum and port values are present as decimal
+ integers.
+
+ To calculate the length and checksum fields of the TCP element, a
+ canonicalized form of the element MUST be used as in section 2.1.
+
+ An iterative method SHOULD be used to calculate checksums as in
+ section 2.1.
+
+ The payload element MUST be encoded as in section 2.1.
+
+
+
+Kennedy Informational [Page 4]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ The TCP offset element was expanded to a maximum of 255 from 16 to
+ allow for the increased size of the header in XML.
+
+ TCPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
+ as well as the <!DOCTYPE> declaration.
+
+3.2. Example Datagram
+
+ The following is an example TCPoXML datagram with an empty payload:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
+ <tcp>
+ <tcp.header>
+ <src port="31415"/>
+ <dest port="42424"/>
+ <sequence number="322622954"/>
+ <acknowledgement number="689715995"/>
+ <offset number=""/>
+ <reserved value="0"/>
+ <control syn="1" ack="1"/>
+ <window size="1"/>
+ <urgent pointer="0"/>
+ <checksum value="2988"/>
+ <tcp.options>
+ <tcp.end kind="0"/>
+ </tcp.options>
+ <padding pad="0"/>
+ </tcp.header>
+ <payload>
+ </payload>
+ </tcp>
+
+4. UDPoXML
+
+ This protocol MUST be implemented to be compliant with this RFC. The
+ DTD for this document type can be found in section 7.3.
+
+4.1. UDP Description
+
+ A number of items have changed from the original UDP specification.
+ Bit-masks, where present have been converted into human-readable
+ values. Length and checksum and port values are present as decimal
+ integers.
+
+
+
+
+
+
+
+Kennedy Informational [Page 5]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ To calculate the length and checksum fields of the UDP element, a
+ canonicalized form of the element MUST be used as in section 2.1. An
+ iterative method SHOULD be used to calculate checksums as in section
+ 2.1.
+
+ The payload element MUST be encoded as in section 2.1.
+
+ UDPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
+ as well as the <!DOCTYPE> declaration.
+
+4.2. Example Datagram
+
+ The following is an example UDPoXML datagram with an empty payload:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
+ <udp>
+ <udp.header>
+ <src port="31415"/>
+ <dest port="42424"/>
+ <udp.length value="143"/>
+ <checksum value="2988"/>
+ </udp.header>
+ <payload>
+ </payload>
+ </udp>
+
+5. Network Transport
+
+ This document provides for the transmission of BLOAT datagrams over
+ two common families of physical layer transport. Future RFCs will
+ address additional transports as routing vendors catch up to the
+ specification, and we begin to see BLOAT routed across the Internet
+ backbone.
+
+5.1. Ethernet
+
+ BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
+ exception that the type field of the Ethernet frame MUST contain the
+ value 0xBEEF. The first 5 octets of the Ethernet frame payload will
+ be 0x3c 3f 78 6d 6c ("<?xml".)
+
+5.2. IEEE 802
+
+ BLOAT is encapsulated in IEEE 802 Networks as in [RFC1042] except
+ that the protocol type code for IPoXML is 0xBEEF.
+
+
+
+
+
+Kennedy Informational [Page 6]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+6. Gatewaying over IP
+
+ In order to facilitate the gradual introduction of BLOAT into the
+ public Internet, BLOAT MAY be encapsulated in IP as in [RFC2003] to
+ gateway between networks that run BLOAT natively on their LANs.
+
+7. DTDs
+
+ The Transport DTDs (7.2. and 7.3.) build on the definitions in the
+ Network DTD (7.1.)
+
+ The DTDs are referenced by their PubidLiteral and SystemLiteral (from
+ [XML]) although it is understood that most IPoXML implementations
+ will not need to pull down the DTD, as it will normally be embedded
+ in the implementation, and presents something of a catch-22 if you
+ need to load part of your network protocol over the network.
+
+7.1. IPoXML DTD
+
+ <!--
+ DTD for IP over XML.
+ Refer to this DTD as:
+
+ <!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
+ -->
+ <!--
+ DTD data types:
+
+ Digits [0..9]+
+
+ Precedence "NetworkControl | InternetworkControl |
+ CRITIC | FlashOverride | Flash | Immediate |
+ Priority | Routine"
+
+ IP4Addr "dotted-decimal" notation of [RFC1123]
+
+ Class [0..3]
+
+ Sec "Unclassified | Confidential | EFTO | MMMM | PROG |
+ Restricted | Secret | Top Secret | Reserved"
+
+ Compartments [0..65535]
+
+ Handling [0..65535]
+
+ TCC [0..16777216]
+
+ -->
+
+
+
+Kennedy Informational [Page 7]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ENTITY % Digits "CDATA">
+ <!ENTITY % Precedence "CDATA">
+ <!ENTITY % IP4Addr "CDATA">
+ <!ENTITY % Class "CDATA">
+ <!ENTITY % Sec "CDATA">
+ <!ENTITY % Compartments "CDATA">
+ <!ENTITY % Handling "CDATA">
+ <!ENTITY % TCC "CDATA">
+
+ <!ELEMENT ip (header, payload)>
+
+ <!ELEMENT header (version, tos, total.length, id, flags, offset, ttl,
+ protocol, checksum, source, destination, options,
+ padding)>
+ <!-- length of header in 32-bit words -->
+ <!ATTLIST header
+ length %Digits; #REQUIRED>
+
+ <!ELEMENT version EMPTY>
+ <!-- ip version. SHOULD be "4" -->
+ <!ATTLIST version
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT tos EMPTY>
+ <!ATTLIST tos
+ precedence %Precedence; #REQUIRED
+ delay (normal | low) #REQUIRED
+ throughput (normal | high) #REQUIRED
+ relibility (normal | high) #REQUIRED
+ reserved CDATA #FIXED "0">
+
+ <!ELEMENT total.length EMPTY>
+ <!--
+ total length of datagram (header and payload) in octets, MUST be
+ less than 65,535 (and SHOULD be less than 1024 for IPoXML on local
+ ethernets).
+ -->
+ <!ATTLIST total.length
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT id EMPTY>
+ <!-- 0 <= id <= 65,535 -->
+ <!ATTLIST id
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT flags EMPTY>
+ <!-- df = don't fragment, mf = more fragments -->
+ <!ATTLIST flags
+
+
+
+Kennedy Informational [Page 8]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ reserved CDATA #FIXED "0"
+ df (may|dont) #REQUIRED
+ mf (last|more) #REQUIRED>
+
+ <!ELEMENT offset EMPTY>
+ <!-- 0 <= offset <= 8192 measured in 8 octet (64-bit) chunks -->
+ <!ATTLIST offset
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT ttl EMPTY>
+ <!-- 0 <= ttl <= 255 -->
+ <!ATTLIST ttl
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT protocol EMPTY>
+ <!-- 0 <= protocol <= 255 (per IANA) -->
+ <!ATTLIST protocol
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT checksum EMPTY>
+ <!-- 0 <= checksum <= 65535 (over header only) -->
+ <!ATTLIST checksum
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT source EMPTY>
+ <!ATTLIST source
+ address %IP4Addr; #REQUIRED>
+
+ <!ELEMENT destination EMPTY>
+ <!ATTLIST destination
+ address %IP4Addr; #REQUIRED>
+
+ <!ELEMENT options ( end | noop | security | loose | strict | record
+ | stream | timestamp )*>
+
+ <!ELEMENT end EMPTY>
+ <!ATTLIST end
+ copied (0|1) #REQUIRED
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "0">
+
+ <!ELEMENT noop EMPTY>
+ <!ATTLIST noop
+ copied (0|1) #REQUIRED
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "1">
+
+ <!ELEMENT security EMPTY>
+
+
+
+Kennedy Informational [Page 9]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ATTLIST security
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "2"
+ length CDATA #FIXED "11"
+ security %Sec; #REQUIRED
+ compartments %Compartments; #REQUIRED
+ handling %Handling; #REQUIRED
+ tcc %TCC; #REQUIRED>
+ <!ELEMENT loose (hop)+>
+ <!ATTLIST loose
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "3"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT hop EMPTY>
+ <!ATTLIST hop
+ address %IP4Addr; #REQUIRED>
+
+ <!ELEMENT strict (hop)+>
+ <!ATTLIST strict
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "9"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT record (hop)+>
+ <!ATTLIST record
+ copied CDATA #FIXED "0"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "7"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT stream EMPTY>
+ <!-- 0 <= id <= 65,535 -->
+ <!ATTLIST stream
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "8"
+ length CDATA #FIXED "4"
+ id %Digits; #REQUIRED>
+
+ <!ELEMENT timestamp (tstamp)+>
+ <!-- 0 <= oflw <=15 -->
+
+
+
+Kennedy Informational [Page 10]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ATTLIST timestamp
+ copied CDATA #FIXED "0"
+ class CDATA #FIXED "2"
+ number CDATA #FIXED "4"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED
+ oflw %Digits; #REQUIRED
+ flag (0 | 1 | 3) #REQUIRED>
+
+ <!ELEMENT tstamp EMPTY>
+ <!ATTLIST tstamp
+ time %Digits; #REQUIRED
+ address %IP4Addr; #IMPLIED>
+ <!--
+ padding to bring header to 32-bit boundary.
+ pad MUST be "0"*
+ -->
+ <!ELEMENT padding EMPTY>
+ <!ATTLIST padding
+ pad CDATA #REQUIRED>
+
+ <!-- payload MUST be encoded as base-64 [RFC2045], as modified
+ by section 2.1 of this RFC -->
+ <!ELEMENT payload (CDATA)>
+
+7.2. TCPoXML DTD
+
+ <!--
+ DTD for TCP over XML.
+ Refer to this DTD as:
+
+ <!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
+ -->
+
+ <!-- the pseudoheader is only included for checksum calculations -->
+ <!ELEMENT tcp (tcp.pseudoheader?, tcp.header, payload)>
+
+ <!ELEMENT tcp.header (src, dest, sequence, acknowledgement, offset,
+ reserved, control, window, checksum, urgent,
+ tcp.options, padding)>
+
+ <!ELEMENT src EMPTY>
+ <!-- 0 <= port <= 65,535 -->
+ <!ATTLIST src
+ port %Digits; #REQUIRED>
+
+ <!ELEMENT dest EMPTY>
+ <!-- 0 <= port <= 65,535 -->
+
+
+
+Kennedy Informational [Page 11]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ATTLIST dest
+ port %Digits; #REQUIRED>
+
+ <!ELEMENT sequence EMPTY>
+ <!-- 0 <= number <= 4294967295 -->
+ <!ATTLIST sequence
+ number %Digits; #REQUIRED>
+
+ <!ELEMENT acknowledgement EMPTY>
+ <!-- 0 <= number <= 4294967295 -->
+ <!ATTLIST acknowledgement
+ number %Digits; #REQUIRED>
+
+ <!ELEMENT offset EMPTY>
+ <!-- 0 <= number <= 255 -->
+ <!ATTLIST offset
+ number %Digits; #REQUIRED>
+
+ <!ELEMENT reserved EMPTY>
+ <!ATTLIST reserved
+ value CDATA #FIXED "0">
+
+ <!ELEMENT control EMPTY>
+ <!ATTLIST control
+ urg (0|1) #IMPLIED
+ ack (0|1) #IMPLIED
+ psh (0|1) #IMPLIED
+ rst (0|1) #IMPLIED
+ syn (0|1) #IMPLIED
+ fin (0|1) #IMPLIED>
+
+ <!ELEMENT window EMPTY>
+ <!-- 0 <= size <= 65,535 -->
+ <!ATTLIST window
+ size %Digits; #REQUIRED>
+
+ <!--
+ checksum as in ip, but with
+ the following pseudo-header added into the tcp element:
+ -->
+ <!ELEMENT tcp.pseudoheader (source, destination, protocol,
+ tcp.length)>
+
+ <!--
+ tcp header + data length in octets. does not include the size of
+
+ the pseudoheader.
+ -->
+
+
+
+Kennedy Informational [Page 12]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ELEMENT tcp.length EMPTY>
+ <!ATTLIST tcp.length
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT urgent EMPTY>
+ <!-- 0 <= pointer <= 65,535 -->
+ <!ATTLIST urgent
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT tcp.options (tcp.end | tcp.noop | tcp.mss)+>
+
+ <!ELEMENT tcp.end EMPTY>
+ <!ATTLIST tcp.end
+ kind CDATA #FIXED "0">
+
+ <!ELEMENT tcp.noop EMPTY>
+ <!ATTLIST tcp.noop
+ kind CDATA #FIXED "1">
+
+ <!ELEMENT tcp.mss EMPTY>
+ <!ATTLIST tcp.mss
+ kind CDATA #FIXED "2"
+ length CDATA #FIXED "4"
+ size %Digits; #REQUIRED>
+
+7.3. UDPoXML DTD
+
+ <!--
+ DTD for UDP over XML.
+ Refer to this DTD as:
+
+ <!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
+ -->
+
+ <!ELEMENT udp (udp.pseudoheader?, udp.header, payload)>
+
+ <!ELEMENT udp.header (src, dest, udp.length, checksum)>
+
+ <!ELEMENT udp.pseudoheader (source, destination, protocol,
+ udp.length)>
+
+ <!--
+ udp header + data length in octets. does not include the size of
+ the pseudoheader.
+ -->
+ <!ELEMENT udp.length EMPTY>
+ <!ATTLIST udp.length
+ value %Digits; #REQUIRED>
+
+
+
+Kennedy Informational [Page 13]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+8. Security Considerations
+
+ XML, as a subset of SGML, has the same security considerations as
+ specified in SGML Media Types [RFC1874]. Security considerations
+ that apply to IP, TCP and UDP also likely apply to BLOAT as it does
+ not attempt to correct for issues not related to message format.
+
+9. References
+
+ [JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
+ February 2002. (Work in Progress)
+
+ [RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
+ August 1980.
+
+ [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
+ September 1981.
+
+ [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
+ 793, September 1981.
+
+ [RFC894] Hornig, C., "Standard for the Transmission of IP
+ Datagrams over Ethernet Networks.", RFC 894, April 1984.
+
+ [RFC1042] Postel, J. and J. Reynolds, "Standard for the
+ Transmission of IP Datagrams Over IEEE 802 Networks", STD
+ 43, RFC 1042, February 1988.
+
+ [RFC1123] Braden, R., "Requirements for Internet Hosts -
+ Application and Support", RFC 1123, October 1989.
+
+ [RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
+ 1995.
+
+ [RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
+ October 1996.
+
+ [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
+ Extensions (MIME) Part One: Format of Internet Message
+ Bodies", RFC 2045, November 1996.
+
+ [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
+ Requirement Levels", BCP 14, RFC 2119, March 1997.
+
+ [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
+ 10646", RFC 2279, January 1998.
+
+
+
+
+
+Kennedy Informational [Page 14]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
+ (IPv6) Specification", RFC 2460, December 1998.
+
+ [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
+ RFC 3080, March 2001.
+
+ [SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
+ Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
+ "Simple Object Access Protocol (SOAP) 1.1" World Wide Web
+ Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
+
+ [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
+ Markup Language (XML)" World Wide Web Consortium
+ Recommendation REC- xml-19980210.
+ http://www.w3.org/TR/1998/REC-xml-19980210
+
+10. Author's Address
+
+ Hugh Kennedy
+ Mimezine
+ 1060 West Addison
+ Chicago, IL 60613
+ USA
+
+ EMail: kennedyh@engin.umich.edu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Kennedy Informational [Page 15]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+11. Full Copyright Statement
+
+ Copyright (C) The Internet Society (2002). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC Editor function is currently provided by the
+ Internet Society.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Kennedy Informational [Page 16]
+
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index 00ccadb..4e60101 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -41,6 +41,14 @@
#include <QtTest/QtTest>
#include <QtNetwork/QtNetwork>
+
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Current path (C:\private\<UID>) contains only ascii chars
+//#define SRCDIR QDir::currentPath()
+#define SRCDIR "."
+#endif
+
#include "../network-settings.h"
class tst_NetworkSelfTest: public QObject
@@ -57,6 +65,7 @@ private slots:
void serverReachability();
void remotePortsOpen_data();
void remotePortsOpen();
+ void fileLineEndingTest();
// specific protocol tests
void ftpServer();
@@ -392,6 +401,31 @@ void tst_NetworkSelfTest::remotePortsOpen()
QVERIFY(socket.state() == QAbstractSocket::ConnectedState);
}
+
+void tst_NetworkSelfTest::fileLineEndingTest()
+{
+ QString referenceName = SRCDIR "/rfc3252.txt";
+ long long expectedReferenceSize = 25962;
+
+ QString lineEndingType("LF");
+
+ QFile reference(referenceName);
+ QVERIFY(reference.open(QIODevice::ReadOnly));
+ QByteArray byteLine = reference.readLine();
+ if(byteLine.endsWith("\r\n"))
+ lineEndingType = "CRLF";
+ else if(byteLine.endsWith("\r"))
+ lineEndingType = "CR";
+
+ QString referenceAsTextData;
+ QFile referenceAsText(referenceName);
+ QVERIFY(referenceAsText.open(QIODevice::ReadOnly));
+ referenceAsTextData = referenceAsText.readAll();
+
+ QVERIFY2(expectedReferenceSize == referenceAsTextData.length(), QString("Reference file %1 has %2 as line ending and file size not matching - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit());
+ QVERIFY2(!lineEndingType.compare("LF"), QString("Reference file %1 has %2 as line ending - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit());
+}
+
static QList<Chat> ftpChat()
{
return QList<Chat>() << Chat::expect("220")
diff --git a/tests/auto/qfocusevent/tst_qfocusevent.cpp b/tests/auto/qfocusevent/tst_qfocusevent.cpp
index 6c47530..121bd41 100644
--- a/tests/auto/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/qfocusevent/tst_qfocusevent.cpp
@@ -399,10 +399,10 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
QDialog* d = new QDialog( testFocusWidget );
d->show();
d->activateWindow(); // ### CDE
- // wait 1 secs to give some visible feedback
- QTest::qWait(1000);
+ QApplication::setActiveWindow(d);
+ QTest::qWaitForWindowShown(d);
- QVERIFY(childFocusWidgetOne->focusOutEventRecieved);
+ QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved);
QVERIFY(childFocusWidgetOne->focusOutEventLostFocus);
QVERIFY( !childFocusWidgetOne->focusInEventRecieved );
@@ -411,12 +411,12 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
QVERIFY( !childFocusWidgetOne->hasFocus() );
d->hide();
- QTest::qWait(1000);
+ QTest::qWait(100);
#if defined(Q_OS_IRIX)
QEXPECT_FAIL("", "IRIX requires explicit activateWindow(), so this test does not make any sense.", Abort);
#endif
- QVERIFY(childFocusWidgetOne->focusInEventRecieved);
+ QTRY_VERIFY(childFocusWidgetOne->focusInEventRecieved);
QVERIFY(childFocusWidgetOne->focusInEventGotFocus);
QVERIFY( childFocusWidgetOne->hasFocus() );
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 2c4a253..2fee98d 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -154,6 +154,8 @@ void tst_QGraphicsAnchorLayout::simple()
QGraphicsWidget p;
p.setLayout(l);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 2);
}
@@ -183,6 +185,8 @@ void tst_QGraphicsAnchorLayout::simple_center()
setAnchor(l, b, Qt::AnchorBottom, c, Qt::AnchorTop, 0);
setAnchor(l, c, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 3);
QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window);
@@ -193,6 +197,8 @@ void tst_QGraphicsAnchorLayout::simple_center()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+
+ delete p;
}
void tst_QGraphicsAnchorLayout::simple_semifloat()
@@ -228,6 +234,8 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
setAnchor(l, a, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 4);
QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window);
@@ -240,6 +248,8 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+
+ delete p;
}
void tst_QGraphicsAnchorLayout::layoutDirection()
@@ -286,6 +296,10 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
view->show();
QCOMPARE(checkReverseDirection(p), true);
+ QVERIFY(l->hasConflicts() == false);
+
+ delete p;
+ delete view;
}
void tst_QGraphicsAnchorLayout::diagonal()
@@ -326,6 +340,8 @@ void tst_QGraphicsAnchorLayout::diagonal()
l->addAnchor(e, Qt::AnchorRight, l, Qt::AnchorRight);
l->addAnchor(d, Qt::AnchorRight, e, Qt::AnchorLeft);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 5);
QGraphicsWidget p;
@@ -373,6 +389,9 @@ void tst_QGraphicsAnchorLayout::diagonal()
QCOMPARE(p.size(), testA);
QCOMPARE(checkReverseDirection(&p), true);
+
+ c->setMinimumWidth(300);
+ QVERIFY(l->hasConflicts());
}
void tst_QGraphicsAnchorLayout::parallel()
@@ -465,6 +484,8 @@ void tst_QGraphicsAnchorLayout::parallel()
QCOMPARE(e->geometry(), QRectF(375, 400, 175, 100));
QCOMPARE(f->geometry(), QRectF(550, 500, 200, 100));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::parallel2()
@@ -489,6 +510,7 @@ void tst_QGraphicsAnchorLayout::parallel2()
l->addAnchor(l, Qt::AnchorLeft, b, Qt::AnchorLeft);
l->addAnchor(b, Qt::AnchorRight, a, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 2);
QGraphicsWidget p;
@@ -570,6 +592,8 @@ void tst_QGraphicsAnchorLayout::snake()
QCOMPARE(b->geometry(), QRectF(90.0, 100.0, 10.0, 100.0));
QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
@@ -603,6 +627,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
l->addAnchor(c, Qt::AnchorRight, l, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 3);
QGraphicsWidget p;
@@ -706,6 +731,8 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(c->geometry(), QRectF(200.0, 200.0, 100.0, 100.0));
QCOMPARE(d->geometry(), QRectF(0.0, 300.0, 300.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
@@ -782,6 +809,8 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
QCOMPARE(a->size(), d->size());
QCOMPARE(e->size().width(), 4 * a->size().width());
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::proportionalPreferred()
@@ -844,6 +873,8 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred()
QCOMPARE(a->size().width(), 10 * factor);
QCOMPARE(c->size().width(), 14 * factor);
QCOMPARE(p.size(), QSizeF(12, 400));
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::example()
@@ -897,6 +928,7 @@ void tst_QGraphicsAnchorLayout::example()
l->addAnchor(l, Qt::AnchorLeft, g, Qt::AnchorLeft);
l->addAnchor(f, Qt::AnchorRight, g, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 7);
QGraphicsWidget p;
@@ -985,6 +1017,10 @@ void tst_QGraphicsAnchorLayout::setSpacing()
QCOMPARE(b->geometry(), QRectF(24, 0, 20, 20));
QCOMPARE(c->geometry(), QRectF(0, 20, 44, 20));
+ QVERIFY(l->hasConflicts() == false);
+
+ delete p;
+ delete view;
}
/*!
@@ -1067,6 +1103,8 @@ void tst_QGraphicsAnchorLayout::hardComplexS60()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(240, 40));
+ QVERIFY(l->hasConflicts() == false);
+ delete p;
}
void tst_QGraphicsAnchorLayout::stability()
@@ -1128,6 +1166,7 @@ void tst_QGraphicsAnchorLayout::delete_anchor()
QGraphicsWidget *p = new QGraphicsWidget;
p->setLayout(l);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 3);
scene.addItem(p);
@@ -1277,10 +1316,10 @@ void tst_QGraphicsAnchorLayout::conflicts()
a->setMinimumSize(QSizeF(29,10));
QCOMPARE(l->hasConflicts(), false);
- // It will currently fail if we uncomment this:
- //QEXPECT_FAIL("", "The constraints are just within their bounds in order to be feasible", Continue);
- //a->setMinimumSize(QSizeF(30,10));
- //QCOMPARE(l->hasConflicts(), false);
+ a->setMinimumSize(QSizeF(30,10));
+ QCOMPARE(l->hasConflicts(), false);
+
+ delete p;
}
QTEST_MAIN(tst_QGraphicsAnchorLayout)
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 8228ab9..a6746db 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -58,10 +58,9 @@ public:
setSpacing( 0 );
}
- // ###: Remove me when isValid() is supported
bool isValid()
{
- return true;
+ return !hasConflicts();
}
void setAnchor(
@@ -463,9 +462,6 @@ void tst_QGraphicsAnchorLayout1::testAddAndRemoveAnchor()
void tst_QGraphicsAnchorLayout1::testIsValid()
{
- // ###: REMOVE ME
- return;
-
// Empty, valid
{
QGraphicsWidget *widget = new QGraphicsWidget;
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index a5d79de..9c58b24 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -143,9 +143,11 @@ public:
// It is only called once.
void tst_QGraphicsLinearLayout::initTestCase()
{
+#ifndef Q_WS_S60
// since the style will influence the results, we have to ensure
// that the tests are run using the same style on all platforms
QApplication::setStyle(new QPlastiqueStyle);
+#endif
}
// This will be called after the last test function is executed.
@@ -708,10 +710,10 @@ void tst_QGraphicsLinearLayout::itemAt_visualOrder()
QGraphicsWidget *w2 = new QGraphicsWidget;
l->insertItem(2, w2);
- QCOMPARE(l->itemAt(0), w0);
- QCOMPARE(l->itemAt(1), w1);
- QCOMPARE(l->itemAt(2), w2);
- QCOMPARE(l->itemAt(3), w3);
+ QCOMPARE(l->itemAt(0), static_cast<QGraphicsLayoutItem*>(w0));
+ QCOMPARE(l->itemAt(1), static_cast<QGraphicsLayoutItem*>(w1));
+ QCOMPARE(l->itemAt(2), static_cast<QGraphicsLayoutItem*>(w2));
+ QCOMPARE(l->itemAt(3), static_cast<QGraphicsLayoutItem*>(w3));
}
void tst_QGraphicsLinearLayout::orientation_data()
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 9d23096..1aa515c 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -311,15 +311,13 @@ void tst_QGraphicsView::renderHints()
view.show();
QTest::qWaitForWindowShown(&view);
view.repaint();
- QTest::qWait(125);
- QCOMPARE(item->hints, view.renderHints());
+ QTRY_COMPARE(item->hints, view.renderHints());
view.setRenderHints(QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
QCOMPARE(view.renderHints(), QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
view.repaint();
- QTest::qWait(125);
- QCOMPARE(item->hints, view.renderHints());
+ QTRY_COMPARE(item->hints, view.renderHints());
}
void tst_QGraphicsView::alignment()
@@ -384,7 +382,7 @@ void tst_QGraphicsView::interactive()
view.show();
QTest::qWaitForWindowShown(&view);
- QTestEventLoop::instance().enterLoop(1);
+ QApplication::processEvents();
QTRY_COMPARE(item->events.size(), 1); // activate
QPoint itemPoint = view.mapFromScene(item->scenePos());
@@ -935,11 +933,13 @@ void tst_QGraphicsView::foregroundBrush()
view.setSceneRect(-1000, -1000, 2000, 2000);
for (int i = -500; i < 500; i += 10) {
view.centerOn(i, 0);
- QTest::qWait(10);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
for (int i = -500; i < 500; i += 10) {
view.centerOn(0, i);
- QTest::qWait(10);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
}
@@ -965,7 +965,8 @@ void tst_QGraphicsView::matrix()
gradient2.setColorAt(1, Qt::transparent);
gradient2.setSpread(QGradient::RepeatSpread);
scene.setBackgroundBrush(gradient2);
- QTest::qWait(10);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
}
@@ -978,7 +979,8 @@ void tst_QGraphicsView::matrix()
view.show();
for (int i = 0; i < 160; ++i) {
view.rotate(18);
- QTest::qWait(5);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
/*
// These cause a crash
@@ -993,11 +995,13 @@ void tst_QGraphicsView::matrix()
*/
for (int i = 0; i < 20; ++i) {
view.scale(1.2, 1.2);
- QTest::qWait(20);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
for (int i = 0; i < 20; ++i) {
view.scale(0.6, 0.6);
- QTest::qWait(20);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
}
}
@@ -1093,10 +1097,12 @@ void tst_QGraphicsView::centerOnItem()
QGraphicsView view(&scene);
view.setSceneRect(-1000, -1000, 2000, 2000);
view.show();
+ QTest::qWaitForWindowShown(&view);
int tolerance = 7;
for (int x = 0; x < 3; ++x) {
for (int i = 0; i < 4; ++i) {
+ QApplication::processEvents();
view.centerOn(items[i]);
QPoint viewCenter = view.mapToScene(view.viewport()->rect().center()).toPoint();
@@ -1111,7 +1117,7 @@ void tst_QGraphicsView::centerOnItem()
QFAIL(qPrintable(error));
}
- QTest::qWait(250);
+ QApplication::processEvents();
}
view.rotate(13);
@@ -1141,6 +1147,7 @@ void tst_QGraphicsView::ensureVisibleRect()
view.setSceneRect(-500, -500, 1000, 1000);
view.setFixedSize(250, 250);
view.show();
+ QTest::qWaitForWindowShown(&view);
for (int y = -100; y < 100; y += 25) {
for (int x = -100; x < 100; x += 13) {
@@ -1177,7 +1184,7 @@ void tst_QGraphicsView::ensureVisibleRect()
QVERIFY(qAbs(viewPoint.y() - viewRect.top()) >= margin -1);
QVERIFY(qAbs(viewPoint.y() - viewRect.bottom()) >= margin -1);
- QTest::qWait(10);
+ QApplication::processEvents();
}
}
view.rotate(5);
@@ -1381,10 +1388,8 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust()
view.setFrameStyle(0);
view.resize(300, 300);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(125);
+ QTest::qWaitForWindowShown(&view) ;
+ QTRY_VERIFY(rect->numPaints > 0);
rect->numPaints = 0;
if (updateRect.isNull())
@@ -1521,8 +1526,8 @@ void tst_QGraphicsView::itemAt2()
view.setTransformationAnchor(QGraphicsView::NoAnchor);
view.setRenderHint(QPainter::Antialiasing);
view.show();
-
- QTestEventLoop::instance().enterLoop(1);
+ QTest::qWaitForWindowShown(&view);
+ QApplication::processEvents();
QPoint itemViewPoint = view.mapFromScene(item->scenePos());
@@ -2135,17 +2140,17 @@ void tst_QGraphicsView::resizeAnchor()
for (int size = 200; size <= 400; size += 25) {
view.resize(size, size);
if (i == 0) {
- QCOMPARE(view.mapToScene(50, 50), f);
- QVERIFY(view.mapToScene(view.viewport()->rect().center()) != center);
+ QTRY_COMPARE(view.mapToScene(50, 50), f);
+ QTRY_VERIFY(view.mapToScene(view.viewport()->rect().center()) != center);
} else {
- QVERIFY(view.mapToScene(50, 50) != f);
+ QTRY_VERIFY(view.mapToScene(50, 50) != f);
QPointF newCenter = view.mapToScene(view.viewport()->rect().center());
int slack = 3;
QVERIFY(qAbs(newCenter.x() - center.x()) < slack);
QVERIFY(qAbs(newCenter.y() - center.y()) < slack);
}
- QTest::qWait(250);
+ QTest::qWait(20);
}
}
}
@@ -2154,12 +2159,15 @@ class CustomView : public QGraphicsView
{
Q_OBJECT
public:
+ CustomView(QGraphicsScene *s = 0) : QGraphicsView(s) {}
QList<QRegion> lastUpdateRegions;
+ bool painted;
protected:
void paintEvent(QPaintEvent *event)
{
lastUpdateRegions << event->region();
+ painted = true;
QGraphicsView::paintEvent(event);
}
};
@@ -2247,6 +2255,7 @@ void tst_QGraphicsView::viewportUpdateMode2()
// Create a view with viewport rect equal to QRect(0, 0, 200, 200).
QGraphicsScene dummyScene;
CustomView view;
+ view.painted = false;
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
view.setScene(&dummyScene);
int left, top, right, bottom;
@@ -2255,6 +2264,7 @@ void tst_QGraphicsView::viewportUpdateMode2()
view.show();
QTest::qWaitForWindowShown(&view);
QTest::qWait(50);
+ QTRY_VERIFY(view.painted);
const QRect viewportRect = view.viewport()->rect();
QCOMPARE(viewportRect, QRect(0, 0, 200, 200));
@@ -2921,10 +2931,10 @@ void tst_QGraphicsView::task239729_noViewUpdate()
EventSpy spy(view->viewport(), QEvent::Paint);
QCOMPARE(spy.count(), 0);
- QTest::qWait(150);
+ QTest::qWait(100);
QCOMPARE(spy.count(), 0);
scene.update();
- QTest::qWait(150);
+ QApplication::processEvents();
QTRY_COMPARE(spy.count(), 1);
delete view;
@@ -3159,7 +3169,6 @@ void tst_QGraphicsView::moveItemWhileScrolling()
int a = adjustForAntialiasing ? 2 : 1;
expectedRegion += QRect(40, 50, 10, 10).adjusted(-a, -a, a, a);
expectedRegion += QRect(40, 60, 10, 10).adjusted(-a, -a, a, a);
-
QCOMPARE(view.lastPaintedRegion, expectedRegion);
}
@@ -3343,11 +3352,13 @@ void tst_QGraphicsView::render()
{
// ### This test can be much more thorough - see QGraphicsScene::render.
QGraphicsScene scene;
- QGraphicsView view(&scene);
+ CustomView view(&scene);
view.setFrameStyle(0);
view.resize(200, 200);
+ view.painted = false;
view.show();
QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.painted > 0);
RenderTester *r1 = new RenderTester(QRectF(0, 0, 50, 50));
RenderTester *r2 = new RenderTester(QRectF(50, 50, 50, 50));
@@ -3383,10 +3394,12 @@ void tst_QGraphicsView::exposeRegion()
QGraphicsScene scene;
scene.addItem(item);
+ item->paints = 0;
CustomView view;
view.setScene(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(item->paints > 0);
item->paints = 0;
view.lastUpdateRegions.clear();
@@ -3449,7 +3462,7 @@ void tst_QGraphicsView::update()
QTest::qWaitForWindowShown(&view);
QApplication::setActiveWindow(&view);
- QTest::qWait(50);
+ QApplication::processEvents();
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
const QRect viewportRect = view.viewport()->rect();
@@ -3465,15 +3478,15 @@ void tst_QGraphicsView::update()
viewPrivate->processPendingUpdates();
QVERIFY(viewPrivate->dirtyRegion.isEmpty());
QVERIFY(viewPrivate->dirtyBoundingRect.isEmpty());
- QTest::qWait(150);
+ QApplication::processEvents();
if (!intersects) {
- QVERIFY(view.lastUpdateRegions.isEmpty());
+ QTRY_VERIFY(view.lastUpdateRegions.isEmpty());
} else {
- QCOMPARE(view.lastUpdateRegions.size(), 1);
+ QTRY_COMPARE(view.lastUpdateRegions.size(), 1);
// Note that we adjust by 2 for antialiasing.
- QCOMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect.adjusted(-2, -2, 2, 2) & viewportRect));
+ QTRY_COMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect.adjusted(-2, -2, 2, 2) & viewportRect));
}
- QVERIFY(!viewPrivate->fullUpdatePending);
+ QTRY_VERIFY(!viewPrivate->fullUpdatePending);
#endif
}
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index dc7184c..063075d 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -944,6 +944,16 @@ void tst_QScriptContext::inheritActivationAndThisObject()
QVERIFY(ret.isNumber());
QCOMPARE(ret.toInt32(), 123);
}
+
+ // QT-2219
+ {
+ eng.globalObject().setProperty("a", 123);
+ QScriptValue ret = eng.evaluate("(function() { myEval('var a = 456'); return a; })()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 456);
+ QEXPECT_FAIL("", "QT-2219: Wrong activation object is returned from native function's parent context", Continue);
+ QVERIFY(eng.globalObject().property("a").strictlyEquals(123));
+ }
}
static QScriptValue parentContextToString(QScriptContext *ctx, QScriptEngine *)
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 4d693af..183aa3f 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -95,6 +95,7 @@ private slots:
void evaluate();
void nestedEvaluate();
void uncaughtException();
+ void errorMessage_QT679();
void valueConversion();
void importExtension();
void infiniteRecursion();
@@ -1625,6 +1626,16 @@ void tst_QScriptEngine::uncaughtException()
}
}
+void tst_QScriptEngine::errorMessage_QT679()
+{
+ QScriptEngine engine;
+ engine.globalObject().setProperty("foo", 15);
+ QScriptValue error = engine.evaluate("'hello world';\nfoo.bar.blah");
+ QVERIFY(error.isError());
+ QEXPECT_FAIL("", "Task QT-679: the error message always contains the first line of the script, even if the error was on a different line", Continue);
+ QCOMPARE(error.toString(), QString::fromLatin1("TypeError: Result of expression 'foo.bar' [undefined] is not an object."));
+}
+
struct Foo {
public:
int x, y;
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
index 6d231ca..80c7b53 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -104,6 +104,8 @@ QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
setContextMenuPolicy(Qt::DefaultContextMenu);
setAcceptDrops(true); // ### fake
+ // Fake property: Keep the menu bar editable in the form even if a native menu bar is used.
+ setNativeMenuBar(false);
m_addMenu->setText(tr("Type Here"));
addAction(m_addMenu);
diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 851bfc1..7574fdd 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -63,6 +63,7 @@
#include <QtGui/QApplication>
#include <QtGui/QToolBar>
#include <QtGui/QMainWindow>
+#include <QtGui/QMenuBar>
QT_BEGIN_NAMESPACE
@@ -611,9 +612,15 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
createFakeProperty(QLatin1String("dragEnabled"));
// windowModality is visible only for the main container, in which case the form windows enables it on loading
setVisible(createFakeProperty(QLatin1String("windowModality")), false);
- if (qobject_cast<const QToolBar *>(d->m_object)) // prevent toolbars from being dragged off
+ if (qobject_cast<const QToolBar *>(d->m_object)) { // prevent toolbars from being dragged off
createFakeProperty(QLatin1String("floatable"), QVariant(true));
-
+ } else {
+ if (qobject_cast<const QMenuBar *>(d->m_object)) {
+ // Keep the menu bar editable in the form even if a native menu bar is used.
+ const bool nativeMenuBarDefault = !qApp->testAttribute(Qt::AA_DontUseNativeMenuBar);
+ createFakeProperty(QLatin1String("nativeMenuBar"), QVariant(nativeMenuBarDefault));
+ }
+ }
if (d->m_canHaveLayoutAttributes) {
static const QString layoutGroup = QLatin1String("Layout");
const char* fakeLayoutProperties[] = {
diff --git a/tools/designer/translations/translations.pro b/tools/designer/translations/translations.pro
index 8395259..c8cd76d 100644
--- a/tools/designer/translations/translations.pro
+++ b/tools/designer/translations/translations.pro
@@ -133,7 +133,7 @@ HEADERS += ../../shared/findwidget/abstractfindwidget.h \
TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/designer_de.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_ja.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_pl.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/designer_ru.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_zh_CN.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_zh_TW.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_untranslated.ts
-
diff --git a/tools/linguist/linguist/linguist.pro b/tools/linguist/linguist/linguist.pro
index 314163c..00ebec1 100644
--- a/tools/linguist/linguist/linguist.pro
+++ b/tools/linguist/linguist/linguist.pro
@@ -81,9 +81,6 @@ PROJECTNAME = Qt \
Linguist
target.path = $$[QT_INSTALL_BINS]
INSTALLS += target
-linguisttranslations.files = *.qm
-linguisttranslations.path = $$[QT_INSTALL_TRANSLATIONS]
-INSTALLS += linguisttranslations
phrasebooks.path = $$[QT_INSTALL_DATA]/phrasebooks
# ## will this work on windows?
diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph
index 69af041..9d40bd3 100644
--- a/tools/linguist/phrasebooks/russian.qph
+++ b/tools/linguist/phrasebooks/russian.qph
@@ -201,10 +201,6 @@
<target>разделить выбранные элементы</target>
</phrase>
<phrase>
- <source>dock</source>
- <target>док</target>
-</phrase>
-<phrase>
<source>document</source>
<target>документ</target>
</phrase>
@@ -302,7 +298,7 @@
</phrase>
<phrase>
<source>font style</source>
- <target>стиль шрифта</target>
+ <target>начертание</target>
</phrase>
<phrase>
<source>function key</source>
@@ -510,7 +506,7 @@
</phrase>
<phrase>
<source>OK</source>
- <target>Готово</target>
+ <target>ОК</target>
</phrase>
<phrase>
<source>OLE</source>
@@ -1038,10 +1034,6 @@
</phrase>
<phrase>
<source>OK</source>
- <target>Выбрать</target>
-</phrase>
-<phrase>
- <source>OK</source>
<target>Закрыть</target>
</phrase>
<phrase>
@@ -1092,4 +1084,84 @@
<source>Checkable</source>
<target>Переключаемое</target>
</phrase>
+<phrase>
+ <source>Style</source>
+ <target>Начертание</target>
+</phrase>
+<phrase>
+ <source>Point size</source>
+ <target>Размер</target>
+</phrase>
+<phrase>
+ <source>Family</source>
+ <target>Шрифт</target>
+</phrase>
+<phrase>
+ <source>Writing system</source>
+ <target>Система письма</target>
+</phrase>
+<phrase>
+ <source>OK</source>
+ <target>Удалить</target>
+</phrase>
+<phrase>
+ <source>Style</source>
+ <target>Стиль</target>
+</phrase>
+<phrase>
+ <source>Edit</source>
+ <target>Изменить</target>
+</phrase>
+<phrase>
+ <source>Invalid</source>
+ <target>Некорректный</target>
+</phrase>
+<phrase>
+ <source>Invalid</source>
+ <target>Некорректная</target>
+</phrase>
+<phrase>
+ <source>Invalid</source>
+ <target>Некорректное</target>
+</phrase>
+<phrase>
+ <source>tag</source>
+ <target>тэг</target>
+</phrase>
+<phrase>
+ <source>tab order</source>
+ <target>порядок обхода</target>
+</phrase>
+<phrase>
+ <source>Ascending</source>
+ <target>По возрастанию</target>
+</phrase>
+<phrase>
+ <source>Descending</source>
+ <target>По убыванию</target>
+</phrase>
+<phrase>
+ <source>Reset</source>
+ <target>Сбросить</target>
+</phrase>
+<phrase>
+ <source>Sort order</source>
+ <target>Порядок сортировки</target>
+</phrase>
+<phrase>
+ <source>Appearance</source>
+ <target>Внешний вид</target>
+</phrase>
+<phrase>
+ <source>View</source>
+ <target>Просмотр</target>
+</phrase>
+<phrase>
+ <source>Actions</source>
+ <target>Действия</target>
+</phrase>
+<phrase>
+ <source>Table of Contents</source>
+ <target>Оглавление</target>
+</phrase>
</QPH>