From d289e54f2d2aa066cb383d8c8249bd7594bdf7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 6 Apr 2011 10:47:28 +0200 Subject: Make accessibility work on Windows with alien This means that there will be no implicit conversion to windows handles anymore! Enabler for making QML accessible on windows. (cherry picked from commit a3ac7deb5dfe48c5fdd0e170c20b6852c3bb41de) Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible_win.cpp | 126 +++++++++++++++++++++++++++++---- 1 file changed, 113 insertions(+), 13 deletions(-) diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp index caa2104..0e69a5e 100644 --- a/src/gui/accessible/qaccessible_win.cpp +++ b/src/gui/accessible/qaccessible_win.cpp @@ -47,6 +47,8 @@ #include "qt_windows.h" #include "qwidget.h" #include "qsettings.h" +#include +#include #include #if !defined(WINABLEAPI) @@ -159,6 +161,12 @@ void showDebug(const char* funcName, const QAccessibleInterface *iface) # define showDebug(f, iface) #endif +// This stuff is used for widgets/items with no window handle: +typedef QMap > NotifyMap; +Q_GLOBAL_STATIC(NotifyMap, qAccessibleRecentSentEvents) +static int eventNum = 0; + + void QAccessible::initialize() { @@ -251,17 +259,15 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) // An event has to be associated with a window, // so find the first parent that is a widget. QWidget *w = 0; - if (o->isWidgetType()) { - w = (QWidget*)o; - } else { - QObject *p = o; - while ((p = p->parent()) != 0) { - if (p->isWidgetType()) { - w = (QWidget*)p; + QObject *p = o; + do { + if (p->isWidgetType()) { + w = static_cast(p); + if (w->internalWinId()) break; - } } - } + p = p->parent(); + } while (p); if (!w) { if (reason != QAccessible::ContextHelpStart && @@ -282,12 +288,81 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) } } + WId wid = w->internalWinId(); if (reason != MenuCommand) { // MenuCommand is faked - ptrNotifyWinEvent(reason, w->winId(), OBJID_CLIENT, who); + if (w != o) { + // See comment "SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE" + eventNum %= 50; //[0..49] + int eventId = - eventNum - 1; + + qAccessibleRecentSentEvents()->insert(eventId, qMakePair(o,who)); + ptrNotifyWinEvent(reason, wid, OBJID_CLIENT, eventId ); + + ++eventNum; + } else { + ptrNotifyWinEvent(reason, wid, OBJID_CLIENT, who); + } } #endif // Q_WS_WINCE } +/* == SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE == + + If the user requested to send the event to a widget with no window, + we need to send an event to an object with no hwnd. + The way we do that is to send it to the *first* ancestor widget + with a window. + Then we'll need a way of identifying the child: + We'll just keep a list of the most recent events that we have sent, + where each entry in the list is identified by a negative value + between [-50,-1]. This negative value we will pass on to + NotifyWinEvent() as the child id. When the negative value have + reached -50, it will wrap around to -1. This seems to be enough + + Now, when the client receives that event, he will first call + AccessibleObjectFromEvent() where dwChildID is the special + negative value. AccessibleObjectFromEvent does two steps: + 1. It will first sent a WM_GETOBJECT to the server, asking + for the IAccessible interface for the HWND. + 2. With the IAccessible interface it got hold of it will call + acc_getChild where the child id argument is the special + negative identifier. In our reimplementation of get_accChild + we check for this if the child id is negative. If it is, then + we'll look up in our table for the entry that is associated + with that value. + The entry will then contain a pointer to the QObject /QWidget + that we can use to call queryAccessibleInterface() on. + + + The following figure shows how the interaction between server and + client is in the case when the server is sending an event. + +SERVER (Qt) | CLIENT | +--------------------------------------------+---------------------------------------+ + | +acc->updateAccessibility(obj, childIndex) | + | +recentEvents()->insert(- 1 - eventNum, | + qMakePair(obj, childIndex) | +NotifyWinEvent(hwnd, childId) => | + | AccessibleObjectFromEvent(event, hwnd, OBJID_CLIENT, childId ) + | will do: + <=== 1. send WM_GETOBJECT(hwnd, OBJID_CLIENT) +widget ~= hwnd +iface = queryAccessibleInteface(widget) +(create IAccessible interface wrapper for + iface) + return iface ===> IAccessible* iface; (for hwnd) + | + <=== call iface->get_accChild(childId) +get_accChild() { | + if (varChildID.lVal < 0) { + QPair ref = recentEvents().value(varChildID.lVal); + [...] + } +*/ + + void QAccessible::setRootObject(QObject *o) { if (rootObjectHandler) { @@ -418,15 +493,18 @@ public: delete accessible; } + /* IUnknown */ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *); ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE Release(); + /* IDispatch */ HRESULT STDMETHODCALLTYPE GetTypeInfoCount(unsigned int *); HRESULT STDMETHODCALLTYPE GetTypeInfo(unsigned int, unsigned long, ITypeInfo **); HRESULT STDMETHODCALLTYPE GetIDsOfNames(const _GUID &, wchar_t **, unsigned int, unsigned long, long *); HRESULT STDMETHODCALLTYPE Invoke(long, const _GUID &, unsigned long, unsigned short, tagDISPPARAMS *, tagVARIANT *, tagEXCEPINFO *, unsigned int *); + /* IAccessible */ HRESULT STDMETHODCALLTYPE accHitTest(long xLeft, long yTop, VARIANT *pvarID); HRESULT STDMETHODCALLTYPE accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID); HRESULT STDMETHODCALLTYPE accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd); @@ -451,6 +529,7 @@ public: HRESULT STDMETHODCALLTYPE get_accFocus(VARIANT *pvarID); HRESULT STDMETHODCALLTYPE get_accSelection(VARIANT *pvarChildren); + /* IOleWindow */ HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); @@ -896,9 +975,30 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, I if (varChildID.vt == VT_EMPTY) return E_INVALIDARG; + + int childIndex = varChildID.lVal; QAccessibleInterface *acc = 0; - RelationFlag rel = varChildID.lVal ? Child : Self; - accessible->navigate(rel, varChildID.lVal, &acc); + + if (childIndex < 0) { + const int entry = childIndex; + QPair ref = qAccessibleRecentSentEvents()->value(entry); + if (ref.first) { + acc = queryAccessibleInterface(ref.first); + if (acc && ref.second) { + if (ref.second) { + QAccessibleInterface *res; + int index = acc->navigate(Child, ref.second, &res); + delete acc; + if (index == -1) + return E_INVALIDARG; + acc = res; + } + } + } + } else { + RelationFlag rel = childIndex ? Child : Self; + accessible->navigate(rel, childIndex, &acc); + } if (acc) { QWindowsAccessible* wacc = new QWindowsAccessible(acc); @@ -1203,7 +1303,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::GetWindow(HWND *phwnd) if (!o || !o->isWidgetType()) return E_FAIL; - *phwnd = static_cast(o)->winId(); + *phwnd = static_cast(o)->effectiveWinId(); return S_OK; } -- cgit v0.12 From 96406a7dd609e75340f7b4a05726c60c197786b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 5 May 2011 16:19:16 +0200 Subject: Fix updateAccessibility for QGraphicsObjects If updateAccessibility is called on a QGraphicsObject, walk up and find the closest ancestor widget with a HWND. (cherry picked from commit d4291591dfb6a7b1f5c7d00879e8162e84d9ab1b) Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible_win.cpp | 124 ++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp index 0e69a5e..98db529 100644 --- a/src/gui/accessible/qaccessible_win.cpp +++ b/src/gui/accessible/qaccessible_win.cpp @@ -49,6 +49,9 @@ #include "qsettings.h" #include #include +#include +#include +#include #include #if !defined(WINABLEAPI) @@ -150,6 +153,106 @@ static const char *roleString(QAccessible::Role role) return roles[int(role)]; } +static const char *eventString(QAccessible::Event ev) +{ + static const char *events[] = { + "null", // 0 + "SoundPlayed" /*= 0x0001*/, + "Alert" /*= 0x0002*/, + "ForegroundChanged" /*= 0x0003*/, + "MenuStart" /*= 0x0004*/, + "MenuEnd" /*= 0x0005*/, + "PopupMenuStart" /*= 0x0006*/, + "PopupMenuEnd" /*= 0x0007*/, + "ContextHelpStart" /*= 0x000C*/, // 8 + "ContextHelpEnd" /*= 0x000D*/, + "DragDropStart" /*= 0x000E*/, + "DragDropEnd" /*= 0x000F*/, + "DialogStart" /*= 0x0010*/, + "DialogEnd" /*= 0x0011*/, + "ScrollingStart" /*= 0x0012*/, + "ScrollingEnd" /*= 0x0013*/, + "MenuCommand" /*= 0x0018*/, // 16 + + // Values from IAccessible2 + "ActionChanged" /*= 0x0101*/, // 17 + "ActiveDescendantChanged", + "AttributeChanged", + "DocumentContentChanged", + "DocumentLoadComplete", + "DocumentLoadStopped", + "DocumentReload", + "HyperlinkEndIndexChanged", + "HyperlinkNumberOfAnchorsChanged", + "HyperlinkSelectedLinkChanged", + "HypertextLinkActivated", + "HypertextLinkSelected", + "HyperlinkStartIndexChanged", + "HypertextChanged", + "HypertextNLinksChanged", + "ObjectAttributeChanged", + "PageChanged", + "SectionChanged", + "TableCaptionChanged", + "TableColumnDescriptionChanged", + "TableColumnHeaderChanged", + "TableModelChanged", + "TableRowDescriptionChanged", + "TableRowHeaderChanged", + "TableSummaryChanged", + "TextAttributeChanged", + "TextCaretMoved", + // TextChanged, deprecated, use TextUpdated + //TextColumnChanged = TextCaretMoved + 2, + "TextInserted", + "TextRemoved", + "TextUpdated", + "TextSelectionChanged", + "VisibleDataChanged", /*= 0x0101+32*/ + "ObjectCreated" /*= 0x8000*/, // 49 + "ObjectDestroyed" /*= 0x8001*/, + "ObjectShow" /*= 0x8002*/, + "ObjectHide" /*= 0x8003*/, + "ObjectReorder" /*= 0x8004*/, + "Focus" /*= 0x8005*/, + "Selection" /*= 0x8006*/, + "SelectionAdd" /*= 0x8007*/, + "SelectionRemove" /*= 0x8008*/, + "SelectionWithin" /*= 0x8009*/, + "StateChanged" /*= 0x800A*/, + "LocationChanged" /*= 0x800B*/, + "NameChanged" /*= 0x800C*/, + "DescriptionChanged" /*= 0x800D*/, + "ValueChanged" /*= 0x800E*/, + "ParentChanged" /*= 0x800F*/, + "HelpChanged" /*= 0x80A0*/, + "DefaultActionChanged" /*= 0x80B0*/, + "AcceleratorChanged" /*= 0x80C0*/ + }; + int e = int(ev); + if (e <= 0x80c0) { + const int last = sizeof(events)/sizeof(char*) - 1; + + if (e <= 0x07) + return events[e]; + else if (e <= 0x13) + return events[e - 0x0c + 8]; + else if (e == 0x18) + return events[16]; + else if (e <= 0x0101 + 32) + return events[e - 0x101 + 17]; + else if (e <= 0x800f) + return events[e - 0x8000 + 49]; + else if (e == 0x80a0) + return events[last - 2]; + else if (e == 0x80b0) + return events[last - 1]; + else if (e == 0x80c0) + return events[last]; + } + return "unknown"; +}; + void showDebug(const char* funcName, const QAccessibleInterface *iface) { qDebug() << "Role:" << roleString(iface->role(0)) @@ -266,9 +369,28 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) if (w->internalWinId()) break; } - p = p->parent(); + if (QGraphicsObject *gfxObj = qobject_cast(p)) { + QGraphicsItem *parentItem = gfxObj->parentItem(); + if (parentItem) { + p = parentItem->toGraphicsObject(); + } else { + QGraphicsView *view = 0; + if (QGraphicsScene *scene = gfxObj->scene()) { + QWidget *fw = QApplication::focusWidget(); + const QList views = scene->views(); + for (int i = 0 ; i < views.count() && view != fw; ++i) { + view = views.at(i); + } + } + p = view; + } + } else { + p = p->parent(); + } + } while (p); + //qDebug() << "updateAccessibility(), hwnd:" << w << ", object:" << o << "," << eventString(reason); if (!w) { if (reason != QAccessible::ContextHelpStart && reason != QAccessible::ContextHelpEnd) -- cgit v0.12 From 4687938fd03ed65306039af6b4e5e192ec8bf491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 5 May 2011 16:21:36 +0200 Subject: Call updateAccessibility on the QGraphicsObject in updateMicroFocus Since QGraphicsObjects now can be in the a11y hierarchy, we should treat them just like we treat widgets. (cherry picked from commit 860745a4713b29857d14571572504da71a2ca077) Reviewed-by: Frederik Gladhorn --- src/gui/graphicsview/qgraphicsitem.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e67fe82..41ff317 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7395,15 +7395,19 @@ void QGraphicsItem::updateMicroFocus() if (QWidget *fw = QApplication::focusWidget()) { if (scene()) { for (int i = 0 ; i < scene()->views().count() ; ++i) { - if (scene()->views().at(i) == fw) - if (QInputContext *inputContext = fw->inputContext()) + if (scene()->views().at(i) == fw) { + if (QInputContext *inputContext = fw->inputContext()) { inputContext->update(); - } - } #ifndef QT_NO_ACCESSIBILITY - // ##### is this correct - QAccessible::updateAccessibility(fw, 0, QAccessible::StateChanged); + // ##### is this correct + if (toGraphicsObject()) + QAccessible::updateAccessibility(toGraphicsObject(), 0, QAccessible::StateChanged); #endif + break; + } + } + } + } } #endif } -- cgit v0.12 From 9a02ad74693f1835745ec20798b353f7e62bcd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 5 May 2011 16:28:58 +0200 Subject: Notify a11y framework of FocusChanges for QGraphicsObject (cherry picked from commit 1b5cb7865eb8b48a2721f9b9c3ccd2fb25f8175d) Reviewed-by: Frederik Gladhorn --- src/gui/graphicsview/qgraphicsscene.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0713d09..ba4c914 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -245,6 +245,10 @@ #include #include #include +#ifndef QT_NO_ACCESSIBILITY +# include +#endif + #include #include #ifdef Q_WS_X11 @@ -837,6 +841,14 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, if (item) focusItem = item; updateInputMethodSensitivityInViews(); + +#ifndef QT_NO_ACCESSIBILITY + if (focusItem) { + if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) { + QAccessible::updateAccessibility(focusObj, 0, QAccessible::Focus); + } + } +#endif if (item) { QFocusEvent event(QEvent::FocusIn, focusReason); sendEvent(item, &event); -- cgit v0.12 From a825b3a9e6132842090e43fae85d2c6c61b2def6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 5 May 2011 16:40:45 +0200 Subject: Avoided calling updateAccessibility() from updateMicroFocus if the item was hidden This had the following negative effect in qmlviewer: - Every time the qmlviewer logged something to its QPlainTextEdit (regardless of if it was visible or not) it would call updateMicroFocus (because appending to QPlainTextEdit would move the cursor). The result was that the AT client got overloaded with accessibility state changes, and response time got really bad. (cherry picked from commit ad50e45311cce712fbe35641cde973d616ff560d) Reviewed-by: Frederik Gladhorn --- src/gui/kernel/qwidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ebc9dd5..434a788 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11344,8 +11344,10 @@ void QWidget::updateMicroFocus() } #endif #ifndef QT_NO_ACCESSIBILITY - // ##### is this correct - QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged); + if (isVisible()) { + // ##### is this correct + QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged); + } #endif } -- cgit v0.12 From 37c329a3e35fabc88fbcad824a69f37c671d2132 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 14 Apr 2011 21:38:45 +0200 Subject: New algorithm for drawing thin lines Added a new QCosmeticStroker class for drawing thin lines. The class can handle both aliased and antialiased lines. The code replaces all the midpoint line drawing algorithms in the raster paintengine and gives correct subpixel positioning for lines. It gives around 30% to 50% speedup against the midpoint algorithm. If we missed that fast path, the speedup is around between a factor of 6 to 8 for lines and aliased paths and 100 and 400 for antialiased paths. Reviewed-by: Kim --- src/gui/painting/painting.pri | 4 +- src/gui/painting/qcosmeticstroker.cpp | 954 +++++++++++++++++++ src/gui/painting/qcosmeticstroker_p.h | 101 ++ src/gui/painting/qpaintengine_raster.cpp | 1520 ++---------------------------- src/gui/painting/qpaintengine_raster_p.h | 5 - src/gui/painting/qpaintengineex.cpp | 2 +- 6 files changed, 1137 insertions(+), 1449 deletions(-) create mode 100644 src/gui/painting/qcosmeticstroker.cpp create mode 100644 src/gui/painting/qcosmeticstroker_p.h diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 65e7af4..13a9ba1 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -6,6 +6,7 @@ HEADERS += \ painting/qcolor.h \ painting/qcolor_p.h \ painting/qcolormap.h \ + painting/qcosmeticstroker_p.h \ painting/qdrawutil.h \ painting/qemulationpaintengine_p.h \ painting/qgraphicssystem_p.h \ @@ -14,7 +15,7 @@ HEADERS += \ painting/qoutlinemapper_p.h \ painting/qpaintdevice.h \ painting/qpaintengine.h \ - painting/qpaintengine_p.h \ + painting/qpaintengine_p.h \ painting/qpaintengine_alpha_p.h \ painting/qpaintengine_preview_p.h \ painting/qpaintengineex_p.h \ @@ -53,6 +54,7 @@ SOURCES += \ painting/qbrush.cpp \ painting/qcolor.cpp \ painting/qcolor_p.cpp \ + painting/qcosmeticstroker.cpp \ painting/qcssutil.cpp \ painting/qdrawutil.cpp \ painting/qemulationpaintengine.cpp \ diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp new file mode 100644 index 0000000..498b154 --- /dev/null +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -0,0 +1,954 @@ +#include "qcosmeticstroker_p.h" +#include "private/qpainterpath_p.h" +#include +#include + +#if 0 +inline QString capString(int caps) +{ + QString str; + if (caps & QCosmeticStroker::CapBegin) { + str += "CapBegin "; + } + if (caps & QCosmeticStroker::CapEnd) { + str += "CapEnd "; + } + return str; +} +#endif + +#define toF26Dot6(x) ((int)((x)*64.)) + +static inline uint sourceOver(uint d, uint color) +{ + return color + BYTE_MUL(d, qAlpha(~color)); +} + +inline static int F16Dot16FixedDiv(int x, int y) +{ + if (qAbs(x) > 0x7fff) + return (((qlonglong)x) << 16) / y; + return (x << 16) / y; +} + +typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage); + +namespace { + +struct Dasher { + QCosmeticStroker *stroker; + int *pattern; + int offset; + int dashIndex; + int dashOn; + + Dasher(QCosmeticStroker *s, bool reverse, int start, int stop) + : stroker(s) + { + int delta = stop - start; + if (reverse) { + pattern = stroker->reversePattern; + offset = stroker->patternLength - stroker->patternOffset - delta - ((start & 63) - 32); + dashOn = 0; + } else { + pattern = stroker->pattern; + offset = stroker->patternOffset - ((start & 63) - 32); + dashOn = 1; + } + offset %= stroker->patternLength; + if (offset < 0) + offset += stroker->patternLength; + + dashIndex = 0; + while (offset>= pattern[dashIndex]) + ++dashIndex; + +// qDebug() << " dasher" << offset/64. << reverse << dashIndex; + stroker->patternOffset += delta; + stroker->patternOffset %= stroker->patternLength; + } + + bool on() const { + return (dashIndex + dashOn) & 1; + } + void adjust() { + offset += 64; + if (offset >= pattern[dashIndex]) { + ++dashIndex; + dashIndex %= stroker->patternSize; + } + offset %= stroker->patternLength; +// qDebug() << "dasher.adjust" << offset/64. << dashIndex; + } +}; + +struct NoDasher { + NoDasher(QCosmeticStroker *, bool, int, int) {} + bool on() const { return true; } + void adjust(int = 0) {} +}; + +}; + +template +static void drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); +template +static void drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); + +inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) +{ + int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; + int lasty = stroker->spans[stroker->current_span-1].y; + + if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { + stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); + stroker->current_span = 0; + } + + stroker->spans[stroker->current_span].x = ushort(x); + stroker->spans[stroker->current_span].len = 1; + stroker->spans[stroker->current_span].y = y; + stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8; + ++stroker->current_span; +} + +inline void drawPixelARGB32(QCosmeticStroker *stroker, int x, int y, int coverage) +{ + const QRect &cl = stroker->clip; + if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) + return; + + int offset = x + stroker->ppl*y; + uint c = BYTE_MUL(stroker->color, coverage); + stroker->pixels[offset] = sourceOver(stroker->pixels[offset], c); +} + +inline void drawPixelARGB32Opaque(QCosmeticStroker *stroker, int x, int y, int) +{ + const QRect &cl = stroker->clip; + if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) + return; + + int offset = x + stroker->ppl*y; + stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color); +} + +enum StrokeSelection { + Aliased = 0, + AntiAliased = 1, + Solid = 0, + Dashed = 2, + RegularDraw = 0, + FastDraw = 4 +}; + +static StrokeLine strokeLine(int strokeSelection) +{ + StrokeLine stroke; + + switch (strokeSelection) { + case Aliased|Solid|RegularDraw: + stroke = &::drawLine; + break; + case Aliased|Solid|FastDraw: + stroke = &::drawLine; + break; + case Aliased|Dashed|RegularDraw: + stroke = &::drawLine; + break; + case Aliased|Dashed|FastDraw: + stroke = &::drawLine; + break; + case AntiAliased|Solid|RegularDraw: + stroke = &drawLineAA; + break; + case AntiAliased|Solid|FastDraw: + stroke = &drawLineAA; + break; + case AntiAliased|Dashed|RegularDraw: + stroke = &drawLineAA; + break; + case AntiAliased|Dashed|FastDraw: + stroke = &drawLineAA; + break; + default: + Q_ASSERT(false); + stroke = 0; + } + return stroke; +} + +void QCosmeticStroker::setup() +{ + blend = state->penData.blend; + if (state->clip && state->clip->enabled && state->clip->hasRectClip && !state->clip->clipRect.isEmpty()) { + clip &= state->clip->clipRect; + blend = state->penData.unclipped_blend; + } + + int strokeSelection = 0; + if (blend == state->penData.unclipped_blend + && state->penData.type == QSpanData::Solid + && (state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied + || state->penData.rasterBuffer->format == QImage::Format_RGB32) + && state->compositionMode() == QPainter::CompositionMode_SourceOver) + strokeSelection |= FastDraw; + + if (state->renderHints & QPainter::Antialiasing) + strokeSelection |= AntiAliased; + + const QVector &penPattern = state->lastPen.dashPattern(); + if (penPattern.isEmpty()) { + Q_ASSERT(!pattern && !reversePattern); + pattern = 0; + reversePattern = 0; + patternLength = 0; + patternSize = 0; + } else { + pattern = (int *)malloc(penPattern.size()*sizeof(int)); + reversePattern = (int *)malloc(penPattern.size()*sizeof(int)); + patternSize = penPattern.size(); + + patternLength = 0; + for (int i = 0; i < patternSize; ++i) { + patternLength += (int) qMax(1. , penPattern.at(i)*64.); + pattern[i] = patternLength; + } + patternLength = 0; + for (int i = 0; i < patternSize; ++i) { + patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.); + reversePattern[i] = patternLength; + } + strokeSelection |= Dashed; +// qDebug() << "setup: size=" << patternSize << "length=" << patternLength/64.; + } + + stroke = strokeLine(strokeSelection); + + qreal width = state->lastPen.widthF(); + if (width == 0) + opacity = 256; + else if (state->lastPen.isCosmetic()) + opacity = (int) 256*width; + else + opacity = (int) 256*width*state->txscale; + opacity = qBound(0, opacity, 256); + + drawCaps = state->lastPen.capStyle() != Qt::FlatCap; + + if (strokeSelection & FastDraw) { + color = INTERPOLATE_PIXEL_256(state->penData.solid.color, opacity, 0, 0); + QRasterBuffer *buffer = state->penData.rasterBuffer; + pixels = (uint *)buffer->buffer(); + ppl = buffer->bytesPerLine()>>2; + } + + // setup FP clip bounds + xmin = clip.left() - 1; + xmax = clip.right() + 2; + ymin = clip.top() - 1; + ymax = clip.bottom() + 2; + + lastPixel.x = -1; +} + +// returns true if the whole line gets clipped away +bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2) +{ + // basic/rough clipping is done in floating point coordinates to avoid + // integer overflow problems. + if (x1 < xmin) { + if (x2 <= xmin) + goto clipped; + y1 += (y2 - y1)/(x2 - x1) * (xmin - x1); + x1 = xmin; + } else if (x1 > xmax) { + if (x2 >= xmax) + goto clipped; + y1 += (y2 - y1)/(x2 - x1) * (xmax - x1); + x1 = xmax; + } + if (x2 < xmin) { + lastPixel.x = -1; + y2 += (y2 - y1)/(x2 - x1) * (xmin - x2); + x2 = xmin; + } else if (x2 > xmax) { + lastPixel.x = -1; + y2 += (y2 - y1)/(x2 - x1) * (xmax - x2); + x2 = xmax; + } + + if (y1 < ymin) { + if (y2 <= ymin) + goto clipped; + x1 += (x2 - x1)/(y2 - y1) * (ymin - y1); + y1 = ymin; + } else if (y1 > ymax) { + if (y2 >= ymax) + goto clipped; + x1 += (x2 - x1)/(y2 - y1) * (ymax - y1); + y1 = ymax; + } + if (y2 < ymin) { + lastPixel.x = -1; + x2 += (x2 - x1)/(y2 - y1) * (ymin - y2); + y2 = ymin; + } else if (y2 > ymax) { + lastPixel.x = -1; + x2 += (x2 - x1)/(y2 - y1) * (ymax - y2); + y2 = ymax; + } + + return false; + + clipped: + lastPixel.x = -1; + return true; +} + + +void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2) +{ + QPointF start = p1 * state->matrix; + QPointF end = p2 * state->matrix; + + patternOffset = state->lastPen.dashOffset()*64; + lastPixel.x = -1; + + stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0); + + blend(current_span, spans, &state->penData); + current_span = 0; +} + +void QCosmeticStroker::drawPoints(const QPoint *points, int num) +{ + const QPoint *end = points + num; + while (points < end) { + QPointF p = QPointF(*points) * state->matrix; + drawPixel(this, qRound(p.x()), qRound(p.y()), 255); + ++points; + } + + blend(current_span, spans, &state->penData); + current_span = 0; +} + +void QCosmeticStroker::drawPoints(const QPointF *points, int num) +{ + const QPointF *end = points + num; + while (points < end) { + QPointF p = (*points) * state->matrix; + drawPixel(this, qRound(p.x()), qRound(p.y()), 255); + ++points; + } + + blend(current_span, spans, &state->penData); + current_span = 0; +} + +void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal ry2) +{ + // this is basically the same code as used in the aliased stroke method, + // but it only determines the direction and last point of a line + // + // This is being used to have proper dropout control for closed contours + // by calculating the direction and last pixel of the last segment in the contour. + // the info is then used to perform dropout control when drawing the first line segment + // of the contour + lastPixel.x = -1; + lastPixel.y = -1; + + if (clipLine(rx1, ry1, rx2, ry2)) + return; + + int x1 = toF26Dot6(rx1); + int y1 = toF26Dot6(ry1); + int x2 = toF26Dot6(rx2); + int y2 = toF26Dot6(ry2); + + int dx = qAbs(x2 - x1); + int dy = qAbs(y2 - y1); + + if (dx < dy) { + // vertical + bool swapped = false; + if (y1 > y2) { + swapped = true; + qSwap(y1, y2); + qSwap(x1, x2); + } + int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); + int x = x1 << 10; + + int y = (y1+32) >> 6; + int ys = (y2+32) >> 6; + + if (y != ys) { + x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; + + if (swapped) { + lastPixel.x = x >> 16; + lastPixel.y = y; + lastDir = QCosmeticStroker::BottomToTop; + } else { + lastPixel.x = (x + (ys - y - 1)*xinc) >> 16; + lastPixel.y = ys - 1; + lastDir = QCosmeticStroker::TopToBottom; + } + lastAxisAligned = qAbs(xinc) < (1 << 14); + } + } else { + // horizontal + if (!dx) + return; + + bool swapped = false; + if (x1 > x2) { + swapped = true; + qSwap(x1, x2); + qSwap(y1, y2); + } + int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); + int y = y1 << 10; + + int x = (x1+32) >> 6; + int xs = (x2+32) >> 6; + + if (x != xs) { + y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; + + if (swapped) { + lastPixel.x = x; + lastPixel.y = y >> 16; + lastDir = QCosmeticStroker::RightToLeft; + } else { + lastPixel.x = xs - 1; + lastPixel.y = (y + (xs - x - 1)*yinc) >> 16; + lastDir = QCosmeticStroker::LeftToRight; + } + lastAxisAligned = qAbs(yinc) < (1 << 14); + } + } +// qDebug() << " moveTo: setting last pixel to x/y dir" << lastPixel.x << lastPixel.y << lastDir; +} + +static inline const QPainterPath::ElementType *subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, + const qreal *points, bool *closed) +{ + const QPainterPath::ElementType *start = t; + ++t; + + // find out if the subpath is closed + while (t < end) { + if (*t == QPainterPath::MoveToElement) + break; + ++t; + } + + int offset = t - start - 1; +// qDebug() << "subpath" << offset << points[0] << points[1] << points[2*offset] << points[2*offset+1]; + *closed = (points[0] == points[2*offset] && points[1] == points[2*offset + 1]); + + return t; +} + +void QCosmeticStroker::drawPath(const QVectorPath &path) +{ +// qDebug() << ">>>> drawpath" << path.convertToPainterPath() +// << "antialiasing:" << (bool)(state->renderHints & QPainter::Antialiasing) << " implicit close:" << path.hasImplicitClose(); + if (path.isEmpty()) + return; + + const qreal *points = path.points(); + const QPainterPath::ElementType *type = path.elements(); + + if (type) { + const QPainterPath::ElementType *end = type + path.elementCount(); + + while (type < end) { + Q_ASSERT(type == path.elements() || *type == QPainterPath::MoveToElement); + + QPointF p = QPointF(points[0], points[1]) * state->matrix; + QPointF movedTo = p; + patternOffset = state->lastPen.dashOffset()*64; + lastPixel.x = -1; + + bool closed; + const QPainterPath::ElementType *e = subPath(type, end, points, &closed); + if (closed) { + const qreal *p = points + 2*(e-type); + calculateLastPoint(p[-4], p[-3], p[-2], p[-1]); + } + int caps = (!closed & drawCaps) ? CapBegin : NoCaps; +// qDebug() << "closed =" << closed << capString(caps); + + points += 2; + ++type; + + while (type < e) { + QPointF p2 = QPointF(points[0], points[1]) * state->matrix; + switch (*type) { + case QPainterPath::MoveToElement: + Q_ASSERT(!"Logic error"); + break; + + case QPainterPath::LineToElement: + if (!closed && drawCaps && type == e - 1) + caps |= CapEnd; + stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); + p = p2; + points += 2; + ++type; + break; + + case QPainterPath::CurveToElement: { + if (!closed && drawCaps && type == e - 3) + caps |= CapEnd; + QPointF p3 = QPointF(points[2], points[3]) * state->matrix; + QPointF p4 = QPointF(points[4], points[5]) * state->matrix; + renderCubic(p, p2, p3, p4, caps); + p = p4; + type += 3; + points += 6; + break; + } + case QPainterPath::CurveToDataElement: + Q_ASSERT(!"QPainterPath::toSubpathPolygons(), bad element type"); + break; + } + caps = NoCaps; + } + } + } else { // !type, simple polygon + QPointF p = QPointF(points[0], points[1]) * state->matrix; + QPointF movedTo = p; + patternOffset = state->lastPen.dashOffset()*64; + lastPixel.x = -1; + + const qreal *end = points + 2*path.elementCount(); + // handle closed path case + bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]); + int caps = (!closed & drawCaps) ? CapBegin : NoCaps; + if (closed) + calculateLastPoint(end[-2], end[-1], points[0], points[1]); + + points += 2; + while (points < end) { + QPointF p2 = QPointF(points[0], points[1]) * state->matrix; + + if (!closed && drawCaps && points == end - 2) + caps |= CapEnd; + + stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); + + p = p2; + points += 2; + caps = NoCaps; + } + if (path.hasImplicitClose()) + stroke(this, p.x(), p.y(), movedTo.x(), movedTo.y(), NoCaps); + } + + + blend(current_span, spans, &state->penData); + current_span = 0; +} + +void QCosmeticStroker::renderCubic(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, int caps) +{ +// qDebug() << ">>>> renderCubic" << p1 << p2 << p3 << p4 << capString(caps); + const int maxSubDivisions = 6; + PointF points[3*maxSubDivisions + 4]; + + points[3].x = p1.x(); + points[3].y = p1.y(); + points[2].x = p2.x(); + points[2].y = p2.y(); + points[1].x = p3.x(); + points[1].y = p3.y(); + points[0].x = p4.x(); + points[0].y = p4.y(); + + PointF *p = points; + int level = maxSubDivisions; + + renderCubicSubdivision(p, level, caps); +} + +static void splitCubic(QCosmeticStroker::PointF *points) +{ + const qreal half = .5; + qreal a, b, c, d; + + points[6].x = points[3].x; + c = points[1].x; + d = points[2].x; + points[1].x = a = ( points[0].x + c ) * half; + points[5].x = b = ( points[3].x + d ) * half; + c = ( c + d ) * half; + points[2].x = a = ( a + c ) * half; + points[4].x = b = ( b + c ) * half; + points[3].x = ( a + b ) * half; + + points[6].y = points[3].y; + c = points[1].y; + d = points[2].y; + points[1].y = a = ( points[0].y + c ) * half; + points[5].y = b = ( points[3].y + d ) * half; + c = ( c + d ) * half; + points[2].y = a = ( a + c ) * half; + points[4].y = b = ( b + c ) * half; + points[3].y = ( a + b ) * half; +} + +void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points, int level, int caps) +{ + if (level) { + qreal dx = points[3].x - points[0].x; + qreal dy = points[3].y - points[0].y; + qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy)); + + if (qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) > len || + qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) > len) { + splitCubic(points); + + --level; + renderCubicSubdivision(points + 3, level, caps & CapBegin); + renderCubicSubdivision(points, level, caps & CapEnd); + return; + } + } + + stroke(this, points[3].x, points[3].y, points[0].x, points[0].y, caps); +} + +static inline int swapCaps(int caps) +{ + return ((caps & QCosmeticStroker::CapBegin) << 1) | + ((caps & QCosmeticStroker::CapEnd) >> 1); +} + +// adjust line by half a pixel +static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc) +{ + if (caps & QCosmeticStroker::CapBegin) { + x1 -= 32; + y -= yinc >> 1; + } + if (caps & QCosmeticStroker::CapEnd) { + x2 += 32; + } +} + +/* + The hard part about this is dropout control and avoiding douple drawing of points when + the drawing shifts from horizontal to vertical or back. + */ +template +static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) +{ + if (stroker->clipLine(rx1, ry1, rx2, ry2)) + return; + + static const int half = 32; + int x1 = toF26Dot6(rx1) + half; + int y1 = toF26Dot6(ry1) + half; + int x2 = toF26Dot6(rx2) + half; + int y2 = toF26Dot6(ry2) + half; + + int dx = qAbs(x2 - x1); + int dy = qAbs(y2 - y1); + + QCosmeticStroker::Point last = stroker->lastPixel; + +// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64. << capString(caps); + + if (dx < dy) { + // vertical + + bool swapped = false; + if (y1 > y2) { + swapped = true; + qSwap(y1, y2); + qSwap(x1, x2); + caps = swapCaps(caps); + --x1; --x2; --y1; --y2; + } + int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); + int x = x1 << 10; + + capAdjust(caps, y1, y2, x, xinc); + + int y = (y1+32) >> 6; + int ys = (y2+32) >> 6; + + if (y != ys) { + x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; + + // calculate first and last pixel and perform dropout control + QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom; + QCosmeticStroker::Point first; + first.x = x >> 16; + first.y = y; + last.x = (x + (ys - y - 1)*xinc) >> 16; + last.y = ys - 1; + if (swapped) { + qSwap(first, last); + dir = QCosmeticStroker::BottomToTop; + } + bool axisAligned = qAbs(xinc) < (1 << 14); + if (stroker->lastPixel.x >= 0) { + if (first.x == stroker->lastPixel.x && + first.y == stroker->lastPixel.y) { + // remove duplicated pixel + if (swapped) { + --ys; + } else { + ++y; + x += xinc; + } + } else if (stroker->lastDir != dir && + (((axisAligned && stroker->lastAxisAligned) && + stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) || + (qAbs(stroker->lastPixel.x - first.x) > 1 && + qAbs(stroker->lastPixel.y - first.y) > 1))) { + // have a missing pixel, insert it + if (swapped) { + ++ys; + } else { + --y; + x -= xinc; + } + } + } + stroker->lastDir = dir; + stroker->lastAxisAligned = axisAligned; + + Dasher dasher(stroker, swapped, y << 6, ys << 6); + + do { + if (dasher.on()) + drawPixel(stroker, x >> 16, y, 255); + dasher.adjust(); + x += xinc; + } while (++y < ys); + } + } else { + // horizontal + if (!dx) + return; + + bool swapped = false; + if (x1 > x2) { + swapped = true; + qSwap(x1, x2); + qSwap(y1, y2); + caps = swapCaps(caps); + --x1; --x2; --y1; --y2; + } + int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); + int y = y1 << 10; + + capAdjust(caps, x1, x2, y, yinc); + + int x = (x1+32) >> 6; + int xs = (x2+32) >> 6; + + + if (x != xs) { + y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; + + // calculate first and last pixel to perform dropout control + QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight; + QCosmeticStroker::Point first; + first.x = x; + first.y = y >> 16; + last.x = xs - 1; + last.y = (y + (xs - x - 1)*yinc) >> 16; + if (swapped) { + qSwap(first, last); + dir = QCosmeticStroker::RightToLeft; + } + bool axisAligned = qAbs(yinc) < (1 << 14); + if (stroker->lastPixel.x >= 0) { + if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) { + // remove duplicated pixel + if (swapped) { + --xs; + } else { + ++x; + y += yinc; + } + } else if (stroker->lastDir != dir && + (((axisAligned && stroker->lastAxisAligned) && + stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) || + (qAbs(stroker->lastPixel.x - first.x) > 1 && + qAbs(stroker->lastPixel.y - first.y) > 1))) { + // have a missing pixel, insert it + if (swapped) { + ++xs; + } else { + --x; + y -= yinc; + } + } + } + stroker->lastDir = dir; + stroker->lastAxisAligned = axisAligned; + + Dasher dasher(stroker, swapped, x << 6, xs << 6); + + do { + if (dasher.on()) + drawPixel(stroker, x, y >> 16, 255); + dasher.adjust(); + y += yinc; + } while (++x < xs); + } + } + stroker->lastPixel = last; +} + + +template +static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) +{ + if (stroker->clipLine(rx1, ry1, rx2, ry2)) + return; + + int x1 = toF26Dot6(rx1); + int y1 = toF26Dot6(ry1); + int x2 = toF26Dot6(rx2); + int y2 = toF26Dot6(ry2); + + int dx = x2 - x1; + int dy = y2 - y1; + + if (qAbs(dx) < qAbs(dy)) { + // vertical + + int xinc = F16Dot16FixedDiv(dx, dy); + + bool swapped = false; + if (y1 > y2) { + qSwap(y1, y2); + qSwap(x1, x2); + swapped = true; + caps = swapCaps(caps); + } + + int x = (x1 - 32) << 10; + x -= ( ((y1 & 63) - 32) * xinc ) >> 6; + + capAdjust(caps, y1, y2, x, xinc); + + Dasher dasher(stroker, swapped, y1, y2); + + int y = y1 >> 6; + int ys = y2 >> 6; + + int alphaStart, alphaEnd; + if (y == ys) { + alphaStart = y2 - y1; + Q_ASSERT(alphaStart >= 0 && alphaStart < 64); + alphaEnd = 0; + } else { + alphaStart = 64 - (y1 & 63); + alphaEnd = (y2 & 63); + } +// qDebug() << "vertical" << x1/64. << y1/64. << x2/64. << y2/64.; +// qDebug() << " x=" << x << "dx=" << dx << "xi=" << (x>>16) << "xsi=" << ((x+(ys-y)*dx)>>16) << "y=" << y << "ys=" << ys; + + // draw first pixel + if (dasher.on()) { + uint alpha = (quint8)(x >> 8); + drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6); + drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6); + } + dasher.adjust(); + x += xinc; + ++y; + if (y < ys) { + do { + if (dasher.on()) { + uint alpha = (quint8)(x >> 8); + drawPixel(stroker, x>>16, y, (255-alpha)); + drawPixel(stroker, (x>>16) + 1, y, alpha); + } + dasher.adjust(); + x += xinc; + } while (++y < ys); + } + // draw last pixel + if (alphaEnd && dasher.on()) { + uint alpha = (quint8)(x >> 8); + drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6); + drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6); + } + } else { + // horizontal + if (!dx) + return; + + int yinc = F16Dot16FixedDiv(dy, dx); + + bool swapped = false; + if (x1 > x2) { + qSwap(x1, x2); + qSwap(y1, y2); + swapped = true; + caps = swapCaps(caps); + } + + int y = (y1 - 32) << 10; + y -= ( ((x1 & 63) - 32) * yinc ) >> 6; + + capAdjust(caps, x1, x2, y, yinc); + + Dasher dasher(stroker, swapped, x1, x2); + + int x = x1 >> 6; + int xs = x2 >> 6; + +// qDebug() << "horizontal" << x1/64. << y1/64. << x2/64. << y2/64.; +// qDebug() << " y=" << y << "dy=" << dy << "x=" << x << "xs=" << xs << "yi=" << (y>>16) << "ysi=" << ((y+(xs-x)*dy)>>16); + int alphaStart, alphaEnd; + if (x == xs) { + alphaStart = x2 - x1; + Q_ASSERT(alphaStart >= 0 && alphaStart < 64); + alphaEnd = 0; + } else { + alphaStart = 64 - (x1 & 63); + alphaEnd = (x2 & 63); + } + + // draw first pixel + if (dasher.on()) { + uint alpha = (quint8)(y >> 8); + drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6); + drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6); + } + dasher.adjust(); + y += yinc; + ++x; + // draw line + if (x < xs) { + do { + if (dasher.on()) { + uint alpha = (quint8)(y >> 8); + drawPixel(stroker, x, y>>16, (255-alpha)); + drawPixel(stroker, x, (y>>16) + 1, alpha); + } + dasher.adjust(); + y += yinc; + } while (++x < xs); + } + // draw last pixel + if (alphaEnd && dasher.on()) { + uint alpha = (quint8)(y >> 8); + drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6); + drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6); + } + } +} diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h new file mode 100644 index 0000000..bc6dd76 --- /dev/null +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -0,0 +1,101 @@ +#ifndef QCOSMETICSTROKER_P_H +#define QCOSMETICSTROKER_P_H + +#include +#include +#include +#include + +class QCosmeticStroker; + + +typedef void (*StrokeLine)(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); + +class QCosmeticStroker +{ +public: + struct Point { + int x; + int y; + }; + struct PointF { + qreal x; + qreal y; + }; + + enum Caps { + NoCaps = 0, + CapBegin = 0x1, + CapEnd = 0x2, + }; + + // used to avoid drop outs or duplicated points + enum Direction { + TopToBottom, + BottomToTop, + LeftToRight, + RightToLeft + }; + + QCosmeticStroker(QRasterPaintEngineState *s, const QRect &dr) + : state(s), + clip(dr), + pattern(0), + reversePattern(0), + patternSize(0), + patternLength(0), + patternOffset(0), + current_span(0), + lastDir(LeftToRight), + lastAxisAligned(false) + { setup(); } + ~QCosmeticStroker() { free(pattern); free(reversePattern); } + void drawLine(const QPointF &p1, const QPointF &p2); + void drawPath(const QVectorPath &path); + void drawPoints(const QPoint *points, int num); + void drawPoints(const QPointF *points, int num); + + + QRasterPaintEngineState *state; + QRect clip; + // clip bounds in real + qreal xmin, xmax; + qreal ymin, ymax; + + StrokeLine stroke; + bool drawCaps; + + int *pattern; + int *reversePattern; + int patternSize; + int patternLength; + int patternOffset; + + enum { NSPANS = 255 }; + QT_FT_Span spans[NSPANS]; + int current_span; + ProcessSpans blend; + + int opacity; + + uint color; + uint *pixels; + int ppl; + + Direction lastDir; + Point lastPixel; + bool lastAxisAligned; + +private: + void setup(); + + void renderCubic(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, int caps); + void renderCubicSubdivision(PointF *points, int level, int caps); + // used for closed subpaths + void calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal ry2); + +public: + bool clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2); +}; + +#endif // QCOSMETICLINE_H diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 2119e30..f0bc0d6 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -69,6 +69,7 @@ // #include #include #include +#include #include "qmemrotate_p.h" #include "qpaintengine_raster_p.h" @@ -156,20 +157,6 @@ enum LineDrawMode { LineDrawIncludeLastPixel }; -static void drawLine_midpoint_i(int x1, int y1, int x2, int y2, ProcessSpans span_func, QSpanData *data, - LineDrawMode style, const QIntRect &rect); -static void drawLine_midpoint_dashed_i(int x1, int y1, int x2, int y2, - QPen *pen, ProcessSpans span_func, QSpanData *data, - LineDrawMode style, const QIntRect &devRect, - int *patternOffset); -// static void drawLine_midpoint_f(qreal x1, qreal y1, qreal x2, qreal y2, -// ProcessSpans span_func, QSpanData *data, -// LineDrawMode style, const QRect &devRect); - -static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, - ProcessSpans pen_func, ProcessSpans brush_func, - QSpanData *pen_data, QSpanData *brush_data); - struct QRasterFloatPoint { qreal x; qreal y; @@ -789,14 +776,12 @@ void QRasterPaintEngine::updatePen(const QPen &pen) s->stroker = 0; } + ensureState(); // needed because of tx_noshear... s->flags.fast_pen = pen_style > Qt::NoPen - && s->penData.blend - && !s->flags.antialiased - && (penWidth == 0 || (penWidth <= 1 - && (s->matrix.type() <= QTransform::TxTranslate - || pen.isCosmetic()))); + && s->penData.blend + && ((pen.isCosmetic() && penWidth <= 1) + || (s->flags.tx_noshear && penWidth * s->txscale <= 1)); - ensureState(); // needed because of tx_noshear... s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap && s->flags.tx_noshear; s->strokeFlags = 0; @@ -1513,6 +1498,7 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount) qDebug(" - QRasterPaintEngine::drawRect(), rectCount=%d", rectCount); #endif Q_D(QRasterPaintEngine); + ensureState(); QRasterPaintEngineState *s = state(); // Fill @@ -1541,32 +1527,14 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount) ensurePen(); if (s->penData.blend) { - if (s->flags.fast_pen && s->lastPen.brush().isOpaque()) { - const QRect *r = rects; - const QRect *lastRect = rects + rectCount; - while (r < lastRect) { - int left = r->x(); - int right = r->x() + r->width(); - int top = r->y(); - int bottom = r->y() + r->height(); - -#ifdef Q_WS_MAC - int pts[] = { top, left, - top, right, - bottom, right, - bottom, left }; -#else - int pts[] = { left, top, - right, top, - right, bottom, - left, bottom }; -#endif - - strokePolygonCosmetic((QPoint *) pts, 4, WindingMode); - ++r; + QRectVectorPath path; + if (s->flags.fast_pen) { + QCosmeticStroker stroker(s, d->deviceRect); + for (int i = 0; i < rectCount; ++i) { + path.set(rects[i]); + stroker.drawPath(path); } } else { - QRectVectorPath path; for (int i = 0; i < rectCount; ++i) { path.set(rects[i]); stroke(path, s->pen); @@ -1581,13 +1549,13 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount) void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount) { #ifdef QT_DEBUG_DRAW - qDebug(" - QRasterPaintEngine::drawRect(), rectCount=%d", rectCount); + qDebug(" - QRasterPaintEngine::drawRect(QRectF*), rectCount=%d", rectCount); #endif #ifdef QT_FAST_SPANS Q_D(QRasterPaintEngine); + ensureState(); QRasterPaintEngineState *s = state(); - ensureState(); if (s->flags.tx_noshear) { ensureBrush(); @@ -1605,59 +1573,17 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount) ensurePen(); if (s->penData.blend) { - qreal width = s->pen.isCosmetic() - ? (s->lastPen.widthF() == 0 ? 1 : s->lastPen.widthF()) - : s->lastPen.widthF() * s->txscale; - - if (s->flags.fast_pen && s->lastPen.brush().isOpaque()) { - for (int i = 0; i < rectCount; ++i) { - const QRectF &r = rects[i]; - qreal left = r.x(); - qreal right = r.x() + r.width(); - qreal top = r.y(); - qreal bottom = r.y() + r.height(); - qreal pts[] = { left, top, - right, top, - right, bottom, - left, bottom }; - strokePolygonCosmetic((QPointF *) pts, 4, WindingMode); - } - } else if (width <= 1 && qpen_style(s->lastPen) == Qt::SolidLine) { - d->initializeRasterizer(&s->penData); - + QRectVectorPath path; + if (s->flags.fast_pen) { + QCosmeticStroker stroker(s, d->deviceRect); for (int i = 0; i < rectCount; ++i) { - const QRectF &rect = rects[i].normalized(); - if (rect.isEmpty()) { - qreal pts[] = { rect.left(), rect.top(), rect.right(), rect.bottom() }; - QVectorPath vp(pts, 2, 0, QVectorPath::LinesHint); - QPaintEngineEx::stroke(vp, s->lastPen); - } else { - const QPointF tl = s->matrix.map(rect.topLeft()); - const QPointF tr = s->matrix.map(rect.topRight()); - const QPointF bl = s->matrix.map(rect.bottomLeft()); - const QPointF br = s->matrix.map(rect.bottomRight()); - const qreal w = width / (rect.width() * s->txscale); - const qreal h = width / (rect.height() * s->txscale); - d->rasterizer->rasterizeLine(tl, tr, w); // top - d->rasterizer->rasterizeLine(bl, br, w); // bottom - d->rasterizer->rasterizeLine(bl, tl, h); // left - d->rasterizer->rasterizeLine(br, tr, h); // right - } + path.set(rects[i]); + stroker.drawPath(path); } } else { for (int i = 0; i < rectCount; ++i) { - const QRectF &r = rects[i]; - qreal left = r.x(); - qreal right = r.x() + r.width(); - qreal top = r.y(); - qreal bottom = r.y() + r.height(); - qreal pts[] = { left, top, - right, top, - right, bottom, - left, bottom, - left, top }; - QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); - QPaintEngineEx::stroke(vp, s->lastPen); + path.set(rects[i]); + QPaintEngineEx::stroke(path, s->lastPen); } } } @@ -1674,36 +1600,16 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount) */ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) { + Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); + ensurePen(pen); if (!s->penData.blend) return; - if (s->flags.fast_pen && !path.isCurved() - && s->lastPen.brush().isOpaque()) { - int count = path.elementCount(); - QPointF *points = (QPointF *) path.points(); - const QPainterPath::ElementType *types = path.elements(); - if (types) { - int first = 0; - int last; - while (first < count) { - while (first < count && types[first] != QPainterPath::MoveToElement) ++first; - last = first + 1; - while (last < count && types[last] == QPainterPath::LineToElement) ++last; - strokePolygonCosmetic(points + first, last - first, - path.hasImplicitClose() && last == count // only close last one.. - ? WindingMode - : PolylineMode); - first = last; - } - } else { - strokePolygonCosmetic(points, count, - path.hasImplicitClose() - ? WindingMode - : PolylineMode); - } - + if (s->flags.fast_pen) { + QCosmeticStroker stroker(s, d->deviceRect); + stroker.drawPath(path); } else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) { qreal width = s->lastPen.isCosmetic() ? (qpen_widthf(s->lastPen) == 0 ? 1 : qpen_widthf(s->lastPen)) @@ -1818,26 +1724,6 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) } } - if (path.shape() == QVectorPath::EllipseHint) { - if (!s->flags.antialiased && s->matrix.type() <= QTransform::TxScale) { - const qreal *p = path.points(); - QPointF tl = QPointF(p[0], p[1]) * s->matrix; - QPointF br = QPointF(p[4], p[5]) * s->matrix; - QRectF r = s->matrix.mapRect(QRectF(tl, br)); - - ProcessSpans penBlend = d->getPenFunc(r, &s->penData); - ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData); - const QRect brect = QRect(int(r.x()), int(r.y()), - int_dim(r.x(), r.width()), - int_dim(r.y(), r.height())); - if (brect == r) { - drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend, - &s->penData, &s->brushData); - return; - } - } - } - // ### Optimize for non transformed ellipses and rectangles... QRectF cpRect = path.controlPointRect(); const QRect deviceRect = s->matrix.mapRect(cpRect).toRect(); @@ -2032,6 +1918,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly */ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) { + Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); #ifdef QT_DEBUG_DRAW @@ -2048,9 +1935,9 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly } ensurePen(); - ensureBrush(); if (mode != PolylineMode) { // Do the fill... + ensureBrush(); if (s->brushData.blend) { fillPolygon(points, pointCount, mode); } @@ -2058,10 +1945,11 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly // Do the outline... if (s->penData.blend) { - if (s->flags.fast_pen && s->lastPen.brush().isOpaque()) - strokePolygonCosmetic(points, pointCount, mode); - else { - QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + if (s->flags.fast_pen) { + QCosmeticStroker stroker(s, d->deviceRect); + stroker.drawPath(vp); + } else { QPaintEngineEx::stroke(vp, s->lastPen); } } @@ -2090,13 +1978,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg return; } - ensureState(); ensurePen(); - if (!(s->flags.int_xform && s->flags.fast_pen && (!s->penData.blend || s->pen.brush().isOpaque()))) { - // this calls the float version - QPaintEngineEx::drawPolygon(points, pointCount, mode); - return; - } // Do the fill if (mode != PolylineMode) { @@ -2122,230 +2004,24 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg // Do the outline... if (s->penData.blend) { - if (s->flags.fast_pen && s->lastPen.brush().isOpaque()) - strokePolygonCosmetic(points, pointCount, mode); - else { - int count = pointCount * 2; - QVarLengthArray fpoints(count); -#ifdef Q_WS_MAC - for (int i=0; ilastPen); - } - } -} - -/*! - \internal -*/ -void QRasterPaintEngine::strokePolygonCosmetic(const QPointF *points, int pointCount, PolygonDrawMode mode) -{ - Q_D(QRasterPaintEngine); - QRasterPaintEngineState *s = state(); - - Q_ASSERT(s->penData.blend); - Q_ASSERT(s->flags.fast_pen); - - bool needs_closing = mode != PolylineMode && points[0] != points[pointCount-1]; - - // Use fast path for 0 width / trivial pens. - QIntRect devRect; - devRect.set(d->deviceRect); - - LineDrawMode mode_for_last = (s->lastPen.capStyle() != Qt::FlatCap - ? LineDrawIncludeLastPixel - : LineDrawNormal); - int dashOffset = int(s->lastPen.dashOffset()); - - // Draw all the line segments. - for (int i=1; imatrix; - QPointF lp2 = points[i] * s->matrix; - - const QRectF brect(lp1, lp2); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) { - drawLine_midpoint_i(qFloor(lp1.x()), qFloor(lp1.y()), - qFloor(lp2.x()), qFloor(lp2.y()), - penBlend, &s->penData, - i == pointCount - 1 ? mode_for_last : LineDrawIncludeLastPixel, - devRect); - } else { - drawLine_midpoint_dashed_i(qFloor(lp1.x()), qFloor(lp1.y()), - qFloor(lp2.x()), qFloor(lp2.y()), - &s->lastPen, - penBlend, &s->penData, - i == pointCount - 1 ? mode_for_last : LineDrawIncludeLastPixel, - devRect, &dashOffset); + int count = pointCount * 2; + QVarLengthArray fpoints(count); + #ifdef Q_WS_MAC + for (int i=0; imatrix; - QPointF lp2 = points[0] * s->matrix; - - const QRectF brect(lp1, lp2); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) { - drawLine_midpoint_i(qFloor(lp1.x()), qFloor(lp1.y()), - qFloor(lp2.x()), qFloor(lp2.y()), - penBlend, &s->penData, - LineDrawIncludeLastPixel, - devRect); + #else + for (int i=0; iflags.fast_pen) { + QCosmeticStroker stroker(s, d->deviceRect); + stroker.drawPath(vp); } else { - drawLine_midpoint_dashed_i(qFloor(lp1.x()), qFloor(lp1.y()), - qFloor(lp2.x()), qFloor(lp2.y()), - &s->lastPen, - penBlend, &s->penData, - LineDrawIncludeLastPixel, - devRect, &dashOffset); - } - } - -} - -/*! - \internal -*/ -void QRasterPaintEngine::strokePolygonCosmetic(const QPoint *points, int pointCount, PolygonDrawMode mode) -{ - Q_D(QRasterPaintEngine); - QRasterPaintEngineState *s = state(); - - // We assert here because this function is called from drawRects - // and drawPolygon and they already do ensurePen(), so we skip that - // here to avoid duplicate checks.. - Q_ASSERT(s->penData.blend); - - bool needs_closing = mode != PolylineMode && points[0] != points[pointCount-1]; - - QIntRect devRect; - devRect.set(d->deviceRect); - - LineDrawMode mode_for_last = (s->lastPen.capStyle() != Qt::FlatCap - ? LineDrawIncludeLastPixel - : LineDrawNormal); - - int m11 = int(s->matrix.m11()); - int m22 = int(s->matrix.m22()); - int dx = int(s->matrix.dx()); - int dy = int(s->matrix.dy()); - int m13 = int(s->matrix.m13()); - int m23 = int(s->matrix.m23()); - bool affine = !m13 && !m23; - - int dashOffset = int(s->lastPen.dashOffset()); - - if (affine) { - // Draw all the line segments. - for (int i=1; imatrix; - const QPoint lp2 = points[i] * s->matrix; - const QRect brect(lp1, lp2); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(lp1.x(), lp1.y(), - lp2.x(), lp2.y(), - penBlend, &s->penData, - i == pointCount - 1 ? mode_for_last : LineDrawIncludeLastPixel, - devRect); - else - drawLine_midpoint_dashed_i(lp1.x(), lp1.y(), - lp2.x(), lp2.y(), - &s->lastPen, - penBlend, &s->penData, - i == pointCount - 1 ? mode_for_last : LineDrawIncludeLastPixel, - devRect, &dashOffset); - - } - - // Polygons are implicitly closed. - if (needs_closing) { - const QPoint lp1 = points[pointCount - 1] * s->matrix; - const QPoint lp2 = points[0] * s->matrix; - const QRect brect(lp1, lp2); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(lp1.x(), lp1.y(), - lp2.x(), lp2.y(), - penBlend, &s->penData, LineDrawIncludeLastPixel, - devRect); - else - drawLine_midpoint_dashed_i(lp1.x(), lp1.y(), - lp2.x(), lp2.y(), - &s->lastPen, - penBlend, &s->penData, LineDrawIncludeLastPixel, - devRect, &dashOffset); - } - } else { - // Draw all the line segments. - for (int i=1; igetPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(x1, y1, x2, y2, - penBlend, &s->penData, - i == pointCount - 1 ? mode_for_last : LineDrawIncludeLastPixel, - devRect); - else - drawLine_midpoint_dashed_i(x1, y1, x2, y2, - &s->lastPen, - penBlend, &s->penData, - i == pointCount - 1 ? mode_for_last : LineDrawIncludeLastPixel, - devRect, &dashOffset); - - } - - int x1 = points[pointCount-1].x() * m11 + dx; - int y1 = points[pointCount-1].y() * m22 + dy; - qreal w = m13*points[pointCount-1].x() + m23*points[pointCount-1].y() + 1.; - w = 1/w; - x1 = int(x1*w); - y1 = int(y1*w); - int x2 = points[0].x() * m11 + dx; - int y2 = points[0].y() * m22 + dy; - w = m13*points[0].x() + m23*points[0].y() + 1.; - w = 1/w; - x2 = int(x2 * w); - y2 = int(y2 * w); - // Polygons are implicitly closed. - - if (needs_closing) { - const QRect brect(x1, y1, x2 - x1 + 1, y2 - y1 + 1); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(x1, y1, x2, y2, - penBlend, &s->penData, LineDrawIncludeLastPixel, - devRect); - else - drawLine_midpoint_dashed_i(x1, y1, x2, y2, - &s->lastPen, - penBlend, &s->penData, LineDrawIncludeLastPixel, - devRect, &dashOffset); + QPaintEngineEx::stroke(vp, s->lastPen); } } } @@ -3345,32 +3021,6 @@ QRasterPaintEnginePrivate::getBrushFunc(const QRectF &rect, return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; } -inline ProcessSpans -QRasterPaintEnginePrivate::getPenFunc(const QRect &rect, - const QSpanData *data) const -{ - Q_Q(const QRasterPaintEngine); - const QRasterPaintEngineState *s = q->state(); - - if (!s->flags.fast_pen && s->matrix.type() > QTransform::TxTranslate) - return data->blend; - const int penWidth = s->flags.fast_pen ? 1 : qCeil(s->pen.widthF()); - return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; -} - -inline ProcessSpans -QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect, - const QSpanData *data) const -{ - Q_Q(const QRasterPaintEngine); - const QRasterPaintEngineState *s = q->state(); - - if (!s->flags.fast_pen && s->matrix.type() > QTransform::TxTranslate) - return data->blend; - const int penWidth = s->flags.fast_pen ? 1 : qCeil(s->lastPen.widthF()); - return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; -} - /*! \reimp */ @@ -3544,48 +3194,16 @@ void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount) QRasterPaintEngineState *s = state(); ensurePen(); - qreal pw = s->lastPen.widthF(); - if (!s->flags.fast_pen && (s->matrix.type() > QTransform::TxTranslate || pw > 1)) { - QPaintEngineEx::drawPoints(points, pointCount); - - } else { - if (!s->penData.blend) - return; - - QVarLengthArray array(pointCount); - QT_FT_Span span = { 0, 1, 0, 255 }; - const QPointF *end = points + pointCount; - qreal trans_x, trans_y; - int x, y; - int left = d->deviceRect.x(); - int right = left + d->deviceRect.width(); - int top = d->deviceRect.y(); - int bottom = top + d->deviceRect.height(); - int count = 0; - while (points < end) { - s->matrix.map(points->x(), points->y(), &trans_x, &trans_y); - x = qFloor(trans_x); - y = qFloor(trans_y); - if (x >= left && x < right && y >= top && y < bottom) { - if (count > 0) { - const QT_FT_Span &last = array[count - 1]; - // spans must be sorted on y (primary) and x (secondary) - if (y < last.y || (y == last.y && x < last.x)) { - s->penData.blend(count, array.constData(), &s->penData); - count = 0; - } - } - - span.x = x; - span.y = y; - array[count++] = span; - } - ++points; - } + if (!s->penData.blend) + return; - if (count > 0) - s->penData.blend(count, array.constData(), &s->penData); + if (!s->flags.fast_pen) { + QPaintEngineEx::drawPoints(points, pointCount); + return; } + + QCosmeticStroker stroker(s, d->deviceRect); + stroker.drawPoints(points, pointCount); } @@ -3595,48 +3213,16 @@ void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) QRasterPaintEngineState *s = state(); ensurePen(); - double pw = s->lastPen.widthF(); - if (!s->flags.fast_pen && (s->matrix.type() > QTransform::TxTranslate || pw > 1)) { - QPaintEngineEx::drawPoints(points, pointCount); - - } else { - if (!s->penData.blend) - return; - - QVarLengthArray array(pointCount); - QT_FT_Span span = { 0, 1, 0, 255 }; - const QPoint *end = points + pointCount; - qreal trans_x, trans_y; - int x, y; - int left = d->deviceRect.x(); - int right = left + d->deviceRect.width(); - int top = d->deviceRect.y(); - int bottom = top + d->deviceRect.height(); - int count = 0; - while (points < end) { - s->matrix.map(points->x(), points->y(), &trans_x, &trans_y); - x = qFloor(trans_x); - y = qFloor(trans_y); - if (x >= left && x < right && y >= top && y < bottom) { - if (count > 0) { - const QT_FT_Span &last = array[count - 1]; - // spans must be sorted on y (primary) and x (secondary) - if (y < last.y || (y == last.y && x < last.x)) { - s->penData.blend(count, array.constData(), &s->penData); - count = 0; - } - } - - span.x = x; - span.y = y; - array[count++] = span; - } - ++points; - } + if (!s->penData.blend) + return; - if (count > 0) - s->penData.blend(count, array.constData(), &s->penData); + if (!s->flags.fast_pen) { + QPaintEngineEx::drawPoints(points, pointCount); + return; } + + QCosmeticStroker stroker(s, d->deviceRect); + stroker.drawPoints(points, pointCount); } /*! @@ -3645,59 +3231,22 @@ void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount) { #ifdef QT_DEBUG_DRAW - qDebug() << " - QRasterPaintEngine::drawLine()"; + qDebug() << " - QRasterPaintEngine::drawLines(QLine*)" << lineCount; #endif Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); ensurePen(); + if (!s->penData.blend) + return; + if (s->flags.fast_pen) { - QIntRect bounds; bounds.set(d->deviceRect); - LineDrawMode mode = s->lastPen.capStyle() == Qt::FlatCap - ? LineDrawNormal - : LineDrawIncludeLastPixel; - - int m11 = int(s->matrix.m11()); - int m22 = int(s->matrix.m22()); - int dx = qFloor(s->matrix.dx()); - int dy = qFloor(s->matrix.dy()); + QCosmeticStroker stroker(s, d->deviceRect); for (int i=0; ilastPen.dashOffset()); - if (s->flags.int_xform) { - const QLine &l = lines[i]; - int x1 = l.x1() * m11 + dx; - int y1 = l.y1() * m22 + dy; - int x2 = l.x2() * m11 + dx; - int y2 = l.y2() * m22 + dy; - - const QRect brect(QPoint(x1, y1), QPoint(x2, y2)); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(x1, y1, x2, y2, - penBlend, &s->penData, mode, bounds); - else - drawLine_midpoint_dashed_i(x1, y1, x2, y2, - &s->lastPen, penBlend, - &s->penData, mode, bounds, - &dashOffset); - } else { - QLineF line = lines[i] * s->matrix; - const QRectF brect(QPointF(line.x1(), line.y1()), - QPointF(line.x2(), line.y2())); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(int(line.x1()), int(line.y1()), - int(line.x2()), int(line.y2()), - penBlend, &s->penData, mode, bounds); - else - drawLine_midpoint_dashed_i(int(line.x1()), int(line.y1()), - int(line.x2()), int(line.y2()), - &s->lastPen, penBlend, - &s->penData, mode, bounds, - &dashOffset); - } + const QLine &l = lines[i]; + stroker.drawLine(l.p1(), l.p2()); } - } else if (s->penData.blend) { + } else { QPaintEngineEx::drawLines(lines, lineCount); } } @@ -3754,7 +3303,7 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) { #ifdef QT_DEBUG_DRAW - qDebug() << " - QRasterPaintEngine::drawLine()"; + qDebug() << " - QRasterPaintEngine::drawLines(QLineF *)" << lineCount; #endif Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -3763,28 +3312,10 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) if (!s->penData.blend) return; if (s->flags.fast_pen) { - QIntRect bounds; - bounds.set(d->deviceRect); - LineDrawMode mode = s->lastPen.capStyle() == Qt::FlatCap - ? LineDrawNormal - : LineDrawIncludeLastPixel; - + QCosmeticStroker stroker(s, d->deviceRect); for (int i=0; ilastPen.dashOffset()); - QLineF line = lines[i] * s->matrix; - const QRectF brect(QPointF(line.x1(), line.y1()), - QPointF(line.x2(), line.y2())); - ProcessSpans penBlend = d->getPenFunc(brect, &s->penData); - if (qpen_style(s->lastPen) == Qt::SolidLine) - drawLine_midpoint_i(int(line.x1()), int(line.y1()), - int(line.x2()), int(line.y2()), - penBlend, &s->penData, mode, bounds); - else - drawLine_midpoint_dashed_i(int(line.x1()), int(line.y1()), - int(line.x2()), int(line.y2()), - &s->lastPen, - penBlend, &s->penData, mode, - bounds, &dashOffset); + QLineF line = lines[i]; + stroker.drawLine(line.p1(), line.p2()); } } else { QPaintEngineEx::drawLines(lines, lineCount); @@ -3797,29 +3328,6 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) */ void QRasterPaintEngine::drawEllipse(const QRectF &rect) { - Q_D(QRasterPaintEngine); - QRasterPaintEngineState *s = state(); - - ensurePen(); - if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen) - || (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased)) - && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT - && !rect.isEmpty() - && s->matrix.type() <= QTransform::TxScale) // no shear - { - ensureBrush(); - const QRectF r = s->matrix.mapRect(rect); - ProcessSpans penBlend = d->getPenFunc(r, &s->penData); - ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData); - const QRect brect = QRect(int(r.x()), int(r.y()), - int_dim(r.x(), r.width()), - int_dim(r.y(), r.height())); - if (brect == r) { - drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend, - &s->penData, &s->brushData); - return; - } - } QPaintEngineEx::drawEllipse(rect); } @@ -4821,7 +4329,7 @@ static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userDa while (spans < end) { QSpan *clipped = cspans; spans = qt_intersect_spans(fillData->clip, ¤tClip, spans, end, &clipped, NSPANS); -// qDebug() << "processed " << processed << "clipped" << clipped-cspans +// qDebug() << "processed " << spanCount - (end - spans) << "clipped" << clipped-cspans // << "span:" << cspans->x << cspans->y << cspans->len << spans->coverage; if (clipped - cspans) @@ -5473,878 +4981,6 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _ adjustSpanMethods(); } -#ifdef Q_WS_WIN - - -#endif - - -/*! - \internal - - Draws a line using the floating point midpoint algorithm. The line - \a line is already in device coords at this point. -*/ - -static void drawLine_midpoint_i(int x1, int y1, int x2, int y2, ProcessSpans span_func, QSpanData *data, - LineDrawMode style, const QIntRect &devRect) -{ -#ifdef QT_DEBUG_DRAW - qDebug() << " - drawLine_midpoint_i" << QLine(QPoint(x1, y1), QPoint(x2, y2)); -#endif - - int x, y; - int dx, dy, d, incrE, incrNE; - - dx = x2 - x1; - dy = y2 - y1; - - const int NSPANS = 256; - QT_FT_Span spans[NSPANS]; - int current = 0; - bool ordered = true; - - if (dy == 0) { - // specialcase horizontal lines - if (y1 >= devRect.y1 && y1 < devRect.y2) { - int start = qMax(devRect.x1, qMin(x1, x2)); - int stop = qMax(x1, x2) + 1; - int stop_clipped = qMin(devRect.x2, stop); - int len = stop_clipped - start; - if (style == LineDrawNormal && stop == stop_clipped) - len--; - if (len > 0) { - spans[0].x = ushort(start); - spans[0].len = ushort(len); - spans[0].y = y1; - spans[0].coverage = 255; - span_func(1, spans, data); - } - } - return; - } else if (dx == 0) { - // specialcase vertical lines - if (x1 >= devRect.x1 && x1 < devRect.x2) { - int start = qMax(devRect.y1, qMin(y1, y2)); - int stop = qMax(y1, y2) + 1; - int stop_clipped = qMin(devRect.y2, stop); - int len = stop_clipped - start; - if (style == LineDrawNormal && stop == stop_clipped) - len--; - // hw: create spans directly instead to possibly avoid clipping - if (len > 0) - fillRect_normalized(QRect(x1, start, 1, len).normalized(), data, 0); - } - return; - } - - - if (qAbs(dx) >= qAbs(dy)) { /* if x is the major axis: */ - - if (x2 < x1) { /* if coordinates are out of order */ - qt_swap_int(x1, x2); - dx = -dx; - - qt_swap_int(y1, y2); - dy = -dy; - } - - int x_lower_limit = - 128; - if (x1 < x_lower_limit) { - int cy = dy * (x_lower_limit - x1) / dx + y1; - drawLine_midpoint_i(x_lower_limit, cy, x2, y2, span_func, data, style, devRect); - return; - } - - if (style == LineDrawNormal) - --x2; - - // In the loops below we increment before call the span function so - // we need to stop one pixel before - x2 = qMin(x2, devRect.x2 - 1); - - // completely clipped, so abort - if (x2 <= x1) { - return; - } - - int x = x1; - int y = y1; - - if (y2 <= y1) - ordered = false; - - { - const int index = (ordered ? current : NSPANS - 1 - current); - spans[index].coverage = 255; - spans[index].x = x; - spans[index].y = y; - - if (x >= devRect.x1 && y >= devRect.y1 && y < devRect.y2) - spans[index].len = 1; - else - spans[index].len = 0; - } - - if (y2 > y1) { // 315 -> 360 and 135 -> 180 (unit circle degrees) - y2 = qMin(y2, devRect.y2 - 1); - - incrE = dy * 2; - d = incrE - dx; - incrNE = (dy - dx) * 2; - - if (y > y2) - goto flush_and_return; - - while (x < x2) { - ++x; - if (d > 0) { - if (spans[current].len > 0) - ++current; - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - - ++y; - d += incrNE; - if (y > y2) - goto flush_and_return; - - spans[current].len = 0; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - } else { - d += incrE; - if (x == devRect.x1) - spans[current].x = devRect.x1; - } - - if (x < devRect.x1 || y < devRect.y1) - continue; - - Q_ASSERT(x 0) { - ++current; - } - } else { // 0-45 and 180->225 (unit circle degrees) - - y1 = qMin(y1, devRect.y2 - 1); - - incrE = dy * 2; - d = incrE + dx; - incrNE = (dy + dx) * 2; - - if (y < devRect.y1) - goto flush_and_return; - - while (x < x2) { - ++x; - if (d < 0) { - if (spans[NSPANS - 1 - current].len > 0) - ++current; - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - - --y; - d += incrNE; - if (y < devRect.y1) - goto flush_and_return; - - const int index = NSPANS - 1 - current; - spans[index].len = 0; - spans[index].coverage = 255; - spans[index].x = x; - spans[index].y = y; - } else { - d += incrE; - if (x == devRect.x1) - spans[NSPANS - 1 - current].x = devRect.x1; - } - - if (x < devRect.x1 || y > y1) - continue; - - Q_ASSERT(x 0) { - ++current; - } - } - - } else { - - // if y is the major axis: - - if (y2 < y1) { /* if coordinates are out of order */ - qt_swap_int(y1, y2); - dy = -dy; - - qt_swap_int(x1, x2); - dx = -dx; - } - - int y_lower_limit = - 128; - if (y1 < y_lower_limit) { - int cx = dx * (y_lower_limit - y1) / dy + x1; - drawLine_midpoint_i(cx, y_lower_limit, x2, y2, span_func, data, style, devRect); - return; - } - - if (style == LineDrawNormal) - --y2; - - // In the loops below we increment before call the span function so - // we need to stop one pixel before - y2 = qMin(y2, devRect.y2 - 1); - - // completely clipped, so abort - if (y2 <= y1) { - return; - } - - x = x1; - y = y1; - - if (x>=devRect.x1 && y>=devRect.y1 && x < devRect.x2) { - Q_ASSERT(x >= devRect.x1 && y >= devRect.y1 && x < devRect.x2 && y < devRect.y2); - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - - if (x2 > x1) { // 90 -> 135 and 270 -> 315 (unit circle degrees) - x2 = qMin(x2, devRect.x2 - 1); - incrE = dx * 2; - d = incrE - dy; - incrNE = (dx - dy) * 2; - - if (x > x2) - goto flush_and_return; - - while (y < y2) { - if (d > 0) { - ++x; - d += incrNE; - if (x > x2) - goto flush_and_return; - } else { - d += incrE; - } - ++y; - if (x < devRect.x1 || y < devRect.y1) - continue; - Q_ASSERT(x 90 and 225 -> 270 (unit circle degrees) - x1 = qMin(x1, devRect.x2 - 1); - incrE = dx * 2; - d = incrE + dy; - incrNE = (dx + dy) * 2; - - if (x < devRect.x1) - goto flush_and_return; - - while (y < y2) { - if (d < 0) { - --x; - d += incrNE; - if (x < devRect.x1) - goto flush_and_return; - } else { - d += incrE; - } - ++y; - if (y < devRect.y1 || x > x1) - continue; - Q_ASSERT(x>=devRect.x1 && x=devRect.y1 && y 0) - span_func(current, ordered ? spans : spans + (NSPANS - current), data); -} - -static void offset_pattern(int offset, bool *inDash, int *dashIndex, int *currentOffset, const QVarLengthArray &pattern) -{ - while (offset--) { - if (--*currentOffset == 0) { - *inDash = !*inDash; - *dashIndex = ((*dashIndex + 1) % pattern.size()); - *currentOffset = int(pattern[*dashIndex]); - } - } -} - -static void drawLine_midpoint_dashed_i(int x1, int y1, int x2, int y2, - QPen *pen, - ProcessSpans span_func, QSpanData *data, - LineDrawMode style, const QIntRect &devRect, - int *patternOffset) -{ -#ifdef QT_DEBUG_DRAW - qDebug() << " - drawLine_midpoint_dashed_i" << x1 << y1 << x2 << y2 << *patternOffset; -#endif - - int x, y; - int dx, dy, d, incrE, incrNE; - - dx = x2 - x1; - dy = y2 - y1; - - Q_ASSERT(*patternOffset >= 0); - - const QVector penPattern = pen->dashPattern(); - QVarLengthArray pattern(penPattern.size()); - - int patternLength = 0; - for (int i = 0; i < penPattern.size(); ++i) - patternLength += qMax(1.0, (penPattern.at(i))); - - // pattern must be reversed if coordinates are out of order - int reverseLength = -1; - if (dy == 0 && x1 > x2) - reverseLength = x1 - x2; - else if (dx == 0 && y1 > y2) - reverseLength = y1 - y2; - else if (qAbs(dx) >= qAbs(dy) && x2 < x1) // x major axis - reverseLength = qAbs(dx); - else if (qAbs(dy) >= qAbs(dx) && y2 < y1) // y major axis - reverseLength = qAbs(dy); - - const bool reversed = (reverseLength > -1); - if (reversed) { // reverse pattern - for (int i = 0; i < penPattern.size(); ++i) - pattern[penPattern.size() - 1 - i] = qMax(1.0, penPattern.at(i)); - - *patternOffset = (patternLength - 1 - *patternOffset); - *patternOffset += patternLength - (reverseLength % patternLength); - *patternOffset = *patternOffset % patternLength; - } else { - for (int i = 0; i < penPattern.size(); ++i) - pattern[i] = qMax(1.0, penPattern.at(i)); - } - - int dashIndex = 0; - bool inDash = !reversed; - int currPattern = int(pattern[dashIndex]); - - // adjust pattern for offset - offset_pattern(*patternOffset, &inDash, &dashIndex, &currPattern, pattern); - - const int NSPANS = 256; - QT_FT_Span spans[NSPANS]; - int current = 0; - bool ordered = true; - - if (dy == 0) { - // specialcase horizontal lines - if (y1 >= devRect.y1 && y1 < devRect.y2) { - int start_unclipped = qMin(x1, x2); - int start = qMax(devRect.x1, start_unclipped); - int stop = qMax(x1, x2) + 1; - int stop_clipped = qMin(devRect.x2, stop); - int len = stop_clipped - start; - if (style == LineDrawNormal && stop == stop_clipped) - len--; - - // adjust pattern for starting offset - offset_pattern(start - start_unclipped, &inDash, &dashIndex, &currPattern, pattern); - - if (len > 0) { - int x = start; - while (x < stop_clipped) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - const int dash = qMin(currPattern, stop_clipped - x); - if (inDash) { - spans[current].x = ushort(x); - spans[current].len = ushort(dash); - spans[current].y = y1; - spans[current].coverage = 255; - ++current; - } - if (dash < currPattern) { - currPattern -= dash; - } else { - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - inDash = !inDash; - } - x += dash; - } - } - } - goto flush_and_return; - } else if (dx == 0) { - if (x1 >= devRect.x1 && x1 < devRect.x2) { - int start_unclipped = qMin(y1, y2); - int start = qMax(devRect.y1, start_unclipped); - int stop = qMax(y1, y2) + 1; - int stop_clipped = qMin(devRect.y2, stop); - if (style == LineDrawNormal && stop == stop_clipped) - --stop; - else - stop = stop_clipped; - - // adjust pattern for starting offset - offset_pattern(start - start_unclipped, &inDash, &dashIndex, &currPattern, pattern); - - // loop over dashes - int y = start; - while (y < stop) { - const int dash = qMin(currPattern, stop - y); - if (inDash) { - for (int i = 0; i < dash; ++i) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].x = x1; - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].y = ushort(y + i); - ++current; - } - } - if (dash < currPattern) { - currPattern -= dash; - } else { - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - inDash = !inDash; - } - y += dash; - } - } - goto flush_and_return; - } - - if (qAbs(dx) >= qAbs(dy)) { /* if x is the major axis: */ - - if (x2 < x1) { /* if coordinates are out of order */ - qt_swap_int(x1, x2); - dx = -dx; - - qt_swap_int(y1, y2); - dy = -dy; - } - - if (style == LineDrawNormal) - --x2; - - // In the loops below we increment before call the span function so - // we need to stop one pixel before - x2 = qMin(x2, devRect.x2 - 1); - - // completely clipped, so abort - if (x2 <= x1) - goto flush_and_return; - - int x = x1; - int y = y1; - - if (x >= devRect.x1 && y >= devRect.y1 && y < devRect.y2) { - Q_ASSERT(x < devRect.x2); - if (inDash) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - if (--currPattern <= 0) { - inDash = !inDash; - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - } - } - - if (y2 > y1) { // 315 -> 360 and 135 -> 180 (unit circle degrees) - y2 = qMin(y2, devRect.y2 - 1); - - incrE = dy * 2; - d = incrE - dx; - incrNE = (dy - dx) * 2; - - if (y > y2) - goto flush_and_return; - - while (x < x2) { - if (d > 0) { - ++y; - d += incrNE; - if (y > y2) - goto flush_and_return; - } else { - d += incrE; - } - ++x; - - const bool skip = x < devRect.x1 || y < devRect.y1; - Q_ASSERT(skip || (x < devRect.x2 && y < devRect.y2)); - if (inDash && !skip) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - if (--currPattern <= 0) { - inDash = !inDash; - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - } - } - } else { // 0-45 and 180->225 (unit circle degrees) - y1 = qMin(y1, devRect.y2 - 1); - - incrE = dy * 2; - d = incrE + dx; - incrNE = (dy + dx) * 2; - - if (y < devRect.y1) - goto flush_and_return; - - while (x < x2) { - if (d < 0) { - if (current > 0) { - span_func(current, spans, data); - current = 0; - } - - --y; - d += incrNE; - if (y < devRect.y1) - goto flush_and_return; - } else { - d += incrE; - } - ++x; - - const bool skip = x < devRect.x1 || y > y1; - Q_ASSERT(skip || (x < devRect.x2 && y < devRect.y2)); - if (inDash && !skip) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - if (--currPattern <= 0) { - inDash = !inDash; - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - } - } - } - } else { - - // if y is the major axis: - - if (y2 < y1) { /* if coordinates are out of order */ - qt_swap_int(y1, y2); - dy = -dy; - - qt_swap_int(x1, x2); - dx = -dx; - } - - if (style == LineDrawNormal) - --y2; - - // In the loops below we increment before call the span function so - // we need to stop one pixel before - y2 = qMin(y2, devRect.y2 - 1); - - // completely clipped, so abort - if (y2 <= y1) - goto flush_and_return; - - x = x1; - y = y1; - - if (x>=devRect.x1 && y>=devRect.y1 && x < devRect.x2) { - Q_ASSERT(x < devRect.x2); - if (inDash) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - if (--currPattern <= 0) { - inDash = !inDash; - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - } - } - - if (x2 > x1) { // 90 -> 135 and 270 -> 315 (unit circle degrees) - x2 = qMin(x2, devRect.x2 - 1); - incrE = dx * 2; - d = incrE - dy; - incrNE = (dx - dy) * 2; - - if (x > x2) - goto flush_and_return; - - while (y < y2) { - if (d > 0) { - ++x; - d += incrNE; - if (x > x2) - goto flush_and_return; - } else { - d += incrE; - } - ++y; - const bool skip = x < devRect.x1 || y < devRect.y1; - Q_ASSERT(skip || (x < devRect.x2 && y < devRect.y2)); - if (inDash && !skip) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - if (--currPattern <= 0) { - inDash = !inDash; - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - } - } - } else { // 45 -> 90 and 225 -> 270 (unit circle degrees) - x1 = qMin(x1, devRect.x2 - 1); - incrE = dx * 2; - d = incrE + dy; - incrNE = (dx + dy) * 2; - - if (x < devRect.x1) - goto flush_and_return; - - while (y < y2) { - if (d < 0) { - --x; - d += incrNE; - if (x < devRect.x1) - goto flush_and_return; - } else { - d += incrE; - } - ++y; - const bool skip = y < devRect.y1 || x > x1; - Q_ASSERT(skip || (x >= devRect.x1 && x < devRect.x2 && y < devRect.y2)); - if (inDash && !skip) { - if (current == NSPANS) { - span_func(NSPANS, spans, data); - current = 0; - } - spans[current].len = 1; - spans[current].coverage = 255; - spans[current].x = x; - spans[current].y = y; - ++current; - } - if (--currPattern <= 0) { - inDash = !inDash; - dashIndex = (dashIndex + 1) % pattern.size(); - currPattern = int(pattern[dashIndex]); - } - } - } - } -flush_and_return: - if (current > 0) - span_func(current, ordered ? spans : spans + (NSPANS - current), data); - - // adjust offset - if (reversed) { - *patternOffset = (patternLength - 1 - *patternOffset); - } else { - *patternOffset = 0; - for (int i = 0; i <= dashIndex; ++i) - *patternOffset += int(pattern[i]); - *patternOffset += patternLength - currPattern - 1; - *patternOffset = (*patternOffset % patternLength); - } -} - -/*! - \internal - \a x and \a y is relative to the midpoint of \a rect. -*/ -static inline void drawEllipsePoints(int x, int y, int length, - const QRect &rect, - const QRect &clip, - ProcessSpans pen_func, ProcessSpans brush_func, - QSpanData *pen_data, QSpanData *brush_data) -{ - if (length == 0) - return; - - QT_FT_Span outline[4]; - const int midx = rect.x() + (rect.width() + 1) / 2; - const int midy = rect.y() + (rect.height() + 1) / 2; - - x = x + midx; - y = midy - y; - - // topleft - outline[0].x = midx + (midx - x) - (length - 1) - (rect.width() & 0x1); - outline[0].len = qMin(length, x - outline[0].x); - outline[0].y = y; - outline[0].coverage = 255; - - // topright - outline[1].x = x; - outline[1].len = length; - outline[1].y = y; - outline[1].coverage = 255; - - // bottomleft - outline[2].x = outline[0].x; - outline[2].len = outline[0].len; - outline[2].y = midy + (midy - y) - (rect.height() & 0x1); - outline[2].coverage = 255; - - // bottomright - outline[3].x = x; - outline[3].len = length; - outline[3].y = outline[2].y; - outline[3].coverage = 255; - - if (brush_func && outline[0].x + outline[0].len < outline[1].x) { - QT_FT_Span fill[2]; - - // top fill - fill[0].x = outline[0].x + outline[0].len - 1; - fill[0].len = qMax(0, outline[1].x - fill[0].x); - fill[0].y = outline[1].y; - fill[0].coverage = 255; - - // bottom fill - fill[1].x = outline[2].x + outline[2].len - 1; - fill[1].len = qMax(0, outline[3].x - fill[1].x); - fill[1].y = outline[3].y; - fill[1].coverage = 255; - - int n = (fill[0].y >= fill[1].y ? 1 : 2); - n = qt_intersect_spans(fill, n, clip); - if (n > 0) - brush_func(n, fill, brush_data); - } - if (pen_func) { - int n = (outline[1].y >= outline[2].y ? 2 : 4); - n = qt_intersect_spans(outline, n, clip); - if (n > 0) - pen_func(n, outline, pen_data); - } -} - -/*! - \internal - Draws an ellipse using the integer point midpoint algorithm. -*/ -static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, - ProcessSpans pen_func, ProcessSpans brush_func, - QSpanData *pen_data, QSpanData *brush_data) -{ - const qreal a = qreal(rect.width()) / 2; - const qreal b = qreal(rect.height()) / 2; - qreal d = b*b - (a*a*b) + 0.25*a*a; - - int x = 0; - int y = (rect.height() + 1) / 2; - int startx = x; - - // region 1 - while (a*a*(2*y - 1) > 2*b*b*(x + 1)) { - if (d < 0) { // select E - d += b*b*(2*x + 3); - ++x; - } else { // select SE - d += b*b*(2*x + 3) + a*a*(-2*y + 2); - drawEllipsePoints(startx, y, x - startx + 1, rect, clip, - pen_func, brush_func, pen_data, brush_data); - startx = ++x; - --y; - } - } - drawEllipsePoints(startx, y, x - startx + 1, rect, clip, - pen_func, brush_func, pen_data, brush_data); - - // region 2 - d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); - const int miny = rect.height() & 0x1; - while (y > miny) { - if (d < 0) { // select SE - d += b*b*(2*x + 2) + a*a*(-2*y + 3); - ++x; - } else { // select S - d += a*a*(-2*y + 3); - } - --y; - drawEllipsePoints(x, y, 1, rect, clip, - pen_func, brush_func, pen_data, brush_data); - } -} /*! \fn void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 52f51fa..122c2b8 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -196,9 +196,6 @@ public: void stroke(const QVectorPath &path, const QPen &pen); void fill(const QVectorPath &path, const QBrush &brush); - void strokePolygonCosmetic(const QPoint *pts, int pointCount, PolygonDrawMode mode); - void strokePolygonCosmetic(const QPointF *pt, int pointCount, PolygonDrawMode mode); - void clip(const QVectorPath &path, Qt::ClipOperation op); void clip(const QRect &rect, Qt::ClipOperation op); void clip(const QRegion ®ion, Qt::ClipOperation op); @@ -328,8 +325,6 @@ public: bool isUnclipped_normalized(const QRect &rect) const; bool isUnclipped(const QRect &rect, int penWidth) const; bool isUnclipped(const QRectF &rect, int penWidth) const; - ProcessSpans getPenFunc(const QRect &rect, const QSpanData *data) const; - ProcessSpans getPenFunc(const QRectF &rect, const QSpanData *data) const; ProcessSpans getBrushFunc(const QRect &rect, const QSpanData *data) const; ProcessSpans getBrushFunc(const QRectF &rect, const QSpanData *data) const; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 7f601eb..bbdf76f 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -831,7 +831,7 @@ void QPaintEngineEx::drawEllipse(const QRectF &r) int point_count = 0; x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count); - QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); + QVectorPath vp((qreal *) pts, point_count + 1, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); draw(vp); } -- cgit v0.12 From 15a5eaf0eeb44833a052b6201171fca4b9e8f74e Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Thu, 12 May 2011 14:10:56 +0200 Subject: Clear confusion between QMainWindow and QMainWindowLayout. The variables activateUnifiedToolbarAfterFullScreen and useHIToolBar were implemented in both classes. This was an obvious bug, where variable would be initialized in one class and use in the other one. Task-number: QTBUG-18874 Reviewed-by: Yoann Lopes --- src/gui/widgets/qmainwindow.cpp | 2 -- src/gui/widgets/qmainwindowlayout.cpp | 1 + src/gui/widgets/qmainwindowlayout_p.h | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 43d6796..e39e595 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -78,7 +78,6 @@ public: : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) #ifdef Q_WS_MAC , useHIToolBar(false) - , activateUnifiedToolbarAfterFullScreen(false) #endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) , hasOldCursor(false) , cursorAdjusted(false) @@ -90,7 +89,6 @@ public: Qt::ToolButtonStyle toolButtonStyle; #ifdef Q_WS_MAC bool useHIToolBar; - bool activateUnifiedToolbarAfterFullScreen; #endif void init(); QList hoverSeparator; diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index d4afe07..8880ca9 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1699,6 +1699,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow)) #endif //QT_NO_RUBBERBAND #ifdef Q_WS_MAC + , activateUnifiedToolbarAfterFullScreen(false) , blockVisiblityCheck(false) #endif { diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index 20aca61..0442510 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -338,7 +338,6 @@ public: void removeFromMacToolbar(QToolBar *toolbar); void cleanUpMacToolbarItems(); void fixSizeInUnifiedToolbar(QToolBar *tb) const; - bool useHIToolBar; bool activateUnifiedToolbarAfterFullScreen; void syncUnifiedToolbarVisibility(); bool blockVisiblityCheck; -- cgit v0.12 From bff68fc7094a50af57f7da23ecf9b25cab00f188 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 12 May 2011 16:21:03 +0200 Subject: Fix compilation with namespaces enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Samuel Rødal --- src/gui/painting/qcosmeticstroker.cpp | 4 ++++ src/gui/painting/qcosmeticstroker_p.h | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 498b154..24d625e 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -3,6 +3,8 @@ #include #include +QT_BEGIN_NAMESPACE + #if 0 inline QString capString(int caps) { @@ -952,3 +954,5 @@ static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx } } } + +QT_END_NAMESPACE diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index bc6dd76..1355a5a 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -6,6 +6,12 @@ #include #include +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + class QCosmeticStroker; @@ -98,4 +104,8 @@ public: bool clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2); }; +QT_END_NAMESPACE + +QT_END_HEADER + #endif // QCOSMETICLINE_H -- cgit v0.12 From 7a1c29f101b95c9cc2cb53f8b80d231b5a994a9a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 12 May 2011 19:00:15 +0200 Subject: fix compilation with namespaces --- src/gui/painting/qcosmeticstroker.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 24d625e..3ee262f 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -150,28 +150,28 @@ static StrokeLine strokeLine(int strokeSelection) switch (strokeSelection) { case Aliased|Solid|RegularDraw: - stroke = &::drawLine; + stroke = &QT_PREPEND_NAMESPACE(drawLine); break; case Aliased|Solid|FastDraw: - stroke = &::drawLine; + stroke = &QT_PREPEND_NAMESPACE(drawLine); break; case Aliased|Dashed|RegularDraw: - stroke = &::drawLine; + stroke = &QT_PREPEND_NAMESPACE(drawLine); break; case Aliased|Dashed|FastDraw: - stroke = &::drawLine; + stroke = &QT_PREPEND_NAMESPACE(drawLine); break; case AntiAliased|Solid|RegularDraw: - stroke = &drawLineAA; + stroke = &QT_PREPEND_NAMESPACE(drawLineAA); break; case AntiAliased|Solid|FastDraw: - stroke = &drawLineAA; + stroke = &QT_PREPEND_NAMESPACE(drawLineAA); break; case AntiAliased|Dashed|RegularDraw: - stroke = &drawLineAA; + stroke = &QT_PREPEND_NAMESPACE(drawLineAA); break; case AntiAliased|Dashed|FastDraw: - stroke = &drawLineAA; + stroke = &QT_PREPEND_NAMESPACE(drawLineAA); break; default: Q_ASSERT(false); -- cgit v0.12 From 4d5b8f66d82e9087d9d58a4e76e6b46ce7bb53cc Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 16 May 2011 10:20:54 +0200 Subject: Workaround a bug in Core Text to select Light fonts Currently in Core Text there is not proper way to select fonts with Light weight, for example: QFont font("Helvetica"); font.setWeight(QFont::Light); will give you Helvetica-Light, as with: QFont font("Helvetica"); font.setWeight(QFont::Normal); because of a bug in Core Text, applying 0 symbolic traits with CTFontCreateCopyWithSymbolicTraits will always return the Light variant of that font family. Thus, we should only do this unless symbolicTraits is not 0 or font.weight is not Normal (Light is not a symbolic trait, but CT doesn't support selecting Light weight numerically). Reviewed-by: Eskil --- src/gui/text/qfontengine_coretext.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index cbf51e6..d14db3a 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -100,7 +100,12 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const QCFString &name, const QCFType descriptor = CTFontDescriptorCreateWithNameAndSize(name, fontDef.pixelSize); QCFType baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pixelSize, &transform); - ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits); + ctfont = NULL; + // There is a side effect in Core Text: if we apply 0 as symbolic traits to a font in normal weight, + // we will get the light version of that font (while the way supposed to work doesn't: + // setting kCTFontWeightTrait to some value between -1.0 to 0.0 has no effect on font selection) + if (fontDef.weight != QFont::Normal || symbolicTraits) + ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits); // CTFontCreateCopyWithSymbolicTraits returns NULL if we ask for a trait that does // not exist for the given font. (for example italic) -- cgit v0.12 From 67d275542464c794ec4b650f10cca9a17e10c977 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 16 May 2011 16:07:10 +0200 Subject: fix autotest regressions introduced by 37c329a3 Add proper license headers and properly clip pixel drawing to the devices bounding rect. --- src/gui/painting/qcosmeticstroker.cpp | 45 +++++++++++++++++++++++++++++++++++ src/gui/painting/qcosmeticstroker_p.h | 41 +++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 3ee262f..d694b4b 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qcosmeticstroker_p.h" #include "private/qpainterpath_p.h" #include @@ -99,6 +140,10 @@ static void drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) { + const QRect &cl = stroker->clip; + if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) + return; + int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; int lasty = stroker->spans[stroker->current_span-1].y; diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index 1355a5a..0aa71fc 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QCOSMETICSTROKER_P_H #define QCOSMETICSTROKER_P_H -- cgit v0.12 From c354bc1d567874dd58db6abecf9d5796dfd721be Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 18 May 2011 12:16:33 +0200 Subject: Fix broken drawing with large fonts using QStaticText and FreeType In FreeType, there's a fall back to QFontEngine::alphaMapForGlyph() when the fonts are very large. Since this uses a QPainterPath containing an unhinted glyph, the use of hinted metrics would sometimes lead to the glyphs being clipped because they would be positioned slightly outside the image they were painted into. When outline drawing is on, it makes sense to return unhinted metrics, since the glyphs we will actually use are unhinted. Task-number: QTBUG-19067 Reviewed-by: Jiang Jiang --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index c74ecc8..c4e89d5 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -909,7 +909,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph } } - if (default_hint_style == HintNone) + if (default_hint_style == HintNone || set->outline_drawing) load_flags |= FT_LOAD_NO_HINTING; else load_flags |= load_target; -- cgit v0.12 From 0aa9b30432cec3b7f366983f451fc9a7f8f83243 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 18 May 2011 15:10:40 +0200 Subject: Fall back to using paths for large fonts in drawStaticText() QStaticText had an implicit risk which meant you had to make sure the text size did not grow unreasonably large. This was intended to avoid hiding the performance impact of using QStaticText for such a purpose, but it's too inconvenient. Thus, the same fall back as in drawTextItem() has been introduced. This will also fix a bug recently introduced when we started using the FT cache to draw static text in the raster engine, since this will fail for large fonts. Task-number: QTBUG-19084, QTBUG-19370 Reviewed-by: Jiang Jiang --- src/gui/painting/qpaintengine_raster.cpp | 12 ++++++-- src/gui/painting/qpaintengineex.cpp | 35 ++++++++++++++++++++++ src/gui/painting/qpaintengineex_p.h | 2 +- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 33 +++++++++++++------- 4 files changed, 68 insertions(+), 14 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f0bc0d6..4f8af48 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3029,8 +3029,16 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) ensurePen(); ensureState(); - drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, - textItem->fontEngine()); + QRasterPaintEngineState *s = state(); + + QFontEngine *fontEngine = textItem->fontEngine(); + const qreal pixelSize = fontEngine->fontDef.pixelSize; + if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) < 64 * 64) { + drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, + fontEngine); + } else { + QPaintEngineEx::drawStaticTextItem(textItem); + } } /*! diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index bbdf76f..304e5fc 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -44,6 +44,8 @@ #include "qstroker_p.h" #include "qbezier_p.h" #include +#include +#include #include #include @@ -1057,5 +1059,38 @@ Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path) return p; } +void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) +{ + QPainterPath path; +#ifndef Q_WS_MAC + path.setFillRule(Qt::WindingFill); +#endif + + if (staticTextItem->numGlyphs == 0) + return; + + QFontEngine *fontEngine = staticTextItem->fontEngine(); + fontEngine->addGlyphsToPath(staticTextItem->glyphs, staticTextItem->glyphPositions, + staticTextItem->numGlyphs, &path, 0); + if (!path.isEmpty()) { + QPainterState *s = state(); + QPainter::RenderHints oldHints = s->renderHints; + bool changedHints = false; + if (bool(oldHints & QPainter::TextAntialiasing) + && !bool(fontEngine->fontDef.styleStrategy & QFont::NoAntialias) + && !bool(oldHints & QPainter::Antialiasing)) { + s->renderHints |= QPainter::Antialiasing; + renderHintsChanged(); + changedHints = true; + } + + fill(qtVectorPathForPath(path), staticTextItem->color); + + if (changedHints) { + s->renderHints = oldHints; + renderHintsChanged(); + } + } +} QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index d12c602..7d57eee 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -202,7 +202,7 @@ public: virtual void updateState(const QPaintEngineState &state); - virtual void drawStaticTextItem(QStaticTextItem *) = 0; + virtual void drawStaticTextItem(QStaticTextItem *); virtual void setState(QPainterState *s); inline QPainterState *state() { return static_cast(QPaintEngine::state); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 38bd58d..3cf8faa 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1436,19 +1436,30 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) ensureActive(); - QFontEngineGlyphCache::Type glyphType = textItem->fontEngine()->glyphFormat >= 0 - ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) - : d->glyphCacheType; - if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { - if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate - || (state()->composition_mode != QPainter::CompositionMode_Source - && state()->composition_mode != QPainter::CompositionMode_SourceOver)) - { - glyphType = QFontEngineGlyphCache::Raster_A8; + QPainterState *s = state(); + float det = s->matrix.determinant(); + + // don't try to cache huge fonts or vastly transformed fonts + QFontEngine *fontEngine = textItem->fontEngine(); + const qreal pixelSize = fontEngine->fontDef.pixelSize; + if (pixelSize * pixelSize * qAbs(det) < QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE || + det < 0.25f || det > 4.f) { + QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 + ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) + : d->glyphCacheType; + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + if (d->device->alphaRequested() || s->matrix.type() > QTransform::TxTranslate + || (s->composition_mode != QPainter::CompositionMode_Source + && s->composition_mode != QPainter::CompositionMode_SourceOver)) + { + glyphType = QFontEngineGlyphCache::Raster_A8; + } } - } - d->drawCachedGlyphs(glyphType, textItem); + d->drawCachedGlyphs(glyphType, textItem); + } else { + QPaintEngineEx::drawStaticTextItem(textItem); + } } bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src) -- cgit v0.12 From 44e1526ee2585c0402c284aa94eb2472fa4a4145 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 18 May 2011 16:17:17 +0200 Subject: Change the flushing of the CGContext to a synchronization. When many NSView are being drawn, calling CGContextFlush() is too expensive and some flickering becomes apparent. We now call CGContextSynchronize() instead. Since this solves the flickering problem, we can now call setNeedsDisplay: for items in the unified toolbar. This allows us to smootly trigger many flushings inside the unified toolbar. Task-number: QTBUG-19267 Reviewed-by: Jiang Jiang --- src/gui/kernel/qcocoaview_mac.mm | 2 +- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index b5e5d18..578970c 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -320,7 +320,7 @@ static int qCocoaViewCount = 0; } - CGContextFlush(context); + CGContextSynchronize(context); qt_mac_release_graphics_context(context); return; } diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 2fda6b9..94a7417 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -171,10 +171,8 @@ void QUnifiedToolbarSurface::flush(QWidget *widget) if (!d->image) return; - if (widget->d_func()->flushRequested) { - // We call display: directly to avoid flickering in the toolbar. - qt_mac_display(widget); - } + if (widget->d_func()->flushRequested) + qt_mac_setNeedsDisplay(widget); } void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget) -- cgit v0.12 From 5933d4e4fb8b48ebed641e7f6b1d032df253df30 Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Wed, 18 May 2011 17:43:14 +0300 Subject: Fixing Linux compatibility issues for Symbian Reviewed-by: Laszlo Agocs --- .../mobile/quickhit/plugins/LevelOne/levelone.pro | 6 ++-- .../plugins/LevelTemplate/leveltemplate.pro | 6 ++-- .../mobile/quickhit/plugins/LevelTwo/leveltwo.pro | 6 ++-- mkspecs/features/symbian/application_icon.prf | 4 +-- src/gui/dialogs/dialogs.pri | 2 +- src/gui/styles/styles.pri | 6 +--- src/plugins/bearer/symbian/symbian.pri | 9 ++--- src/plugins/phonon/mmf/mmf.pro | 4 +-- src/plugins/s60/5_0/5_0.pro | 8 ++--- src/s60installs/qt.iby | 42 +++++++++++----------- src/s60installs/s60installs.pro | 6 ++-- tests/auto/qcssparser/qcssparser.pro | 2 +- 12 files changed, 44 insertions(+), 57 deletions(-) diff --git a/demos/mobile/quickhit/plugins/LevelOne/levelone.pro b/demos/mobile/quickhit/plugins/LevelOne/levelone.pro index fcbfc56..b936721 100644 --- a/demos/mobile/quickhit/plugins/LevelOne/levelone.pro +++ b/demos/mobile/quickhit/plugins/LevelOne/levelone.pro @@ -57,11 +57,11 @@ BLD_INF_RULES.prj_exports += "gfx/background3.png ../winscw/c/Data/gfx/backgroun myQml.sources = level.qml -myQml.path = c:/System/quickhitdata/levelone +myQml.path = c:/system/quickhitdata/levelone myGraphic.sources = gfx/* -myGraphic.path = c:/System/quickhitdata/levelone/gfx +myGraphic.path = c:/system/quickhitdata/levelone/gfx mySound.sources = sound/* -mySound.path = c:/System/quickhitdata/levelone/sound +mySound.path = c:/system/quickhitdata/levelone/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro b/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro index a4f5900..1370956 100644 --- a/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro +++ b/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro @@ -60,11 +60,11 @@ BLD_INF_RULES.prj_exports += "gfx/enemy1.png ../winscw/c/Data/gfx/enemy1.png" \ myQml.sources = qml/* -myQml.path = c:/System/quickhitdata/leveltemplate +myQml.path = c:/system/quickhitdata/leveltemplate myGraphic.sources = gfx/* -myGraphic.path = c:/System/quickhitdata/leveltemplate/gfx +myGraphic.path = c:/system/quickhitdata/leveltemplate/gfx mySound.sources = sound/* -mySound.path = c:/System/quickhitdata/leveltemplate/sound +mySound.path = c:/system/quickhitdata/leveltemplate/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro b/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro index 171ee6c..e5c144f 100644 --- a/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro +++ b/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro @@ -64,11 +64,11 @@ BLD_INF_RULES.prj_exports += "gfx/background2.png ../winscw/c/Data/gfx/backgroun myQml.sources = qml/* -myQml.path = c:/System/quickhitdata/leveltwo +myQml.path = c:/system/quickhitdata/leveltwo myGraphic.sources = gfx/* -myGraphic.path = c:/System/quickhitdata/leveltwo/gfx +myGraphic.path = c:/system/quickhitdata/leveltwo/gfx mySound.sources = sound/* -mySound.path = c:/System/quickhitdata/leveltwo/sound +mySound.path = c:/system/quickhitdata/leveltwo/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 06f5b31..56d1ea8 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -65,8 +65,8 @@ contains(CONFIG, no_icon) { mifconv.target = $$replace(mifconv.target, /, \\) } # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library - # svg-t icons should always use /c32 depth - mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed + # svg-t icons should always use -c32 depth + mifconv.commands = mifconv $$mifconv.target -c32 $$ICON_backslashed mifconv.depends = $$ICON PRE_TARGETDEPS += $$mifconv.target diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 12e3a71..c25b6d5 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -109,7 +109,7 @@ SOURCES += \ dialogs/qprintpreviewdialog.cpp symbian:contains(QT_CONFIG, s60) { - LIBS += -lCommonDialogs + LIBS += -lcommondialogs SOURCES += dialogs/qfiledialog_symbian.cpp \ dialogs/qcolordialog_symbian.cpp } diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index b22a908..c595ee8 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -172,11 +172,7 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { symbian { SOURCES += styles/qs60style_s60.cpp LIBS += -legul -lbmpanim - contains(CONFIG, is_using_gnupoc) { - LIBS += -laknicon -laknskins -laknskinsrv -lfontutils - } else { - LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils - } + LIBS += -laknicon -laknskins -laknskinsrv -lfontutils } else { SOURCES += styles/qs60style_simulated.cpp RESOURCES += styles/qstyle_s60_simulated.qrc diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri index 8d92f57..121cefb 100644 --- a/src/plugins/bearer/symbian/symbian.pri +++ b/src/plugins/bearer/symbian/symbian.pri @@ -19,13 +19,8 @@ LIBS += -lcommdb \ -linsock \ -lecom \ -lefsrv \ - -lnetmeta - -is_using_gnupoc { - LIBS += -lconnmon -} else { - LIBS += -lConnMon -} + -lnetmeta \ + -lconnmon QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index a9e5746..3b8184b 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -103,7 +103,7 @@ symbian { exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { HEADERS += $$PHONON_MMF_DIR/download.h SOURCES += $$PHONON_MMF_DIR/download.cpp - LIBS += -lDownloadMgr + LIBS += -ldownloadmgr DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD } } @@ -125,7 +125,7 @@ symbian { LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream # These are for effects. - LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + LIBS += -laudioequalizereffect -lbassboosteffect -ldistanceattenuationeffect -ldopplerbase -leffectbase -lenvironmentalreverbeffect -llistenerdopplereffect -llistenerlocationeffect -llistenerorientationeffect -llocationbase -lloudnesseffect -lorientationbase -lsourcedopplereffect -lsourcelocationeffect -lsourceorientationeffect -lstereowideningeffect # This is to allow IAP to be specified LIBS += -lcommdb diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro index 00aea1b..1617a1e 100644 --- a/src/plugins/s60/5_0/5_0.pro +++ b/src/plugins/s60/5_0/5_0.pro @@ -10,12 +10,8 @@ contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_2.cpp \ ../src/qdesktopservices_3_2.cpp \ ../src/qcoreapplication_3_2.cpp - contains(CONFIG, is_using_gnupoc) { - LIBS += -ldirectorylocalizer - } else { - LIBS += -lDirectoryLocalizer - } - LIBS += -lefsrv + LIBS += -lefsrv \ + -ldirectorylocalizer INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index d6b36e0..9f2c979 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -40,7 +40,7 @@ file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll // Phonon MMF backend file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll -data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin // graphicssystems file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll @@ -54,41 +54,41 @@ file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll // imageformats stubs -data=\epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin // codecs stubs -data=\epoc32\data\z\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin -data=\epoc32\data\z\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin -data=\epoc32\data\z\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin -data=\epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin // iconengines stubs -data=\epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin // qml import plugins file=ABI_DIR\BUILD_DIR\qmlfolderlistmodelplugin.dll SHARED_LIB_DIR\qmlfolderlistmodelplugin.dll file=ABI_DIR\BUILD_DIR\qmlgesturesplugin.dll SHARED_LIB_DIR\qmlgesturesplugin.dll file=ABI_DIR\BUILD_DIR\qmlparticlesplugin.dll SHARED_LIB_DIR\qmlparticlesplugin.dll -data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin -data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin -data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin -data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir -data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir -data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir // graphicssystems -data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin -data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin // bearer stub -data=\epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin // Stub sis file data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index d1bb48b..17b229f 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -10,10 +10,10 @@ symbian: { TARGET = "Qt$${QT_LIBINFIX}" isEmpty(QT_LIBINFIX) { - TARGET.UID3 = 0x2001E61C + TARGET.UID3 = 0x2001e61c } else { # Always use experimental UID for infixed configuration to avoid UID clash - TARGET.UID3 = 0xE001E61C + TARGET.UID3 = 0xe001e61c } VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} @@ -116,7 +116,7 @@ symbian: { # Support backup & restore for Qt libraries qtbackup.sources = backup_registration.xml - qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + qtbackup.path = c:/private/10202d56/import/packages/$$replace(TARGET.UID3, 0x,) DEPLOYMENT += qtlibraries \ qtbackup \ diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 674064f..4953490 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -10,7 +10,7 @@ requires(contains(QT_CONFIG,private_tests)) wince*|symbian: { addFiles.sources = testdata addFiles.path = . - timesFont.sources = C:/Windows/Fonts/times.ttf + timesFont.sources = c:/windows/fonts/times.ttf timesFont.path = . DEPLOYMENT += addFiles timesFont } -- cgit v0.12 From 38d04b8cd5a26564945b833450a104fe82d97e14 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 19 May 2011 08:40:13 +0300 Subject: Opening taskswitcher, pushes application softkeys to top of switcher If application does not have active window, do not update CBA, since this causes the CBA to become on foreground. Task-number: QTBUG-19225 Reviewed-by: Miikka Heikkinen --- src/gui/kernel/qsoftkeymanager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 204efe9..c51df9b 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -193,9 +193,11 @@ void QSoftKeyManager::sendKeyEvent() void QSoftKeyManager::updateSoftKeys() { - QSoftKeyManager::instance()->d_func()->pendingUpdate = true; - QEvent *event = new QEvent(QEvent::UpdateSoftKeys); - QApplication::postEvent(QSoftKeyManager::instance(), event); + if (QApplication::activeWindow()) { + QSoftKeyManager::instance()->d_func()->pendingUpdate = true; + QEvent *event = new QEvent(QEvent::UpdateSoftKeys); + QApplication::postEvent(QSoftKeyManager::instance(), event); + } } bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level) -- cgit v0.12 From 12d4465ad9af5473d48a3abfe6b277f0881a3604 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 19 May 2011 10:32:26 +0300 Subject: Fix qguimetatype benchmark for Symbian QMetaType::QColorGroup requires QT3_SUPPORT, so skip that in builds that do not include QT3_SUPPORT. Task-number: QTBUG-19254 Reviewed-by: Sami Merila --- tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp index fd5132c..531943a 100644 --- a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -68,8 +68,12 @@ tst_QGuiMetaType::~tst_QGuiMetaType() void tst_QGuiMetaType::constructGuiType_data() { QTest::addColumn("typeId"); - for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i) + for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i) { +#ifndef QT3_SUPPORT + if (i != 63) // QMetaType::QColorGroup (63) requires QT3_SUPPORT +#endif QTest::newRow(QMetaType::typeName(i)) << i; + } } // Tests how fast QMetaType can default-construct and destroy a Qt GUI -- cgit v0.12 From f8e85838c5531b56c2175cbdb9c24db426f7fd89 Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 19 May 2011 09:27:19 +0200 Subject: Revert "Fix how subpixel positions are intepreted in an aliased grid." This reverts commit 69fc9e594e6d5da87bff42707973683f84b67c93. Conflicts: src/gui/painting/qpaintengine_raster.cpp src/gui/painting/qrasterizer.cpp --- src/gui/painting/qoutlinemapper.cpp | 9 +++++++ src/gui/painting/qoutlinemapper_p.h | 8 ++++++- src/gui/painting/qpaintengine_raster.cpp | 40 ++++++++++++++++++++++---------- src/gui/painting/qrasterizer.cpp | 4 ++-- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index aac5083..6e53c35 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; + #define qreal_to_fixed_26_6(f) (int(f * 64)) @@ -214,6 +216,13 @@ void QOutlineMapper::endOutline() elements = m_elements_dev.data(); } + if (m_round_coords) { + // round coordinates to match outlines drawn with drawLine_midpoint_i + for (int i = 0; i < m_elements.size(); ++i) + elements[i] = QPointF(qFloor(elements[i].x() + aliasedCoordinateDelta), + qFloor(elements[i].y() + aliasedCoordinateDelta)); + } + controlPointRect = boundingRect(elements, element_count); #ifdef QT_DEBUG_CONVERT diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h index 4dd28ac..0f2303c 100644 --- a/src/gui/painting/qoutlinemapper_p.h +++ b/src/gui/painting/qoutlinemapper_p.h @@ -95,7 +95,8 @@ public: m_tags(0), m_contours(0), m_polygon_dev(0), - m_in_clip_elements(false) + m_in_clip_elements(false), + m_round_coords(false) { } @@ -201,6 +202,8 @@ public: QT_FT_Outline *convertPath(const QPainterPath &path); QT_FT_Outline *convertPath(const QVectorPath &path); + void setCoordinateRounding(bool coordinateRounding) { m_round_coords = coordinateRounding; } + inline QPainterPath::ElementType *elementTypes() const { return m_element_types.size() == 0 ? 0 : m_element_types.data(); } public: @@ -234,6 +237,9 @@ public: bool m_valid; bool m_in_clip_elements; + +private: + bool m_round_coords; }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4f8af48..b730be3 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -127,6 +127,9 @@ void dumpClip(int width, int height, const QClipData *clip); // 4 pixels. #define int_dim(pos, dim) (int(pos+dim) - int(pos)) +// use the same rounding as in qrasterizer.cpp (6 bit fixed point) +static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; + #ifdef Q_WS_WIN extern bool qt_cleartype_enabled; #endif @@ -1666,10 +1669,10 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) static inline QRect toNormalizedFillRect(const QRectF &rect) { - int x1 = qRound(rect.x()); - int y1 = qRound(rect.y()); - int x2 = qRound(rect.right()); - int y2 = qRound(rect.bottom()); + int x1 = qRound(rect.x() + aliasedCoordinateDelta); + int y1 = qRound(rect.y() + aliasedCoordinateDelta); + int x2 = qRound(rect.right() + aliasedCoordinateDelta); + int y2 = qRound(rect.bottom() + aliasedCoordinateDelta); if (x2 < x1) qSwap(x1, x2); @@ -1939,7 +1942,9 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly // Do the fill... ensureBrush(); if (s->brushData.blend) { + d->outlineMapper->setCoordinateRounding(s->penData.blend && s->flags.fast_pen && s->lastPen.brush().isOpaque()); fillPolygon(points, pointCount, mode); + d->outlineMapper->setCoordinateRounding(false); } } @@ -1986,6 +1991,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg if (s->brushData.blend) { // Compose polygon fill.., ensureOutlineMapper(); + d->outlineMapper->setCoordinateRounding(s->penData.blend != 0); d->outlineMapper->beginOutline(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill); d->outlineMapper->moveTo(*points); const QPoint *p = points; @@ -1999,6 +2005,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, &s->brushData); d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data()); + d->outlineMapper->setCoordinateRounding(false); } } @@ -2255,7 +2262,10 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe int sr_b = qCeil(sr.bottom()) - 1; if (s->matrix.type() <= QTransform::TxScale && !s->flags.antialiased && sr_l == sr_r && sr_t == sr_b) { + // as fillRect will apply the aliased coordinate delta we need to + // subtract it here as we don't use it for image drawing QTransform old = s->matrix; + s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); // Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied. QRgb color = img.pixel(sr_l, sr_t); @@ -2399,9 +2409,11 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe d->initializeRasterizer(&d->image_filler_xform); d->rasterizer->setAntialiased(s->flags.antialiased); + const QPointF offs = s->flags.antialiased ? QPointF() : QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta); + const QRectF &rect = r.normalized(); - const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); - const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); + const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs; + const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs; if (s->flags.tx_noshear) d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); @@ -2410,12 +2422,13 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe return; } #endif + const qreal offs = s->flags.antialiased ? qreal(0) : aliasedCoordinateDelta; QPainterPath path; path.addRect(r); QTransform m = s->matrix; s->matrix = QTransform(m.m11(), m.m12(), m.m13(), m.m21(), m.m22(), m.m23(), - m.m31(), m.m32(), m.m33()); + m.m31() - offs, m.m32() - offs, m.m33()); fillPath(path, &d->image_filler_xform); s->matrix = m; } else { @@ -2867,6 +2880,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); + const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); const uchar *bits = image.bits(); for (int i=0; isetFontScale(matrix.m11()); ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); + const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta); for (int i=0; igetCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize); - const int x = qFloor(positions[i].x + tmetrics.HorizBearingX()); - const int y = qFloor(positions[i].y - tmetrics.HorizBearingY()); + const int x = qFloor(positions[i].x + metrics.x + aliasDelta); + const int y = qFloor(positions[i].y + metrics.y + aliasDelta); alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); } @@ -3125,7 +3140,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte || (fontEngine->type() == QFontEngine::Proxy && !(static_cast(fontEngine)->drawAsOutline())) )) { - fontEngine->draw(this, qFloor(p.x()), qFloor(p.y()), ti); + fontEngine->draw(this, qFloor(p.x() + aliasedCoordinateDelta), qFloor(p.y() + aliasedCoordinateDelta), ti); return; } #endif // Q_WS_QWS @@ -3148,6 +3163,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte for(int i = 0; i < glyphs.size(); i++) { QImage img = fontEngine->alphaMapForGlyph(glyphs[i]); glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[i]); + // ### hm, perhaps an QFixed offs = QFixed::fromReal(aliasedCoordinateDelta) is needed here? alphaPenBlt(img.bits(), img.bytesPerLine(), img.depth(), qRound(positions[i].x + metrics.x), qRound(positions[i].y + metrics.y), diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 75116c2..bd38286 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -62,8 +62,8 @@ typedef int Q16Dot16; #define SPAN_BUFFER_SIZE 256 -#define COORD_ROUNDING 0 // 0: round up, 1: round down -#define COORD_OFFSET 0 // 26.6, 32 is half a pixel +#define COORD_ROUNDING 1 // 0: round up, 1: round down +#define COORD_OFFSET 32 // 26.6, 32 is half a pixel static inline QT_FT_Vector PointToVector(const QPointF &p) { -- cgit v0.12 From 03e6eced23187d49d913a45846956c1fdbdc1bf7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 19 May 2011 11:23:54 +0300 Subject: Fix qguivariant benchmark for Symbian QMetaType::QColorGroup requires QT3_SUPPORT, so skip that in builds that do not include QT3_SUPPORT. Task-number: QTBUG-19253 Reviewed-by: TrustMe --- tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp index a9e49b5..5c1a4dc 100644 --- a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp +++ b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp @@ -70,8 +70,12 @@ tst_QGuiVariant::~tst_QGuiVariant() void tst_QGuiVariant::createGuiType_data() { QTest::addColumn("typeId"); - for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i) + for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i) { +#ifndef QT3_SUPPORT + if (i != 63) // QMetaType::QColorGroup (63) requires QT3_SUPPORT +#endif QTest::newRow(QMetaType::typeName(i)) << i; + } } // Tests how fast a Qt GUI type can be default-constructed by a -- cgit v0.12 From c319214f919e3345f673391253f92c6bc0e2a285 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 19 May 2011 13:47:37 +0200 Subject: Fix in-process drag-n-drop of image data, image/* was not available. If we give the exact initial QMimeData to the dropEvent, we only get application/x-qt-image as available mimeType. We need to go through QDropData to call xdndObtainData, which can still do some in-process optimization, but there we can do the "saving QImage to the requested format" conversion. Task-number: QTBUG-4110 Merge-request: 860 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qdnd_x11.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 1c59d41..ecb9a70 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1166,12 +1166,20 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) // some XEMBEDding, so try to find the real QMimeData used // based on the timestamp for this drop. QMimeData *dropData = 0; - int at = findXdndDropTransactionByTime(qt_xdnd_target_current_time); - if (at != -1) + const int at = findXdndDropTransactionByTime(qt_xdnd_target_current_time); + if (at != -1) { dropData = QDragManager::dragPrivate(X11->dndDropTransactions.at(at).object)->data; + // Can't use the source QMimeData if we need the image conversion code from xdndObtainData + if (dropData && dropData->hasImage()) + dropData = 0; + } // if we can't find it, then use the data in the drag manager - if (!dropData) - dropData = (manager->object) ? manager->dragPrivate()->data : manager->dropData; + if (!dropData) { + if (manager->object && !manager->dragPrivate()->data->hasImage()) + dropData = manager->dragPrivate()->data; + else + dropData = manager->dropData; + } // Drop coming from another app? Update keyboard modifiers. if (!qt_xdnd_dragging) { @@ -1855,8 +1863,16 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) && (!(w->windowType() == Qt::Desktop) || w->acceptDrops())) { QDragPrivate * o = QDragManager::self()->dragPrivate(); - if (o->data->hasFormat(QLatin1String(format))) - result = o->data->data(QLatin1String(format)); + const QString mimeType = QString::fromLatin1(format); + if (o->data->hasFormat(mimeType)) { + result = o->data->data(mimeType); + } else if (mimeType.startsWith(QLatin1String("image/")) && o->data->hasImage()) { + // ### duplicated from QInternalMimeData::renderDataHelper + QImage image = qvariant_cast(o->data->imageData()); + QBuffer buf(&result); + buf.open(QBuffer::WriteOnly); + image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper()); + } return result; } -- cgit v0.12 From 457c33d9fd308542c9290fd60bf86960f9251255 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Thu, 19 May 2011 13:55:12 +0200 Subject: Wayland: send surface id + process id pairs to compositor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables doing window/process management since we can now actually map the process we've launched to a window. Reviewed-by: Samuel Rødal --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 15 ++++ src/plugins/platforms/wayland/qwaylanddisplay.h | 11 +++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ++- src/plugins/platforms/wayland/wayland.pro | 2 + .../qwaylandwindowmanager-client-protocol.h | 82 +++++++++++++++++++++ .../qwaylandwindowmanagerintegration.cpp | 84 ++++++++++++++++++++++ .../qwaylandwindowmanagerintegration.h | 69 ++++++++++++++++++ .../wayland-windowmanager-protocol.c | 36 ++++++++++ .../windowmanager_integration.pri | 16 +++++ 9 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h create mode 100644 src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp create mode 100644 src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h create mode 100644 src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c create mode 100644 src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 876b46a..dcfaf0f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,10 @@ #include "gl_integration/qwaylandglintegration.h" #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT +#include "windowmanager_integration/qwaylandwindowmanagerintegration.h" +#endif + #include #include @@ -95,6 +99,13 @@ QWaylandGLIntegration * QWaylandDisplay::eglIntegration() } #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT +QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() +{ + return mWindowManagerIntegration; +} +#endif + void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, @@ -134,6 +145,10 @@ QWaylandDisplay::QWaylandDisplay(void) mEglIntegration->initialize(); #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this); +#endif + connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index a2cb1b2..81deb3d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -55,6 +55,8 @@ class QWaylandBuffer; class QPlatformScreen; class QWaylandScreen; class QWaylandGLIntegration; +class QWaylandWindowManagerIntegration; + class QWaylandDisplay : public QObject { Q_OBJECT @@ -74,6 +76,11 @@ public: #ifdef QT_WAYLAND_GL_SUPPORT QWaylandGLIntegration *eglIntegration(); #endif + +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + QWaylandWindowManagerIntegration *windowManagerIntegration(); +#endif + void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y); void syncCallback(wl_display_sync_func_t func, void *data); @@ -123,6 +130,10 @@ private: QWaylandGLIntegration *mEglIntegration; #endif +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + QWaylandWindowManagerIntegration *mWindowManagerIntegration; +#endif + static void shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 53f2f48..d2a7647 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -46,6 +46,11 @@ #include "qwaylandinputdevice.h" #include "qwaylandscreen.h" +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT +#include "windowmanager_integration/qwaylandwindowmanagerintegration.h" +#endif + +#include #include #include @@ -60,6 +65,10 @@ QWaylandWindow::QWaylandWindow(QWidget *window) static WId id = 1; mWindowId = id++; +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid()); +#endif + mSurface = mDisplay->createSurface(this); } @@ -120,7 +129,6 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer) } } - void QWaylandWindow::damage(const QRegion ®ion) { //We have to do sync stuff before calling damage, or we might diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 8d2d4b5..d2498b2 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -34,8 +34,10 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND INCLUDEPATH += $$PWD include ($$PWD/gl_integration/gl_integration.pri) +include ($$PWD/windowmanager_integration/windowmanager_integration.pri) include (../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target + diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h new file mode 100644 index 0000000..ec776c5 --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h @@ -0,0 +1,82 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H +#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; + +struct wl_windowmanager; + +extern const struct wl_interface wl_windowmanager_interface; + +#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 + +static inline struct wl_windowmanager * +wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/) +{ + // ### does not run without latest wayland. must be enabled later + //wl_display_bind(display, id, "wl_windowmanager", version); + + return (struct wl_windowmanager *) + wl_proxy_create_for_id(display, &wl_windowmanager_interface, id); +} + +static inline void +wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data); +} + +static inline void * +wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager); +} + +static inline void +wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager) +{ + wl_proxy_destroy((struct wl_proxy *) wl_windowmanager); +} + +static inline void +wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid) +{ + wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, + WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp new file mode 100644 index 0000000..8a8e5a9 --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwindowmanagerintegration.h" +#include "qwaylandwindowmanager-client-protocol.h" + +#include + +QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegration(QWaylandDisplay *waylandDisplay) +{ + return new QWaylandWindowManagerIntegration(waylandDisplay); +} + +QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) + : mWaylandDisplay(waylandDisplay) + , mWaylandWindowManager(0) +{ + wl_display_add_global_listener(mWaylandDisplay->wl_display(), + QWaylandWindowManagerIntegration::wlHandleListenerGlobal, + this); +} + +QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() +{ + +} + +struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const +{ + return mWaylandWindowManager; +} + +void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, + uint32_t version, void *data) +{ + if (strcmp(interface, "wl_windowmanager") == 0) { + QWaylandWindowManagerIntegration *integration = static_cast(data); + integration->mWaylandWindowManager = wl_windowmanager_create(display,id, version); + } +} + +void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId) +{ + wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId); +} + diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h new file mode 100644 index 0000000..01a7bdd --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H +#define QWAYLANDWINDOWMANAGERINTEGRATION_H + +#include +#include "wayland-client.h" +#include "qwaylanddisplay.h" + +class QWaylandWindowManagerIntegration +{ +public: + explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); + virtual ~QWaylandWindowManagerIntegration(); + static QWaylandWindowManagerIntegration *createIntegration(QWaylandDisplay *waylandDisplay); + struct wl_windowmanager *windowManager() const; + + void mapSurfaceToProcess(struct wl_surface *surface, long long processId); + void mapClientToProcess(long long processId); + +private: + static void wlHandleListenerGlobal(wl_display *display, uint32_t id, + const char *interface, uint32_t version, void *data); + +private: + QWaylandDisplay *mWaylandDisplay; + struct wl_windowmanager *mWaylandWindowManager; +}; + +#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c new file mode 100644 index 0000000..48049d8 --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c @@ -0,0 +1,36 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#include +#include +#include "wayland-util.h" + +static const struct wl_message wl_windowmanager_requests[] = { + { "map_client_to_process", "u", NULL }, +}; + +WL_EXPORT const struct wl_interface wl_windowmanager_interface = { + "wl_windowmanager", 1, + ARRAY_LENGTH(wl_windowmanager_requests), wl_windowmanager_requests, + 0, NULL, +}; diff --git a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri new file mode 100644 index 0000000..a282182 --- /dev/null +++ b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri @@ -0,0 +1,16 @@ +DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT + +contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) { + + HEADERS += \ + $$PWD/qwaylandwindowmanager-client-protocol.h \ + $$PWD/qwaylandwindowmanagerintegration.h + + SOURCES += \ + $$PWD/qwaylandwindowmanagerintegration.cpp \ + $$PWD/wayland-windowmanager-protocol.c + +} + + + -- cgit v0.12 From 2e38c0b2339cdf7241ef913197bef4b992895d55 Mon Sep 17 00:00:00 2001 From: Denis Oliver Kropp Date: Thu, 19 May 2011 15:02:03 +0200 Subject: directfb: Paint engine enhancements - Support negative scaling using DSBLIT_FLIP_HORIZONTAL/VERTICAL (DirectFB >= 1.4.3). - Implement drawing points. - Implement rectangular path filling. - Discard drawing when alpha is zero with SrcOver. - Also use DirectFB StretchBlit() if supported by hardware. - Unify/simplify pen/brush/composition support handling. - Enhance output when printing raster fallbacks. - Other minor cleanups. Merge-request: 991 Reviewed-by: Marcel Schuette --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 435 ++++++++++++++------- .../gfxdrivers/directfb/qdirectfbpaintengine.h | 1 + 2 files changed, 299 insertions(+), 137 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 18861cf..dfe5db4 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -63,27 +63,26 @@ class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { public: enum TransformationTypeFlags { - Matrix_NegativeScale = 0x100, + Matrix_NegativeScaleX = 0x100, + Matrix_NegativeScaleY = 0x200, Matrix_RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject), - Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported) +#if (Q_DIRECTFB_VERSION >= 0x010403) + Matrix_BlitsUnsupported = (Matrix_RectsUnsupported) +#else + Matrix_BlitsUnsupported = (Matrix_RectsUnsupported|Matrix_NegativeScaleX|Matrix_NegativeScaleY) +#endif }; inline static uint getTransformationType(const QTransform &transform) { int ret = transform.type(); - if (qMin(transform.m11(), transform.m22()) < 0) { - ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale; - } + if (transform.m11() < 0) + ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScaleX; + if (transform.m22() < 0) + ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScaleY; return ret; } - enum CompositionModeStatus { - PorterDuff_None = 0x0, - PorterDuff_Supported = 0x1, - PorterDuff_PremultiplyColors = 0x2, - PorterDuff_AlwaysBlend = 0x4 - }; - enum ClipType { ClipUnset, NoClip, @@ -95,25 +94,24 @@ public: QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p); ~QDirectFBPaintEnginePrivate(); - inline void setTransform(const QTransform &transforma); - inline void setPen(const QPen &pen); - inline void setCompositionMode(QPainter::CompositionMode mode); - inline void setRenderHints(QPainter::RenderHints hints); + void setBrush(const QBrush &brush); + void setCompositionMode(QPainter::CompositionMode mode); + void setPen(const QPen &pen); + void setTransform(const QTransform &transforma); + void setRenderHints(QPainter::RenderHints hints); - inline void setDFBColor(const QColor &color); + bool prepareForDraw(const QColor &color); - inline void lock(); - inline void unlock(); + void lock(); + void unlock(); static inline void unlock(QDirectFBPaintDevice *device); - inline bool isSimpleBrush(const QBrush &brush) const; - void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos, const QTransform &pixmapTransform); void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); - inline bool supportsStretchBlit() const; + bool supportsStretchBlit() const; - inline void updateClip(); + void updateClip(); virtual void systemStateChanged(); static IDirectFBSurface *getSurface(const QImage &img, bool *release); @@ -131,7 +129,8 @@ public: IDirectFBSurface *surface; bool antialiased; - bool simplePen; + bool supportedBrush; + bool supportedPen; uint transformationType; // this is QTransform::type() + Matrix_NegativeScale if qMin(transform.m11(), transform.m22()) < 0 @@ -141,13 +140,13 @@ public: ClipType clipType; QDirectFBPaintDevice *dfbDevice; - uint compositionModeStatus; + bool supportedComposition; bool isPremultiplied; bool inClip; QRect currentClip; - QDirectFBPaintEngine *q; + QDirectFBPaintEngine *engine; }; class SurfaceCache @@ -183,14 +182,27 @@ static QCache imageCache(4*1024*1024); // 4 MB #define VOID_ARG() static_cast(false) enum PaintOperation { - DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004, - DRAW_PIXMAP = 0x0008, DRAW_TILED_PIXMAP = 0x0010, STROKE_PATH = 0x0020, - DRAW_PATH = 0x0040, DRAW_POINTS = 0x0080, DRAW_ELLIPSE = 0x0100, - DRAW_POLYGON = 0x0200, DRAW_TEXT = 0x0400, FILL_PATH = 0x0800, - FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, DRAW_ROUNDED_RECT = 0x4000, - DRAW_STATICTEXT = 0x8000, ALL = 0xffff + DRAW_RECTS = 0x0001, + DRAW_LINES = 0x0002, + DRAW_IMAGE = 0x0004, + DRAW_PIXMAP = 0x0008, + DRAW_TILED_PIXMAP = 0x0010, + STROKE_PATH = 0x0020, + DRAW_PATH = 0x0040, + DRAW_POINTS = 0x0080, + DRAW_ELLIPSE = 0x0100, + DRAW_POLYGON = 0x0200, + DRAW_TEXT = 0x0400, + FILL_PATH = 0x0800, + FILL_RECT = 0x1000, + DRAW_COLORSPANS = 0x2000, + DRAW_ROUNDED_RECT = 0x4000, + DRAW_STATICTEXT = 0x8000, + ALL = 0xffff }; +//#define QT_DIRECTFB_WARN_ON_RASTERFALLBACKS ALL + enum { RasterWarn = 1, RasterDisable = 2 }; static inline uint rasterFallbacksMask(PaintOperation op) { @@ -268,8 +280,7 @@ static inline uint rasterFallbacksMask(PaintOperation op) template static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - uint transformationType, bool simplePen, - uint clipType, uint compositionModeStatus, + QDirectFBPaintEnginePrivate *priv, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three); @@ -283,20 +294,14 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * rasterFallbackWarn("Falling back to raster engine for", \ __FUNCTION__, \ state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ + d_func(), \ #one, one, #two, two, #three, three); \ break; \ case RasterDisable|RasterWarn: \ rasterFallbackWarn("Disabled raster engine operation", \ __FUNCTION__, \ state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ + d_func(), \ #one, one, #two, two, #three, three); \ case RasterDisable: \ return; \ @@ -304,6 +309,8 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * } template +static inline void drawPoints(const T *points, int n, const QTransform &transform, IDirectFBSurface *surface); +template static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface); template static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface); @@ -400,6 +407,14 @@ void QDirectFBPaintEngine::clipEnabledChanged() d->updateClip(); } +void QDirectFBPaintEngine::brushChanged() +{ + Q_D(QDirectFBPaintEngine); + d->setBrush(state()->brush); + + QRasterPaintEngine::brushChanged(); +} + void QDirectFBPaintEngine::penChanged() { Q_D(QDirectFBPaintEngine); @@ -494,23 +509,21 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) return; if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || !d->simplePen + || !d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedBrush + || !d->supportedComposition) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; } - if (brush.style() != Qt::NoBrush) { - d->setDFBColor(brush.color()); + if (brush.style() != Qt::NoBrush && d->prepareForDraw(brush.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects)(rects, rectCount, state()->matrix, d->surface)); } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects)(rects, rectCount, state()->matrix, d->surface)); } } @@ -524,23 +537,21 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) return; if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || !d->simplePen + || !d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedBrush + || !d->supportedComposition) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; } - if (brush.style() != Qt::NoBrush) { - d->setDFBColor(brush.color()); + if (brush.style() != Qt::NoBrush && d->prepareForDraw(brush.color())) { CLIPPED_PAINT(fillRects(rects, rectCount, state()->matrix, d->surface)); } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects)(rects, rectCount, state()->matrix, d->surface)); } } @@ -550,17 +561,16 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) Q_D(QDirectFBPaintEngine); const QPen &pen = state()->pen; - if (!d->simplePen + if (!d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); } } @@ -570,17 +580,16 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) Q_D(QDirectFBPaintEngine); const QPen &pen = state()->pen; - if (!d->simplePen + if (!d->supportedPen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); } } @@ -610,7 +619,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, */ #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + if (!d->supportedComposition || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size()) @@ -664,7 +673,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast(data); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + if (!d->supportedComposition || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) { @@ -701,7 +710,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset); - } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + } else if (!d->supportedComposition || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) || (!d->supportsStretchBlit() && state()->matrix.isScaling())) { @@ -740,18 +749,40 @@ void QDirectFBPaintEngine::drawPath(const QPainterPath &path) void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount) { - RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPoints(points, pointCount); + + const QPen &pen = state()->pen; + if (!d->supportedPen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->supportedComposition) { + RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); + d->lock(); + QRasterPaintEngine::drawPoints(points, pointCount); + return; + } + + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawPoints)(points, pointCount, state()->matrix, d->surface)); + } } void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount) { - RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPoints(points, pointCount); + + const QPen &pen = state()->pen; + if (!d->supportedPen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->supportedComposition) { + RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); + d->lock(); + QRasterPaintEngine::drawPoints(points, pointCount); + return; + } + + if (pen.style() != Qt::NoPen && d->prepareForDraw(pen.color())) { + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawPoints)(points, pointCount, state()->matrix, d->surface)); + } } void QDirectFBPaintEngine::drawEllipse(const QRectF &rect) @@ -793,6 +824,29 @@ void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { if (brush.style() == Qt::NoBrush) return; + + const QPainterPath::ElementType *elements = path.elements(); + const qreal *points = path.points(); + + if (path.elementCount() == 5) { + if (elements[0] == QPainterPath::MoveToElement + && elements[1] == QPainterPath::LineToElement + && elements[2] == QPainterPath::LineToElement + && elements[3] == QPainterPath::LineToElement + && elements[4] == QPainterPath::LineToElement) { + + if (points[1] == points[3] + && points[2] == points[4] + && points[5] == points[7] + && points[6] == points[0]) { + QRectF rect( points[0], points[1], points[4], points[5] ); + + fillRect( rect, brush ); + return; + } + } + } + RASTERFALLBACK(FILL_PATH, path, brush, VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); @@ -828,12 +882,13 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { break; } - d->setDFBColor(color); - const QRect r = state()->matrix.mapRect(rect).toRect(); - CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); + if (d->prepareForDraw(color)) { + const QRect r = state()->matrix.mapRect(rect).toRect(); + CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); + } return; } case Qt::TexturePattern: { @@ -842,7 +897,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) QTransform transform(stateTransform); transform.translate(brushOrigin.x(), brushOrigin.y()); transform = brush.transform() * transform; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) + if (!d->supportedComposition || (QDirectFBPaintEnginePrivate::getTransformationType(transform) & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) || (!d->supportsStretchBlit() && transform.isScaling())) { break; @@ -870,12 +925,11 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QDirectFBPaintEngine); if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { + || !d->supportedComposition) { RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); - } else { - d->setDFBColor(color); + } else if (d->prepareForDraw(color)) { const QRect r = state()->matrix.mapRect(rect).toRect(); CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); } @@ -909,12 +963,11 @@ void QDirectFBPaintEngine::initImageCache(int size) // ---- QDirectFBPaintEnginePrivate ---- - QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) - : surface(0), antialiased(false), simplePen(false), + : surface(0), antialiased(false), supportedBrush(false), supportedPen(false), transformationType(0), opacity(255), clipType(ClipUnset), dfbDevice(0), - compositionModeStatus(0), isPremultiplied(false), inClip(false), q(p) + supportedComposition(false), isPremultiplied(false), inClip(false), engine(p) { fb = QDirectFBScreen::instance()->dfb(); surfaceCache = new SurfaceCache; @@ -925,11 +978,6 @@ QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate() delete surfaceCache; } -bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const -{ - return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); -} - void QDirectFBPaintEnginePrivate::lock() { // We will potentially get a new pointer to the buffer after a @@ -961,25 +1009,9 @@ void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device) #endif } -void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) +void QDirectFBPaintEnginePrivate::setBrush(const QBrush &brush) { - transformationType = getTransformationType(transform); - setPen(q->state()->pen); -} - -void QDirectFBPaintEnginePrivate::setPen(const QPen &pen) -{ - if (pen.style() == Qt::NoPen) { - simplePen = true; - } else if (pen.style() == Qt::SolidLine - && !antialiased - && pen.brush().style() == Qt::SolidPattern - && pen.widthF() <= 1.0 - && (transformationType < QTransform::TxScale || pen.isCosmetic())) { - simplePen = true; - } else { - simplePen = false; - } + supportedBrush = (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); } void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) @@ -989,23 +1021,19 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0; if (forceRasterFallBack) { - compositionModeStatus = PorterDuff_None; + supportedComposition = false; return; } - compositionModeStatus = PorterDuff_Supported|PorterDuff_PremultiplyColors|PorterDuff_AlwaysBlend; + supportedComposition = true; switch (mode) { case QPainter::CompositionMode_Clear: surface->SetPorterDuff(surface, DSPD_CLEAR); break; case QPainter::CompositionMode_Source: surface->SetPorterDuff(surface, DSPD_SRC); - compositionModeStatus &= ~PorterDuff_AlwaysBlend; - if (!isPremultiplied) - compositionModeStatus &= ~PorterDuff_PremultiplyColors; break; case QPainter::CompositionMode_SourceOver: - compositionModeStatus &= ~PorterDuff_AlwaysBlend; surface->SetPorterDuff(surface, DSPD_SRC_OVER); break; case QPainter::CompositionMode_DestinationOver: @@ -1013,8 +1041,6 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; case QPainter::CompositionMode_SourceIn: surface->SetPorterDuff(surface, DSPD_SRC_IN); - if (!isPremultiplied) - compositionModeStatus &= ~PorterDuff_PremultiplyColors; break; case QPainter::CompositionMode_DestinationIn: surface->SetPorterDuff(surface, DSPD_DST_IN); @@ -1044,32 +1070,69 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; #endif default: - compositionModeStatus = PorterDuff_None; + supportedComposition = false; break; } } +void QDirectFBPaintEnginePrivate::setPen(const QPen &pen) +{ + if (pen.style() == Qt::NoPen) { + supportedPen = true; + } else if (pen.style() == Qt::SolidLine + && !antialiased + && pen.brush().style() == Qt::SolidPattern + && pen.widthF() <= 1.0 + && (transformationType < QTransform::TxScale || pen.isCosmetic())) { + supportedPen = true; + } else { + supportedPen = false; + } +} + +void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) +{ + transformationType = getTransformationType(transform); + setPen(engine->state()->pen); +} + void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) { const bool old = antialiased; antialiased = bool(hints & QPainter::Antialiasing); if (old != antialiased) { - setPen(q->state()->pen); + setPen(engine->state()->pen); } } void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags) { DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; - if (flags & Premultiplied) - blittingFlags |= DSBLIT_SRC_PREMULTIPLY; + +#if (Q_DIRECTFB_VERSION >= 0x010403) + if (transformationType & Matrix_NegativeScaleX) + blittingFlags |= DSBLIT_FLIP_HORIZONTAL; + + if (transformationType & Matrix_NegativeScaleY) + blittingFlags |= DSBLIT_FLIP_VERTICAL; +#endif + if (flags & HasAlpha) blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; + if (opacity != 255) { blittingFlags |= DSBLIT_BLEND_COLORALPHA; surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); } + if (flags & Premultiplied) { + if (blittingFlags & DSBLIT_BLEND_COLORALPHA) + blittingFlags |= DSBLIT_SRC_PREMULTCOLOR; + } else { + if (blittingFlags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) + blittingFlags |= DSBLIT_SRC_PREMULTIPLY; + } + surface->SetBlittingFlags(surface, blittingFlags); } @@ -1080,14 +1143,14 @@ static inline uint ALPHA_MUL(uint x, uint a) return t; } -void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) +bool QDirectFBPaintEnginePrivate::prepareForDraw(const QColor &color) { Q_ASSERT(surface); - Q_ASSERT(compositionModeStatus & PorterDuff_Supported); + Q_ASSERT(supportedComposition); const quint8 alpha = (opacity == 255 ? color.alpha() : ALPHA_MUL(color.alpha(), opacity)); QColor col; - if (compositionModeStatus & PorterDuff_PremultiplyColors) { + if (isPremultiplied) { col = QColor(ALPHA_MUL(color.red(), alpha), ALPHA_MUL(color.green(), alpha), ALPHA_MUL(color.blue(), alpha), @@ -1096,7 +1159,28 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) col = QColor(color.red(), color.green(), color.blue(), alpha); } surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha()); - surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND); + + bool blend = false; + + switch (engine->state()->composition_mode) { + case QPainter::CompositionMode_Clear: + case QPainter::CompositionMode_Source: + break; + case QPainter::CompositionMode_SourceOver: + if (alpha == 0) + return false; + + if (alpha != 255) + blend = true; + break; + default: + blend = true; + break; + } + + surface->SetDrawingFlags(surface, blend ? DSDRAW_BLEND : DSDRAW_NOFX); + + return true; } IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) @@ -1137,7 +1221,7 @@ IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, boo void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src) { const QRect sr = src.toRect(); - const QRect dr = q->state()->matrix.mapRect(dest).toRect(); + const QRect dr = engine->state()->matrix.mapRect(dest).toRect(); if (dr.isEmpty()) return; const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; @@ -1167,7 +1251,7 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off, const QTransform &pixmapTransform) { - const QTransform &transform = q->state()->matrix; + const QTransform &transform = engine->state()->matrix; Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) && !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported)); const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); @@ -1293,7 +1377,12 @@ void QDirectFBPaintEnginePrivate::updateClip() bool QDirectFBPaintEnginePrivate::supportsStretchBlit() const { #ifdef QT_DIRECTFB_STRETCHBLIT - return !(q->state()->renderHints & QPainter::SmoothPixmapTransform); + DFBGraphicsDeviceDescription desc; + + fb->GetDeviceDescription(fb, &desc); + + return !(engine->state()->renderHints & QPainter::SmoothPixmapTransform) + || (desc.acceleration_mask & DFXL_STRETCHBLIT); #else return false; #endif @@ -1334,10 +1423,32 @@ void SurfaceCache::clear() } -static inline QRect mapRect(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); } -static inline QRect mapRect(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); } +static inline QRect map(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); } +static inline QRect map(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); } static inline QLine map(const QTransform &transform, const QLine &line) { return transform.map(line); } static inline QLine map(const QTransform &transform, const QLineF &line) { return transform.map(line).toLine(); } +static inline QPoint map(const QTransform &transform, const QPoint &point) { return transform.map(point); } +static inline QPoint map(const QTransform &transform, const QPointF &point) { return transform.map(point).toPoint(); } + +template +static inline void drawPoints(const T *points, int n, const QTransform &transform, IDirectFBSurface *surface) +{ + if (n == 1) { + const QPoint p = map(transform, points[0]); + surface->FillRectangle(surface, p.x(), p.y(), 1, 1); + } else { + QVarLengthArray rectArray(n); + for (int i=0; iFillRectangles(surface, rectArray.constData(), n); + } +} + template static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface) { @@ -1361,12 +1472,12 @@ template static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) { if (n == 1) { - const QRect r = mapRect(transform, rects[0]); + const QRect r = map(transform, rects[0]); surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height()); } else { QVarLengthArray rectArray(n); for (int i=0; i static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) { for (int i=0; iDrawRectangle(surface, r.x(), r.y(), r.width(), r.height()); } } @@ -1389,14 +1500,18 @@ template inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr(const bool &) { return 0; } template static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - uint transformationType, bool simplePen, - uint clipType, uint compositionModeStatus, + QDirectFBPaintEnginePrivate *priv, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three) { QString out; QDebug dbg(&out); + + + dbg << "***"; + + dbg << msg << (QByteArray(func) + "()") << "painting on"; if (dev->devType() == QInternal::Widget) { dbg << static_cast(dev); @@ -1404,10 +1519,55 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << dev << "of type" << dev->devType(); } - dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) - << "simplePen" << simplePen - << "clipType" << clipType - << "compositionModeStatus" << compositionModeStatus; + dbg << "\n\t"; + + + dbg << ((priv->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) ? "*" : "") << QString::fromLatin1("transformationType 0x%1").arg(priv->transformationType, 3, 16, QLatin1Char('0')); + + dbg << priv->engine->state()->matrix; + + dbg << "\n\t"; + + + + dbg << (priv->supportedBrush ? "" : "*") << "supportedBrush" << priv->supportedBrush; + + dbg << priv->engine->state()->brush; + + dbg << "\n\t"; + + const QGradient *gradient = priv->engine->state()->brush.gradient(); + if (gradient) { + const QGradientStops &stops = gradient->stops(); + + dbg << "gradient: " << *gradient; + dbg << "stops: " << stops.count(); + dbg << "\n\t"; + + for (int i=0; isupportedPen ? "" : "*") << "supportedPen" << priv->supportedPen; + + dbg << priv->engine->state()->pen; + + dbg << "\n\t"; + + + + dbg << (priv->clipType == QDirectFBPaintEnginePrivate::ComplexClip ? "*" : "") << "clipType" << priv->clipType; + + dbg << "\n\t"; + + + dbg << (priv->supportedComposition ? "" : "*") << "supportedComposition" << priv->supportedComposition; + + dbg << "\n\t"; + const T1 *t1 = ptr(one); const T2 *t2 = ptr(two); @@ -1428,3 +1588,4 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * QT_END_NAMESPACE #endif // QT_NO_QWS_DIRECTFB + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index a3217d0..b71671d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -97,6 +97,7 @@ public: virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); virtual void clipEnabledChanged(); + virtual void brushChanged(); virtual void penChanged(); virtual void opacityChanged(); virtual void compositionModeChanged(); -- cgit v0.12 From 837f18f043b18410c1d93b9f1156acf729dad510 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 19 May 2011 14:43:53 +0200 Subject: Add QtPrivate::QEnableIf Needed for QtConcurrent. Like the new std::enable_if (in c++0x) Reviewed-by: Joao --- src/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 3e1f011..b3462de 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2770,6 +2770,12 @@ QT_LICENSED_MODULE(DBus) # define QT_NO_RAWFONT #endif +namespace QtPrivate { +//like std::enable_if +template struct QEnableIf; +template struct QEnableIf { typedef T Type; }; +} + QT_END_NAMESPACE QT_END_HEADER -- cgit v0.12 From 917f2ff617209bcc283eb3590b422bcf239c0537 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 18 Apr 2011 14:07:32 +0200 Subject: Support of lambdas in QtConcurrent::run Reviewed-by: Joao --- src/corelib/concurrent/qtconcurrentcompilertest.h | 14 +++ .../concurrent/qtconcurrentfunctionwrappers.h | 11 +-- src/corelib/concurrent/qtconcurrentrun.h | 75 ++++++++++++--- .../concurrent/qtconcurrentstoredfunctioncall.h | 105 +++++++++------------ src/corelib/global/qglobal.h | 3 + tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp | 67 +++++++++++++ 6 files changed, 194 insertions(+), 81 deletions(-) diff --git a/src/corelib/concurrent/qtconcurrentcompilertest.h b/src/corelib/concurrent/qtconcurrentcompilertest.h index fad0c35..86f01b3 100644 --- a/src/corelib/concurrent/qtconcurrentcompilertest.h +++ b/src/corelib/concurrent/qtconcurrentcompilertest.h @@ -57,6 +57,20 @@ QT_MODULE(Core) # define QT_TYPENAME typename #endif +namespace QtPrivate { + +template +class HasResultType { + typedef char Yes; + typedef void *No; + template static Yes test(int, const typename U::result_type * = 0); + template static No test(double); +public: + enum { Value = (sizeof(test(0)) == sizeof(Yes)) }; +}; + +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h index 98506a5..7a574f2 100644 --- a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h @@ -195,17 +195,10 @@ QtConcurrent::ConstMemberFunctionWrapper createFunctionWrapper(T (C::*func return QtConcurrent::ConstMemberFunctionWrapper(func); } - -template -void *lazyResultType_helper(int, typename T::result_type * = 0); -template -char lazyResultType_helper(double); - -template (0)) != sizeof(void*)> +template ::Value> struct LazyResultType { typedef typename Functor::result_type Type; }; template -struct LazyResultType { typedef void Type; }; - +struct LazyResultType { typedef void Type; }; template struct ReduceResultType; diff --git a/src/corelib/concurrent/qtconcurrentrun.h b/src/corelib/concurrent/qtconcurrentrun.h index 9fa8a27..9d46c61 100644 --- a/src/corelib/concurrent/qtconcurrentrun.h +++ b/src/corelib/concurrent/qtconcurrentrun.h @@ -71,63 +71,114 @@ namespace QtConcurrent { template QFuture run(T (*functionPointer)()) { - return (new QT_TYPENAME SelectStoredFunctorCall0::type(functionPointer))->start(); + return (new StoredFunctorCall0(functionPointer))->start(); } template QFuture run(T (*functionPointer)(Param1), const Arg1 &arg1) { - return (new QT_TYPENAME SelectStoredFunctorCall1::type(functionPointer, arg1))->start(); + return (new StoredFunctorCall1(functionPointer, arg1))->start(); } template QFuture run(T (*functionPointer)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) { - return (new QT_TYPENAME SelectStoredFunctorCall2::type(functionPointer, arg1, arg2))->start(); + return (new StoredFunctorCall2(functionPointer, arg1, arg2))->start(); } template QFuture run(T (*functionPointer)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) { - return (new QT_TYPENAME SelectStoredFunctorCall3::type(functionPointer, arg1, arg2, arg3))->start(); + return (new StoredFunctorCall3(functionPointer, arg1, arg2, arg3))->start(); } template QFuture run(T (*functionPointer)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) { - return (new QT_TYPENAME SelectStoredFunctorCall4::type(functionPointer, arg1, arg2, arg3, arg4))->start(); + return (new StoredFunctorCall4(functionPointer, arg1, arg2, arg3, arg4))->start(); } template QFuture run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) { - return (new QT_TYPENAME SelectStoredFunctorCall5::type(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); + return (new StoredFunctorCall5(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); } +#ifdef Q_COMPILER_DECLTYPE + +template +auto run(Functor functor) -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor()) result_type; + return (new StoredFunctorCall0(functor))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1)) result_type; + return (new StoredFunctorCall1(functor, arg1))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2)) result_type; + return (new StoredFunctorCall2(functor, arg1, arg2))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2, arg3)) result_type; + return (new StoredFunctorCall3(functor, arg1, arg2, arg3))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type; + return (new StoredFunctorCall4(functor, arg1, arg2, arg3, arg4))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type; + return (new StoredFunctorCall5(functor, arg1, arg2, arg3, arg4, arg5))->start(); +} + +#endif + template QFuture run(FunctionObject functionObject) { - return (new QT_TYPENAME SelectStoredFunctorCall0::type(functionObject))->start(); + return (new StoredFunctorCall0(functionObject))->start(); } template QFuture run(FunctionObject functionObject, const Arg1 &arg1) { - return (new QT_TYPENAME SelectStoredFunctorCall1::type(functionObject, arg1))->start(); + return (new StoredFunctorCall1(functionObject, arg1))->start(); } template QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2) { - return (new QT_TYPENAME SelectStoredFunctorCall2::type(functionObject, arg1, arg2))->start(); + return (new StoredFunctorCall2(functionObject, arg1, arg2))->start(); } template QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) { - return (new QT_TYPENAME SelectStoredFunctorCall3::type(functionObject, arg1, arg2, arg3))->start(); + return (new StoredFunctorCall3(functionObject, arg1, arg2, arg3))->start(); } template QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) { - return (new QT_TYPENAME SelectStoredFunctorCall4::type(functionObject, arg1, arg2, arg3, arg4))->start(); + return (new StoredFunctorCall4(functionObject, arg1, arg2, arg3, arg4))->start(); } template QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) { - return (new QT_TYPENAME SelectStoredFunctorCall5::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); + return (new StoredFunctorCall5(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); } template diff --git a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h index 82d95f6..2a90e39 100644 --- a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h +++ b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h @@ -66,10 +66,10 @@ struct StoredFunctorCall0: public RunFunctionTask }; -template -struct VoidStoredFunctorCall0: public RunFunctionTask +template +struct StoredFunctorCall0: public RunFunctionTask { - inline VoidStoredFunctorCall0(FunctionPointer _function) + inline StoredFunctorCall0(FunctionPointer _function) : function(_function) {} void runFunctor() { function(); } FunctionPointer function; @@ -77,13 +77,6 @@ struct VoidStoredFunctorCall0: public RunFunctionTask }; template -struct SelectStoredFunctorCall0 -{ - typedef typename SelectSpecialization::template - Type, - VoidStoredFunctorCall0 >::type type; -}; -template struct StoredFunctorPointerCall0: public RunFunctionTask { inline StoredFunctorPointerCall0(FunctionPointer * _function) @@ -276,10 +269,10 @@ struct StoredFunctorCall1: public RunFunctionTask Arg1 arg1; }; -template -struct VoidStoredFunctorCall1: public RunFunctionTask +template +struct StoredFunctorCall1: public RunFunctionTask { - inline VoidStoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) + inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) : function(_function), arg1(_arg1) {} void runFunctor() { function(arg1); } FunctionPointer function; @@ -287,13 +280,6 @@ struct VoidStoredFunctorCall1: public RunFunctionTask }; template -struct SelectStoredFunctorCall1 -{ - typedef typename SelectSpecialization::template - Type, - VoidStoredFunctorCall1 >::type type; -}; -template struct StoredFunctorPointerCall1: public RunFunctionTask { inline StoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1) @@ -486,10 +472,10 @@ struct StoredFunctorCall2: public RunFunctionTask Arg1 arg1; Arg2 arg2; }; -template -struct VoidStoredFunctorCall2: public RunFunctionTask +template +struct StoredFunctorCall2: public RunFunctionTask { - inline VoidStoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) + inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) : function(_function), arg1(_arg1), arg2(_arg2) {} void runFunctor() { function(arg1, arg2); } FunctionPointer function; @@ -497,13 +483,6 @@ struct VoidStoredFunctorCall2: public RunFunctionTask }; template -struct SelectStoredFunctorCall2 -{ - typedef typename SelectSpecialization::template - Type, - VoidStoredFunctorCall2 >::type type; -}; -template struct StoredFunctorPointerCall2: public RunFunctionTask { inline StoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2) @@ -696,10 +675,10 @@ struct StoredFunctorCall3: public RunFunctionTask Arg1 arg1; Arg2 arg2; Arg3 arg3; }; -template -struct VoidStoredFunctorCall3: public RunFunctionTask +template +struct StoredFunctorCall3: public RunFunctionTask { - inline VoidStoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} void runFunctor() { function(arg1, arg2, arg3); } FunctionPointer function; @@ -707,13 +686,6 @@ struct VoidStoredFunctorCall3: public RunFunctionTask }; template -struct SelectStoredFunctorCall3 -{ - typedef typename SelectSpecialization::template - Type, - VoidStoredFunctorCall3 >::type type; -}; -template struct StoredFunctorPointerCall3: public RunFunctionTask { inline StoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) @@ -906,10 +878,10 @@ struct StoredFunctorCall4: public RunFunctionTask Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; }; -template -struct VoidStoredFunctorCall4: public RunFunctionTask +template +struct StoredFunctorCall4: public RunFunctionTask { - inline VoidStoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} void runFunctor() { function(arg1, arg2, arg3, arg4); } FunctionPointer function; @@ -917,13 +889,6 @@ struct VoidStoredFunctorCall4: public RunFunctionTask }; template -struct SelectStoredFunctorCall4 -{ - typedef typename SelectSpecialization::template - Type, - VoidStoredFunctorCall4 >::type type; -}; -template struct StoredFunctorPointerCall4: public RunFunctionTask { inline StoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) @@ -1116,10 +1081,10 @@ struct StoredFunctorCall5: public RunFunctionTask Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; }; -template -struct VoidStoredFunctorCall5: public RunFunctionTask +template +struct StoredFunctorCall5: public RunFunctionTask { - inline VoidStoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); } FunctionPointer function; @@ -1127,13 +1092,6 @@ struct VoidStoredFunctorCall5: public RunFunctionTask }; template -struct SelectStoredFunctorCall5 -{ - typedef typename SelectSpecialization::template - Type, - VoidStoredFunctorCall5 >::type type; -}; -template struct StoredFunctorPointerCall5: public RunFunctionTask { inline StoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) @@ -1316,6 +1274,33 @@ struct SelectStoredConstMemberFunctionPointerCall5 Type, VoidStoredConstMemberFunctionPointerCall5 >::type type; }; + +template +class StoredFunctorCall : public RunFunctionTask +{ +public: + StoredFunctorCall(const Functor &f) : functor(f) { } + void runFunctor() + { + this->result = functor(); + } +private: + Functor functor; +}; +template +class StoredFunctorCall : public RunFunctionTask +{ +public: + StoredFunctorCall(const Functor &f) : functor(f) { } + void runFunctor() + { + functor(); + } +private: + Functor functor; +}; + + } //namespace QtConcurrent #endif // qdoc diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b3462de..f47c9a7 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -428,6 +428,7 @@ namespace QT_NAMESPACE {} # define Q_COMPILER_INITIALIZER_LISTS # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_LAMBDA +# define Q_COMPILER_DECLTYPE //# define Q_COMPILER_VARIADIC_TEMPLATES //# define Q_COMPILER_CLASS_ENUM //# define Q_COMPILER_DEFAULT_DELETE_MEMBERS @@ -524,6 +525,7 @@ namespace QT_NAMESPACE {} # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 /* C++0x features supported in GCC 4.3: */ # define Q_COMPILER_RVALUE_REFS +# define Q_COMPILER_DECLTYPE # endif # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 /* C++0x features supported in GCC 4.4: */ @@ -791,6 +793,7 @@ namespace QT_NAMESPACE {} # if __INTEL_COMPILER >= 1100 # define Q_COMPILER_RVALUE_REFS # define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_DECLTYPE # elif __INTEL_COMPILER >= 1200 # define Q_COMPILER_VARIADIC_TEMPLATES # define Q_COMPILER_AUTO_TYPE diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp index 1069cb5..be79a13 100644 --- a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -67,6 +67,8 @@ private slots: #if 0 void createFunctor(); #endif + void functor(); + void lambda(); }; #if 0 @@ -444,6 +446,71 @@ void tst_QtConcurrentRun::createFunctor() } #endif +struct Functor { + int operator()() { return 42; } + double operator()(double a, double b) { return a/b; } + int operator()(int a, int b) { return a/b; } + void operator()(int) { } + void operator()(int, int, int) { } + void operator()(int, int, int, int) { } + void operator()(int, int, int, int, int) { } + void operator()(int, int, int, int, int, int) { } +}; + +void tst_QtConcurrentRun::functor() +{ + //this test functor without result_type, decltype need to be supported by the compiler +#ifndef Q_COMPILER_DECLTYPE + QSKIP("Compiler do not suport decltype", SkipAll); +#else + Functor f; + { + QFuture fut = QtConcurrent::run(f); + QCOMPARE(fut.result(), 42); + } + { + QFuture fut = QtConcurrent::run(f, 8.5, 1.8); + QCOMPARE(fut.result(), (8.5/1.8)); + } + { + QFuture fut = QtConcurrent::run(f, 19, 3); + QCOMPARE(fut.result(), int(19/3)); + } + { + QtConcurrent::run(f, 1).waitForFinished(); + QtConcurrent::run(f, 1,2).waitForFinished(); + QtConcurrent::run(f, 1,2,3).waitForFinished(); + QtConcurrent::run(f, 1,2,3,4).waitForFinished(); + QtConcurrent::run(f, 1,2,3,4,5).waitForFinished(); + } +#endif +} + + +void tst_QtConcurrentRun::lambda() +{ +#ifndef Q_COMPILER_LAMBDA + QSKIP("Compiler do not suport lambda", SkipAll); +#else + + QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45); + QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15); + QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15)); + QCOMPARE(QtConcurrent::run([](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5); + +#ifdef Q_COMPILER_INITIALIZER_LISTS + { + QString str { "Hello World Foo" }; + QFuture f1 = QtConcurrent::run([&](){ return str.split(' '); }); + auto r = f1.result(); + QCOMPARE(r, QStringList({"Hello", "World", "Foo"})); + } +#endif + +#endif +} + + #include "tst_qtconcurrentrun.moc" #else -- cgit v0.12 From a09f5c425079405e72078813bdb7b103c29a5221 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 20 Apr 2011 13:49:19 +0200 Subject: MSVC do not really support initilizer_list std::initializer_list exists, but it is not possible to do bracket initialisation Reviewed-by: Joao --- src/corelib/global/qglobal.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index f47c9a7..32eedc7 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -425,15 +425,11 @@ namespace QT_NAMESPACE {} #if defined(Q_CC_MSVC) && _MSC_VER >= 1600 # define Q_COMPILER_RVALUE_REFS -# define Q_COMPILER_INITIALIZER_LISTS # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_LAMBDA # define Q_COMPILER_DECLTYPE -//# define Q_COMPILER_VARIADIC_TEMPLATES -//# define Q_COMPILER_CLASS_ENUM -//# define Q_COMPILER_DEFAULT_DELETE_MEMBERS -//# define Q_COMPILER_UNICODE_STRINGS -//# define Q_COMPILER_EXTERN_TEMPLATES +// MSCV has std::initilizer_list, but do not support the braces initilization +//# define Q_COMPILER_INITIALIZER_LISTS # endif -- cgit v0.12 From 38d1b31006ecc83811bbb13e5a4182eac593a970 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 18 May 2011 17:55:43 +0200 Subject: Tests for QtConcurrent::map using lambdas Also disable tests with std::vector in c++0x as they do not compile Reviewed-by: Joao --- tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp index 2f1adb4..8814cde 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -146,6 +146,15 @@ void tst_QtConcurrentMap::map() QCOMPARE(numberList, QList() << 2 << 4 << 6); QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished(); QCOMPARE(numberList, QList() << 4 << 8 << 12); + +#ifdef Q_COMPILER_LAMBDA + // lambda + QtConcurrent::map(list, [](int &x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList() << 128 << 256 << 384); + QtConcurrent::map(list.begin(), list.end(), [](int &x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList() << 256 << 512 << 768); +#endif + } // functors don't take arguments by reference, making these no-ops @@ -170,6 +179,14 @@ void tst_QtConcurrentMap::map() QCOMPARE(list, QList() << 1 << 2 << 3); QtConcurrent::map(list.begin(), list.end(), multiplyBy2Immutable).waitForFinished(); QCOMPARE(list, QList() << 1 << 2 << 3); + +#ifdef Q_COMPILER_LAMBDA + // lambda + QtConcurrent::map(list, [](int x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList() << 1 << 2 << 3); + QtConcurrent::map(list.begin(), list.end(), [](int x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList() << 1 << 2 << 3); +#endif } // Linked lists and forward iterators @@ -2303,6 +2320,10 @@ void tst_QtConcurrentMap::stlContainers() { #ifdef QT_NO_STL QSKIP("Qt compiled without STL support", SkipAll); +#elif defined(Q_COMPILER_RVALUE_REFS) + //mapped uses &Container::push_back, but in c++0x, std::vector has two overload of it + // meaning it is not possible to take the address of that function anymore. + QSKIP("mapped do not work with c++0x stl vector", SkipAll); #else std::vector vector; vector.push_back(1); -- cgit v0.12 From 841cd1500d153f5141f4c8a1e039f235c39d01f3 Mon Sep 17 00:00:00 2001 From: Denis Oliver Kropp Date: Thu, 19 May 2011 15:51:47 +0200 Subject: Fix brush transform in QtDirectFB backend, fixing QTBUG-18577 Merge-request: 1224 Reviewed-by: Marcel Schuette --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index dfe5db4..d90c8ca 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -1254,7 +1254,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix const QTransform &transform = engine->state()->matrix; Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) && !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported)); - const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); + const QRect destinationRect = dest.toRect(); QRect newClip = destinationRect; if (!currentClip.isEmpty()) newClip &= currentClip; @@ -1270,7 +1270,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix }; surface->SetClip(surface, &clip); - QPointF offset = pixmapTransform.inverted().map(off); + QPointF offset = off; Q_ASSERT(transform.type() <= QTransform::TxScale); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); -- cgit v0.12 From 14bf7c3761efe208ce19047b8ddc3f811a63a437 Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 19 May 2011 12:48:35 +0200 Subject: Revert "fix breakages in qpainter autotests." This reverts commit 50a53d2f7a7e12cd597dc72a08ad62b79fee4554. ...which was required because of 69fc9e594e6d5da87bff42707973683f84b67c93 "Fix how subpixel positions are intepreted in an aliased grid." which was reverted in f8e85838c5531b56c2175cbdb9c24db426f7fd89 because of 37c329a3e35fabc88fbcad824a69f37c671d2132 "New algorithm for drawing thin lines". phew! --- tests/auto/qpainter/tst_qpainter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 9844434..65ac2f9 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -1315,7 +1315,7 @@ void tst_QPainter::drawRect2() p.end(); QRect stroke = getPaintedSize(image, Qt::white); - QCOMPARE(stroke, fill.adjusted(0, 0, 1, 1)); + QCOMPARE(stroke.adjusted(1, 1, 0, 0), fill.adjusted(0, 0, 1, 1)); } } @@ -1412,13 +1412,13 @@ void tst_QPainter::drawPath_data() { QPainterPath p; p.addRect(2.25, 2.25, 10, 10); - QTest::newRow("non-aligned rect") << p << QRect(2, 2, 10, 10) << 10 * 10; + QTest::newRow("non-aligned rect") << p << QRect(3, 3, 10, 10) << 10 * 10; } { QPainterPath p; p.addRect(2.25, 2.25, 10.5, 10.5); - QTest::newRow("non-aligned rect 2") << p << QRect(2, 2, 11, 11) << 11 * 11; + QTest::newRow("non-aligned rect 2") << p << QRect(3, 3, 10, 10) << 10 * 10; } { -- cgit v0.12 From 7cfd06ee22a875d7658ce6668b418e6f8c6f6480 Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 19 May 2011 16:05:02 +0200 Subject: Compilation fix of f8e8583 --- src/gui/painting/qpaintengine_raster.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index b730be3..7dda940 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2928,6 +2928,7 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) if (matrix.type() == QTransform::TxScale) fe->setFontScale(matrix.m11()); ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); + const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta); for (int i=0; igetCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize); - const int x = qFloor(positions[i].x + metrics.x + aliasDelta); - const int y = qFloor(positions[i].y + metrics.y + aliasDelta); + const int x = qFloor(positions[i].x + tmetrics.HorizBearingX() + aliasDelta); + const int y = qFloor(positions[i].y - tmetrics.HorizBearingY() + aliasDelta); alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); } -- cgit v0.12 From aea5e35f57d061b133d2fa613d10f5e0118f5706 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Thu, 19 May 2011 16:30:44 +0200 Subject: Don't crash if windowmanager is not initialized This can happen if there is e.g. no wayland server. Reviewed-by: sroedal --- .../windowmanager_integration/qwaylandwindowmanagerintegration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp index 8a8e5a9..b93e6d2 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp @@ -79,6 +79,7 @@ void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *displa void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId) { - wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId); + if (mWaylandWindowManager) + wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId); } -- cgit v0.12 From 4af11f2c6666c55657569f946c33816f33711225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 19 May 2011 14:58:18 +0200 Subject: Compile fixes for Xlib plugin. --- src/plugins/platforms/xlib/qxlibscreen.cpp | 6 +++--- src/plugins/platforms/xlib/qxlibstatic.cpp | 4 ---- src/plugins/platforms/xlib/qxlibstatic.h | 1 + src/plugins/platforms/xlib/qxlibwindow.cpp | 17 +++++++++-------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index 7c8a367..920116a 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -41,6 +41,8 @@ #include "qxlibscreen.h" +#include + #include "qxlibcursor.h" #include "qxlibwindow.h" #include "qxlibkeyboard.h" @@ -54,8 +56,6 @@ #include -#include - QT_BEGIN_NAMESPACE static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); @@ -201,7 +201,7 @@ QXlibScreen::QXlibScreen() #ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay->nativeDisplay()); + int MIT_SHM_extension_supported = XShmQueryExtension (mDisplay->nativeDisplay()); Q_ASSERT(MIT_SHM_extension_supported == True); #endif original_x_errhandler = XSetErrorHandler(qt_x_errhandler); diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index 6117781..7b562ea 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -51,10 +51,6 @@ #include -#ifndef QT_NO_XFIXES -#include -#endif // QT_NO_XFIXES - static const char * x11_atomnames = { // window-manager <-> client protocols "WM_PROTOCOLS\0" diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h index 72cfaec..7d1a0d0 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.h +++ b/src/plugins/platforms/xlib/qxlibstatic.h @@ -132,6 +132,7 @@ typedef char *XPointer; #endif #ifndef QT_NO_XFIXES +#include typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 9a05fc6..90bcc0d 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -47,14 +47,6 @@ #include "qxlibstatic.h" #include "qxlibdisplay.h" -#include -#include -#include -#include - -#include -#include - #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) #include "qglxintegration.h" @@ -66,6 +58,15 @@ #endif //QT_OPENGL_ES_2 #endif //QT_NO_OPENGL + +#include +#include +#include +#include + +#include +#include + //#define MYX11_DEBUG QT_BEGIN_NAMESPACE -- cgit v0.12 From c15b41056e60abdbb4d835e27a360f01be618a4f Mon Sep 17 00:00:00 2001 From: Janusz Lewandowski Date: Thu, 19 May 2011 16:21:39 +0200 Subject: Lighthouse minimal: Add support for transparency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 1231 Reviewed-by: Samuel Rødal --- src/plugins/platforms/minimal/qminimalintegration.cpp | 4 ++-- src/plugins/platforms/minimal/qminimalintegration.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index 3a545e4..44a4eb6 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -50,8 +50,8 @@ QMinimalIntegration::QMinimalIntegration() QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); - mPrimaryScreen->mDepth = 16; - mPrimaryScreen->mFormat = QImage::Format_RGB16; + mPrimaryScreen->mDepth = 32; + mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied; mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 5f93443..993d364 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -51,7 +51,7 @@ class QMinimalScreen : public QPlatformScreen { public: QMinimalScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} + : mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) {} QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } -- cgit v0.12 From a3b627e1c5ce03a2500ab35c64729b1995639dcc Mon Sep 17 00:00:00 2001 From: Janusz Lewandowski Date: Thu, 19 May 2011 16:21:40 +0200 Subject: Lighthouse xcb and xlib: Add support for transparency of GLX windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 1231 Reviewed-by: Samuel Rødal --- .../platforms/glxconvenience/glxconvenience.pri | 8 ++++++ .../platforms/glxconvenience/qglxconvenience.cpp | 30 ++++++++++++++++------ .../qwaylandxcompositeglxcontext.cpp | 4 ++- src/plugins/platforms/xcb/qxcbwindow.cpp | 8 +++++- src/plugins/platforms/xcb/qxcbwindow.h | 6 +++++ src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 11 ++++---- src/plugins/platforms/xlib/qxlibintegration.cpp | 2 +- src/plugins/platforms/xlib/qxlibwindow.cpp | 13 ++++++++-- src/plugins/platforms/xlib/qxlibwindow.h | 8 ++++++ src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 13 +++++----- 10 files changed, 78 insertions(+), 25 deletions(-) diff --git a/src/plugins/platforms/glxconvenience/glxconvenience.pri b/src/plugins/platforms/glxconvenience/glxconvenience.pri index d6c9922..b4d43a3 100644 --- a/src/plugins/platforms/glxconvenience/glxconvenience.pri +++ b/src/plugins/platforms/glxconvenience/glxconvenience.pri @@ -5,3 +5,11 @@ HEADERS += \ SOURCES += \ $$PWD/qglxconvenience.cpp + +CONFIG += xrender + +xrender { + LIBS += -lXrender +} else { + DEFINES += QT_NO_XRENDER +} diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp index 7cee3e2..eb0f6a6 100644 --- a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp +++ b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp @@ -43,6 +43,10 @@ #include +#ifndef QT_NO_XRENDER +#include +#endif + enum { XFocusOut = FocusOut, XFocusIn = FocusIn, @@ -84,14 +88,15 @@ QVector qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); } - spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + if (format.accum()) { + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - if (format.alpha()) { - spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } } - } else { spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; @@ -136,8 +141,17 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow if (reducedFormat.alpha()) { int alphaSize; glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize); - if (alphaSize > 0) - break; + if (alphaSize > 0) { + XVisualInfo *visual = glXGetVisualFromFBConfig(display, chosenConfig); +#if !defined(QT_NO_XRENDER) + XRenderPictFormat *pictFormat = XRenderFindVisualFormat(display, visual->visual); + if (pictFormat->direct.alphaMask > 0) + break; +#else + if (visual->depth == 32) + break; +#endif + } } else { break; // Just choose the first in the list if there's no alpha requested } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp index caf5117..baf0fa3 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp @@ -132,10 +132,12 @@ void QWaylandXCompositeGLXContext::geometryChanged() Colormap cmap = XCreateColormap(mGlxIntegration->xDisplay(),mGlxIntegration->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; + a.background_pixel = WhitePixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen()); + a.border_pixel = BlackPixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen()); a.colormap = cmap; mXWindow = XCreateWindow(mGlxIntegration->xDisplay(), mGlxIntegration->rootWindow(),0, 0, size.width(), size.height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); + CWBackPixel|CWBorderPixel|CWColormap, &a); XCompositeRedirectWindow(mGlxIntegration->xDisplay(), mXWindow, CompositeRedirectManual); XMapWindow(mGlxIntegration->xDisplay(), mXWindow); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0456638..3365c22 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -131,13 +131,17 @@ QXcbWindow::QXcbWindow(QWidget *tlw) visualInfo = XGetVisualInfo(DISPLAY_FROM_XCB(this), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //XCB_USE_GLX if (visualInfo) { + m_depth = visualInfo->depth; + m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); XSetWindowAttributes a; + a.background_pixel = WhitePixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber()); + a.border_pixel = BlackPixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber()); a.colormap = cmap; m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); + CWBackPixel|CWBorderPixel|CWColormap, &a); printf("created GL window: %d\n", m_window); } else { @@ -147,6 +151,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) #endif //defined(XCB_USE_GLX) || defined(XCB_USE_EGL) { m_window = xcb_generate_id(xcb_connection()); + m_depth = m_screen->screen()->root_depth; + m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; Q_XCB_CALL(xcb_create_window(xcb_connection(), XCB_COPY_FROM_PARENT, // depth -- same as root diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index e049837..20b4640 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -74,6 +75,8 @@ public: QPlatformGLContext *glContext() const; xcb_window_t window() const { return m_window; } + uint depth() const { return m_depth; } + QImage::Format format() const { return m_format; } void handleExposeEvent(const xcb_expose_event_t *event); void handleClientMessageEvent(const xcb_client_message_event_t *event); @@ -99,6 +102,9 @@ private: xcb_window_t m_window; QPlatformGLContext *m_context; + uint m_depth; + QImage::Format m_format; + xcb_sync_int64_t m_syncValue; xcb_sync_counter_t m_syncCounter; diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 718f093..38c01f9 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -58,7 +58,7 @@ class QXcbShmImage : public QXcbObject { public: - QXcbShmImage(QXcbScreen *connection, const QSize &size); + QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); ~QXcbShmImage() { destroy(); } QImage *image() { return &m_qimage; } @@ -81,7 +81,7 @@ private: QRegion m_dirty; }; -QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) +QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format) : QXcbObject(screen->connection()) , m_gc(0) , m_gc_window(0) @@ -91,7 +91,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) size.width(), size.height(), XCB_IMAGE_FORMAT_Z_PIXMAP, - screen->depth(), + depth, 0, ~0, 0); @@ -111,7 +111,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1) qWarning() << "QXcbWindowSurface: Error while marking the shared memory segment to be destroyed"; - m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, screen->format()); + m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format); } void QXcbShmImage::destroy() @@ -232,9 +232,10 @@ void QXcbWindowSurface::resize(const QSize &size) QWindowSurface::resize(size); QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(window())); + QXcbWindow* win = static_cast(window()->platformWindow()); delete m_image; - m_image = new QXcbShmImage(screen, size); + m_image = new QXcbShmImage(screen, size, win->depth(), win->format()); Q_XCB_NOOP(connection()); m_syncingResize = true; diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 78f907a..b0c8bc9 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -150,7 +150,7 @@ bool QXlibIntegration::hasOpenGL() const { #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast(mScreens.at(0)); + QXlibScreen *screen = static_cast(mScreens.at(0)); return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 90bcc0d..4efcb11 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -102,18 +102,27 @@ QXlibWindow::QXlibWindow(QWidget *window) visualInfo = XGetVisualInfo(mScreen->display()->nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //!defined(QT_OPENGL_ES_2) if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + mDepth = visualInfo->depth; + mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + mVisual = visualInfo->visual; + Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), visualInfo->visual, AllocNone); XSetWindowAttributes a; + a.background_pixel = WhitePixel(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber()); + a.border_pixel = BlackPixel(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber()); a.colormap = cmap; x_window = XCreateWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); + CWBackPixel|CWBorderPixel|CWColormap, &a); } else { qFatal("no window!"); } #endif //!defined(QT_NO_OPENGL) } else { + mDepth = mScreen->depth(); + mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + mVisual = mScreen->defaultVisual(); + x_window = XCreateSimpleWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, mScreen->blackPixel(), mScreen->whitePixel()); diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index 08694a5..2d11224 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -122,6 +122,10 @@ public: Window xWindow() const; GC graphicsContext() const; + inline uint depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + Visual* visual() const { return mVisual; } + protected: QVector getNetWmState() const; void setMWMHints(const QXlibMWMHints &mwmhints); @@ -135,6 +139,10 @@ private: Window x_window; GC gc; + uint mDepth; + QImage::Format mFormat; + Visual* mVisual; + GC createGC(); QPlatformGLContext *mGLContext; diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index 513f10d..78fe387 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -80,20 +80,19 @@ void QXlibShmImageInfo::destroy() void QXlibWindowSurface::resizeShmImage(int width, int height) { + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); + QXlibWindow *win = static_cast(window()->platformWindow()); #ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); + shm_img = QImage(width, height, win->format()); #else - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); if (image_info) image_info->destroy(); else image_info = new QXlibShmImageInfo(screen->display()->nativeDisplay()); - Visual *visual = screen->defaultVisual(); - - XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), visual, 24, ZPixmap, 0, + XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), win->visual(), win->depth(), ZPixmap, 0, &image_info->shminfo, width, height); @@ -160,11 +159,11 @@ void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPo #ifdef DONT_USE_MIT_SHM // just convert the image every time... if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + QXlibWindow *win = static_cast(window()->platformWindow()); QImage image = shm_img; //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, + XImage *xi = XCreateImage(screen->display(), win->visual(), win->depth(), ZPixmap, 0, (char *) image.scanLine(0), image.width(), image.height(), 32, image.bytesPerLine()); -- cgit v0.12 From 6241e39cff9311c943430ff2f31236b13618f2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 19 May 2011 16:18:21 +0200 Subject: Full translucent background support in xcb and xlib backend. Make sure to pick an alpha visual also for non-GL surface types, and to ask for alpha in the window format if the WA_TranslucentBackground attribute is set. Reviewed-by: Janusz Lewandowski --- src/gui/kernel/qwidget_qpa.cpp | 11 +++++++++-- src/opengl/qgl_qpa.cpp | 2 ++ src/opengl/qwindowsurface_gl.cpp | 18 +++++++++++++----- src/plugins/platforms/xcb/qxcbwindow.cpp | 3 ++- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 11 +++++++++++ src/plugins/platforms/xlib/qxlibwindow.cpp | 8 +++++--- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 14 +++++++++++++- 7 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 001810e..960073c 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -731,12 +731,19 @@ QPlatformWindowFormat QWidget::platformWindowFormat() const { Q_D(const QWidget); + QPlatformWindowFormat format; + QTLWExtra *extra = d->maybeTopData(); if (extra){ - return extra->platformWindowFormat; + format = extra->platformWindowFormat; } else { - return QPlatformWindowFormat::defaultFormat(); + format = QPlatformWindowFormat::defaultFormat(); } + + if (testAttribute(Qt::WA_TranslucentBackground)) + format.setAlpha(true); + + return format; } void QWidgetPrivate::createSysExtra() diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 994344c..9da650f 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -150,6 +150,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) if (shareContext) { winFormat.setSharedContext(shareContext->d_func()->platformContext); } + if (widget->testAttribute(Qt::WA_TranslucentBackground)) + winFormat.setAlpha(true); winFormat.setWindowApi(QPlatformWindowFormat::OpenGL); winFormat.setWindowSurface(false); widget->setPlatformWindowFormat(winFormat); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 49b3dc2..ff57446 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -542,19 +542,27 @@ void QGLWindowSurface::beginPaint(const QRegion &) d_ptr->did_paint = true; updateGeometry(); - if (!context()) - return; - int clearFlags = 0; - if (context()->d_func()->workaround_needsFullClearOnEveryFrame) + QGLContext *ctx = reinterpret_cast(window()->d_func()->extraData()->glContext); + + if (!ctx) + return; + + if (ctx->d_func()->workaround_needsFullClearOnEveryFrame) clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; - else if (context()->format().alpha()) + else if (ctx->format().alpha()) clearFlags = GL_COLOR_BUFFER_BIT; if (clearFlags) { + if (d_ptr->fbo) + d_ptr->fbo->bind(); + glClearColor(0.0, 0.0, 0.0, 0.0); glClear(clearFlags); + + if (d_ptr->fbo) + d_ptr->fbo->release(); } } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 3365c22..0dd29eb 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -113,7 +113,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) #if defined(XCB_USE_GLX) || defined(XCB_USE_EGL) if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) + && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) + || tlw->platformWindowFormat().alpha()) { #if defined(XCB_USE_GLX) XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), tlw->platformWindowFormat()); diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 38c01f9..88a54dc 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -54,6 +54,7 @@ #include #include +#include class QXcbShmImage : public QXcbObject { @@ -189,6 +190,16 @@ QPaintDevice *QXcbWindowSurface::paintDevice() void QXcbWindowSurface::beginPaint(const QRegion ®ion) { m_image->preparePaint(region); + + if (m_image->image()->hasAlphaChannel()) { + QPainter p(m_image->image()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector rects = region.rects(); + const QColor blank = Qt::transparent; + for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } + } } void QXcbWindowSurface::endPaint(const QRegion &) diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 4efcb11..50ea7b5 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -81,9 +81,10 @@ QXlibWindow::QXlibWindow(QWidget *window) int w = window->width(); int h = window->height(); - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) ) { #if !defined(QT_NO_OPENGL) + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) + || window->platformWindowFormat().alpha()) { #if !defined(QT_OPENGL_ES_2) XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(),mScreen->xScreenNumber(),window->platformWindowFormat()); #else @@ -117,8 +118,9 @@ QXlibWindow::QXlibWindow(QWidget *window) } else { qFatal("no window!"); } + } else #endif //!defined(QT_NO_OPENGL) - } else { + { mDepth = mScreen->depth(); mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; mVisual = mScreen->defaultVisual(); diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index 78fe387..a917f45 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -49,6 +49,8 @@ #include "qxlibscreen.h" #include "qxlibdisplay.h" +#include "qpainter.h" + # include # include # include @@ -108,7 +110,7 @@ void QXlibWindowSurface::resizeShmImage(int width, int height) Q_ASSERT(shm_attach_status == True); - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, win->format() ); #endif painted = false; } @@ -213,6 +215,16 @@ void QXlibWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); resizeBuffer(size()); + + if (shm_img.hasAlphaChannel()) { + QPainter p(&shm_img); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector rects = region.rects(); + const QColor blank = Qt::transparent; + for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } + } } void QXlibWindowSurface::endPaint(const QRegion ®ion) -- cgit v0.12 From a0b2fc44ff8752193cacde52276b1822741f5374 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 20 May 2011 14:22:39 +1000 Subject: Notify when the TextInput cursorRectangle property changes within pre-edit Anything that updates the horizontal scroll is also likely to change the position of the cursor rectangle and the micro focus. So group these actions together and ensure they're done before emitting cursorPositionChanged() so positionToRectangle() returns a valid value from that handler. Change-Id: I5fadc58efb148a8dabe88a94381c86cd64dba3bd Task-number: QTBUG-19089 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativetextinput.cpp | 54 ++++++++-------------- .../graphicsitems/qdeclarativetextinput_p.h | 5 +- .../tst_qdeclarativetextinput.cpp | 10 ++++ 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 9a91769..226cce9 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -236,11 +236,11 @@ void QDeclarativeTextInput::setFont(const QFont &font) if (oldFont != d->font) { d->control->setFont(d->font); + updateSize(); + updateCursorRectangle(); if(d->cursorItem){ d->cursorItem->setHeight(QFontMetrics(d->font).height()); - moveCursor(); } - updateSize(); } emit fontChanged(d->sourceFont); } @@ -359,8 +359,7 @@ void QDeclarativeTextInput::setHAlign(HAlignment align) bool forceAlign = d->hAlignImplicit && d->effectiveLayoutMirror; d->hAlignImplicit = false; if (d->setHAlign(align, forceAlign) && isComponentComplete()) { - updateRect(); - d->updateHorizontalScroll(); + updateCursorRectangle(); } } @@ -369,8 +368,7 @@ void QDeclarativeTextInput::resetHAlign() Q_D(QDeclarativeTextInput); d->hAlignImplicit = true; if (d->determineHorizontalAlignment() && isComponentComplete()) { - updateRect(); - d->updateHorizontalScroll(); + updateCursorRectangle(); } } @@ -423,8 +421,7 @@ void QDeclarativeTextInputPrivate::mirrorChange() Q_Q(QDeclarativeTextInput); if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeTextInput::AlignRight || hAlign == QDeclarativeTextInput::AlignLeft)) { - q->updateRect(); - updateHorizontalScroll(); + q->updateCursorRectangle(); emit q->effectiveHorizontalAlignmentChanged(); } } @@ -683,7 +680,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b) d->autoScroll = b; //We need to repaint so that the scrolling is taking into account. updateSize(true); - d->updateHorizontalScroll(); + updateCursorRectangle(); emit autoScrollChanged(d->autoScroll); } @@ -947,10 +944,6 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c) d->cursorComponent = c; if(!c){ //note that the components are owned by something else - disconnect(d->control, SIGNAL(cursorPositionChanged(int,int)), - this, SLOT(moveCursor())); - disconnect(d->control, SIGNAL(updateMicroFocus()), - this, SLOT(moveCursor())); delete d->cursorItem; }else{ d->startCreatingCursor(); @@ -962,10 +955,6 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c) void QDeclarativeTextInputPrivate::startCreatingCursor() { Q_Q(QDeclarativeTextInput); - q->connect(control, SIGNAL(cursorPositionChanged(int,int)), - q, SLOT(moveCursor()), Qt::UniqueConnection); - q->connect(control, SIGNAL(updateMicroFocus()), - q, SLOT(moveCursor()), Qt::UniqueConnection); if(cursorComponent->isReady()){ q->createCursor(); }else if(cursorComponent->isLoading()){ @@ -1001,15 +990,6 @@ void QDeclarativeTextInput::createCursor() d->cursorItem->setHeight(d->control->height()-1); // -1 to counter QLineControl's +1 which is not consistent with Text. } -void QDeclarativeTextInput::moveCursor() -{ - Q_D(QDeclarativeTextInput); - if(!d->cursorItem) - return; - d->updateHorizontalScroll(); - d->cursorItem->setX(d->control->cursorToX() - d->hscroll); -} - /*! \qmlmethod rect TextInput::positionToRectangle(int pos) @@ -1118,8 +1098,6 @@ void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev) ev->ignore(); } else { d->control->processInputMethodEvent(ev); - updateSize(); - d->updateHorizontalScroll(); } } if (!ev->isAccepted()) @@ -1297,7 +1275,7 @@ void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry, Q_D(QDeclarativeTextInput); if (newGeometry.width() != oldGeometry.width()) { updateSize(); - d->updateHorizontalScroll(); + updateCursorRectangle(); } QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); } @@ -1643,7 +1621,6 @@ void QDeclarativeTextInput::moveCursorSelection(int position) { Q_D(QDeclarativeTextInput); d->control->moveCursor(position, true); - d->updateHorizontalScroll(); } /*! @@ -1900,7 +1877,7 @@ void QDeclarativeTextInputPrivate::init() canPaste = !control->isReadOnly() && QApplication::clipboard()->text().length() != 0; #endif // QT_NO_CLIPBOARD q->connect(control, SIGNAL(updateMicroFocus()), - q, SLOT(updateMicroFocus())); + q, SLOT(updateCursorRectangle())); q->connect(control, SIGNAL(displayTextChanged(QString)), q, SLOT(updateRect())); q->updateSize(); @@ -1916,9 +1893,7 @@ void QDeclarativeTextInputPrivate::init() void QDeclarativeTextInput::cursorPosChanged() { Q_D(QDeclarativeTextInput); - d->updateHorizontalScroll(); - updateRect();//TODO: Only update rect between pos's - updateMicroFocus(); + updateCursorRectangle(); emit cursorPositionChanged(); d->control->resetCursorBlinkTimer(); @@ -1934,6 +1909,17 @@ void QDeclarativeTextInput::cursorPosChanged() } } +void QDeclarativeTextInput::updateCursorRectangle() +{ + Q_D(QDeclarativeTextInput); + d->updateHorizontalScroll(); + updateRect();//TODO: Only update rect between pos's + updateMicroFocus(); + emit cursorRectangleChanged(); + if (d->cursorItem) + d->cursorItem->setX(d->control->cursorToX() - d->hscroll); +} + void QDeclarativeTextInput::selectionChanged() { Q_D(QDeclarativeTextInput); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index ec70e43..171db92 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -75,7 +75,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) - Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorPositionChanged) + Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged) Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged) Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged) @@ -221,6 +221,7 @@ public: Q_SIGNALS: void textChanged(); void cursorPositionChanged(); + void cursorRectangleChanged(); void selectionStartChanged(); void selectionEndChanged(); void selectedTextChanged(); @@ -279,8 +280,8 @@ private Q_SLOTS: void q_textChanged(); void selectionChanged(); void createCursor(); - void moveCursor(); void cursorPosChanged(); + void updateCursorRectangle(); void updateRect(const QRect &r = QRect()); void q_canPasteChanged(); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index a241241..3349d34 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -2431,15 +2431,20 @@ void tst_qdeclarativetextinput::preeditAutoScroll() QTest::qWaitForWindowShown(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); + QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged())); + int cursorRectangleChanges = 0; + // test the text is scrolled so the preedit is visible. ic.sendPreeditText(preeditText.mid(0, 3), 1); QVERIFY(input.positionAt(0) != 0); QVERIFY(input.cursorRectangle().left() < input.boundingRect().width()); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); // test the text is scrolled back when the preedit is removed. ic.sendEvent(QInputMethodEvent()); QCOMPARE(input.positionAt(0), 0); QCOMPARE(input.positionAt(input.width()), 5); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); // some tolerance for different fonts. #ifdef Q_OS_LINUX @@ -2455,26 +2460,31 @@ void tst_qdeclarativetextinput::preeditAutoScroll() ic.sendPreeditText(preeditText, i + 1); QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error); QVERIFY(input.positionToRectangle(0).x() < x); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); x = input.positionToRectangle(0).x(); } for (int i = 1; i >= 0; --i) { ic.sendPreeditText(preeditText, i + 1); QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error); QVERIFY(input.positionToRectangle(0).x() > x); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); x = input.positionToRectangle(0).x(); } // Test incrementing the preedit cursor doesn't cause further // scrolling when right most text is visible. ic.sendPreeditText(preeditText, preeditText.length() - 3); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); x = input.positionToRectangle(0).x(); for (int i = 2; i >= 0; --i) { ic.sendPreeditText(preeditText, preeditText.length() - i); QCOMPARE(input.positionToRectangle(0).x(), x); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); } for (int i = 1; i < 3; ++i) { ic.sendPreeditText(preeditText, preeditText.length() - i); QCOMPARE(input.positionToRectangle(0).x(), x); + QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); } // Test disabling auto scroll. -- cgit v0.12 From ed0ecda733b5f844b385f57fb00f3801427c30b6 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 20 May 2011 09:16:14 +0200 Subject: Fix QtDeclarative def file for winscw. A symbol became absent for some reason, which broke the building of the declarativeobserver plug-in. The ABSENT is now removed. Reviewed-by: TRUSTME --- src/s60installs/bwins/QtDeclarativeu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 18639fd..8206a76 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1716,7 +1716,7 @@ EXPORTS ?inWorkerThread@QDeclarativeListModel@@ABE_NXZ @ 1715 NONAME ABSENT ; bool QDeclarativeListModel::inWorkerThread(void) const ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ABSENT ; bool QDeclarativeListModel::canMove(int, int, int) const ?getScriptEngine@QDeclarativeDebugHelper@@SAPAVQScriptEngine@@PAVQDeclarativeEngine@@@Z @ 1717 NONAME ABSENT ; class QScriptEngine * QDeclarativeDebugHelper::getScriptEngine(class QDeclarativeEngine *) - ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ABSENT ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) + ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) ?add@QDeclarativeBasePositioner@@QBEPAVQDeclarativeTransition@@XZ @ 1719 NONAME ABSENT ; class QDeclarativeTransition * QDeclarativeBasePositioner::add(void) const ?setLoops@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1720 NONAME ABSENT ; void QDeclarativeAbstractAnimation::setLoops(int) ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1721 NONAME ABSENT ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *) -- cgit v0.12 From c8a3c427e96ee11907592f5c7f72046795c027ed Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 20 May 2011 09:31:16 +0200 Subject: Fix typo in comment --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 32eedc7..80d364a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -428,7 +428,7 @@ namespace QT_NAMESPACE {} # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_LAMBDA # define Q_COMPILER_DECLTYPE -// MSCV has std::initilizer_list, but do not support the braces initilization +// MSCV has std::initilizer_list, but do not support the braces initialization //# define Q_COMPILER_INITIALIZER_LISTS # endif -- cgit v0.12 From 29a6523dd8d3fac9be198c73153691c6dcdb3b21 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 10 Aug 2010 15:58:25 +0200 Subject: Make selection work across ligatures For widgets like QPlainTextEdit, selection across ligatures (typically 'fi', 'ffi', 'fl', etc.) end up highlighting the entire ligature glyphs, this patch fixed that by dividing width inside the ligature so that selection will not expand past the actual selected characters. Since cursor position already considered this, we merely adopted the algorithm and made it a separated helper function for all necessary cases. Dividing width directly looks like a temporary workaround but works well enough so far for cursor positions. Task-number: QTBUG-11969 Reviewed-by: Eskil (cherry picked from commit 99fd5825dfb4d50cff93165995701a65b7a8e4ed) --- src/gui/text/qtextlayout.cpp | 64 +++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index c34a04b..7328ea9 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1011,6 +1011,35 @@ QScriptItem &QTextLineItemIterator::next() return *si; } +static QFixed offsetInLigature(const unsigned short *logClusters, + const QGlyphLayout &glyphs, + int pos, int max, int glyph_pos) +{ + int offsetInCluster = 0; + for (int i = pos - 1; i >= 0; i--) { + if (logClusters[i] == glyph_pos) + offsetInCluster++; + else + break; + } + + // in the case that the offset is inside a (multi-character) glyph, + // interpolate the position. + if (offsetInCluster > 0) { + int clusterLength = 0; + for (int i = pos - offsetInCluster; i < max; i++) { + if (logClusters[i] == glyph_pos) + clusterLength++; + else + break; + } + if (clusterLength) + return glyphs.advances_x[glyph_pos] * offsetInCluster / clusterLength; + } + + return 0; +} + bool QTextLineItemIterator::getSelectionBounds(QFixed *selectionX, QFixed *selectionWidth) const { *selectionX = *selectionWidth = 0; @@ -1050,8 +1079,19 @@ bool QTextLineItemIterator::getSelectionBounds(QFixed *selectionX, QFixed *selec swidth += glyphs.effectiveAdvance(g); } - *selectionX = x + soff; - *selectionWidth = swidth; + // If the starting character is in the middle of a ligature, + // selection should only contain the right part of that ligature + // glyph, so we need to get the width of the left part here and + // add it to *selectionX + QFixed leftOffsetInLigature = offsetInLigature(logClusters, glyphs, from, + to, start_glyph); + *selectionX = x + soff + leftOffsetInLigature; + *selectionWidth = swidth - leftOffsetInLigature; + // If the ending character is also part of a ligature, swidth does + // not contain that part yet, we also need to find out the width of + // that left part + *selectionWidth += offsetInLigature(logClusters, glyphs, to, + eng->length(item), end_glyph); } return true; } @@ -2465,14 +2505,6 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const if(pos == l) x += si->width; } else { - int offsetInCluster = 0; - for (int i=pos-1; i >= 0; i--) { - if (logClusters[i] == glyph_pos) - offsetInCluster++; - else - break; - } - if (reverse) { int end = qMin(lineEnd, si->position + l) - si->position; int glyph_end = end == l ? si->num_glyphs : logClusters[end]; @@ -2484,17 +2516,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const for (int i = glyph_start; i < glyph_pos; i++) x += glyphs.effectiveAdvance(i); } - if (offsetInCluster > 0) { // in the case that the offset is inside a (multi-character) glyph, interpolate the position. - int clusterLength = 0; - for (int i=pos - offsetInCluster; i < line.length; i++) { - if (logClusters[i] == glyph_pos) - clusterLength++; - else - break; - } - if (clusterLength) - x+= glyphs.advances_x[glyph_pos] * offsetInCluster / clusterLength; - } + x += offsetInLigature(logClusters, glyphs, pos, line.length, glyph_pos); } *cursorPos = pos + si->position; -- cgit v0.12 From 0ccf01368adcabbb25958a55976083f72116a2d5 Mon Sep 17 00:00:00 2001 From: Martin Petersson Date: Fri, 20 May 2011 10:04:18 +0200 Subject: tst_qhostinfo: Fix IPv6 lookup detection on Windows. Moved the QTcpServer test to init winsock before we use getaddrinfo. Reviewed-by: Shane Kearns --- tests/auto/qhostinfo/tst_qhostinfo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index af0631e..7657035 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -213,6 +213,13 @@ void tst_QHostInfo::initTestCase() #else ipv6Available = false; ipv6LookupsAvailable = false; + + QTcpServer server; + if (server.listen(QHostAddress("::1"))) { + // We have IPv6 support + ipv6Available = true; + } + #if !defined(QT_NO_GETADDRINFO) // check if the system getaddrinfo can do IPv6 lookups struct addrinfo hint, *result = 0; @@ -235,13 +242,6 @@ void tst_QHostInfo::initTestCase() #endif #endif - QTcpServer server; - if (server.listen(QHostAddress("::1"))) { - // We have IPv6 support - ipv6Available = true; - } - - // run each testcase with and without test enabled QTest::addColumn("cache"); QTest::newRow("WithCache") << true; -- cgit v0.12 From d80949eee06ff464d58bd97a6c89bae7e961f3c8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 19 May 2011 12:40:03 +0200 Subject: Fix ligature offset in multi-line text Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 4 ++-- tests/auto/qtextlayout/tst_qtextlayout.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 7328ea9..de4ca4f 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2505,8 +2505,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const if(pos == l) x += si->width; } else { + int end = qMin(lineEnd, si->position + l) - si->position; if (reverse) { - int end = qMin(lineEnd, si->position + l) - si->position; int glyph_end = end == l ? si->num_glyphs : logClusters[end]; for (int i = glyph_end - 1; i >= glyph_pos; i--) x += glyphs.effectiveAdvance(i); @@ -2516,7 +2516,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const for (int i = glyph_start; i < glyph_pos; i++) x += glyphs.effectiveAdvance(i); } - x += offsetInLigature(logClusters, glyphs, pos, line.length, glyph_pos); + x += offsetInLigature(logClusters, glyphs, pos, end, glyph_pos); } *cursorPos = pos + si->position; diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index ad33b70..964679a 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -126,6 +126,7 @@ private slots: void textWidthWithStackedTextEngine(); void textWidthWithLineSeparator(); void textWithSurrogates_qtbug15679(); + void cursorInLigatureWithMultipleLines(); private: QFont testFont; @@ -1436,5 +1437,21 @@ void tst_QTextLayout::textWithSurrogates_qtbug15679() QCOMPARE(x[2] - x[0], x[5] - x[3]); } +void tst_QTextLayout::cursorInLigatureWithMultipleLines() +{ +#if !defined(Q_WS_MAC) + QSKIP("This test can only be run on Mac", SkipAll); +#endif + QTextLayout layout("first line finish", QFont("Times", 20)); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(70); + line = layout.createLine(); + layout.endLayout(); + + // The second line will be "finish", with "fi" as a ligature + QVERIFY(line.cursorToX(0) != line.cursorToX(1)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From 278cf1f37945050c4a46d5acab0659f3a7546a43 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 20 May 2011 10:26:54 +0200 Subject: Fix ligature offset in multi-line text Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 4 ++-- tests/auto/qtextlayout/tst_qtextlayout.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 07aeb72..9501c0b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2559,8 +2559,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const } else { bool rtl = eng->isRightToLeft(); bool visual = eng->visualCursorMovement(); + int end = qMin(lineEnd, si->position + l) - si->position; if (reverse) { - int end = qMin(lineEnd, si->position + l) - si->position; int glyph_end = end == l ? si->num_glyphs : logClusters[end]; int glyph_start = glyph_pos; if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem))) @@ -2576,7 +2576,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const for (int i = glyph_start; i <= glyph_end; i++) x += glyphs.effectiveAdvance(i); } - x += eng->offsetInLigature(si, pos, line.length, glyph_pos); + x += eng->offsetInLigature(si, pos, end, glyph_pos); } *cursorPos = pos + si->position; diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 83c7094..b5712fb 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -127,6 +127,7 @@ private slots: void textWithSurrogates_qtbug15679(); void textWidthWithStackedTextEngine(); void textWidthWithLineSeparator(); + void cursorInLigatureWithMultipleLines(); private: QFont testFont; @@ -1460,5 +1461,21 @@ void tst_QTextLayout::textWidthWithLineSeparator() QCOMPARE(line1.naturalTextWidth(), line2.naturalTextWidth()); } +void tst_QTextLayout::cursorInLigatureWithMultipleLines() +{ +#if !defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout("first line finish", QFont("Times", 20)); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(70); + line = layout.createLine(); + layout.endLayout(); + + // The second line will be "finish", with "fi" as a ligature + QVERIFY(line.cursorToX(0) != line.cursorToX(1)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From fd043eb78212de5935bc101624818070e1b4fb1b Mon Sep 17 00:00:00 2001 From: shiroki Date: Fri, 20 May 2011 10:38:12 +0200 Subject: add test case for ipv6 url parsing Reviewed-by: Thiago --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 57 ++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index feb8204..203de5b 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -219,6 +219,8 @@ private Q_SLOTS: void putGetDeleteGetFromHttp(); void sendCustomRequestToHttp_data(); void sendCustomRequestToHttp(); + void connectToIPv6Address_data(); + void connectToIPv6Address(); void ioGetFromData_data(); void ioGetFromData(); @@ -447,14 +449,19 @@ public: QSemaphore ready; bool doClose; bool doSsl; + bool ipv6; bool multiple; int totalConnections; - MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0) - : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), + MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false) + : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), multiple(false), totalConnections(0) { - listen(); + if( useipv6 ){ + listen(QHostAddress::AnyIPv6); + }else{ + listen(); + } if (thread) { connect(thread, SIGNAL(started()), this, SLOT(threadStartedSlot())); moveToThread(thread); @@ -466,7 +473,7 @@ public: protected: void incomingConnection(int socketDescriptor) { - //qDebug() << "incomingConnection" << socketDescriptor; + //qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6; if (!doSsl) { client = new QTcpSocket; client->setSocketDescriptor(socketDescriptor); @@ -2317,6 +2324,48 @@ void tst_QNetworkReply::putGetDeleteGetFromHttp() } +void tst_QNetworkReply::connectToIPv6Address_data() +{ + QTest::addColumn("url"); + QTest::addColumn("error"); + QTest::addColumn("dataToSend"); + QTest::addColumn("serverVerifyData"); + QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("\r\nHost: [::1]\r\n"); + //to add more test data here +} + +void tst_QNetworkReply::connectToIPv6Address() +{ + QFETCH(QUrl, url); + QFETCH(QNetworkReply::NetworkError, error); + QFETCH(QByteArray, dataToSend); + QFETCH(QByteArray, serverVerifyData); + + QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: "); + httpResponse += QByteArray::number(dataToSend.size()); + httpResponse += "\r\n\r\n"; + httpResponse += dataToSend; + + MiniHttpServer server(httpResponse, false, NULL/*thread*/, true/*useipv6*/); + server.doClose = true; + + url.setPort(server.serverPort()); + QNetworkRequest request(url); + + QNetworkReplyPtr reply = manager.get(request); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QByteArray content = reply->readAll(); + if( !serverVerifyData.isEmpty()){ + //qDebug() << server.receivedData; + //QVERIFY(server.receivedData.contains(serverVerifyData)); //got a bug here + } + QVERIFY(content == dataToSend); + QCOMPARE(reply->url(), request.url()); + QVERIFY(reply->error() == error); +} + void tst_QNetworkReply::sendCustomRequestToHttp_data() { QTest::addColumn("url"); -- cgit v0.12 From 31e9c098f3c9321eebf1ac3e4c44a2d18d3816b8 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 19 May 2011 23:19:47 +0200 Subject: Fix smaller bugs in the stroker Calculating the continuation point for closed contours was not taking transformations and the half pixel offset into account. --- src/gui/painting/qcosmeticstroker.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index d694b4b..47a1359 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -409,10 +409,11 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal if (clipLine(rx1, ry1, rx2, ry2)) return; - int x1 = toF26Dot6(rx1); - int y1 = toF26Dot6(ry1); - int x2 = toF26Dot6(rx2); - int y2 = toF26Dot6(ry2); + const int half = 32; + int x1 = toF26Dot6(rx1) + half; + int y1 = toF26Dot6(ry1) + half; + int x2 = toF26Dot6(rx2) + half; + int y2 = toF26Dot6(ry2) + half; int dx = qAbs(x2 - x1); int dy = qAbs(y2 - y1); @@ -424,6 +425,7 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal swapped = true; qSwap(y1, y2); qSwap(x1, x2); + --x1; --x2; --y1; --y2; } int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); int x = x1 << 10; @@ -455,6 +457,7 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal swapped = true; qSwap(x1, x2); qSwap(y1, y2); + --x1; --x2; --y1; --y2; } int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); int y = y1 << 10; @@ -525,7 +528,9 @@ void QCosmeticStroker::drawPath(const QVectorPath &path) const QPainterPath::ElementType *e = subPath(type, end, points, &closed); if (closed) { const qreal *p = points + 2*(e-type); - calculateLastPoint(p[-4], p[-3], p[-2], p[-1]); + QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix; + QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix; + calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y()); } int caps = (!closed & drawCaps) ? CapBegin : NoCaps; // qDebug() << "closed =" << closed << capString(caps); @@ -577,8 +582,10 @@ void QCosmeticStroker::drawPath(const QVectorPath &path) // handle closed path case bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]); int caps = (!closed & drawCaps) ? CapBegin : NoCaps; - if (closed) - calculateLastPoint(end[-2], end[-1], points[0], points[1]); + if (closed) { + QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix; + calculateLastPoint(p2.x(), p2.y(), p.x(), p.y()); + } points += 2; while (points < end) { -- cgit v0.12 From eedab65056a6898e5a6f6bd103bed53e6787d334 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 20 May 2011 12:30:35 +0200 Subject: Fixed inconsistent behaviour in Qt.rect(). The QML function Qt.rect() used to return a null rectangle if the width or height argument were negative. This was inconsistent with Qt.size() and parsing a string of the type "x,y,wxh" which do not check the width and height. Reviewed-by: Samuel --- src/declarative/qml/qdeclarativeengine.cpp | 3 --- tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 9fde18c..1feaeb3 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1699,9 +1699,6 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine qsreal w = ctxt->argument(2).toNumber(); qsreal h = ctxt->argument(3).toNumber(); - if (w < 0 || h < 0) - return engine->nullValue(); - return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QRectF(x, y, w, h))); } diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 80d9d93..518be89 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -174,7 +174,7 @@ void tst_qdeclarativeqt::rect() QCOMPARE(qvariant_cast(object->property("test2")), QRectF(-10, 13, 100, 109.6)); QCOMPARE(qvariant_cast(object->property("test3")), QRectF()); QCOMPARE(qvariant_cast(object->property("test4")), QRectF()); - QCOMPARE(qvariant_cast(object->property("test5")), QRectF()); + QCOMPARE(qvariant_cast(object->property("test5")), QRectF(10, 13, 100, -109)); delete object; } -- cgit v0.12 From 3b6c77da8c8b2b7db4d75f122464462656ef8daf Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 20 May 2011 13:55:06 +0200 Subject: Absenting function in winscw def files. --- src/s60installs/bwins/QtCoreu.def | 92 ++++++------ src/s60installs/bwins/QtDeclarativeu.def | 18 +-- src/s60installs/bwins/QtGuiu.def | 240 +++++++++++++++---------------- src/s60installs/bwins/QtMultimediau.def | 10 +- src/s60installs/bwins/QtNetworku.def | 28 ++-- src/s60installs/bwins/QtScriptu.def | 4 +- src/s60installs/bwins/QtSqlu.def | 6 +- src/s60installs/bwins/QtTestu.def | 4 +- src/s60installs/bwins/QtXmlPatternsu.def | 6 +- src/s60installs/bwins/QtXmlu.def | 14 +- src/s60installs/bwins/phononu.def | 8 +- 11 files changed, 215 insertions(+), 215 deletions(-) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index d1e734d..aa1f348 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4489,50 +4489,50 @@ EXPORTS ?symbianCommandLine@QCoreApplicationPrivate@@SAPAVCApaCommandLine@@XZ @ 4488 NONAME ; class CApaCommandLine * QCoreApplicationPrivate::symbianCommandLine(void) ?revision@QMetaProperty@@QBEHXZ @ 4489 NONAME ; int QMetaProperty::revision(void) const ?revision@QMetaMethod@@QBEHXZ @ 4490 NONAME ; int QMetaMethod::revision(void) const - ??_EQDateTime@@QAE@I@Z @ 4491 NONAME ; QDateTime::~QDateTime(unsigned int) - ??4QDate@@QAEAAV0@ABV0@@Z @ 4492 NONAME ; class QDate & QDate::operator=(class QDate const &) - ??4QSizeF@@QAEAAV0@ABV0@@Z @ 4493 NONAME ; class QSizeF & QSizeF::operator=(class QSizeF const &) - ??0QSize@@QAE@ABV0@@Z @ 4494 NONAME ; QSize::QSize(class QSize const &) - ??0QEvent@@QAE@ABV0@@Z @ 4495 NONAME ; QEvent::QEvent(class QEvent const &) - ??0QTextCodecFactoryInterface@@QAE@XZ @ 4496 NONAME ; QTextCodecFactoryInterface::QTextCodecFactoryInterface(void) - ??0QPointF@@QAE@ABV0@@Z @ 4497 NONAME ; QPointF::QPointF(class QPointF const &) - ??_EQUrl@@QAE@I@Z @ 4498 NONAME ; QUrl::~QUrl(unsigned int) - ??0QGenericArgument@@QAE@ABV0@@Z @ 4499 NONAME ; QGenericArgument::QGenericArgument(class QGenericArgument const &) - ??_EQVariant@@QAE@I@Z @ 4500 NONAME ; QVariant::~QVariant(unsigned int) - ??4QLineF@@QAEAAV0@ABV0@@Z @ 4501 NONAME ; class QLineF & QLineF::operator=(class QLineF const &) - ??0QXmlStreamAttributes@@QAE@ABV0@@Z @ 4502 NONAME ; QXmlStreamAttributes::QXmlStreamAttributes(class QXmlStreamAttributes const &) - ??0QMetaEnum@@QAE@ABV0@@Z @ 4503 NONAME ; QMetaEnum::QMetaEnum(class QMetaEnum const &) - ??4QUuid@@QAEAAU0@ABU0@@Z @ 4504 NONAME ; struct QUuid & QUuid::operator=(struct QUuid const &) - ??0CQtActiveScheduler@@QAE@XZ @ 4505 NONAME ; CQtActiveScheduler::CQtActiveScheduler(void) - ??0QSizeF@@QAE@ABV0@@Z @ 4506 NONAME ; QSizeF::QSizeF(class QSizeF const &) - ??4QMetaEnum@@QAEAAV0@ABV0@@Z @ 4507 NONAME ; class QMetaEnum & QMetaEnum::operator=(class QMetaEnum const &) - ??4QRect@@QAEAAV0@ABV0@@Z @ 4508 NONAME ; class QRect & QRect::operator=(class QRect const &) - ??_EQMutexPool@@QAE@I@Z @ 4509 NONAME ; QMutexPool::~QMutexPool(unsigned int) - ??0QMetaClassInfo@@QAE@ABV0@@Z @ 4510 NONAME ; QMetaClassInfo::QMetaClassInfo(class QMetaClassInfo const &) - ??0QDate@@QAE@ABV0@@Z @ 4511 NONAME ; QDate::QDate(class QDate const &) - ??_EQTextDecoder@@QAE@I@Z @ 4512 NONAME ; QTextDecoder::~QTextDecoder(unsigned int) - ??_EQMutex@@QAE@I@Z @ 4513 NONAME ; QMutex::~QMutex(unsigned int) - ??0QTimerEvent@@QAE@ABV0@@Z @ 4514 NONAME ; QTimerEvent::QTimerEvent(class QTimerEvent const &) - ??0QXmlStreamAttributes@@QAE@XZ @ 4515 NONAME ; QXmlStreamAttributes::QXmlStreamAttributes(void) - ??_EConverterState@QTextCodec@@QAE@I@Z @ 4516 NONAME ; QTextCodec::ConverterState::~ConverterState(unsigned int) - ??4QTime@@QAEAAV0@ABV0@@Z @ 4517 NONAME ; class QTime & QTime::operator=(class QTime const &) - ??0QMetaMethod@@QAE@ABV0@@Z @ 4518 NONAME ; QMetaMethod::QMetaMethod(class QMetaMethod const &) - ??_EQTextEncoder@@QAE@I@Z @ 4519 NONAME ; QTextEncoder::~QTextEncoder(unsigned int) - ??_EQFileInfo@@QAE@I@Z @ 4520 NONAME ; QFileInfo::~QFileInfo(unsigned int) - ??4QRectF@@QAEAAV0@ABV0@@Z @ 4521 NONAME ; class QRectF & QRectF::operator=(class QRectF const &) - ??4QXmlStreamStringRef@@QAEAAV0@ABV0@@Z @ 4522 NONAME ; class QXmlStreamStringRef & QXmlStreamStringRef::operator=(class QXmlStreamStringRef const &) - ??4QBasicAtomicInt@@QAEAAV0@ABV0@@Z @ 4523 NONAME ; class QBasicAtomicInt & QBasicAtomicInt::operator=(class QBasicAtomicInt const &) - ??_EQEasingCurve@@QAE@I@Z @ 4524 NONAME ; QEasingCurve::~QEasingCurve(unsigned int) - ??_EQReadWriteLock@@QAE@I@Z @ 4525 NONAME ; QReadWriteLock::~QReadWriteLock(unsigned int) - ??0QFactoryInterface@@QAE@XZ @ 4526 NONAME ; QFactoryInterface::QFactoryInterface(void) - ??4QLine@@QAEAAV0@ABV0@@Z @ 4527 NONAME ; class QLine & QLine::operator=(class QLine const &) - ??0QMetaProperty@@QAE@ABV0@@Z @ 4528 NONAME ; QMetaProperty::QMetaProperty(class QMetaProperty const &) - ??_EQBitArray@@QAE@I@Z @ 4529 NONAME ; QBitArray::~QBitArray(unsigned int) - ??0QTime@@QAE@ABV0@@Z @ 4530 NONAME ; QTime::QTime(class QTime const &) - ??4QPoint@@QAEAAV0@ABV0@@Z @ 4531 NONAME ; class QPoint & QPoint::operator=(class QPoint const &) - ??4QSize@@QAEAAV0@ABV0@@Z @ 4532 NONAME ; class QSize & QSize::operator=(class QSize const &) - ??0QPoint@@QAE@ABV0@@Z @ 4533 NONAME ; QPoint::QPoint(class QPoint const &) - ??4QPointF@@QAEAAV0@ABV0@@Z @ 4534 NONAME ; class QPointF & QPointF::operator=(class QPointF const &) - ??_EQRegExp@@QAE@I@Z @ 4535 NONAME ; QRegExp::~QRegExp(unsigned int) - ??4QLocalePrivate@@QAEAAU0@ABU0@@Z @ 4536 NONAME ; struct QLocalePrivate & QLocalePrivate::operator=(struct QLocalePrivate const &) + ??_EQDateTime@@QAE@I@Z @ 4491 NONAME ABSENT ; QDateTime::~QDateTime(unsigned int) + ??4QDate@@QAEAAV0@ABV0@@Z @ 4492 NONAME ABSENT ; class QDate & QDate::operator=(class QDate const &) + ??4QSizeF@@QAEAAV0@ABV0@@Z @ 4493 NONAME ABSENT ; class QSizeF & QSizeF::operator=(class QSizeF const &) + ??0QSize@@QAE@ABV0@@Z @ 4494 NONAME ABSENT ; QSize::QSize(class QSize const &) + ??0QEvent@@QAE@ABV0@@Z @ 4495 NONAME ABSENT ; QEvent::QEvent(class QEvent const &) + ??0QTextCodecFactoryInterface@@QAE@XZ @ 4496 NONAME ABSENT ; QTextCodecFactoryInterface::QTextCodecFactoryInterface(void) + ??0QPointF@@QAE@ABV0@@Z @ 4497 NONAME ABSENT ; QPointF::QPointF(class QPointF const &) + ??_EQUrl@@QAE@I@Z @ 4498 NONAME ABSENT ; QUrl::~QUrl(unsigned int) + ??0QGenericArgument@@QAE@ABV0@@Z @ 4499 NONAME ABSENT ; QGenericArgument::QGenericArgument(class QGenericArgument const &) + ??_EQVariant@@QAE@I@Z @ 4500 NONAME ABSENT ; QVariant::~QVariant(unsigned int) + ??4QLineF@@QAEAAV0@ABV0@@Z @ 4501 NONAME ABSENT ; class QLineF & QLineF::operator=(class QLineF const &) + ??0QXmlStreamAttributes@@QAE@ABV0@@Z @ 4502 NONAME ABSENT ; QXmlStreamAttributes::QXmlStreamAttributes(class QXmlStreamAttributes const &) + ??0QMetaEnum@@QAE@ABV0@@Z @ 4503 NONAME ABSENT ; QMetaEnum::QMetaEnum(class QMetaEnum const &) + ??4QUuid@@QAEAAU0@ABU0@@Z @ 4504 NONAME ABSENT ; struct QUuid & QUuid::operator=(struct QUuid const &) + ??0CQtActiveScheduler@@QAE@XZ @ 4505 NONAME ABSENT ; CQtActiveScheduler::CQtActiveScheduler(void) + ??0QSizeF@@QAE@ABV0@@Z @ 4506 NONAME ABSENT ; QSizeF::QSizeF(class QSizeF const &) + ??4QMetaEnum@@QAEAAV0@ABV0@@Z @ 4507 NONAME ABSENT ; class QMetaEnum & QMetaEnum::operator=(class QMetaEnum const &) + ??4QRect@@QAEAAV0@ABV0@@Z @ 4508 NONAME ABSENT ; class QRect & QRect::operator=(class QRect const &) + ??_EQMutexPool@@QAE@I@Z @ 4509 NONAME ABSENT ; QMutexPool::~QMutexPool(unsigned int) + ??0QMetaClassInfo@@QAE@ABV0@@Z @ 4510 NONAME ABSENT ; QMetaClassInfo::QMetaClassInfo(class QMetaClassInfo const &) + ??0QDate@@QAE@ABV0@@Z @ 4511 NONAME ABSENT ; QDate::QDate(class QDate const &) + ??_EQTextDecoder@@QAE@I@Z @ 4512 NONAME ABSENT ; QTextDecoder::~QTextDecoder(unsigned int) + ??_EQMutex@@QAE@I@Z @ 4513 NONAME ABSENT ; QMutex::~QMutex(unsigned int) + ??0QTimerEvent@@QAE@ABV0@@Z @ 4514 NONAME ABSENT ; QTimerEvent::QTimerEvent(class QTimerEvent const &) + ??0QXmlStreamAttributes@@QAE@XZ @ 4515 NONAME ABSENT ; QXmlStreamAttributes::QXmlStreamAttributes(void) + ??_EConverterState@QTextCodec@@QAE@I@Z @ 4516 NONAME ABSENT ; QTextCodec::ConverterState::~ConverterState(unsigned int) + ??4QTime@@QAEAAV0@ABV0@@Z @ 4517 NONAME ABSENT ; class QTime & QTime::operator=(class QTime const &) + ??0QMetaMethod@@QAE@ABV0@@Z @ 4518 NONAME ABSENT ; QMetaMethod::QMetaMethod(class QMetaMethod const &) + ??_EQTextEncoder@@QAE@I@Z @ 4519 NONAME ABSENT ; QTextEncoder::~QTextEncoder(unsigned int) + ??_EQFileInfo@@QAE@I@Z @ 4520 NONAME ABSENT ; QFileInfo::~QFileInfo(unsigned int) + ??4QRectF@@QAEAAV0@ABV0@@Z @ 4521 NONAME ABSENT ; class QRectF & QRectF::operator=(class QRectF const &) + ??4QXmlStreamStringRef@@QAEAAV0@ABV0@@Z @ 4522 NONAME ABSENT ; class QXmlStreamStringRef & QXmlStreamStringRef::operator=(class QXmlStreamStringRef const &) + ??4QBasicAtomicInt@@QAEAAV0@ABV0@@Z @ 4523 NONAME ABSENT ; class QBasicAtomicInt & QBasicAtomicInt::operator=(class QBasicAtomicInt const &) + ??_EQEasingCurve@@QAE@I@Z @ 4524 NONAME ABSENT ; QEasingCurve::~QEasingCurve(unsigned int) + ??_EQReadWriteLock@@QAE@I@Z @ 4525 NONAME ABSENT ; QReadWriteLock::~QReadWriteLock(unsigned int) + ??0QFactoryInterface@@QAE@XZ @ 4526 NONAME ABSENT ; QFactoryInterface::QFactoryInterface(void) + ??4QLine@@QAEAAV0@ABV0@@Z @ 4527 NONAME ABSENT ; class QLine & QLine::operator=(class QLine const &) + ??0QMetaProperty@@QAE@ABV0@@Z @ 4528 NONAME ABSENT ; QMetaProperty::QMetaProperty(class QMetaProperty const &) + ??_EQBitArray@@QAE@I@Z @ 4529 NONAME ABSENT ; QBitArray::~QBitArray(unsigned int) + ??0QTime@@QAE@ABV0@@Z @ 4530 NONAME ABSENT ; QTime::QTime(class QTime const &) + ??4QPoint@@QAEAAV0@ABV0@@Z @ 4531 NONAME ABSENT ; class QPoint & QPoint::operator=(class QPoint const &) + ??4QSize@@QAEAAV0@ABV0@@Z @ 4532 NONAME ABSENT ; class QSize & QSize::operator=(class QSize const &) + ??0QPoint@@QAE@ABV0@@Z @ 4533 NONAME ABSENT ; QPoint::QPoint(class QPoint const &) + ??4QPointF@@QAEAAV0@ABV0@@Z @ 4534 NONAME ABSENT ; class QPointF & QPointF::operator=(class QPointF const &) + ??_EQRegExp@@QAE@I@Z @ 4535 NONAME ABSENT ; QRegExp::~QRegExp(unsigned int) + ??4QLocalePrivate@@QAEAAU0@ABU0@@Z @ 4536 NONAME ABSENT ; struct QLocalePrivate & QLocalePrivate::operator=(struct QLocalePrivate const &) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index b3309ad..bcc0ff6 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1893,13 +1893,13 @@ EXPORTS ?setLayoutMirror@QDeclarativeItemPrivate@@QAEX_N@Z @ 1892 NONAME ; void QDeclarativeItemPrivate::setLayoutMirror(bool) ?setImplicitLayoutMirror@QDeclarativeItemPrivate@@QAEX_N0@Z @ 1893 NONAME ; void QDeclarativeItemPrivate::setImplicitLayoutMirror(bool, bool) ?isMirrored@QDeclarativeItemPrivate@@QBE_NXZ @ 1894 NONAME ; bool QDeclarativeItemPrivate::isMirrored(void) const - ??_EQDeclarativeListReference@@QAE@I@Z @ 1895 NONAME ; QDeclarativeListReference::~QDeclarativeListReference(unsigned int) - ??_EVariant@QDeclarativeParser@@QAE@I@Z @ 1896 NONAME ; QDeclarativeParser::Variant::~Variant(unsigned int) - ??_EQDeclarativeProperty@@QAE@I@Z @ 1897 NONAME ; QDeclarativeProperty::~QDeclarativeProperty(unsigned int) - ??_EQDeclarativeError@@QAE@I@Z @ 1898 NONAME ; QDeclarativeError::~QDeclarativeError(unsigned int) - ??_EQDeclarativeCustomParserProperty@@QAE@I@Z @ 1899 NONAME ; QDeclarativeCustomParserProperty::~QDeclarativeCustomParserProperty(unsigned int) - ??0QDeclarativeExtensionInterface@@QAE@XZ @ 1900 NONAME ; QDeclarativeExtensionInterface::QDeclarativeExtensionInterface(void) - ??_EQDeclarativeScriptString@@QAE@I@Z @ 1901 NONAME ; QDeclarativeScriptString::~QDeclarativeScriptString(unsigned int) - ??_EQDeclarativeCustomParserNode@@QAE@I@Z @ 1902 NONAME ; QDeclarativeCustomParserNode::~QDeclarativeCustomParserNode(unsigned int) - ??_EQDeclarativePixmap@@QAE@I@Z @ 1903 NONAME ; QDeclarativePixmap::~QDeclarativePixmap(unsigned int) + ??_EQDeclarativeListReference@@QAE@I@Z @ 1895 NONAME ABSENT ; QDeclarativeListReference::~QDeclarativeListReference(unsigned int) + ??_EVariant@QDeclarativeParser@@QAE@I@Z @ 1896 NONAME ABSENT ; QDeclarativeParser::Variant::~Variant(unsigned int) + ??_EQDeclarativeProperty@@QAE@I@Z @ 1897 NONAME ABSENT ; QDeclarativeProperty::~QDeclarativeProperty(unsigned int) + ??_EQDeclarativeError@@QAE@I@Z @ 1898 NONAME ABSENT ; QDeclarativeError::~QDeclarativeError(unsigned int) + ??_EQDeclarativeCustomParserProperty@@QAE@I@Z @ 1899 NONAME ABSENT ; QDeclarativeCustomParserProperty::~QDeclarativeCustomParserProperty(unsigned int) + ??0QDeclarativeExtensionInterface@@QAE@XZ @ 1900 NONAME ABSENT ; QDeclarativeExtensionInterface::QDeclarativeExtensionInterface(void) + ??_EQDeclarativeScriptString@@QAE@I@Z @ 1901 NONAME ABSENT ; QDeclarativeScriptString::~QDeclarativeScriptString(unsigned int) + ??_EQDeclarativeCustomParserNode@@QAE@I@Z @ 1902 NONAME ABSENT ; QDeclarativeCustomParserNode::~QDeclarativeCustomParserNode(unsigned int) + ??_EQDeclarativePixmap@@QAE@I@Z @ 1903 NONAME ABSENT ; QDeclarativePixmap::~QDeclarativePixmap(unsigned int) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index b68f59f..3e848ec 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12982,133 +12982,133 @@ EXPORTS ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ABSENT ; void QGraphicsSystem::releaseCachedResources(void) ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) ?paintingActive@QVolatileImage@@QBE_NXZ @ 12983 NONAME ; bool QVolatileImage::paintingActive(void) const - ??_EQFontPrivate@@QAE@I@Z @ 12984 NONAME ; QFontPrivate::~QFontPrivate(unsigned int) - ??0QMimeSource@@QAE@XZ @ 12985 NONAME ; QMimeSource::QMimeSource(void) - ??0QStyleFactoryInterface@@QAE@XZ @ 12986 NONAME ; QStyleFactoryInterface::QStyleFactoryInterface(void) - ??0QFileOpenEvent@@QAE@ABV0@@Z @ 12987 NONAME ; QFileOpenEvent::QFileOpenEvent(class QFileOpenEvent const &) - ??4QStyleOptionViewItemV2@@QAEAAV0@ABV0@@Z @ 12988 NONAME ; class QStyleOptionViewItemV2 & QStyleOptionViewItemV2::operator=(class QStyleOptionViewItemV2 const &) - ??0QShowEvent@@QAE@ABV0@@Z @ 12989 NONAME ; QShowEvent::QShowEvent(class QShowEvent const &) - ??0QMouseEvent@@QAE@ABV0@@Z @ 12990 NONAME ; QMouseEvent::QMouseEvent(class QMouseEvent const &) - ??0QActionEvent@@QAE@ABV0@@Z @ 12991 NONAME ; QActionEvent::QActionEvent(class QActionEvent const &) - ??0QTouchEvent@@QAE@ABV0@@Z @ 12992 NONAME ; QTouchEvent::QTouchEvent(class QTouchEvent const &) - ??_EQImageData@@QAE@I@Z @ 12993 NONAME ; QImageData::~QImageData(unsigned int) - ??4QBezier@@QAEAAV0@ABV0@@Z @ 12994 NONAME ; class QBezier & QBezier::operator=(class QBezier const &) - ??0QIconEngineV2@@QAE@XZ @ 12995 NONAME ; QIconEngineV2::QIconEngineV2(void) - ??4iterator@QTextBlock@@QAEAAV01@ABV01@@Z @ 12996 NONAME ; class QTextBlock::iterator & QTextBlock::iterator::operator=(class QTextBlock::iterator const &) - ??0QIconEngineV2@@QAE@ABV0@@Z @ 12997 NONAME ; QIconEngineV2::QIconEngineV2(class QIconEngineV2 const &) - ??0QIconEngineFactoryInterfaceV2@@QAE@XZ @ 12998 NONAME ; QIconEngineFactoryInterfaceV2::QIconEngineFactoryInterfaceV2(void) - ??4QTextLine@@QAEAAV0@ABV0@@Z @ 12999 NONAME ; class QTextLine & QTextLine::operator=(class QTextLine const &) - ??0QToolBarChangeEvent@@QAE@ABV0@@Z @ 13000 NONAME ; QToolBarChangeEvent::QToolBarChangeEvent(class QToolBarChangeEvent const &) - ??0QResizeEvent@@QAE@ABV0@@Z @ 13001 NONAME ; QResizeEvent::QResizeEvent(class QResizeEvent const &) - ??0QIconEngineFactoryInterface@@QAE@XZ @ 13002 NONAME ; QIconEngineFactoryInterface::QIconEngineFactoryInterface(void) - ??0QPictureFormatInterface@@QAE@XZ @ 13003 NONAME ; QPictureFormatInterface::QPictureFormatInterface(void) - ??_EQPolygon@@QAE@I@Z @ 13004 NONAME ; QPolygon::~QPolygon(unsigned int) - ??_EQImageReader@@QAE@I@Z @ 13005 NONAME ; QImageReader::~QImageReader(unsigned int) - ??4QStyleOptionGraphicsItem@@QAEAAV0@ABV0@@Z @ 13006 NONAME ; class QStyleOptionGraphicsItem & QStyleOptionGraphicsItem::operator=(class QStyleOptionGraphicsItem const &) - ??4QStyleOptionProgressBarV2@@QAEAAV0@ABV0@@Z @ 13007 NONAME ; class QStyleOptionProgressBarV2 & QStyleOptionProgressBarV2::operator=(class QStyleOptionProgressBarV2 const &) - ??0QDragEnterEvent@@QAE@ABV0@@Z @ 13008 NONAME ; QDragEnterEvent::QDragEnterEvent(class QDragEnterEvent const &) - ??_EKey@QPixmapCache@@QAE@I@Z @ 13009 NONAME ; QPixmapCache::Key::~Key(unsigned int) - ??_EQCursor@@QAE@I@Z @ 13010 NONAME ; QCursor::~QCursor(unsigned int) - ??0QShortcutEvent@@QAE@ABV0@@Z @ 13011 NONAME ; QShortcutEvent::QShortcutEvent(class QShortcutEvent const &) - ??_EQTextCursor@@QAE@I@Z @ 13012 NONAME ; QTextCursor::~QTextCursor(unsigned int) - ??0QGradient@@QAE@ABV0@@Z @ 13013 NONAME ; QGradient::QGradient(class QGradient const &) - ??4QInputMethodEvent@@QAEAAV0@ABV0@@Z @ 13014 NONAME ; class QInputMethodEvent & QInputMethodEvent::operator=(class QInputMethodEvent const &) - ??0QVector2D@@QAE@ABV0@@Z @ 13015 NONAME ; QVector2D::QVector2D(class QVector2D const &) - ??4QStyleOptionFocusRect@@QAEAAV0@ABV0@@Z @ 13016 NONAME ; class QStyleOptionFocusRect & QStyleOptionFocusRect::operator=(class QStyleOptionFocusRect const &) - ??_EQPen@@QAE@I@Z @ 13017 NONAME ; QPen::~QPen(unsigned int) - ??_EQKeySequence@@QAE@I@Z @ 13018 NONAME ; QKeySequence::~QKeySequence(unsigned int) - ??4QGradient@@QAEAAV0@ABV0@@Z @ 13019 NONAME ; class QGradient & QGradient::operator=(class QGradient const &) - ??0QTextTableFormat@@QAE@ABV0@@Z @ 13020 NONAME ; QTextTableFormat::QTextTableFormat(class QTextTableFormat const &) - ??_EQImagePixmapCleanupHooks@@QAE@I@Z @ 13021 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(unsigned int) - ??0QStatusTipEvent@@QAE@ABV0@@Z @ 13022 NONAME ; QStatusTipEvent::QStatusTipEvent(class QStatusTipEvent const &) - ??0Value@QCss@@QAE@ABU01@@Z @ 13023 NONAME ; QCss::Value::Value(struct QCss::Value const &) - ??4QSizePolicy@@QAEAAV0@ABV0@@Z @ 13024 NONAME ; class QSizePolicy & QSizePolicy::operator=(class QSizePolicy const &) - ??_ETouchPoint@QTouchEvent@@QAE@I@Z @ 13025 NONAME ; QTouchEvent::TouchPoint::~TouchPoint(unsigned int) - ??4QItemSelection@@QAEAAV0@ABV0@@Z @ 13026 NONAME ; class QItemSelection & QItemSelection::operator=(class QItemSelection const &) - ??4QStyleOptionQ3ListView@@QAEAAV0@ABV0@@Z @ 13027 NONAME ; class QStyleOptionQ3ListView & QStyleOptionQ3ListView::operator=(class QStyleOptionQ3ListView const &) - ??0QSizePolicy@@QAE@ABV0@@Z @ 13028 NONAME ; QSizePolicy::QSizePolicy(class QSizePolicy const &) - ??4QStyleOptionFrameV2@@QAEAAV0@ABV0@@Z @ 13029 NONAME ; class QStyleOptionFrameV2 & QStyleOptionFrameV2::operator=(class QStyleOptionFrameV2 const &) - ??4QVector3D@@QAEAAV0@ABV0@@Z @ 13030 NONAME ; class QVector3D & QVector3D::operator=(class QVector3D const &) - ??4QStyleOptionQ3DockWindow@@QAEAAV0@ABV0@@Z @ 13031 NONAME ; class QStyleOptionQ3DockWindow & QStyleOptionQ3DockWindow::operator=(class QStyleOptionQ3DockWindow const &) - ??_EQFont@@QAE@I@Z @ 13032 NONAME ; QFont::~QFont(unsigned int) - ??4QStyleOptionDockWidget@@QAEAAV0@ABV0@@Z @ 13033 NONAME ; class QStyleOptionDockWidget & QStyleOptionDockWidget::operator=(class QStyleOptionDockWidget const &) - ??0QPainterState@@QAE@ABV0@@Z @ 13034 NONAME ; QPainterState::QPainterState(class QPainterState const &) - ??4QStyleOptionFrame@@QAEAAV0@ABV0@@Z @ 13035 NONAME ; class QStyleOptionFrame & QStyleOptionFrame::operator=(class QStyleOptionFrame const &) + ??_EQFontPrivate@@QAE@I@Z @ 12984 NONAME ABSENT ; QFontPrivate::~QFontPrivate(unsigned int) + ??0QMimeSource@@QAE@XZ @ 12985 NONAME ABSENT ; QMimeSource::QMimeSource(void) + ??0QStyleFactoryInterface@@QAE@XZ @ 12986 NONAME ABSENT ; QStyleFactoryInterface::QStyleFactoryInterface(void) + ??0QFileOpenEvent@@QAE@ABV0@@Z @ 12987 NONAME ABSENT ; QFileOpenEvent::QFileOpenEvent(class QFileOpenEvent const &) + ??4QStyleOptionViewItemV2@@QAEAAV0@ABV0@@Z @ 12988 NONAME ABSENT ; class QStyleOptionViewItemV2 & QStyleOptionViewItemV2::operator=(class QStyleOptionViewItemV2 const &) + ??0QShowEvent@@QAE@ABV0@@Z @ 12989 NONAME ABSENT ; QShowEvent::QShowEvent(class QShowEvent const &) + ??0QMouseEvent@@QAE@ABV0@@Z @ 12990 NONAME ABSENT ; QMouseEvent::QMouseEvent(class QMouseEvent const &) + ??0QActionEvent@@QAE@ABV0@@Z @ 12991 NONAME ABSENT ; QActionEvent::QActionEvent(class QActionEvent const &) + ??0QTouchEvent@@QAE@ABV0@@Z @ 12992 NONAME ABSENT ; QTouchEvent::QTouchEvent(class QTouchEvent const &) + ??_EQImageData@@QAE@I@Z @ 12993 NONAME ABSENT ; QImageData::~QImageData(unsigned int) + ??4QBezier@@QAEAAV0@ABV0@@Z @ 12994 NONAME ABSENT ; class QBezier & QBezier::operator=(class QBezier const &) + ??0QIconEngineV2@@QAE@XZ @ 12995 NONAME ABSENT ; QIconEngineV2::QIconEngineV2(void) + ??4iterator@QTextBlock@@QAEAAV01@ABV01@@Z @ 12996 NONAME ABSENT ; class QTextBlock::iterator & QTextBlock::iterator::operator=(class QTextBlock::iterator const &) + ??0QIconEngineV2@@QAE@ABV0@@Z @ 12997 NONAME ABSENT ; QIconEngineV2::QIconEngineV2(class QIconEngineV2 const &) + ??0QIconEngineFactoryInterfaceV2@@QAE@XZ @ 12998 NONAME ABSENT ; QIconEngineFactoryInterfaceV2::QIconEngineFactoryInterfaceV2(void) + ??4QTextLine@@QAEAAV0@ABV0@@Z @ 12999 NONAME ABSENT ; class QTextLine & QTextLine::operator=(class QTextLine const &) + ??0QToolBarChangeEvent@@QAE@ABV0@@Z @ 13000 NONAME ABSENT ; QToolBarChangeEvent::QToolBarChangeEvent(class QToolBarChangeEvent const &) + ??0QResizeEvent@@QAE@ABV0@@Z @ 13001 NONAME ABSENT ; QResizeEvent::QResizeEvent(class QResizeEvent const &) + ??0QIconEngineFactoryInterface@@QAE@XZ @ 13002 NONAME ABSENT ; QIconEngineFactoryInterface::QIconEngineFactoryInterface(void) + ??0QPictureFormatInterface@@QAE@XZ @ 13003 NONAME ABSENT ; QPictureFormatInterface::QPictureFormatInterface(void) + ??_EQPolygon@@QAE@I@Z @ 13004 NONAME ABSENT ; QPolygon::~QPolygon(unsigned int) + ??_EQImageReader@@QAE@I@Z @ 13005 NONAME ABSENT ; QImageReader::~QImageReader(unsigned int) + ??4QStyleOptionGraphicsItem@@QAEAAV0@ABV0@@Z @ 13006 NONAME ABSENT ; class QStyleOptionGraphicsItem & QStyleOptionGraphicsItem::operator=(class QStyleOptionGraphicsItem const &) + ??4QStyleOptionProgressBarV2@@QAEAAV0@ABV0@@Z @ 13007 NONAME ABSENT ; class QStyleOptionProgressBarV2 & QStyleOptionProgressBarV2::operator=(class QStyleOptionProgressBarV2 const &) + ??0QDragEnterEvent@@QAE@ABV0@@Z @ 13008 NONAME ABSENT ; QDragEnterEvent::QDragEnterEvent(class QDragEnterEvent const &) + ??_EKey@QPixmapCache@@QAE@I@Z @ 13009 NONAME ABSENT ; QPixmapCache::Key::~Key(unsigned int) + ??_EQCursor@@QAE@I@Z @ 13010 NONAME ABSENT ; QCursor::~QCursor(unsigned int) + ??0QShortcutEvent@@QAE@ABV0@@Z @ 13011 NONAME ABSENT ; QShortcutEvent::QShortcutEvent(class QShortcutEvent const &) + ??_EQTextCursor@@QAE@I@Z @ 13012 NONAME ABSENT ; QTextCursor::~QTextCursor(unsigned int) + ??0QGradient@@QAE@ABV0@@Z @ 13013 NONAME ABSENT ; QGradient::QGradient(class QGradient const &) + ??4QInputMethodEvent@@QAEAAV0@ABV0@@Z @ 13014 NONAME ABSENT ; class QInputMethodEvent & QInputMethodEvent::operator=(class QInputMethodEvent const &) + ??0QVector2D@@QAE@ABV0@@Z @ 13015 NONAME ABSENT ; QVector2D::QVector2D(class QVector2D const &) + ??4QStyleOptionFocusRect@@QAEAAV0@ABV0@@Z @ 13016 NONAME ABSENT ; class QStyleOptionFocusRect & QStyleOptionFocusRect::operator=(class QStyleOptionFocusRect const &) + ??_EQPen@@QAE@I@Z @ 13017 NONAME ABSENT ; QPen::~QPen(unsigned int) + ??_EQKeySequence@@QAE@I@Z @ 13018 NONAME ABSENT ; QKeySequence::~QKeySequence(unsigned int) + ??4QGradient@@QAEAAV0@ABV0@@Z @ 13019 NONAME ABSENT ; class QGradient & QGradient::operator=(class QGradient const &) + ??0QTextTableFormat@@QAE@ABV0@@Z @ 13020 NONAME ABSENT ; QTextTableFormat::QTextTableFormat(class QTextTableFormat const &) + ??_EQImagePixmapCleanupHooks@@QAE@I@Z @ 13021 NONAME ABSENT ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(unsigned int) + ??0QStatusTipEvent@@QAE@ABV0@@Z @ 13022 NONAME ABSENT ; QStatusTipEvent::QStatusTipEvent(class QStatusTipEvent const &) + ??0Value@QCss@@QAE@ABU01@@Z @ 13023 NONAME ABSENT ; QCss::Value::Value(struct QCss::Value const &) + ??4QSizePolicy@@QAEAAV0@ABV0@@Z @ 13024 NONAME ABSENT ; class QSizePolicy & QSizePolicy::operator=(class QSizePolicy const &) + ??_ETouchPoint@QTouchEvent@@QAE@I@Z @ 13025 NONAME ABSENT ; QTouchEvent::TouchPoint::~TouchPoint(unsigned int) + ??4QItemSelection@@QAEAAV0@ABV0@@Z @ 13026 NONAME ABSENT ; class QItemSelection & QItemSelection::operator=(class QItemSelection const &) + ??4QStyleOptionQ3ListView@@QAEAAV0@ABV0@@Z @ 13027 NONAME ABSENT ; class QStyleOptionQ3ListView & QStyleOptionQ3ListView::operator=(class QStyleOptionQ3ListView const &) + ??0QSizePolicy@@QAE@ABV0@@Z @ 13028 NONAME ABSENT ; QSizePolicy::QSizePolicy(class QSizePolicy const &) + ??4QStyleOptionFrameV2@@QAEAAV0@ABV0@@Z @ 13029 NONAME ABSENT ; class QStyleOptionFrameV2 & QStyleOptionFrameV2::operator=(class QStyleOptionFrameV2 const &) + ??4QVector3D@@QAEAAV0@ABV0@@Z @ 13030 NONAME ABSENT ; class QVector3D & QVector3D::operator=(class QVector3D const &) + ??4QStyleOptionQ3DockWindow@@QAEAAV0@ABV0@@Z @ 13031 NONAME ABSENT ; class QStyleOptionQ3DockWindow & QStyleOptionQ3DockWindow::operator=(class QStyleOptionQ3DockWindow const &) + ??_EQFont@@QAE@I@Z @ 13032 NONAME ABSENT ; QFont::~QFont(unsigned int) + ??4QStyleOptionDockWidget@@QAEAAV0@ABV0@@Z @ 13033 NONAME ABSENT ; class QStyleOptionDockWidget & QStyleOptionDockWidget::operator=(class QStyleOptionDockWidget const &) + ??0QPainterState@@QAE@ABV0@@Z @ 13034 NONAME ABSENT ; QPainterState::QPainterState(class QPainterState const &) + ??4QStyleOptionFrame@@QAEAAV0@ABV0@@Z @ 13035 NONAME ABSENT ; class QStyleOptionFrame & QStyleOptionFrame::operator=(class QStyleOptionFrame const &) ?qt_draw_decoration_for_glyphs@@YAXPAVQPainter@@PBIPBUQFixedPoint@@HPAVQFontEngine@@ABVQFont@@ABVQTextCharFormat@@@Z @ 13036 NONAME ; void qt_draw_decoration_for_glyphs(class QPainter *, unsigned int const *, struct QFixedPoint const *, int, class QFontEngine *, class QFont const &, class QTextCharFormat const &) - ??4QTextLength@@QAEAAV0@ABV0@@Z @ 13037 NONAME ; class QTextLength & QTextLength::operator=(class QTextLength const &) - ??0QHelpEvent@@QAE@ABV0@@Z @ 13038 NONAME ; QHelpEvent::QHelpEvent(class QHelpEvent const &) - ??0QContextMenuEvent@@QAE@ABV0@@Z @ 13039 NONAME ; QContextMenuEvent::QContextMenuEvent(class QContextMenuEvent const &) - ??0QWhatsThisClickedEvent@@QAE@ABV0@@Z @ 13040 NONAME ; QWhatsThisClickedEvent::QWhatsThisClickedEvent(class QWhatsThisClickedEvent const &) - ??4QStyleOptionTab@@QAEAAV0@ABV0@@Z @ 13041 NONAME ; class QStyleOptionTab & QStyleOptionTab::operator=(class QStyleOptionTab const &) - ??0QTabletEvent@@QAE@ABV0@@Z @ 13042 NONAME ; QTabletEvent::QTabletEvent(class QTabletEvent const &) - ??4QItemSelectionRange@@QAEAAV0@ABV0@@Z @ 13043 NONAME ; class QItemSelectionRange & QItemSelectionRange::operator=(class QItemSelectionRange const &) - ??_EQStyleOptionViewItemV4@@QAE@I@Z @ 13044 NONAME ; QStyleOptionViewItemV4::~QStyleOptionViewItemV4(unsigned int) - ??0QSymbianGraphicsSystemEx@@QAE@XZ @ 13045 NONAME ; QSymbianGraphicsSystemEx::QSymbianGraphicsSystemEx(void) - ??4QEglProperties@@QAEAAV0@ABV0@@Z @ 13046 NONAME ; class QEglProperties & QEglProperties::operator=(class QEglProperties const &) - ??0QHoverEvent@@QAE@ABV0@@Z @ 13047 NONAME ; QHoverEvent::QHoverEvent(class QHoverEvent const &) - ??0QPaintEngineState@@QAE@XZ @ 13048 NONAME ; QPaintEngineState::QPaintEngineState(void) - ??0QKeyEvent@@QAE@ABV0@@Z @ 13049 NONAME ; QKeyEvent::QKeyEvent(class QKeyEvent const &) - ??0QIconEngine@@QAE@ABV0@@Z @ 13050 NONAME ; QIconEngine::QIconEngine(class QIconEngine const &) - ??4QStyleOptionToolBoxV2@@QAEAAV0@ABV0@@Z @ 13051 NONAME ; class QStyleOptionToolBoxV2 & QStyleOptionToolBoxV2::operator=(class QStyleOptionToolBoxV2 const &) - ??0QImageIOHandlerFactoryInterface@@QAE@XZ @ 13052 NONAME ; QImageIOHandlerFactoryInterface::QImageIOHandlerFactoryInterface(void) - ??_EQRegion@@QAE@I@Z @ 13053 NONAME ; QRegion::~QRegion(unsigned int) - ??4QStyleOptionComplex@@QAEAAV0@ABV0@@Z @ 13054 NONAME ; class QStyleOptionComplex & QStyleOptionComplex::operator=(class QStyleOptionComplex const &) - ??_EFileInfo@QZipReader@@QAE@I@Z @ 13055 NONAME ; QZipReader::FileInfo::~FileInfo(unsigned int) - ??0QBitmap@@QAE@ABV0@@Z @ 13056 NONAME ; QBitmap::QBitmap(class QBitmap const &) + ??4QTextLength@@QAEAAV0@ABV0@@Z @ 13037 NONAME ABSENT ; class QTextLength & QTextLength::operator=(class QTextLength const &) + ??0QHelpEvent@@QAE@ABV0@@Z @ 13038 NONAME ABSENT ; QHelpEvent::QHelpEvent(class QHelpEvent const &) + ??0QContextMenuEvent@@QAE@ABV0@@Z @ 13039 NONAME ABSENT ; QContextMenuEvent::QContextMenuEvent(class QContextMenuEvent const &) + ??0QWhatsThisClickedEvent@@QAE@ABV0@@Z @ 13040 NONAME ABSENT ; QWhatsThisClickedEvent::QWhatsThisClickedEvent(class QWhatsThisClickedEvent const &) + ??4QStyleOptionTab@@QAEAAV0@ABV0@@Z @ 13041 NONAME ABSENT ; class QStyleOptionTab & QStyleOptionTab::operator=(class QStyleOptionTab const &) + ??0QTabletEvent@@QAE@ABV0@@Z @ 13042 NONAME ABSENT ; QTabletEvent::QTabletEvent(class QTabletEvent const &) + ??4QItemSelectionRange@@QAEAAV0@ABV0@@Z @ 13043 NONAME ABSENT ; class QItemSelectionRange & QItemSelectionRange::operator=(class QItemSelectionRange const &) + ??_EQStyleOptionViewItemV4@@QAE@I@Z @ 13044 NONAME ABSENT ; QStyleOptionViewItemV4::~QStyleOptionViewItemV4(unsigned int) + ??0QSymbianGraphicsSystemEx@@QAE@XZ @ 13045 NONAME ABSENT ; QSymbianGraphicsSystemEx::QSymbianGraphicsSystemEx(void) + ??4QEglProperties@@QAEAAV0@ABV0@@Z @ 13046 NONAME ABSENT ; class QEglProperties & QEglProperties::operator=(class QEglProperties const &) + ??0QHoverEvent@@QAE@ABV0@@Z @ 13047 NONAME ABSENT ; QHoverEvent::QHoverEvent(class QHoverEvent const &) + ??0QPaintEngineState@@QAE@XZ @ 13048 NONAME ABSENT ; QPaintEngineState::QPaintEngineState(void) + ??0QKeyEvent@@QAE@ABV0@@Z @ 13049 NONAME ABSENT ; QKeyEvent::QKeyEvent(class QKeyEvent const &) + ??0QIconEngine@@QAE@ABV0@@Z @ 13050 NONAME ABSENT ; QIconEngine::QIconEngine(class QIconEngine const &) + ??4QStyleOptionToolBoxV2@@QAEAAV0@ABV0@@Z @ 13051 NONAME ABSENT ; class QStyleOptionToolBoxV2 & QStyleOptionToolBoxV2::operator=(class QStyleOptionToolBoxV2 const &) + ??0QImageIOHandlerFactoryInterface@@QAE@XZ @ 13052 NONAME ABSENT ; QImageIOHandlerFactoryInterface::QImageIOHandlerFactoryInterface(void) + ??_EQRegion@@QAE@I@Z @ 13053 NONAME ABSENT ; QRegion::~QRegion(unsigned int) + ??4QStyleOptionComplex@@QAEAAV0@ABV0@@Z @ 13054 NONAME ABSENT ; class QStyleOptionComplex & QStyleOptionComplex::operator=(class QStyleOptionComplex const &) + ??_EFileInfo@QZipReader@@QAE@I@Z @ 13055 NONAME ABSENT ; QZipReader::FileInfo::~FileInfo(unsigned int) + ??0QBitmap@@QAE@ABV0@@Z @ 13056 NONAME ABSENT ; QBitmap::QBitmap(class QBitmap const &) ?forceToRaster@QSymbianGraphicsSystemEx@@UAEXPAVQWidget@@@Z @ 13057 NONAME ; void QSymbianGraphicsSystemEx::forceToRaster(class QWidget *) ?leadingSpaceWidth@QTextEngine@@QAE?AUQFixed@@ABUQScriptLine@@@Z @ 13058 NONAME ; struct QFixed QTextEngine::leadingSpaceWidth(struct QScriptLine const &) ?releaseCachedGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13059 NONAME ; void QSymbianGraphicsSystemEx::releaseCachedGpuResources(void) - ??_EQTextFormat@@QAE@I@Z @ 13060 NONAME ; QTextFormat::~QTextFormat(unsigned int) - ??4QStyleOptionTabWidgetFrame@@QAEAAV0@ABV0@@Z @ 13061 NONAME ; class QStyleOptionTabWidgetFrame & QStyleOptionTabWidgetFrame::operator=(class QStyleOptionTabWidgetFrame const &) - ??4QMouseEvent@@QAEAAV0@ABV0@@Z @ 13062 NONAME ; class QMouseEvent & QMouseEvent::operator=(class QMouseEvent const &) - ??_EQPainter@@QAE@I@Z @ 13063 NONAME ; QPainter::~QPainter(unsigned int) - ??4QStyleOptionTabBarBaseV2@@QAEAAV0@ABV0@@Z @ 13064 NONAME ; class QStyleOptionTabBarBaseV2 & QStyleOptionTabBarBaseV2::operator=(class QStyleOptionTabBarBaseV2 const &) - ??4QInputEvent@@QAEAAV0@ABV0@@Z @ 13065 NONAME ; class QInputEvent & QInputEvent::operator=(class QInputEvent const &) - ??_EQPainterPath@@QAE@I@Z @ 13066 NONAME ; QPainterPath::~QPainterPath(unsigned int) - ??4QQuaternion@@QAEAAV0@ABV0@@Z @ 13067 NONAME ; class QQuaternion & QQuaternion::operator=(class QQuaternion const &) - ??4Symbol@QCss@@QAEAAU01@ABU01@@Z @ 13068 NONAME ; struct QCss::Symbol & QCss::Symbol::operator=(struct QCss::Symbol const &) - ??0QIconDragEvent@@QAE@ABV0@@Z @ 13069 NONAME ; QIconDragEvent::QIconDragEvent(class QIconDragEvent const &) - ??0QTextImageFormat@@QAE@ABV0@@Z @ 13070 NONAME ; QTextImageFormat::QTextImageFormat(class QTextImageFormat const &) - ??0QMoveEvent@@QAE@ABV0@@Z @ 13071 NONAME ; QMoveEvent::QMoveEvent(class QMoveEvent const &) - ??0QInputContextFactoryInterface@@QAE@XZ @ 13072 NONAME ; QInputContextFactoryInterface::QInputContextFactoryInterface(void) - ??0QTextFrameFormat@@QAE@ABV0@@Z @ 13073 NONAME ; QTextFrameFormat::QTextFrameFormat(class QTextFrameFormat const &) - ??0Symbol@QCss@@QAE@ABU01@@Z @ 13074 NONAME ; QCss::Symbol::Symbol(struct QCss::Symbol const &) - ??4QStyleOptionFrameV3@@QAEAAV0@ABV0@@Z @ 13075 NONAME ; class QStyleOptionFrameV3 & QStyleOptionFrameV3::operator=(class QStyleOptionFrameV3 const &) - ??0QGraphicsSystem@@QAE@XZ @ 13076 NONAME ; QGraphicsSystem::QGraphicsSystem(void) - ??4QStyleOptionViewItem@@QAEAAV0@ABV0@@Z @ 13077 NONAME ; class QStyleOptionViewItem & QStyleOptionViewItem::operator=(class QStyleOptionViewItem const &) - ??4QStyleOptionProgressBar@@QAEAAV0@ABV0@@Z @ 13078 NONAME ; class QStyleOptionProgressBar & QStyleOptionProgressBar::operator=(class QStyleOptionProgressBar const &) - ??4QStyleOptionRubberBand@@QAEAAV0@ABV0@@Z @ 13079 NONAME ; class QStyleOptionRubberBand & QStyleOptionRubberBand::operator=(class QStyleOptionRubberBand const &) - ??0QDragResponseEvent@@QAE@ABV0@@Z @ 13080 NONAME ; QDragResponseEvent::QDragResponseEvent(class QDragResponseEvent const &) - ??0QIconEngine@@QAE@XZ @ 13081 NONAME ; QIconEngine::QIconEngine(void) - ??_EQBrush@@QAE@I@Z @ 13082 NONAME ; QBrush::~QBrush(unsigned int) - ??_EQTableWidgetSelectionRange@@QAE@I@Z @ 13083 NONAME ; QTableWidgetSelectionRange::~QTableWidgetSelectionRange(unsigned int) - ??4QStyleOptionTabBarBase@@QAEAAV0@ABV0@@Z @ 13084 NONAME ; class QStyleOptionTabBarBase & QStyleOptionTabBarBase::operator=(class QStyleOptionTabBarBase const &) - ??0QTextObjectInterface@@QAE@XZ @ 13085 NONAME ; QTextObjectInterface::QTextObjectInterface(void) - ??0QHideEvent@@QAE@ABV0@@Z @ 13086 NONAME ; QHideEvent::QHideEvent(class QHideEvent const &) - ??0QCloseEvent@@QAE@ABV0@@Z @ 13087 NONAME ; QCloseEvent::QCloseEvent(class QCloseEvent const &) - ??0QTextFrameLayoutData@@QAE@XZ @ 13088 NONAME ; QTextFrameLayoutData::QTextFrameLayoutData(void) - ??4QStyleOptionTabWidgetFrameV2@@QAEAAV0@ABV0@@Z @ 13089 NONAME ; class QStyleOptionTabWidgetFrameV2 & QStyleOptionTabWidgetFrameV2::operator=(class QStyleOptionTabWidgetFrameV2 const &) - ??4QStyleOptionTabV2@@QAEAAV0@ABV0@@Z @ 13090 NONAME ; class QStyleOptionTabV2 & QStyleOptionTabV2::operator=(class QStyleOptionTabV2 const &) + ??_EQTextFormat@@QAE@I@Z @ 13060 NONAME ABSENT ; QTextFormat::~QTextFormat(unsigned int) + ??4QStyleOptionTabWidgetFrame@@QAEAAV0@ABV0@@Z @ 13061 NONAME ABSENT ; class QStyleOptionTabWidgetFrame & QStyleOptionTabWidgetFrame::operator=(class QStyleOptionTabWidgetFrame const &) + ??4QMouseEvent@@QAEAAV0@ABV0@@Z @ 13062 NONAME ABSENT ; class QMouseEvent & QMouseEvent::operator=(class QMouseEvent const &) + ??_EQPainter@@QAE@I@Z @ 13063 NONAME ABSENT ; QPainter::~QPainter(unsigned int) + ??4QStyleOptionTabBarBaseV2@@QAEAAV0@ABV0@@Z @ 13064 NONAME ABSENT ; class QStyleOptionTabBarBaseV2 & QStyleOptionTabBarBaseV2::operator=(class QStyleOptionTabBarBaseV2 const &) + ??4QInputEvent@@QAEAAV0@ABV0@@Z @ 13065 NONAME ABSENT ; class QInputEvent & QInputEvent::operator=(class QInputEvent const &) + ??_EQPainterPath@@QAE@I@Z @ 13066 NONAME ABSENT ; QPainterPath::~QPainterPath(unsigned int) + ??4QQuaternion@@QAEAAV0@ABV0@@Z @ 13067 NONAME ABSENT ; class QQuaternion & QQuaternion::operator=(class QQuaternion const &) + ??4Symbol@QCss@@QAEAAU01@ABU01@@Z @ 13068 NONAME ABSENT ; struct QCss::Symbol & QCss::Symbol::operator=(struct QCss::Symbol const &) + ??0QIconDragEvent@@QAE@ABV0@@Z @ 13069 NONAME ABSENT ; QIconDragEvent::QIconDragEvent(class QIconDragEvent const &) + ??0QTextImageFormat@@QAE@ABV0@@Z @ 13070 NONAME ABSENT ; QTextImageFormat::QTextImageFormat(class QTextImageFormat const &) + ??0QMoveEvent@@QAE@ABV0@@Z @ 13071 NONAME ABSENT ; QMoveEvent::QMoveEvent(class QMoveEvent const &) + ??0QInputContextFactoryInterface@@QAE@XZ @ 13072 NONAME ABSENT ; QInputContextFactoryInterface::QInputContextFactoryInterface(void) + ??0QTextFrameFormat@@QAE@ABV0@@Z @ 13073 NONAME ABSENT ; QTextFrameFormat::QTextFrameFormat(class QTextFrameFormat const &) + ??0Symbol@QCss@@QAE@ABU01@@Z @ 13074 NONAME ABSENT ; QCss::Symbol::Symbol(struct QCss::Symbol const &) + ??4QStyleOptionFrameV3@@QAEAAV0@ABV0@@Z @ 13075 NONAME ABSENT ; class QStyleOptionFrameV3 & QStyleOptionFrameV3::operator=(class QStyleOptionFrameV3 const &) + ??0QGraphicsSystem@@QAE@XZ @ 13076 NONAME ABSENT ; QGraphicsSystem::QGraphicsSystem(void) + ??4QStyleOptionViewItem@@QAEAAV0@ABV0@@Z @ 13077 NONAME ABSENT ; class QStyleOptionViewItem & QStyleOptionViewItem::operator=(class QStyleOptionViewItem const &) + ??4QStyleOptionProgressBar@@QAEAAV0@ABV0@@Z @ 13078 NONAME ABSENT ; class QStyleOptionProgressBar & QStyleOptionProgressBar::operator=(class QStyleOptionProgressBar const &) + ??4QStyleOptionRubberBand@@QAEAAV0@ABV0@@Z @ 13079 NONAME ABSENT ; class QStyleOptionRubberBand & QStyleOptionRubberBand::operator=(class QStyleOptionRubberBand const &) + ??0QDragResponseEvent@@QAE@ABV0@@Z @ 13080 NONAME ABSENT ; QDragResponseEvent::QDragResponseEvent(class QDragResponseEvent const &) + ??0QIconEngine@@QAE@XZ @ 13081 NONAME ABSENT ; QIconEngine::QIconEngine(void) + ??_EQBrush@@QAE@I@Z @ 13082 NONAME ABSENT ; QBrush::~QBrush(unsigned int) + ??_EQTableWidgetSelectionRange@@QAE@I@Z @ 13083 NONAME ABSENT ; QTableWidgetSelectionRange::~QTableWidgetSelectionRange(unsigned int) + ??4QStyleOptionTabBarBase@@QAEAAV0@ABV0@@Z @ 13084 NONAME ABSENT ; class QStyleOptionTabBarBase & QStyleOptionTabBarBase::operator=(class QStyleOptionTabBarBase const &) + ??0QTextObjectInterface@@QAE@XZ @ 13085 NONAME ABSENT ; QTextObjectInterface::QTextObjectInterface(void) + ??0QHideEvent@@QAE@ABV0@@Z @ 13086 NONAME ABSENT ; QHideEvent::QHideEvent(class QHideEvent const &) + ??0QCloseEvent@@QAE@ABV0@@Z @ 13087 NONAME ABSENT ; QCloseEvent::QCloseEvent(class QCloseEvent const &) + ??0QTextFrameLayoutData@@QAE@XZ @ 13088 NONAME ABSENT ; QTextFrameLayoutData::QTextFrameLayoutData(void) + ??4QStyleOptionTabWidgetFrameV2@@QAEAAV0@ABV0@@Z @ 13089 NONAME ABSENT ; class QStyleOptionTabWidgetFrameV2 & QStyleOptionTabWidgetFrameV2::operator=(class QStyleOptionTabWidgetFrameV2 const &) + ??4QStyleOptionTabV2@@QAEAAV0@ABV0@@Z @ 13090 NONAME ABSENT ; class QStyleOptionTabV2 & QStyleOptionTabV2::operator=(class QStyleOptionTabV2 const &) ?platformExtension@QGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 13091 NONAME ; class QGraphicsSystemEx * QGraphicsSystem::platformExtension(void) - ??4QTextListFormat@@QAEAAV0@ABV0@@Z @ 13092 NONAME ; class QTextListFormat & QTextListFormat::operator=(class QTextListFormat const &) - ??_EQPalette@@QAE@I@Z @ 13093 NONAME ; QPalette::~QPalette(unsigned int) + ??4QTextListFormat@@QAEAAV0@ABV0@@Z @ 13092 NONAME ABSENT ; class QTextListFormat & QTextListFormat::operator=(class QTextListFormat const &) + ??_EQPalette@@QAE@I@Z @ 13093 NONAME ABSENT ; QPalette::~QPalette(unsigned int) ?releaseAllGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13094 NONAME ; void QSymbianGraphicsSystemEx::releaseAllGpuResources(void) - ??0QFocusEvent@@QAE@ABV0@@Z @ 13095 NONAME ; QFocusEvent::QFocusEvent(class QFocusEvent const &) - ??4QStyleOptionQ3ListViewItem@@QAEAAV0@ABV0@@Z @ 13096 NONAME ; class QStyleOptionQ3ListViewItem & QStyleOptionQ3ListViewItem::operator=(class QStyleOptionQ3ListViewItem const &) - ??_EQIcon@@QAE@I@Z @ 13097 NONAME ; QIcon::~QIcon(unsigned int) - ??0QTextListFormat@@QAE@ABV0@@Z @ 13098 NONAME ; QTextListFormat::QTextListFormat(class QTextListFormat const &) - ??0QGuiPlatformPluginInterface@@QAE@XZ @ 13099 NONAME ; QGuiPlatformPluginInterface::QGuiPlatformPluginInterface(void) - ??_EQTextLayout@@QAE@I@Z @ 13100 NONAME ; QTextLayout::~QTextLayout(unsigned int) - ??0QWheelEvent@@QAE@ABV0@@Z @ 13101 NONAME ; QWheelEvent::QWheelEvent(class QWheelEvent const &) - ??0QWindowStateChangeEvent@@QAE@ABV0@@Z @ 13102 NONAME ; QWindowStateChangeEvent::QWindowStateChangeEvent(class QWindowStateChangeEvent const &) - ??_EQTextEngine@@QAE@I@Z @ 13103 NONAME ; QTextEngine::~QTextEngine(unsigned int) - ??4QStyleOptionTitleBar@@QAEAAV0@ABV0@@Z @ 13104 NONAME ; class QStyleOptionTitleBar & QStyleOptionTitleBar::operator=(class QStyleOptionTitleBar const &) - ??4Value@QCss@@QAEAAU01@ABU01@@Z @ 13105 NONAME ; struct QCss::Value & QCss::Value::operator=(struct QCss::Value const &) + ??0QFocusEvent@@QAE@ABV0@@Z @ 13095 NONAME ABSENT ; QFocusEvent::QFocusEvent(class QFocusEvent const &) + ??4QStyleOptionQ3ListViewItem@@QAEAAV0@ABV0@@Z @ 13096 NONAME ABSENT ; class QStyleOptionQ3ListViewItem & QStyleOptionQ3ListViewItem::operator=(class QStyleOptionQ3ListViewItem const &) + ??_EQIcon@@QAE@I@Z @ 13097 NONAME ABSENT ; QIcon::~QIcon(unsigned int) + ??0QTextListFormat@@QAE@ABV0@@Z @ 13098 NONAME ABSENT ; QTextListFormat::QTextListFormat(class QTextListFormat const &) + ??0QGuiPlatformPluginInterface@@QAE@XZ @ 13099 NONAME ABSENT ; QGuiPlatformPluginInterface::QGuiPlatformPluginInterface(void) + ??_EQTextLayout@@QAE@I@Z @ 13100 NONAME ABSENT ; QTextLayout::~QTextLayout(unsigned int) + ??0QWheelEvent@@QAE@ABV0@@Z @ 13101 NONAME ABSENT ; QWheelEvent::QWheelEvent(class QWheelEvent const &) + ??0QWindowStateChangeEvent@@QAE@ABV0@@Z @ 13102 NONAME ABSENT ; QWindowStateChangeEvent::QWindowStateChangeEvent(class QWindowStateChangeEvent const &) + ??_EQTextEngine@@QAE@I@Z @ 13103 NONAME ABSENT ; QTextEngine::~QTextEngine(unsigned int) + ??4QStyleOptionTitleBar@@QAEAAV0@ABV0@@Z @ 13104 NONAME ABSENT ; class QStyleOptionTitleBar & QStyleOptionTitleBar::operator=(class QStyleOptionTitleBar const &) + ??4Value@QCss@@QAEAAU01@ABU01@@Z @ 13105 NONAME ABSENT ; struct QCss::Value & QCss::Value::operator=(struct QCss::Value const &) ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 13106 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) - ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13107 NONAME ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) - ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13108 NONAME ; class QBitmap & QBitmap::operator=(class QBitmap const &) - ??0QItemSelection@@QAE@ABV0@@Z @ 13109 NONAME ; QItemSelection::QItemSelection(class QItemSelection const &) - ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13110 NONAME ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) + ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13107 NONAME ABSENT ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) + ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13108 NONAME ABSENT ; class QBitmap & QBitmap::operator=(class QBitmap const &) + ??0QItemSelection@@QAE@ABV0@@Z @ 13109 NONAME ABSENT ; QItemSelection::QItemSelection(class QItemSelection const &) + ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13110 NONAME ABSENT ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) ?setInstantInvalidatePropagation@QGraphicsLayout@@SAX_N@Z @ 13111 NONAME ; void QGraphicsLayout::setInstantInvalidatePropagation(bool) ?instantInvalidatePropagation@QGraphicsLayout@@SA_NXZ @ 13112 NONAME ; bool QGraphicsLayout::instantInvalidatePropagation(void) diff --git a/src/s60installs/bwins/QtMultimediau.def b/src/s60installs/bwins/QtMultimediau.def index 19e6bc7..763360b 100644 --- a/src/s60installs/bwins/QtMultimediau.def +++ b/src/s60installs/bwins/QtMultimediau.def @@ -274,9 +274,9 @@ EXPORTS ?sampleRate@QAudioFormat@@QBEHXZ @ 273 NONAME ; int QAudioFormat::sampleRate(void) const ?supportedSampleRates@QAudioDeviceInfo@@QBE?AV?$QList@H@@XZ @ 274 NONAME ; class QList QAudioDeviceInfo::supportedSampleRates(void) const ?setChannelCount@QAudioFormat@@QAEXH@Z @ 275 NONAME ; void QAudioFormat::setChannelCount(int) - ??0QAbstractAudioInput@@QAE@XZ @ 276 NONAME ; QAbstractAudioInput::QAbstractAudioInput(void) - ??0QAudioEngineFactoryInterface@@QAE@XZ @ 277 NONAME ; QAudioEngineFactoryInterface::QAudioEngineFactoryInterface(void) - ??0QAbstractAudioDeviceInfo@@QAE@XZ @ 278 NONAME ; QAbstractAudioDeviceInfo::QAbstractAudioDeviceInfo(void) - ??0QAbstractAudioOutput@@QAE@XZ @ 279 NONAME ; QAbstractAudioOutput::QAbstractAudioOutput(void) - ??_EQAudioDeviceInfo@@QAE@I@Z @ 280 NONAME ; QAudioDeviceInfo::~QAudioDeviceInfo(unsigned int) + ??0QAbstractAudioInput@@QAE@XZ @ 276 NONAME ABSENT ; QAbstractAudioInput::QAbstractAudioInput(void) + ??0QAudioEngineFactoryInterface@@QAE@XZ @ 277 NONAME ABSENT ; QAudioEngineFactoryInterface::QAudioEngineFactoryInterface(void) + ??0QAbstractAudioDeviceInfo@@QAE@XZ @ 278 NONAME ABSENT ; QAbstractAudioDeviceInfo::QAbstractAudioDeviceInfo(void) + ??0QAbstractAudioOutput@@QAE@XZ @ 279 NONAME ABSENT ; QAbstractAudioOutput::QAbstractAudioOutput(void) + ??_EQAudioDeviceInfo@@QAE@I@Z @ 280 NONAME ABSENT ; QAudioDeviceInfo::~QAudioDeviceInfo(unsigned int) diff --git a/src/s60installs/bwins/QtNetworku.def b/src/s60installs/bwins/QtNetworku.def index c044693..b3137d8 100644 --- a/src/s60installs/bwins/QtNetworku.def +++ b/src/s60installs/bwins/QtNetworku.def @@ -1145,18 +1145,18 @@ EXPORTS ?setNetworkAccessible@QNetworkAccessManager@@QAEXW4NetworkAccessibility@1@@Z @ 1144 NONAME ; void QNetworkAccessManager::setNetworkAccessible(enum QNetworkAccessManager::NetworkAccessibility) ??_EQBearerEngineFactoryInterface@@UAE@I@Z @ 1145 NONAME ; QBearerEngineFactoryInterface::~QBearerEngineFactoryInterface(unsigned int) ?enablePolling@QNetworkConfigurationManagerPrivate@@QAEXXZ @ 1146 NONAME ; void QNetworkConfigurationManagerPrivate::enablePolling(void) - ??_EQSslError@@QAE@I@Z @ 1147 NONAME ; QSslError::~QSslError(unsigned int) - ??0QBearerEngineFactoryInterface@@QAE@XZ @ 1148 NONAME ; QBearerEngineFactoryInterface::QBearerEngineFactoryInterface(void) - ??_EQSslCipher@@QAE@I@Z @ 1149 NONAME ; QSslCipher::~QSslCipher(unsigned int) - ??_EQSslConfiguration@@QAE@I@Z @ 1150 NONAME ; QSslConfiguration::~QSslConfiguration(unsigned int) - ??_EQSslCertificate@@QAE@I@Z @ 1151 NONAME ; QSslCertificate::~QSslCertificate(unsigned int) - ??_EQNetworkInterface@@QAE@I@Z @ 1152 NONAME ; QNetworkInterface::~QNetworkInterface(unsigned int) - ??_EQNetworkProxy@@QAE@I@Z @ 1153 NONAME ; QNetworkProxy::~QNetworkProxy(unsigned int) - ??_EQHostAddress@@QAE@I@Z @ 1154 NONAME ; QHostAddress::~QHostAddress(unsigned int) - ??_EQNetworkConfiguration@@QAE@I@Z @ 1155 NONAME ; QNetworkConfiguration::~QNetworkConfiguration(unsigned int) - ??_EQHostInfo@@QAE@I@Z @ 1156 NONAME ; QHostInfo::~QHostInfo(unsigned int) - ??_EQNetworkRequest@@QAE@I@Z @ 1157 NONAME ; QNetworkRequest::~QNetworkRequest(unsigned int) - ??4QIPv6Address@@QAEAAV0@ABV0@@Z @ 1158 NONAME ; class QIPv6Address & QIPv6Address::operator=(class QIPv6Address const &) - ??_EQNetworkAddressEntry@@QAE@I@Z @ 1159 NONAME ; QNetworkAddressEntry::~QNetworkAddressEntry(unsigned int) - ??_EQNetworkCookie@@QAE@I@Z @ 1160 NONAME ; QNetworkCookie::~QNetworkCookie(unsigned int) + ??_EQSslError@@QAE@I@Z @ 1147 NONAME ABSENT ; QSslError::~QSslError(unsigned int) + ??0QBearerEngineFactoryInterface@@QAE@XZ @ 1148 NONAME ABSENT ; QBearerEngineFactoryInterface::QBearerEngineFactoryInterface(void) + ??_EQSslCipher@@QAE@I@Z @ 1149 NONAME ABSENT ; QSslCipher::~QSslCipher(unsigned int) + ??_EQSslConfiguration@@QAE@I@Z @ 1150 NONAME ABSENT ; QSslConfiguration::~QSslConfiguration(unsigned int) + ??_EQSslCertificate@@QAE@I@Z @ 1151 NONAME ABSENT ; QSslCertificate::~QSslCertificate(unsigned int) + ??_EQNetworkInterface@@QAE@I@Z @ 1152 NONAME ABSENT ; QNetworkInterface::~QNetworkInterface(unsigned int) + ??_EQNetworkProxy@@QAE@I@Z @ 1153 NONAME ABSENT ; QNetworkProxy::~QNetworkProxy(unsigned int) + ??_EQHostAddress@@QAE@I@Z @ 1154 NONAME ABSENT ; QHostAddress::~QHostAddress(unsigned int) + ??_EQNetworkConfiguration@@QAE@I@Z @ 1155 NONAME ABSENT ; QNetworkConfiguration::~QNetworkConfiguration(unsigned int) + ??_EQHostInfo@@QAE@I@Z @ 1156 NONAME ABSENT ; QHostInfo::~QHostInfo(unsigned int) + ??_EQNetworkRequest@@QAE@I@Z @ 1157 NONAME ABSENT ; QNetworkRequest::~QNetworkRequest(unsigned int) + ??4QIPv6Address@@QAEAAV0@ABV0@@Z @ 1158 NONAME ABSENT ; class QIPv6Address & QIPv6Address::operator=(class QIPv6Address const &) + ??_EQNetworkAddressEntry@@QAE@I@Z @ 1159 NONAME ABSENT ; QNetworkAddressEntry::~QNetworkAddressEntry(unsigned int) + ??_EQNetworkCookie@@QAE@I@Z @ 1160 NONAME ABSENT ; QNetworkCookie::~QNetworkCookie(unsigned int) diff --git a/src/s60installs/bwins/QtScriptu.def b/src/s60installs/bwins/QtScriptu.def index 3185819..2048e36 100644 --- a/src/s60installs/bwins/QtScriptu.def +++ b/src/s60installs/bwins/QtScriptu.def @@ -405,6 +405,6 @@ EXPORTS ?compare@QScriptDeclarativeClass@@UAE_NPAUObject@1@0@Z @ 404 NONAME ; bool QScriptDeclarativeClass::compare(struct QScriptDeclarativeClass::Object *, struct QScriptDeclarativeClass::Object *) ?toString@PersistentIdentifier@QScriptDeclarativeClass@@QBE?AVQString@@XZ @ 405 NONAME ; class QString QScriptDeclarativeClass::PersistentIdentifier::toString(void) const ?startsWithUpper@QScriptDeclarativeClass@@QAE_NABQAX@Z @ 406 NONAME ; bool QScriptDeclarativeClass::startsWithUpper(void * const const &) - ??0QScriptExtensionInterface@@QAE@XZ @ 407 NONAME ; QScriptExtensionInterface::QScriptExtensionInterface(void) - ??_EQScriptValue@@QAE@I@Z @ 408 NONAME ; QScriptValue::~QScriptValue(unsigned int) + ??0QScriptExtensionInterface@@QAE@XZ @ 407 NONAME ABSENT ; QScriptExtensionInterface::QScriptExtensionInterface(void) + ??_EQScriptValue@@QAE@I@Z @ 408 NONAME ABSENT ; QScriptValue::~QScriptValue(unsigned int) diff --git a/src/s60installs/bwins/QtSqlu.def b/src/s60installs/bwins/QtSqlu.def index 8b857c1..777e86e 100644 --- a/src/s60installs/bwins/QtSqlu.def +++ b/src/s60installs/bwins/QtSqlu.def @@ -458,7 +458,7 @@ EXPORTS ?staticMetaObject@QSqlDriver@@2UQMetaObject@@B @ 457 NONAME ; struct QMetaObject const QSqlDriver::staticMetaObject ?staticMetaObject@QSqlQueryModel@@2UQMetaObject@@B @ 458 NONAME ; struct QMetaObject const QSqlQueryModel::staticMetaObject ?staticMetaObject@QSQLiteDriver@@2UQMetaObject@@B @ 459 NONAME ; struct QMetaObject const QSQLiteDriver::staticMetaObject - ??4QSqlRelation@@QAEAAV0@ABV0@@Z @ 460 NONAME ; class QSqlRelation & QSqlRelation::operator=(class QSqlRelation const &) - ??0QSqlDriverFactoryInterface@@QAE@XZ @ 461 NONAME ; QSqlDriverFactoryInterface::QSqlDriverFactoryInterface(void) - ??0QSqlRelation@@QAE@ABV0@@Z @ 462 NONAME ; QSqlRelation::QSqlRelation(class QSqlRelation const &) + ??4QSqlRelation@@QAEAAV0@ABV0@@Z @ 460 NONAME ABSENT ; class QSqlRelation & QSqlRelation::operator=(class QSqlRelation const &) + ??0QSqlDriverFactoryInterface@@QAE@XZ @ 461 NONAME ABSENT ; QSqlDriverFactoryInterface::QSqlDriverFactoryInterface(void) + ??0QSqlRelation@@QAE@ABV0@@Z @ 462 NONAME ABSENT ; QSqlRelation::QSqlRelation(class QSqlRelation const &) diff --git a/src/s60installs/bwins/QtTestu.def b/src/s60installs/bwins/QtTestu.def index 40ff5e2..ba3b167 100644 --- a/src/s60installs/bwins/QtTestu.def +++ b/src/s60installs/bwins/QtTestu.def @@ -107,7 +107,7 @@ EXPORTS ?addSkip@QTestResult@@SAXPBDW4SkipMode@QTest@@0H@Z @ 106 NONAME ; void QTestResult::addSkip(char const *, enum QTest::SkipMode, char const *, int) ?currentGlobalDataTag@QTestResult@@SAPBDXZ @ 107 NONAME ; char const * QTestResult::currentGlobalDataTag(void) ?stopLogging@QTestLog@@SAXXZ @ 108 NONAME ; void QTestLog::stopLogging(void) - ??_EQTestData@@QAE@I@Z @ 109 NONAME ; QTestData::~QTestData(unsigned int) + ??_EQTestData@@QAE@I@Z @ 109 NONAME ABSENT ; QTestData::~QTestData(unsigned int) ??1QTestLog@@AAE@XZ @ 110 NONAME ; QTestLog::~QTestLog(void) ?skipCount@QTestResult@@SAHXZ @ 111 NONAME ; int QTestResult::skipCount(void) ?setCurrentGlobalTestData@QTestResult@@SAXPAVQTestData@@@Z @ 112 NONAME ; void QTestResult::setCurrentGlobalTestData(class QTestData *) @@ -140,7 +140,7 @@ EXPORTS ?currentTestFailed@QTestResult@@SA_NXZ @ 139 NONAME ; bool QTestResult::currentTestFailed(void) ?compare@QTestResult@@SA_N_NPBDPAD2111H@Z @ 140 NONAME ; bool QTestResult::compare(bool, char const *, char *, char *, char const *, char const *, char const *, int) ?addXFail@QTestLog@@SAXPBD0H@Z @ 141 NONAME ; void QTestLog::addXFail(char const *, char const *, int) - ??_EQTestTable@@QAE@I@Z @ 142 NONAME ; QTestTable::~QTestTable(unsigned int) + ??_EQTestTable@@QAE@I@Z @ 142 NONAME ABSENT ; QTestTable::~QTestTable(unsigned int) ??0QBenchmarkGlobalData@@QAE@XZ @ 143 NONAME ; QBenchmarkGlobalData::QBenchmarkGlobalData(void) ?beginDataRun@QBenchmarkTestMethodData@@QAEXXZ @ 144 NONAME ; void QBenchmarkTestMethodData::beginDataRun(void) ?resultsAccepted@QBenchmarkTestMethodData@@QBE_NXZ @ 145 NONAME ; bool QBenchmarkTestMethodData::resultsAccepted(void) const diff --git a/src/s60installs/bwins/QtXmlPatternsu.def b/src/s60installs/bwins/QtXmlPatternsu.def index 5a458b3..9d553e1 100644 --- a/src/s60installs/bwins/QtXmlPatternsu.def +++ b/src/s60installs/bwins/QtXmlPatternsu.def @@ -277,7 +277,7 @@ EXPORTS ?writeEscapedAttribute@QXmlSerializer@@AAEXABVQString@@@Z @ 276 NONAME ; void QXmlSerializer::writeEscapedAttribute(class QString const &) ?staticMetaObject@QAbstractMessageHandler@@2UQMetaObject@@B @ 277 NONAME ; struct QMetaObject const QAbstractMessageHandler::staticMetaObject ?staticMetaObject@QAbstractUriResolver@@2UQMetaObject@@B @ 278 NONAME ; struct QMetaObject const QAbstractUriResolver::staticMetaObject - ??_EQXmlQuery@@QAE@I@Z @ 279 NONAME ; QXmlQuery::~QXmlQuery(unsigned int) - ??4QXmlNodeModelIndex@@QAEAAV0@ABV0@@Z @ 280 NONAME ; class QXmlNodeModelIndex & QXmlNodeModelIndex::operator=(class QXmlNodeModelIndex const &) - ??_EQXmlItem@@QAE@I@Z @ 281 NONAME ; QXmlItem::~QXmlItem(unsigned int) + ??_EQXmlQuery@@QAE@I@Z @ 279 NONAME ABSENT ; QXmlQuery::~QXmlQuery(unsigned int) + ??4QXmlNodeModelIndex@@QAEAAV0@ABV0@@Z @ 280 NONAME ABSENT ; class QXmlNodeModelIndex & QXmlNodeModelIndex::operator=(class QXmlNodeModelIndex const &) + ??_EQXmlItem@@QAE@I@Z @ 281 NONAME ABSENT ; QXmlItem::~QXmlItem(unsigned int) diff --git a/src/s60installs/bwins/QtXmlu.def b/src/s60installs/bwins/QtXmlu.def index f54e317..c77f5ed 100644 --- a/src/s60installs/bwins/QtXmlu.def +++ b/src/s60installs/bwins/QtXmlu.def @@ -400,11 +400,11 @@ EXPORTS ?warning@QXmlDefaultHandler@@UAE_NABVQXmlParseException@@@Z @ 399 NONAME ; bool QXmlDefaultHandler::warning(class QXmlParseException const &) ?EndOfDocument@QXmlInputSource@@2GB @ 400 NONAME ; unsigned short const QXmlInputSource::EndOfDocument ?EndOfData@QXmlInputSource@@2GB @ 401 NONAME ; unsigned short const QXmlInputSource::EndOfData - ??0QXmlContentHandler@@QAE@XZ @ 402 NONAME ; QXmlContentHandler::QXmlContentHandler(void) - ??0QXmlDTDHandler@@QAE@XZ @ 403 NONAME ; QXmlDTDHandler::QXmlDTDHandler(void) - ??0QXmlReader@@QAE@XZ @ 404 NONAME ; QXmlReader::QXmlReader(void) - ??0QXmlLexicalHandler@@QAE@XZ @ 405 NONAME ; QXmlLexicalHandler::QXmlLexicalHandler(void) - ??0QXmlDeclHandler@@QAE@XZ @ 406 NONAME ; QXmlDeclHandler::QXmlDeclHandler(void) - ??0QXmlEntityResolver@@QAE@XZ @ 407 NONAME ; QXmlEntityResolver::QXmlEntityResolver(void) - ??0QXmlErrorHandler@@QAE@XZ @ 408 NONAME ; QXmlErrorHandler::QXmlErrorHandler(void) + ??0QXmlContentHandler@@QAE@XZ @ 402 NONAME ABSENT ; QXmlContentHandler::QXmlContentHandler(void) + ??0QXmlDTDHandler@@QAE@XZ @ 403 NONAME ABSENT ; QXmlDTDHandler::QXmlDTDHandler(void) + ??0QXmlReader@@QAE@XZ @ 404 NONAME ABSENT ; QXmlReader::QXmlReader(void) + ??0QXmlLexicalHandler@@QAE@XZ @ 405 NONAME ABSENT ; QXmlLexicalHandler::QXmlLexicalHandler(void) + ??0QXmlDeclHandler@@QAE@XZ @ 406 NONAME ABSENT ; QXmlDeclHandler::QXmlDeclHandler(void) + ??0QXmlEntityResolver@@QAE@XZ @ 407 NONAME ABSENT ; QXmlEntityResolver::QXmlEntityResolver(void) + ??0QXmlErrorHandler@@QAE@XZ @ 408 NONAME ABSENT ; QXmlErrorHandler::QXmlErrorHandler(void) diff --git a/src/s60installs/bwins/phononu.def b/src/s60installs/bwins/phononu.def index 15f83b1..71d1a80 100644 --- a/src/s60installs/bwins/phononu.def +++ b/src/s60installs/bwins/phononu.def @@ -570,8 +570,8 @@ EXPORTS ?setOutputDevice@PulseSupport@Phonon@@QAE_NVQString@@H@Z @ 569 NONAME ; bool Phonon::PulseSupport::setOutputDevice(class QString, int) ?qt_metacast@AudioDataOutput@Phonon@@UAEPAXPBD@Z @ 570 NONAME ; void * Phonon::AudioDataOutput::qt_metacast(char const *) ?clearStreamCache@PulseSupport@Phonon@@QAEXVQString@@@Z @ 571 NONAME ; void Phonon::PulseSupport::clearStreamCache(class QString) - ??_EEffectParameter@Phonon@@QAE@I@Z @ 572 NONAME ; Phonon::EffectParameter::~EffectParameter(unsigned int) - ??_EPath@Phonon@@QAE@I@Z @ 573 NONAME ; Phonon::Path::~Path(unsigned int) - ??_EMediaSource@Phonon@@QAE@I@Z @ 574 NONAME ; Phonon::MediaSource::~MediaSource(unsigned int) - ??_EObjectDescriptionData@Phonon@@QAE@I@Z @ 575 NONAME ; Phonon::ObjectDescriptionData::~ObjectDescriptionData(unsigned int) + ??_EEffectParameter@Phonon@@QAE@I@Z @ 572 NONAME ABSENT ; Phonon::EffectParameter::~EffectParameter(unsigned int) + ??_EPath@Phonon@@QAE@I@Z @ 573 NONAME ABSENT ; Phonon::Path::~Path(unsigned int) + ??_EMediaSource@Phonon@@QAE@I@Z @ 574 NONAME ABSENT ; Phonon::MediaSource::~MediaSource(unsigned int) + ??_EObjectDescriptionData@Phonon@@QAE@I@Z @ 575 NONAME ABSENT ; Phonon::ObjectDescriptionData::~ObjectDescriptionData(unsigned int) -- cgit v0.12 From 4e9286880fd2686e61de2c4be3c317e01f0d9989 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 20 May 2011 14:12:57 +0200 Subject: Add some autotests and benchmarks for QUuid Missing those functions for optimization. Reviewed-by: joao --- tests/auto/quuid/tst_quuid.cpp | 65 +++++++++++++++- .../benchmarks/corelib/plugin/quuid/tst_quuid.cpp | 89 ++++++++++++++++++++++ 2 files changed, 152 insertions(+), 2 deletions(-) diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index 50e48c9..f24c893 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -60,7 +60,10 @@ public: tst_QUuid(); private slots: + void fromChar(); void toString(); + void fromString(); + void check_QDataStream(); void isNull(); void equal(); void notEqual(); @@ -83,16 +86,74 @@ public: tst_QUuid::tst_QUuid() { - uuidA = "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"; - uuidB = "{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"; + //"{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"; + uuidA = QUuid(0xfc69b59e, 0xcc34 ,0x4436 ,0xa4 ,0x3c ,0xee ,0x95 ,0xd1 ,0x28 ,0xb8 ,0xc5); + + //"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"; + uuidB = QUuid(0x1ab6e93a ,0xb1cb ,0x4a87 ,0xba ,0x47 ,0xec ,0x7e ,0x99 ,0x03 ,0x9a ,0x7b); } +void tst_QUuid::fromChar() +{ + QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")); + QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5")); + QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c")); + QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34")); + QCOMPARE(QUuid(), QUuid("fc69b59e-cc34-")); + QCOMPARE(QUuid(), QUuid("fc69b59e-cc34")); + QCOMPARE(QUuid(), QUuid("cc34")); + QCOMPARE(QUuid(), QUuid(NULL)); + + QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); +} void tst_QUuid::toString() { QCOMPARE(uuidA.toString(), QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + + QCOMPARE(uuidB.toString(), QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")); } +void tst_QUuid::fromString() +{ + QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(QUuid(), QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c"))); + + QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); +} + +void tst_QUuid::check_QDataStream() +{ + QUuid tmp; + QByteArray ar; + { + QDataStream out(&ar,QIODevice::WriteOnly); + out.setByteOrder(QDataStream::BigEndian); + out << uuidA; + } + { + QDataStream in(&ar,QIODevice::ReadOnly); + in.setByteOrder(QDataStream::BigEndian); + in >> tmp; + QCOMPARE(uuidA, tmp); + } + { + QDataStream out(&ar,QIODevice::WriteOnly); + out.setByteOrder(QDataStream::LittleEndian); + out << uuidA; + } + { + QDataStream in(&ar,QIODevice::ReadOnly); + in.setByteOrder(QDataStream::LittleEndian); + in >> tmp; + QCOMPARE(uuidA, tmp); + } +} void tst_QUuid::isNull() { diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp index 9e885ee..47a3d3f 100644 --- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp @@ -53,6 +53,14 @@ public: private slots: void createUuid(); + void fromChar(); + void toString(); + void fromString(); + void toDataStream(); + void fromDataStream(); + void isNull(); + void operatorLess(); + void operatorMore(); }; void tst_bench_QUuid::createUuid() @@ -62,5 +70,86 @@ void tst_bench_QUuid::createUuid() } } +void tst_bench_QUuid::fromChar() +{ + QBENCHMARK { + QUuid uuid("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"); + } +} + +void tst_bench_QUuid::toString() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toString(); + } +} + +void tst_bench_QUuid::fromString() +{ + QString string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"; + QBENCHMARK { + QUuid uuid(string); + } +} + +void tst_bench_QUuid::toDataStream() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + QByteArray ar; + { + QDataStream out(&ar,QIODevice::WriteOnly); + QBENCHMARK { + out << uuid1; + } + } +} + +void tst_bench_QUuid::fromDataStream() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + QByteArray ar; + { + QDataStream out(&ar,QIODevice::WriteOnly); + out << uuid1; + } + { + QDataStream in(&ar,QIODevice::ReadOnly); + QBENCHMARK { + in >> uuid2; + } + } +} + +void tst_bench_QUuid::isNull() +{ + QUuid uuid = QUuid(); + QBENCHMARK { + uuid.isNull(); + } +} + +void tst_bench_QUuid::operatorLess() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + uuid2 = QUuid::createUuid(); + QBENCHMARK { + uuid1 < uuid2; + } +} + +void tst_bench_QUuid::operatorMore() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + uuid2 = QUuid::createUuid(); + QBENCHMARK { + uuid1 > uuid2; + } +} + QTEST_MAIN(tst_bench_QUuid); #include "tst_quuid.moc" -- cgit v0.12 From 7ce566ed82666ac08f137f4d8590ce589d42c82a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 20 May 2011 11:07:06 +0200 Subject: Optimize QUuid::toString() and relevant QUuid::toString() and QUuid(const QString &) are too slow now. Task-number: QTBUG-19418 Reviewed-by: joao Reviewed-by: Denis Dzyubenko Reviewed-by: Ritt Konstantin Reviewed-by: Robin Burchell Reviewed-by: Richard J. Moore --- src/corelib/plugin/quuid.cpp | 153 ++++++++++++++++++++++++++++--------------- src/corelib/plugin/quuid.h | 2 +- 2 files changed, 100 insertions(+), 55 deletions(-) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index ba47bec..e4adf13 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -42,9 +42,97 @@ #include "quuid.h" #include "qdatastream.h" +#include "qendian.h" QT_BEGIN_NAMESPACE +#ifndef QT_NO_QUUID_STRING +template +void _q_toHex(Char *&dst, Integral value) +{ + static const char digits[] = "0123456789abcdef"; + + if (sizeof(Integral) > 1) + value = qToBigEndian(value); + + const char* p = reinterpret_cast(&value); + + for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) { + uint j = (p[i] >> 4) & 0xf; + dst[0] = Char(digits[j]); + j = p[i] & 0xf; + dst[1] = Char(digits[j]); + } +} + +template +bool _q_fromHex(const Char *&src, Integral &value) +{ + value = 0; + + for (uint i = 0; i < sizeof(Integral) * 2; ++i) { + int ch = *src++; + int tmp; + if (ch >= '0' && ch <= '9') + tmp = ch - '0'; + else if (ch >= 'a' && ch <= 'f') + tmp = ch - 'a' + 10; + else if (ch >= 'A' && ch <= 'F') + tmp = ch - 'A' + 10; + else + return false; + + value = value * 16 + tmp; + } + + return true; +} + +template +void _q_uuidToHex(Char *&dst, const uint &d1, const ushort &d2, const ushort &d3, const uchar (&d4)[8]) +{ + *dst++ = Char('{'); + _q_toHex(dst, d1); + *dst++ = Char('-'); + _q_toHex(dst, d2); + *dst++ = Char('-'); + _q_toHex(dst, d3); + *dst++ = Char('-'); + for (int i = 0; i < 2; i++) + _q_toHex(dst, d4[i]); + *dst++ = Char('-'); + for (int i = 2; i < 8; i++) + _q_toHex(dst, d4[i]); + *dst = Char('}'); +} + +template +bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&d4)[8]) +{ + if (*src == Char('{')) + src++; + if (!_q_fromHex(src, d1) + || *src++ != Char('-') + || !_q_fromHex(src, d2) + || *src++ != Char('-') + || !_q_fromHex(src, d3) + || *src++ != Char('-') + || !_q_fromHex(src, d4[0]) + || !_q_fromHex(src, d4[1]) + || *src++ != Char('-') + || !_q_fromHex(src, d4[2]) + || !_q_fromHex(src, d4[3]) + || !_q_fromHex(src, d4[4]) + || !_q_fromHex(src, d4[5]) + || !_q_fromHex(src, d4[6]) + || !_q_fromHex(src, d4[7])) { + return false; + } + + return true; +} +#endif + /*! \class QUuid \brief The QUuid class stores a Universally Unique Identifier (UUID). @@ -231,50 +319,22 @@ QT_BEGIN_NAMESPACE */ QUuid::QUuid(const QString &text) { - bool ok; - if (text.isEmpty()) { - *this = QUuid(); - return; - } - QString temp = text.toUpper(); - if (temp[0] != QLatin1Char('{')) - temp = QLatin1Char('{') + text; - if (text[(int)text.length()-1] != QLatin1Char('}')) - temp += QLatin1Char('}'); - - data1 = temp.mid(1, 8).toULongLong(&ok, 16); - if (!ok) { + if (text.length() < 36) { *this = QUuid(); return; } - data2 = temp.mid(10, 4).toUInt(&ok, 16); - if (!ok) { - *this = QUuid(); - return; - } - data3 = temp.mid(15, 4).toUInt(&ok, 16); - if (!ok) { - *this = QUuid(); - return; - } - data4[0] = temp.mid(20, 2).toUInt(&ok, 16); - if (!ok) { + const ushort *data = reinterpret_cast(text.unicode()); + + if (*data == '{' && text.length() < 37) { *this = QUuid(); return; } - data4[1] = temp.mid(22, 2).toUInt(&ok, 16); - if (!ok) { + + if (!_q_uuidFromHex(data, data1, data2, data3, data4)) { *this = QUuid(); return; } - for (int i = 2; i<8; i++) { - data4[i] = temp.mid(25 + (i-2)*2, 2).toUShort(&ok, 16); - if (!ok) { - *this = QUuid(); - return; - } - } } /*! @@ -308,11 +368,6 @@ QUuid::QUuid(const char *text) \sa toString() */ -static QString uuidhex(uint data, int digits) -{ - return QString::number(data, 16).rightJustified(digits, QLatin1Char('0')); -} - /*! Returns the string representation of this QUuid. The string is formatted as five hex fields separated by '-' and enclosed in @@ -349,22 +404,12 @@ static QString uuidhex(uint data, int digits) */ QString QUuid::toString() const { - QString result; - - QChar dash = QLatin1Char('-'); - result = QLatin1Char('{') + uuidhex(data1,8); - result += dash; - result += uuidhex(data2,4); - result += dash; - result += uuidhex(data3,4); - result += dash; - result += uuidhex(data4[0],2); - result += uuidhex(data4[1],2); - result += dash; - for (int i = 2; i < 8; i++) - result += uuidhex(data4[i],2); + QString result(38, Qt::Uninitialized); + ushort *data = (ushort *)result.unicode(); - return result + QLatin1Char('}'); + _q_uuidToHex(data, data1, data2, data3, data4); + + return result; } #endif diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 37bcd08..39f0179 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -108,7 +108,7 @@ struct Q_CORE_EXPORT QUuid QUuid(const QString &); QUuid(const char *); QString toString() const; - operator QString() const { return toString(); } + operator QString() const { return toString(); } // ### Qt5 remove #endif bool isNull() const; -- cgit v0.12 From 71f923f29e2c60444a85fc765fc582e06cb7eca4 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 20 May 2011 11:36:01 +0200 Subject: Add QUuid::toByteArray() and relevant Add QUuid::toByteArray() and QUuid(const QByteArray &). Same behavior with QUuid::toString() and QUuid(const QString &). Task-number: QTBUG-19419 Reviewed-by: joao --- src/corelib/plugin/quuid.cpp | 79 ++++++++++++++++++++++ src/corelib/plugin/quuid.h | 2 + tests/auto/quuid/tst_quuid.cpp | 20 ++++++ .../benchmarks/corelib/plugin/quuid/tst_quuid.cpp | 18 +++++ 4 files changed, 119 insertions(+) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index e4adf13..c80d0f5 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -344,6 +344,39 @@ QUuid::QUuid(const char *text) { *this = QUuid(QString::fromLatin1(text)); } + +/*! + Creates a QUuid object from the QByteArray \a text, which must be + formatted as five hex fields separated by '-', e.g., + "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex + digit. The curly braces shown here are optional, but it is normal to + include them. If the conversion fails, a null UUID is created. See + toByteArray() for an explanation of how the five hex fields map to the + public data members in QUuid. + + \since 4.8 + + \sa toByteArray(), QUuid() +*/ +QUuid::QUuid(const QByteArray &text) +{ + if (text.length() < 36) { + *this = QUuid(); + return; + } + + const char *data = text.constData(); + + if (*data == '{' && text.length() < 37) { + *this = QUuid(); + return; + } + + if (!_q_uuidFromHex(data, data1, data2, data3, data4)) { + *this = QUuid(); + return; + } +} #endif /*! @@ -411,6 +444,52 @@ QString QUuid::toString() const return result; } + +/*! + Returns the binary representation of this QUuid. The byte array is + formatted as five hex fields separated by '-' and enclosed in + curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where + 'x' is a hex digit. From left to right, the five hex fields are + obtained from the four public data members in QUuid as follows: + + \table + \header + \o Field # + \o Source + + \row + \o 1 + \o data1 + + \row + \o 2 + \o data2 + + \row + \o 3 + \o data3 + + \row + \o 4 + \o data4[0] .. data4[1] + + \row + \o 5 + \o data4[2] .. data4[7] + + \endtable + + \since 4.8 +*/ +QByteArray QUuid::toByteArray() const +{ + QByteArray result(38, Qt::Uninitialized); + char *data = result.data(); + + _q_uuidToHex(data, data1, data2, data3, data4); + + return result; +} #endif #ifndef QT_NO_DATASTREAM diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 39f0179..ecaae48 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -109,6 +109,8 @@ struct Q_CORE_EXPORT QUuid QUuid(const char *); QString toString() const; operator QString() const { return toString(); } // ### Qt5 remove + QUuid(const QByteArray &); + QByteArray toByteArray() const; #endif bool isNull() const; diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index f24c893..1b65abb 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -63,6 +63,8 @@ private slots: void fromChar(); void toString(); void fromString(); + void toByteArray(); + void fromByteArray(); void check_QDataStream(); void isNull(); void equal(); @@ -127,6 +129,24 @@ void tst_QUuid::fromString() QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); } +void tst_QUuid::toByteArray() +{ + QCOMPARE(uuidA.toByteArray(), QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + + QCOMPARE(uuidB.toByteArray(), QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")); +} + +void tst_QUuid::fromByteArray() +{ + QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(QUuid(), QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c"))); + + QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); +} + void tst_QUuid::check_QDataStream() { QUuid tmp; diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp index 47a3d3f..608423a 100644 --- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp @@ -56,6 +56,8 @@ private slots: void fromChar(); void toString(); void fromString(); + void toByteArray(); + void fromByteArray(); void toDataStream(); void fromDataStream(); void isNull(); @@ -93,6 +95,22 @@ void tst_bench_QUuid::fromString() } } +void tst_bench_QUuid::toByteArray() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toByteArray(); + } +} + +void tst_bench_QUuid::fromByteArray() +{ + QByteArray string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"; + QBENCHMARK { + QUuid uuid(string); + } +} + void tst_bench_QUuid::toDataStream() { QUuid uuid1, uuid2; -- cgit v0.12 From 06873e467d98ad60d827afae29500bf2ff783c03 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 20 May 2011 11:16:33 +0200 Subject: Add QUuid::toRfc4122() and fromRfc4122() Following the RFC4122, provide the interfaces between QUuid and QByteArray, they are simpler then toByteArray() and relevant. Thanks for the suggestion and brief code from Robin Burchell. Task-number: QTBUG-19420 Reviewed-by: joao --- src/corelib/plugin/quuid.cpp | 92 ++++++++++++++++++++++ src/corelib/plugin/quuid.h | 2 + tests/auto/quuid/tst_quuid.cpp | 16 ++++ .../benchmarks/corelib/plugin/quuid/tst_quuid.cpp | 18 +++++ 4 files changed, 128 insertions(+) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index c80d0f5..4b1856d 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -380,6 +380,45 @@ QUuid::QUuid(const QByteArray &text) #endif /*! + Creates a QUuid object from the binary representation of the UUID, as + specified by RFC 4122 section 4.1.2. See toRfc4122() for a further + explanation of the order of bytes required. + + The byte array accepted is NOT a human readable format. + + If the conversion fails, a null UUID is created. + + \since 4.8 + + \sa toRfc4122(), QUuid() +*/ +QUuid QUuid::fromRfc4122(const QByteArray &bytes) +{ + if (bytes.isEmpty() || bytes.length() != 16) + return QUuid(); + + uint d1; + ushort d2, d3; + uchar d4[8]; + + const uchar *data = reinterpret_cast(bytes.constData()); + + d1 = qFromBigEndian(data); + data += sizeof(quint32); + d2 = qFromBigEndian(data); + data += sizeof(quint16); + d3 = qFromBigEndian(data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + d4[i] = *(data); + data++; + } + + return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]); +} + +/*! \fn bool QUuid::operator==(const QUuid &other) const Returns true if this QUuid and the \a other QUuid are identical; @@ -492,6 +531,59 @@ QByteArray QUuid::toByteArray() const } #endif +/*! + Returns the binary representation of this QUuid. The byte array is in big + endian format, and formatted according to RFC 4122, section 4.1.2 - + "Layout and byte order". + + The order is as follows: + + \table + \header + \o Field # + \o Source + + \row + \o 1 + \o data1 + + \row + \o 2 + \o data2 + + \row + \o 3 + \o data3 + + \row + \o 4 + \o data4[0] .. data4[7] + + \endtable + + \since 4.8 +*/ +QByteArray QUuid::toRfc4122() const +{ + // we know how many bytes a UUID has, I hope :) + QByteArray bytes(16, Qt::Uninitialized); + uchar *data = reinterpret_cast(bytes.data()); + + qToBigEndian(data1, data); + data += sizeof(quint32); + qToBigEndian(data2, data); + data += sizeof(quint16); + qToBigEndian(data3, data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + *(data) = data4[i]; + data++; + } + + return bytes; +} + #ifndef QT_NO_DATASTREAM /*! \relates QUuid diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index ecaae48..f5a2e8f 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -112,6 +112,8 @@ struct Q_CORE_EXPORT QUuid QUuid(const QByteArray &); QByteArray toByteArray() const; #endif + QByteArray toRfc4122() const; + static QUuid fromRfc4122(const QByteArray &); bool isNull() const; bool operator==(const QUuid &orig) const diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index 1b65abb..bedc397 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -65,6 +65,8 @@ private slots: void fromString(); void toByteArray(); void fromByteArray(); + void toRfc4122(); + void fromRfc4122(); void check_QDataStream(); void isNull(); void equal(); @@ -147,6 +149,20 @@ void tst_QUuid::fromByteArray() QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); } +void tst_QUuid::toRfc4122() +{ + QCOMPARE(uuidA.toRfc4122(), QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5")); + + QCOMPARE(uuidB.toRfc4122(), QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b")); +} + +void tst_QUuid::fromRfc4122() +{ + QCOMPARE(uuidA, QUuid::fromRfc4122(QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5"))); + + QCOMPARE(uuidB, QUuid::fromRfc4122(QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b"))); +} + void tst_QUuid::check_QDataStream() { QUuid tmp; diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp index 608423a..77a9920 100644 --- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp @@ -58,6 +58,8 @@ private slots: void fromString(); void toByteArray(); void fromByteArray(); + void toRfc4122(); + void fromRfc4122(); void toDataStream(); void fromDataStream(); void isNull(); @@ -111,6 +113,22 @@ void tst_bench_QUuid::fromByteArray() } } +void tst_bench_QUuid::toRfc4122() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toRfc4122(); + } +} + +void tst_bench_QUuid::fromRfc4122() +{ + QByteArray string = QByteArray::fromHex("67C8770B44F1410AAB9AF9B5446F13EE"); + QBENCHMARK { + QUuid uuid = QUuid::fromRfc4122(string); + } +} + void tst_bench_QUuid::toDataStream() { QUuid uuid1, uuid2; -- cgit v0.12 From d56d7f107f9d18810d742ac4d3a2e36077722cb8 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 20 May 2011 09:48:30 +0200 Subject: QDataStream: speedup steaming of QUuid. By reading and writing as a whole block, because the size of QUuid is fixed. Reviewed-by: joao --- src/corelib/plugin/quuid.cpp | 64 ++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 4b1856d..ddc388c 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -591,11 +591,30 @@ QByteArray QUuid::toRfc4122() const */ QDataStream &operator<<(QDataStream &s, const QUuid &id) { - s << (quint32)id.data1; - s << (quint16)id.data2; - s << (quint16)id.data3; - for (int i = 0; i < 8; i++) - s << (quint8)id.data4[i]; + QByteArray bytes; + if (s.byteOrder() == QDataStream::BigEndian) { + bytes = id.toRfc4122(); + } else { + // we know how many bytes a UUID has, I hope :) + bytes = QByteArray(16, Qt::Uninitialized); + uchar *data = reinterpret_cast(bytes.data()); + + qToLittleEndian(id.data1, data); + data += sizeof(quint32); + qToLittleEndian(id.data2, data); + data += sizeof(quint16); + qToLittleEndian(id.data3, data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + *(data) = id.data4[i]; + data++; + } + } + + if (s.writeRawData(bytes.data(), 16) != 16) { + s.setStatus(QDataStream::WriteFailed); + } return s; } @@ -605,19 +624,30 @@ QDataStream &operator<<(QDataStream &s, const QUuid &id) */ QDataStream &operator>>(QDataStream &s, QUuid &id) { - quint32 u32; - quint16 u16; - quint8 u8; - s >> u32; - id.data1 = u32; - s >> u16; - id.data2 = u16; - s >> u16; - id.data3 = u16; - for (int i = 0; i < 8; i++) { - s >> u8; - id.data4[i] = u8; + QByteArray bytes(16, Qt::Uninitialized); + if (s.readRawData(bytes.data(), 16) != 16) { + s.setStatus(QDataStream::ReadPastEnd); + return s; } + + if (s.byteOrder() == QDataStream::BigEndian) { + id = QUuid::fromRfc4122(bytes); + } else { + const uchar *data = reinterpret_cast(bytes.constData()); + + id.data1 = qFromLittleEndian(data); + data += sizeof(quint32); + id.data2 = qFromLittleEndian(data); + data += sizeof(quint16); + id.data3 = qFromLittleEndian(data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + id.data4[i] = *(data); + data++; + } + } + return s; } #endif // QT_NO_DATASTREAM -- cgit v0.12 From 96d10abbb40c52ac6274f1144766f3fb27dfd726 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 20 May 2011 12:45:56 +0200 Subject: Optimize QUuid::QUuid(const char *) Reviewed-by: joao --- src/corelib/plugin/quuid.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index ddc388c..e07a1aa 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -342,7 +342,15 @@ QUuid::QUuid(const QString &text) */ QUuid::QUuid(const char *text) { - *this = QUuid(QString::fromLatin1(text)); + if (!text) { + *this = QUuid(); + return; + } + + if (!_q_uuidFromHex(text, data1, data2, data3, data4)) { + *this = QUuid(); + return; + } } /*! -- cgit v0.12 From 358d5b2fd70010c1b5f65b820dfadf38f51f65b4 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 20 May 2011 11:07:16 +0300 Subject: Remove S60 version plugins S60 version plugins serve no purpose now that S60 3.x support has been dropped, so remove them to improve performance. Task-number: QTBUG-18614 Reviewed-by: Janne Koskinen --- src/corelib/kernel/qcore_symbian_p.cpp | 74 -------------- src/corelib/kernel/qcore_symbian_p.h | 13 --- src/corelib/kernel/qcoreapplication.cpp | 7 +- src/corelib/tools/qlocale.cpp | 4 - src/corelib/tools/qlocale_symbian.cpp | 86 ++++------------ src/corelib/tools/tools.pri | 5 + src/gui/util/qdesktopservices_s60.cpp | 37 +++++-- src/gui/util/util.pri | 6 ++ src/plugins/plugins.pro | 1 - src/plugins/s60/3_1/3_1.pro | 9 -- src/plugins/s60/3_2/3_2.pro | 23 ----- src/plugins/s60/5_0/5_0.pro | 23 ----- src/plugins/s60/bwins/qts60pluginu.def | 8 -- src/plugins/s60/eabi/qts60pluginu.def | 8 -- src/plugins/s60/s60.pro | 11 -- src/plugins/s60/s60pluginbase.pri | 23 ----- src/plugins/s60/src/qcoreapplication_3_1.cpp | 48 --------- src/plugins/s60/src/qcoreapplication_3_2.cpp | 48 --------- src/plugins/s60/src/qdesktopservices_3_1.cpp | 49 --------- src/plugins/s60/src/qdesktopservices_3_2.cpp | 80 --------------- src/plugins/s60/src/qlocale_3_1.cpp | 148 --------------------------- src/plugins/s60/src/qlocale_3_2.cpp | 66 ------------ src/s60installs/bwins/QtCoreu.def | 2 +- src/s60installs/eabi/QtCoreu.def | 2 +- src/s60installs/s60installs.pro | 16 +-- 25 files changed, 61 insertions(+), 736 deletions(-) delete mode 100644 src/plugins/s60/3_1/3_1.pro delete mode 100644 src/plugins/s60/3_2/3_2.pro delete mode 100644 src/plugins/s60/5_0/5_0.pro delete mode 100644 src/plugins/s60/bwins/qts60pluginu.def delete mode 100644 src/plugins/s60/eabi/qts60pluginu.def delete mode 100644 src/plugins/s60/s60.pro delete mode 100644 src/plugins/s60/s60pluginbase.pri delete mode 100644 src/plugins/s60/src/qcoreapplication_3_1.cpp delete mode 100644 src/plugins/s60/src/qcoreapplication_3_2.cpp delete mode 100644 src/plugins/s60/src/qdesktopservices_3_1.cpp delete mode 100644 src/plugins/s60/src/qdesktopservices_3_2.cpp delete mode 100644 src/plugins/s60/src/qlocale_3_1.cpp delete mode 100644 src/plugins/s60/src/qlocale_3_2.cpp diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index c717cb9..9b893e5 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -109,80 +109,6 @@ QHBufC::~QHBufC() delete m_hBufC; } -class QS60PluginResolver -{ -public: - QS60PluginResolver() - : initTried(false) {} - - ~QS60PluginResolver() { - lib.Close(); - } - - TLibraryFunction resolve(int ordinal) { - if (!initTried) { - init(); - initTried = true; - } - - if (lib.Handle()) - return lib.Lookup(ordinal); - else - return reinterpret_cast(NULL); - } - -private: - void init() - { - _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll"); - _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll"); - _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll"); - - TPtrC libName; - TInt uidValue; - switch (QSysInfo::s60Version()) { - case QSysInfo::SV_S60_3_1: - libName.Set(KLibName_3_1); - uidValue = 0x2001E620; - break; - case QSysInfo::SV_S60_3_2: - libName.Set(KLibName_3_2); - uidValue = 0x2001E621; - break; - case QSysInfo::SV_S60_5_0: // Fall through to default - default: - // Default to 5.0 version, as any unknown platform is likely to be newer than that - libName.Set(KLibName_5_0); - uidValue = 0x2001E622; - break; - } - - TUidType libUid(KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid(uidValue)); - lib.Load(libName, libUid); - - // Duplicate lib handle to enable process wide access to it. Since Duplicate overwrites - // existing handle without closing it, store original for subsequent closing. - RLibrary origHandleCloser = lib; - lib.Duplicate(RThread(), EOwnerProcess); - origHandleCloser.Close(); - } - - RLibrary lib; - bool initTried; -}; - -Q_GLOBAL_STATIC(QS60PluginResolver, qt_s60_plugin_resolver); - -/*! - \internal - Resolves a platform version specific function from S60 plugin. - If plugin is missing or resolving fails for another reason, NULL is returned. -*/ -Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal) -{ - return qt_s60_plugin_resolver()->resolve(ordinal); -} - class QS60RFsSession { public: diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index cbe84a8..7b849f0 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -142,19 +142,6 @@ inline uint qHash(TUid uid) return qHash(uid.iUid); } -// S60 version specific function ordinals that can be resolved -enum S60PluginFuncOrdinals -{ - S60Plugin_TimeFormatL = 1, - S60Plugin_GetTimeFormatSpec = 2, - S60Plugin_GetLongDateFormatSpec = 3, - S60Plugin_GetShortDateFormatSpec = 4, - S60Plugin_LocalizedDirectoryName = 5, - S60Plugin_GetSystemDrive = 6 -}; - -Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); - Q_CORE_EXPORT RFs& qt_s60GetRFs(); Q_CORE_EXPORT RSocketServ& qt_symbianGetSocketServer(); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c0b1748..aba3a28 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -116,8 +116,6 @@ private: }; #ifdef Q_OS_SYMBIAN -typedef TDriveNumber (*SystemDriveFunc)(RFs&); -static SystemDriveFunc PtrGetSystemDrive = 0; static CApaCommandLine* apaCommandLine = 0; static char *apaTail = 0; static QVector *apaArgv = 0; @@ -1950,10 +1948,7 @@ QString QCoreApplication::applicationDirPath() } if (err != KErrNone || (driveInfo.iDriveAtt & KDriveAttRom) || (driveInfo.iMediaAtt & KMediaAttWriteProtected)) { - if(!PtrGetSystemDrive) - PtrGetSystemDrive = reinterpret_cast(qt_resolveS60PluginFunc(S60Plugin_GetSystemDrive)); - Q_ASSERT(PtrGetSystemDrive); - drive = PtrGetSystemDrive(fs); + drive = fs.GetSystemDrive(); fs.DriveToChar(drive, driveChar); } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index c8ed94b..84713ee 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -76,7 +76,6 @@ QT_BEGIN_NAMESPACE #if defined(Q_OS_SYMBIAN) void qt_symbianUpdateSystemPrivate(); -void qt_symbianInitSystemLocale(); #endif #ifndef QT_NO_SYSTEMLOCALE @@ -470,9 +469,6 @@ static const QSystemLocale *systemLocale() { if (_systemLocale) return _systemLocale; -#if defined(Q_OS_SYMBIAN) - qt_symbianInitSystemLocale(); -#endif return QSystemLocale_globalSystemLocale(); } diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 5dca7b7..46b5be6 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include "private/qcore_symbian_p.h" #include "private/qcoreapplication_p.h" @@ -60,27 +61,6 @@ QT_BEGIN_NAMESPACE static TExtendedLocale _s60Locale; -// Type definitions for runtime resolved function pointers -typedef void (*FormatFunc)(TTime&, TDes&, const TDesC&, const TLocale&); -typedef TPtrC (*FormatSpecFunc)(TExtendedLocale&); - -// Runtime resolved functions -static FormatFunc ptrTimeFormatL = NULL; -static FormatSpecFunc ptrGetTimeFormatSpec = NULL; -static FormatSpecFunc ptrGetLongDateFormatSpec = NULL; -static FormatSpecFunc ptrGetShortDateFormatSpec = NULL; - -// Default functions if functions cannot be resolved -static void defaultTimeFormatL(TTime&, TDes& des, const TDesC&, const TLocale&) -{ - des.Zero(); -} - -static TPtrC defaultFormatSpec(TExtendedLocale&) -{ - return TPtrC(KNullDesC); -} - /* Definition of struct for mapping Symbian to ISO locale */ @@ -699,9 +679,9 @@ static QString symbianDateFormat(bool short_format) TPtrC dateFormat; if (short_format) { - dateFormat.Set(ptrGetShortDateFormatSpec(_s60Locale)); + dateFormat.Set(_s60Locale.GetShortDateFormatSpec()); } else { - dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale)); + dateFormat.Set(_s60Locale.GetLongDateFormatSpec()); } return s60ToQtFormat(qt_TDesC2QString(dateFormat)); @@ -713,7 +693,7 @@ static QString symbianDateFormat(bool short_format) */ static QString symbianTimeFormat() { - return s60ToQtFormat(qt_TDesC2QString(ptrGetTimeFormatSpec(_s60Locale))); + return s60ToQtFormat(qt_TDesC2QString(_s60Locale.GetTimeFormatSpec())); } /*! @@ -737,17 +717,20 @@ static QString symbianDateToString(const QDate &date, bool short_format) TPtrC dateFormat; if (short_format) { - dateFormat.Set(ptrGetShortDateFormatSpec(_s60Locale)); + dateFormat.Set(_s60Locale.GetShortDateFormatSpec()); } else { - dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale)); + dateFormat.Set(_s60Locale.GetLongDateFormatSpec()); } - TRAPD(err, ptrTimeFormatL(timeStr, buffer, dateFormat, *_s60Locale.GetLocale());) + TLocale *formatLocale = _s60Locale.GetLocale(); + TRAPD(err, timeStr.FormatL(buffer, dateFormat, *formatLocale);) - if (err == KErrNone) + if (err == KErrNone) { + NumberConversion::ConvertDigits(buffer, formatLocale->DigitType()); return qt_TDes2QString(buffer); - else + } else { return QString(); + } } /*! @@ -767,17 +750,15 @@ static QString symbianTimeToString(const QTime &time) TTime timeStr(dateTime); TBuf buffer; - TRAPD(err, ptrTimeFormatL( - timeStr, - buffer, - ptrGetTimeFormatSpec(_s60Locale), - *_s60Locale.GetLocale()); - ) + TLocale *formatLocale = _s60Locale.GetLocale(); + TRAPD(err, timeStr.FormatL(buffer, _s60Locale.GetTimeFormatSpec(), *formatLocale);) - if (err == KErrNone) + if (err == KErrNone) { + NumberConversion::ConvertDigits(buffer, formatLocale->DigitType()); return qt_TDes2QString(buffer); - else + } else { return QString(); + } } /*! @@ -802,37 +783,6 @@ void qt_symbianUpdateSystemPrivate() _s60Locale.LoadSystemSettings(); } -void qt_symbianInitSystemLocale() -{ - static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0); - if (initDone == 2) - return; - if (initDone.testAndSetRelaxed(0, 1)) { - // Initialize platform version dependent function pointers - ptrTimeFormatL = reinterpret_cast - (qt_resolveS60PluginFunc(S60Plugin_TimeFormatL)); - ptrGetTimeFormatSpec = reinterpret_cast - (qt_resolveS60PluginFunc(S60Plugin_GetTimeFormatSpec)); - ptrGetLongDateFormatSpec = reinterpret_cast - (qt_resolveS60PluginFunc(S60Plugin_GetLongDateFormatSpec)); - ptrGetShortDateFormatSpec = reinterpret_cast - (qt_resolveS60PluginFunc(S60Plugin_GetShortDateFormatSpec)); - if (!ptrTimeFormatL) - ptrTimeFormatL = &defaultTimeFormatL; - if (!ptrGetTimeFormatSpec) - ptrGetTimeFormatSpec = &defaultFormatSpec; - if (!ptrGetLongDateFormatSpec) - ptrGetLongDateFormatSpec = &defaultFormatSpec; - if (!ptrGetShortDateFormatSpec) - ptrGetShortDateFormatSpec = &defaultFormatSpec; - bool ret = initDone.testAndSetRelease(1, 2); - Q_ASSERT(ret); - Q_UNUSED(ret); - } - while(initDone != 2) - QThread::yieldCurrentThread(); -} - QLocale QSystemLocale::fallbackLocale() const { TLanguage lang = User::Language(); diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 0c2cf16..3dfce4b 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -122,3 +122,8 @@ INCLUDEPATH += ../3rdparty/md5 \ # Note: libm should be present by default becaue this is C++ !macx-icc:!vxworks:!symbian:unix:LIBS_PRIVATE += -lm +symbian { + # QLocale Symbian implementation needs this + LIBS += -lnumberconversion +} + diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 8caeb74..f5ba144 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -70,6 +70,10 @@ #include #endif +#ifdef Q_WS_S60 +#include // CDirectoryLocalizer +#endif + QT_BEGIN_NAMESPACE _LIT(KCacheSubDir, "Cache\\"); @@ -444,18 +448,31 @@ static QString defaultLocalizedDirectoryName(QString&) QString QDesktopServices::displayName(StandardLocation type) { - static LocalizerFunc ptrLocalizerFunc = NULL; - - if (!ptrLocalizerFunc) { - ptrLocalizerFunc = reinterpret_cast - (qt_resolveS60PluginFunc(S60Plugin_LocalizedDirectoryName)); - if (!ptrLocalizerFunc) - ptrLocalizerFunc = &defaultLocalizedDirectoryName; - } + QString ret; +#ifdef Q_WS_S60 QString rawPath = storageLocation(type); - return ptrLocalizerFunc(rawPath); -} + TRAPD(err, + QT_TRYCATCH_LEAVING( + CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL(); + CleanupStack::PushL(localizer); + localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath))); + if (localizer->IsLocalized()) { + TPtrC locName(localizer->LocalizedName()); + ret = qt_TDesC2QString(locName); + } + CleanupStack::PopAndDestroy(localizer); + ) + ) + + if (err != KErrNone) + ret = QString(); +#else + qWarning("QDesktopServices::displayName() not implemented for this platform version"); +#endif + + return ret; +} QT_END_NAMESPACE diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index f125f82..7395604 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -56,4 +56,10 @@ symbian { } else { DEFINES += USE_SCHEMEHANDLER } + + contains(CONFIG, is_using_gnupoc) { + LIBS += -ldirectorylocalizer + } else { + LIBS += -lDirectoryLocalizer + } } diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 7479d2f..6e99b54 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -11,7 +11,6 @@ unix:!symbian { embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers !win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods !symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible -symbian:SUBDIRS += s60 contains(QT_CONFIG, phonon): SUBDIRS *= phonon qpa:SUBDIRS += platforms contains(QT_CONFIG, declarative): SUBDIRS *= qmltooling diff --git a/src/plugins/s60/3_1/3_1.pro b/src/plugins/s60/3_1/3_1.pro deleted file mode 100644 index 9437f3d..0000000 --- a/src/plugins/s60/3_1/3_1.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../s60pluginbase.pri) - -TARGET = qts60plugin_3_1$${QT_LIBINFIX} - -SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp \ - ../src/qcoreapplication_3_1.cpp - -TARGET.UID3=0x2001E620 diff --git a/src/plugins/s60/3_2/3_2.pro b/src/plugins/s60/3_2/3_2.pro deleted file mode 100644 index b104c05..0000000 --- a/src/plugins/s60/3_2/3_2.pro +++ /dev/null @@ -1,23 +0,0 @@ -include(../s60pluginbase.pri) - -TARGET = qts60plugin_3_2$${QT_LIBINFIX} - -contains(S60_VERSION, 3.1) { - SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp \ - ../src/qcoreapplication_3_1.cpp -} else { - SOURCES += ../src/qlocale_3_2.cpp \ - ../src/qdesktopservices_3_2.cpp \ - ../src/qcoreapplication_3_2.cpp - contains(CONFIG, is_using_gnupoc) { - LIBS += -ldirectorylocalizer - } else { - LIBS += -lDirectoryLocalizer - } - LIBS += -lefsrv - LIBS += -lnumberconversion - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -} - -TARGET.UID3=0x2001E621 diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro deleted file mode 100644 index b037215..0000000 --- a/src/plugins/s60/5_0/5_0.pro +++ /dev/null @@ -1,23 +0,0 @@ -include(../s60pluginbase.pri) - -TARGET = qts60plugin_5_0$${QT_LIBINFIX} - -contains(S60_VERSION, 3.1) { - SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp \ - ../src/qcoreapplication_3_1.cpp -} else { - SOURCES += ../src/qlocale_3_2.cpp \ - ../src/qdesktopservices_3_2.cpp \ - ../src/qcoreapplication_3_2.cpp - contains(CONFIG, is_using_gnupoc) { - LIBS += -ldirectorylocalizer - } else { - LIBS += -lDirectoryLocalizer - } - LIBS += -lefsrv - LIBS += -lnumberconversion - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -} - -TARGET.UID3=0x2001E622 diff --git a/src/plugins/s60/bwins/qts60pluginu.def b/src/plugins/s60/bwins/qts60pluginu.def deleted file mode 100644 index b4110a9..0000000 --- a/src/plugins/s60/bwins/qts60pluginu.def +++ /dev/null @@ -1,8 +0,0 @@ -EXPORTS - ?defaultFormatL@@YAXAAVTTime@@AAVTDes16@@ABVTDesC16@@ABVTLocale@@@Z @ 1 NONAME ; void defaultFormatL(class TTime &, class TDes16 &, class TDesC16 const &, class TLocale const &) - ?defaultGetTimeFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 2 NONAME ; class TPtrC16 defaultGetTimeFormatSpec(class TExtendedLocale &) - ?defaultGetLongDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 3 NONAME ; class TPtrC16 defaultGetLongDateFormatSpec(class TExtendedLocale &) - ?defaultGetShortDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 4 NONAME ; class TPtrC16 defaultGetShortDateFormatSpec(class TExtendedLocale &) - ?localizedDirectoryName@@YA?AVQString@@AAV1@@Z @ 5 NONAME ; class QString localizedDirectoryName(class QString &) - ?systemDrive@@YA?AW4TDriveNumber@@AAVRFs@@@Z @ 6 NONAME ; enum TDriveNumber systemDrive(class RFs &) - diff --git a/src/plugins/s60/eabi/qts60pluginu.def b/src/plugins/s60/eabi/qts60pluginu.def deleted file mode 100644 index df7895c..0000000 --- a/src/plugins/s60/eabi/qts60pluginu.def +++ /dev/null @@ -1,8 +0,0 @@ -EXPORTS - _Z14defaultFormatLR5TTimeR6TDes16RK7TDesC16RK7TLocale @ 1 NONAME - _Z24defaultGetTimeFormatSpecR15TExtendedLocale @ 2 NONAME - _Z28defaultGetLongDateFormatSpecR15TExtendedLocale @ 3 NONAME - _Z29defaultGetShortDateFormatSpecR15TExtendedLocale @ 4 NONAME - _Z22localizedDirectoryNameR7QString @ 5 NONAME - _Z11systemDriveR3RFs @ 6 NONAME - diff --git a/src/plugins/s60/s60.pro b/src/plugins/s60/s60.pro deleted file mode 100644 index c999fff..0000000 --- a/src/plugins/s60/s60.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs - - -symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - SUBDIRS += 3_1 3_2 - } - - # 5.0 is used also for Symbian3 and later - SUBDIRS += 5_0 -} \ No newline at end of file diff --git a/src/plugins/s60/s60pluginbase.pri b/src/plugins/s60/s60pluginbase.pri deleted file mode 100644 index 4e15102..0000000 --- a/src/plugins/s60/s60pluginbase.pri +++ /dev/null @@ -1,23 +0,0 @@ -# Note: These version based 'plugins' are not an actual Qt plugins, -# they are just regular runtime loaded libraries -include(../qpluginbase.pri) - -CONFIG -= plugin - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60 - -MMP_RULES += NOEXPORTLIBRARY - -symbian-abld|symbian-sbsv2 { - defBlock = \ - "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ../bwins/qts60plugin.def" \ - "$${LITERAL_HASH}else" \ - "DEFFILE ../eabi/qts60plugin.def" \ - "$${LITERAL_HASH}endif" -} else { - CONFIG *= def_files - DEF_FILE = ../eabi/qts60pluginu.def -} - -MMP_RULES += defBlock \ No newline at end of file diff --git a/src/plugins/s60/src/qcoreapplication_3_1.cpp b/src/plugins/s60/src/qcoreapplication_3_1.cpp deleted file mode 100644 index aa298de..0000000 --- a/src/plugins/s60/src/qcoreapplication_3_1.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -EXPORT_C TDriveNumber systemDrive(RFs&) -{ - return EDriveC; -} diff --git a/src/plugins/s60/src/qcoreapplication_3_2.cpp b/src/plugins/s60/src/qcoreapplication_3_2.cpp deleted file mode 100644 index a6b6a77..0000000 --- a/src/plugins/s60/src/qcoreapplication_3_2.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -EXPORT_C TDriveNumber systemDrive(RFs& fs) -{ - return fs.GetSystemDrive(); -} diff --git a/src/plugins/s60/src/qdesktopservices_3_1.cpp b/src/plugins/s60/src/qdesktopservices_3_1.cpp deleted file mode 100644 index 9ebe0f7..0000000 --- a/src/plugins/s60/src/qdesktopservices_3_1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -EXPORT_C QString localizedDirectoryName(QString&) -{ - qWarning("QDesktopServices::displayName() not implemented for this platform version"); - return QString(); -} diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp deleted file mode 100644 index 5aab099..0000000 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#ifdef Q_WS_S60 -#include // CBase -> Required by cdirectorylocalizer.h -#include // CDirectoryLocalizer - -EXPORT_C QString localizedDirectoryName(QString& rawPath) -{ - QString ret; - std::exception dummy; // voodoo fix for "Undefined symbol typeinfo for std::exception" in armv5 build - - TRAPD(err, - QT_TRYCATCH_LEAVING( - CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL(); - CleanupStack::PushL(localizer); - localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath))); - if(localizer->IsLocalized()){ - TPtrC locName(localizer->LocalizedName()); - ret = qt_TDesC2QString(locName); - } - CleanupStack::PopAndDestroy(localizer); - ) - ) - - if (err != KErrNone) - ret = QString(); - - return ret; -} -#else - -EXPORT_C QString localizedDirectoryName(QString& /* rawPath */) -{ - qWarning("QDesktopServices::displayName() not implemented for this platform version"); - return QString(); -} -#endif diff --git a/src/plugins/s60/src/qlocale_3_1.cpp b/src/plugins/s60/src/qlocale_3_1.cpp deleted file mode 100644 index 7dcaba0..0000000 --- a/src/plugins/s60/src/qlocale_3_1.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -_LIT(KYear, "%Y"); -_LIT(KMonth, "%M"); -_LIT(KDay, "%D"); -_LIT(KLocaleIndependent, "%F"); -static TBuf<10> dateFormat; -static TBuf<10> timeFormat; - -static void initialiseDateFormat() -{ - if(dateFormat.Length()) - return; - - TLocale locale; - - //Separator 1 is used between 1st and 2nd components of the date - //Separator 2 is used between 2nd and 3rd components of the date - //Usually they are the same, but they are allowed to be different - TChar s1 = locale.DateSeparator(1); - TChar s2 = locale.DateSeparator(2); - dateFormat=KLocaleIndependent; - switch(locale.DateFormat()) { - case EDateAmerican: - dateFormat.Append(KMonth); - dateFormat.Append(s1); - dateFormat.Append(KDay); - dateFormat.Append(s2); - dateFormat.Append(KYear); - break; - case EDateEuropean: - dateFormat.Append(KDay); - dateFormat.Append(s1); - dateFormat.Append(KMonth); - dateFormat.Append(s2); - dateFormat.Append(KYear); - break; - case EDateJapanese: - default: //it's closest to ISO format - dateFormat.Append(KYear); - dateFormat.Append(s1); - dateFormat.Append(KMonth); - dateFormat.Append(s2); - dateFormat.Append(KDay); - break; - } -#ifdef _DEBUG - RDebug::Print(_L("Date Format \"%S\""), &dateFormat); -#endif -} - -static void initialiseTimeFormat() -{ - if(timeFormat.Length()) - return; - - TLocale locale; - //Separator 1 is used between 1st and 2nd components of the time - //Separator 2 is used between 2nd and 3rd components of the time - //Usually they are the same, but they are allowed to be different - TChar s1 = locale.TimeSeparator(1); - TChar s2 = locale.TimeSeparator(2); - switch(locale.TimeFormat()) { - case ETime12: - timeFormat.Append(_L("%I")); - break; - case ETime24: - default: - timeFormat.Append(_L("%H")); - break; - } - timeFormat.Append(s1); - timeFormat.Append(_L("%T")); - timeFormat.Append(s2); - timeFormat.Append(_L("%S")); - -#ifdef _DEBUG - RDebug::Print(_L("Time Format \"%S\""), &timeFormat); -#endif -} - -EXPORT_C void defaultFormatL(TTime& time, TDes& des, const TDesC& fmt, const TLocale&) -{ - //S60 3.1 does not support format for a specific locale, so use default locale - time.FormatL(des, fmt); -} - -//S60 3.1 doesn't support extended locale date&time formats, so use default locale -EXPORT_C TPtrC defaultGetTimeFormatSpec(TExtendedLocale&) -{ - initialiseTimeFormat(); - return TPtrC(timeFormat); -} - -EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale&) -{ - initialiseDateFormat(); - return TPtrC(dateFormat); -} - -EXPORT_C TPtrC defaultGetShortDateFormatSpec(TExtendedLocale&) -{ - initialiseDateFormat(); - return TPtrC(dateFormat); -} diff --git a/src/plugins/s60/src/qlocale_3_2.cpp b/src/plugins/s60/src/qlocale_3_2.cpp deleted file mode 100644 index ecbf46c..0000000 --- a/src/plugins/s60/src/qlocale_3_2.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale& locale) -{ - return locale.GetLongDateFormatSpec(); -} - -EXPORT_C TPtrC defaultGetShortDateFormatSpec(TExtendedLocale& locale) -{ - return locale.GetShortDateFormatSpec(); -} - -EXPORT_C TPtrC defaultGetTimeFormatSpec(TExtendedLocale& locale) -{ - return locale.GetTimeFormatSpec(); -} - -EXPORT_C void defaultFormatL(TTime& time, TDes& des, const TDesC& format, const TLocale& locale) -{ - time.FormatL(des, format, locale); - NumberConversion::ConvertDigits(des, locale.DigitType()); -} diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index e4f244c..76a9a55 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -2940,7 +2940,7 @@ EXPORTS ?qt_qFindChildren_helper@@YAXPBVQObject@@ABVQString@@PBVQRegExp@@ABUQMetaObject@@PAV?$QList@PAX@@@Z @ 2939 NONAME ; void qt_qFindChildren_helper(class QObject const *, class QString const &, class QRegExp const *, struct QMetaObject const &, class QList *) ?qt_regexp_toCanonical@@YA?AVQString@@ABV1@W4PatternSyntax@QRegExp@@@Z @ 2940 NONAME ; class QString qt_regexp_toCanonical(class QString const &, enum QRegExp::PatternSyntax) ?qt_register_signal_spy_callbacks@@YAXABUQSignalSpyCallbackSet@@@Z @ 2941 NONAME ; void qt_register_signal_spy_callbacks(struct QSignalSpyCallbackSet const &) - ?qt_resolveS60PluginFunc@@YAP6AHXZH@Z @ 2942 NONAME ; int (*)(void) qt_resolveS60PluginFunc(int) + ?qt_resolveS60PluginFunc@@YAP6AHXZH@Z @ 2942 NONAME ABSENT ; int (*)(void) qt_resolveS60PluginFunc(int) ?qt_s60GetRFs@@YAAAVRFs@@XZ @ 2943 NONAME ; class RFs & qt_s60GetRFs(void) ?qt_safe_select@@YAHHPAUfd_set@@00PBUtimeval@@@Z @ 2944 NONAME ; int qt_safe_select(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval const *) ?qt_symbianLocaleName@@YA?AVQByteArray@@H@Z @ 2945 NONAME ; class QByteArray qt_symbianLocaleName(int) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 6c4e837..76b1568 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -43,7 +43,7 @@ EXPORTS _Z21qt_regexp_toCanonicalRK7QStringN7QRegExp13PatternSyntaxE @ 42 NONAME _Z23qUnregisterResourceDataiPKhS0_S0_ @ 43 NONAME _Z23qt_qFindChildren_helperPK7QObjectRK7QStringPK7QRegExpRK11QMetaObjectP5QListIPvE @ 44 NONAME - _Z23qt_resolveS60PluginFunci @ 45 NONAME + _Z23qt_resolveS60PluginFunci @ 45 NONAME ABSENT _Z23qt_symbian_throwIfErrori @ 46 NONAME _Z24qGlobalPostedEventsCountv @ 47 NONAME _Z24qcoreStateMachineHandlerv @ 48 NONAME diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 02c3da0..b72e2a4 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -40,30 +40,18 @@ symbian: { bearerStubZ = $${PWD}/qsymbianbearer.qtplugin } - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + contains(S60_VERSION, 5.0) { qts60plugindeployment = \ "IF package(0x2003A678) OR package(0x20022E6D)" \ - " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ELSEIF package(0x1028315F)" \ - " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}_3_2.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ - "ELSEIF package(0x102752AE)" \ - " \"$$pluginLocations/qts60plugin_3_2$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2$${QT_LIBINFIX}.dll\"" \ - " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}_3_2.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ - "ELSEIF package(0x102032BE)" \ - " \"$$pluginLocations/qts60plugin_3_1$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1$${QT_LIBINFIX}.dll\"" \ - " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}_3_1.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ELSE" \ - " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ENDIF" \ " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\"" } else { # No need to deploy plugins for older platform versions when building on Symbian3 or later - qts60plugindeployment = \ - " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" - bearer_plugin.files = $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll bearer_plugin.path = c:$$QT_PLUGINS_BASE_DIR/bearer DEPLOYMENT += bearer_plugin @@ -86,7 +74,7 @@ symbian: { qtlibraries.pkg_prerules += "; Dependencies of Qt libraries" # It is expected that Symbian^3 and newer phones will have sufficiently new OpenC already installed - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + contains(S60_VERSION, 5.0) { qtlibraries.pkg_prerules += "(0x20013851), 1, 5, 1, {\"PIPS Installer\"}" contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { qtlibraries.pkg_prerules += "(0x200110CB), 1, 5, 1, {\"Open C LIBSSL Common\"}" -- cgit v0.12 From c19ff75707621b0c5bcb832da84921a0370d72a8 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 20 May 2011 14:37:55 +0200 Subject: Improved performance of the QLocale::name() function. Task-number: QTBUG-19168 Reviewed-by: Zeno Albisser --- src/corelib/tools/qlocale.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index c8ed94b..c398a5c 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -942,19 +942,32 @@ QLocale::Country QLocale::country() const QString QLocale::name() const { - Language l = language(); + const QLocalePrivate *dd = d(); - QString result = d()->languageCode(); + if (dd->m_language_id == QLocale::AnyLanguage) + return QString(); + if (dd->m_language_id == QLocale::C) + return QLatin1String("C"); - if (l == C) - return result; + const unsigned char *c = language_code_list + 3*(uint(dd->m_language_id)); - Country c = country(); - if (c == AnyCountry) - return result; + QString result(7, Qt::Uninitialized); + ushort *data = (ushort *)result.unicode(); + const ushort *begin = data; - result.append(QLatin1Char('_')); - result.append(d()->countryCode()); + *data++ = ushort(c[0]); + *data++ = ushort(c[1]); + if (c[2] != 0) + *data++ = ushort(c[2]); + if (dd->m_country_id != AnyCountry) { + *data++ = '_'; + const unsigned char *c = country_code_list + 3*(uint(dd->m_country_id)); + *data++ = ushort(c[0]); + *data++ = ushort(c[1]); + if (c[2] != 0) + *data++ = ushort(c[2]); + } + result.resize(data - begin); return result; } -- cgit v0.12 From c50519034230005e30ce96be45251c19adabbbd1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 20 May 2011 17:21:10 +0200 Subject: Remove s60 plugin dll from the iby file too. Reviewed-by: TRUSTME --- src/s60installs/qt.iby | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index d6b36e0..452d838 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -49,10 +49,6 @@ file=ABI_DIR\BUILD_DIR\qglgraphicssystem.dll SHARED_LIB_DIR\qglgraphicssystem.dl // bearer file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll -// S60 version compatibility plugins for 5.0 (3.1 and 3.2 devices are never likely to have this in ROM, -// so don't bother including those plugins -file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll - // imageformats stubs data=\epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin data=\epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin -- cgit v0.12 From 2609e50213b3ea7cb5085b4dde12bb687ad2b285 Mon Sep 17 00:00:00 2001 From: Eckhart Koppen Date: Sat, 21 May 2011 11:09:03 +0300 Subject: Updating DEF files for Symbian --- src/s60installs/bwins/QtGuiu.def | 31 ++++++++++++++++++++++--------- src/s60installs/bwins/QtOpenGLu.def | 4 +++- src/s60installs/eabi/QtGuiu.def | 21 ++++++++++++++++----- src/s60installs/eabi/QtOpenGLu.def | 5 ++++- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3c9c16d..7468b85 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12979,7 +12979,7 @@ EXPORTS ?byteCount@QVolatileImage@@QBEHXZ @ 12978 NONAME ; int QVolatileImage::byteCount(void) const ??0QVolatileImage@@QAE@ABV0@@Z @ 12979 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) ?depth@QVolatileImage@@QBEHXZ @ 12980 NONAME ; int QVolatileImage::depth(void) const - ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ; void QGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ABSENT ; void QGraphicsSystem::releaseCachedResources(void) ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) png_access_version_number @ 12983 NONAME png_benign_error @ 12984 NONAME @@ -13228,7 +13228,7 @@ EXPORTS ?qt_static_metacall@QToolBox@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13227 NONAME ; void QToolBox::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QSplitter@@0UQMetaObjectExtraData@@B @ 13228 NONAME ; struct QMetaObjectExtraData const QSplitter::staticMetaObjectExtraData ?qt_static_metacall@QGraphicsTextItem@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13229 NONAME ; void QGraphicsTextItem::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13230 NONAME ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13230 NONAME ABSENT ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?qt_static_metacall@QGraphicsView@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13231 NONAME ; void QGraphicsView::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QGraphicsOpacityEffect@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13232 NONAME ; void QGraphicsOpacityEffect::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QGraphicsBlurEffect@@0UQMetaObjectExtraData@@B @ 13233 NONAME ; struct QMetaObjectExtraData const QGraphicsBlurEffect::staticMetaObjectExtraData @@ -13260,7 +13260,7 @@ EXPORTS ?qt_static_metacall@QGraphicsScene@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13259 NONAME ; void QGraphicsScene::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QTextList@@0UQMetaObjectExtraData@@B @ 13260 NONAME ; struct QMetaObjectExtraData const QTextList::staticMetaObjectExtraData ?qt_fontdata_from_index@@YA?AVQByteArray@@H@Z @ 13261 NONAME ; class QByteArray qt_fontdata_from_index(int) - ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13262 NONAME ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13262 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const ?offsetInLigature@QTextEngine@@QAE?AUQFixed@@PBUQScriptItem@@HHH@Z @ 13263 NONAME ; struct QFixed QTextEngine::offsetInLigature(struct QScriptItem const *, int, int, int) ?qt_static_metacall@QGraphicsAnchor@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13264 NONAME ; void QGraphicsAnchor::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?swap@QImage@@QAEXAAV1@@Z @ 13265 NONAME ; void QImage::swap(class QImage &) @@ -13333,7 +13333,7 @@ EXPORTS ?staticMetaObjectExtraData@QProxyModel@@0UQMetaObjectExtraData@@B @ 13332 NONAME ; struct QMetaObjectExtraData const QProxyModel::staticMetaObjectExtraData ?staticMetaObjectExtraData@QInputContextPlugin@@0UQMetaObjectExtraData@@B @ 13333 NONAME ; struct QMetaObjectExtraData const QInputContextPlugin::staticMetaObjectExtraData ?metaObject@QIdentityProxyModel@@UBEPBUQMetaObject@@XZ @ 13334 NONAME ; struct QMetaObject const * QIdentityProxyModel::metaObject(void) const - ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13335 NONAME ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const + ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13335 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const ?removeColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13336 NONAME ; bool QIdentityProxyModel::removeColumns(int, int, class QModelIndex const &) ?qt_static_metacall@QDirModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13337 NONAME ; void QDirModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QMdiSubWindow@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13338 NONAME ; void QMdiSubWindow::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13571,7 +13571,7 @@ EXPORTS ?d_func@QBlitterPaintEngine@@AAEPAVQBlitterPaintEnginePrivate@@XZ @ 13570 NONAME ; class QBlitterPaintEnginePrivate * QBlitterPaintEngine::d_func(void) ?setNumberPrefix@QTextListFormat@@QAEXABVQString@@@Z @ 13571 NONAME ; void QTextListFormat::setNumberPrefix(class QString const &) ?qt_static_metacall@QAbstractSpinBox@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13572 NONAME ; void QAbstractSpinBox::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13573 NONAME ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13573 NONAME ABSENT ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?lineHeight@QTextBlockFormat@@QBEMMM@Z @ 13574 NONAME ; float QTextBlockFormat::lineHeight(float, float) const ??0QIdentityProxyModel@@IAE@AAVQIdentityProxyModelPrivate@@PAVQObject@@@Z @ 13575 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QIdentityProxyModelPrivate &, class QObject *) ?staticMetaObjectExtraData@QGraphicsEffect@@0UQMetaObjectExtraData@@B @ 13576 NONAME ; struct QMetaObjectExtraData const QGraphicsEffect::staticMetaObjectExtraData @@ -13660,7 +13660,7 @@ EXPORTS ?swap@QIcon@@QAEXAAV1@@Z @ 13659 NONAME ; void QIcon::swap(class QIcon &) ?columnCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 13660 NONAME ; int QIdentityProxyModel::columnCount(class QModelIndex const &) const ?unmarkRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 13661 NONAME ; void QBlittablePixmapData::unmarkRasterOverlay(class QRectF const &) - ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13662 NONAME ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const + ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13662 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 13663 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *, int) ?brushOriginChanged@QBlitterPaintEngine@@UAEXXZ @ 13664 NONAME ; void QBlitterPaintEngine::brushOriginChanged(void) ?openFile@QFileOpenEvent@@QBE_NAAVQFile@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z @ 13665 NONAME ; bool QFileOpenEvent::openFile(class QFile &, class QFlags) const @@ -13683,7 +13683,7 @@ EXPORTS ?unlock@QBlittable@@QAEXXZ @ 13682 NONAME ; void QBlittable::unlock(void) ?swap@QRegion@@QAEXAAV1@@Z @ 13683 NONAME ; void QRegion::swap(class QRegion &) ?staticMetaObjectExtraData@QLCDNumber@@0UQMetaObjectExtraData@@B @ 13684 NONAME ; struct QMetaObjectExtraData const QLCDNumber::staticMetaObjectExtraData - ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13685 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13685 NONAME ABSENT ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) ?staticMetaObjectExtraData@QS60Style@@0UQMetaObjectExtraData@@B @ 13686 NONAME ; struct QMetaObjectExtraData const QS60Style::staticMetaObjectExtraData ?qt_static_metacall@QWidgetAction@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13687 NONAME ; void QWidgetAction::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QListView@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13688 NONAME ; void QListView::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13724,7 +13724,7 @@ EXPORTS ?staticMetaObjectExtraData@QProgressBar@@0UQMetaObjectExtraData@@B @ 13723 NONAME ; struct QMetaObjectExtraData const QProgressBar::staticMetaObjectExtraData ?qt_static_metacall@QLineEdit@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13724 NONAME ; void QLineEdit::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?drawStaticTextItem@QBlitterPaintEngine@@UAEXPAVQStaticTextItem@@@Z @ 13725 NONAME ; void QBlitterPaintEngine::drawStaticTextItem(class QStaticTextItem *) - ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13726 NONAME ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13726 NONAME ABSENT ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?lock@QBlittable@@QAEPAVQImage@@XZ @ 13727 NONAME ; class QImage * QBlittable::lock(void) ?setFontHintingPreference@QTextCharFormat@@QAEXW4HintingPreference@QFont@@@Z @ 13728 NONAME ; void QTextCharFormat::setFontHintingPreference(enum QFont::HintingPreference) ?qt_static_metacall@QPixmapColorizeFilter@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13729 NONAME ; void QPixmapColorizeFilter::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13776,7 +13776,7 @@ EXPORTS ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 13775 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *) ?qt_static_metacall@QRadioButton@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13776 NONAME ; void QRadioButton::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ??1QInternalMimeData@@UAE@XZ @ 13777 NONAME ; QInternalMimeData::~QInternalMimeData(void) - ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13778 NONAME ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13778 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const ?qt_addBitmapToPath@@YAXMMPBEHHHPAVQPainterPath@@@Z @ 13779 NONAME ; void qt_addBitmapToPath(float, float, unsigned char const *, int, int, int, class QPainterPath *) ?qt_static_metacall@QTextTable@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13780 NONAME ; void QTextTable::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QItemSelectionModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13781 NONAME ; void QItemSelectionModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13786,4 +13786,17 @@ EXPORTS ?qt_static_metacall@QGraphicsWidget@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13785 NONAME ; void QGraphicsWidget::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QShortcut@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13786 NONAME ; void QShortcut::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?endOfLine@QTextEngine@@AAEHH@Z @ 13787 NONAME ; int QTextEngine::endOfLine(int) + ?setCursorMoveStyle@QTextLayout@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13788 NONAME ; void QTextLayout::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13789 NONAME ; enum Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13790 NONAME ; enum Qt::CursorMoveStyle QTextLayout::cursorMoveStyle(void) const + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13791 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum Qt::CursorMoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13792 NONAME ; void QLineControl::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?cursorMoveStyle@QLineEdit@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13793 NONAME ; enum Qt::CursorMoveStyle QLineEdit::cursorMoveStyle(void) const + ?forceToRaster@QSymbianGraphicsSystemEx@@UAEXPAVQWidget@@@Z @ 13794 NONAME ; void QSymbianGraphicsSystemEx::forceToRaster(class QWidget *) + ?releaseCachedGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13795 NONAME ; void QSymbianGraphicsSystemEx::releaseCachedGpuResources(void) + ?setCursorMoveStyle@QLineEdit@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13796 NONAME ; void QLineEdit::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?platformExtension@QGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 13797 NONAME ; class QGraphicsSystemEx * QGraphicsSystem::platformExtension(void) + ?releaseAllGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13798 NONAME ; void QSymbianGraphicsSystemEx::releaseAllGpuResources(void) + ?cursorMoveStyle@QLineControl@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13799 NONAME ; enum Qt::CursorMoveStyle QLineControl::cursorMoveStyle(void) const + ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 13800 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index b4dcf4f..745bc9b 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -715,7 +715,7 @@ EXPORTS ?detachTextureFromPool@QGLPixmapData@@QAEXXZ @ 714 NONAME ; void QGLPixmapData::detachTextureFromPool(void) ?reclaimTexture@QGLPixmapData@@QAEXXZ @ 715 NONAME ; void QGLPixmapData::reclaimTexture(void) ?destroyTexture@QGLPixmapData@@QAEXXZ @ 716 NONAME ; void QGLPixmapData::destroyTexture(void) - ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ; void QGLGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ABSENT ; void QGLGraphicsSystem::releaseCachedResources(void) ?serialNumber@QGLTextureGlyphCache@@QBEHXZ @ 718 NONAME ; int QGLTextureGlyphCache::serialNumber(void) const ?forceToImage@QGLPixmapData@@QAEXXZ @ 719 NONAME ; void QGLPixmapData::forceToImage(void) ?idealFormat@QGLPixmapData@@QAE?AW4Format@QImage@@AAV3@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 720 NONAME ; enum QImage::Format QGLPixmapData::idealFormat(class QImage &, class QFlags) @@ -874,4 +874,6 @@ EXPORTS ?staticMetaObjectExtraData@QGraphicsShaderEffect@@0UQMetaObjectExtraData@@B @ 873 NONAME ; struct QMetaObjectExtraData const QGraphicsShaderEffect::staticMetaObjectExtraData ?staticMetaObjectExtraData@QGLEngineShaderManager@@0UQMetaObjectExtraData@@B @ 874 NONAME ; struct QMetaObjectExtraData const QGLEngineShaderManager::staticMetaObjectExtraData ?qt_static_metacall@QGLShaderProgram@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 875 NONAME ; void QGLShaderProgram::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?platformExtension@QGLGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 876 NONAME ; class QGraphicsSystemEx * QGLGraphicsSystem::platformExtension(void) + ?releaseCachedGpuResources@QGLGraphicsSystem@@UAEXXZ @ 877 NONAME ; void QGLGraphicsSystem::releaseCachedGpuResources(void) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 8cd3dd4..ecdec9d 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12180,7 +12180,7 @@ EXPORTS _ZNK14QVolatileImage7toImageEv @ 12179 NONAME _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME - _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME + _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME ABSENT _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME _Z18qt_addBitmapToPathffPKhiiiP12QPainterPath @ 12184 NONAME _Z22qt_fontdata_from_indexi @ 12185 NONAME @@ -12288,7 +12288,7 @@ EXPORTS _ZN11QTextEngine27positionAfterVisualMovementEiN11QTextCursor13MoveOperationE @ 12287 NONAME _ZN11QTextEngine9alignLineERK11QScriptLine @ 12288 NONAME _ZN11QTextEngine9endOfLineEi @ 12289 NONAME - _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME ABSENT _ZN11QTextObject18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12291 NONAME _ZN11QTextObject25staticMetaObjectExtraDataE @ 12292 NONAME DATA 8 _ZN11QToolButton18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12293 NONAME @@ -12352,7 +12352,7 @@ EXPORTS _ZN13QSwipeGesture18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12351 NONAME _ZN13QSwipeGesture25staticMetaObjectExtraDataE @ 12352 NONAME DATA 8 _ZN13QTextDocument18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12353 NONAME - _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME ABSENT _ZN13QTextDocument25staticMetaObjectExtraDataE @ 12355 NONAME DATA 8 _ZN13QWidgetAction18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12356 NONAME _ZN13QWidgetAction25staticMetaObjectExtraDataE @ 12357 NONAME DATA 8 @@ -12641,7 +12641,7 @@ EXPORTS _ZN9QGroupBox18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12640 NONAME _ZN9QGroupBox25staticMetaObjectExtraDataE @ 12641 NONAME DATA 8 _ZN9QLineEdit18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12642 NONAME - _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME ABSENT _ZN9QLineEdit25staticMetaObjectExtraDataE @ 12644 NONAME DATA 8 _ZN9QListView18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12645 NONAME _ZN9QListView25staticMetaObjectExtraDataE @ 12646 NONAME DATA 8 @@ -12666,7 +12666,7 @@ EXPORTS _ZNK10QBlittable12capabilitiesEv @ 12665 NONAME _ZNK10QBlittable4sizeEv @ 12666 NONAME _ZNK10QTabWidget14heightForWidthEi @ 12667 NONAME - _ZNK10QTextBlock7isValidEv @ 12668 NONAME + _ZNK10QTextBlock7isValidEv @ 12668 NONAME ABSENT _ZNK10QZipWriter10isWritableEv @ 12669 NONAME _ZNK10QZipWriter17compressionPolicyEv @ 12670 NONAME _ZNK10QZipWriter19creationPermissionsEv @ 12671 NONAME @@ -12738,4 +12738,15 @@ EXPORTS _ZTV19QIdentityProxyModel @ 12737 NONAME _ZTV20QBlittablePixmapData @ 12738 NONAME _Zls6QDebugPK13QSymbianEvent @ 12739 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12740 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12741 NONAME + _ZN15QGraphicsSystem17platformExtensionEv @ 12742 NONAME + _ZN24QSymbianGraphicsSystemEx10hasBCM2727Ev @ 12743 NONAME + _ZN24QSymbianGraphicsSystemEx13forceToRasterEP7QWidget @ 12744 NONAME + _ZN24QSymbianGraphicsSystemEx22releaseAllGpuResourcesEv @ 12745 NONAME + _ZN24QSymbianGraphicsSystemEx25releaseCachedGpuResourcesEv @ 12746 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12747 NONAME + _ZTI17QGraphicsSystemEx @ 12748 NONAME + _ZTI24QSymbianGraphicsSystemEx @ 12749 NONAME + _ZTV24QSymbianGraphicsSystemEx @ 12750 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index c252484..2b67d2c 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -719,7 +719,7 @@ EXPORTS _ZN13QGLPixmapData14reclaimTextureEv @ 718 NONAME _ZN13QGLPixmapData21detachTextureFromPoolEv @ 719 NONAME _ZN13QGLPixmapData9hibernateEv @ 720 NONAME - _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME + _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME ABSENT _ZN13QGLPixmapData11idealFormatER6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 722 NONAME _ZN13QGLPixmapData24releaseNativeImageHandleEv @ 723 NONAME _ZN13QGLPixmapData25initFromNativeImageHandleEPvRK7QString @ 724 NONAME @@ -780,4 +780,7 @@ EXPORTS _ZN9QGLShader25staticMetaObjectExtraDataE @ 779 NONAME DATA 8 _ZN9QGLWidget18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 780 NONAME _ZN9QGLWidget25staticMetaObjectExtraDataE @ 781 NONAME DATA 8 + _ZN17QGLGraphicsSystem17platformExtensionEv @ 782 NONAME + _ZN17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 783 NONAME + _ZThn4_N17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 784 NONAME -- cgit v0.12 From f45dad5017ba70fe9ed663a81586f197ca8fed41 Mon Sep 17 00:00:00 2001 From: Eckhart Koppen Date: Sat, 21 May 2011 11:09:03 +0300 Subject: Updating DEF files for Symbian --- src/s60installs/bwins/QtGuiu.def | 31 ++++++++++++++++++++++--------- src/s60installs/bwins/QtOpenGLu.def | 4 +++- src/s60installs/eabi/QtGuiu.def | 21 ++++++++++++++++----- src/s60installs/eabi/QtOpenGLu.def | 5 ++++- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3c9c16d..7468b85 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12979,7 +12979,7 @@ EXPORTS ?byteCount@QVolatileImage@@QBEHXZ @ 12978 NONAME ; int QVolatileImage::byteCount(void) const ??0QVolatileImage@@QAE@ABV0@@Z @ 12979 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) ?depth@QVolatileImage@@QBEHXZ @ 12980 NONAME ; int QVolatileImage::depth(void) const - ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ; void QGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ABSENT ; void QGraphicsSystem::releaseCachedResources(void) ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) png_access_version_number @ 12983 NONAME png_benign_error @ 12984 NONAME @@ -13228,7 +13228,7 @@ EXPORTS ?qt_static_metacall@QToolBox@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13227 NONAME ; void QToolBox::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QSplitter@@0UQMetaObjectExtraData@@B @ 13228 NONAME ; struct QMetaObjectExtraData const QSplitter::staticMetaObjectExtraData ?qt_static_metacall@QGraphicsTextItem@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13229 NONAME ; void QGraphicsTextItem::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13230 NONAME ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13230 NONAME ABSENT ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?qt_static_metacall@QGraphicsView@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13231 NONAME ; void QGraphicsView::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QGraphicsOpacityEffect@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13232 NONAME ; void QGraphicsOpacityEffect::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QGraphicsBlurEffect@@0UQMetaObjectExtraData@@B @ 13233 NONAME ; struct QMetaObjectExtraData const QGraphicsBlurEffect::staticMetaObjectExtraData @@ -13260,7 +13260,7 @@ EXPORTS ?qt_static_metacall@QGraphicsScene@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13259 NONAME ; void QGraphicsScene::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QTextList@@0UQMetaObjectExtraData@@B @ 13260 NONAME ; struct QMetaObjectExtraData const QTextList::staticMetaObjectExtraData ?qt_fontdata_from_index@@YA?AVQByteArray@@H@Z @ 13261 NONAME ; class QByteArray qt_fontdata_from_index(int) - ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13262 NONAME ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13262 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const ?offsetInLigature@QTextEngine@@QAE?AUQFixed@@PBUQScriptItem@@HHH@Z @ 13263 NONAME ; struct QFixed QTextEngine::offsetInLigature(struct QScriptItem const *, int, int, int) ?qt_static_metacall@QGraphicsAnchor@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13264 NONAME ; void QGraphicsAnchor::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?swap@QImage@@QAEXAAV1@@Z @ 13265 NONAME ; void QImage::swap(class QImage &) @@ -13333,7 +13333,7 @@ EXPORTS ?staticMetaObjectExtraData@QProxyModel@@0UQMetaObjectExtraData@@B @ 13332 NONAME ; struct QMetaObjectExtraData const QProxyModel::staticMetaObjectExtraData ?staticMetaObjectExtraData@QInputContextPlugin@@0UQMetaObjectExtraData@@B @ 13333 NONAME ; struct QMetaObjectExtraData const QInputContextPlugin::staticMetaObjectExtraData ?metaObject@QIdentityProxyModel@@UBEPBUQMetaObject@@XZ @ 13334 NONAME ; struct QMetaObject const * QIdentityProxyModel::metaObject(void) const - ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13335 NONAME ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const + ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13335 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const ?removeColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13336 NONAME ; bool QIdentityProxyModel::removeColumns(int, int, class QModelIndex const &) ?qt_static_metacall@QDirModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13337 NONAME ; void QDirModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QMdiSubWindow@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13338 NONAME ; void QMdiSubWindow::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13571,7 +13571,7 @@ EXPORTS ?d_func@QBlitterPaintEngine@@AAEPAVQBlitterPaintEnginePrivate@@XZ @ 13570 NONAME ; class QBlitterPaintEnginePrivate * QBlitterPaintEngine::d_func(void) ?setNumberPrefix@QTextListFormat@@QAEXABVQString@@@Z @ 13571 NONAME ; void QTextListFormat::setNumberPrefix(class QString const &) ?qt_static_metacall@QAbstractSpinBox@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13572 NONAME ; void QAbstractSpinBox::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13573 NONAME ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13573 NONAME ABSENT ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?lineHeight@QTextBlockFormat@@QBEMMM@Z @ 13574 NONAME ; float QTextBlockFormat::lineHeight(float, float) const ??0QIdentityProxyModel@@IAE@AAVQIdentityProxyModelPrivate@@PAVQObject@@@Z @ 13575 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QIdentityProxyModelPrivate &, class QObject *) ?staticMetaObjectExtraData@QGraphicsEffect@@0UQMetaObjectExtraData@@B @ 13576 NONAME ; struct QMetaObjectExtraData const QGraphicsEffect::staticMetaObjectExtraData @@ -13660,7 +13660,7 @@ EXPORTS ?swap@QIcon@@QAEXAAV1@@Z @ 13659 NONAME ; void QIcon::swap(class QIcon &) ?columnCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 13660 NONAME ; int QIdentityProxyModel::columnCount(class QModelIndex const &) const ?unmarkRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 13661 NONAME ; void QBlittablePixmapData::unmarkRasterOverlay(class QRectF const &) - ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13662 NONAME ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const + ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13662 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 13663 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *, int) ?brushOriginChanged@QBlitterPaintEngine@@UAEXXZ @ 13664 NONAME ; void QBlitterPaintEngine::brushOriginChanged(void) ?openFile@QFileOpenEvent@@QBE_NAAVQFile@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z @ 13665 NONAME ; bool QFileOpenEvent::openFile(class QFile &, class QFlags) const @@ -13683,7 +13683,7 @@ EXPORTS ?unlock@QBlittable@@QAEXXZ @ 13682 NONAME ; void QBlittable::unlock(void) ?swap@QRegion@@QAEXAAV1@@Z @ 13683 NONAME ; void QRegion::swap(class QRegion &) ?staticMetaObjectExtraData@QLCDNumber@@0UQMetaObjectExtraData@@B @ 13684 NONAME ; struct QMetaObjectExtraData const QLCDNumber::staticMetaObjectExtraData - ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13685 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13685 NONAME ABSENT ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) ?staticMetaObjectExtraData@QS60Style@@0UQMetaObjectExtraData@@B @ 13686 NONAME ; struct QMetaObjectExtraData const QS60Style::staticMetaObjectExtraData ?qt_static_metacall@QWidgetAction@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13687 NONAME ; void QWidgetAction::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QListView@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13688 NONAME ; void QListView::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13724,7 +13724,7 @@ EXPORTS ?staticMetaObjectExtraData@QProgressBar@@0UQMetaObjectExtraData@@B @ 13723 NONAME ; struct QMetaObjectExtraData const QProgressBar::staticMetaObjectExtraData ?qt_static_metacall@QLineEdit@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13724 NONAME ; void QLineEdit::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?drawStaticTextItem@QBlitterPaintEngine@@UAEXPAVQStaticTextItem@@@Z @ 13725 NONAME ; void QBlitterPaintEngine::drawStaticTextItem(class QStaticTextItem *) - ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13726 NONAME ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13726 NONAME ABSENT ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?lock@QBlittable@@QAEPAVQImage@@XZ @ 13727 NONAME ; class QImage * QBlittable::lock(void) ?setFontHintingPreference@QTextCharFormat@@QAEXW4HintingPreference@QFont@@@Z @ 13728 NONAME ; void QTextCharFormat::setFontHintingPreference(enum QFont::HintingPreference) ?qt_static_metacall@QPixmapColorizeFilter@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13729 NONAME ; void QPixmapColorizeFilter::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13776,7 +13776,7 @@ EXPORTS ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 13775 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *) ?qt_static_metacall@QRadioButton@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13776 NONAME ; void QRadioButton::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ??1QInternalMimeData@@UAE@XZ @ 13777 NONAME ; QInternalMimeData::~QInternalMimeData(void) - ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13778 NONAME ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13778 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const ?qt_addBitmapToPath@@YAXMMPBEHHHPAVQPainterPath@@@Z @ 13779 NONAME ; void qt_addBitmapToPath(float, float, unsigned char const *, int, int, int, class QPainterPath *) ?qt_static_metacall@QTextTable@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13780 NONAME ; void QTextTable::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QItemSelectionModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13781 NONAME ; void QItemSelectionModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13786,4 +13786,17 @@ EXPORTS ?qt_static_metacall@QGraphicsWidget@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13785 NONAME ; void QGraphicsWidget::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QShortcut@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13786 NONAME ; void QShortcut::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?endOfLine@QTextEngine@@AAEHH@Z @ 13787 NONAME ; int QTextEngine::endOfLine(int) + ?setCursorMoveStyle@QTextLayout@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13788 NONAME ; void QTextLayout::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13789 NONAME ; enum Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13790 NONAME ; enum Qt::CursorMoveStyle QTextLayout::cursorMoveStyle(void) const + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13791 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum Qt::CursorMoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13792 NONAME ; void QLineControl::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?cursorMoveStyle@QLineEdit@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13793 NONAME ; enum Qt::CursorMoveStyle QLineEdit::cursorMoveStyle(void) const + ?forceToRaster@QSymbianGraphicsSystemEx@@UAEXPAVQWidget@@@Z @ 13794 NONAME ; void QSymbianGraphicsSystemEx::forceToRaster(class QWidget *) + ?releaseCachedGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13795 NONAME ; void QSymbianGraphicsSystemEx::releaseCachedGpuResources(void) + ?setCursorMoveStyle@QLineEdit@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13796 NONAME ; void QLineEdit::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?platformExtension@QGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 13797 NONAME ; class QGraphicsSystemEx * QGraphicsSystem::platformExtension(void) + ?releaseAllGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13798 NONAME ; void QSymbianGraphicsSystemEx::releaseAllGpuResources(void) + ?cursorMoveStyle@QLineControl@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13799 NONAME ; enum Qt::CursorMoveStyle QLineControl::cursorMoveStyle(void) const + ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 13800 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index b4dcf4f..745bc9b 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -715,7 +715,7 @@ EXPORTS ?detachTextureFromPool@QGLPixmapData@@QAEXXZ @ 714 NONAME ; void QGLPixmapData::detachTextureFromPool(void) ?reclaimTexture@QGLPixmapData@@QAEXXZ @ 715 NONAME ; void QGLPixmapData::reclaimTexture(void) ?destroyTexture@QGLPixmapData@@QAEXXZ @ 716 NONAME ; void QGLPixmapData::destroyTexture(void) - ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ; void QGLGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ABSENT ; void QGLGraphicsSystem::releaseCachedResources(void) ?serialNumber@QGLTextureGlyphCache@@QBEHXZ @ 718 NONAME ; int QGLTextureGlyphCache::serialNumber(void) const ?forceToImage@QGLPixmapData@@QAEXXZ @ 719 NONAME ; void QGLPixmapData::forceToImage(void) ?idealFormat@QGLPixmapData@@QAE?AW4Format@QImage@@AAV3@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 720 NONAME ; enum QImage::Format QGLPixmapData::idealFormat(class QImage &, class QFlags) @@ -874,4 +874,6 @@ EXPORTS ?staticMetaObjectExtraData@QGraphicsShaderEffect@@0UQMetaObjectExtraData@@B @ 873 NONAME ; struct QMetaObjectExtraData const QGraphicsShaderEffect::staticMetaObjectExtraData ?staticMetaObjectExtraData@QGLEngineShaderManager@@0UQMetaObjectExtraData@@B @ 874 NONAME ; struct QMetaObjectExtraData const QGLEngineShaderManager::staticMetaObjectExtraData ?qt_static_metacall@QGLShaderProgram@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 875 NONAME ; void QGLShaderProgram::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?platformExtension@QGLGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 876 NONAME ; class QGraphicsSystemEx * QGLGraphicsSystem::platformExtension(void) + ?releaseCachedGpuResources@QGLGraphicsSystem@@UAEXXZ @ 877 NONAME ; void QGLGraphicsSystem::releaseCachedGpuResources(void) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 8cd3dd4..ecdec9d 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12180,7 +12180,7 @@ EXPORTS _ZNK14QVolatileImage7toImageEv @ 12179 NONAME _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME - _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME + _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME ABSENT _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME _Z18qt_addBitmapToPathffPKhiiiP12QPainterPath @ 12184 NONAME _Z22qt_fontdata_from_indexi @ 12185 NONAME @@ -12288,7 +12288,7 @@ EXPORTS _ZN11QTextEngine27positionAfterVisualMovementEiN11QTextCursor13MoveOperationE @ 12287 NONAME _ZN11QTextEngine9alignLineERK11QScriptLine @ 12288 NONAME _ZN11QTextEngine9endOfLineEi @ 12289 NONAME - _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME ABSENT _ZN11QTextObject18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12291 NONAME _ZN11QTextObject25staticMetaObjectExtraDataE @ 12292 NONAME DATA 8 _ZN11QToolButton18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12293 NONAME @@ -12352,7 +12352,7 @@ EXPORTS _ZN13QSwipeGesture18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12351 NONAME _ZN13QSwipeGesture25staticMetaObjectExtraDataE @ 12352 NONAME DATA 8 _ZN13QTextDocument18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12353 NONAME - _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME ABSENT _ZN13QTextDocument25staticMetaObjectExtraDataE @ 12355 NONAME DATA 8 _ZN13QWidgetAction18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12356 NONAME _ZN13QWidgetAction25staticMetaObjectExtraDataE @ 12357 NONAME DATA 8 @@ -12641,7 +12641,7 @@ EXPORTS _ZN9QGroupBox18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12640 NONAME _ZN9QGroupBox25staticMetaObjectExtraDataE @ 12641 NONAME DATA 8 _ZN9QLineEdit18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12642 NONAME - _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME ABSENT _ZN9QLineEdit25staticMetaObjectExtraDataE @ 12644 NONAME DATA 8 _ZN9QListView18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12645 NONAME _ZN9QListView25staticMetaObjectExtraDataE @ 12646 NONAME DATA 8 @@ -12666,7 +12666,7 @@ EXPORTS _ZNK10QBlittable12capabilitiesEv @ 12665 NONAME _ZNK10QBlittable4sizeEv @ 12666 NONAME _ZNK10QTabWidget14heightForWidthEi @ 12667 NONAME - _ZNK10QTextBlock7isValidEv @ 12668 NONAME + _ZNK10QTextBlock7isValidEv @ 12668 NONAME ABSENT _ZNK10QZipWriter10isWritableEv @ 12669 NONAME _ZNK10QZipWriter17compressionPolicyEv @ 12670 NONAME _ZNK10QZipWriter19creationPermissionsEv @ 12671 NONAME @@ -12738,4 +12738,15 @@ EXPORTS _ZTV19QIdentityProxyModel @ 12737 NONAME _ZTV20QBlittablePixmapData @ 12738 NONAME _Zls6QDebugPK13QSymbianEvent @ 12739 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12740 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12741 NONAME + _ZN15QGraphicsSystem17platformExtensionEv @ 12742 NONAME + _ZN24QSymbianGraphicsSystemEx10hasBCM2727Ev @ 12743 NONAME + _ZN24QSymbianGraphicsSystemEx13forceToRasterEP7QWidget @ 12744 NONAME + _ZN24QSymbianGraphicsSystemEx22releaseAllGpuResourcesEv @ 12745 NONAME + _ZN24QSymbianGraphicsSystemEx25releaseCachedGpuResourcesEv @ 12746 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12747 NONAME + _ZTI17QGraphicsSystemEx @ 12748 NONAME + _ZTI24QSymbianGraphicsSystemEx @ 12749 NONAME + _ZTV24QSymbianGraphicsSystemEx @ 12750 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index c252484..2b67d2c 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -719,7 +719,7 @@ EXPORTS _ZN13QGLPixmapData14reclaimTextureEv @ 718 NONAME _ZN13QGLPixmapData21detachTextureFromPoolEv @ 719 NONAME _ZN13QGLPixmapData9hibernateEv @ 720 NONAME - _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME + _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME ABSENT _ZN13QGLPixmapData11idealFormatER6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 722 NONAME _ZN13QGLPixmapData24releaseNativeImageHandleEv @ 723 NONAME _ZN13QGLPixmapData25initFromNativeImageHandleEPvRK7QString @ 724 NONAME @@ -780,4 +780,7 @@ EXPORTS _ZN9QGLShader25staticMetaObjectExtraDataE @ 779 NONAME DATA 8 _ZN9QGLWidget18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 780 NONAME _ZN9QGLWidget25staticMetaObjectExtraDataE @ 781 NONAME DATA 8 + _ZN17QGLGraphicsSystem17platformExtensionEv @ 782 NONAME + _ZN17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 783 NONAME + _ZThn4_N17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 784 NONAME -- cgit v0.12 From db0f7f8a17632f7bcc00517d4dff917f979aa637 Mon Sep 17 00:00:00 2001 From: Eckhart Koppen Date: Sun, 22 May 2011 09:44:25 +0300 Subject: Un-absented QML debugger function --- src/s60installs/bwins/QtDeclarativeu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 18639fd..8206a76 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1716,7 +1716,7 @@ EXPORTS ?inWorkerThread@QDeclarativeListModel@@ABE_NXZ @ 1715 NONAME ABSENT ; bool QDeclarativeListModel::inWorkerThread(void) const ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ABSENT ; bool QDeclarativeListModel::canMove(int, int, int) const ?getScriptEngine@QDeclarativeDebugHelper@@SAPAVQScriptEngine@@PAVQDeclarativeEngine@@@Z @ 1717 NONAME ABSENT ; class QScriptEngine * QDeclarativeDebugHelper::getScriptEngine(class QDeclarativeEngine *) - ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ABSENT ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) + ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) ?add@QDeclarativeBasePositioner@@QBEPAVQDeclarativeTransition@@XZ @ 1719 NONAME ABSENT ; class QDeclarativeTransition * QDeclarativeBasePositioner::add(void) const ?setLoops@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1720 NONAME ABSENT ; void QDeclarativeAbstractAnimation::setLoops(int) ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1721 NONAME ABSENT ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *) -- cgit v0.12 From 00a72cd1f5aff15d5a3a59d61efd2f5653d7dd34 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 23 May 2011 15:20:02 +1000 Subject: Fix QtDeclarative keyinteraction example Task-number: QTBUG-19033 --- examples/declarative/keyinteraction/focus/Core/GridMenu.qml | 2 +- examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml index f3894fb..224d38b 100644 --- a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml +++ b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml @@ -86,7 +86,7 @@ FocusScope { hoverEnabled: true onClicked: { - GridView.view.currentIndex = index + container.GridView.view.currentIndex = index container.forceActiveFocus() } } diff --git a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml index 88c3624..8f9d022 100644 --- a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml +++ b/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml @@ -68,7 +68,7 @@ Item { hoverEnabled: true onClicked: { - ListView.view.currentIndex = index + container.ListView.view.currentIndex = index container.forceActiveFocus() } } -- cgit v0.12 From 89f5c035bd3798a0998c3046de643bda0fa8da6b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 23 May 2011 09:03:52 +0200 Subject: uic: #include for QToolBox on non-laid-out forms. for the fake tab-spacing property, which accesses the internal layout and sets its spacing. Task-number: QTBUG-19339 Reviewed-by: Jarek Kobus --- src/tools/uic/cpp/cppwriteincludes.cpp | 7 ++++++- src/tools/uic/cpp/cppwriteincludes.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index d09c712..fdf99b1 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -82,7 +82,7 @@ static inline QString moduleHeader(const QString &module, const QString &header) namespace CPP { WriteIncludes::WriteIncludes(Uic *uic) - : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false) + : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false), m_laidOut(false) { // When possible (no namespace) use the "QtModule/QClass" convention // and create a re-mapping of the old header "qclass.h" to it. Do not do this @@ -106,6 +106,7 @@ WriteIncludes::WriteIncludes(Uic *uic) void WriteIncludes::acceptUI(DomUI *node) { m_scriptsActivated = false; + m_laidOut = false; m_localIncludes.clear(); m_globalIncludes.clear(); m_knownClasses.clear(); @@ -160,6 +161,7 @@ void WriteIncludes::acceptWidget(DomWidget *node) void WriteIncludes::acceptLayout(DomLayout *node) { add(node->attributeClass()); + m_laidOut = true; TreeWalker::acceptLayout(node); } @@ -236,6 +238,9 @@ void WriteIncludes::add(const QString &className, bool determineHeader, const QS m_knownClasses.insert(className); + if (!m_laidOut && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox"))) + add(QLatin1String("QLayout")); // spacing property of QToolBox) + if (className == QLatin1String("Line")) { // ### hmm, deprecate me! add(QLatin1String("QFrame")); return; diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h index 2b98fe9..3509430 100644 --- a/src/tools/uic/cpp/cppwriteincludes.h +++ b/src/tools/uic/cpp/cppwriteincludes.h @@ -107,6 +107,7 @@ private: StringMap m_oldHeaderToNewHeader; bool m_scriptsActivated; + bool m_laidOut; }; } // namespace CPP -- cgit v0.12 From a1c9e88596241ca356986c74b057e6330eae6137 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 23 May 2011 10:52:36 +0300 Subject: Removed qts60plugin references also from config.profiles Task-number: QTBUG-18614 Reviewed-by: TrustMe --- config.profiles/symbian/qt.iby | 4 ---- config.profiles/symbian/qt.pkg | 3 --- 2 files changed, 7 deletions(-) diff --git a/config.profiles/symbian/qt.iby b/config.profiles/symbian/qt.iby index 18b3940..1f295f0 100644 --- a/config.profiles/symbian/qt.iby +++ b/config.profiles/symbian/qt.iby @@ -52,10 +52,6 @@ file=ABI_DIR\BUILD_DIR\qglgraphicssystem.dll SHARED_LIB_DIR\qglgraphicssystem.dl // bearer file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll -// S60 version compatibility plugins for 5.0 (3.1 and 3.2 devices are never likely to have this in ROM, -// so don't bother including those plugins -file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll - file=ABI_DIR\BUILD_DIR\qtactilefeedback.dll SHARED_LIB_DIR\qtactilefeedback.dll // imageformats stubs diff --git a/config.profiles/symbian/qt.pkg b/config.profiles/symbian/qt.pkg index 6ef51ce..b2db49f 100644 --- a/config.profiles/symbian/qt.pkg +++ b/config.profiles/symbian/qt.pkg @@ -68,9 +68,6 @@ "/epoc32/release/armv5/urel/phonon_mmf.dll" - "!:\sys\bin\phonon_mmf.dll" "/epoc32/data/z/resource/qt/plugins/phonon_backend/phonon_mmf.qtplugin" - "!:\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin" - -"/epoc32/release/armv5/urel/qts60plugin_5_0.dll" - "!:\sys\bin\qts60plugin_5_0.dll" - ; localization "/epoc32/data/z/resource/qt/translations/qt_ur.qm" - "!:\resource\qt\translations\qt_ur.qm" "/epoc32/data/z/resource/qt/translations/qt_fa.qm" - "!:\resource\qt\translations\qt_fa.qm" -- cgit v0.12 From 32a583b575da1b387955734ccf36b0a93de37670 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 23 May 2011 09:27:23 +0200 Subject: Fix the build for QUuid Add a quint8 specialization for qbswap. Reviewed-by: Bradley T. Hughes --- src/corelib/global/qendian.h | 5 +++++ src/corelib/plugin/quuid.cpp | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 566307b..1e95b43 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -363,6 +363,11 @@ template inline void qToLittleEndian(T src, uchar *dest) #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN +template <> inline quint8 qbswap(quint8 source) +{ + return source; +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index e07a1aa..0a1c4b5 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -52,8 +52,7 @@ void _q_toHex(Char *&dst, Integral value) { static const char digits[] = "0123456789abcdef"; - if (sizeof(Integral) > 1) - value = qToBigEndian(value); + value = qToBigEndian(value); const char* p = reinterpret_cast(&value); -- cgit v0.12 From ca0b5b4dceaa9d7c152d4ccb58184ee04ab1a6b4 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 23 May 2011 12:20:09 +0300 Subject: Fix Coverity issues found from QS60Style There are couple uninitialized variables in QS60Style. This also corrects compilation warnings for the class. Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 35 ++++++++++++----------------------- src/gui/styles/qs60style_s60.cpp | 9 +++------ 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index fa6eeb7..77c4974 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1155,11 +1155,10 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom case Qt::UpArrow: pe = PE_IndicatorArrowUp; break; - case Qt::DownArrow: + default: pe = PE_IndicatorArrowDown; break; - default: - break; } + } toolButton.rect = button; drawPrimitive(pe, &toolButton, painter, widget); } @@ -1333,8 +1332,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (const QStyleOptionButton *button = qstyleoption_cast(option)) { const bool isDisabled = !(option->state & State_Enabled); const bool isFlat = button->features & QStyleOptionButton::Flat; - QS60StyleEnums::SkinParts skinPart; - QS60StylePrivate::SkinElements skinElement; + QS60StyleEnums::SkinParts skinPart = QS60StyleEnums::SP_QsnFrButtonCenterInactive; + QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_ButtonInactive; if (!isDisabled) { const bool isPressed = (option->state & State_Sunken) || (option->state & State_On); @@ -1345,11 +1344,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; } - } else { - if (isFlat) - skinPart =QS60StyleEnums::SP_QsnFrButtonCenterInactive; - else - skinElement = QS60StylePrivate::SE_ButtonInactive; } if (isFlat) QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags); @@ -2226,21 +2220,16 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; #ifndef QT_NO_TOOLBUTTON case PE_IndicatorArrowDown: + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafScrollArrowDown, painter, option->rect, flags); + break; case PE_IndicatorArrowLeft: + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafScrollArrowLeft, painter, option->rect, flags); + break; case PE_IndicatorArrowRight: - case PE_IndicatorArrowUp: { - QS60StyleEnums::SkinParts skinPart; - if (element==PE_IndicatorArrowDown) - skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowDown; - else if (element==PE_IndicatorArrowLeft) - skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowLeft; - else if (element==PE_IndicatorArrowRight) - skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowRight; - else if (element==PE_IndicatorArrowUp) - skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowUp; - - QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags); - } + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafScrollArrowRight, painter, option->rect, flags); + break; + case PE_IndicatorArrowUp: + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafScrollArrowUp, painter, option->rect, flags); break; #endif //QT_NO_TOOLBUTTON #ifndef QT_NO_SPINBOX diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 1e374cb..4b8fa84 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -579,7 +579,6 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( const TAknsItemID skinId = m_partMap[stylepartIndex].skinID; TInt fallbackGraphicID = -1; - HBufC* iconFile = HBufC::NewLC( KMaxFileName ); fallbackInfo(stylepart, fallbackGraphicID); TAknsItemID colorGroup = KAknsIIDQsnIconColors; @@ -613,7 +612,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( defaultColor); QPixmap result = fromFbsBitmap(icon, iconMask, flags, targetSize); - CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile + CleanupStack::PopAndDestroy(2); //icon, iconMask return result; } @@ -1541,7 +1540,7 @@ QVariant QS60StyleModeSpecifics::themeDefinition( //Animation definitions case QS60StyleEnums::TD_AnimationData: { - CAknsBmpAnimItemData *animationData; + CAknsBmpAnimItemData *animationData = 0; TAknsItemID animationSkinId = partSpecificThemeId(part); QList list; @@ -1557,9 +1556,6 @@ QVariant QS60StyleModeSpecifics::themeDefinition( QS60StyleEnums::AnimationMode playMode; switch(animationData->PlayMode()) { - case CBitmapAnimClientData::EPlay: - playMode = QS60StyleEnums::AM_PlayOnce; - break; case CBitmapAnimClientData::ECycle: playMode = QS60StyleEnums::AM_Looping; break; @@ -1567,6 +1563,7 @@ QVariant QS60StyleModeSpecifics::themeDefinition( playMode = QS60StyleEnums::AM_Bounce; break; default: + playMode = QS60StyleEnums::AM_PlayOnce; break; } list.append(QVariant((int)playMode)); -- cgit v0.12 From 5651fdf16a22cbf3ccd6663d5d5c95b420a3df13 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 23 May 2011 11:18:42 +0200 Subject: Force repaint of modal sheet in Cocoa. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the raster engine on Mac OS X, modal sheets only get their content painted once the sliding down animation is over. By forcing the repaint, the modal sheet has the correct painting during the whole animation. Task-number: QTBUG-17426 Reviewed-by: Samuel Rødal --- src/gui/kernel/qapplication_mac.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index f607a72..b82d212 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -715,6 +715,7 @@ void qt_event_request_showsheet(QWidget *w) { Q_ASSERT(qt_mac_is_macsheet(w)); #ifdef QT_MAC_USE_COCOA + w->repaint(); [NSApp beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget()) modalDelegate:nil didEndSelector:nil contextInfo:0]; #else -- cgit v0.12 From 5338d78aa9d80ddd2bcb21e6b22cd2cf1522a7d3 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 19 May 2011 10:29:49 +0200 Subject: Support placing cursor in ligature with mouse or touch We need to find out the closest element in the ligature to the point we clicked (or tapped), currently we do this by dividing the width of that ligature glyph evenly by the number of characters it covered. We only support Common and Greek script at this point, ligatures in other scripts are still handled as a whole. Task-number: QTBUG-19260 Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 66 ++++++++++++++++++++++++++++++ src/gui/text/qtextengine_p.h | 2 + src/gui/text/qtextlayout.cpp | 16 ++++---- tests/auto/qtextlayout/tst_qtextlayout.cpp | 25 +++++++++++ 4 files changed, 102 insertions(+), 7 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index ff27bc6..0df543b 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2825,6 +2825,72 @@ QFixed QTextEngine::offsetInLigature(const QScriptItem *si, int pos, int max, in return 0; } +// Scan in logClusters[from..to-1] for glyph_pos +int QTextEngine::getClusterLength(unsigned short *logClusters, + const HB_CharAttributes *attributes, + int from, int to, int glyph_pos, int *start) +{ + int clusterLength = 0; + for (int i = from; i < to; i++) { + if (logClusters[i] == glyph_pos && attributes[i].charStop) { + if (*start < 0) + *start = i; + clusterLength++; + } + else if (clusterLength) + break; + } + return clusterLength; +} + +int QTextEngine::positionInLigature(const QScriptItem *si, int end, + QFixed x, QFixed edge, int glyph_pos) +{ + unsigned short *logClusters = this->logClusters(si); + int clusterStart = -1; + int clusterLength = 0; + + if (si->analysis.script != QUnicodeTables::Common && + si->analysis.script != QUnicodeTables::Greek) { + if (glyph_pos == -1) + return si->position + end; + else { + int i; + for (i = 0; i < end; i++) + if (logClusters[i] == glyph_pos) + break; + return si->position + i; + } + } + + if (glyph_pos == -1 && end > 0) + glyph_pos = logClusters[end - 1]; + else { + if (x < edge) + glyph_pos--; + } + + const HB_CharAttributes *attrs = attributes(); + clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart); + + if (clusterLength) { + const QGlyphLayout &glyphs = shapedGlyphs(si); + QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos); + // the approximate width of each individual element of the ligature + QFixed perItemWidth = glyphWidth / clusterLength; + QFixed left = x > edge ? edge : edge - glyphWidth; + int n = ((x - left) / perItemWidth).floor().toInt(); + QFixed dist = x - left - n * perItemWidth; + int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; + int pos = si->position + clusterStart + closestItem; + // Jump to the next charStop + while (!attrs[pos].charStop && pos < end) + pos++; + return pos; + } + return si->position + end; +} + int QTextEngine::previousLogicalPosition(int oldPos) const { const HB_CharAttributes *attrs = attributes(); diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index e06ca1c..8e1d796 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -620,6 +620,7 @@ public: QFixed leadingSpaceWidth(const QScriptLine &line); QFixed offsetInLigature(const QScriptItem *si, int pos, int max, int glyph_pos); + int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos); int previousLogicalPosition(int oldPos) const; int nextLogicalPosition(int oldPos) const; int lineNumberForTextPosition(int pos); @@ -642,6 +643,7 @@ private: void resolveAdditionalFormats() const; int endOfLine(int lineNum); int beginningOfLine(int lineNum); + int getClusterLength(unsigned short *logClusters, const HB_CharAttributes *attributes, int from, int to, int glyph_pos, int *start); }; class QStackTextEngine : public QTextEngine { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 9501c0b..20edb87 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2691,6 +2691,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } int glyph_pos = -1; + QFixed edge; // has to be inside run if (cpos == QTextLine::CursorOnCharacter) { if (si.analysis.bidiLevel % 2) { @@ -2701,6 +2702,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (pos < x) break; glyph_pos = gs; + edge = pos; break; } pos -= glyphs.effectiveAdvance(gs); @@ -2713,6 +2715,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (pos > x) break; glyph_pos = gs; + edge = pos; } pos += glyphs.effectiveAdvance(gs); ++gs; @@ -2726,6 +2729,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (gs <= ge) { if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } pos -= glyphs.effectiveAdvance(gs); @@ -2735,6 +2739,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (ge >= gs) { if (glyphs.attributes[ge].clusterStart && qAbs(x-pos) < dist) { glyph_pos = ge; + edge = pos; dist = qAbs(x-pos); } pos += glyphs.effectiveAdvance(ge); @@ -2746,6 +2751,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (gs <= ge) { if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } pos += glyphs.effectiveAdvance(gs); @@ -2757,6 +2763,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const pos += glyphs.effectiveAdvance(gs); if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } ++gs; @@ -2773,16 +2780,11 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (rtl && nchars > 0) return insertionPoints[lastLine ? nchars : nchars - 1]; } - return si.position + end; + return eng->positionInLigature(&si, end, x, pos, -1); } } Q_ASSERT(glyph_pos != -1); - int j; - for (j = 0; j < eng->length(item); ++j) - if (logClusters[j] == glyph_pos) - break; -// qDebug("at pos %d (in run: %d)", si.position + j, j); - return si.position + j; + return eng->positionInLigature(&si, end, x, edge, glyph_pos); } } // right of last item diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index b5712fb..e68a65e 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -128,6 +128,7 @@ private slots: void textWidthWithStackedTextEngine(); void textWidthWithLineSeparator(); void cursorInLigatureWithMultipleLines(); + void xToCursorForLigatures(); private: QFont testFont; @@ -1477,5 +1478,29 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() QVERIFY(line.cursorToX(0) != line.cursorToX(1)); } +void tst_QTextLayout::xToCursorForLigatures() +{ +#if !defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout("fi", QFont("Times", 20)); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + + QVERIFY(line.xToCursor(0) != line.xToCursor(line.naturalTextWidth() / 2)); + + // U+0061 U+0308 + QTextLayout layout2(QString::fromUtf8("\x61\xCC\x88"), QFont("Times", 20)); + + layout2.beginLayout(); + line = layout2.createLine(); + layout2.endLayout(); + + qreal width = line.naturalTextWidth(); + QVERIFY(line.xToCursor(0) == line.xToCursor(width / 2) || + line.xToCursor(width) == line.xToCursor(width / 2)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From 26b640f62b789f26a4a1e16b602e3b5ced76888b Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 23 May 2011 13:43:56 +0300 Subject: QS60Style: Remove 3.x specific code from style Remove S60 3.x support from QS60Style. Task-number: QTBUG-18615 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 213 +++++++++++++-------------------- src/gui/styles/qs60style_p.h | 3 - src/gui/styles/qs60style_s60.cpp | 45 +------ src/gui/styles/qs60style_simulated.cpp | 19 --- 4 files changed, 84 insertions(+), 196 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index d68ef89..1098364 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -91,11 +91,8 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,19,"QVGA Landscape"}, -{320,240,1,19,"QVGA Portrait"}, {360,640,1,19,"NHD Landscape"}, {640,360,1,19,"NHD Portrait"}, -{352,800,1,12,"E90 Landscape"}, {480,640,1,19,"VGA Landscape"} // *** End of generated data *** }; @@ -104,11 +101,8 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, -{5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, {7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** }; @@ -532,29 +526,14 @@ void QS60StylePrivate::setCurrentLayout(int index) void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart, QPainter *painter, const QRect &rect, SkinElementFlags flags) { - static const bool doCache = -#if defined(Q_WS_S60) - // Freezes on 3.1. Anyways, caching is only really needed on touch UI - !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); -#else - true; -#endif - - const QPixmap skinPartPixMap((doCache ? cachedPart : part)(skinPart, rect.size(), painter, flags)); + const QPixmap skinPartPixMap((cachedPart)(skinPart, rect.size(), painter, flags)); if (!skinPartPixMap.isNull()) painter->drawPixmap(rect.topLeft(), skinPartPixMap); } void QS60StylePrivate::drawFrame(SkinFrameElements frameElement, QPainter *painter, const QRect &rect, SkinElementFlags flags) { - static const bool doCache = -#if defined(Q_WS_S60) - // Freezes on 3.1. Anyways, caching is only really needed on touch UI - !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); -#else - true; -#endif - const QPixmap frameElementPixMap((doCache ? cachedFrame : frame)(frameElement, rect.size(), flags)); + const QPixmap frameElementPixMap((cachedFrame)(frameElement, rect.size(), flags)); if (!frameElementPixMap.isNull()) painter->drawPixmap(rect.topLeft(), frameElementPixMap); } @@ -1040,23 +1019,10 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/ //Groove graphics - if (QS60StylePrivate::hasSliderGrooveGraphic()) { - const QS60StylePrivate::SkinElements grooveElement = horizontal ? - QS60StylePrivate::SE_SliderGrooveHorizontal : - QS60StylePrivate::SE_SliderGrooveVertical; - QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags); - } else { - const QPoint sliderGrooveCenter = sliderGroove.center(); - const bool horizontal = optionSlider->orientation == Qt::Horizontal; - painter->save(); - if (widget) - painter->setPen(widget->palette().windowText().color()); - if (horizontal) - painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y()); - else - painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom()); - painter->restore(); - } + const QS60StylePrivate::SkinElements grooveElement = horizontal ? + QS60StylePrivate::SE_SliderGrooveHorizontal : + QS60StylePrivate::SE_SliderGrooveVertical; + QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags); //Handle graphics const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget); @@ -1979,36 +1945,31 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (!tbWidget || (widget && qobject_cast(widget->parentWidget()))) break; - // Normally in S60 5.0+ there is no background for toolbar, but in some cases with versatile QToolBar, + // Normally in S60 there is no background for toolbar, but in some cases with versatile QToolBar, // it looks a bit strange. So, lets fillRect with Button. - if (!QS60StylePrivate::isToolBarBackground()) { - QList actions = tbWidget->actions(); - bool justToolButtonsInToolBar = true; - for (int i = 0; i < actions.size(); ++i) { - QWidget *childWidget = tbWidget->widgetForAction(actions.at(i)); - const QToolButton *button = qobject_cast(childWidget); - if (!button){ - justToolButtonsInToolBar = false; - } - } - - // Draw frame background - // for vertical toolbars with text only and - // for toolbars with extension buttons and - // for toolbars with widgets in them. - if (!justToolButtonsInToolBar || - (tbWidget && - (tbWidget->orientation() == Qt::Vertical) && - (tbWidget->toolButtonStyle() == Qt::ToolButtonTextOnly))) { - painter->save(); - if (widget) - painter->setBrush(widget->palette().button()); - painter->setOpacity(0.3); - painter->fillRect(toolBar->rect, painter->brush()); - painter->restore(); - } - } else { - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBar, painter, toolBar->rect, flags); + QList actions = tbWidget->actions(); + bool justToolButtonsInToolBar = true; + for (int i = 0; i < actions.size(); ++i) { + QWidget *childWidget = tbWidget->widgetForAction(actions.at(i)); + const QToolButton *button = qobject_cast(childWidget); + if (!button) + justToolButtonsInToolBar = false; + } + + // Draw frame background + // for vertical toolbars with text only and + // for toolbars with extension buttons and + // for toolbars with widgets in them. + if (!justToolButtonsInToolBar + || (tbWidget + && tbWidget->orientation() == Qt::Vertical + && tbWidget->toolButtonStyle() == Qt::ToolButtonTextOnly)) { + painter->save(); + if (widget) + painter->setBrush(widget->palette().button()); + painter->setOpacity(0.3); + painter->fillRect(toolBar->rect, painter->brush()); + painter->restore(); } } break; @@ -2416,52 +2377,46 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorBranch: #if defined(Q_WS_S60) - // 3.1 AVKON UI does not have tree view component, use common style for drawing there - if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) { -#else - if (true) { -#endif - QCommonStyle::drawPrimitive(element, option, painter, widget); - } else { - if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast(option)) { - const bool rightLine = option->state & State_Item; - const bool downLine = option->state & State_Sibling; - const bool upLine = option->state & (State_Open | State_Children | State_Item | State_Sibling); - QS60StylePrivate::SkinElementFlags adjustedFlags = flags; - - QS60StyleEnums::SkinParts skinPart; - bool drawSkinPart = false; - if (rightLine && downLine && upLine) { - skinPart = QS60StyleEnums::SP_QgnIndiHlLineBranch; - drawSkinPart = true; - } else if (rightLine && upLine) { - skinPart = QS60StyleEnums::SP_QgnIndiHlLineEnd; - drawSkinPart = true; - } else if (upLine && downLine) { - skinPart = QS60StyleEnums::SP_QgnIndiHlLineStraight; - drawSkinPart = true; - } - - if (option->direction == Qt::RightToLeft) - adjustedFlags |= QS60StylePrivate::SF_Mirrored_X_Axis; - - if (drawSkinPart) - QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, adjustedFlags); - - if (option->state & State_Children) { - QS60StyleEnums::SkinParts skinPart = - (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; - const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget); - const int minDimension = qMin(option->rect.width(), option->rect.height()); - const int magicTweak = (option->direction == Qt::RightToLeft) ? -3 : 3; //@todo: magic - //The branch indicator icon in S60 is supposed to be superimposed on top of branch lines. - QRect iconRect(QPoint(option->rect.left() + magicTweak, selectionRect.top() + 1), QSize(minDimension, minDimension)); - if (!QS60StylePrivate::isTouchSupported()) - iconRect.translate(0, -4); //@todo: magic - QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, adjustedFlags); - } + if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast(option)) { + const bool rightLine = option->state & State_Item; + const bool downLine = option->state & State_Sibling; + const bool upLine = option->state & (State_Open | State_Children | State_Item | State_Sibling); + QS60StylePrivate::SkinElementFlags adjustedFlags = flags; + + QS60StyleEnums::SkinParts skinPart; + bool drawSkinPart = false; + if (rightLine && downLine && upLine) { + skinPart = QS60StyleEnums::SP_QgnIndiHlLineBranch; + drawSkinPart = true; + } else if (rightLine && upLine) { + skinPart = QS60StyleEnums::SP_QgnIndiHlLineEnd; + drawSkinPart = true; + } else if (upLine && downLine) { + skinPart = QS60StyleEnums::SP_QgnIndiHlLineStraight; + drawSkinPart = true; + } + + if (option->direction == Qt::RightToLeft) + adjustedFlags |= QS60StylePrivate::SF_Mirrored_X_Axis; + + if (drawSkinPart) + QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, adjustedFlags); + + if (option->state & State_Children) { + QS60StyleEnums::SkinParts skinPart = + (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget); + const int minDimension = qMin(option->rect.width(), option->rect.height()); + const int magicTweak = (option->direction == Qt::RightToLeft) ? -3 : 3; + //The branch indicator icon in S60 is supposed to be superimposed on top of branch lines. + QRect iconRect(QPoint(option->rect.left() + magicTweak, selectionRect.top() + 1), QSize(minDimension, minDimension)); + iconRect.translate(0, -4); + QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, adjustedFlags); } } +#else + QCommonStyle::drawPrimitive(element, option, painter, widget); +#endif break; case PE_PanelItemViewRow: // ### Qt 5: remove #ifndef QT_NO_ITEMVIEWS @@ -2483,10 +2438,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelScrollAreaCorner: break; case PE_IndicatorItemViewItemDrop: - if (QS60StylePrivate::isTouchSupported()) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_DropArea, painter, option->rect, flags); - else - commonStyleDraws = true; + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_DropArea, painter, option->rect, flags); break; // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: @@ -2662,13 +2614,11 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, } } sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); - if (QS60StylePrivate::isTouchSupported()) { - //Make itemview easier to use in touch devices - sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); - //QCommonStyle does not adjust height with horizontal margin, it only adjusts width - if (ct == CT_MenuItem) - sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values - } + //Make itemview easier to use in touch devices + sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); + //QCommonStyle does not adjust height with horizontal margin, it only adjusts width + if (ct == CT_MenuItem) + sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values break; #ifndef QT_NO_COMBOBOX case CT_ComboBox: { @@ -3302,8 +3252,7 @@ void QS60Style::polish(QApplication *application) QCommonStyle::polish(qApp); d->m_originalPalette = application->palette(); d->setThemePalette(application); - if (QS60StylePrivate::isTouchSupported()) - qApp->installEventFilter(this); + qApp->installEventFilter(this); } /*! @@ -3318,8 +3267,7 @@ void QS60Style::unpolish(QApplication *application) const QPalette newPalette = QApplication::style()->standardPalette(); QApplication::setPalette(newPalette); QApplicationPrivate::setSystemPalette(d->m_originalPalette); - if (QS60StylePrivate::isTouchSupported()) - qApp->removeEventFilter(this); + qApp->removeEventFilter(this); } /*! @@ -3330,11 +3278,10 @@ bool QS60Style::event(QEvent *e) #ifdef QT_KEYPAD_NAVIGATION Q_D(QS60Style); const QEvent::Type eventType = e->type(); - if ((eventType == QEvent::FocusIn || - eventType == QEvent::FocusOut || - eventType == QEvent::EnterEditFocus || - eventType == QEvent::LeaveEditFocus) && - QS60StylePrivate::isTouchSupported()) + if (eventType == QEvent::FocusIn + || eventType == QEvent::FocusOut + || eventType == QEvent::EnterEditFocus + || eventType == QEvent::LeaveEditFocus) return false; #endif diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ee981c0..1cf069b 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -516,9 +516,6 @@ public: void setBackgroundTexture(QApplication *application) const; static void deleteBackground(); - static bool isTouchSupported(); - static bool isToolBarBackground(); - static bool hasSliderGrooveGraphic(); static bool isSingleClickUi(); static bool isWidgetPressed(const QWidget *widget); diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index f8a6b96..58d70a4 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -692,21 +692,6 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask return pixmap; } -bool QS60StylePrivate::isTouchSupported() -{ - return bool(AknLayoutUtils::PenEnabled()); -} - -bool QS60StylePrivate::isToolBarBackground() -{ - return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); -} - -bool QS60StylePrivate::hasSliderGrooveGraphic() -{ - return QSysInfo::s60Version() != QSysInfo::SV_S60_3_1; -} - bool QS60StylePrivate::isSingleClickUi() { return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0); @@ -1067,20 +1052,8 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme switch(frameElement) { case QS60StylePrivate::SF_ToolTip: - if (QSysInfo::s60Version() != QSysInfo::SV_S60_3_1) { - centerId.Set(EAknsMajorGeneric, 0x19c2); - frameId.Set(EAknsMajorSkin, 0x5300); - } else { - centerId.Set(KAknsIIDQsnFrPopupCenter); - frameId.iMinor = centerId.iMinor - 9; - } - break; - case QS60StylePrivate::SF_ToolBar: - if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || - QSysInfo::s60Version() == QSysInfo::SV_S60_3_2) { - centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu); - frameId.Set(KAknsIIDQsnFrPopupSub); - } + centerId.Set(EAknsMajorGeneric, 0x19c2); + frameId.Set(EAknsMajorSkin, 0x5300); break; case QS60StylePrivate::SF_PopupBackground: centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu); @@ -1222,10 +1195,7 @@ void QS60StylePrivate::setActiveLayout() //not found, lets try with either of dimensions if (activeLayoutIndex==-1){ - const QSysInfo::S60Version currentRelease = QSysInfo::s60Version(); const bool landscape = screenHeight < screenWidth; - - activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2; activeLayoutIndex += (!landscape) ? 1 : 0; } @@ -1281,9 +1251,7 @@ bool QS60StyleModeSpecifics::disabledPartGraphic(QS60StyleEnums::SkinParts &part case QS60StyleEnums::SP_QsnFrButtonSideLInactive: case QS60StyleEnums::SP_QsnFrButtonSideRInactive: case QS60StyleEnums::SP_QsnFrButtonCenterInactive: - if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 || - QSysInfo::s60Version()==QSysInfo::SV_S60_3_2)) - disabledGraphic = true; + disabledGraphic = true; break; default: break; @@ -1299,9 +1267,7 @@ bool QS60StyleModeSpecifics::disabledFrameGraphic(QS60StylePrivate::SkinFrameEle switch(frame){ // inactive button graphics are available from 5.0 onwards case QS60StylePrivate::SF_ButtonInactive: - if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 || - QSysInfo::s60Version()==QSysInfo::SV_S60_3_2)) - disabledGraphic = true; + disabledGraphic = true; break; default: break; @@ -1312,9 +1278,6 @@ bool QS60StyleModeSpecifics::disabledFrameGraphic(QS60StylePrivate::SkinFrameEle QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { - if (!QS60StylePrivate::isTouchSupported()) - return QPixmap(); - QS60StyleEnums::SkinParts updatedPart = part; switch(part){ // AVKON UI has a abnormal handling for scrollbar graphics. It is possible that the root diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index ca02cdf..d0789a8 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -318,25 +318,6 @@ QPixmap QS60StylePrivate::backgroundTexture(bool /*skipCreation*/) return *m_background; } -bool QS60StylePrivate::isTouchSupported() -{ -#ifdef QT_KEYPAD_NAVIGATION - return !QApplication::keypadNavigationEnabled(); -#else - return true; -#endif -} - -bool QS60StylePrivate::isToolBarBackground() -{ - return true; -} - -bool QS60StylePrivate::hasSliderGrooveGraphic() -{ - return false; -} - bool QS60StylePrivate::isSingleClickUi() { return false; -- cgit v0.12 From 95570aee41ddb620f3b661e2baddc428ebe35326 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 23 May 2011 14:57:20 +0300 Subject: QS60Style: icon is not shown correctly in a menu item in all cases Style was using a pixel metric value for the rect, when it has already earlier calculated a correct size rect to use for an itemview item icon. Use the calculated value, as it is correct in all cases (just icon, icon + checkbox, icon + text, icon + checkbox + text). Task-number: QTBUG-19330 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 1098364..63b45d3 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1797,7 +1797,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget); //draw icon and/or checkState - QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize), + QPixmap pix = menuItem->icon.pixmap(iconRect.width(), enabled ? QIcon::Normal : QIcon::Disabled); const bool itemWithIcon = !pix.isNull(); if (itemWithIcon) { -- cgit v0.12 From ddfd45c1be13f695b106f10af7a4d0bc66059df6 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 23 May 2011 14:25:53 +0200 Subject: Revert the revert of subpixel positions interpretation for text So that text rendering with raster engine on Mac can be the same as with native engine. Reviewed-by: Eskil --- src/gui/painting/qpaintengine_raster.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 7dda940..592bf12 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2880,7 +2880,6 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); - const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); const uchar *bits = image.bits(); for (int i=0; i Date: Thu, 19 May 2011 10:29:49 +0200 Subject: Support placing cursor in ligature with mouse or touch We need to find out the closest element in the ligature to the point we clicked (or tapped), currently we do this by dividing the width of that ligature glyph evenly by the number of characters it covered. We only support Common and Greek script at this point, ligatures in other scripts are still handled as a whole. Task-number: QTBUG-19260 Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 66 ++++++++++++++++++++++++++++++ src/gui/text/qtextengine_p.h | 3 ++ src/gui/text/qtextlayout.cpp | 12 +++--- tests/auto/qtextlayout/tst_qtextlayout.cpp | 25 +++++++++++ 4 files changed, 99 insertions(+), 7 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 806779a..62de1fe 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2697,6 +2697,72 @@ QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line) return width(line.from + pos, line.length - pos); } +// Scan in logClusters[from..to-1] for glyph_pos +int QTextEngine::getClusterLength(unsigned short *logClusters, + const HB_CharAttributes *attributes, + int from, int to, int glyph_pos, int *start) +{ + int clusterLength = 0; + for (int i = from; i < to; i++) { + if (logClusters[i] == glyph_pos && attributes[i].charStop) { + if (*start < 0) + *start = i; + clusterLength++; + } + else if (clusterLength) + break; + } + return clusterLength; +} + +int QTextEngine::positionInLigature(const QScriptItem *si, int end, + QFixed x, QFixed edge, int glyph_pos) +{ + unsigned short *logClusters = this->logClusters(si); + int clusterStart = -1; + int clusterLength = 0; + + if (si->analysis.script != QUnicodeTables::Common && + si->analysis.script != QUnicodeTables::Greek) { + if (glyph_pos == -1) + return si->position + end; + else { + int i; + for (i = 0; i < end; i++) + if (logClusters[i] == glyph_pos) + break; + return si->position + i; + } + } + + if (glyph_pos == -1 && end > 0) + glyph_pos = logClusters[end - 1]; + else { + if (x < edge) + glyph_pos--; + } + + const HB_CharAttributes *attrs = attributes(); + clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart); + + if (clusterLength) { + const QGlyphLayout &glyphs = shapedGlyphs(si); + QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos); + // the approximate width of each individual element of the ligature + QFixed perItemWidth = glyphWidth / clusterLength; + QFixed left = x > edge ? edge : edge - glyphWidth; + int n = ((x - left) / perItemWidth).floor().toInt(); + QFixed dist = x - left - n * perItemWidth; + int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; + int pos = si->position + clusterStart + closestItem; + // Jump to the next charStop + while (!attrs[pos].charStop && pos < end) + pos++; + return pos; + } + return si->position + end; +} + QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f) : QTextEngine(string, f), _layoutData(string, _memory, MemSize) diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 5e33f21..f8939e3 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -594,6 +594,8 @@ public: void shapeLine(const QScriptLine &line); QFixed leadingSpaceWidth(const QScriptLine &line); + int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos); + private: void setBoundary(int strPos) const; void addRequiredBoundaries() const; @@ -608,6 +610,7 @@ private: void splitItem(int item, int pos) const; void resolveAdditionalFormats() const; + int getClusterLength(unsigned short *logClusters, const HB_CharAttributes *attributes, int from, int to, int glyph_pos, int *start); }; class QStackTextEngine : public QTextEngine { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index de4ca4f..5857f33 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2622,6 +2622,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } int glyph_pos = -1; + QFixed edge; // has to be inside run if (cpos == QTextLine::CursorOnCharacter) { if (si.analysis.bidiLevel % 2) { @@ -2632,6 +2633,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (pos < x) break; glyph_pos = gs; + edge = pos; break; } pos -= glyphs.effectiveAdvance(gs); @@ -2644,6 +2646,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (pos > x) break; glyph_pos = gs; + edge = pos; } pos += glyphs.effectiveAdvance(gs); ++gs; @@ -2672,15 +2675,10 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } } if (qAbs(x-pos) < dist) - return si.position + end; + return eng->positionInLigature(&si, end, x, pos, -1); } Q_ASSERT(glyph_pos != -1); - int j; - for (j = 0; j < eng->length(item); ++j) - if (logClusters[j] == glyph_pos) - break; -// qDebug("at pos %d (in run: %d)", si.position + j, j); - return si.position + j; + return eng->positionInLigature(&si, end, x, edge, glyph_pos); } } // right of last item diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 964679a..df84c8f 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -127,6 +127,7 @@ private slots: void textWidthWithLineSeparator(); void textWithSurrogates_qtbug15679(); void cursorInLigatureWithMultipleLines(); + void xToCursorForLigatures(); private: QFont testFont; @@ -1453,5 +1454,29 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() QVERIFY(line.cursorToX(0) != line.cursorToX(1)); } +void tst_QTextLayout::xToCursorForLigatures() +{ +#if !defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout("fi", QFont("Times", 20)); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + + QVERIFY(line.xToCursor(0) != line.xToCursor(line.naturalTextWidth() / 2)); + + // U+0061 U+0308 + QTextLayout layout2(QString::fromUtf8("\x61\xCC\x88"), QFont("Times", 20)); + + layout2.beginLayout(); + line = layout2.createLine(); + layout2.endLayout(); + + qreal width = line.naturalTextWidth(); + QVERIFY(line.xToCursor(0) == line.xToCursor(width / 2) || + line.xToCursor(width) == line.xToCursor(width / 2)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From e5d94256be2525c24a8b61edd771662b7f2b8be3 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 4 May 2011 17:40:15 +0200 Subject: Use OpenSSL X509_NAME_ENTRY API to parse UTF8 subjectName/issuerName ... to be able to display non-ASCII names from subject and issuerInfo. Task-number: QTBUG-7912 Merge-request: 922 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 47 ++++++++------------------ src/network/ssl/qsslsocket_openssl_symbols.cpp | 12 +++++-- src/network/ssl/qsslsocket_openssl_symbols_p.h | 6 +++- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index a5cdf01..9887438 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE // forward declaration -static QMap _q_mapFromOnelineName(char *name); +static QMap _q_mapFromX509Name(X509_NAME *name); /*! Constructs a QSslCertificate by reading \a format encoded data @@ -324,7 +324,7 @@ QString QSslCertificate::issuerInfo(SubjectInfo info) const // lazy init if (d->issuerInfo.isEmpty() && d->x509) d->issuerInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_issuer_name(d->x509)); return d->issuerInfo.value(_q_SubjectInfoToString(info)); } @@ -341,7 +341,7 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const // lazy init if (d->issuerInfo.isEmpty() && d->x509) d->issuerInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_issuer_name(d->x509)); return d->issuerInfo.value(QString::fromLatin1(tag)); } @@ -360,7 +360,7 @@ QString QSslCertificate::subjectInfo(SubjectInfo info) const // lazy init if (d->subjectInfo.isEmpty() && d->x509) d->subjectInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_subject_name(d->x509)); return d->subjectInfo.value(_q_SubjectInfoToString(info)); } @@ -376,7 +376,7 @@ QString QSslCertificate::subjectInfo(const QByteArray &tag) const // lazy init if (d->subjectInfo.isEmpty() && d->x509) d->subjectInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_subject_name(d->x509)); return d->subjectInfo.value(QString::fromLatin1(tag)); } @@ -666,37 +666,18 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n"; } -static QMap _q_mapFromOnelineName(char *name) +static QMap _q_mapFromX509Name(X509_NAME *name) { QMap info; - QString infoStr = QString::fromLocal8Bit(name); - q_CRYPTO_free(name); - - // ### The right-hand encoding seems to allow hex (Regulierungsbeh\xC8orde) - //entry.replace(QLatin1String("\\x"), QLatin1String("%")); - //entry = QUrl::fromPercentEncoding(entry.toLatin1()); - // ### See RFC-4630 for more details! - - QRegExp rx(QLatin1String("/([A-Za-z]+)=(.+)")); - - int pos = 0; - while ((pos = rx.indexIn(infoStr, pos)) != -1) { - const QString name = rx.cap(1); - - QString value = rx.cap(2); - const int valuePos = rx.pos(2); - - const int next = rx.indexIn(value); - if (next == -1) { - info.insert(name, value); - break; - } - - value = value.left(next); - info.insert(name, value); - pos = valuePos + value.length(); + for( int i = 0; i < q_X509_NAME_entry_count(name); ++i ) + { + X509_NAME_ENTRY *e = q_X509_NAME_get_entry( name, i ); + const char *obj = q_OBJ_nid2sn( q_OBJ_obj2nid( q_X509_NAME_ENTRY_get_object( e ) ) ); + unsigned char *data = 0; + int size = q_ASN1_STRING_to_UTF8( &data, q_X509_NAME_ENTRY_get_data( e ) ); + info[QString::fromUtf8( obj )] = QString::fromUtf8( (char*)data, size ); + q_CRYPTO_free( data ); } - return info; } diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index b1310cc..6cb4794 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -101,6 +101,7 @@ DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) +DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return); DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return) DEFINEFUNC(BIO *, BIO_new, BIO_METHOD *a, a, return 0, return) @@ -248,7 +249,10 @@ DEFINEFUNC4(void *, X509_get_ext_d2i, X509 *a, a, int b, b, int *c, c, int *d, d DEFINEFUNC(X509_NAME *, X509_get_issuer_name, X509 *a, a, return 0, return) DEFINEFUNC(X509_NAME *, X509_get_subject_name, X509 *a, a, return 0, return) DEFINEFUNC(int, X509_verify_cert, X509_STORE_CTX *a, a, return -1, return) -DEFINEFUNC3(char *, X509_NAME_oneline, X509_NAME *a, a, char *b, b, int c, c, return 0, return) +DEFINEFUNC(int, X509_NAME_entry_count, X509_NAME *a, a, return 0, return) +DEFINEFUNC2(X509_NAME_ENTRY *, X509_NAME_get_entry, X509_NAME *a, a, int b, b, return 0, return) +DEFINEFUNC(ASN1_STRING *, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY *a, a, return 0, return) +DEFINEFUNC(ASN1_OBJECT *, X509_NAME_ENTRY_get_object, X509_NAME_ENTRY *a, a, return 0, return) DEFINEFUNC(EVP_PKEY *, X509_PUBKEY_get, X509_PUBKEY *a, a, return 0, return) DEFINEFUNC(void, X509_STORE_free, X509_STORE *a, a, return, DUMMYARG) DEFINEFUNC(X509_STORE *, X509_STORE_new, DUMMYARG, DUMMYARG, return 0, return) @@ -647,6 +651,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(ASN1_INTEGER_get) RESOLVEFUNC(ASN1_STRING_data) RESOLVEFUNC(ASN1_STRING_length) + RESOLVEFUNC(ASN1_STRING_to_UTF8) RESOLVEFUNC(BIO_ctrl) RESOLVEFUNC(BIO_free) RESOLVEFUNC(BIO_new) @@ -736,7 +741,10 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSLv3_server_method) RESOLVEFUNC(SSLv23_server_method) RESOLVEFUNC(TLSv1_server_method) - RESOLVEFUNC(X509_NAME_oneline) + RESOLVEFUNC(X509_NAME_entry_count) + RESOLVEFUNC(X509_NAME_get_entry) + RESOLVEFUNC(X509_NAME_ENTRY_get_data) + RESOLVEFUNC(X509_NAME_ENTRY_get_object) RESOLVEFUNC(X509_PUBKEY_get) RESOLVEFUNC(X509_STORE_free) RESOLVEFUNC(X509_STORE_new) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 49830ac..ceff57d 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -204,6 +204,7 @@ bool q_resolveOpenSslSymbols(); long q_ASN1_INTEGER_get(ASN1_INTEGER *a); unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); int q_ASN1_STRING_length(ASN1_STRING *a); +int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b); long q_BIO_ctrl(BIO *a, int b, long c, void *d); int q_BIO_free(BIO *a); BIO *q_BIO_new(BIO_METHOD *a); @@ -360,7 +361,10 @@ void *q_X509_get_ext_d2i(X509 *a, int b, int *c, int *d); X509_NAME *q_X509_get_issuer_name(X509 *a); X509_NAME *q_X509_get_subject_name(X509 *a); int q_X509_verify_cert(X509_STORE_CTX *ctx); -char *q_X509_NAME_oneline(X509_NAME *a, char *b, int c); +int q_X509_NAME_entry_count(X509_NAME *a); +X509_NAME_ENTRY *q_X509_NAME_get_entry(X509_NAME *a,int b); +ASN1_STRING *q_X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *a); +ASN1_OBJECT *q_X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *a); EVP_PKEY *q_X509_PUBKEY_get(X509_PUBKEY *a); void q_X509_STORE_free(X509_STORE *store); X509_STORE *q_X509_STORE_new(); -- cgit v0.12 From 2e8d206fd9f656cd88b797c059ef83ed3df32881 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 1 Feb 2011 11:29:13 +0100 Subject: fix coding style for merge request re. utf8 characters in SSL certs fixes minor coding issues for "Use OpenSSL X509_NAME_ENTRY API to parse UTF8 subjectName/issuerName" Task-number: QTBUG-7912 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 9887438..3a703270 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -669,14 +669,13 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi static QMap _q_mapFromX509Name(X509_NAME *name) { QMap info; - for( int i = 0; i < q_X509_NAME_entry_count(name); ++i ) - { - X509_NAME_ENTRY *e = q_X509_NAME_get_entry( name, i ); - const char *obj = q_OBJ_nid2sn( q_OBJ_obj2nid( q_X509_NAME_ENTRY_get_object( e ) ) ); + for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) { + X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i); + const char *obj = q_OBJ_nid2sn(q_OBJ_obj2nid(q_X509_NAME_ENTRY_get_object(e))); unsigned char *data = 0; - int size = q_ASN1_STRING_to_UTF8( &data, q_X509_NAME_ENTRY_get_data( e ) ); - info[QString::fromUtf8( obj )] = QString::fromUtf8( (char*)data, size ); - q_CRYPTO_free( data ); + int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e)); + info[QString::fromUtf8(obj)] = QString::fromUtf8((char*)data, size); + q_CRYPTO_free(data); } return info; } -- cgit v0.12 From 19c77b5e5e5fefedafcfbd587c3fbb4114d7c641 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 21 Mar 2011 18:15:01 +0100 Subject: add auto test for SSL certificates containing utf8 characters Task-number: QTBUG-7912 Reviewed-by: Peter Hartmann --- .../certificates/cert-ss-san-utf8.pem | 16 +++++++++++ .../certificates/cert-ss-san-utf8.pem.san | 5 ++++ .../certificates/gencertificates.sh | 10 +++++++ tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 32 ++++++++++++++++++---- 4 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem create mode 100644 tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem new file mode 100644 index 0000000..e1b731d --- /dev/null +++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICkTCCAfqgAwIBAgIJAL1nF+PLAF2KMA0GCSqGSIb3DQEBBQUAMGkxKzApBgNV +BAoMIkjElcSCxrLDvyDKjeG6v8qI4bq34bi7IFLDqWPDtnJkxZ0xFTATBgNVBAsM +DOOIp0HjiYHvvatCQzEWMBQGA1UEAwwNSm9obm55IEd1aXRhcjELMAkGA1UEBhMC +Tk8wHhcNMTEwNTA1MDgxMzEwWhcNMTEwNjA0MDgxMzEwWjBpMSswKQYDVQQKDCJI +xJXEgsayw78gyo3hur/KiOG6t+G4uyBSw6ljw7ZyZMWdMRUwEwYDVQQLDAzjiKdB +44mB772rQkMxFjAUBgNVBAMMDUpvaG5ueSBHdWl0YXIxCzAJBgNVBAYTAk5PMIGf +MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2zSxS17I6596dJE/VAmGz+06D9S8n +3C0hnIGNVu+LwbgDJTvOw0SzNj4UP72UGgd3UI1KLBg5XWIsRNmE3COJMMh6syjI +L1Ept+tVXxGL6n4gl+0nZ7dkUyxJmeFtigYrL+qCH1yd5rmf3sC3jO4IosuAiG66 +IDkJEVo64NT8ZQIDAQABo0EwPzA9BgNVHREENjA0gQ9hcm5lQGZvb2Jhci5vcmeC +Dnd3dy5mb29iYXIub3JngRFiamFybmVAZm9vYmFyLm9yZzANBgkqhkiG9w0BAQUF +AAOBgQAqVhbC0/EUFdnKlYV3PrknwGX1dPEPGJuIQHa0KpoicvNiOhs1HxBDYbzc +F6wcAMEynq4YwGKhcQLZOs2mo0LreAjA9rU/yBnqrnUW/4gxtUUvmJKK+62IjfLp +eO1L+1NcEMJiaZf8fip4VXhXdOYUhgE8WUZ1UJRC6w3T/yAgcQ== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san new file mode 100644 index 0000000..f46a637 --- /dev/null +++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san @@ -0,0 +1,5 @@ +[subj_alt_name] +subjectAltName=\ + email:arne@foobar.org,\ + DNS:www.foobar.org,\ + email:bjarne@foobar.org diff --git a/tests/auto/qsslcertificate/certificates/gencertificates.sh b/tests/auto/qsslcertificate/certificates/gencertificates.sh index e705785..c8a5db6 100755 --- a/tests/auto/qsslcertificate/certificates/gencertificates.sh +++ b/tests/auto/qsslcertificate/certificates/gencertificates.sh @@ -90,5 +90,15 @@ openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \ -config san.cnf -extensions subj_alt_name /bin/cp san.cnf $outname.san +#--- Non-ASCII Subject --------------------------------------------------------------------- +echo -e "\n generating self signed root cert. with Subject containing UTF-8 characters ..." +outname=cert-ss-san-utf8.pem +#subject="/O=HĕĂƲÿ ʍếʈặḻ Récördŝ/OU=㈧A㉁ォBC/CN=Johnny Guitar/C=NO" +subject=$'/O=H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba\xb7\xe1\xb8\xbb R\xc3\xa9c\xc3\xb6rd\xc5\x9d/OU=\xe3\x88\xa7A\xe3\x89\x81\xef\xbd\xabBC/CN=Johnny Guitar/C=NO' +openssl req -out req-san.pem -new -key rsa-pri-1024.pem -utf8 -subj "$subject" +openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \ + -config san.cnf -extensions subj_alt_name -nameopt multiline,utf8,-esc_msb +/bin/cp san.cnf $outname.san + echo -e "\n cleaning up ..." /bin/rm rsa-pri-1024.pem rsa-pub-1024.* req*.pem diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index 57f2fa8..a91bf0f 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -96,6 +96,7 @@ private slots: void digest_data(); void digest(); void alternateSubjectNames_data(); + void utf8SubjectNames(); void alternateSubjectNames(); void publicKey_data(); void publicKey(); @@ -407,6 +408,27 @@ void tst_QSslCertificate::alternateSubjectNames() } } +void tst_QSslCertificate::utf8SubjectNames() +{ + QSslCertificate cert = QSslCertificate::fromPath("certificates/cert-ss-san-utf8.pem", QSsl::Pem, + QRegExp::FixedString).first(); + QVERIFY(!cert.isNull()); + + // O is "Heavy Metal Records" with heavy use of "decorations" like accents, umlauts etc., + // OU uses arabian / asian script letters near codepoint 64K. + // strings split where the compiler would otherwise find three-digit hex numbers + static const char *o = "H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba" + "\xb7\xe1\xb8\xbb R\xc3\xa9" "c" "\xc3\xb6rd\xc5\x9d"; + static const char *ou = "\xe3\x88\xa7" "A" "\xe3\x89\x81\xef\xbd\xab" "BC"; + + // the following two tests should help find "\x"-literal encoding bugs in the test itself + QCOMPARE(cert.subjectInfo("O").length(), QString::fromUtf8(o).length()); + QCOMPARE (cert.subjectInfo("O").toUtf8().toHex(), QByteArray(o).toHex()); + + QCOMPARE(cert.subjectInfo("O"), QString::fromUtf8(o)); + QCOMPARE(cert.subjectInfo("OU"), QString::fromUtf8(ou)); +} + void tst_QSslCertificate::publicKey_data() { QTest::addColumn("certFilePath"); @@ -519,13 +541,13 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"certificates/*\" fixed der") << QString("certificates/*") << int(QRegExp::FixedString) << false << 0; QTest::newRow("\"certificates/*\" regexp pem") << QString("certificates/*") << int(QRegExp::RegExp) << true << 0; QTest::newRow("\"certificates/*\" regexp der") << QString("certificates/*") << int(QRegExp::RegExp) << false << 0; - QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 4; + QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 5; QTest::newRow("\"certificates/*\" wildcard der") << QString("certificates/*") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("\"c*/c*.pem\" fixed pem") << QString("c*/c*.pem") << int(QRegExp::FixedString) << true << 0; QTest::newRow("\"c*/c*.pem\" fixed der") << QString("c*/c*.pem") << int(QRegExp::FixedString) << false << 0; QTest::newRow("\"c*/c*.pem\" regexp pem") << QString("c*/c*.pem") << int(QRegExp::RegExp) << true << 0; QTest::newRow("\"c*/c*.pem\" regexp der") << QString("c*/c*.pem") << int(QRegExp::RegExp) << false << 0; - QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 4; + QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 5; QTest::newRow("\"c*/c*.pem\" wildcard der") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("\"d*/c*.pem\" fixed pem") << QString("d*/c*.pem") << int(QRegExp::FixedString) << true << 0; QTest::newRow("\"d*/c*.pem\" fixed der") << QString("d*/c*.pem") << int(QRegExp::FixedString) << false << 0; @@ -535,7 +557,7 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"d*/c*.pem\" wildcard der") << QString("d*/c*.pem") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("\"c.*/c.*.pem\" fixed pem") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << true << 0; QTest::newRow("\"c.*/c.*.pem\" fixed der") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << false << 0; - QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 4; + QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 5; QTest::newRow("\"c.*/c.*.pem\" regexp der") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << false << 0; QTest::newRow("\"c.*/c.*.pem\" wildcard pem") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; QTest::newRow("\"c.*/c.*.pem\" wildcard der") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; @@ -546,7 +568,7 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; #ifdef Q_OS_LINUX - QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 4; + QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 5; #endif QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1; @@ -769,7 +791,7 @@ void tst_QSslCertificate::nulInCN() QString cn = cert.subjectInfo(QSslCertificate::CommonName); QVERIFY(cn != "www.bank.com"); - static const char realCN[] = "www.bank.com\\x00.badguy.com"; + static const char realCN[] = "www.bank.com\0.badguy.com"; QCOMPARE(cn, QString::fromLatin1(realCN, sizeof realCN - 1)); } -- cgit v0.12 From 83c37059df7f23be482d4ecb2c54603a3665a33d Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 24 May 2011 10:29:01 +0200 Subject: fix Symbian ordinals for merge request re. utf8 characters in SSL certs Task-number: QTBUG-7912 --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 6cb4794..a940fcd 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -522,6 +522,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(ASN1_INTEGER_get, 48, libs.second ) RESOLVEFUNC(ASN1_STRING_data, 71, libs.second ) RESOLVEFUNC(ASN1_STRING_length, 76, libs.second ) + RESOLVEFUNC(ASN1_STRING_to_UTF8, 86, libs.second ) RESOLVEFUNC(BIO_ctrl, 184, libs.second ) RESOLVEFUNC(BIO_free, 209, libs.second ) RESOLVEFUNC(BIO_new, 222, libs.second ) @@ -612,7 +613,10 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSLv23_server_method, 191, libs.first ) RESOLVEFUNC(TLSv1_server_method, 200, libs.first ) RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.first ) - RESOLVEFUNC(X509_NAME_oneline, 1830, libs.second ) + RESOLVEFUNC(X509_NAME_entry_count, 1821, libs.second ) + RESOLVEFUNC(X509_NAME_get_entry, 1823, libs.second ) + RESOLVEFUNC(X509_NAME_ENTRY_get_data, 1808, libs.second ) + RESOLVEFUNC(X509_NAME_ENTRY_get_object, 1809, libs.second ) RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second ) RESOLVEFUNC(X509_STORE_free, 1939, libs.second ) RESOLVEFUNC(X509_STORE_new, 1942, libs.second ) -- cgit v0.12 From 5a4df38ac98aa013bcfaddc8470bc1a7bae4449e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 18 May 2011 12:16:33 +0200 Subject: Fix broken drawing with large fonts using QStaticText and FreeType In FreeType, there's a fall back to QFontEngine::alphaMapForGlyph() when the fonts are very large. Since this uses a QPainterPath containing an unhinted glyph, the use of hinted metrics would sometimes lead to the glyphs being clipped because they would be positioned slightly outside the image they were painted into. When outline drawing is on, it makes sense to return unhinted metrics, since the glyphs we will actually use are unhinted. Task-number: QTBUG-19067 Reviewed-by: Jiang Jiang (cherry picked from commit 5fcd60f2560e8caf495ce67028a8da8bef27acad) --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index f514942..4c6083c 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -795,7 +795,7 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, if (set && set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; - if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics)) + if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics) || set->outline_drawing) load_flags |= FT_LOAD_NO_HINTING; else load_flags |= load_target; -- cgit v0.12 From 154402f56dcf8303a6ce601a52215226af8d31ba Mon Sep 17 00:00:00 2001 From: Robert Hogan Date: Tue, 24 May 2011 11:04:27 +0200 Subject: Add QUrl::topLevelDomain() and move TLD table from QtNetwork to QtCore Move Qt's copy of the Mozilla public suffix list from QtNetwork to QtCore and use it to expose a new API function QUrl::topLevelDomain(). This function returns the section of the url that is a registrar-controlled top level domain. QtCore now exports a couple of functions to the other Qt modules: qTopLevelDomain, a helper function for QUrl::topLevelDomain(); and qIsEffectiveTLD(), a helper function for QNetworkCookeieJar. The motivation for this new API is to allow QtWebKit implement a Third-Party Cookie blocking policy. For this QtWebKit needs to know the element of the url that is the registry-controlled TLD. Without this knowledge it would end up blocking third-party cookies per host rather than per registry-controlled domain. See also https://bugs.webkit.org/show_bug.cgi?id=45455 Merge-request: 1205 Task-number: QTBUG-13601 Reviewed-by: Peter Hartmann --- src/corelib/io/io.pri | 3 + src/corelib/io/qtldurl.cpp | 117 + src/corelib/io/qtldurl_p.h | 66 + src/corelib/io/qurl.cpp | 19 +- src/corelib/io/qurl.h | 3 + src/corelib/io/qurltlds_p.h | 6481 ++++++++++++++++++++ src/corelib/io/qurltlds_p.h.INFO | 17 + src/network/access/access.pri | 1 - src/network/access/qnetworkcookiejar.cpp | 43 +- src/network/access/qnetworkcookiejar_p.h | 3 - src/network/access/qnetworkcookiejartlds_p.h | 6481 -------------------- src/network/access/qnetworkcookiejartlds_p.h.INFO | 17 - .../qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 4 +- tests/auto/qurl/tst_qurl.cpp | 26 + util/corelib/qurl-generateTLDs/main.cpp | 161 + .../qurl-generateTLDs/qurl-generateTLDs.pro | 9 + .../cookiejar-generateTLDs.pro | 9 - util/network/cookiejar-generateTLDs/main.cpp | 161 - 18 files changed, 6905 insertions(+), 6716 deletions(-) create mode 100644 src/corelib/io/qtldurl.cpp create mode 100644 src/corelib/io/qtldurl_p.h create mode 100644 src/corelib/io/qurltlds_p.h create mode 100644 src/corelib/io/qurltlds_p.h.INFO delete mode 100644 src/network/access/qnetworkcookiejartlds_p.h delete mode 100644 src/network/access/qnetworkcookiejartlds_p.h.INFO create mode 100644 util/corelib/qurl-generateTLDs/main.cpp create mode 100644 util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro delete mode 100644 util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro delete mode 100644 util/network/cookiejar-generateTLDs/main.cpp diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index f67600d..e411f8f 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -24,6 +24,8 @@ HEADERS += \ io/qresource_p.h \ io/qresource_iterator_p.h \ io/qurl.h \ + io/qurltlds_p.h \ + io/qtldurl_p.h \ io/qsettings.h \ io/qsettings_p.h \ io/qfsfileengine.h \ @@ -41,6 +43,7 @@ SOURCES += \ io/qbuffer.cpp \ io/qdatastream.cpp \ io/qdataurl.cpp \ + io/qtldurl.cpp \ io/qdebug.cpp \ io/qdir.cpp \ io/qdiriterator.cpp \ diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp new file mode 100644 index 0000000..7db4bbd --- /dev/null +++ b/src/corelib/io/qtldurl.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformdefs.h" +#include "qurl.h" +#include "private/qurltlds_p.h" +#include "private/qtldurl_p.h" +#include "QtCore/qstringlist.h" + +QT_BEGIN_NAMESPACE + +static bool containsTLDEntry(const QString &entry) +{ + int index = qHash(entry) % tldCount; + int currentDomainIndex = tldIndices[index]; + while (currentDomainIndex < tldIndices[index+1]) { + QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex); + if (currentEntry == entry) + return true; + currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0 + } + return false; +} + +/*! + \internal + + Return the top-level-domain per Qt's copy of the Mozilla public suffix list of + \a domain. +*/ + +Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain) +{ + QStringList sections = domain.toLower().split(QLatin1Char('.'), QString::SkipEmptyParts); + if (sections.isEmpty()) + return QString(); + + QString level, tld; + for (int j = sections.count() - 1; j >= 0; --j) { + level.prepend(QLatin1Char('.') + sections.at(j)); + if (qIsEffectiveTLD(level.right(level.size() - 1))) + tld = level; + } + return tld; +} + +/*! + \internal + + Return true if \a domain is a top-level-domain per Qt's copy of the Mozilla public suffix list. +*/ + +Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain) +{ + // for domain 'foo.bar.com': + // 1. return if TLD table contains 'foo.bar.com' + if (containsTLDEntry(domain)) + return true; + + if (domain.contains(QLatin1Char('.'))) { + int count = domain.size() - domain.indexOf(QLatin1Char('.')); + QString wildCardDomain; + wildCardDomain.reserve(count + 1); + wildCardDomain.append(QLatin1Char('*')); + wildCardDomain.append(domain.right(count)); + // 2. if table contains '*.bar.com', + // test if table contains '!foo.bar.com' + if (containsTLDEntry(wildCardDomain)) { + QString exceptionDomain; + exceptionDomain.reserve(domain.size() + 1); + exceptionDomain.append(QLatin1Char('!')); + exceptionDomain.append(domain); + return (! containsTLDEntry(exceptionDomain)); + } + } + return false; +} + +QT_END_NAMESPACE diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h new file mode 100644 index 0000000..152ffa0 --- /dev/null +++ b/src/corelib/io/qtldurl_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTLDURL_P_H +#define QTLDURL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qDecodeDataUrl. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qurl.h" +#include "QtCore/qstring.h" + +QT_BEGIN_NAMESPACE + +Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain); +Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain); + +QT_END_NAMESPACE + +#endif // QDATAURL_P_H diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index efd3f45..c433d35 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -192,7 +192,9 @@ #if defined QT3_SUPPORT #include "qfileinfo.h" #endif - +#ifndef QT_BOOTSTRAPPED +#include "qtldurl_p.h" +#endif #if defined(Q_OS_WINCE_WM) #pragma optimize("g", off) #endif @@ -5593,6 +5595,21 @@ bool QUrl::hasFragment() const } /*! + \since 4.8 + + Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net). + Note that the return value is prefixed with a '.' unless the + URL does not contain a valid TLD, in which case the function returns + an empty string. +*/ +#ifndef QT_BOOTSTRAPPED +QString QUrl::topLevelDomain() const +{ + return qTopLevelDomain(host()); +} +#endif + +/*! Returns the result of the merge of this URL with \a relative. This URL is used as a base to convert \a relative to an absolute URL. diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 7534b8d..07b0b4e 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -181,6 +181,9 @@ public: void setEncodedFragment(const QByteArray &fragment); QByteArray encodedFragment() const; bool hasFragment() const; +#ifndef QT_BOOTSTRAPPED + QString topLevelDomain() const; +#endif QUrl resolved(const QUrl &relative) const; diff --git a/src/corelib/io/qurltlds_p.h b/src/corelib/io/qurltlds_p.h new file mode 100644 index 0000000..f4f525c --- /dev/null +++ b/src/corelib/io/qurltlds_p.h @@ -0,0 +1,6481 @@ +// Version: MPL 1.1/GPL 2.0/LGPL 2.1 +// +// The contents of this file are subject to the Mozilla Public License Version +// 1.1 (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the +// License. +// +// The Original Code is the Public Suffix List. +// +// The Initial Developer of the Original Code is +// Jo Hermans . +// Portions created by the Initial Developer are Copyright (C) 2007 +// the Initial Developer. All Rights Reserved. +// +// Contributor(s): +// Ruben Arakelyan +// Gervase Markham +// Pamela Greene +// David Triendl +// Jothan Frakes +// The kind representatives of many TLD registries +// +// Alternatively, the contents of this file may be used under the terms of +// either the GNU General Public License Version 2 or later (the "GPL"), or +// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +// in which case the provisions of the GPL or the LGPL are applicable instead +// of those above. If you wish to allow use of your version of this file only +// under the terms of either the GPL or the LGPL, and not to allow others to +// use your version of this file under the terms of the MPL, indicate your +// decision by deleting the provisions above and replace them with the notice +// and other provisions required by the GPL or the LGPL. If you do not delete +// the provisions above, a recipient may use your version of this file under +// the terms of any one of the MPL, the GPL or the LGPL. +// + +#ifndef QURLTLD_P_H +#define QURLTLD_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the Network Access and Core framework. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +// note to maintainer: +// this file should be updated before each release -> +// for instructions see the program at +// util/corelib/qurl-generateTLDs + +static const quint16 tldCount = 3949; +static const quint16 tldIndices[] = { +0, +7, +14, +14, +20, +51, +61, +93, +100, +100, +116, +159, +167, +180, +180, +193, +234, +234, +234, +255, +255, +255, +280, +280, +287, +287, +295, +303, +313, +326, +326, +380, +393, +413, +419, +419, +419, +424, +438, +438, +469, +515, +515, +515, +534, +534, +557, +557, +557, +557, +572, +572, +572, +579, +587, +597, +612, +612, +624, +636, +648, +662, +687, +709, +714, +740, +766, +789, +789, +805, +805, +810, +815, +815, +824, +824, +831, +857, +869, +891, +891, +916, +916, +916, +927, +934, +964, +971, +987, +987, +987, +1008, +1008, +1016, +1016, +1030, +1030, +1052, +1075, +1075, +1082, +1087, +1115, +1135, +1135, +1135, +1172, +1178, +1178, +1178, +1202, +1207, +1220, +1220, +1266, +1266, +1266, +1266, +1272, +1290, +1316, +1316, +1332, +1332, +1339, +1339, +1352, +1352, +1389, +1389, +1408, +1415, +1437, +1444, +1489, +1489, +1502, +1502, +1512, +1518, +1539, +1555, +1562, +1584, +1598, +1607, +1607, +1607, +1632, +1652, +1652, +1658, +1658, +1675, +1682, +1709, +1733, +1748, +1776, +1783, +1783, +1790, +1797, +1826, +1850, +1850, +1856, +1880, +1887, +1901, +1921, +1947, +1961, +1967, +1967, +1967, +1972, +1986, +1986, +1986, +2009, +2029, +2029, +2047, +2061, +2075, +2075, +2075, +2075, +2075, +2075, +2082, +2082, +2124, +2124, +2129, +2162, +2162, +2162, +2236, +2256, +2263, +2276, +2283, +2313, +2313, +2347, +2380, +2387, +2387, +2387, +2431, +2438, +2445, +2452, +2459, +2459, +2469, +2490, +2516, +2527, +2540, +2540, +2586, +2610, +2630, +2630, +2653, +2660, +2669, +2693, +2693, +2710, +2710, +2719, +2719, +2734, +2740, +2740, +2753, +2753, +2763, +2770, +2775, +2782, +2789, +2802, +2820, +2827, +2827, +2841, +2855, +2855, +2865, +2872, +2884, +2884, +2919, +2937, +2955, +2962, +3012, +3042, +3073, +3083, +3083, +3100, +3105, +3112, +3131, +3131, +3166, +3180, +3187, +3194, +3211, +3218, +3223, +3233, +3249, +3259, +3268, +3314, +3314, +3324, +3324, +3336, +3336, +3336, +3336, +3350, +3363, +3376, +3398, +3416, +3445, +3464, +3488, +3488, +3497, +3545, +3552, +3552, +3552, +3566, +3573, +3573, +3573, +3581, +3581, +3603, +3603, +3615, +3621, +3621, +3683, +3683, +3710, +3710, +3716, +3716, +3748, +3770, +3791, +3803, +3810, +3817, +3833, +3846, +3846, +3852, +3876, +3876, +3882, +3903, +3910, +3939, +3939, +3939, +3947, +3962, +3962, +3981, +3994, +4021, +4030, +4042, +4085, +4085, +4096, +4096, +4104, +4123, +4123, +4123, +4143, +4154, +4164, +4194, +4194, +4194, +4205, +4205, +4222, +4238, +4301, +4309, +4322, +4331, +4331, +4331, +4331, +4331, +4347, +4365, +4375, +4375, +4385, +4398, +4412, +4430, +4430, +4437, +4447, +4463, +4472, +4472, +4472, +4484, +4484, +4484, +4484, +4484, +4490, +4490, +4511, +4511, +4522, +4522, +4522, +4522, +4528, +4528, +4534, +4551, +4551, +4551, +4564, +4583, +4583, +4611, +4611, +4611, +4622, +4622, +4649, +4668, +4677, +4692, +4692, +4692, +4705, +4723, +4723, +4723, +4729, +4729, +4743, +4743, +4750, +4750, +4763, +4770, +4776, +4776, +4776, +4793, +4811, +4811, +4811, +4821, +4821, +4841, +4857, +4891, +4897, +4903, +4903, +4903, +4919, +4935, +4942, +4958, +4958, +4975, +4975, +4975, +4985, +4985, +5020, +5032, +5032, +5040, +5053, +5068, +5079, +5079, +5101, +5115, +5115, +5135, +5154, +5161, +5161, +5168, +5168, +5184, +5210, +5210, +5238, +5255, +5278, +5285, +5308, +5318, +5327, +5327, +5333, +5333, +5340, +5348, +5355, +5366, +5377, +5384, +5408, +5415, +5422, +5435, +5442, +5482, +5482, +5482, +5482, +5498, +5527, +5534, +5541, +5572, +5572, +5572, +5579, +5591, +5602, +5602, +5621, +5621, +5646, +5664, +5671, +5671, +5681, +5696, +5707, +5716, +5716, +5723, +5723, +5732, +5742, +5742, +5763, +5770, +5776, +5790, +5790, +5797, +5806, +5816, +5832, +5882, +5882, +5882, +5882, +5893, +5934, +5934, +5965, +5965, +5980, +5980, +5980, +5980, +6007, +6017, +6034, +6051, +6065, +6075, +6075, +6091, +6097, +6097, +6109, +6109, +6109, +6122, +6147, +6168, +6168, +6191, +6191, +6191, +6191, +6191, +6198, +6217, +6224, +6224, +6231, +6245, +6252, +6252, +6270, +6270, +6284, +6305, +6315, +6322, +6322, +6322, +6329, +6329, +6329, +6353, +6361, +6361, +6375, +6391, +6405, +6405, +6415, +6431, +6431, +6431, +6431, +6458, +6475, +6475, +6475, +6482, +6489, +6496, +6496, +6503, +6520, +6520, +6520, +6527, +6527, +6544, +6561, +6573, +6573, +6580, +6580, +6587, +6587, +6592, +6592, +6592, +6592, +6599, +6599, +6612, +6633, +6649, +6649, +6669, +6676, +6683, +6683, +6713, +6720, +6727, +6736, +6736, +6746, +6770, +6807, +6814, +6827, +6846, +6846, +6864, +6864, +6864, +6864, +6881, +6888, +6888, +6888, +6914, +6935, +6935, +6935, +6953, +6959, +6966, +6983, +6983, +6983, +7013, +7023, +7023, +7023, +7023, +7037, +7044, +7058, +7079, +7086, +7123, +7134, +7155, +7168, +7178, +7203, +7227, +7236, +7258, +7265, +7274, +7274, +7303, +7303, +7314, +7314, +7345, +7352, +7367, +7377, +7388, +7388, +7402, +7402, +7409, +7421, +7421, +7467, +7484, +7484, +7484, +7491, +7532, +7532, +7539, +7546, +7546, +7553, +7573, +7573, +7573, +7580, +7587, +7594, +7594, +7594, +7606, +7606, +7637, +7637, +7637, +7664, +7664, +7664, +7677, +7684, +7701, +7723, +7723, +7723, +7723, +7734, +7734, +7734, +7748, +7748, +7748, +7748, +7759, +7759, +7775, +7775, +7782, +7789, +7817, +7824, +7831, +7836, +7865, +7865, +7876, +7901, +7901, +7908, +7918, +7938, +7945, +7945, +7957, +7964, +7979, +7986, +7994, +8007, +8007, +8014, +8021, +8061, +8061, +8071, +8088, +8131, +8138, +8153, +8160, +8160, +8160, +8175, +8183, +8197, +8211, +8211, +8211, +8243, +8243, +8243, +8243, +8259, +8259, +8259, +8259, +8259, +8266, +8275, +8281, +8281, +8281, +8281, +8288, +8288, +8309, +8309, +8309, +8330, +8330, +8330, +8330, +8337, +8343, +8343, +8360, +8370, +8370, +8380, +8380, +8386, +8386, +8397, +8415, +8415, +8428, +8454, +8460, +8475, +8492, +8526, +8554, +8554, +8583, +8583, +8583, +8598, +8607, +8617, +8617, +8642, +8652, +8652, +8652, +8662, +8688, +8688, +8704, +8704, +8747, +8765, +8775, +8783, +8811, +8835, +8835, +8835, +8850, +8859, +8884, +8910, +8919, +8952, +8978, +8978, +8991, +8991, +8991, +8999, +8999, +8999, +9030, +9030, +9030, +9030, +9030, +9041, +9048, +9048, +9054, +9054, +9054, +9086, +9108, +9108, +9119, +9119, +9130, +9144, +9152, +9161, +9174, +9194, +9207, +9207, +9207, +9232, +9242, +9242, +9271, +9290, +9308, +9308, +9308, +9308, +9320, +9333, +9343, +9356, +9379, +9379, +9379, +9395, +9395, +9406, +9419, +9419, +9419, +9419, +9450, +9485, +9485, +9497, +9497, +9505, +9517, +9528, +9528, +9551, +9564, +9586, +9586, +9608, +9608, +9626, +9626, +9626, +9653, +9653, +9681, +9681, +9681, +9698, +9698, +9698, +9714, +9729, +9737, +9737, +9765, +9765, +9765, +9765, +9765, +9825, +9844, +9866, +9880, +9880, +9880, +9880, +9886, +9895, +9895, +9895, +9895, +9895, +9913, +9913, +9924, +9958, +9958, +9967, +9975, +9975, +9975, +9981, +9998, +9998, +9998, +10012, +10036, +10036, +10066, +10079, +10097, +10121, +10133, +10142, +10142, +10142, +10156, +10173, +10173, +10173, +10196, +10205, +10205, +10205, +10205, +10218, +10234, +10240, +10240, +10240, +10264, +10273, +10286, +10286, +10286, +10286, +10299, +10299, +10309, +10309, +10339, +10358, +10358, +10374, +10374, +10390, +10390, +10413, +10413, +10439, +10461, +10467, +10467, +10467, +10492, +10492, +10501, +10528, +10528, +10528, +10539, +10583, +10583, +10583, +10613, +10613, +10619, +10628, +10645, +10645, +10645, +10650, +10671, +10687, +10709, +10709, +10709, +10709, +10709, +10727, +10727, +10727, +10727, +10733, +10733, +10768, +10768, +10773, +10780, +10788, +10788, +10797, +10797, +10835, +10835, +10845, +10852, +10861, +10861, +10861, +10861, +10861, +10861, +10861, +10875, +10888, +10907, +10907, +10907, +10920, +10920, +10932, +10946, +10977, +10977, +10997, +11008, +11037, +11059, +11059, +11059, +11067, +11067, +11067, +11067, +11067, +11077, +11091, +11102, +11102, +11112, +11125, +11129, +11129, +11154, +11154, +11154, +11164, +11164, +11189, +11189, +11189, +11189, +11189, +11196, +11196, +11227, +11238, +11247, +11256, +11265, +11265, +11286, +11307, +11330, +11337, +11378, +11378, +11389, +11413, +11454, +11469, +11475, +11475, +11475, +11475, +11503, +11503, +11503, +11503, +11534, +11534, +11550, +11550, +11557, +11557, +11557, +11557, +11574, +11585, +11585, +11603, +11626, +11643, +11643, +11643, +11643, +11663, +11663, +11682, +11696, +11696, +11696, +11696, +11706, +11706, +11706, +11706, +11723, +11723, +11757, +11757, +11773, +11795, +11813, +11836, +11836, +11883, +11903, +11952, +11965, +11965, +11984, +11997, +12008, +12008, +12008, +12024, +12043, +12065, +12071, +12099, +12129, +12140, +12140, +12146, +12161, +12161, +12161, +12161, +12167, +12167, +12180, +12186, +12208, +12226, +12243, +12243, +12252, +12252, +12274, +12289, +12302, +12302, +12313, +12313, +12313, +12313, +12358, +12358, +12358, +12369, +12375, +12391, +12391, +12391, +12391, +12405, +12410, +12416, +12416, +12436, +12436, +12436, +12443, +12443, +12462, +12477, +12492, +12492, +12503, +12519, +12525, +12531, +12571, +12571, +12591, +12591, +12601, +12641, +12641, +12641, +12657, +12657, +12657, +12699, +12699, +12699, +12712, +12728, +12744, +12761, +12769, +12782, +12793, +12823, +12836, +12851, +12863, +12890, +12900, +12900, +12900, +12910, +12910, +12924, +12924, +12924, +12924, +12924, +12952, +12984, +13003, +13038, +13038, +13056, +13056, +13056, +13056, +13074, +13081, +13093, +13103, +13103, +13112, +13119, +13132, +13132, +13132, +13141, +13151, +13183, +13193, +13206, +13206, +13206, +13236, +13252, +13267, +13267, +13294, +13307, +13307, +13307, +13343, +13349, +13349, +13349, +13375, +13375, +13375, +13384, +13384, +13384, +13393, +13393, +13393, +13402, +13414, +13425, +13445, +13467, +13485, +13499, +13509, +13528, +13528, +13549, +13549, +13559, +13570, +13570, +13570, +13570, +13598, +13637, +13647, +13647, +13661, +13673, +13682, +13687, +13694, +13694, +13720, +13733, +13742, +13748, +13771, +13795, +13795, +13814, +13821, +13821, +13855, +13862, +13862, +13862, +13874, +13874, +13897, +13909, +13909, +13947, +13947, +13952, +13952, +13970, +13979, +13979, +13979, +14008, +14049, +14049, +14049, +14049, +14049, +14049, +14060, +14083, +14083, +14091, +14101, +14101, +14101, +14101, +14118, +14136, +14195, +14195, +14195, +14213, +14213, +14232, +14232, +14253, +14253, +14258, +14275, +14275, +14304, +14311, +14311, +14318, +14318, +14318, +14318, +14318, +14318, +14325, +14325, +14345, +14345, +14379, +14389, +14422, +14422, +14422, +14422, +14435, +14441, +14441, +14460, +14460, +14471, +14471, +14481, +14495, +14495, +14495, +14502, +14502, +14502, +14502, +14524, +14533, +14541, +14552, +14552, +14552, +14552, +14563, +14563, +14568, +14568, +14585, +14595, +14602, +14628, +14628, +14645, +14672, +14678, +14697, +14697, +14734, +14757, +14764, +14771, +14771, +14771, +14796, +14815, +14822, +14845, +14861, +14861, +14861, +14873, +14873, +14873, +14902, +14920, +14920, +14926, +14926, +14926, +14941, +14949, +14949, +14949, +14949, +14949, +14960, +14960, +14971, +14971, +14998, +15003, +15003, +15003, +15013, +15013, +15027, +15027, +15027, +15043, +15053, +15063, +15074, +15083, +15093, +15093, +15121, +15121, +15128, +15128, +15144, +15144, +15144, +15144, +15165, +15170, +15170, +15170, +15170, +15170, +15170, +15170, +15186, +15206, +15206, +15206, +15224, +15236, +15236, +15252, +15258, +15258, +15258, +15258, +15264, +15277, +15288, +15307, +15307, +15318, +15328, +15328, +15334, +15334, +15363, +15399, +15399, +15422, +15438, +15447, +15447, +15456, +15456, +15456, +15495, +15495, +15495, +15495, +15511, +15511, +15530, +15557, +15566, +15582, +15590, +15590, +15604, +15604, +15625, +15635, +15655, +15655, +15655, +15655, +15655, +15665, +15675, +15675, +15675, +15675, +15675, +15682, +15682, +15682, +15694, +15719, +15749, +15749, +15794, +15794, +15837, +15854, +15854, +15861, +15861, +15861, +15861, +15884, +15900, +15911, +15931, +15931, +15931, +15931, +15931, +15963, +15963, +15996, +16006, +16013, +16024, +16034, +16049, +16049, +16049, +16059, +16059, +16059, +16059, +16059, +16059, +16059, +16064, +16075, +16104, +16104, +16117, +16124, +16124, +16124, +16124, +16130, +16145, +16159, +16190, +16193, +16196, +16210, +16224, +16243, +16255, +16261, +16280, +16283, +16292, +16295, +16295, +16301, +16304, +16322, +16325, +16328, +16349, +16355, +16382, +16408, +16414, +16414, +16414, +16458, +16477, +16480, +16485, +16488, +16514, +16520, +16530, +16530, +16546, +16562, +16597, +16603, +16622, +16622, +16646, +16669, +16672, +16715, +16715, +16715, +16718, +16718, +16727, +16733, +16752, +16770, +16787, +16794, +16810, +16827, +16840, +16850, +16876, +16901, +16901, +16901, +16916, +16919, +16926, +16943, +16972, +16978, +16978, +16978, +16981, +17008, +17008, +17016, +17053, +17053, +17053, +17053, +17072, +17086, +17105, +17139, +17153, +17162, +17162, +17177, +17177, +17177, +17177, +17195, +17218, +17221, +17221, +17237, +17276, +17276, +17300, +17319, +17339, +17357, +17370, +17383, +17400, +17407, +17419, +17439, +17439, +17449, +17465, +17475, +17504, +17527, +17527, +17534, +17548, +17564, +17564, +17598, +17598, +17601, +17630, +17649, +17669, +17669, +17679, +17686, +17757, +17776, +17796, +17810, +17840, +17840, +17877, +17884, +17884, +17911, +17936, +17970, +17980, +17995, +17995, +18008, +18011, +18036, +18075, +18097, +18097, +18104, +18115, +18115, +18129, +18134, +18141, +18141, +18157, +18180, +18190, +18217, +18224, +18252, +18284, +18284, +18296, +18299, +18312, +18322, +18338, +18348, +18348, +18363, +18372, +18387, +18387, +18390, +18402, +18445, +18445, +18445, +18466, +18479, +18479, +18498, +18508, +18511, +18511, +18511, +18511, +18511, +18526, +18558, +18586, +18622, +18643, +18670, +18686, +18710, +18720, +18739, +18739, +18742, +18745, +18771, +18774, +18777, +18791, +18813, +18816, +18822, +18839, +18845, +18851, +18854, +18878, +18881, +18896, +18896, +18899, +18926, +18937, +18940, +18953, +18963, +19010, +19010, +19017, +19046, +19060, +19060, +19087, +19095, +19101, +19101, +19128, +19146, +19157, +19157, +19188, +19198, +19205, +19223, +19230, +19255, +19280, +19280, +19283, +19292, +19301, +19320, +19323, +19323, +19341, +19341, +19365, +19378, +19381, +19394, +19423, +19433, +19440, +19466, +19490, +19490, +19490, +19497, +19504, +19511, +19511, +19518, +19545, +19568, +19575, +19575, +19583, +19586, +19592, +19592, +19609, +19622, +19629, +19641, +19641, +19656, +19673, +19700, +19723, +19733, +19746, +19759, +19769, +19782, +19789, +19795, +19831, +19834, +19841, +19851, +19854, +19880, +19895, +19898, +19898, +19911, +19922, +19950, +20020, +20030, +20059, +20062, +20089, +20107, +20151, +20154, +20175, +20205, +20208, +20229, +20229, +20255, +20261, +20261, +20283, +20335, +20362, +20385, +20392, +20392, +20392, +20392, +20418, +20418, +20418, +20418, +20443, +20446, +20446, +20452, +20452, +20467, +20467, +20489, +20489, +20498, +20525, +20554, +20560, +20575, +20589, +20589, +20589, +20614, +20652, +20659, +20659, +20668, +20679, +20679, +20679, +20685, +20685, +20685, +20685, +20685, +20685, +20696, +20733, +20760, +20766, +20769, +20792, +20792, +20792, +20792, +20813, +20813, +20813, +20813, +20826, +20826, +20846, +20862, +20880, +20887, +20901, +20908, +20933, +20938, +20958, +20969, +20978, +20978, +20978, +20985, +20985, +20985, +21000, +21010, +21010, +21014, +21026, +21033, +21041, +21041, +21051, +21051, +21064, +21071, +21113, +21120, +21120, +21127, +21134, +21142, +21164, +21164, +21164, +21188, +21195, +21208, +21215, +21226, +21226, +21226, +21238, +21249, +21255, +21255, +21265, +21279, +21296, +21301, +21315, +21321, +21331, +21331, +21331, +21337, +21343, +21343, +21351, +21351, +21361, +21368, +21383, +21383, +21389, +21413, +21437, +21449, +21462, +21478, +21506, +21534, +21546, +21546, +21557, +21580, +21595, +21595, +21595, +21595, +21626, +21626, +21646, +21670, +21676, +21688, +21688, +21716, +21731, +21762, +21762, +21762, +21762, +21762, +21783, +21789, +21799, +21828, +21828, +21837, +21845, +21868, +21874, +21874, +21880, +21880, +21889, +21901, +21910, +21941, +21941, +21959, +21959, +21959, +21966, +21966, +21972, +21972, +21995, +22011, +22043, +22043, +22051, +22051, +22060, +22060, +22060, +22074, +22086, +22086, +22099, +22099, +22120, +22120, +22134, +22144, +22150, +22158, +22164, +22164, +22171, +22199, +22210, +22210, +22210, +22220, +22228, +22228, +22239, +22261, +22304, +22304, +22312, +22349, +22349, +22349, +22357, +22381, +22381, +22390, +22390, +22390, +22390, +22402, +22413, +22413, +22422, +22422, +22445, +22445, +22445, +22456, +22456, +22469, +22479, +22501, +22512, +22528, +22528, +22528, +22528, +22528, +22528, +22528, +22540, +22540, +22546, +22546, +22546, +22546, +22569, +22591, +22591, +22591, +22591, +22610, +22655, +22655, +22667, +22667, +22677, +22677, +22692, +22692, +22702, +22702, +22702, +22717, +22736, +22750, +22755, +22780, +22785, +22822, +22844, +22859, +22871, +22909, +22949, +22962, +22973, +22979, +22988, +23007, +23027, +23035, +23072, +23082, +23082, +23109, +23116, +23130, +23158, +23166, +23166, +23172, +23177, +23189, +23219, +23219, +23250, +23273, +23281, +23281, +23281, +23281, +23281, +23287, +23287, +23299, +23305, +23315, +23315, +23321, +23328, +23334, +23355, +23355, +23355, +23355, +23355, +23366, +23390, +23396, +23396, +23396, +23396, +23402, +23418, +23424, +23424, +23438, +23446, +23446, +23446, +23500, +23525, +23569, +23592, +23592, +23592, +23605, +23614, +23614, +23614, +23627, +23633, +23657, +23673, +23673, +23673, +23689, +23689, +23701, +23701, +23701, +23713, +23713, +23713, +23738, +23758, +23775, +23775, +23794, +23794, +23803, +23803, +23803, +23803, +23813, +23826, +23845, +23845, +23845, +23845, +23872, +23872, +23872, +23888, +23888, +23900, +23900, +23906, +23906, +23906, +23906, +23906, +23924, +23924, +23924, +23930, +23930, +23939, +23949, +23971, +23971, +23971, +24000, +24012, +24042, +24042, +24042, +24042, +24042, +24070, +24076, +24094, +24094, +24094, +24123, +24123, +24123, +24134, +24150, +24150, +24150, +24150, +24150, +24150, +24155, +24179, +24179, +24189, +24189, +24189, +24198, +24198, +24218, +24218, +24218, +24234, +24251, +24257, +24276, +24305, +24321, +24321, +24321, +24334, +24334, +24334, +24349, +24356, +24361, +24372, +24372, +24372, +24388, +24396, +24396, +24402, +24410, +24410, +24428, +24428, +24450, +24450, +24467, +24485, +24495, +24495, +24495, +24507, +24507, +24514, +24531, +24531, +24531, +24531, +24531, +24537, +24537, +24558, +24572, +24584, +24584, +24601, +24601, +24607, +24615, +24615, +24632, +24632, +24632, +24632, +24661, +24676, +24676, +24724, +24751, +24751, +24774, +24774, +24783, +24793, +24793, +24793, +24813, +24819, +24819, +24826, +24826, +24842, +24858, +24872, +24872, +24890, +24890, +24890, +24890, +24890, +24890, +24890, +24890, +24890, +24906, +24906, +24917, +24928, +24947, +24947, +24947, +24947, +24947, +24947, +24947, +24947, +24947, +24963, +24983, +24991, +24991, +24991, +24991, +24991, +24991, +24991, +24991, +25007, +25007, +25007, +25007, +25007, +25007, +25007, +25030, +25040, +25040, +25040, +25040, +25040, +25059, +25097, +25132, +25149, +25159, +25169, +25169, +25169, +25192, +25192, +25192, +25192, +25205, +25205, +25216, +25221, +25221, +25233, +25233, +25240, +25250, +25256, +25273, +25273, +25303, +25321, +25321, +25321, +25333, +25333, +25333, +25333, +25370, +25370, +25402, +25418, +25418, +25439, +25439, +25454, +25454, +25454, +25463, +25477, +25526, +25526, +25526, +25526, +25545, +25562, +25572, +25572, +25582, +25582, +25582, +25597, +25610, +25634, +25641, +25641, +25641, +25668, +25668, +25675, +25707, +25727, +25727, +25741, +25756, +25756, +25779, +25811, +25811, +25811, +25817, +25817, +25817, +25827, +25827, +25827, +25827, +25827, +25836, +25836, +25836, +25836, +25850, +25850, +25860, +25884, +25901, +25922, +25936, +25946, +25969, +25969, +25969, +25969, +25975, +25975, +25987, +25987, +26065, +26065, +26065, +26084, +26084, +26103, +26128, +26141, +26151, +26169, +26169, +26169, +26180, +26191, +26191, +26191, +26197, +26197, +26205, +26211, +26235, +26235, +26235, +26235, +26235, +26235, +26245, +26245, +26259, +26259, +26259, +26259, +26284, +26284, +26325, +26325, +26355, +26364, +26364, +26402, +26418, +26418, +26425, +26432, +26432, +26454, +26504, +26513, +26525, +26525, +26525, +26525, +26525, +26545, +26545, +26571, +26590, +26597, +26597, +26597, +26597, +26597, +26639, +26648, +26659, +26666, +26672, +26672, +26672, +26672, +26672, +26694, +26701, +26701, +26701, +26724, +26724, +26746, +26753, +26774, +26774, +26774, +26774, +26806, +26824, +26824, +26830, +26852, +26882, +26882, +26889, +26889, +26889, +26889, +26889, +26889, +26903, +26911, +26918, +26918, +26928, +26948, +26948, +26970, +26970, +26985, +26996, +27045, +27045, +27058, +27058, +27068, +27068, +27104, +27155, +27155, +27155, +27155, +27155, +27172, +27172, +27172, +27172, +27189, +27195, +27195, +27223, +27223, +27223, +27223, +27244, +27290, +27322, +27332, +27364, +27371, +27371, +27371, +27401, +27401, +27417, +27417, +27431, +27470, +27470, +27470, +27470, +27484, +27484, +27484, +27484, +27484, +27496, +27496, +27515, +27515, +27543, +27560, +27576, +27604, +27622, +27631, +27631, +27638, +27649, +27672, +27682, +27682, +27682, +27707, +27717, +27724, +27732, +27755, +27755, +27755, +27768, +27768, +27783, +27789, +27799, +27799, +27799, +27818, +27826, +27838, +27848, +27848, +27848, +27855, +27862, +27862, +27896, +27921, +27921, +27943, +27954, +27954, +27976, +27976, +27976, +27985, +28002, +28012, +28019, +28034, +28034, +28046, +28068, +28097, +28122, +28122, +28131, +28137, +28151, +28151, +28172, +28190, +28196, +28211, +28211, +28264, +28273, +28286, +28324, +28324, +28324, +28354, +28354, +28361, +28397, +28417, +28417, +28424, +28435, +28461, +28461, +28470, +28483, +28483, +28483, +28483, +28483, +28483, +28483, +28515, +28531, +28531, +28549, +28575, +28575, +28575, +28582, +28599, +28615, +28630, +28630, +28672, +28711, +28723, +28723, +28731, +28752, +28752, +28752, +28763, +28763, +28775, +28775, +28775, +28775, +28775, +28775, +28805, +28814, +28830, +28861, +28882, +28882, +28902, +28918, +28937, +28952, +28959, +28998, +29009, +29009, +29009, +29009, +29019, +29019, +29019, +29019, +29019, +29057, +29069, +29076, +29076, +29076, +29076, +29076, +29082, +29082, +29082, +29117, +29117, +29117, +29117, +29134, +29134, +29159, +29159, +29185, +29185, +29196, +29196, +29242, +29248, +29256, +29280, +29301, +29307, +29307, +29307, +29314, +29314, +29338, +29356, +29367, +29367, +29381, +29391, +29399, +29399, +29414, +29434, +29434, +29441, +29473, +29484, +29503, +29520, +29520, +29548, +29565, +29572, +29572, +29572, +29572, +29572, +29597, +29597, +29620, +29655, +29660, +29660, +29660, +29667, +29674, +29688, +29698, +29705, +29728, +29740, +29740, +29761, +29761, +29767, +29780, +29787, +29794, +29794, +29807, +29820, +29820, +29820, +29820, +29832, +29844, +29855, +29855, +29855, +29867, +29867, +29867, +29867, +29881, +29881, +29905, +29905, +29905, +29923, +29923, +29948, +29948, +29948, +29976, +29986, +29996, +29996, +30030, +30030, +30054, +30054, +30070, +30070, +30070, +30077, +30077, +30087, +30107, +30107, +30115, +30141, +30178, +30178, +30201, +30201, +30201, +30207, +30229, +30239, +30254, +30268, +30277, +30311, +30323, +30323, +30331, +30331, +30331, +30331, +30331, +30353, +30365, +30374, +30374, +30374, +30380, +30380, +30380, +30380, +30410, +30410, +30410, +30443, +30443, +30453, +30462, +30472, +30472, +30472, +30472, +30472, +30472, +30489, +30500, +30500, +30500, +30532, +30532, +30553, +30577, +30599, +30599, +30609, +30640, +30640, +30640, +30664, +30676, +30676, +30676, +30692, +30719, +30728, +30728, +30742, +30742, +30749, +30749, +30760, +30770, +30770, +30783, +30783, +30783, +30804, +30847, +30847, +30847, +30847, +30857, +30857, +30857, +30857, +30875, +30875, +30895, +30895, +30921, +30926, +30926, +30926, +30945, +30945, +30945, +30945, +30959, +30959, +30959, +30959, +30972, +30972, +30984, +31011, +31011, +31048, +31056, +31056, +31070, +31077, +31077, +31110, +31110, +31115, +31122, +31139, +31159, +31159, +31165, +31171, +31171, +31197, +31204, +31211, +31211, +31221, +31228, +31228, +31245, +31245, +31245, +31252, +31265, +31265, +31265, +31265, +31294, +31305, +31320, +31333, +31333, +31333, +31343, +31350, +31357, +31369, +31369, +31379, +31385, +31391, +31407, +31407, +31407, +31423, +31423, +31423, +31434, +31454, +31470, +31511, +31521, +31521, +31521, +31542, +31582, +31582, +31597, +31597, +31597, +31614, +31623, +31645, +31645, +31661, +31661, +31669, +31669, +31676, +31676, +31706, +31720, +31726, +31743, +31785, +31804, +31817, +31817, +31835, +31846, +31863, +31885, +31885, +31896, +31907, +31907, +31907, +31922, +31922, +31929, +31929, +31929, +31936, +31943, +31949, +31949, +31949, +31959, +32006, +32024, +32031, +32031, +32038, +32063, +32095, +32095, +32105, +32105, +32105, +32105, +32105, +32125, +32134, +32140, +32176, +32185, +32195, +32195, +32195, +32195, +32202, +32202, +32218, +32236, +32259, +32294, +32300, +32305, +32305, +32305, +32323, +32337, +32352, +32359, +32374, +32381, +32388, +32388, +32388, +32402, +32402, +32402, +32402, +32418, +32428, +32428, +32428, +32450, +32450, +32450, +32462, +32467, +32480, +32480, +32480, +32487, +32502, +32509, +32525, +32560, +32570, +32583, +32597, +32623, +32637, +32644, +32667, +32707, +32725, +32725, +32747, +32747, +32751, +32758, +32789, +32807, +32824, +32824, +32824, +32824, +32843, +32843, +32850, +32876, +32908, +32915, +32946, +32965, +32965, +32982, +33002, +33009, +33029, +33064, +33084, +33098, +33098, +33098, +33098, +33110, +33110, +33151, +33158, +33180, +33198, +33205, +33227, +33227, +33237, +33237, +33253, +33258, +33277, +33292, +33315, +33315, +33333, +33348, +33348, +33348, +33348, +33348, +33348, +33348, +33355, +33355, +33355, +33390, +33408, +33423, +33437, +33452, +33458, +33465, +33480, +33480, +33487, +33494, +33504, +33511, +33551, +33551, +33558, +33589, +33595, +33595, +33602, +33627, +33644, +33668, +33668, +33668, +33676, +33676, +33716, +33728, +33747, +33747, +33769, +33775, +33789, +33803, +33803, +33810, +33810, +33810, +33820, +33820, +33820, +33820, +33843, +33843, +33843, +33879, +33889, +33889, +33889, +33903, +33917, +33931, +33959, +33993, +34000, +34014, +34037, +34043, +34055, +34055, +34077, +34083, +34090, +34099, +34099, +34115, +34115, +34133, +34140, +34167, +34172, +34184, +34221, +34245, +34252, +34252, +34259, +34318, +34318, +34325, +34325, +34352, +34400, +34415, +34422, +34422, +34431, +34438, +34445, +34445, +34473, +34473, +34489, +34489, +34489, +34489, +34499, +34499, +34499, +34516, +34536, +34551, +34564, +34580, +34580, +34580, +34589, +34589, +34589, +34613, +34648, +34648, +34648, +34655, +34664, +34681, +34681, +34698, +34698, +34720, +34736, +34749, +34749, +34765, +34778, +34785, +34795, +34819, +34819, +34829, +34841, +34848, +34854, +34854, +34854, +34878, +34894, +34894, +34900, +34917, +34934, +34940, +34970, +34998, +34998, +35004, +35004, +35012, +35012, +35012, +35020, +35020, +35032, +35038, +35062, +35062, +35062, +35068, +35068, +35082, +35092, +35096, +35107, +35118, +35134, +35155, +35155, +35166, +35178, +35178, +35195, +35201, +35201, +35201, +35226, +35226, +35226, +35226, +35256, +35262, +35272, +35280, +35299, +35332, +35354, +35354, +35354, +35370, +35386, +35417, +35417, +35460, +35473, +35478, +35495, +35504, +35504, +35518, +35552, +35589, +35624, +35624, +35637, +35637, +35643, +35643, +35669, +35682, +35695, +35702, +35709, +35709, +35726, +35739, +35749, +35756, +35756, +35778, +35803, +35810, +35829, +35883, +35899, +35905, +35911, +35911, +35923, +35947, +35954, +35980, +35987, +36034, +36052, +36063, +36095, +36106, +36106, +36113, +36120, +36140, +36140, +36153, +36160, +36160, +36167, +36203, +36203, +36218, +36218, +36225, +36253, +36259, +36284, +36296, +36310, +36324, +36331, +36344, +36367, +36367, +36367, +36412, +36412, +36422, +36463, +36463, +36463, +36479, +36490, +36513, +36520, +36520, +36527, +36527, +36527, +36540, +36574, +36594, +36594, +36605, +36621, +36621, +36641, +36641, +36641, +36659, +36682, +36682, +36682, +36682, +36705, +36705, +36705, +36720, +36720, +36755, +36755, +36771, +36771, +36771, +36788, +36806, +36835, +36845, +36875, +36875, +36903, +36921, +36928, +36928, +36940, +36940, +36940, +36966, +36966, +36973, +36983, +36998, +37004, +37014, +37024, +37024, +37032, +37038, +37038, +37061, +37074, +37074, +37091, +37098, +37105, +37105, +37133, +37141, +37141, +37148, +37191, +37191, +37197, +37197, +37210, +37224, +37224, +37231, +37250, +37257, +37273, +37273, +37280, +37287, +37294, +37300, +37307, +37330, +37348, +37348, +37359, +37359, +37359, +37377, +37392, +37398, +37412, +37431, +37469, +37486, +37508, +37517, +37535, +37535, +37542, +37542, +37549, +37549, +37549, +37549, +37556, +37576, +37576, +37583, +37590, +37597, +37604, +37604, +37621, +37635, +37676, +37676, +37704, +37711, +37728, +37728, +37737, +37737, +37737, +37750, +37757, +37778, +37785, +37785, +37819, +37826, +37833, +37843, +37850, +37869, +37914, +37921, +37935, +37942, +37949, +37982, +38013, +38013, +38013, +38023, +38057, +38077, +38097, +38110, +38117, +38123, +38133, +38133, +38133, +38140, +38140, +38148, +38159, +38179, +38192, +38205, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38225, +38225, +38230, +38246, +38258, +38280, +38287, +38294, +38294, +38294, +38301, +38318, +38318, +38340, +38371, +38371, +38384, +38420, +38440, +38453, +38481, +38506, +38522, +38534, +38559, +38559, +38559, +38564, +38564, +38581, +38604, +38604, +38611, +38620, +38626, +38635, +38635, +38635, +38666, +38674, +38688, +38693, +38710, +38722, +38722, +38722, +38729, +38734, +38752, +38792, +38818, +38825, +38861, +38902, +38934, +38949, +38949, +38960, +38969, +38985, +38985, +38996, +39013, +39024, +39024, +39032, +39061, +39074, +39089, +39123, +39123, +39123, +39140, +39161, +39180, +39206, +39215, +39254, +39261, +39277, +39284, +39314, +39314, +39330, +39340, +39340, +39371, +39371, +39392, +39430, +39430, +39437, +39444, +39461, +39468, +39468, +39485, +39517, +39524, +39538, +39543, +39548, +39555, +39581, +39588, +39588, +39609, +39609, +39616, +39652, +39670, +39677, +39677, +39684, +39691, +39702, +39717, +39717, +39717, +39724, +39749, +39760, +39766, +39775, +39791, +39791, +39814, +39827, +39827, +39837, +39859}; + +static const char tldData[] = { +"com.cn\0" +"com.co\0" +"hb.cn\0" +"med.br\0conf.lv\0wallonie.museum\0" +"namsos.no\0" +"\xe7\xb6\xb2\xe7\xbb\x9c.hk\0farmers.museum\0rel.pl\0" +"com.cu\0" +"military.museum\0" +"*.jm\0convent.museum\0cymru.museum\0malvik.no\0" +"univ.sn\0" +"gliding.aero\0" +"wodzislaw.pl\0" +"com.dm\0!pref.iwate.jp\0tran\xc3\xb8y.no\0pila.pl\0" +"mb.it\0*.ke\0lib.ri.us\0" +"com.ec\0*.kh\0tr\xc3\xb8gstad.no\0" +"com.ee\0" +"mobi.gp\0" +"gran.no\0" +"wa.gov.au\0" +"com.dz\0kg.kr\0" +"zoological.museum\0gjerstad.no\0haugesund.no\0kharkov.ua\0" +"walbrzych.pl\0" +"civilization.museum\0" +"ha.no\0" +"*.kw\0" +"med.ec\0com.es\0" +"med.ee\0otago.museum\0svelvik.no\0" +"art.ht\0amber.museum\0elvendrell.museum\0rost.no\0" +"jx.cn\0gratangen.no\0" +"association.aero\0ca.it\0" +"zaporizhzhe.ua\0" +"com.fr\0" +"szex.hu\0" +"e-burg.ru\0" +"com.ge\0bokn.no\0" +"mordovia.ru\0" +"com.gh\0*.mm\0" +"com.gi\0z.se\0" +"cahcesuolo.no\0" +"hurdal.no\0joshkar-ola.ru\0" +"cadaques.museum\0ma.us\0" +"a.bg\0" +"com.gn\0bozen.it\0tambov.ru\0" +"*.gifu.jp\0*.tokyo.jp\0*.mt\0" +"com.gp\0travel\0cc.tx.us\0" +"com.gr\0hemne.no\0" +"*.ni\0" +"*.mz\0" +"cc.il.us\0" +"com.gy\0" +"zj.cn\0oksnes.no\0museum.tt\0" +"com.hk\0*.np\0" +"rc.it\0baseball.museum\0" +"com.hn\0exhibition.museum\0" +"h\xc3\xa1""bmer.no\0" +"com.hr\0" +"fg.it\0stathelle.no\0defense.tn\0" +"com.ht\0" +"qld.gov.au\0*.nz\0" +"davvenj\xc3\xa1rga.no\0*.om\0" +"vang.no\0" +"*.kumamoto.jp\0" +"vercelli.it\0usenet.pl\0" +"com.io\0stalbans.museum\0" +"com.iq\0" +"*.pg\0" +"com.is\0klabu.no\0skiptvet.no\0" +"med.ht\0field.museum\0" +"gr.it\0gj\xc3\xb8vik.no\0tromsa.no\0lib.mi.us\0" +"ca.na\0" +"hagebostad.no\0k12.ma.us\0" +"*.qa\0" +"*.niigata.jp\0" +"monzaebrianza.it\0com.jo\0comunica\xc3\xa7\xc3\xb5""es.museum\0" +"gr.jp\0" +"ballangen.no\0*.py\0" +"scienceandindustry.museum\0" +"nuoro.it\0com.kg\0" +"com.ki\0" +"im.it\0idv.tw\0" +"*.akita.jp\0com.km\0r\xc3\xb8ros.no\0sopot.pl\0" +"!pref.yamanashi.jp\0" +"com.kp\0" +"!pref.kochi.jp\0com.la\0" +"com.lb\0" +"com.lc\0stjordalshalsen.no\0sigdal.no\0cc.nm.us\0" +"samnanger.no\0" +"drobak.no\0" +"vt.it\0" +"catering.aero\0com.ky\0" +"com.kz\0cc.ca.us\0" +"com.lk\0" +"grosseto.it\0mosvik.no\0" +"namsskogan.no\0" +"loten.no\0" +"chirurgiens-dentistes.fr\0" +"com.lr\0bremanger.no\0" +"gs.cn\0" +"com.lv\0lib.co.us\0" +"com.mg\0" +"passenger-association.aero\0" +"com.ly\0yekaterinburg.ru\0" +"vladivostok.ru\0" +"com.mk\0beeldengeluid.museum\0" +"com.ml\0" +"art.pl\0" +"com.mo\0" +"britishcolumbia.museum\0tx.us\0" +"com.na\0sakhalin.ru\0*.sv\0" +"mc.it\0" +"amsterdam.museum\0udm.ru\0" +"com.mu\0" +"com.mv\0com.nf\0" +"com.mw\0com.ng\0il.us\0" +"geometre-expert.fr\0com.mx\0" +"med.ly\0com.my\0" +"ag.it\0" +"*.tr\0" +"!pref.oita.jp\0" +"hoyanger.no\0skedsmo.no\0" +"com.nr\0turystyka.pl\0" +"koebenhavn.museum\0" +"quebec.museum\0" +"stord.no\0*.uk\0" +"act.au\0" +"br.it\0cb.it\0gyeonggi.kr\0jobs.tt\0lib.hi.us\0" +"*.ve\0" +"*.saga.jp\0wildlife.museum\0com.pa\0" +"monzabrianza.it\0sciencehistory.museum\0stange.no\0oskol.ru\0principe.st\0*.uy\0" +"plaza.museum\0com.pe\0" +"com.pf\0" +"eigersund.no\0" +"com.ph\0" +"manx.museum\0marylhurst.museum\0" +"md.ci\0pi.it\0schweiz.museum\0com.pk\0" +"grp.lk\0fr\xc3\xb8ya.no\0com.pl\0press.se\0" +"us.com\0" +"b.bg\0cremona.it\0communication.museum\0art.sn\0" +"med.pa\0" +"com.pr\0" +"com.ps\0" +"com.pt\0" +"k12.in.us\0" +"ah.cn\0bahcavuotna.no\0" +"sondrio.it\0arkhangelsk.ru\0" +"cargo.aero\0" +"council.aero\0" +"museum.mv\0hattfjelldal.no\0spydeberg.no\0med.pl\0" +"niepce.museum\0museum.mw\0" +"anthropology.museum\0" +"pharmacien.fr\0smola.no\0" +"fin.ec\0" +"selbu.no\0" +"workinggroup.aero\0nm.us\0" +"museum.no\0com.re\0" +"cc.vt.us\0" +"village.museum\0" +"ca.us\0" +"*.sapporo.jp\0" +"teramo.it\0" +"com.ro\0" +"*.ye\0" +"com.sa\0" +"com.sb\0" +"so.it\0com.sc\0" +"jolster.no\0com.sd\0" +"com.ru\0" +"com.rw\0com.sg\0" +"sydney.museum\0" +"sa.edu.au\0" +"tom.ru\0" +"com.sl\0*.za\0" +"\xe7\xbd\x91\xe7\xb5\xa1.hk\0naturbruksgymn.se\0com.sn\0" +"assedic.fr\0com.so\0" +"!pref.mie.jp\0*.yu\0" +"med.sa\0" +"newspaper.museum\0holmestrand.no\0dnepropetrovsk.ua\0" +"christiansburg.museum\0roan.no\0" +"pesaro-urbino.it\0med.sd\0com.st\0" +"s\xc3\xb8gne.no\0" +"nuernberg.museum\0" +"*.zm\0" +"com.sy\0" +"*.nagano.jp\0com.tj\0" +"nt.gov.au\0news.hu\0paderborn.museum\0" +"boston.museum\0" +"com.tn\0" +"com.to\0" +"broadcast.museum\0" +"com.ua\0" +"*.zw\0" +"baikal.ru\0" +"bykle.no\0com.tt\0" +"verdal.no\0" +"roros.no\0" +"fi.cr\0carboniaiglesias.it\0chuvashia.ru\0com.tw\0" +"k12.ca.us\0" +"eidsvoll.no\0" +"*.ishikawa.jp\0" +"dolls.museum\0" +"naval.museum\0" +"karasjok.no\0tysvar.no\0" +"bielawa.pl\0com.vc\0" +"svalbard.no\0deatnu.no\0rnd.ru\0" +"grandrapids.museum\0" +"bauern.museum\0k12.pr.us\0" +"press.ma\0" +"*.kagawa.jp\0fribourg.museum\0przeworsk.pl\0com.vi\0" +"com.uz\0" +"babia-gora.pl\0" +"com.vn\0" +"med.pro\0" +"suedtirol.it\0kursk.ru\0" +"bonn.museum\0" +"lt.it\0" +"design.aero\0microlight.aero\0americanantiques.museum\0meland.no\0" +"insurance.aero\0aarborte.no\0" +"kh.ua\0" +"macerata.it\0architecture.museum\0" +"rovigo.it\0rawa-maz.pl\0" +"store.nf\0levanger.no\0" +"b\xc3\xa1jddar.no\0" +"not.br\0" +"com.ws\0" +"!pref.kagawa.jp\0" +"!omanpost.om\0" +"vt.us\0" +"gs.ah.no\0vladikavkaz.ru\0" +"no.it\0" +"in.na\0szkola.pl\0a.se\0" +"aid.pl\0" +"workshop.museum\0vegarshei.no\0" +"sund.no\0" +"bs.it\0flora.no\0" +"agriculture.museum\0" +"koeln.museum\0" +"minnesota.museum\0k12.il.us\0" +"froya.no\0" +"aeroport.fr\0" +"davvenjarga.no\0zgora.pl\0ivano-frankivsk.ua\0" +"*.gunma.jp\0" +"amot.no\0" +"mus.br\0chungbuk.kr\0" +"ggf.br\0lorenskog.no\0" +"jeonbuk.kr\0" +"k12.vi.us\0" +"c.bg\0sande.more-og-romsdal.no\0" +"perugia.it\0" +"massa-carrara.it\0" +"michigan.museum\0" +"archaeology.museum\0mosj\xc3\xb8""en.no\0czest.pl\0koenig.ru\0\xe0\xb6\xbd\xe0\xb6\x82\xe0\xb6\x9a\xe0\xb7\x8f\0" +"mobi.tt\0" +"kraanghke.no\0" +"cc.in.us\0" +"re.it\0lib.vt.us\0" +"dell-ogliastra.it\0" +"s\xc3\xb8mna.no\0" +"k12.wv.us\0" +"gok.pk\0fh.se\0" +"luzern.museum\0" +"fi.it\0swidnica.pl\0" +"cbg.ru\0" +"latina.it\0" +"vibovalentia.it\0" +"modum.no\0" +"safety.aero\0" +"sp.it\0" +"science.museum\0ah.no\0" +"norddal.no\0" +"cc.na\0" +"re.kr\0" +"dielddanuorri.no\0" +"force.museum\0" +"torino.it\0cc.md.us\0" +"artanddesign.museum\0pisz.pl\0" +"olsztyn.pl\0" +"unsa.ba\0rade.no\0vinnica.ua\0" +"in.rs\0astrakhan.ru\0" +"sogne.no\0" +"homebuilt.aero\0" +"polkowice.pl\0" +"hole.no\0health.vn\0" +"fj.cn\0" +"davvesiida.no\0" +"vic.au\0" +"kongsberg.no\0" +"pub.sa\0" +"vv.it\0" +"!pref.tottori.jp\0" +"*.sendai.jp\0in.th\0" +"lib.pa.us\0" +"chiropractic.museum\0" +"mobi.na\0aca.pro\0" +"konyvelo.hu\0sciencecenters.museum\0" +"he.cn\0" +"in.ua\0" +"!city.nagoya.jp\0" +"muenchen.museum\0" +"psi.br\0" +"maryland.museum\0" +"!statecouncil.om\0" +"tr\xc3\xa6na.no\0" +"!pref.yamagata.jp\0jewishart.museum\0" +"lu.it\0me.it\0" +"chel.ru\0" +"tatarstan.ru\0" +"adult.ht\0in.us\0" +"kafjord.no\0" +"\xd7\x99\xd7\xa8\xd7\x95\xd7\xa9\xd7\x9c\xd7\x99\xd7\x9d.museum\0" +"net.ac\0k12.ec\0" +"net.ae\0bashkiria.ru\0" +"net.af\0!omantel.om\0" +"net.ag\0" +"net.ai\0" +"!pref.toyama.jp\0" +"net.al\0timekeeping.museum\0" +"net.an\0design.museum\0fin.tn\0" +"ethnology.museum\0" +"perso.ht\0asker.no\0b.se\0" +"net.ba\0" +"net.bb\0flanders.museum\0" +"mincom.tn\0" +"frana.no\0" +"bt.it\0" +"net.bh\0" +"auto.pl\0" +"net.az\0" +"treviso.it\0" +"war.museum\0" +"net.bm\0" +"langevag.no\0m\xc3\xa5lselv.no\0" +"net.bo\0" +"gol.no\0" +"folkebibl.no\0" +"net.br\0" +"net.bs\0troandin.no\0saotome.st\0lib.tn.us\0" +"md.us\0k12.ut.us\0" +"d.bg\0cambridge.museum\0\xc3\xa5s.no\0" +"net.ci\0" +"net.bz\0" +"sch.ae\0undersea.museum\0odda.no\0" +"net.cn\0" +"net.co\0c.la\0" +"gliwice.pl\0" +"aurskog-h\xc3\xb8land.no\0" +"andria-trani-barletta.it\0" +"net.cu\0loab\xc3\xa1t.no\0" +"rep.kp\0" +"\xe7\xbb\x84\xe7\xb9\x94.hk\0" +"gallery.museum\0" +"\xc3\xb8rland.no\0" +"store.ro\0" +"net.dm\0" +"somna.no\0" +"hemnes.no\0" +"ringebu.no\0k12.ky.us\0" +"net.ec\0" +"dn.ua\0" +"tarnobrzeg.pl\0" +"soc.lk\0" +"romsa.no\0" +"bamble.no\0" +"net.dz\0lutsk.ua\0" +"barlettatraniandria.it\0ta.it\0countryestate.museum\0" +"kaszuby.pl\0" +"*.yamaguchi.jp\0cranbrook.museum\0store.st\0" +"southcarolina.museum\0lib.md.us\0" +"textile.museum\0" +"cheltenham.museum\0hurum.no\0" +"*.oita.jp\0" +"shop.ht\0cc.me.us\0" +"shop.hu\0turin.it\0" +"louvre.museum\0" +"k12.ar.us\0" +"consulting.aero\0" +"gv.ao\0" +"sauherad.no\0" +"gv.at\0net.ge\0" +"ostre-toten.no\0lib.ok.us\0" +"net.gg\0pilots.museum\0" +"2000.hu\0geology.museum\0" +"net.gn\0" +"mazowsze.pl\0bir.ru\0" +"net.gp\0" +"net.gr\0" +"oxford.museum\0" +"per.la\0" +"eastafrica.museum\0" +"meeres.museum\0" +"net.gy\0*.shizuoka.jp\0" +"\xe5\x95\x86\xe6\xa5\xad.tw\0" +"net.hk\0" +"net.hn\0" +"philadelphiaarea.museum\0" +"osen.no\0" +"net.ht\0net.id\0" +"fundacio.museum\0" +"j\xc3\xb8rpeland.no\0" +"\xe6\x95\x99\xe8\x82\xb2.hk\0" +"divtasvuodna.no\0" +"student.aero\0sch.gg\0net.im\0" +"\xe7\xbd\x91\xe7\xbb\x9c.cn\0net.in\0" +"net.iq\0" +"net.ir\0" +"net.is\0" +"net.je\0" +"kepno.pl\0lapy.pl\0" +"per.nf\0" +"gov\0*.shimane.jp\0" +"artcenter.museum\0" +"k\xc3\xa5""fjord.no\0" +"net.jo\0" +"eu.int\0" +"c.se\0" +"net.kg\0" +"ce.it\0net.ki\0" +"sch.id\0os.hedmark.no\0" +"columbus.museum\0" +"arteducation.museum\0" +"net.kn\0" +"kr.com\0" +"net.la\0bushey.museum\0cc.gu.us\0" +"net.lb\0" +"net.lc\0" +"gs.bu.no\0" +"e164.arpa\0" +"chieti.it\0labour.museum\0" +"sch.ir\0creation.museum\0krodsherad.no\0" +"net.ky\0" +"net.kz\0me.us\0" +"e.bg\0sch.je\0net.lk\0" +"zlg.br\0suwalki.pl\0" +"\xe5\x80\x8b\xe4\xba\xba.hk\0net.ma\0" +"net.lr\0" +"sch.jo\0notaires.km\0net.me\0" +"net.lv\0karate.museum\0" +"net.ly\0karm\xc3\xb8y.no\0" +"rg.it\0" +"net.mk\0" +"net.ml\0evenes.no\0" +"ngo.lk\0net.mo\0egyptian.museum\0" +"marine.ru\0" +"realestate.pl\0" +"net.mu\0" +"net.mv\0net.nf\0" +"net.mw\0net.ng\0gda.pl\0" +"net.mx\0" +"freemasonry.museum\0net.my\0enebakk.no\0" +"karlsoy.no\0" +"\xe7\xbd\x91\xe7\xbb\x9c.hk\0\xc3\xb8rskog.no\0" +"randaberg.no\0" +"club.aero\0" +"certification.aero\0sr.it\0" +"center.museum\0so.gov.pl\0" +"caa.aero\0" +"sch.lk\0tvedestrand.no\0" +"net.nr\0" +"luroy.no\0" +"aukra.no\0s\xc3\xa1lat.no\0lib.me.us\0" +"ddr.museum\0" +"york.museum\0stryn.no\0k12.nm.us\0" +"per.sg\0" +"judaica.museum\0" +"verona.it\0" +"agdenes.no\0" +"cng.br\0sch.ly\0" +"net.pa\0" +"author.aero\0" +"naturalhistory.museum\0steiermark.museum\0bu.no\0" +"sn\xc3\xa5sa.no\0net.pe\0" +"net.ph\0" +"savannahga.museum\0batsfjord.no\0lib.oh.us\0" +"net.pk\0" +"net.pl\0" +"net.pn\0" +"washingtondc.museum\0" +"net.pr\0" +"net.ps\0" +"net.pt\0" +"nordkapp.no\0" +"emergency.aero\0krokstadelva.no\0" +"satx.museum\0ngo.ph\0omsk.ru\0" +"texas.museum\0" +"ngo.pl\0" +"mantova.it\0gu.us\0" +"!pref.shiga.jp\0isa.us\0" +"usa.museum\0" +"gb.net\0k12.vi\0" +"iveland.no\0" +"tempio-olbia.it\0" +"net.sa\0" +"net.sb\0" +"works.aero\0net.sc\0komvux.se\0" +"net.sd\0" +"net.ru\0" +"0.bg\0" +"forlicesena.it\0net.rw\0net.sg\0" +"klodzko.pl\0" +"detroit.museum\0wegrow.pl\0" +"net.sl\0" +"glogow.pl\0" +"store.bb\0air.museum\0" +"net.so\0" +"katowice.pl\0" +"nsk.ru\0" +"pisa.it\0eid.no\0" +"net.st\0" +"film.hu\0" +"tuva.ru\0d.se\0" +"net.th\0" +"net.sy\0" +"viterbo.it\0tsaritsyn.ru\0perso.sn\0net.tj\0" +"lib.gu.us\0" +"plc.co.im\0sec.ps\0" +"r\xc3\xa1hkker\xc3\xa1vju.no\0kazimierz-dolny.pl\0net.tn\0" +"net.to\0" +"veterinaire.km\0" +"net.ua\0" +"info.ht\0net.tt\0" +"info.hu\0" +"exchange.aero\0" +"sch.sa\0net.tw\0" +"andriatranibarletta.it\0perso.tn\0" +"f.bg\0malselv.no\0" +"net.vc\0" +"trana.no\0" +"ns.ca\0" +"net.vi\0" +"lucca.it\0oristano.it\0" +"usarts.museum\0net.vn\0" +"gon.pk\0" +"pl.ua\0" +"eastcoast.museum\0" +"novara.it\0" +"k12.ks.us\0" +"dp.ua\0" +"nesseby.no\0" +"!pref.wakayama.jp\0" +"repbody.aero\0" +"jamison.museum\0lugansk.ua\0" +"ss.it\0" +"alessandria.it\0" +"hadsel.no\0net.ws\0" +"\xe0\xae\x9a\xe0\xae\xbf\xe0\xae\x99\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x82\xe0\xae\xb0\xe0\xaf\x8d\0" +"veterinaire.fr\0leirfjord.no\0" +"massacarrara.it\0north.museum\0" +"project.museum\0" +"other.nf\0" +"k12.nh.us\0" +"mat.br\0artgallery.museum\0" +"sr.gov.pl\0" +"gamvik.no\0" +"info.ec\0lancashire.museum\0" +"fm.br\0ltd.co.im\0" +"americana.museum\0southwest.museum\0cc.ak.us\0" +"enna.it\0lunner.no\0" +"v\xc3\xa5gan.no\0" +"mari.ru\0" +"accident-investigation.aero\0" +"sor-aurdal.no\0lib.ny.us\0" +"novosibirsk.ru\0" +"bjugn.no\0" +"n\xc3\xa6r\xc3\xb8y.no\0ostrowwlkp.pl\0" +"info.bb\0foundation.museum\0" +"brand.se\0" +"info.at\0!pref.akita.jp\0l\xc3\xb8ten.no\0" +"coal.museum\0miners.museum\0" +"glass.museum\0" +"info.az\0" +"frog.museum\0szczytno.pl\0nov.ru\0" +"sunndal.no\0" +"gen.in\0" +"gx.cn\0" +"web.co\0*.mie.jp\0hobol.no\0\xe5\x8f\xb0\xe6\xb9\xbe\0" +"logistics.aero\0plo.ps\0" +"erotika.hu\0" +"torsken.no\0" +"exeter.museum\0" +"info.co\0" +"selje.no\0" +"storfjord.no\0" +"barum.no\0lind\xc3\xa5s.no\0" +"leasing.aero\0" +"championship.aero\0fst.br\0" +"lierne.no\0" +"!gobiernoelectronico.ar\0""1.bg\0" +"corporation.museum\0" +"al.it\0*.miyagi.jp\0" +"*.aomori.jp\0" +"\xd8\xa7\xd9\x84\xd8\xa7\xd8\xb1\xd8\xaf\xd9\x86\0" +"amursk.ru\0" +"vestvagoy.no\0" +"\xd8\xa7\xdb\x8c\xd8\xb1\xd8\xa7\xd9\x86.ir\0cc.fl.us\0" +"os.hordaland.no\0" +"pistoia.it\0" +"tver.ru\0e.se\0" +"res.in\0*.yamagata.jp\0syzran.ru\0" +"capebreton.museum\0sandnessj\xc3\xb8""en.no\0" +"ternopil.ua\0" +"shop.pl\0" +"tank.museum\0" +"m\xc3\xa5s\xc3\xb8y.no\0" +"potenza.it\0time.museum\0" +"mjondalen.no\0" +"eng.br\0nedre-eiker.no\0" +"air-surveillance.aero\0" +"nt.au\0am.br\0pn.it\0" +"oystre-slidre.no\0ug.gov.pl\0" +"g.bg\0nesodden.no\0vologda.ru\0" +"parma.it\0tula.ru\0" +"*.nara.jp\0ak.us\0" +"nt.ca\0konin.pl\0" +"kiev.ua\0" +"skierv\xc3\xa1.no\0vestre-toten.no\0" +"ri.it\0botanical.museum\0farsund.no\0veg\xc3\xa5rshei.no\0dagestan.ru\0" +"ind.br\0k-uralsk.ru\0" +"rahkkeravju.no\0cmw.ru\0" +"canada.museum\0" +"fm.it\0" +"cc.wi.us\0" +"web.id\0aver\xc3\xb8y.no\0" +"dudinka.ru\0" +"baghdad.museum\0fitjar.no\0grane.no\0" +"gs.fm.no\0" +"sumy.ua\0" +"al.no\0" +"westfalen.museum\0" +"oregon.museum\0" +"bruxelles.museum\0elk.pl\0" +"planetarium.museum\0sn\xc3\xa5""ase.no\0" +"s\xc3\xb8rreisa.no\0" +"gs.st.no\0skien.no\0" +"bible.museum\0ivanovo.ru\0" +"avellino.it\0" +"tgory.pl\0" +"family.museum\0" +"ppg.br\0k12.as.us\0" +"trader.aero\0gorlice.pl\0" +"cc.al.us\0" +"ogliastra.it\0" +"is.it\0lib.nv.us\0" +"dr.na\0" +"media.hu\0nesna.no\0fl.us\0" +"uri.arpa\0" +"bjerkreim.no\0" +"charter.aero\0" +"genova.it\0" +"it.ao\0botany.museum\0hapmir.no\0" +"educational.museum\0" +"helsinki.museum\0" +"memorial.museum\0" +"web.lk\0pharmacy.museum\0" +"aircraft.aero\0appspot.com\0" +"ferrara.it\0beskidy.pl\0" +"hi.cn\0" +"taxi.aero\0flekkefjord.no\0" +"varoy.no\0" +"ragusa.it\0ambulance.museum\0" +"can.museum\0" +"*.osaka.jp\0isleofman.museum\0fm.no\0warmia.pl\0" +"educator.aero\0asmatart.museum\0" +"mi.it\0" +"kutno.pl\0" +"skedsmokorset.no\0" +"2.bg\0" +"*.kagoshima.jp\0km.ua\0" +"!city.sendai.jp\0" +"web.nf\0st.no\0cc.ri.us\0" +"reggiocalabria.it\0" +"wi.us\0" +"ancona.it\0newjersey.museum\0nnov.ru\0" +"f.se\0" +"ind.in\0" +"info.vn\0" +"andoy.no\0" +"ch.it\0fredrikstad.no\0guovdageaidnu.no\0" +"fjaler.no\0" +"sa.com\0" +"gs.nt.no\0" +"masfjorden.no\0" +"pordenone.it\0" +"po.it\0basel.museum\0" +"chambagri.fr\0" +"h.bg\0web.pk\0" +"london.museum\0" +"sciencecenter.museum\0\xe0\xb9\x84\xe0\xb8\x97\xe0\xb8\xa2\0" +"unbi.ba\0augustow.pl\0" +"wolomin.pl\0" +"notaires.fr\0tcm.museum\0al.us\0" +"nu.ca\0!pref.nagano.jp\0" +"info.tn\0" +"lib.wa.us\0" +"ed.ao\0info.tt\0" +"barreau.bj\0" +"k12.wy.us\0" +"pp.az\0gop.pk\0" +"int\0" +"l\xc3\xb8renskog.no\0podhale.pl\0" +"voagat.no\0" +"telekommunikation.museum\0" +"qld.au\0" +"te.it\0freiburg.museum\0snasa.no\0" +"gjemnes.no\0" +"sejny.pl\0" +"media.pl\0" +"skjak.no\0" +"watchandclock.museum\0" +"ed.ci\0pacific.museum\0" +"theater.museum\0info.ro\0" +"uk.com\0" +"campobasso.it\0aquarium.museum\0tysv\xc3\xa6r.no\0" +"kragero.no\0" +"windmill.museum\0info.sd\0" +"sologne.museum\0sande.m\xc3\xb8re-og-romsdal.no\0" +"nt.no\0cc.mi.us\0" +"ed.cr\0" +"academy.museum\0zachpomor.pl\0" +"tananger.no\0v\xc3\xa1rgg\xc3\xa1t.no\0ri.us\0" +"federation.aero\0" +"web.tj\0" +"matta-varjjat.no\0" +"steigen.no\0" +"local\0akrehamn.no\0" +"!pref.chiba.jp\0info.pk\0" +"info.pl\0""6bone.pl\0" +"klepp.no\0kherson.ua\0" +"ketrzyn.pl\0info.pr\0" +"sweden.museum\0" +"lardal.no\0" +"!retina.ar\0gz.cn\0" +"barletta-trani-andria.it\0vikna.no\0" +"bearalv\xc3\xa1hki.no\0" +"broker.aero\0gov.nc.tr\0" +"info.na\0k12.fl.us\0" +"hembygdsforbund.museum\0" +"entertainment.aero\0jerusalem.museum\0l\xc3\xa6rdal.no\0" +"hitra.no\0sogndal.no\0" +"farmequipment.museum\0info.mv\0info.nf\0\xc3\xa5lg\xc3\xa5rd.no\0" +"la-spezia.it\0" +"skanland.no\0fam.pk\0" +"skole.museum\0" +"art.museum\0" +"presidio.museum\0" +"3.bg\0public.museum\0" +"h\xc3\xb8yanger.no\0zagan.pl\0" +"an.it\0" +"philadelphia.museum\0info.nr\0" +"pesarourbino.it\0g\xc3\xa1ivuotna.no\0" +"poltava.ua\0" +"nt.ro\0" +"station.museum\0" +"mi.th\0" +"altoadige.it\0" +"nu.it\0" +"usculture.museum\0g.se\0" +"h\xc3\xa1mm\xc3\xa1rfeasta.no\0" +"daegu.kr\0info.la\0" +"dovre.no\0" +"ci.it\0horology.museum\0" +"bergbau.museum\0" +"press.museum\0" +"gangwon.kr\0" +"!city.kitakyushu.jp\0sor-varanger.no\0cc.hi.us\0" +"fuossko.no\0" +"zp.ua\0" +"american.museum\0" +"fl\xc3\xa5.no\0mi.us\0" +"i.bg\0" +"od.ua\0" +"encyclopedic.museum\0" +"ind.tn\0" +"midatlantic.museum\0" +"newyork.museum\0" +"castres.museum\0" +"act.edu.au\0" +"topology.museum\0" +"ed.jp\0" +"of.by\0" +"iris.arpa\0inf.br\0askim.no\0pyatigorsk.ru\0" +"nord-fron.no\0nsn.us\0" +"beardu.no\0" +"agrar.hu\0corvette.museum\0chtr.k12.ma.us\0" +"figueres.museum\0" +"!pref.gunma.jp\0medizinhistorisches.museum\0" +"tjeldsund.no\0" +"nebraska.museum\0" +"bellevue.museum\0" +"abo.pa\0k12.al.us\0" +"info.ki\0" +"inf.cu\0sv.it\0" +"jfk.museum\0" +"!city.osaka.jp\0swinoujscie.pl\0" +"bydgoszcz.pl\0" +"!city.kyoto.jp\0" +"uvic.museum\0" +"madrid.museum\0steinkjer.no\0" +"lib.ma.us\0" +"sirdal.no\0" +"n\xc3\xb8tter\xc3\xb8y.no\0" +"taranto.it\0starnberg.museum\0" +"vic.gov.au\0pvt.ge\0pors\xc3\xa1\xc5\x8bgu.no\0" +"naroy.no\0ris\xc3\xb8r.no\0" +"va.it\0salem.museum\0starachowice.pl\0" +"!nawrastelecom.om\0" +"town.museum\0te.ua\0" +"se.net\0" +"kemerovo.ru\0" +"lerdal.no\0" +"gs.va.no\0" +"kms.ru\0" +"consulado.st\0" +"haram.no\0" +"tysnes.no\0" +"!pref.ibaraki.jp\0hamburg.museum\0" +"\xc3\xa5rdal.no\0" +"airline.aero\0" +"crew.aero\0newhampshire.museum\0" +"muenster.museum\0" +"aerodrome.aero\0" +"heroy.nordland.no\0belau.pw\0" +"kamchatka.ru\0" +"b\xc3\xa5""d\xc3\xa5""ddj\xc3\xa5.no\0lillehammer.no\0hi.us\0" +"hk.cn\0" +"!city.kobe.jp\0berlevag.no\0" +"ardal.no\0" +"askoy.no\0" +"vardo.no\0" +"fyresdal.no\0" +"sassari.it\0" +"video.hu\0drammen.no\0" +"lyngen.no\0nakhodka.ru\0" +"ip6.arpa\0games.hu\0" +"online.museum\0" +"k12.sd.us\0" +"4.bg\0sebastopol.ua\0" +"ao.it\0atlanta.museum\0" +"lebork.pl\0" +"ravenna.it\0" +"railway.museum\0songdalen.no\0" +"!pref.shimane.jp\0delaware.museum\0ed.pw\0" +"f\xc3\xb8rde.no\0" +"living.museum\0" +"juif.museum\0" +"lomza.pl\0" +"h.se\0" +"!bl.uk\0" +"portland.museum\0\xe7\xb5\x84\xe7\xb9\x94.tw\0" +"stj\xc3\xb8rdal.no\0" +"lecce.it\0" +"bz.it\0" +"farmstead.museum\0va.no\0" +"express.aero\0!nacion.ar\0" +"presse.km\0gs.of.no\0" +"\xe5\x8f\xb0\xe7\x81\xa3\0" +"og.ao\0gyeongbuk.kr\0vestv\xc3\xa5g\xc3\xb8y.no\0" +"prd.fr\0" +"pp.ru\0pp.se\0" +"forum.hu\0!pref.saga.jp\0" +"kvalsund.no\0" +"!city.kawasaki.jp\0n\xc3\xa5\xc3\xa5mesjevuemie.no\0" +"j.bg\0" +"vlaanderen.museum\0" +"cc.va.us\0" +"\xd8\xa7\xd9\x8a\xd8\xb1\xd8\xa7\xd9\x86.ir\0alabama.museum\0" +"school.museum\0her\xc3\xb8y.m\xc3\xb8re-og-romsdal.no\0" +"\xc3\xa5seral.no\0" +"traniandriabarletta.it\0" +"flog.br\0" +"presse.ml\0" +"k\xc3\xa1r\xc3\xa1\xc5\xa1johka.no\0" +"historisch.museum\0" +"farm.museum\0palmsprings.museum\0oslo.no\0dyroy.no\0stranda.no\0" +"gs.rl.no\0r\xc3\xa5""de.no\0" +"bomlo.no\0s\xc3\xb8rum.no\0" +"jan-mayen.no\0ivgu.no\0" +"coop\0" +"agr.br\0k12.ak.us\0" +"!nic.ar\0catanzaro.it\0fusa.no\0" +"hu.com\0" +"inf.mk\0" +"vet.br\0" +"k12.mt.us\0k12.nd.us\0" +"vlog.br\0\xe5\x85\xac\xe5\x8f\xb8.cn\0sandnessjoen.no\0" +"lib.az.us\0" +"nsw.edu.au\0of.no\0\xc3\xb8stre-toten.no\0" +"*.okinawa.jp\0" +"vb.it\0" +"asso.fr\0firenze.it\0" +"trieste.it\0" +"\xe5\x85\xac\xe5\x8f\xb8.hk\0" +"museet.museum\0" +"prd.km\0" +"navuotna.no\0lib.ca.us\0" +"cc.nv.us\0" +"asso.gp\0" +"meraker.no\0" +"h\xc3\xa1pmir.no\0" +"i.ph\0" +"sx.cn\0jeonnam.kr\0" +"halden.no\0" +"fed.us\0" +"medio-campidano.it\0tsk.ru\0" +"barcelona.museum\0" +"giessen.museum\0roma.museum\0" +"hl.cn\0" +"\xe0\xae\x87\xe0\xae\xb2\xe0\xae\x99\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88\0" +"biz.bb\0benevento.it\0rl.no\0bygland.no\0" +"port.fr\0asso.ht\0prd.mg\0" +"biz.at\0" +"tra.kp\0" +"*.aichi.jp\0khabarovsk.ru\0" +"campidano-medio.it\0" +"biz.az\0" +"newmexico.museum\0va.us\0" +"finearts.museum\0" +"murmansk.ru\0" +"\xc3\xb8rsta.no\0radom.pl\0k12.sc.us\0" +"5.bg\0kvinesdal.no\0" +"ap.it\0" +"*.fukushima.jp\0" +"asso.bj\0" +"mad.museum\0" +"lebesby.no\0" +"og.it\0glas.museum\0sauda.no\0" +"i.se\0" +"k12.tx.us\0" +"asso.ci\0mk.ua\0" +"cesena-forli.it\0" +"lowicz.pl\0" +"k12.id.us\0" +"tas.gov.au\0" +"lukow.pl\0" +"utazas.hu\0" +"maritimo.museum\0bjark\xc3\xb8y.no\0" +"adm.br\0" +"pr.it\0lib.vi.us\0" +"bergamo.it\0k12.va.us\0" +"k.bg\0" +"railroad.museum\0" +"!british-library.uk\0" +"cincinnati.museum\0" +"sorreisa.no\0" +"asso.dz\0!nel.uk\0" +"rm.it\0" +"nv.us\0" +"nx.cn\0gos.pk\0" +"vic.edu.au\0" +"biella.it\0tjome.no\0" +"r\xc3\xb8yken.no\0" +"beiarn.no\0" +"qc.ca\0" +"georgia.museum\0square.museum\0" +"labor.museum\0omasvuotna.no\0cc.la.us\0" +"br.com\0reggioemilia.it\0" +"kristiansund.no\0" +"sorum.no\0" +"orsta.no\0" +"furniture.museum\0surrey.museum\0eng.pro\0" +"asn.lv\0balat.no\0" +"lavangen.no\0sld.pa\0" +"fla.no\0k12.ms.us\0k12.nc.us\0" +"bardu.no\0" +"donostia.museum\0" +"club.tw\0" +"elburg.museum\0" +"gs.hl.no\0lodingen.no\0" +"samara.ru\0" +"vc.it\0*.nagasaki.jp\0" +"fosnes.no\0" +"fuel.aero\0" +"qc.com\0" +"skjervoy.no\0" +"bill.museum\0kv\xc3\xa6""fjord.no\0" +"skydiving.aero\0*.tokushima.jp\0" +"!congresodelalengua3.ar\0laquila.it\0k12.ct.us\0" +"gorge.museum\0linz.museum\0sherbrooke.museum\0" +"tranoy.no\0ing.pa\0" +"ptz.ru\0" +"kr.it\0prato.it\0stat.no\0" +"\xd0\xb8\xd0\xba\xd0\xbe\xd0\xbc.museum\0" +"cosenza.it\0" +"stj\xc3\xb8rdalshalsen.no\0" +"finland.museum\0leka.no\0cc.pr.us\0" +"historichouses.museum\0s\xc3\xa1l\xc3\xa1t.no\0" +"venice.it\0" +"biz.ki\0" +"g\xc3\xa1ls\xc3\xa1.no\0" +"\xe7\xbb\x84\xe7\xbb\x87.hk\0" +"*.yamanashi.jp\0" +"rad\xc3\xb8y.no\0" +"6.bg\0" +"fareast.ru\0" +"paragliding.aero\0ba.it\0aq.it\0" +"sk\xc3\xa5nland.no\0" +"its.me\0" +"us.na\0" +"hl.no\0cc.ga.us\0" +"ac\0granvin.no\0" +"ad\0qld.edu.au\0!city.sapporo.jp\0" +"ae\0" +"af\0" +"ag\0crotone.it\0" +"dallas.museum\0" +"ai\0brussels.museum\0" +"dali.museum\0" +"la.us\0" +"al\0salzburg.museum\0" +"am\0" +"an\0cl.it\0" +"ao\0" +"aq\0ba\0" +"bb\0" +"as\0lajolla.museum\0" +"at\0" +"be\0" +"bf\0inderoy.no\0snz.ru\0" +"aw\0bg\0" +"ax\0bh\0cim.br\0ltd.gi\0biz.mv\0" +"bi\0xz.cn\0\xe7\xb5\x84\xe7\xb9\x94.hk\0biz.mw\0" +"az\0bj\0" +"bm\0tranibarlettaandria.it\0naamesjevuemie.no\0" +"chattanooga.museum\0" +"bo\0" +"l.bg\0" +"ca\0" +"br\0stateofdelaware.museum\0" +"bs\0cc\0" +"cd\0biz.nr\0" +"cf\0berlev\xc3\xa5g.no\0" +"bw\0cg\0snaase.no\0" +"ch\0harvestcelebration.museum\0ck.ua\0" +"by\0ci\0" +"bz\0bahccavuotna.no\0" +"cl\0yuzhno-sakhalinsk.ru\0" +"cm\0halsa.no\0lyngdal.no\0" +"cn\0" +"co\0rn.it\0childrens.museum\0frankfurt.museum\0" +"cr\0" +"pskov.ru\0" +"cu\0de\0" +"cv\0fr.it\0lib.ky.us\0" +"aseral.no\0kvam.no\0" +"cx\0hellas.museum\0" +"hof.no\0" +"cz\0dj\0k12.la.us\0" +"dk\0moscow.museum\0" +"sosnowiec.pl\0" +"dm\0biz.pk\0" +"schokoladen.museum\0biz.pl\0" +"far.br\0arna.no\0tynset.no\0" +"even\xc3\xa1\xc5\xa1\xc5\xa1i.no\0" +"ec\0" +"biz.pr\0" +"ee\0celtic.museum\0" +"scientist.aero\0modern.museum\0" +"pr.us\0" +"dz\0" +"mj\xc3\xb8ndalen.no\0s\xc3\xb8r-odal.no\0" +"!nic.tr\0" +"conference.aero\0vestnes.no\0k12.mn.us\0" +"!pref.hiroshima.jp\0" +"es\0trapani.it\0" +"fermo.it\0vard\xc3\xb8.no\0" +"eu\0gs.hm.no\0r\xc3\xb8""d\xc3\xb8y.no\0stordal.no\0" +"gc.ca\0!nhs.uk\0" +"jgora.pl\0" +"fi\0stjordal.no\0" +"fm\0!mediaphone.om\0" +"kirov.ru\0pvt.k12.ma.us\0" +"fo\0" +"ga\0hyllestad.no\0" +"gov.ac\0fr\0andriabarlettatrani.it\0ga.us\0" +"gov.ae\0gd\0estate.museum\0" +"gov.af\0ge\0tolga.no\0" +"gf\0asso.re\0cc.oh.us\0" +"gg\0florida.museum\0" +"presse.ci\0gh\0" +"gi\0k12.dc.us\0" +"ltd.lk\0orland.no\0" +"gov.al\0" +"gl\0tokke.no\0" +"hanggliding.aero\0gm\0" +"hareid.no\0" +"gov.ba\0tj.cn\0gp\0" +"gov.bb\0gq\0" +"gov.as\0gr\0agrigento.it\0lc.it\0" +"gs\0kalmykia.ru\0aero.tt\0" +"gov.bf\0" +"county.museum\0" +"gov.bh\0hn.cn\0gw\0" +"gov.az\0gy\0assn.lk\0guernsey.museum\0" +"hk\0" +"gov.bm\0h\xc3\xa6gebostad.no\0biz.tj\0" +"hm\0computer.museum\0" +"gov.bo\0hn\0kl\xc3\xa6""bu.no\0" +"pulawy.pl\0" +"gov.br\0" +"trd.br\0gov.bs\0hr\0reggio-calabria.it\0historyofscience.museum\0lipetsk.ru\0" +"gov.cd\0*.nagoya.jp\0" +"ht\0id\0spjelkavik.no\0" +"hu\0ie\0aero.mv\0" +"marketplace.aero\0mn.it\0biz.tt\0" +"gov.by\0saintlouis.museum\0mer\xc3\xa5ker.no\0" +"gov.bz\0" +"7.bg\0gov.cl\0virtual.museum\0" +"gov.cm\0vennesla.no\0kr.ua\0" +"gov.cn\0im\0ar.it\0galsa.no\0rovno.ua\0" +"gov.co\0in\0" +"io\0limanowa.pl\0" +"iq\0k12.ga.us\0" +"ir\0" +"riik.ee\0is\0\xc3\xa1laheadju.no\0" +"gov.cu\0it\0hawaii.museum\0seaport.museum\0" +"je\0pubol.museum\0hm.no\0" +"gov.cx\0" +"*.chiba.jp\0" +"*.kawasaki.jp\0" +"k.se\0" +"gov.dm\0" +"aland.fi\0vik.no\0" +"yk.ca\0jo\0kobierzyce.pl\0" +"jp\0biz.vn\0" +"presse.fr\0lib.il.us\0\xe9\xa6\x99\xe6\xb8\xaf\0" +"gov.ec\0" +"transport.museum\0bronnoy.no\0" +"slg.br\0gov.ee\0asso.nc\0bievat.no\0" +"nyny.museum\0" +"kg\0" +"mo-i-rana.no\0" +"gov.dz\0ki\0" +"monmouth.museum\0" +"suldal.no\0" +"bc.ca\0km\0zt.ua\0" +"pt.it\0kn\0" +"fineart.museum\0" +"la\0" +"kr\0gulen.no\0" +"m.bg\0mo.cn\0lc\0alaheadju.no\0g\xc3\xa1\xc5\x8bgaviika.no\0" +"nowaruda.pl\0cc.ut.us\0" +"br\xc3\xb8nn\xc3\xb8y.no\0" +"ky\0li\0overhalla.no\0" +"kz\0khv.ru\0" +"lk\0" +"artdeco.museum\0" +"ma\0fortworth.museum\0kostroma.ru\0" +"ro.it\0kirkenes.no\0vestby.no\0" +"urbino-pesaro.it\0ls\0mc\0alstahaug.no\0" +"blog.br\0gov.ge\0lt\0md\0" +"lu\0me\0botanicgarden.museum\0" +"gov.gg\0lv\0oh.us\0" +"gov.gh\0mg\0valley.museum\0" +"gov.gi\0mh\0" +"ly\0sandiego.museum\0" +"mk\0" +"ml\0" +"gov.gn\0rollag.no\0naklo.pl\0" +"mn\0" +"mo\0" +"mp\0leirvik.no\0" +"gov.gr\0mq\0na\0cc.ks.us\0" +"mr\0" +"ms\0nc\0" +"valer.hedmark.no\0" +"mu\0ne\0" +"mv\0nf\0" +"mw\0" +"mx\0nord-odal.no\0jur.pro\0" +"my\0" +"gov.hk\0name.hr\0" +"nl\0" +"astronomy.museum\0lib.nm.us\0" +"catania.it\0" +"no\0" +"skjerv\xc3\xb8y.no\0" +"k12.ne.us\0" +"monza-e-della-brianza.it\0!pref.fukushima.jp\0nr\0" +"gov.ie\0" +"stuttgart.museum\0nu\0cc.mn.us\0" +"karasjohka.no\0" +"engine.aero\0bearalvahki.no\0" +"oyer.no\0" +"ve.it\0" +"gov.im\0froland.no\0cc.ar.us\0" +"gov.in\0magadan.ru\0" +"pescara.it\0" +"gov.iq\0usdecorativearts.museum\0" +"gov.ir\0pa\0" +"gov.is\0" +"gov.it\0lavagis.no\0" +"gov.je\0" +"naustdal.no\0pe\0k12.or.us\0" +"gd.cn\0carraramassa.it\0pf\0" +"ph\0" +"cc.ny.us\0" +"rissa.no\0" +"info\0pk\0pomorze.pl\0" +"pl\0" +"gov.jo\0asso.km\0pn\0" +"*.okayama.jp\0cieszyn.pl\0" +"freight.aero\0" +"pr\0" +"narvik.no\0ps\0" +"!pref.aichi.jp\0elverum.no\0pt\0" +"edunet.tn\0" +"gov.kg\0" +"flatanger.no\0marker.no\0pw\0" +"gov.ki\0nuremberg.museum\0" +"aip.ee\0" +"gov.km\0" +"gov.kn\0" +"gov.kp\0" +"rieti.it\0gov.la\0bajddar.no\0" +"gov.lb\0aviation.museum\0" +"gov.lc\0" +"asso.mc\0" +"re\0" +"ut.us\0" +"sa.gov.au\0gov.ky\0" +"mo.it\0gov.kz\0" +"gov.lk\0" +"iraq.museum\0" +"badajoz.museum\0" +"8.bg\0inder\xc3\xb8y.no\0" +"monticello.museum\0ro\0ks.ua\0" +"gov.ma\0svizzera.museum\0" +"gov.lr\0sa\0" +"matera.it\0sb\0" +"gov.lt\0rs\0sc\0" +"gov.me\0sd\0" +"gov.lv\0ru\0se\0" +"gov.mg\0" +"rw\0sg\0" +"gov.ly\0assisi.museum\0kids.museum\0sh\0" +"si\0" +"gov.mk\0" +"gov.ml\0sk\0" +"sl\0" +"gov.mn\0airguard.museum\0sm\0" +"gov.mo\0l.se\0sn\0" +"so\0" +"gov.mr\0ks.us\0" +"name.az\0sr\0" +"naturhistorisches.museum\0tc\0" +"trainer.aero\0cn.it\0urbinopesaro.it\0gov.mu\0nativeamerican.museum\0st\0td\0" +"gov.mv\0su\0" +"trentino.it\0gov.mw\0gov.ng\0tf\0" +"tg\0" +"co.ae\0venezia.it\0gov.my\0th\0" +"!pref.ehime.jp\0sy\0" +"co.ag\0lewismiller.museum\0ostrowiec.pl\0sz\0tj\0" +"tk\0" +"motorcycle.museum\0tl\0" +"birdart.museum\0trogstad.no\0tm\0" +"tn\0" +"humanities.museum\0to\0" +"pu.it\0gov.nr\0ua\0lib.ut.us\0" +"co.ao\0" +"co.ba\0trondheim.no\0tt\0" +"in-addr.arpa\0tempioolbia.it\0!city.yokohama.jp\0mn.us\0" +"n.bg\0schoenbrunn.museum\0tv\0" +"co.at\0aremark.no\0tw\0ug\0" +"jus.br\0" +"co.bi\0bialowieza.pl\0ar.us\0" +"audnedaln.no\0kustanai.ru\0" +"va\0" +"us\0vc\0" +"newport.museum\0" +"kopervik.no\0gov.ph\0vg\0" +"ny.us\0vi\0" +"co.bw\0finn\xc3\xb8y.no\0gov.pk\0uz\0" +"honefoss.no\0gov.pl\0lanbib.se\0" +"co.ci\0" +"gov.pn\0intl.tn\0" +"act.gov.au\0vn\0" +"television.museum\0gov.pr\0" +"sykkylven.no\0v\xc3\xa5ler.hedmark.no\0gov.ps\0" +"gov.pt\0" +"co.cr\0vu\0" +"legnica.pl\0" +"sa.au\0" +"bjarkoy.no\0" +"openair.museum\0birkenes.no\0lib.nj.us\0" +"fylkesbibl.no\0holt\xc3\xa5len.no\0" +"iz.hr\0" +"ws\0" +"oceanographique.museum\0" +"b\xc3\xa1id\xc3\xa1r.no\0cc.mo.us\0" +"\xc3\xb8ygarden.no\0" +"contemporary.museum\0" +"gb.com\0cc.as.us\0" +"belluno.it\0gov.sa\0" +"gov.sb\0" +"gov.rs\0gov.sc\0" +"gov.sd\0" +"!pref.nagasaki.jp\0gov.ru\0" +"asia\0" +"sa.cr\0gov.rw\0gov.sg\0" +"kuzbass.ru\0" +"gs.vf.no\0" +"gov.sl\0" +"norfolk.museum\0" +"k12.de.us\0" +"mil\0" +"rendalen.no\0" +"gov.st\0" +"agro.pl\0" +"orkdal.no\0" +"le.it\0gov.sy\0" +"gov.tj\0" +"co.gg\0nore-og-uvdal.no\0v\xc3\xa5ler.\xc3\xb8stfold.no\0" +"gov.tl\0" +"gov.tn\0" +"gov.to\0" +"kids.us\0" +"equipment.aero\0gov.ua\0" +"!city.niigata.jp\0gov.tt\0" +"sel.no\0" +"l\xc3\xa4ns.museum\0" +"gov.tw\0" +"rennebu.no\0" +"egersund.no\0" +"medecin.km\0" +"co.gy\0" +"!mecon.ar\0" +"berlin.museum\0" +"carrara-massa.it\0" +"9.bg\0" +"pri.ee\0gov.vc\0" +"at.it\0" +"muosat.no\0" +"co.id\0" +"co.hu\0" +"etne.no\0" +"\xc3\xa1lt\xc3\xa1.no\0" +"gov.vn\0" +"modelling.aero\0" +"co.im\0" +"co.in\0\xc3\xa5krehamn.no\0m.se\0" +"gouv.fr\0*.kitakyushu.jp\0" +"narviika.no\0" +"rennes\xc3\xb8y.no\0" +"co.ir\0afjord.no\0" +"lea\xc5\x8bgaviika.no\0buryatia.ru\0" +"co.it\0coastaldefence.museum\0" +"co.je\0vf.no\0" +"osteroy.no\0" +"uslivinghistory.museum\0" +"aerobatic.aero\0" +"mesaverde.museum\0mining.museum\0" +"a\xc3\xa9roport.ci\0gov.ws\0" +"co.jp\0copenhagen.museum\0" +"pv.it\0" +"r\xc3\xb8mskog.no\0" +"vossevangen.no\0porsanger.no\0" +"salat.no\0mo.us\0" +"o.bg\0imperia.it\0carrier.museum\0" +"carbonia-iglesias.it\0" +"as.us\0" +"alvdal.no\0" +"state.museum\0mandal.no\0cn.ua\0" +"cuneo.it\0" +"gouv.ht\0" +"!city.okayama.jp\0co.kr\0" +"co.lc\0" +"sa.it\0" +"donna.no\0" +"sortland.no\0" +"tomsk.ru\0" +"birthplace.museum\0l\xc3\xb8""dingen.no\0" +"ge.it\0orenburg.ru\0" +"cn.com\0" +"co.ma\0" +"co.ls\0skaun.no\0name.vn\0" +"navigation.aero\0" +"cagliari.it\0co.me\0portal.museum\0" +"gouv.bj\0" +"udine.it\0" +"engineer.aero\0" +"szczecin.pl\0" +"wales.museum\0" +"co.na\0bo.telemark.no\0" +"austin.museum\0" +"k12.mo.us\0" +"co.mu\0" +"gouv.ci\0" +"co.mw\0" +"esp.br\0" +"naturalhistorymuseum.museum\0" +"mosjoen.no\0" +"solund.no\0" +"name.tj\0" +"sand\xc3\xb8y.no\0" +"kunstunddesign.museum\0" +"cartoonart.museum\0collection.museum\0gsm.pl\0" +"aure.no\0" +"!pref.yamaguchi.jp\0historical.museum\0" +"name.tt\0" +"england.museum\0valle.no\0" +"cc.ok.us\0" +"salangen.no\0" +"gloppen.no\0" +"cc.co.us\0" +"contemporaryart.museum\0" +"tas.edu.au\0" +"trading.aero\0" +"mazury.pl\0" +"!pref.aomori.jp\0co.pl\0" +"opoczno.pl\0" +"*.kobe.jp\0co.pn\0" +"oppegard.no\0" +"co.pw\0" +"saltdal.no\0smolensk.ru\0" +"na.it\0\xc4\x8d\xc3\xa1hcesuolo.no\0" +"vgs.no\0evenassi.no\0" +"parachuting.aero\0jl.cn\0maritime.museum\0bd.se\0" +"badaddja.no\0" +"bergen.no\0" +"brussel.museum\0" +"avoues.fr\0" +"cesenaforli.it\0" +"oregontrail.museum\0" +"ullensaker.no\0" +"jobs\0" +"accident-prevention.aero\0" +"n.se\0" +"association.museum\0california.museum\0" +"cultural.museum\0co.rs\0" +"zoology.museum\0" +"pruszkow.pl\0" +"control.aero\0nt.edu.au\0net\0komforb.se\0" +"lincoln.museum\0aurland.no\0name.pr\0co.rw\0" +"ostroleka.pl\0" +"isernia.it\0" +"tm.fr\0" +"gs.ol.no\0" +"nb.ca\0marnardal.no\0" +"williamsburg.museum\0" +"!jet.uk\0" +"suisse.museum\0\xc3\xa5""fjord.no\0flakstad.no\0" +"karmoy.no\0" +"yn.cn\0chesapeakebay.museum\0" +"nsw.au\0" +"amur.ru\0co.st\0" +"imb.br\0siellak.no\0\xe7\xb6\xb2\xe8\xb7\xaf.tw\0" +"name.na\0" +"co.th\0" +"p.bg\0" +"co.sz\0co.tj\0" +"name.mv\0\xc3\xa5lesund.no\0lib.in.us\0" +"lucerne.museum\0naumburg.museum\0" +"society.museum\0name.my\0" +"tinn.no\0" +"co.tt\0" +"unj\xc3\xa1rga.no\0" +"co.ug\0" +"lib.wy.us\0" +"co.tz\0" +"ass.km\0" +"ok.us\0" +"tm.hu\0kongsvinger.no\0" +"ibestad.no\0" +"juedisches.museum\0co.us\0" +"cq.cn\0" +"rs.ba\0" +"wa.edu.au\0co.vi\0" +"co.uz\0" +"health.museum\0" +"grue.no\0" +"automotive.museum\0journalism.museum\0settlement.museum\0" +"qh.cn\0interactive.museum\0" +"snillfjord.no\0!national-library-scotland.uk\0" +"balsfjord.no\0lib.nh.us\0" +"kolobrzeg.pl\0" +"gs.tm.no\0" +"h\xc3\xb8nefoss.no\0" +"ol.no\0" +"music.museum\0moareke.no\0" +"b\xc3\xb8.nordland.no\0" +"name.mk\0lier.no\0" +"eidfjord.no\0" +"sc.cn\0tm.km\0" +"jelenia-gora.pl\0sanok.pl\0" +"intelligence.museum\0" +"srv.br\0elblag.pl\0" +"judygarland.museum\0" +"padua.it\0" +"k12.co.us\0" +"lindesnes.no\0" +"name.jo\0izhevsk.ru\0" +"yorkshire.museum\0mel\xc3\xb8y.no\0" +"tm.mc\0lib.pr.us\0" +"hjartdal.no\0" +"tm.mg\0" +"bari.it\0milano.it\0" +"lg.jp\0" +"zgrad.ru\0" +"sm\xc3\xb8la.no\0" +"communications.museum\0" +"arts.co\0seoul.kr\0engerdal.no\0" +"oster\xc3\xb8y.no\0" +"\xe6\x95\x8e\xe8\x82\xb2.hk\0foggia.it\0verran.no\0" +"orskog.no\0voronezh.ru\0kv.ua\0" +"av.it\0" +"tm.no\0nissedal.no\0" +"historisches.museum\0gs.mr.no\0" +"medecin.fr\0" +"montreal.museum\0" +"o.se\0" +"!metro.tokyo.jp\0sola.no\0" +"k12.tn.us\0" +"floro.no\0" +"milan.it\0*.shiga.jp\0" +"berkeley.museum\0" +"maintenance.aero\0" +"ws.na\0" +"lindas.no\0cc.ia.us\0" +"brescia.it\0embroidery.museum\0" +"arezzo.it\0tm.pl\0" +"r\xc3\xa6lingen.no\0" +"burghof.museum\0" +"rec.br\0" +"q.bg\0" +"!nawras.om\0" +"hammarfeasta.no\0" +"moss.no\0" +"on.ca\0" +"gouv.rw\0" +"luxembourg.museum\0" +"rec.co\0british.museum\0" +"reggio-emilia.it\0" +"gouv.sn\0lib.wv.us\0" +"avocat.fr\0" +"simbirsk.ru\0" +"jar.ru\0" +"monza-brianza.it\0" +"tm.ro\0" +"imageandsound.museum\0" +"jpn.com\0mr.no\0" +"siracusa.it\0" +"norilsk.ru\0tm.se\0" +"tn.it\0" +"jeju.kr\0" +"!pref.fukuoka.jp\0" +"*.hyogo.jp\0portlligat.museum\0" +"!pref.osaka.jp\0" +"siena.it\0sc.kr\0omaha.museum\0saskatchewan.museum\0" +"phoenix.museum\0vanylven.no\0" +"botanicalgarden.museum\0" +"turek.pl\0" +"vagsoy.no\0" +"riodejaneiro.museum\0" +"vi.it\0" +"uy.com\0" +"kristiansand.no\0" +"sd.cn\0trento.it\0" +"muncie.museum\0" +"berg.no\0meldal.no\0" +"nes.buskerud.no\0" +"saratov.ru\0" +"gs.oslo.no\0" +"harstad.no\0vaga.no\0" +"research.museum\0" +"brunel.museum\0ia.us\0" +"test.tj\0" +"columbia.museum\0" +"ms.it\0stockholm.museum\0" +"reklam.hu\0" +"pomorskie.pl\0lg.ua\0" +"bg.it\0historicalsociety.museum\0rns.tn\0" +"mallorca.museum\0surgut.ru\0cc.sc.us\0" +"ushistory.museum\0" +"palana.ru\0" +"snoasa.no\0" +"naturalsciences.museum\0" +"yaroslavl.ru\0" +"unjarga.no\0" +"p.se\0" +"ingatlan.hu\0" +"irc.pl\0" +"savona.it\0" +"cr.it\0" +"test.ru\0cc.tn.us\0" +"ms.kr\0museumvereniging.museum\0" +"time.no\0k12.ia.us\0" +"vladimir.ru\0" +"correios-e-telecomunica\xc3\xa7\xc3\xb5""es.museum\0" +"gouv.km\0nationalfirearms.museum\0" +"m\xc3\xa1latvuopmi.no\0" +"aero\0yosemite.museum\0" +"r.bg\0school.na\0" +"cc.vi.us\0" +"*.wakayama.jp\0" +"beauxarts.museum\0averoy.no\0ullensvang.no\0bar.pro\0" +"!city.hiroshima.jp\0" +"b\xc3\xa1hccavuotna.no\0" +"frosta.no\0" +"gdynia.pl\0" +"medical.museum\0" +"embaixada.st\0" +"balsan.it\0vantaa.museum\0" +"za.net\0" +"!city.saitama.jp\0lib.ks.us\0" +"fnd.br\0" +"ru.com\0se.com\0hol.no\0modalen.no\0" +"gouv.ml\0chukotka.ru\0" +"malopolska.pl\0" +"mansion.museum\0" +"iki.fi\0children.museum\0" +"cyber.museum\0rec.nf\0mo\xc3\xa5reke.no\0" +"to.it\0" +"hasvik.no\0" +"\xc3\xb8yer.no\0" +"arts.ro\0sc.ug\0" +"lib.ar.us\0" +"sc.tz\0cc.ms.us\0cc.nc.us\0" +"etc.br\0poznan.pl\0" +"cnt.br\0viking.museum\0" +"*.miyazaki.jp\0" +"melhus.no\0" +"skodje.no\0vevelstad.no\0" +"sc.us\0" +"upow.gov.pl\0" +"!city.fukuoka.jp\0brandywinevalley.museum\0natuurwetenschappen.museum\0tranby.no\0" +"bahn.museum\0msk.ru\0" +"delmenhorst.museum\0" +"russia.museum\0fuoisku.no\0" +"shell.museum\0" +"r\xc3\xa1isa.no\0" +"hs.kr\0udmurtia.ru\0" +"palermo.it\0" +"pilot.aero\0" +"tn.us\0" +"priv.hu\0" +"li.it\0" +"kr\xc3\xa5""anghke.no\0mosreg.ru\0" +"lib.fl.us\0" +"plants.museum\0" +"ulsan.kr\0national.museum\0" +"mil.ac\0!pref.nara.jp\0surgeonshall.museum\0" +"mil.ae\0santacruz.museum\0vi.us\0" +"wlocl.pl\0" +"mt.it\0napoli.it\0alaska.museum\0arts.nf\0" +"missoula.museum\0" +"rec.ro\0" +"mil.al\0" +"marburg.museum\0waw.pl\0" +"pharmaciens.km\0indianapolis.museum\0larsson.museum\0" +"cc.sd.us\0" +"mil.ba\0mobi\0" +"indianmarket.museum\0" +"recreation.aero\0padova.it\0" +"varese.it\0parti.se\0" +"mil.az\0" +"mil.bo\0!pref.kagoshima.jp\0khmelnitskiy.ua\0" +"rygge.no\0" +"os\xc3\xb8yro.no\0" +"mil.br\0" +"cs.it\0" +"austevoll.no\0fjell.no\0" +"mil.by\0" +"!pref.tokushima.jp\0org\0" +"mil.cn\0gs.svalbard.no\0" +"mil.co\0" +"pz.it\0lib.va.us\0\xd1\x80\xd1\x84\0" +"\xe4\xb8\xaa\xe4\xba\xba.hk\0ms.us\0nc.us\0k12.wi.us\0" +"s.bg\0drangedal.no\0" +"en.it\0" +"culturalcenter.museum\0" +"house.museum\0divttasvuotna.no\0" +"fhs.no\0" +"circus.museum\0" +"priv.at\0" +"mil.ec\0" +"ruovat.no\0" +"midsund.no\0vagan.no\0" +"casadelamoneda.museum\0" +"bristol.museum\0" +"and.museum\0" +"ascolipiceno.it\0computerhistory.museum\0vyatka.ru\0" +"uhren.museum\0" +"lahppi.no\0" +"*.yokohama.jp\0cody.museum\0lib.al.us\0" +"colonialwilliamsburg.museum\0indian.museum\0cc.ky.us\0" +"tp.it\0biev\xc3\xa1t.no\0" +"can.br\0royken.no\0" +"id.ir\0" +"mediocampidano.it\0tromso.no\0" +"kartuzy.pl\0k12.ok.us\0" +"*.saitama.jp\0stjohn.museum\0m\xc3\xa1tta-v\xc3\xa1rjjat.no\0" +"mil.ge\0trani-barletta-andria.it\0" +"lib.as.us\0" +"swiebodzin.pl\0cc.mt.us\0cc.nd.us\0" +"mil.gh\0" +"science-fiction.museum\0\xd9\x82\xd8\xb7\xd8\xb1\0" +"airtraffic.aero\0" +"konskowola.pl\0" +"scienceandhistory.museum\0nysa.pl\0sd.us\0" +"balestrand.no\0" +"oygarden.no\0" +"her\xc3\xb8y.nordland.no\0" +"!pref.ishikawa.jp\0strand.no\0" +"\xe7\xb5\x84\xe7\xbb\x87.hk\0mil.hn\0" +"gob.bo\0volda.no\0" +"losangeles.museum\0larvik.no\0" +"university.museum\0" +"cc.dc.us\0" +"mil.id\0" +"sorfold.no\0" +"watch-and-clock.museum\0" +"flor\xc3\xb8.no\0" +"nittedal.no\0oppeg\xc3\xa5rd.no\0" +"k12.ri.us\0" +"gob.cl\0" +"komi.ru\0" +"government.aero\0mil.in\0" +"mil.iq\0id.lv\0" +"culture.museum\0" +"id.ly\0" +"raholt.no\0" +"lubin.pl\0grozny.ru\0" +"kchr.ru\0" +"nikolaev.ua\0" +"lib.sd.us\0" +"de.com\0" +"mil.jo\0" +"*.kanagawa.jp\0gaular.no\0miasta.pl\0" +"bi.it\0rnu.tn\0uzhgorod.ua\0" +"idrett.no\0v\xc3\xa5gs\xc3\xb8y.no\0" +"wroclaw.pl\0" +"res.aero\0ne.jp\0mil.kg\0" +"\xc3\xa5mli.no\0" +"education.museum\0" +"dgca.aero\0" +"mil.km\0" +"trolley.museum\0" +"cci.fr\0r.se\0" +"archaeological.museum\0" +"monzaedellabrianza.it\0mil.kr\0" +"gob.es\0kvafjord.no\0ky.us\0" +"lecco.it\0" +"ct.it\0" +"magazine.aero\0" +"operaunite.com\0ne.kr\0" +"mil.kz\0skoczow.pl\0" +"nf.ca\0" +"western.museum\0" +"kunst.museum\0gaivuotna.no\0karpacz.pl\0spb.ru\0cc.id.us\0" +"slask.pl\0" +"youth.museum\0" +"adv.br\0campidanomedio.it\0!songfest.om\0" +"geelvinck.museum\0\xd8\xa7\xd9\x85\xd8\xa7\xd8\xb1\xd8\xa7\xd8\xaa\0" +"mil.lv\0" +"fie.ee\0mil.mg\0mt.us\0nd.us\0k12.vt.us\0" +"t.bg\0ushuaia.museum\0" +"off.ai\0" +"irkutsk.ru\0" +"stor-elvdal.no\0tourism.tn\0" +"penza.ru\0" +"bj.cn\0\xe4\xb8\xad\xe5\x9b\xbd\0" +"civilwar.museum\0mil.mv\0opole.pl\0" +"nes.akershus.no\0" +"mil.my\0karelia.ru\0" +"como.it\0sande.vestfold.no\0" +"\xe4\xb8\xad\xe5\x9c\x8b\0" +"gob.hn\0lib.la.us\0" +"mil.no\0cc.wv.us\0" +"boleslawiec.pl\0" +"!pref.niigata.jp\0gs.sf.no\0dc.us\0k12.mi.us\0" +"museum\0dep.no\0kv\xc3\xa6nangen.no\0l\xc3\xa1hppi.no\0" +"film.museum\0" +"frei.no\0" +"notodden.no\0risor.no\0" +"messina.it\0" +"eidsberg.no\0" +"krakow.pl\0lib.mt.us\0lib.nd.us\0" +"rauma.no\0" +"mulhouse.museum\0" +"sibenik.museum\0grong.no\0mil.pe\0" +"budejju.no\0k12.nv.us\0" +"stavanger.no\0mil.ph\0" +"forli-cesena.it\0" +"naples.it\0cc.ne.us\0" +"s\xc3\xb8r-aurdal.no\0" +"mil.pl\0" +"vibo-valentia.it\0ski.museum\0siedlce.pl\0" +"bus.museum\0" +"tozsde.hu\0" +"!pref.shizuoka.jp\0santabarbara.museum\0" +"zhitomir.ua\0" +"pro.az\0" +"ne.pw\0" +"pro.br\0orkanger.no\0b\xc3\xb8.telemark.no\0" +"roma.it\0cc.ct.us\0" +"heritage.museum\0giske.no\0" +"!pref.kumamoto.jp\0prof.pr\0" +"*.kochi.jp\0" +"andria-barletta-trani.it\0*.toyama.jp\0sveio.no\0" +"id.us\0" +"bolt.hu\0" +"fetsund.no\0porsgrunn.no\0" +"iglesias-carbonia.it\0" +"sf.no\0" +"mil.ru\0" +"from.hr\0asnes.no\0mil.rw\0" +"alesund.no\0sos.pl\0" +"livorno.it\0" +"crafts.museum\0" +"aquila.it\0" +"vega.no\0" +"jewelry.museum\0" +"sk\xc3\xa1nit.no\0chita.ru\0" +"pro.ec\0" +"fortmissoula.museum\0j\xc3\xb8lster.no\0" +"pro\0mil.st\0" +"busan.kr\0lib.ga.us\0" +"dellogliastra.it\0" +"aosta.it\0chungnam.kr\0gob.mx\0" +"mil.sy\0k12.hi.us\0" +"mil.tj\0" +"ulan-ude.ru\0mil.to\0wv.us\0" +"luster.no\0volgograd.ru\0" +"pa.it\0kommunalforbund.se\0lib.tx.us\0" +"s.se\0" +"qsl.br\0" +"mil.tw\0" +"est.pr\0ens.tn\0" +"lib.id.us\0" +"mil.tz\0" +"uscountryestate.museum\0" +"agents.aero\0" +"\xc3\xb8vre-eiker.no\0ne.ug\0" +"pb.ao\0" +"gob.pa\0ne.tz\0" +"tur.br\0" +"mil.vc\0" +"or.at\0gob.pe\0" +"s\xc3\xb8r-fron.no\0" +"or.bi\0ne.us\0" +"u.bg\0gob.pk\0" +"stavern.no\0" +"brindisi.it\0" +"aknoluokta.no\0" +"!pref.kyoto.jp\0tydal.no\0" +"plc.ly\0muos\xc3\xa1t.no\0" +"or.ci\0hamaroy.no\0priv.pl\0" +"vestre-slidre.no\0gniezno.pl\0" +"\xe7\xae\x87\xe4\xba\xba.hk\0" +"andebu.no\0" +"nieruchomosci.pl\0\xd8\xa7\xd9\x84\xd8\xb3\xd8\xb9\xd9\x88\xd8\xaf\xd9\x8a\xd8\xa9\0" +"or.cr\0pro.ht\0bolzano.it\0" +"ct.us\0k12.md.us\0" +"za.org\0" +"!icnet.uk\0" +"localhistory.museum\0" +"firm.ht\0" +"lel.br\0tr.it\0kvanangen.no\0" +"sondre-land.no\0t\xc3\xb8nsberg.no\0vefsn.no\0" +"nature.museum\0yamal.ru\0" +"rv.ua\0" +"lans.museum\0lib.ne.us\0" +"lur\xc3\xb8y.no\0" +"eu.com\0firm.in\0" +"hjelmeland.no\0" +"gs.tr.no\0" +"casino.hu\0essex.museum\0tourism.pl\0" +"rennesoy.no\0" +"priv.no\0" +"baths.museum\0mytis.ru\0" +"tingvoll.no\0" +"cc.az.us\0" +"sh.cn\0" +"!pref.miyazaki.jp\0s\xc3\xb8rfold.no\0" +"aurskog-holand.no\0malatvuopmi.no\0" +"lib.ct.us\0" +"cc.pa.us\0" +"pa.gov.pl\0" +"firm.co\0cc.de.us\0" +"nrw.museum\0" +"daejeon.kr\0livinghistory.museum\0" +"gildeskal.no\0lund.no\0" +"\xc3\xb8ksnes.no\0stavropol.ru\0" +"b\xc3\xa6rum.no\0r\xc3\xb8yrvik.no\0" +"osoyro.no\0" +"priv.me\0sula.no\0!parliament.uk\0" +"nationalheritage.museum\0" +"jaworzno.pl\0" +"dinosaur.museum\0" +"garden.museum\0trust.museum\0" +"turen.tn\0" +"kautokeino.no\0" +"pro.na\0" +"gorizia.it\0" +"siljan.no\0" +"or.id\0pro.mv\0" +"bieszczady.pl\0www.ro\0" +"lib.ee\0antiques.museum\0brasil.museum\0tr.no\0" +"aejrie.no\0" +"!pref.hokkaido.jp\0" +"schlesisches.museum\0" +"huissier-justice.fr\0or.it\0" +"t.se\0" +"environment.museum\0" +"vindafjord.no\0" +"edu.ac\0or.jp\0" +"tree.museum\0" +"groundhandling.aero\0edu.af\0" +"rochester.museum\0sanfrancisco.museum\0" +"ebiz.tw\0" +"kirovograd.ua\0" +"edu.al\0" +"edu.an\0\xc3\xa1k\xc5\x8boluokta.no\0v\xc3\xa5g\xc3\xa5.no\0" +"v.bg\0" +"edu.ba\0" +"edu.bb\0nesset.no\0" +"hornindal.no\0pro.pr\0" +"or.kr\0" +"az.us\0" +"edu.bh\0volkenkunde.museum\0" +"edu.bi\0" +"edu.az\0" +"b\xc3\xb8mlo.no\0" +"edu.bm\0" +"edu.bo\0tyumen.ru\0" +"edu.br\0" +"edu.bs\0pa.us\0" +"alto-adige.it\0whaling.museum\0" +"*.iwate.jp\0" +"edu.ci\0law.pro\0" +"edu.bz\0de.us\0" +"lib.ak.us\0" +"edu.cn\0" +"edu.co\0" +"laspezia.it\0" +"baidar.no\0" +"ts.it\0" +"or.na\0" +"edu.cu\0hotel.lk\0" +"show.aero\0or.mu\0" +"sandnes.no\0" +"museumcenter.museum\0" +"edu.dm\0kazan.ru\0" +"biz\0caltanissetta.it\0odessa.ua\0k12.oh.us\0" +"crimea.ua\0" +"research.aero\0lom.no\0" +"edu.ec\0florence.it\0clock.museum\0sshn.se\0" +"edu.ee\0game.tw\0" +"!pref.okinawa.jp\0" +"ilawa.pl\0" +"edu.dz\0indiana.museum\0" +"gs.jan-mayen.no\0" +"publ.pt\0" +"nom.ad\0" +"skanit.no\0gdansk.pl\0k12.pa.us\0" +"nom.ag\0edu.es\0" +"if.ua\0" +"pro.tt\0lib.de.us\0" +"environmentalconservation.museum\0cc.or.us\0" +"bern.museum\0nat.tn\0" +"rubtsovsk.ru\0" +"!educ.ar\0masoy.no\0" +"bologna.it\0" +"\xc3\xa5snes.no\0fhv.se\0" +"*.tottori.jp\0radoy.no\0" +"romskog.no\0" +"malbork.pl\0" +"olbiatempio.it\0" +"edu.ge\0" +"edu.gh\0" +"edu.gi\0" +"or.pw\0" +"hob\xc3\xb8l.no\0" +"nom.br\0edu.gn\0virginia.museum\0mbone.pl\0!nls.uk\0" +"seljord.no\0pro.vn\0" +"edu.gp\0" +"edu.gr\0" +"!uba.ar\0!pref.saitama.jp\0" +"greta.fr\0gs.aa.no\0kvinnherad.no\0" +"lib.sc.us\0" +"js.cn\0nom.co\0edu.hk\0" +"lesja.no\0" +"bl.it\0" +"edu.hn\0\xc3\xb8ystre-slidre.no\0mari-el.ru\0" +"hotel.hu\0" +"rindal.no\0" +"edu.ht\0" +"!pref.miyagi.jp\0" +"midtre-gauldal.no\0" +"xj.cn\0australia.museum\0" +"ab.ca\0salvadordali.museum\0olawa.pl\0" +"pc.it\0" +"u.se\0" +"edu.in\0b\xc3\xa1l\xc3\xa1t.no\0" +"ln.cn\0alta.no\0" +"chelyabinsk.ru\0" +"edu.iq\0" +"ontario.museum\0" +"edu.is\0" +"edu.it\0" +"b\xc3\xa5tsfjord.no\0" +"trysil.no\0or.th\0" +"utsira.no\0" +"nom.es\0edu.jo\0fhsk.se\0" +"bale.museum\0" +"w.bg\0" +"lillesand.no\0" +"edu.kg\0" +"amusement.aero\0" +"edu.ki\0" +"fauske.no\0or.ug\0" +"int.az\0askvoll.no\0eidskog.no\0cv.ua\0" +"algard.no\0" +"edu.km\0or.tz\0" +"nom.fr\0edu.kn\0" +"*.ibaraki.jp\0hoylandet.no\0" +"int.bo\0edu.kp\0" +"edu.la\0" +"si.it\0edu.lb\0travel.pl\0" +"edu.lc\0mx.na\0n\xc3\xa1vuotna.no\0ovre-eiker.no\0" +"aa.no\0!siemens.om\0" +"sciences.museum\0or.us\0" +"cat\0" +"edu.ky\0" +"int.ci\0edu.kz\0firm.ro\0cc.wy.us\0" +"edu.lk\0vaapste.no\0" +"!pref.tochigi.jp\0" +"int.co\0podlasie.pl\0" +"edu.lr\0" +"karikatur.museum\0jamal.ru\0" +"gjovik.no\0krager\xc3\xb8.no\0k12.az.us\0" +"edu.me\0" +"ud.it\0edu.lv\0entomology.museum\0" +"edu.mg\0moskenes.no\0" +"\xe6\x94\xbf\xe5\xba\x9c.hk\0edu.ly\0" +"stpetersburg.museum\0" +"edu.mk\0" +"edu.ml\0nordreisa.no\0" +"!pref.fukui.jp\0lib.ms.us\0lib.nc.us\0" +"edu.mn\0\xd9\x81\xd9\x84\xd8\xb3\xd8\xb7\xd9\x8a\xd9\x86\0" +"fot.br\0edu.mo\0" +"iron.museum\0" +"asti.it\0annefrank.museum\0stv.ru\0cc.nh.us\0" +"edu.mv\0" +"lodi.it\0edu.mw\0edu.ng\0" +"gwangju.kr\0edu.mx\0" +"edu.my\0" +"soundandvision.museum\0" +"lenvik.no\0" +"ballooning.aero\0" +"name\0" +"jogasz.hu\0frogn.no\0" +"history.museum\0" +"consultant.aero\0edu.nr\0" +"manchester.museum\0" +"*.hiroshima.jp\0" +"pol.dz\0" +"*.tochigi.jp\0heimatunduhren.museum\0" +"!pref.kanagawa.jp\0" +"firm.nf\0edu.pa\0" +"coop.ht\0pc.pl\0" +"chicago.museum\0" +"vn.ua\0" +"edu.pe\0" +"tana.no\0edu.pf\0" +"edu.ph\0" +"nom.km\0" +"travel.tt\0" +"edu.pk\0" +"experts-comptables.fr\0edu.pl\0bryansk.ru\0" +"edu.pn\0" +"evje-og-hornnes.no\0warszawa.pl\0" +"ac.ae\0" +"edu.pr\0" +"vaksdal.no\0edu.ps\0dni.us\0" +"po.gov.pl\0edu.pt\0" +"nordre-land.no\0vadso.no\0" +"rnrt.tn\0" +"sport.hu\0!pref.gifu.jp\0voss.no\0targi.pl\0" +"flesberg.no\0" +"photography.museum\0" +"modena.it\0tonsberg.no\0" +"ac.at\0" +"ac.be\0coop.br\0" +"services.aero\0" +"nom.mg\0" +"wielun.pl\0" +"jefferson.museum\0wy.us\0" +"pd.it\0ot.it\0neues.museum\0slattum.no\0" +"vdonsk.ru\0" +"ar.com\0edu.sa\0" +"\xc3\xa5l.no\0edu.sb\0" +"edu.rs\0edu.sc\0" +"ac.ci\0int.is\0edu.sd\0!tsk.tr\0" +"br\xc3\xb8nn\xc3\xb8ysund.no\0and\xc3\xb8y.no\0edu.ru\0" +"pol.ht\0" +"edu.rw\0edu.sg\0" +"gyeongnam.kr\0olecko.pl\0" +"ac.cn\0" +"graz.museum\0" +"coldwar.museum\0edu.sl\0" +"ac.cr\0" +"edu.sn\0" +"hamar.no\0" +"histoire.museum\0" +"!city.shizuoka.jp\0" +"edu.st\0" +"oceanographic.museum\0nh.us\0" +"x.bg\0" +"surnadal.no\0" +"fc.it\0costume.museum\0stalowa-wola.pl\0" +"valer.ostfold.no\0edu.sy\0" +"edu.tj\0" +"arq.br\0" +"aeroclub.aero\0odo.br\0pe.ca\0\xe7\xb6\xb2\xe7\xb5\xa1.cn\0bronnoysund.no\0nom.pa\0" +"edu.to\0" +"paleo.museum\0nom.pe\0edu.ua\0" +"int.la\0trustee.museum\0forsand.no\0krasnoyarsk.ru\0" +"!pref.hyogo.jp\0" +"edu.tt\0" +"zarow.pl\0" +"edu.tw\0" +"nom.pl\0" +"community.museum\0kvitsoy.no\0" +"int.lk\0tychy.pl\0" +"k12.me.us\0" +"jondal.no\0edu.vc\0" +"illustration.museum\0" +"clinton.museum\0" +"tas.au\0es.kr\0" +"production.aero\0" +"rodoy.no\0" +"database.museum\0bodo.no\0" +"anthro.museum\0landes.museum\0edu.vn\0" +"nom.re\0" +"altai.ru\0" +"filatelia.museum\0" +"sk.ca\0lezajsk.pl\0" +"rockart.museum\0int.mv\0" +"int.mw\0herad.no\0" +"eti.br\0ac.gn\0" +"fedje.no\0nom.ro\0" +"money.museum\0" +"\xd9\x85\xd8\xb5\xd8\xb1\0" +"horten.no\0" +"gangaviika.no\0mielec.pl\0" +"uw.gov.pl\0" +"moma.museum\0" +"edu.ws\0" +"go.ci\0" +"tv.bo\0technology.museum\0" +"s\xc3\xb8ndre-land.no\0" +"tv.br\0" +"jor.br\0lib.dc.us\0" +"arboretum.museum\0" +"go.cr\0" +"artsandcrafts.museum\0\xd8\xaa\xd9\x88\xd9\x86\xd8\xb3\0" +"psc.br\0ac.id\0!city.chiba.jp\0" +"wa.au\0" +"rome.it\0" +"amli.no\0" +"ac.im\0lo.it\0" +"ac.in\0" +"\xe7\xb6\xb2\xe7\xb5\xa1.hk\0durham.museum\0" +"ac.ir\0" +"torino.museum\0" +"loabat.no\0" +"com\0" +"nalchik.ru\0" +"yakutia.ru\0" +"settlers.museum\0" +"!promocion.ar\0int.pt\0" +"union.aero\0" +"utah.museum\0" +"giehtavuoatna.no\0" +"ac.jp\0" +"air-traffic-control.aero\0" +"silk.museum\0usantiques.museum\0" +"bn.it\0" +"kalisz.pl\0" +"perm.ru\0" +"aoste.it\0bindal.no\0" +"coloradoplateau.museum\0k12.gu.us\0" +"frosinone.it\0forde.no\0" +"epilepsy.museum\0" +"olbia-tempio.it\0" +"journalist.aero\0ac.kr\0*.sch.uk\0" +"nic.im\0sciencesnaturelles.museum\0bedzin.pl\0" +"nic.in\0pe.it\0" +"w.se\0" +"!pref.okayama.jp\0" +"urn.arpa\0" +"cinema.museum\0" +"monza.it\0versailles.museum\0int.ru\0" +"andasuolo.no\0skj\xc3\xa5k.no\0chernovtsy.ua\0" +"nyc.museum\0int.rw\0paroch.k12.ma.us\0" +"ringerike.no\0" +"ac.ma\0" +"org.ac\0civilaviation.aero\0" +"rakkestad.no\0" +"org.ae\0ac.me\0" +"org.af\0" +"org.ag\0" +"org.ai\0stokke.no\0" +"airport.aero\0" +"finnoy.no\0" +"org.al\0" +"org.an\0y.bg\0habmer.no\0" +"stadt.museum\0holtalen.no\0" +"int.tj\0" +"org.ba\0gjerdrum.no\0" +"org.bb\0ascoli-piceno.it\0molde.no\0r\xc3\xb8st.no\0tysfjord.no\0" +"pe.kr\0rybnik.pl\0" +"go.id\0" +"ac.mu\0" +"ac.mw\0ac.ng\0" +"org.bh\0\xc3\xa5mot.no\0rana.no\0" +"org.bi\0" +"org.az\0belgorod.ru\0int.tt\0" +"ae.org\0" +"group.aero\0posts-and-telecommunications.museum\0" +"org.bm\0salerno.it\0" +"etnedal.no\0" +"org.bo\0*.hokkaido.jp\0donetsk.ua\0" +"ostroda.pl\0" +"org.br\0" +"org.bs\0" +"go.it\0h\xc3\xb8ylandet.no\0" +"zgorzelec.pl\0" +"org.bw\0" +"org.ci\0" +"org.bz\0vicenza.it\0resistance.museum\0" +"missile.museum\0" +"org.cn\0" +"org.co\0assassination.museum\0" +"go.jp\0" +"tv.it\0austrheim.no\0ac.pa\0" +"verbania.it\0" +"palace.museum\0" +"tmp.br\0int.vn\0" +"org.cu\0" +"paris.museum\0" +"media.aero\0hokksund.no\0" +"arts.museum\0gemological.museum\0hammerfest.no\0" +"k12.ny.us\0" +"org.dm\0hemsedal.no\0ringsaker.no\0sklep.pl\0" +"h\xc3\xa5.no\0cc.nj.us\0" +"rzeszow.pl\0" +"go.kr\0gjesdal.no\0ac.pr\0" +"org.ec\0" +"org.ee\0" +"media.museum\0" +"terni.it\0touch.museum\0zakopane.pl\0" +"journal.aero\0org.dz\0" +"incheon.kr\0" +"b\xc3\xa1hcavuotna.no\0" +"leksvik.no\0ulvik.no\0" +"plantation.museum\0" +"org.es\0loyalist.museum\0" +"gildesk\xc3\xa5l.no\0bytom.pl\0" +"bo.nordland.no\0" +"ambulance.aero\0iglesiascarbonia.it\0" +"tw.cn\0\xe6\x96\xb0\xe5\x8a\xa0\xe5\x9d\xa1\0" +"chocolate.museum\0" +"pittsburgh.museum\0" +"royrvik.no\0sor-odal.no\0ac.rs\0" +"kaluga.ru\0" +"org.ge\0erotica.hu\0ac.ru\0ac.se\0" +"org.gg\0leangaviika.no\0ac.rw\0" +"org.gh\0v\xc3\xa6r\xc3\xb8y.no\0" +"org.gi\0" +"jevnaker.no\0" +"org.gn\0tv.na\0leikanger.no\0" +"org.gp\0" +"ask\xc3\xb8y.no\0" +"org.gr\0wroc.pl\0" +"ad.jp\0" +"powiat.pl\0" +"tj\xc3\xb8me.no\0" +"coop.tt\0" +"ac.th\0" +"mragowo.pl\0ac.sz\0ac.tj\0" +"org.hk\0bo.it\0" +"philately.museum\0" +"org.hn\0" +"fet.no\0" +"axis.museum\0mansions.museum\0" +"wiki.br\0" +"org.ht\0" +"org.hu\0piacenza.it\0scotland.museum\0cpa.pro\0" +"ac.ug\0" +"coop.mv\0x.se\0" +"coop.mw\0ac.tz\0" +"bmd.br\0" +"org.im\0ralingen.no\0" +"org.in\0" +"cz.it\0lib.ia.us\0" +"org.iq\0" +"org.ir\0" +"org.is\0" +"nl.ca\0" +"org.je\0" +"childrensgarden.museum\0" +"kvits\xc3\xb8y.no\0go.pw\0" +"sokndal.no\0" +"ra.it\0grimstad.no\0" +"denmark.museum\0" +"ac.vn\0" +"ecn.br\0org.jo\0" +"bialystok.pl\0nj.us\0" +"z.bg\0bilbao.museum\0stargard.pl\0nic.tj\0" +"eisenbahn.museum\0" +"fe.it\0bryne.no\0vrn.ru\0" +"cc.wa.us\0" +"sex.hu\0skierva.no\0" +"org.kg\0" +"org.ki\0" +"org.km\0" +"org.kn\0khakassia.ru\0" +"org.kp\0" +"org.la\0" +"org.lb\0" +"org.lc\0" +"francaise.museum\0" +"panama.museum\0" +"rotorcraft.aero\0gateway.museum\0olkusz.pl\0" +"org.ky\0czeladz.pl\0ryazan.ru\0" +"org.kz\0" +"org.lk\0dyr\xc3\xb8y.no\0" +"raisa.no\0" +"dlugoleka.pl\0" +"org.ma\0" +"org.lr\0prochowice.pl\0" +"org.ls\0" +"org.me\0sandoy.no\0s\xc3\xb8r-varanger.no\0" +"org.lv\0" +"org.mg\0" +"tel\0go.th\0" +"org.ly\0" +"steam.museum\0go.tj\0" +"org.mk\0pasadena.museum\0jessheim.no\0lib.mn.us\0" +"org.ml\0" +"software.aero\0" +"org.mn\0" +"org.mo\0" +"*.fukui.jp\0decorativearts.museum\0" +"spy.museum\0org.na\0jorpeland.no\0" +"vads\xc3\xb8.no\0" +"org.mu\0building.museum\0gausdal.no\0" +"org.mv\0nannestad.no\0" +"org.mw\0org.ng\0go.ug\0" +"vr.it\0org.mx\0" +"org.my\0" +"go.tz\0" +"oppdal.no\0" +"uk.net\0" +"coop.km\0" +"*.kyoto.jp\0" +"sarpsborg.no\0org.nr\0" +"chernigov.ua\0" +"ha.cn\0no.com\0" +"space.museum\0" +"org.pa\0" +"*.ar\0" +"usgarden.museum\0" +"*.bd\0org.pe\0" +"*.au\0org.pf\0um.gov.pl\0" +"bio.br\0" +"org.ph\0" +"org.pk\0" +"fr\xc3\xa6na.no\0org.pl\0" +"nord-aurdal.no\0org.pn\0" +"*.bn\0handson.museum\0agrinet.tn\0" +"kviteseid.no\0" +"rel.ht\0virtuel.museum\0atm.pl\0org.pr\0" +"org.ps\0cherkassy.ua\0" +"org.pt\0wa.us\0" +"*.bt\0arendal.no\0magnitka.ru\0" +"depot.museum\0porsangu.no\0" +"laakesvuemie.no\0" +"sor-fron.no\0" +"heroy.more-og-romsdal.no\0" +"*.ck\0" +"!rakpetroleum.om\0" +"kr\xc3\xb8""dsherad.no\0mail.pl\0" +"mod.gi\0" +"gs.nl.no\0" +"mb.ca\0" +"pavia.it\0" +"civilisation.museum\0folldal.no\0" +"suli.hu\0" +"brumunddal.no\0" +"*.cy\0" +"pg.it\0troms\xc3\xb8.no\0" +"sex.pl\0y.se\0" +"org.ro\0" +"*.do\0" +"caserta.it\0org.sa\0" +"za.com\0halloffame.museum\0org.sb\0lviv.ua\0" +"mill.museum\0org.rs\0org.sc\0" +"org.sd\0" +"idv.hk\0!omanmobile.om\0org.ru\0org.se\0" +"langev\xc3\xa5g.no\0r\xc3\xa5holt.no\0starostwo.gov.pl\0" +"trani-andria-barletta.it\0org.sg\0" +"*.eg\0hvaler.no\0" +"*.ehime.jp\0" +"gmina.pl\0" +"bod\xc3\xb8.no\0org.sl\0" +"edu\0org.sn\0" +"org.so\0lib.wi.us\0" +"kommune.no\0" +"nome.pt\0" +"*.er\0namdalseid.no\0k12.wa.us\0" +"nm.cn\0org.st\0" +"*.et\0d\xc3\xb8nna.no\0" +"jewish.museum\0preservation.museum\0" +"slupsk.pl\0org.sy\0" +"art.br\0org.sz\0org.tj\0" +"ntr.br\0*.fj\0ski.no\0" +"*.fk\0rimini.it\0grajewo.pl\0" +"loppa.no\0" +"franziskaner.museum\0notteroy.no\0org.tn\0" +"org.to\0" +"nesoddtangen.no\0" +"org.ua\0" +"discovery.museum\0wloclawek.pl\0" +"lakas.hu\0org.tt\0" +"kurgan.ru\0" +"baltimore.museum\0nkz.ru\0org.tw\0" +"com.ac\0castle.museum\0" +"*.fukuoka.jp\0sandefjord.no\0varggat.no\0" +"com.af\0" +"com.ag\0" +"ato.br\0k12.nj.us\0" +"com.ai\0" +"city.hu\0oryol.ru\0" +"com.al\0nl.no\0mielno.pl\0cc.ma.us\0" +"org.vc\0" +"com.an\0g12.br\0" +"*.gt\0" +"*.gu\0" +"com.ba\0" +"com.bb\0americanart.museum\0" +"org.vi\0" +"kunstsammlung.museum\0" +"com.aw\0" +"flight.aero\0com.bh\0lib.mo.us\0org.vn\0" +"com.bi\0adygeya.ru\0" +"com.az\0" +"art.dz\0" +"com.bm\0" +"dr\xc3\xb8""bak.no\0" +"com.bo\0isla.pr\0" +"com.br\0" +"com.bs\0ustka.pl\0kuban.ru\0" +"press.aero\0" +"vs.it\0" +"meloy.no\0" +"*.il\0ulm.museum\0" +"com.by\0com.ci\0genoa.it\0" +"com.bz\0sn.cn\0" +"lib.or.us\0" +"santafe.museum\0org.ws\0" +}; + +QT_END_NAMESPACE + +#endif // QURLTLD_P_H diff --git a/src/corelib/io/qurltlds_p.h.INFO b/src/corelib/io/qurltlds_p.h.INFO new file mode 100644 index 0000000..57a8d0e --- /dev/null +++ b/src/corelib/io/qurltlds_p.h.INFO @@ -0,0 +1,17 @@ +The file qnetworkcookiejartlds_p.h is generated from the Public Suffix +List (see [1] and [2]), by the program residing at +util/network/cookiejar-generateTLDs in the Qt source tree. + +That program generates a character array and an index array from the +list to provide fast lookups of elements within C++. + +Those arrays in qnetworkcookiejartlds_p.h are derived from the Public +Suffix List ([2]), which was originally provided by +Jo Hermans . + +The file qnetworkcookiejartlds_p.h was last generated Friday, +November 19th 15:24 2010. + +---- +[1] list: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 +[2] homepage: http://publicsuffix.org/ diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 5ead3ad..99e861e 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -22,7 +22,6 @@ HEADERS += \ access/qnetworkcookie_p.h \ access/qnetworkcookiejar.h \ access/qnetworkcookiejar_p.h \ - access/qnetworkcookiejartlds_p.h \ access/qnetworkrequest.h \ access/qnetworkrequest_p.h \ access/qnetworkreply.h \ diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 53fab9f..f2b1714 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -40,12 +40,12 @@ ****************************************************************************/ #include "qnetworkcookiejar.h" -#include "qnetworkcookiejartlds_p.h" #include "qnetworkcookiejar_p.h" #include "QtNetwork/qnetworkcookie.h" #include "QtCore/qurl.h" #include "QtCore/qdatetime.h" +#include "private/qtldurl_p.h" QT_BEGIN_NAMESPACE @@ -216,7 +216,7 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList &cookieLis // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 // redundant; the "leading dot" rule has been relaxed anyway, see above // we remove the leading dot for this check - if (QNetworkCookieJarPrivate::isEffectiveTLD(domain.remove(0, 1))) + if (qIsEffectiveTLD(domain.remove(0, 1))) continue; // not accepted } @@ -304,43 +304,4 @@ QList QNetworkCookieJar::cookiesForUrl(const QUrl &url) const return result; } -bool QNetworkCookieJarPrivate::isEffectiveTLD(const QString &domain) -{ - // for domain 'foo.bar.com': - // 1. return if TLD table contains 'foo.bar.com' - if (containsTLDEntry(domain)) - return true; - - if (domain.contains(QLatin1Char('.'))) { - int count = domain.size() - domain.indexOf(QLatin1Char('.')); - QString wildCardDomain; - wildCardDomain.reserve(count + 1); - wildCardDomain.append(QLatin1Char('*')); - wildCardDomain.append(domain.right(count)); - // 2. if table contains '*.bar.com', - // test if table contains '!foo.bar.com' - if (containsTLDEntry(wildCardDomain)) { - QString exceptionDomain; - exceptionDomain.reserve(domain.size() + 1); - exceptionDomain.append(QLatin1Char('!')); - exceptionDomain.append(domain); - return (! containsTLDEntry(exceptionDomain)); - } - } - return false; -} - -bool QNetworkCookieJarPrivate::containsTLDEntry(const QString &entry) -{ - int index = qHash(entry) % tldCount; - int currentDomainIndex = tldIndices[index]; - while (currentDomainIndex < tldIndices[index+1]) { - QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex); - if (currentEntry == entry) - return true; - currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0 - } - return false; -} - QT_END_NAMESPACE diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h index d6dc450..ce5a87a 100644 --- a/src/network/access/qnetworkcookiejar_p.h +++ b/src/network/access/qnetworkcookiejar_p.h @@ -63,9 +63,6 @@ class QNetworkCookieJarPrivate: public QObjectPrivate public: QList allCookies; - static bool Q_AUTOTEST_EXPORT isEffectiveTLD(const QString &domain); - static bool containsTLDEntry(const QString &entry); - Q_DECLARE_PUBLIC(QNetworkCookieJar) }; diff --git a/src/network/access/qnetworkcookiejartlds_p.h b/src/network/access/qnetworkcookiejartlds_p.h deleted file mode 100644 index b06d881..0000000 --- a/src/network/access/qnetworkcookiejartlds_p.h +++ /dev/null @@ -1,6481 +0,0 @@ -// Version: MPL 1.1/GPL 2.0/LGPL 2.1 -// -// The contents of this file are subject to the Mozilla Public License Version -// 1.1 (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// http://www.mozilla.org/MPL/ -// -// Software distributed under the License is distributed on an "AS IS" basis, -// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -// for the specific language governing rights and limitations under the -// License. -// -// The Original Code is the Public Suffix List. -// -// The Initial Developer of the Original Code is -// Jo Hermans . -// Portions created by the Initial Developer are Copyright (C) 2007 -// the Initial Developer. All Rights Reserved. -// -// Contributor(s): -// Ruben Arakelyan -// Gervase Markham -// Pamela Greene -// David Triendl -// Jothan Frakes -// The kind representatives of many TLD registries -// -// Alternatively, the contents of this file may be used under the terms of -// either the GNU General Public License Version 2 or later (the "GPL"), or -// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -// in which case the provisions of the GPL or the LGPL are applicable instead -// of those above. If you wish to allow use of your version of this file only -// under the terms of either the GPL or the LGPL, and not to allow others to -// use your version of this file under the terms of the MPL, indicate your -// decision by deleting the provisions above and replace them with the notice -// and other provisions required by the GPL or the LGPL. If you do not delete -// the provisions above, a recipient may use your version of this file under -// the terms of any one of the MPL, the GPL or the LGPL. -// - -#ifndef QNETWORKCOOKIEJARTLD_P_H -#define QNETWORKCOOKIEJARTLD_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the Network Access framework. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -// note to maintainer: -// this file should be updated before each release -> -// for instructions see the program at -// util/network/cookiejar-generateTLDs - -static const quint16 tldCount = 3949; -static const quint16 tldIndices[] = { -0, -7, -14, -14, -20, -51, -61, -93, -100, -100, -116, -159, -167, -180, -180, -193, -234, -234, -234, -255, -255, -255, -280, -280, -287, -287, -295, -303, -313, -326, -326, -380, -393, -413, -419, -419, -419, -424, -438, -438, -469, -515, -515, -515, -534, -534, -557, -557, -557, -557, -572, -572, -572, -579, -587, -597, -612, -612, -624, -636, -648, -662, -687, -709, -714, -740, -766, -789, -789, -805, -805, -810, -815, -815, -824, -824, -831, -857, -869, -891, -891, -916, -916, -916, -927, -934, -964, -971, -987, -987, -987, -1008, -1008, -1016, -1016, -1030, -1030, -1052, -1075, -1075, -1082, -1087, -1115, -1135, -1135, -1135, -1172, -1178, -1178, -1178, -1202, -1207, -1220, -1220, -1266, -1266, -1266, -1266, -1272, -1290, -1316, -1316, -1332, -1332, -1339, -1339, -1352, -1352, -1389, -1389, -1408, -1415, -1437, -1444, -1489, -1489, -1502, -1502, -1512, -1518, -1539, -1555, -1562, -1584, -1598, -1607, -1607, -1607, -1632, -1652, -1652, -1658, -1658, -1675, -1682, -1709, -1733, -1748, -1776, -1783, -1783, -1790, -1797, -1826, -1850, -1850, -1856, -1880, -1887, -1901, -1921, -1947, -1961, -1967, -1967, -1967, -1972, -1986, -1986, -1986, -2009, -2029, -2029, -2047, -2061, -2075, -2075, -2075, -2075, -2075, -2075, -2082, -2082, -2124, -2124, -2129, -2162, -2162, -2162, -2236, -2256, -2263, -2276, -2283, -2313, -2313, -2347, -2380, -2387, -2387, -2387, -2431, -2438, -2445, -2452, -2459, -2459, -2469, -2490, -2516, -2527, -2540, -2540, -2586, -2610, -2630, -2630, -2653, -2660, -2669, -2693, -2693, -2710, -2710, -2719, -2719, -2734, -2740, -2740, -2753, -2753, -2763, -2770, -2775, -2782, -2789, -2802, -2820, -2827, -2827, -2841, -2855, -2855, -2865, -2872, -2884, -2884, -2919, -2937, -2955, -2962, -3012, -3042, -3073, -3083, -3083, -3100, -3105, -3112, -3131, -3131, -3166, -3180, -3187, -3194, -3211, -3218, -3223, -3233, -3249, -3259, -3268, -3314, -3314, -3324, -3324, -3336, -3336, -3336, -3336, -3350, -3363, -3376, -3398, -3416, -3445, -3464, -3488, -3488, -3497, -3545, -3552, -3552, -3552, -3566, -3573, -3573, -3573, -3581, -3581, -3603, -3603, -3615, -3621, -3621, -3683, -3683, -3710, -3710, -3716, -3716, -3748, -3770, -3791, -3803, -3810, -3817, -3833, -3846, -3846, -3852, -3876, -3876, -3882, -3903, -3910, -3939, -3939, -3939, -3947, -3962, -3962, -3981, -3994, -4021, -4030, -4042, -4085, -4085, -4096, -4096, -4104, -4123, -4123, -4123, -4143, -4154, -4164, -4194, -4194, -4194, -4205, -4205, -4222, -4238, -4301, -4309, -4322, -4331, -4331, -4331, -4331, -4331, -4347, -4365, -4375, -4375, -4385, -4398, -4412, -4430, -4430, -4437, -4447, -4463, -4472, -4472, -4472, -4484, -4484, -4484, -4484, -4484, -4490, -4490, -4511, -4511, -4522, -4522, -4522, -4522, -4528, -4528, -4534, -4551, -4551, -4551, -4564, -4583, -4583, -4611, -4611, -4611, -4622, -4622, -4649, -4668, -4677, -4692, -4692, -4692, -4705, -4723, -4723, -4723, -4729, -4729, -4743, -4743, -4750, -4750, -4763, -4770, -4776, -4776, -4776, -4793, -4811, -4811, -4811, -4821, -4821, -4841, -4857, -4891, -4897, -4903, -4903, -4903, -4919, -4935, -4942, -4958, -4958, -4975, -4975, -4975, -4985, -4985, -5020, -5032, -5032, -5040, -5053, -5068, -5079, -5079, -5101, -5115, -5115, -5135, -5154, -5161, -5161, -5168, -5168, -5184, -5210, -5210, -5238, -5255, -5278, -5285, -5308, -5318, -5327, -5327, -5333, -5333, -5340, -5348, -5355, -5366, -5377, -5384, -5408, -5415, -5422, -5435, -5442, -5482, -5482, -5482, -5482, -5498, -5527, -5534, -5541, -5572, -5572, -5572, -5579, -5591, -5602, -5602, -5621, -5621, -5646, -5664, -5671, -5671, -5681, -5696, -5707, -5716, -5716, -5723, -5723, -5732, -5742, -5742, -5763, -5770, -5776, -5790, -5790, -5797, -5806, -5816, -5832, -5882, -5882, -5882, -5882, -5893, -5934, -5934, -5965, -5965, -5980, -5980, -5980, -5980, -6007, -6017, -6034, -6051, -6065, -6075, -6075, -6091, -6097, -6097, -6109, -6109, -6109, -6122, -6147, -6168, -6168, -6191, -6191, -6191, -6191, -6191, -6198, -6217, -6224, -6224, -6231, -6245, -6252, -6252, -6270, -6270, -6284, -6305, -6315, -6322, -6322, -6322, -6329, -6329, -6329, -6353, -6361, -6361, -6375, -6391, -6405, -6405, -6415, -6431, -6431, -6431, -6431, -6458, -6475, -6475, -6475, -6482, -6489, -6496, -6496, -6503, -6520, -6520, -6520, -6527, -6527, -6544, -6561, -6573, -6573, -6580, -6580, -6587, -6587, -6592, -6592, -6592, -6592, -6599, -6599, -6612, -6633, -6649, -6649, -6669, -6676, -6683, -6683, -6713, -6720, -6727, -6736, -6736, -6746, -6770, -6807, -6814, -6827, -6846, -6846, -6864, -6864, -6864, -6864, -6881, -6888, -6888, -6888, -6914, -6935, -6935, -6935, -6953, -6959, -6966, -6983, -6983, -6983, -7013, -7023, -7023, -7023, -7023, -7037, -7044, -7058, -7079, -7086, -7123, -7134, -7155, -7168, -7178, -7203, -7227, -7236, -7258, -7265, -7274, -7274, -7303, -7303, -7314, -7314, -7345, -7352, -7367, -7377, -7388, -7388, -7402, -7402, -7409, -7421, -7421, -7467, -7484, -7484, -7484, -7491, -7532, -7532, -7539, -7546, -7546, -7553, -7573, -7573, -7573, -7580, -7587, -7594, -7594, -7594, -7606, -7606, -7637, -7637, -7637, -7664, -7664, -7664, -7677, -7684, -7701, -7723, -7723, -7723, -7723, -7734, -7734, -7734, -7748, -7748, -7748, -7748, -7759, -7759, -7775, -7775, -7782, -7789, -7817, -7824, -7831, -7836, -7865, -7865, -7876, -7901, -7901, -7908, -7918, -7938, -7945, -7945, -7957, -7964, -7979, -7986, -7994, -8007, -8007, -8014, -8021, -8061, -8061, -8071, -8088, -8131, -8138, -8153, -8160, -8160, -8160, -8175, -8183, -8197, -8211, -8211, -8211, -8243, -8243, -8243, -8243, -8259, -8259, -8259, -8259, -8259, -8266, -8275, -8281, -8281, -8281, -8281, -8288, -8288, -8309, -8309, -8309, -8330, -8330, -8330, -8330, -8337, -8343, -8343, -8360, -8370, -8370, -8380, -8380, -8386, -8386, -8397, -8415, -8415, -8428, -8454, -8460, -8475, -8492, -8526, -8554, -8554, -8583, -8583, -8583, -8598, -8607, -8617, -8617, -8642, -8652, -8652, -8652, -8662, -8688, -8688, -8704, -8704, -8747, -8765, -8775, -8783, -8811, -8835, -8835, -8835, -8850, -8859, -8884, -8910, -8919, -8952, -8978, -8978, -8991, -8991, -8991, -8999, -8999, -8999, -9030, -9030, -9030, -9030, -9030, -9041, -9048, -9048, -9054, -9054, -9054, -9086, -9108, -9108, -9119, -9119, -9130, -9144, -9152, -9161, -9174, -9194, -9207, -9207, -9207, -9232, -9242, -9242, -9271, -9290, -9308, -9308, -9308, -9308, -9320, -9333, -9343, -9356, -9379, -9379, -9379, -9395, -9395, -9406, -9419, -9419, -9419, -9419, -9450, -9485, -9485, -9497, -9497, -9505, -9517, -9528, -9528, -9551, -9564, -9586, -9586, -9608, -9608, -9626, -9626, -9626, -9653, -9653, -9681, -9681, -9681, -9698, -9698, -9698, -9714, -9729, -9737, -9737, -9765, -9765, -9765, -9765, -9765, -9825, -9844, -9866, -9880, -9880, -9880, -9880, -9886, -9895, -9895, -9895, -9895, -9895, -9913, -9913, -9924, -9958, -9958, -9967, -9975, -9975, -9975, -9981, -9998, -9998, -9998, -10012, -10036, -10036, -10066, -10079, -10097, -10121, -10133, -10142, -10142, -10142, -10156, -10173, -10173, -10173, -10196, -10205, -10205, -10205, -10205, -10218, -10234, -10240, -10240, -10240, -10264, -10273, -10286, -10286, -10286, -10286, -10299, -10299, -10309, -10309, -10339, -10358, -10358, -10374, -10374, -10390, -10390, -10413, -10413, -10439, -10461, -10467, -10467, -10467, -10492, -10492, -10501, -10528, -10528, -10528, -10539, -10583, -10583, -10583, -10613, -10613, -10619, -10628, -10645, -10645, -10645, -10650, -10671, -10687, -10709, -10709, -10709, -10709, -10709, -10727, -10727, -10727, -10727, -10733, -10733, -10768, -10768, -10773, -10780, -10788, -10788, -10797, -10797, -10835, -10835, -10845, -10852, -10861, -10861, -10861, -10861, -10861, -10861, -10861, -10875, -10888, -10907, -10907, -10907, -10920, -10920, -10932, -10946, -10977, -10977, -10997, -11008, -11037, -11059, -11059, -11059, -11067, -11067, -11067, -11067, -11067, -11077, -11091, -11102, -11102, -11112, -11125, -11129, -11129, -11154, -11154, -11154, -11164, -11164, -11189, -11189, -11189, -11189, -11189, -11196, -11196, -11227, -11238, -11247, -11256, -11265, -11265, -11286, -11307, -11330, -11337, -11378, -11378, -11389, -11413, -11454, -11469, -11475, -11475, -11475, -11475, -11503, -11503, -11503, -11503, -11534, -11534, -11550, -11550, -11557, -11557, -11557, -11557, -11574, -11585, -11585, -11603, -11626, -11643, -11643, -11643, -11643, -11663, -11663, -11682, -11696, -11696, -11696, -11696, -11706, -11706, -11706, -11706, -11723, -11723, -11757, -11757, -11773, -11795, -11813, -11836, -11836, -11883, -11903, -11952, -11965, -11965, -11984, -11997, -12008, -12008, -12008, -12024, -12043, -12065, -12071, -12099, -12129, -12140, -12140, -12146, -12161, -12161, -12161, -12161, -12167, -12167, -12180, -12186, -12208, -12226, -12243, -12243, -12252, -12252, -12274, -12289, -12302, -12302, -12313, -12313, -12313, -12313, -12358, -12358, -12358, -12369, -12375, -12391, -12391, -12391, -12391, -12405, -12410, -12416, -12416, -12436, -12436, -12436, -12443, -12443, -12462, -12477, -12492, -12492, -12503, -12519, -12525, -12531, -12571, -12571, -12591, -12591, -12601, -12641, -12641, -12641, -12657, -12657, -12657, -12699, -12699, -12699, -12712, -12728, -12744, -12761, -12769, -12782, -12793, -12823, -12836, -12851, -12863, -12890, -12900, -12900, -12900, -12910, -12910, -12924, -12924, -12924, -12924, -12924, -12952, -12984, -13003, -13038, -13038, -13056, -13056, -13056, -13056, -13074, -13081, -13093, -13103, -13103, -13112, -13119, -13132, -13132, -13132, -13141, -13151, -13183, -13193, -13206, -13206, -13206, -13236, -13252, -13267, -13267, -13294, -13307, -13307, -13307, -13343, -13349, -13349, -13349, -13375, -13375, -13375, -13384, -13384, -13384, -13393, -13393, -13393, -13402, -13414, -13425, -13445, -13467, -13485, -13499, -13509, -13528, -13528, -13549, -13549, -13559, -13570, -13570, -13570, -13570, -13598, -13637, -13647, -13647, -13661, -13673, -13682, -13687, -13694, -13694, -13720, -13733, -13742, -13748, -13771, -13795, -13795, -13814, -13821, -13821, -13855, -13862, -13862, -13862, -13874, -13874, -13897, -13909, -13909, -13947, -13947, -13952, -13952, -13970, -13979, -13979, -13979, -14008, -14049, -14049, -14049, -14049, -14049, -14049, -14060, -14083, -14083, -14091, -14101, -14101, -14101, -14101, -14118, -14136, -14195, -14195, -14195, -14213, -14213, -14232, -14232, -14253, -14253, -14258, -14275, -14275, -14304, -14311, -14311, -14318, -14318, -14318, -14318, -14318, -14318, -14325, -14325, -14345, -14345, -14379, -14389, -14422, -14422, -14422, -14422, -14435, -14441, -14441, -14460, -14460, -14471, -14471, -14481, -14495, -14495, -14495, -14502, -14502, -14502, -14502, -14524, -14533, -14541, -14552, -14552, -14552, -14552, -14563, -14563, -14568, -14568, -14585, -14595, -14602, -14628, -14628, -14645, -14672, -14678, -14697, -14697, -14734, -14757, -14764, -14771, -14771, -14771, -14796, -14815, -14822, -14845, -14861, -14861, -14861, -14873, -14873, -14873, -14902, -14920, -14920, -14926, -14926, -14926, -14941, -14949, -14949, -14949, -14949, -14949, -14960, -14960, -14971, -14971, -14998, -15003, -15003, -15003, -15013, -15013, -15027, -15027, -15027, -15043, -15053, -15063, -15074, -15083, -15093, -15093, -15121, -15121, -15128, -15128, -15144, -15144, -15144, -15144, -15165, -15170, -15170, -15170, -15170, -15170, -15170, -15170, -15186, -15206, -15206, -15206, -15224, -15236, -15236, -15252, -15258, -15258, -15258, -15258, -15264, -15277, -15288, -15307, -15307, -15318, -15328, -15328, -15334, -15334, -15363, -15399, -15399, -15422, -15438, -15447, -15447, -15456, -15456, -15456, -15495, -15495, -15495, -15495, -15511, -15511, -15530, -15557, -15566, -15582, -15590, -15590, -15604, -15604, -15625, -15635, -15655, -15655, -15655, -15655, -15655, -15665, -15675, -15675, -15675, -15675, -15675, -15682, -15682, -15682, -15694, -15719, -15749, -15749, -15794, -15794, -15837, -15854, -15854, -15861, -15861, -15861, -15861, -15884, -15900, -15911, -15931, -15931, -15931, -15931, -15931, -15963, -15963, -15996, -16006, -16013, -16024, -16034, -16049, -16049, -16049, -16059, -16059, -16059, -16059, -16059, -16059, -16059, -16064, -16075, -16104, -16104, -16117, -16124, -16124, -16124, -16124, -16130, -16145, -16159, -16190, -16193, -16196, -16210, -16224, -16243, -16255, -16261, -16280, -16283, -16292, -16295, -16295, -16301, -16304, -16322, -16325, -16328, -16349, -16355, -16382, -16408, -16414, -16414, -16414, -16458, -16477, -16480, -16485, -16488, -16514, -16520, -16530, -16530, -16546, -16562, -16597, -16603, -16622, -16622, -16646, -16669, -16672, -16715, -16715, -16715, -16718, -16718, -16727, -16733, -16752, -16770, -16787, -16794, -16810, -16827, -16840, -16850, -16876, -16901, -16901, -16901, -16916, -16919, -16926, -16943, -16972, -16978, -16978, -16978, -16981, -17008, -17008, -17016, -17053, -17053, -17053, -17053, -17072, -17086, -17105, -17139, -17153, -17162, -17162, -17177, -17177, -17177, -17177, -17195, -17218, -17221, -17221, -17237, -17276, -17276, -17300, -17319, -17339, -17357, -17370, -17383, -17400, -17407, -17419, -17439, -17439, -17449, -17465, -17475, -17504, -17527, -17527, -17534, -17548, -17564, -17564, -17598, -17598, -17601, -17630, -17649, -17669, -17669, -17679, -17686, -17757, -17776, -17796, -17810, -17840, -17840, -17877, -17884, -17884, -17911, -17936, -17970, -17980, -17995, -17995, -18008, -18011, -18036, -18075, -18097, -18097, -18104, -18115, -18115, -18129, -18134, -18141, -18141, -18157, -18180, -18190, -18217, -18224, -18252, -18284, -18284, -18296, -18299, -18312, -18322, -18338, -18348, -18348, -18363, -18372, -18387, -18387, -18390, -18402, -18445, -18445, -18445, -18466, -18479, -18479, -18498, -18508, -18511, -18511, -18511, -18511, -18511, -18526, -18558, -18586, -18622, -18643, -18670, -18686, -18710, -18720, -18739, -18739, -18742, -18745, -18771, -18774, -18777, -18791, -18813, -18816, -18822, -18839, -18845, -18851, -18854, -18878, -18881, -18896, -18896, -18899, -18926, -18937, -18940, -18953, -18963, -19010, -19010, -19017, -19046, -19060, -19060, -19087, -19095, -19101, -19101, -19128, -19146, -19157, -19157, -19188, -19198, -19205, -19223, -19230, -19255, -19280, -19280, -19283, -19292, -19301, -19320, -19323, -19323, -19341, -19341, -19365, -19378, -19381, -19394, -19423, -19433, -19440, -19466, -19490, -19490, -19490, -19497, -19504, -19511, -19511, -19518, -19545, -19568, -19575, -19575, -19583, -19586, -19592, -19592, -19609, -19622, -19629, -19641, -19641, -19656, -19673, -19700, -19723, -19733, -19746, -19759, -19769, -19782, -19789, -19795, -19831, -19834, -19841, -19851, -19854, -19880, -19895, -19898, -19898, -19911, -19922, -19950, -20020, -20030, -20059, -20062, -20089, -20107, -20151, -20154, -20175, -20205, -20208, -20229, -20229, -20255, -20261, -20261, -20283, -20335, -20362, -20385, -20392, -20392, -20392, -20392, -20418, -20418, -20418, -20418, -20443, -20446, -20446, -20452, -20452, -20467, -20467, -20489, -20489, -20498, -20525, -20554, -20560, -20575, -20589, -20589, -20589, -20614, -20652, -20659, -20659, -20668, -20679, -20679, -20679, -20685, -20685, -20685, -20685, -20685, -20685, -20696, -20733, -20760, -20766, -20769, -20792, -20792, -20792, -20792, -20813, -20813, -20813, -20813, -20826, -20826, -20846, -20862, -20880, -20887, -20901, -20908, -20933, -20938, -20958, -20969, -20978, -20978, -20978, -20985, -20985, -20985, -21000, -21010, -21010, -21014, -21026, -21033, -21041, -21041, -21051, -21051, -21064, -21071, -21113, -21120, -21120, -21127, -21134, -21142, -21164, -21164, -21164, -21188, -21195, -21208, -21215, -21226, -21226, -21226, -21238, -21249, -21255, -21255, -21265, -21279, -21296, -21301, -21315, -21321, -21331, -21331, -21331, -21337, -21343, -21343, -21351, -21351, -21361, -21368, -21383, -21383, -21389, -21413, -21437, -21449, -21462, -21478, -21506, -21534, -21546, -21546, -21557, -21580, -21595, -21595, -21595, -21595, -21626, -21626, -21646, -21670, -21676, -21688, -21688, -21716, -21731, -21762, -21762, -21762, -21762, -21762, -21783, -21789, -21799, -21828, -21828, -21837, -21845, -21868, -21874, -21874, -21880, -21880, -21889, -21901, -21910, -21941, -21941, -21959, -21959, -21959, -21966, -21966, -21972, -21972, -21995, -22011, -22043, -22043, -22051, -22051, -22060, -22060, -22060, -22074, -22086, -22086, -22099, -22099, -22120, -22120, -22134, -22144, -22150, -22158, -22164, -22164, -22171, -22199, -22210, -22210, -22210, -22220, -22228, -22228, -22239, -22261, -22304, -22304, -22312, -22349, -22349, -22349, -22357, -22381, -22381, -22390, -22390, -22390, -22390, -22402, -22413, -22413, -22422, -22422, -22445, -22445, -22445, -22456, -22456, -22469, -22479, -22501, -22512, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22540, -22540, -22546, -22546, -22546, -22546, -22569, -22591, -22591, -22591, -22591, -22610, -22655, -22655, -22667, -22667, -22677, -22677, -22692, -22692, -22702, -22702, -22702, -22717, -22736, -22750, -22755, -22780, -22785, -22822, -22844, -22859, -22871, -22909, -22949, -22962, -22973, -22979, -22988, -23007, -23027, -23035, -23072, -23082, -23082, -23109, -23116, -23130, -23158, -23166, -23166, -23172, -23177, -23189, -23219, -23219, -23250, -23273, -23281, -23281, -23281, -23281, -23281, -23287, -23287, -23299, -23305, -23315, -23315, -23321, -23328, -23334, -23355, -23355, -23355, -23355, -23355, -23366, -23390, -23396, -23396, -23396, -23396, -23402, -23418, -23424, -23424, -23438, -23446, -23446, -23446, -23500, -23525, -23569, -23592, -23592, -23592, -23605, -23614, -23614, -23614, -23627, -23633, -23657, -23673, -23673, -23673, -23689, -23689, -23701, -23701, -23701, -23713, -23713, -23713, -23738, -23758, -23775, -23775, -23794, -23794, -23803, -23803, -23803, -23803, -23813, -23826, -23845, -23845, -23845, -23845, -23872, -23872, -23872, -23888, -23888, -23900, -23900, -23906, -23906, -23906, -23906, -23906, -23924, -23924, -23924, -23930, -23930, -23939, -23949, -23971, -23971, -23971, -24000, -24012, -24042, -24042, -24042, -24042, -24042, -24070, -24076, -24094, -24094, -24094, -24123, -24123, -24123, -24134, -24150, -24150, -24150, -24150, -24150, -24150, -24155, -24179, -24179, -24189, -24189, -24189, -24198, -24198, -24218, -24218, -24218, -24234, -24251, -24257, -24276, -24305, -24321, -24321, -24321, -24334, -24334, -24334, -24349, -24356, -24361, -24372, -24372, -24372, -24388, -24396, -24396, -24402, -24410, -24410, -24428, -24428, -24450, -24450, -24467, -24485, -24495, -24495, -24495, -24507, -24507, -24514, -24531, -24531, -24531, -24531, -24531, -24537, -24537, -24558, -24572, -24584, -24584, -24601, -24601, -24607, -24615, -24615, -24632, -24632, -24632, -24632, -24661, -24676, -24676, -24724, -24751, -24751, -24774, -24774, -24783, -24793, -24793, -24793, -24813, -24819, -24819, -24826, -24826, -24842, -24858, -24872, -24872, -24890, -24890, -24890, -24890, -24890, -24890, -24890, -24890, -24890, -24906, -24906, -24917, -24928, -24947, -24947, -24947, -24947, -24947, -24947, -24947, -24947, -24947, -24963, -24983, -24991, -24991, -24991, -24991, -24991, -24991, -24991, -24991, -25007, -25007, -25007, -25007, -25007, -25007, -25007, -25030, -25040, -25040, -25040, -25040, -25040, -25059, -25097, -25132, -25149, -25159, -25169, -25169, -25169, -25192, -25192, -25192, -25192, -25205, -25205, -25216, -25221, -25221, -25233, -25233, -25240, -25250, -25256, -25273, -25273, -25303, -25321, -25321, -25321, -25333, -25333, -25333, -25333, -25370, -25370, -25402, -25418, -25418, -25439, -25439, -25454, -25454, -25454, -25463, -25477, -25526, -25526, -25526, -25526, -25545, -25562, -25572, -25572, -25582, -25582, -25582, -25597, -25610, -25634, -25641, -25641, -25641, -25668, -25668, -25675, -25707, -25727, -25727, -25741, -25756, -25756, -25779, -25811, -25811, -25811, -25817, -25817, -25817, -25827, -25827, -25827, -25827, -25827, -25836, -25836, -25836, -25836, -25850, -25850, -25860, -25884, -25901, -25922, -25936, -25946, -25969, -25969, -25969, -25969, -25975, -25975, -25987, -25987, -26065, -26065, -26065, -26084, -26084, -26103, -26128, -26141, -26151, -26169, -26169, -26169, -26180, -26191, -26191, -26191, -26197, -26197, -26205, -26211, -26235, -26235, -26235, -26235, -26235, -26235, -26245, -26245, -26259, -26259, -26259, -26259, -26284, -26284, -26325, -26325, -26355, -26364, -26364, -26402, -26418, -26418, -26425, -26432, -26432, -26454, -26504, -26513, -26525, -26525, -26525, -26525, -26525, -26545, -26545, -26571, -26590, -26597, -26597, -26597, -26597, -26597, -26639, -26648, -26659, -26666, -26672, -26672, -26672, -26672, -26672, -26694, -26701, -26701, -26701, -26724, -26724, -26746, -26753, -26774, -26774, -26774, -26774, -26806, -26824, -26824, -26830, -26852, -26882, -26882, -26889, -26889, -26889, -26889, -26889, -26889, -26903, -26911, -26918, -26918, -26928, -26948, -26948, -26970, -26970, -26985, -26996, -27045, -27045, -27058, -27058, -27068, -27068, -27104, -27155, -27155, -27155, -27155, -27155, -27172, -27172, -27172, -27172, -27189, -27195, -27195, -27223, -27223, -27223, -27223, -27244, -27290, -27322, -27332, -27364, -27371, -27371, -27371, -27401, -27401, -27417, -27417, -27431, -27470, -27470, -27470, -27470, -27484, -27484, -27484, -27484, -27484, -27496, -27496, -27515, -27515, -27543, -27560, -27576, -27604, -27622, -27631, -27631, -27638, -27649, -27672, -27682, -27682, -27682, -27707, -27717, -27724, -27732, -27755, -27755, -27755, -27768, -27768, -27783, -27789, -27799, -27799, -27799, -27818, -27826, -27838, -27848, -27848, -27848, -27855, -27862, -27862, -27896, -27921, -27921, -27943, -27954, -27954, -27976, -27976, -27976, -27985, -28002, -28012, -28019, -28034, -28034, -28046, -28068, -28097, -28122, -28122, -28131, -28137, -28151, -28151, -28172, -28190, -28196, -28211, -28211, -28264, -28273, -28286, -28324, -28324, -28324, -28354, -28354, -28361, -28397, -28417, -28417, -28424, -28435, -28461, -28461, -28470, -28483, -28483, -28483, -28483, -28483, -28483, -28483, -28515, -28531, -28531, -28549, -28575, -28575, -28575, -28582, -28599, -28615, -28630, -28630, -28672, -28711, -28723, -28723, -28731, -28752, -28752, -28752, -28763, -28763, -28775, -28775, -28775, -28775, -28775, -28775, -28805, -28814, -28830, -28861, -28882, -28882, -28902, -28918, -28937, -28952, -28959, -28998, -29009, -29009, -29009, -29009, -29019, -29019, -29019, -29019, -29019, -29057, -29069, -29076, -29076, -29076, -29076, -29076, -29082, -29082, -29082, -29117, -29117, -29117, -29117, -29134, -29134, -29159, -29159, -29185, -29185, -29196, -29196, -29242, -29248, -29256, -29280, -29301, -29307, -29307, -29307, -29314, -29314, -29338, -29356, -29367, -29367, -29381, -29391, -29399, -29399, -29414, -29434, -29434, -29441, -29473, -29484, -29503, -29520, -29520, -29548, -29565, -29572, -29572, -29572, -29572, -29572, -29597, -29597, -29620, -29655, -29660, -29660, -29660, -29667, -29674, -29688, -29698, -29705, -29728, -29740, -29740, -29761, -29761, -29767, -29780, -29787, -29794, -29794, -29807, -29820, -29820, -29820, -29820, -29832, -29844, -29855, -29855, -29855, -29867, -29867, -29867, -29867, -29881, -29881, -29905, -29905, -29905, -29923, -29923, -29948, -29948, -29948, -29976, -29986, -29996, -29996, -30030, -30030, -30054, -30054, -30070, -30070, -30070, -30077, -30077, -30087, -30107, -30107, -30115, -30141, -30178, -30178, -30201, -30201, -30201, -30207, -30229, -30239, -30254, -30268, -30277, -30311, -30323, -30323, -30331, -30331, -30331, -30331, -30331, -30353, -30365, -30374, -30374, -30374, -30380, -30380, -30380, -30380, -30410, -30410, -30410, -30443, -30443, -30453, -30462, -30472, -30472, -30472, -30472, -30472, -30472, -30489, -30500, -30500, -30500, -30532, -30532, -30553, -30577, -30599, -30599, -30609, -30640, -30640, -30640, -30664, -30676, -30676, -30676, -30692, -30719, -30728, -30728, -30742, -30742, -30749, -30749, -30760, -30770, -30770, -30783, -30783, -30783, -30804, -30847, -30847, -30847, -30847, -30857, -30857, -30857, -30857, -30875, -30875, -30895, -30895, -30921, -30926, -30926, -30926, -30945, -30945, -30945, -30945, -30959, -30959, -30959, -30959, -30972, -30972, -30984, -31011, -31011, -31048, -31056, -31056, -31070, -31077, -31077, -31110, -31110, -31115, -31122, -31139, -31159, -31159, -31165, -31171, -31171, -31197, -31204, -31211, -31211, -31221, -31228, -31228, -31245, -31245, -31245, -31252, -31265, -31265, -31265, -31265, -31294, -31305, -31320, -31333, -31333, -31333, -31343, -31350, -31357, -31369, -31369, -31379, -31385, -31391, -31407, -31407, -31407, -31423, -31423, -31423, -31434, -31454, -31470, -31511, -31521, -31521, -31521, -31542, -31582, -31582, -31597, -31597, -31597, -31614, -31623, -31645, -31645, -31661, -31661, -31669, -31669, -31676, -31676, -31706, -31720, -31726, -31743, -31785, -31804, -31817, -31817, -31835, -31846, -31863, -31885, -31885, -31896, -31907, -31907, -31907, -31922, -31922, -31929, -31929, -31929, -31936, -31943, -31949, -31949, -31949, -31959, -32006, -32024, -32031, -32031, -32038, -32063, -32095, -32095, -32105, -32105, -32105, -32105, -32105, -32125, -32134, -32140, -32176, -32185, -32195, -32195, -32195, -32195, -32202, -32202, -32218, -32236, -32259, -32294, -32300, -32305, -32305, -32305, -32323, -32337, -32352, -32359, -32374, -32381, -32388, -32388, -32388, -32402, -32402, -32402, -32402, -32418, -32428, -32428, -32428, -32450, -32450, -32450, -32462, -32467, -32480, -32480, -32480, -32487, -32502, -32509, -32525, -32560, -32570, -32583, -32597, -32623, -32637, -32644, -32667, -32707, -32725, -32725, -32747, -32747, -32751, -32758, -32789, -32807, -32824, -32824, -32824, -32824, -32843, -32843, -32850, -32876, -32908, -32915, -32946, -32965, -32965, -32982, -33002, -33009, -33029, -33064, -33084, -33098, -33098, -33098, -33098, -33110, -33110, -33151, -33158, -33180, -33198, -33205, -33227, -33227, -33237, -33237, -33253, -33258, -33277, -33292, -33315, -33315, -33333, -33348, -33348, -33348, -33348, -33348, -33348, -33348, -33355, -33355, -33355, -33390, -33408, -33423, -33437, -33452, -33458, -33465, -33480, -33480, -33487, -33494, -33504, -33511, -33551, -33551, -33558, -33589, -33595, -33595, -33602, -33627, -33644, -33668, -33668, -33668, -33676, -33676, -33716, -33728, -33747, -33747, -33769, -33775, -33789, -33803, -33803, -33810, -33810, -33810, -33820, -33820, -33820, -33820, -33843, -33843, -33843, -33879, -33889, -33889, -33889, -33903, -33917, -33931, -33959, -33993, -34000, -34014, -34037, -34043, -34055, -34055, -34077, -34083, -34090, -34099, -34099, -34115, -34115, -34133, -34140, -34167, -34172, -34184, -34221, -34245, -34252, -34252, -34259, -34318, -34318, -34325, -34325, -34352, -34400, -34415, -34422, -34422, -34431, -34438, -34445, -34445, -34473, -34473, -34489, -34489, -34489, -34489, -34499, -34499, -34499, -34516, -34536, -34551, -34564, -34580, -34580, -34580, -34589, -34589, -34589, -34613, -34648, -34648, -34648, -34655, -34664, -34681, -34681, -34698, -34698, -34720, -34736, -34749, -34749, -34765, -34778, -34785, -34795, -34819, -34819, -34829, -34841, -34848, -34854, -34854, -34854, -34878, -34894, -34894, -34900, -34917, -34934, -34940, -34970, -34998, -34998, -35004, -35004, -35012, -35012, -35012, -35020, -35020, -35032, -35038, -35062, -35062, -35062, -35068, -35068, -35082, -35092, -35096, -35107, -35118, -35134, -35155, -35155, -35166, -35178, -35178, -35195, -35201, -35201, -35201, -35226, -35226, -35226, -35226, -35256, -35262, -35272, -35280, -35299, -35332, -35354, -35354, -35354, -35370, -35386, -35417, -35417, -35460, -35473, -35478, -35495, -35504, -35504, -35518, -35552, -35589, -35624, -35624, -35637, -35637, -35643, -35643, -35669, -35682, -35695, -35702, -35709, -35709, -35726, -35739, -35749, -35756, -35756, -35778, -35803, -35810, -35829, -35883, -35899, -35905, -35911, -35911, -35923, -35947, -35954, -35980, -35987, -36034, -36052, -36063, -36095, -36106, -36106, -36113, -36120, -36140, -36140, -36153, -36160, -36160, -36167, -36203, -36203, -36218, -36218, -36225, -36253, -36259, -36284, -36296, -36310, -36324, -36331, -36344, -36367, -36367, -36367, -36412, -36412, -36422, -36463, -36463, -36463, -36479, -36490, -36513, -36520, -36520, -36527, -36527, -36527, -36540, -36574, -36594, -36594, -36605, -36621, -36621, -36641, -36641, -36641, -36659, -36682, -36682, -36682, -36682, -36705, -36705, -36705, -36720, -36720, -36755, -36755, -36771, -36771, -36771, -36788, -36806, -36835, -36845, -36875, -36875, -36903, -36921, -36928, -36928, -36940, -36940, -36940, -36966, -36966, -36973, -36983, -36998, -37004, -37014, -37024, -37024, -37032, -37038, -37038, -37061, -37074, -37074, -37091, -37098, -37105, -37105, -37133, -37141, -37141, -37148, -37191, -37191, -37197, -37197, -37210, -37224, -37224, -37231, -37250, -37257, -37273, -37273, -37280, -37287, -37294, -37300, -37307, -37330, -37348, -37348, -37359, -37359, -37359, -37377, -37392, -37398, -37412, -37431, -37469, -37486, -37508, -37517, -37535, -37535, -37542, -37542, -37549, -37549, -37549, -37549, -37556, -37576, -37576, -37583, -37590, -37597, -37604, -37604, -37621, -37635, -37676, -37676, -37704, -37711, -37728, -37728, -37737, -37737, -37737, -37750, -37757, -37778, -37785, -37785, -37819, -37826, -37833, -37843, -37850, -37869, -37914, -37921, -37935, -37942, -37949, -37982, -38013, -38013, -38013, -38023, -38057, -38077, -38097, -38110, -38117, -38123, -38133, -38133, -38133, -38140, -38140, -38148, -38159, -38179, -38192, -38205, -38218, -38218, -38218, -38218, -38218, -38218, -38218, -38218, -38218, -38218, -38218, -38218, -38225, -38225, -38230, -38246, -38258, -38280, -38287, -38294, -38294, -38294, -38301, -38318, -38318, -38340, -38371, -38371, -38384, -38420, -38440, -38453, -38481, -38506, -38522, -38534, -38559, -38559, -38559, -38564, -38564, -38581, -38604, -38604, -38611, -38620, -38626, -38635, -38635, -38635, -38666, -38674, -38688, -38693, -38710, -38722, -38722, -38722, -38729, -38734, -38752, -38792, -38818, -38825, -38861, -38902, -38934, -38949, -38949, -38960, -38969, -38985, -38985, -38996, -39013, -39024, -39024, -39032, -39061, -39074, -39089, -39123, -39123, -39123, -39140, -39161, -39180, -39206, -39215, -39254, -39261, -39277, -39284, -39314, -39314, -39330, -39340, -39340, -39371, -39371, -39392, -39430, -39430, -39437, -39444, -39461, -39468, -39468, -39485, -39517, -39524, -39538, -39543, -39548, -39555, -39581, -39588, -39588, -39609, -39609, -39616, -39652, -39670, -39677, -39677, -39684, -39691, -39702, -39717, -39717, -39717, -39724, -39749, -39760, -39766, -39775, -39791, -39791, -39814, -39827, -39827, -39837, -39859}; - -static const char tldData[] = { -"com.cn\0" -"com.co\0" -"hb.cn\0" -"med.br\0conf.lv\0wallonie.museum\0" -"namsos.no\0" -"\xe7\xb6\xb2\xe7\xbb\x9c.hk\0farmers.museum\0rel.pl\0" -"com.cu\0" -"military.museum\0" -"*.jm\0convent.museum\0cymru.museum\0malvik.no\0" -"univ.sn\0" -"gliding.aero\0" -"wodzislaw.pl\0" -"com.dm\0!pref.iwate.jp\0tran\xc3\xb8y.no\0pila.pl\0" -"mb.it\0*.ke\0lib.ri.us\0" -"com.ec\0*.kh\0tr\xc3\xb8gstad.no\0" -"com.ee\0" -"mobi.gp\0" -"gran.no\0" -"wa.gov.au\0" -"com.dz\0kg.kr\0" -"zoological.museum\0gjerstad.no\0haugesund.no\0kharkov.ua\0" -"walbrzych.pl\0" -"civilization.museum\0" -"ha.no\0" -"*.kw\0" -"med.ec\0com.es\0" -"med.ee\0otago.museum\0svelvik.no\0" -"art.ht\0amber.museum\0elvendrell.museum\0rost.no\0" -"jx.cn\0gratangen.no\0" -"association.aero\0ca.it\0" -"zaporizhzhe.ua\0" -"com.fr\0" -"szex.hu\0" -"e-burg.ru\0" -"com.ge\0bokn.no\0" -"mordovia.ru\0" -"com.gh\0*.mm\0" -"com.gi\0z.se\0" -"cahcesuolo.no\0" -"hurdal.no\0joshkar-ola.ru\0" -"cadaques.museum\0ma.us\0" -"a.bg\0" -"com.gn\0bozen.it\0tambov.ru\0" -"*.gifu.jp\0*.tokyo.jp\0*.mt\0" -"com.gp\0travel\0cc.tx.us\0" -"com.gr\0hemne.no\0" -"*.ni\0" -"*.mz\0" -"cc.il.us\0" -"com.gy\0" -"zj.cn\0oksnes.no\0museum.tt\0" -"com.hk\0*.np\0" -"rc.it\0baseball.museum\0" -"com.hn\0exhibition.museum\0" -"h\xc3\xa1""bmer.no\0" -"com.hr\0" -"fg.it\0stathelle.no\0defense.tn\0" -"com.ht\0" -"qld.gov.au\0*.nz\0" -"davvenj\xc3\xa1rga.no\0*.om\0" -"vang.no\0" -"*.kumamoto.jp\0" -"vercelli.it\0usenet.pl\0" -"com.io\0stalbans.museum\0" -"com.iq\0" -"*.pg\0" -"com.is\0klabu.no\0skiptvet.no\0" -"med.ht\0field.museum\0" -"gr.it\0gj\xc3\xb8vik.no\0tromsa.no\0lib.mi.us\0" -"ca.na\0" -"hagebostad.no\0k12.ma.us\0" -"*.qa\0" -"*.niigata.jp\0" -"monzaebrianza.it\0com.jo\0comunica\xc3\xa7\xc3\xb5""es.museum\0" -"gr.jp\0" -"ballangen.no\0*.py\0" -"scienceandindustry.museum\0" -"nuoro.it\0com.kg\0" -"com.ki\0" -"im.it\0idv.tw\0" -"*.akita.jp\0com.km\0r\xc3\xb8ros.no\0sopot.pl\0" -"!pref.yamanashi.jp\0" -"com.kp\0" -"!pref.kochi.jp\0com.la\0" -"com.lb\0" -"com.lc\0stjordalshalsen.no\0sigdal.no\0cc.nm.us\0" -"samnanger.no\0" -"drobak.no\0" -"vt.it\0" -"catering.aero\0com.ky\0" -"com.kz\0cc.ca.us\0" -"com.lk\0" -"grosseto.it\0mosvik.no\0" -"namsskogan.no\0" -"loten.no\0" -"chirurgiens-dentistes.fr\0" -"com.lr\0bremanger.no\0" -"gs.cn\0" -"com.lv\0lib.co.us\0" -"com.mg\0" -"passenger-association.aero\0" -"com.ly\0yekaterinburg.ru\0" -"vladivostok.ru\0" -"com.mk\0beeldengeluid.museum\0" -"com.ml\0" -"art.pl\0" -"com.mo\0" -"britishcolumbia.museum\0tx.us\0" -"com.na\0sakhalin.ru\0*.sv\0" -"mc.it\0" -"amsterdam.museum\0udm.ru\0" -"com.mu\0" -"com.mv\0com.nf\0" -"com.mw\0com.ng\0il.us\0" -"geometre-expert.fr\0com.mx\0" -"med.ly\0com.my\0" -"ag.it\0" -"*.tr\0" -"!pref.oita.jp\0" -"hoyanger.no\0skedsmo.no\0" -"com.nr\0turystyka.pl\0" -"koebenhavn.museum\0" -"quebec.museum\0" -"stord.no\0*.uk\0" -"act.au\0" -"br.it\0cb.it\0gyeonggi.kr\0jobs.tt\0lib.hi.us\0" -"*.ve\0" -"*.saga.jp\0wildlife.museum\0com.pa\0" -"monzabrianza.it\0sciencehistory.museum\0stange.no\0oskol.ru\0principe.st\0*.uy\0" -"plaza.museum\0com.pe\0" -"com.pf\0" -"eigersund.no\0" -"com.ph\0" -"manx.museum\0marylhurst.museum\0" -"md.ci\0pi.it\0schweiz.museum\0com.pk\0" -"grp.lk\0fr\xc3\xb8ya.no\0com.pl\0press.se\0" -"us.com\0" -"b.bg\0cremona.it\0communication.museum\0art.sn\0" -"med.pa\0" -"com.pr\0" -"com.ps\0" -"com.pt\0" -"k12.in.us\0" -"ah.cn\0bahcavuotna.no\0" -"sondrio.it\0arkhangelsk.ru\0" -"cargo.aero\0" -"council.aero\0" -"museum.mv\0hattfjelldal.no\0spydeberg.no\0med.pl\0" -"niepce.museum\0museum.mw\0" -"anthropology.museum\0" -"pharmacien.fr\0smola.no\0" -"fin.ec\0" -"selbu.no\0" -"workinggroup.aero\0nm.us\0" -"museum.no\0com.re\0" -"cc.vt.us\0" -"village.museum\0" -"ca.us\0" -"*.sapporo.jp\0" -"teramo.it\0" -"com.ro\0" -"*.ye\0" -"com.sa\0" -"com.sb\0" -"so.it\0com.sc\0" -"jolster.no\0com.sd\0" -"com.ru\0" -"com.rw\0com.sg\0" -"sydney.museum\0" -"sa.edu.au\0" -"tom.ru\0" -"com.sl\0*.za\0" -"\xe7\xbd\x91\xe7\xb5\xa1.hk\0naturbruksgymn.se\0com.sn\0" -"assedic.fr\0com.so\0" -"!pref.mie.jp\0*.yu\0" -"med.sa\0" -"newspaper.museum\0holmestrand.no\0dnepropetrovsk.ua\0" -"christiansburg.museum\0roan.no\0" -"pesaro-urbino.it\0med.sd\0com.st\0" -"s\xc3\xb8gne.no\0" -"nuernberg.museum\0" -"*.zm\0" -"com.sy\0" -"*.nagano.jp\0com.tj\0" -"nt.gov.au\0news.hu\0paderborn.museum\0" -"boston.museum\0" -"com.tn\0" -"com.to\0" -"broadcast.museum\0" -"com.ua\0" -"*.zw\0" -"baikal.ru\0" -"bykle.no\0com.tt\0" -"verdal.no\0" -"roros.no\0" -"fi.cr\0carboniaiglesias.it\0chuvashia.ru\0com.tw\0" -"k12.ca.us\0" -"eidsvoll.no\0" -"*.ishikawa.jp\0" -"dolls.museum\0" -"naval.museum\0" -"karasjok.no\0tysvar.no\0" -"bielawa.pl\0com.vc\0" -"svalbard.no\0deatnu.no\0rnd.ru\0" -"grandrapids.museum\0" -"bauern.museum\0k12.pr.us\0" -"press.ma\0" -"*.kagawa.jp\0fribourg.museum\0przeworsk.pl\0com.vi\0" -"com.uz\0" -"babia-gora.pl\0" -"com.vn\0" -"med.pro\0" -"suedtirol.it\0kursk.ru\0" -"bonn.museum\0" -"lt.it\0" -"design.aero\0microlight.aero\0americanantiques.museum\0meland.no\0" -"insurance.aero\0aarborte.no\0" -"kh.ua\0" -"macerata.it\0architecture.museum\0" -"rovigo.it\0rawa-maz.pl\0" -"store.nf\0levanger.no\0" -"b\xc3\xa1jddar.no\0" -"not.br\0" -"com.ws\0" -"!pref.kagawa.jp\0" -"!omanpost.om\0" -"vt.us\0" -"gs.ah.no\0vladikavkaz.ru\0" -"no.it\0" -"in.na\0szkola.pl\0a.se\0" -"aid.pl\0" -"workshop.museum\0vegarshei.no\0" -"sund.no\0" -"bs.it\0flora.no\0" -"agriculture.museum\0" -"koeln.museum\0" -"minnesota.museum\0k12.il.us\0" -"froya.no\0" -"aeroport.fr\0" -"davvenjarga.no\0zgora.pl\0ivano-frankivsk.ua\0" -"*.gunma.jp\0" -"amot.no\0" -"mus.br\0chungbuk.kr\0" -"ggf.br\0lorenskog.no\0" -"jeonbuk.kr\0" -"k12.vi.us\0" -"c.bg\0sande.more-og-romsdal.no\0" -"perugia.it\0" -"massa-carrara.it\0" -"michigan.museum\0" -"archaeology.museum\0mosj\xc3\xb8""en.no\0czest.pl\0koenig.ru\0\xe0\xb6\xbd\xe0\xb6\x82\xe0\xb6\x9a\xe0\xb7\x8f\0" -"mobi.tt\0" -"kraanghke.no\0" -"cc.in.us\0" -"re.it\0lib.vt.us\0" -"dell-ogliastra.it\0" -"s\xc3\xb8mna.no\0" -"k12.wv.us\0" -"gok.pk\0fh.se\0" -"luzern.museum\0" -"fi.it\0swidnica.pl\0" -"cbg.ru\0" -"latina.it\0" -"vibovalentia.it\0" -"modum.no\0" -"safety.aero\0" -"sp.it\0" -"science.museum\0ah.no\0" -"norddal.no\0" -"cc.na\0" -"re.kr\0" -"dielddanuorri.no\0" -"force.museum\0" -"torino.it\0cc.md.us\0" -"artanddesign.museum\0pisz.pl\0" -"olsztyn.pl\0" -"unsa.ba\0rade.no\0vinnica.ua\0" -"in.rs\0astrakhan.ru\0" -"sogne.no\0" -"homebuilt.aero\0" -"polkowice.pl\0" -"hole.no\0health.vn\0" -"fj.cn\0" -"davvesiida.no\0" -"vic.au\0" -"kongsberg.no\0" -"pub.sa\0" -"vv.it\0" -"!pref.tottori.jp\0" -"*.sendai.jp\0in.th\0" -"lib.pa.us\0" -"chiropractic.museum\0" -"mobi.na\0aca.pro\0" -"konyvelo.hu\0sciencecenters.museum\0" -"he.cn\0" -"in.ua\0" -"!city.nagoya.jp\0" -"muenchen.museum\0" -"psi.br\0" -"maryland.museum\0" -"!statecouncil.om\0" -"tr\xc3\xa6na.no\0" -"!pref.yamagata.jp\0jewishart.museum\0" -"lu.it\0me.it\0" -"chel.ru\0" -"tatarstan.ru\0" -"adult.ht\0in.us\0" -"kafjord.no\0" -"\xd7\x99\xd7\xa8\xd7\x95\xd7\xa9\xd7\x9c\xd7\x99\xd7\x9d.museum\0" -"net.ac\0k12.ec\0" -"net.ae\0bashkiria.ru\0" -"net.af\0!omantel.om\0" -"net.ag\0" -"net.ai\0" -"!pref.toyama.jp\0" -"net.al\0timekeeping.museum\0" -"net.an\0design.museum\0fin.tn\0" -"ethnology.museum\0" -"perso.ht\0asker.no\0b.se\0" -"net.ba\0" -"net.bb\0flanders.museum\0" -"mincom.tn\0" -"frana.no\0" -"bt.it\0" -"net.bh\0" -"auto.pl\0" -"net.az\0" -"treviso.it\0" -"war.museum\0" -"net.bm\0" -"langevag.no\0m\xc3\xa5lselv.no\0" -"net.bo\0" -"gol.no\0" -"folkebibl.no\0" -"net.br\0" -"net.bs\0troandin.no\0saotome.st\0lib.tn.us\0" -"md.us\0k12.ut.us\0" -"d.bg\0cambridge.museum\0\xc3\xa5s.no\0" -"net.ci\0" -"net.bz\0" -"sch.ae\0undersea.museum\0odda.no\0" -"net.cn\0" -"net.co\0c.la\0" -"gliwice.pl\0" -"aurskog-h\xc3\xb8land.no\0" -"andria-trani-barletta.it\0" -"net.cu\0loab\xc3\xa1t.no\0" -"rep.kp\0" -"\xe7\xbb\x84\xe7\xb9\x94.hk\0" -"gallery.museum\0" -"\xc3\xb8rland.no\0" -"store.ro\0" -"net.dm\0" -"somna.no\0" -"hemnes.no\0" -"ringebu.no\0k12.ky.us\0" -"net.ec\0" -"dn.ua\0" -"tarnobrzeg.pl\0" -"soc.lk\0" -"romsa.no\0" -"bamble.no\0" -"net.dz\0lutsk.ua\0" -"barlettatraniandria.it\0ta.it\0countryestate.museum\0" -"kaszuby.pl\0" -"*.yamaguchi.jp\0cranbrook.museum\0store.st\0" -"southcarolina.museum\0lib.md.us\0" -"textile.museum\0" -"cheltenham.museum\0hurum.no\0" -"*.oita.jp\0" -"shop.ht\0cc.me.us\0" -"shop.hu\0turin.it\0" -"louvre.museum\0" -"k12.ar.us\0" -"consulting.aero\0" -"gv.ao\0" -"sauherad.no\0" -"gv.at\0net.ge\0" -"ostre-toten.no\0lib.ok.us\0" -"net.gg\0pilots.museum\0" -"2000.hu\0geology.museum\0" -"net.gn\0" -"mazowsze.pl\0bir.ru\0" -"net.gp\0" -"net.gr\0" -"oxford.museum\0" -"per.la\0" -"eastafrica.museum\0" -"meeres.museum\0" -"net.gy\0*.shizuoka.jp\0" -"\xe5\x95\x86\xe6\xa5\xad.tw\0" -"net.hk\0" -"net.hn\0" -"philadelphiaarea.museum\0" -"osen.no\0" -"net.ht\0net.id\0" -"fundacio.museum\0" -"j\xc3\xb8rpeland.no\0" -"\xe6\x95\x99\xe8\x82\xb2.hk\0" -"divtasvuodna.no\0" -"student.aero\0sch.gg\0net.im\0" -"\xe7\xbd\x91\xe7\xbb\x9c.cn\0net.in\0" -"net.iq\0" -"net.ir\0" -"net.is\0" -"net.je\0" -"kepno.pl\0lapy.pl\0" -"per.nf\0" -"gov\0*.shimane.jp\0" -"artcenter.museum\0" -"k\xc3\xa5""fjord.no\0" -"net.jo\0" -"eu.int\0" -"c.se\0" -"net.kg\0" -"ce.it\0net.ki\0" -"sch.id\0os.hedmark.no\0" -"columbus.museum\0" -"arteducation.museum\0" -"net.kn\0" -"kr.com\0" -"net.la\0bushey.museum\0cc.gu.us\0" -"net.lb\0" -"net.lc\0" -"gs.bu.no\0" -"e164.arpa\0" -"chieti.it\0labour.museum\0" -"sch.ir\0creation.museum\0krodsherad.no\0" -"net.ky\0" -"net.kz\0me.us\0" -"e.bg\0sch.je\0net.lk\0" -"zlg.br\0suwalki.pl\0" -"\xe5\x80\x8b\xe4\xba\xba.hk\0net.ma\0" -"net.lr\0" -"sch.jo\0notaires.km\0net.me\0" -"net.lv\0karate.museum\0" -"net.ly\0karm\xc3\xb8y.no\0" -"rg.it\0" -"net.mk\0" -"net.ml\0evenes.no\0" -"ngo.lk\0net.mo\0egyptian.museum\0" -"marine.ru\0" -"realestate.pl\0" -"net.mu\0" -"net.mv\0net.nf\0" -"net.mw\0net.ng\0gda.pl\0" -"net.mx\0" -"freemasonry.museum\0net.my\0enebakk.no\0" -"karlsoy.no\0" -"\xe7\xbd\x91\xe7\xbb\x9c.hk\0\xc3\xb8rskog.no\0" -"randaberg.no\0" -"club.aero\0" -"certification.aero\0sr.it\0" -"center.museum\0so.gov.pl\0" -"caa.aero\0" -"sch.lk\0tvedestrand.no\0" -"net.nr\0" -"luroy.no\0" -"aukra.no\0s\xc3\xa1lat.no\0lib.me.us\0" -"ddr.museum\0" -"york.museum\0stryn.no\0k12.nm.us\0" -"per.sg\0" -"judaica.museum\0" -"verona.it\0" -"agdenes.no\0" -"cng.br\0sch.ly\0" -"net.pa\0" -"author.aero\0" -"naturalhistory.museum\0steiermark.museum\0bu.no\0" -"sn\xc3\xa5sa.no\0net.pe\0" -"net.ph\0" -"savannahga.museum\0batsfjord.no\0lib.oh.us\0" -"net.pk\0" -"net.pl\0" -"net.pn\0" -"washingtondc.museum\0" -"net.pr\0" -"net.ps\0" -"net.pt\0" -"nordkapp.no\0" -"emergency.aero\0krokstadelva.no\0" -"satx.museum\0ngo.ph\0omsk.ru\0" -"texas.museum\0" -"ngo.pl\0" -"mantova.it\0gu.us\0" -"!pref.shiga.jp\0isa.us\0" -"usa.museum\0" -"gb.net\0k12.vi\0" -"iveland.no\0" -"tempio-olbia.it\0" -"net.sa\0" -"net.sb\0" -"works.aero\0net.sc\0komvux.se\0" -"net.sd\0" -"net.ru\0" -"0.bg\0" -"forlicesena.it\0net.rw\0net.sg\0" -"klodzko.pl\0" -"detroit.museum\0wegrow.pl\0" -"net.sl\0" -"glogow.pl\0" -"store.bb\0air.museum\0" -"net.so\0" -"katowice.pl\0" -"nsk.ru\0" -"pisa.it\0eid.no\0" -"net.st\0" -"film.hu\0" -"tuva.ru\0d.se\0" -"net.th\0" -"net.sy\0" -"viterbo.it\0tsaritsyn.ru\0perso.sn\0net.tj\0" -"lib.gu.us\0" -"plc.co.im\0sec.ps\0" -"r\xc3\xa1hkker\xc3\xa1vju.no\0kazimierz-dolny.pl\0net.tn\0" -"net.to\0" -"veterinaire.km\0" -"net.ua\0" -"info.ht\0net.tt\0" -"info.hu\0" -"exchange.aero\0" -"sch.sa\0net.tw\0" -"andriatranibarletta.it\0perso.tn\0" -"f.bg\0malselv.no\0" -"net.vc\0" -"trana.no\0" -"ns.ca\0" -"net.vi\0" -"lucca.it\0oristano.it\0" -"usarts.museum\0net.vn\0" -"gon.pk\0" -"pl.ua\0" -"eastcoast.museum\0" -"novara.it\0" -"k12.ks.us\0" -"dp.ua\0" -"nesseby.no\0" -"!pref.wakayama.jp\0" -"repbody.aero\0" -"jamison.museum\0lugansk.ua\0" -"ss.it\0" -"alessandria.it\0" -"hadsel.no\0net.ws\0" -"\xe0\xae\x9a\xe0\xae\xbf\xe0\xae\x99\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x82\xe0\xae\xb0\xe0\xaf\x8d\0" -"veterinaire.fr\0leirfjord.no\0" -"massacarrara.it\0north.museum\0" -"project.museum\0" -"other.nf\0" -"k12.nh.us\0" -"mat.br\0artgallery.museum\0" -"sr.gov.pl\0" -"gamvik.no\0" -"info.ec\0lancashire.museum\0" -"fm.br\0ltd.co.im\0" -"americana.museum\0southwest.museum\0cc.ak.us\0" -"enna.it\0lunner.no\0" -"v\xc3\xa5gan.no\0" -"mari.ru\0" -"accident-investigation.aero\0" -"sor-aurdal.no\0lib.ny.us\0" -"novosibirsk.ru\0" -"bjugn.no\0" -"n\xc3\xa6r\xc3\xb8y.no\0ostrowwlkp.pl\0" -"info.bb\0foundation.museum\0" -"brand.se\0" -"info.at\0!pref.akita.jp\0l\xc3\xb8ten.no\0" -"coal.museum\0miners.museum\0" -"glass.museum\0" -"info.az\0" -"frog.museum\0szczytno.pl\0nov.ru\0" -"sunndal.no\0" -"gen.in\0" -"gx.cn\0" -"web.co\0*.mie.jp\0hobol.no\0\xe5\x8f\xb0\xe6\xb9\xbe\0" -"logistics.aero\0plo.ps\0" -"erotika.hu\0" -"torsken.no\0" -"exeter.museum\0" -"info.co\0" -"selje.no\0" -"storfjord.no\0" -"barum.no\0lind\xc3\xa5s.no\0" -"leasing.aero\0" -"championship.aero\0fst.br\0" -"lierne.no\0" -"!gobiernoelectronico.ar\0""1.bg\0" -"corporation.museum\0" -"al.it\0*.miyagi.jp\0" -"*.aomori.jp\0" -"\xd8\xa7\xd9\x84\xd8\xa7\xd8\xb1\xd8\xaf\xd9\x86\0" -"amursk.ru\0" -"vestvagoy.no\0" -"\xd8\xa7\xdb\x8c\xd8\xb1\xd8\xa7\xd9\x86.ir\0cc.fl.us\0" -"os.hordaland.no\0" -"pistoia.it\0" -"tver.ru\0e.se\0" -"res.in\0*.yamagata.jp\0syzran.ru\0" -"capebreton.museum\0sandnessj\xc3\xb8""en.no\0" -"ternopil.ua\0" -"shop.pl\0" -"tank.museum\0" -"m\xc3\xa5s\xc3\xb8y.no\0" -"potenza.it\0time.museum\0" -"mjondalen.no\0" -"eng.br\0nedre-eiker.no\0" -"air-surveillance.aero\0" -"nt.au\0am.br\0pn.it\0" -"oystre-slidre.no\0ug.gov.pl\0" -"g.bg\0nesodden.no\0vologda.ru\0" -"parma.it\0tula.ru\0" -"*.nara.jp\0ak.us\0" -"nt.ca\0konin.pl\0" -"kiev.ua\0" -"skierv\xc3\xa1.no\0vestre-toten.no\0" -"ri.it\0botanical.museum\0farsund.no\0veg\xc3\xa5rshei.no\0dagestan.ru\0" -"ind.br\0k-uralsk.ru\0" -"rahkkeravju.no\0cmw.ru\0" -"canada.museum\0" -"fm.it\0" -"cc.wi.us\0" -"web.id\0aver\xc3\xb8y.no\0" -"dudinka.ru\0" -"baghdad.museum\0fitjar.no\0grane.no\0" -"gs.fm.no\0" -"sumy.ua\0" -"al.no\0" -"westfalen.museum\0" -"oregon.museum\0" -"bruxelles.museum\0elk.pl\0" -"planetarium.museum\0sn\xc3\xa5""ase.no\0" -"s\xc3\xb8rreisa.no\0" -"gs.st.no\0skien.no\0" -"bible.museum\0ivanovo.ru\0" -"avellino.it\0" -"tgory.pl\0" -"family.museum\0" -"ppg.br\0k12.as.us\0" -"trader.aero\0gorlice.pl\0" -"cc.al.us\0" -"ogliastra.it\0" -"is.it\0lib.nv.us\0" -"dr.na\0" -"media.hu\0nesna.no\0fl.us\0" -"uri.arpa\0" -"bjerkreim.no\0" -"charter.aero\0" -"genova.it\0" -"it.ao\0botany.museum\0hapmir.no\0" -"educational.museum\0" -"helsinki.museum\0" -"memorial.museum\0" -"web.lk\0pharmacy.museum\0" -"aircraft.aero\0appspot.com\0" -"ferrara.it\0beskidy.pl\0" -"hi.cn\0" -"taxi.aero\0flekkefjord.no\0" -"varoy.no\0" -"ragusa.it\0ambulance.museum\0" -"can.museum\0" -"*.osaka.jp\0isleofman.museum\0fm.no\0warmia.pl\0" -"educator.aero\0asmatart.museum\0" -"mi.it\0" -"kutno.pl\0" -"skedsmokorset.no\0" -"2.bg\0" -"*.kagoshima.jp\0km.ua\0" -"!city.sendai.jp\0" -"web.nf\0st.no\0cc.ri.us\0" -"reggiocalabria.it\0" -"wi.us\0" -"ancona.it\0newjersey.museum\0nnov.ru\0" -"f.se\0" -"ind.in\0" -"info.vn\0" -"andoy.no\0" -"ch.it\0fredrikstad.no\0guovdageaidnu.no\0" -"fjaler.no\0" -"sa.com\0" -"gs.nt.no\0" -"masfjorden.no\0" -"pordenone.it\0" -"po.it\0basel.museum\0" -"chambagri.fr\0" -"h.bg\0web.pk\0" -"london.museum\0" -"sciencecenter.museum\0\xe0\xb9\x84\xe0\xb8\x97\xe0\xb8\xa2\0" -"unbi.ba\0augustow.pl\0" -"wolomin.pl\0" -"notaires.fr\0tcm.museum\0al.us\0" -"nu.ca\0!pref.nagano.jp\0" -"info.tn\0" -"lib.wa.us\0" -"ed.ao\0info.tt\0" -"barreau.bj\0" -"k12.wy.us\0" -"pp.az\0gop.pk\0" -"int\0" -"l\xc3\xb8renskog.no\0podhale.pl\0" -"voagat.no\0" -"telekommunikation.museum\0" -"qld.au\0" -"te.it\0freiburg.museum\0snasa.no\0" -"gjemnes.no\0" -"sejny.pl\0" -"media.pl\0" -"skjak.no\0" -"watchandclock.museum\0" -"ed.ci\0pacific.museum\0" -"theater.museum\0info.ro\0" -"uk.com\0" -"campobasso.it\0aquarium.museum\0tysv\xc3\xa6r.no\0" -"kragero.no\0" -"windmill.museum\0info.sd\0" -"sologne.museum\0sande.m\xc3\xb8re-og-romsdal.no\0" -"nt.no\0cc.mi.us\0" -"ed.cr\0" -"academy.museum\0zachpomor.pl\0" -"tananger.no\0v\xc3\xa1rgg\xc3\xa1t.no\0ri.us\0" -"federation.aero\0" -"web.tj\0" -"matta-varjjat.no\0" -"steigen.no\0" -"local\0akrehamn.no\0" -"!pref.chiba.jp\0info.pk\0" -"info.pl\0""6bone.pl\0" -"klepp.no\0kherson.ua\0" -"ketrzyn.pl\0info.pr\0" -"sweden.museum\0" -"lardal.no\0" -"!retina.ar\0gz.cn\0" -"barletta-trani-andria.it\0vikna.no\0" -"bearalv\xc3\xa1hki.no\0" -"broker.aero\0gov.nc.tr\0" -"info.na\0k12.fl.us\0" -"hembygdsforbund.museum\0" -"entertainment.aero\0jerusalem.museum\0l\xc3\xa6rdal.no\0" -"hitra.no\0sogndal.no\0" -"farmequipment.museum\0info.mv\0info.nf\0\xc3\xa5lg\xc3\xa5rd.no\0" -"la-spezia.it\0" -"skanland.no\0fam.pk\0" -"skole.museum\0" -"art.museum\0" -"presidio.museum\0" -"3.bg\0public.museum\0" -"h\xc3\xb8yanger.no\0zagan.pl\0" -"an.it\0" -"philadelphia.museum\0info.nr\0" -"pesarourbino.it\0g\xc3\xa1ivuotna.no\0" -"poltava.ua\0" -"nt.ro\0" -"station.museum\0" -"mi.th\0" -"altoadige.it\0" -"nu.it\0" -"usculture.museum\0g.se\0" -"h\xc3\xa1mm\xc3\xa1rfeasta.no\0" -"daegu.kr\0info.la\0" -"dovre.no\0" -"ci.it\0horology.museum\0" -"bergbau.museum\0" -"press.museum\0" -"gangwon.kr\0" -"!city.kitakyushu.jp\0sor-varanger.no\0cc.hi.us\0" -"fuossko.no\0" -"zp.ua\0" -"american.museum\0" -"fl\xc3\xa5.no\0mi.us\0" -"i.bg\0" -"od.ua\0" -"encyclopedic.museum\0" -"ind.tn\0" -"midatlantic.museum\0" -"newyork.museum\0" -"castres.museum\0" -"act.edu.au\0" -"topology.museum\0" -"ed.jp\0" -"of.by\0" -"iris.arpa\0inf.br\0askim.no\0pyatigorsk.ru\0" -"nord-fron.no\0nsn.us\0" -"beardu.no\0" -"agrar.hu\0corvette.museum\0chtr.k12.ma.us\0" -"figueres.museum\0" -"!pref.gunma.jp\0medizinhistorisches.museum\0" -"tjeldsund.no\0" -"nebraska.museum\0" -"bellevue.museum\0" -"abo.pa\0k12.al.us\0" -"info.ki\0" -"inf.cu\0sv.it\0" -"jfk.museum\0" -"!city.osaka.jp\0swinoujscie.pl\0" -"bydgoszcz.pl\0" -"!city.kyoto.jp\0" -"uvic.museum\0" -"madrid.museum\0steinkjer.no\0" -"lib.ma.us\0" -"sirdal.no\0" -"n\xc3\xb8tter\xc3\xb8y.no\0" -"taranto.it\0starnberg.museum\0" -"vic.gov.au\0pvt.ge\0pors\xc3\xa1\xc5\x8bgu.no\0" -"naroy.no\0ris\xc3\xb8r.no\0" -"va.it\0salem.museum\0starachowice.pl\0" -"!nawrastelecom.om\0" -"town.museum\0te.ua\0" -"se.net\0" -"kemerovo.ru\0" -"lerdal.no\0" -"gs.va.no\0" -"kms.ru\0" -"consulado.st\0" -"haram.no\0" -"tysnes.no\0" -"!pref.ibaraki.jp\0hamburg.museum\0" -"\xc3\xa5rdal.no\0" -"airline.aero\0" -"crew.aero\0newhampshire.museum\0" -"muenster.museum\0" -"aerodrome.aero\0" -"heroy.nordland.no\0belau.pw\0" -"kamchatka.ru\0" -"b\xc3\xa5""d\xc3\xa5""ddj\xc3\xa5.no\0lillehammer.no\0hi.us\0" -"hk.cn\0" -"!city.kobe.jp\0berlevag.no\0" -"ardal.no\0" -"askoy.no\0" -"vardo.no\0" -"fyresdal.no\0" -"sassari.it\0" -"video.hu\0drammen.no\0" -"lyngen.no\0nakhodka.ru\0" -"ip6.arpa\0games.hu\0" -"online.museum\0" -"k12.sd.us\0" -"4.bg\0sebastopol.ua\0" -"ao.it\0atlanta.museum\0" -"lebork.pl\0" -"ravenna.it\0" -"railway.museum\0songdalen.no\0" -"!pref.shimane.jp\0delaware.museum\0ed.pw\0" -"f\xc3\xb8rde.no\0" -"living.museum\0" -"juif.museum\0" -"lomza.pl\0" -"h.se\0" -"!bl.uk\0" -"portland.museum\0\xe7\xb5\x84\xe7\xb9\x94.tw\0" -"stj\xc3\xb8rdal.no\0" -"lecce.it\0" -"bz.it\0" -"farmstead.museum\0va.no\0" -"express.aero\0!nacion.ar\0" -"presse.km\0gs.of.no\0" -"\xe5\x8f\xb0\xe7\x81\xa3\0" -"og.ao\0gyeongbuk.kr\0vestv\xc3\xa5g\xc3\xb8y.no\0" -"prd.fr\0" -"pp.ru\0pp.se\0" -"forum.hu\0!pref.saga.jp\0" -"kvalsund.no\0" -"!city.kawasaki.jp\0n\xc3\xa5\xc3\xa5mesjevuemie.no\0" -"j.bg\0" -"vlaanderen.museum\0" -"cc.va.us\0" -"\xd8\xa7\xd9\x8a\xd8\xb1\xd8\xa7\xd9\x86.ir\0alabama.museum\0" -"school.museum\0her\xc3\xb8y.m\xc3\xb8re-og-romsdal.no\0" -"\xc3\xa5seral.no\0" -"traniandriabarletta.it\0" -"flog.br\0" -"presse.ml\0" -"k\xc3\xa1r\xc3\xa1\xc5\xa1johka.no\0" -"historisch.museum\0" -"farm.museum\0palmsprings.museum\0oslo.no\0dyroy.no\0stranda.no\0" -"gs.rl.no\0r\xc3\xa5""de.no\0" -"bomlo.no\0s\xc3\xb8rum.no\0" -"jan-mayen.no\0ivgu.no\0" -"coop\0" -"agr.br\0k12.ak.us\0" -"!nic.ar\0catanzaro.it\0fusa.no\0" -"hu.com\0" -"inf.mk\0" -"vet.br\0" -"k12.mt.us\0k12.nd.us\0" -"vlog.br\0\xe5\x85\xac\xe5\x8f\xb8.cn\0sandnessjoen.no\0" -"lib.az.us\0" -"nsw.edu.au\0of.no\0\xc3\xb8stre-toten.no\0" -"*.okinawa.jp\0" -"vb.it\0" -"asso.fr\0firenze.it\0" -"trieste.it\0" -"\xe5\x85\xac\xe5\x8f\xb8.hk\0" -"museet.museum\0" -"prd.km\0" -"navuotna.no\0lib.ca.us\0" -"cc.nv.us\0" -"asso.gp\0" -"meraker.no\0" -"h\xc3\xa1pmir.no\0" -"i.ph\0" -"sx.cn\0jeonnam.kr\0" -"halden.no\0" -"fed.us\0" -"medio-campidano.it\0tsk.ru\0" -"barcelona.museum\0" -"giessen.museum\0roma.museum\0" -"hl.cn\0" -"\xe0\xae\x87\xe0\xae\xb2\xe0\xae\x99\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88\0" -"biz.bb\0benevento.it\0rl.no\0bygland.no\0" -"port.fr\0asso.ht\0prd.mg\0" -"biz.at\0" -"tra.kp\0" -"*.aichi.jp\0khabarovsk.ru\0" -"campidano-medio.it\0" -"biz.az\0" -"newmexico.museum\0va.us\0" -"finearts.museum\0" -"murmansk.ru\0" -"\xc3\xb8rsta.no\0radom.pl\0k12.sc.us\0" -"5.bg\0kvinesdal.no\0" -"ap.it\0" -"*.fukushima.jp\0" -"asso.bj\0" -"mad.museum\0" -"lebesby.no\0" -"og.it\0glas.museum\0sauda.no\0" -"i.se\0" -"k12.tx.us\0" -"asso.ci\0mk.ua\0" -"cesena-forli.it\0" -"lowicz.pl\0" -"k12.id.us\0" -"tas.gov.au\0" -"lukow.pl\0" -"utazas.hu\0" -"maritimo.museum\0bjark\xc3\xb8y.no\0" -"adm.br\0" -"pr.it\0lib.vi.us\0" -"bergamo.it\0k12.va.us\0" -"k.bg\0" -"railroad.museum\0" -"!british-library.uk\0" -"cincinnati.museum\0" -"sorreisa.no\0" -"asso.dz\0!nel.uk\0" -"rm.it\0" -"nv.us\0" -"nx.cn\0gos.pk\0" -"vic.edu.au\0" -"biella.it\0tjome.no\0" -"r\xc3\xb8yken.no\0" -"beiarn.no\0" -"qc.ca\0" -"georgia.museum\0square.museum\0" -"labor.museum\0omasvuotna.no\0cc.la.us\0" -"br.com\0reggioemilia.it\0" -"kristiansund.no\0" -"sorum.no\0" -"orsta.no\0" -"furniture.museum\0surrey.museum\0eng.pro\0" -"asn.lv\0balat.no\0" -"lavangen.no\0sld.pa\0" -"fla.no\0k12.ms.us\0k12.nc.us\0" -"bardu.no\0" -"donostia.museum\0" -"club.tw\0" -"elburg.museum\0" -"gs.hl.no\0lodingen.no\0" -"samara.ru\0" -"vc.it\0*.nagasaki.jp\0" -"fosnes.no\0" -"fuel.aero\0" -"qc.com\0" -"skjervoy.no\0" -"bill.museum\0kv\xc3\xa6""fjord.no\0" -"skydiving.aero\0*.tokushima.jp\0" -"!congresodelalengua3.ar\0laquila.it\0k12.ct.us\0" -"gorge.museum\0linz.museum\0sherbrooke.museum\0" -"tranoy.no\0ing.pa\0" -"ptz.ru\0" -"kr.it\0prato.it\0stat.no\0" -"\xd0\xb8\xd0\xba\xd0\xbe\xd0\xbc.museum\0" -"cosenza.it\0" -"stj\xc3\xb8rdalshalsen.no\0" -"finland.museum\0leka.no\0cc.pr.us\0" -"historichouses.museum\0s\xc3\xa1l\xc3\xa1t.no\0" -"venice.it\0" -"biz.ki\0" -"g\xc3\xa1ls\xc3\xa1.no\0" -"\xe7\xbb\x84\xe7\xbb\x87.hk\0" -"*.yamanashi.jp\0" -"rad\xc3\xb8y.no\0" -"6.bg\0" -"fareast.ru\0" -"paragliding.aero\0ba.it\0aq.it\0" -"sk\xc3\xa5nland.no\0" -"its.me\0" -"us.na\0" -"hl.no\0cc.ga.us\0" -"ac\0granvin.no\0" -"ad\0qld.edu.au\0!city.sapporo.jp\0" -"ae\0" -"af\0" -"ag\0crotone.it\0" -"dallas.museum\0" -"ai\0brussels.museum\0" -"dali.museum\0" -"la.us\0" -"al\0salzburg.museum\0" -"am\0" -"an\0cl.it\0" -"ao\0" -"aq\0ba\0" -"bb\0" -"as\0lajolla.museum\0" -"at\0" -"be\0" -"bf\0inderoy.no\0snz.ru\0" -"aw\0bg\0" -"ax\0bh\0cim.br\0ltd.gi\0biz.mv\0" -"bi\0xz.cn\0\xe7\xb5\x84\xe7\xb9\x94.hk\0biz.mw\0" -"az\0bj\0" -"bm\0tranibarlettaandria.it\0naamesjevuemie.no\0" -"chattanooga.museum\0" -"bo\0" -"l.bg\0" -"ca\0" -"br\0stateofdelaware.museum\0" -"bs\0cc\0" -"cd\0biz.nr\0" -"cf\0berlev\xc3\xa5g.no\0" -"bw\0cg\0snaase.no\0" -"ch\0harvestcelebration.museum\0ck.ua\0" -"by\0ci\0" -"bz\0bahccavuotna.no\0" -"cl\0yuzhno-sakhalinsk.ru\0" -"cm\0halsa.no\0lyngdal.no\0" -"cn\0" -"co\0rn.it\0childrens.museum\0frankfurt.museum\0" -"cr\0" -"pskov.ru\0" -"cu\0de\0" -"cv\0fr.it\0lib.ky.us\0" -"aseral.no\0kvam.no\0" -"cx\0hellas.museum\0" -"hof.no\0" -"cz\0dj\0k12.la.us\0" -"dk\0moscow.museum\0" -"sosnowiec.pl\0" -"dm\0biz.pk\0" -"schokoladen.museum\0biz.pl\0" -"far.br\0arna.no\0tynset.no\0" -"even\xc3\xa1\xc5\xa1\xc5\xa1i.no\0" -"ec\0" -"biz.pr\0" -"ee\0celtic.museum\0" -"scientist.aero\0modern.museum\0" -"pr.us\0" -"dz\0" -"mj\xc3\xb8ndalen.no\0s\xc3\xb8r-odal.no\0" -"!nic.tr\0" -"conference.aero\0vestnes.no\0k12.mn.us\0" -"!pref.hiroshima.jp\0" -"es\0trapani.it\0" -"fermo.it\0vard\xc3\xb8.no\0" -"eu\0gs.hm.no\0r\xc3\xb8""d\xc3\xb8y.no\0stordal.no\0" -"gc.ca\0!nhs.uk\0" -"jgora.pl\0" -"fi\0stjordal.no\0" -"fm\0!mediaphone.om\0" -"kirov.ru\0pvt.k12.ma.us\0" -"fo\0" -"ga\0hyllestad.no\0" -"gov.ac\0fr\0andriabarlettatrani.it\0ga.us\0" -"gov.ae\0gd\0estate.museum\0" -"gov.af\0ge\0tolga.no\0" -"gf\0asso.re\0cc.oh.us\0" -"gg\0florida.museum\0" -"presse.ci\0gh\0" -"gi\0k12.dc.us\0" -"ltd.lk\0orland.no\0" -"gov.al\0" -"gl\0tokke.no\0" -"hanggliding.aero\0gm\0" -"hareid.no\0" -"gov.ba\0tj.cn\0gp\0" -"gov.bb\0gq\0" -"gov.as\0gr\0agrigento.it\0lc.it\0" -"gs\0kalmykia.ru\0aero.tt\0" -"gov.bf\0" -"county.museum\0" -"gov.bh\0hn.cn\0gw\0" -"gov.az\0gy\0assn.lk\0guernsey.museum\0" -"hk\0" -"gov.bm\0h\xc3\xa6gebostad.no\0biz.tj\0" -"hm\0computer.museum\0" -"gov.bo\0hn\0kl\xc3\xa6""bu.no\0" -"pulawy.pl\0" -"gov.br\0" -"trd.br\0gov.bs\0hr\0reggio-calabria.it\0historyofscience.museum\0lipetsk.ru\0" -"gov.cd\0*.nagoya.jp\0" -"ht\0id\0spjelkavik.no\0" -"hu\0ie\0aero.mv\0" -"marketplace.aero\0mn.it\0biz.tt\0" -"gov.by\0saintlouis.museum\0mer\xc3\xa5ker.no\0" -"gov.bz\0" -"7.bg\0gov.cl\0virtual.museum\0" -"gov.cm\0vennesla.no\0kr.ua\0" -"gov.cn\0im\0ar.it\0galsa.no\0rovno.ua\0" -"gov.co\0in\0" -"io\0limanowa.pl\0" -"iq\0k12.ga.us\0" -"ir\0" -"riik.ee\0is\0\xc3\xa1laheadju.no\0" -"gov.cu\0it\0hawaii.museum\0seaport.museum\0" -"je\0pubol.museum\0hm.no\0" -"gov.cx\0" -"*.chiba.jp\0" -"*.kawasaki.jp\0" -"k.se\0" -"gov.dm\0" -"aland.fi\0vik.no\0" -"yk.ca\0jo\0kobierzyce.pl\0" -"jp\0biz.vn\0" -"presse.fr\0lib.il.us\0\xe9\xa6\x99\xe6\xb8\xaf\0" -"gov.ec\0" -"transport.museum\0bronnoy.no\0" -"slg.br\0gov.ee\0asso.nc\0bievat.no\0" -"nyny.museum\0" -"kg\0" -"mo-i-rana.no\0" -"gov.dz\0ki\0" -"monmouth.museum\0" -"suldal.no\0" -"bc.ca\0km\0zt.ua\0" -"pt.it\0kn\0" -"fineart.museum\0" -"la\0" -"kr\0gulen.no\0" -"m.bg\0mo.cn\0lc\0alaheadju.no\0g\xc3\xa1\xc5\x8bgaviika.no\0" -"nowaruda.pl\0cc.ut.us\0" -"br\xc3\xb8nn\xc3\xb8y.no\0" -"ky\0li\0overhalla.no\0" -"kz\0khv.ru\0" -"lk\0" -"artdeco.museum\0" -"ma\0fortworth.museum\0kostroma.ru\0" -"ro.it\0kirkenes.no\0vestby.no\0" -"urbino-pesaro.it\0ls\0mc\0alstahaug.no\0" -"blog.br\0gov.ge\0lt\0md\0" -"lu\0me\0botanicgarden.museum\0" -"gov.gg\0lv\0oh.us\0" -"gov.gh\0mg\0valley.museum\0" -"gov.gi\0mh\0" -"ly\0sandiego.museum\0" -"mk\0" -"ml\0" -"gov.gn\0rollag.no\0naklo.pl\0" -"mn\0" -"mo\0" -"mp\0leirvik.no\0" -"gov.gr\0mq\0na\0cc.ks.us\0" -"mr\0" -"ms\0nc\0" -"valer.hedmark.no\0" -"mu\0ne\0" -"mv\0nf\0" -"mw\0" -"mx\0nord-odal.no\0jur.pro\0" -"my\0" -"gov.hk\0name.hr\0" -"nl\0" -"astronomy.museum\0lib.nm.us\0" -"catania.it\0" -"no\0" -"skjerv\xc3\xb8y.no\0" -"k12.ne.us\0" -"monza-e-della-brianza.it\0!pref.fukushima.jp\0nr\0" -"gov.ie\0" -"stuttgart.museum\0nu\0cc.mn.us\0" -"karasjohka.no\0" -"engine.aero\0bearalvahki.no\0" -"oyer.no\0" -"ve.it\0" -"gov.im\0froland.no\0cc.ar.us\0" -"gov.in\0magadan.ru\0" -"pescara.it\0" -"gov.iq\0usdecorativearts.museum\0" -"gov.ir\0pa\0" -"gov.is\0" -"gov.it\0lavagis.no\0" -"gov.je\0" -"naustdal.no\0pe\0k12.or.us\0" -"gd.cn\0carraramassa.it\0pf\0" -"ph\0" -"cc.ny.us\0" -"rissa.no\0" -"info\0pk\0pomorze.pl\0" -"pl\0" -"gov.jo\0asso.km\0pn\0" -"*.okayama.jp\0cieszyn.pl\0" -"freight.aero\0" -"pr\0" -"narvik.no\0ps\0" -"!pref.aichi.jp\0elverum.no\0pt\0" -"edunet.tn\0" -"gov.kg\0" -"flatanger.no\0marker.no\0pw\0" -"gov.ki\0nuremberg.museum\0" -"aip.ee\0" -"gov.km\0" -"gov.kn\0" -"gov.kp\0" -"rieti.it\0gov.la\0bajddar.no\0" -"gov.lb\0aviation.museum\0" -"gov.lc\0" -"asso.mc\0" -"re\0" -"ut.us\0" -"sa.gov.au\0gov.ky\0" -"mo.it\0gov.kz\0" -"gov.lk\0" -"iraq.museum\0" -"badajoz.museum\0" -"8.bg\0inder\xc3\xb8y.no\0" -"monticello.museum\0ro\0ks.ua\0" -"gov.ma\0svizzera.museum\0" -"gov.lr\0sa\0" -"matera.it\0sb\0" -"gov.lt\0rs\0sc\0" -"gov.me\0sd\0" -"gov.lv\0ru\0se\0" -"gov.mg\0" -"rw\0sg\0" -"gov.ly\0assisi.museum\0kids.museum\0sh\0" -"si\0" -"gov.mk\0" -"gov.ml\0sk\0" -"sl\0" -"gov.mn\0airguard.museum\0sm\0" -"gov.mo\0l.se\0sn\0" -"so\0" -"gov.mr\0ks.us\0" -"name.az\0sr\0" -"naturhistorisches.museum\0tc\0" -"trainer.aero\0cn.it\0urbinopesaro.it\0gov.mu\0nativeamerican.museum\0st\0td\0" -"gov.mv\0su\0" -"trentino.it\0gov.mw\0gov.ng\0tf\0" -"tg\0" -"co.ae\0venezia.it\0gov.my\0th\0" -"!pref.ehime.jp\0sy\0" -"co.ag\0lewismiller.museum\0ostrowiec.pl\0sz\0tj\0" -"tk\0" -"motorcycle.museum\0tl\0" -"birdart.museum\0trogstad.no\0tm\0" -"tn\0" -"humanities.museum\0to\0" -"pu.it\0gov.nr\0ua\0lib.ut.us\0" -"co.ao\0" -"co.ba\0trondheim.no\0tt\0" -"in-addr.arpa\0tempioolbia.it\0!city.yokohama.jp\0mn.us\0" -"n.bg\0schoenbrunn.museum\0tv\0" -"co.at\0aremark.no\0tw\0ug\0" -"jus.br\0" -"co.bi\0bialowieza.pl\0ar.us\0" -"audnedaln.no\0kustanai.ru\0" -"va\0" -"us\0vc\0" -"newport.museum\0" -"kopervik.no\0gov.ph\0vg\0" -"ny.us\0vi\0" -"co.bw\0finn\xc3\xb8y.no\0gov.pk\0uz\0" -"honefoss.no\0gov.pl\0lanbib.se\0" -"co.ci\0" -"gov.pn\0intl.tn\0" -"act.gov.au\0vn\0" -"television.museum\0gov.pr\0" -"sykkylven.no\0v\xc3\xa5ler.hedmark.no\0gov.ps\0" -"gov.pt\0" -"co.cr\0vu\0" -"legnica.pl\0" -"sa.au\0" -"bjarkoy.no\0" -"openair.museum\0birkenes.no\0lib.nj.us\0" -"fylkesbibl.no\0holt\xc3\xa5len.no\0" -"iz.hr\0" -"ws\0" -"oceanographique.museum\0" -"b\xc3\xa1id\xc3\xa1r.no\0cc.mo.us\0" -"\xc3\xb8ygarden.no\0" -"contemporary.museum\0" -"gb.com\0cc.as.us\0" -"belluno.it\0gov.sa\0" -"gov.sb\0" -"gov.rs\0gov.sc\0" -"gov.sd\0" -"!pref.nagasaki.jp\0gov.ru\0" -"asia\0" -"sa.cr\0gov.rw\0gov.sg\0" -"kuzbass.ru\0" -"gs.vf.no\0" -"gov.sl\0" -"norfolk.museum\0" -"k12.de.us\0" -"mil\0" -"rendalen.no\0" -"gov.st\0" -"agro.pl\0" -"orkdal.no\0" -"le.it\0gov.sy\0" -"gov.tj\0" -"co.gg\0nore-og-uvdal.no\0v\xc3\xa5ler.\xc3\xb8stfold.no\0" -"gov.tl\0" -"gov.tn\0" -"gov.to\0" -"kids.us\0" -"equipment.aero\0gov.ua\0" -"!city.niigata.jp\0gov.tt\0" -"sel.no\0" -"l\xc3\xa4ns.museum\0" -"gov.tw\0" -"rennebu.no\0" -"egersund.no\0" -"medecin.km\0" -"co.gy\0" -"!mecon.ar\0" -"berlin.museum\0" -"carrara-massa.it\0" -"9.bg\0" -"pri.ee\0gov.vc\0" -"at.it\0" -"muosat.no\0" -"co.id\0" -"co.hu\0" -"etne.no\0" -"\xc3\xa1lt\xc3\xa1.no\0" -"gov.vn\0" -"modelling.aero\0" -"co.im\0" -"co.in\0\xc3\xa5krehamn.no\0m.se\0" -"gouv.fr\0*.kitakyushu.jp\0" -"narviika.no\0" -"rennes\xc3\xb8y.no\0" -"co.ir\0afjord.no\0" -"lea\xc5\x8bgaviika.no\0buryatia.ru\0" -"co.it\0coastaldefence.museum\0" -"co.je\0vf.no\0" -"osteroy.no\0" -"uslivinghistory.museum\0" -"aerobatic.aero\0" -"mesaverde.museum\0mining.museum\0" -"a\xc3\xa9roport.ci\0gov.ws\0" -"co.jp\0copenhagen.museum\0" -"pv.it\0" -"r\xc3\xb8mskog.no\0" -"vossevangen.no\0porsanger.no\0" -"salat.no\0mo.us\0" -"o.bg\0imperia.it\0carrier.museum\0" -"carbonia-iglesias.it\0" -"as.us\0" -"alvdal.no\0" -"state.museum\0mandal.no\0cn.ua\0" -"cuneo.it\0" -"gouv.ht\0" -"!city.okayama.jp\0co.kr\0" -"co.lc\0" -"sa.it\0" -"donna.no\0" -"sortland.no\0" -"tomsk.ru\0" -"birthplace.museum\0l\xc3\xb8""dingen.no\0" -"ge.it\0orenburg.ru\0" -"cn.com\0" -"co.ma\0" -"co.ls\0skaun.no\0name.vn\0" -"navigation.aero\0" -"cagliari.it\0co.me\0portal.museum\0" -"gouv.bj\0" -"udine.it\0" -"engineer.aero\0" -"szczecin.pl\0" -"wales.museum\0" -"co.na\0bo.telemark.no\0" -"austin.museum\0" -"k12.mo.us\0" -"co.mu\0" -"gouv.ci\0" -"co.mw\0" -"esp.br\0" -"naturalhistorymuseum.museum\0" -"mosjoen.no\0" -"solund.no\0" -"name.tj\0" -"sand\xc3\xb8y.no\0" -"kunstunddesign.museum\0" -"cartoonart.museum\0collection.museum\0gsm.pl\0" -"aure.no\0" -"!pref.yamaguchi.jp\0historical.museum\0" -"name.tt\0" -"england.museum\0valle.no\0" -"cc.ok.us\0" -"salangen.no\0" -"gloppen.no\0" -"cc.co.us\0" -"contemporaryart.museum\0" -"tas.edu.au\0" -"trading.aero\0" -"mazury.pl\0" -"!pref.aomori.jp\0co.pl\0" -"opoczno.pl\0" -"*.kobe.jp\0co.pn\0" -"oppegard.no\0" -"co.pw\0" -"saltdal.no\0smolensk.ru\0" -"na.it\0\xc4\x8d\xc3\xa1hcesuolo.no\0" -"vgs.no\0evenassi.no\0" -"parachuting.aero\0jl.cn\0maritime.museum\0bd.se\0" -"badaddja.no\0" -"bergen.no\0" -"brussel.museum\0" -"avoues.fr\0" -"cesenaforli.it\0" -"oregontrail.museum\0" -"ullensaker.no\0" -"jobs\0" -"accident-prevention.aero\0" -"n.se\0" -"association.museum\0california.museum\0" -"cultural.museum\0co.rs\0" -"zoology.museum\0" -"pruszkow.pl\0" -"control.aero\0nt.edu.au\0net\0komforb.se\0" -"lincoln.museum\0aurland.no\0name.pr\0co.rw\0" -"ostroleka.pl\0" -"isernia.it\0" -"tm.fr\0" -"gs.ol.no\0" -"nb.ca\0marnardal.no\0" -"williamsburg.museum\0" -"!jet.uk\0" -"suisse.museum\0\xc3\xa5""fjord.no\0flakstad.no\0" -"karmoy.no\0" -"yn.cn\0chesapeakebay.museum\0" -"nsw.au\0" -"amur.ru\0co.st\0" -"imb.br\0siellak.no\0\xe7\xb6\xb2\xe8\xb7\xaf.tw\0" -"name.na\0" -"co.th\0" -"p.bg\0" -"co.sz\0co.tj\0" -"name.mv\0\xc3\xa5lesund.no\0lib.in.us\0" -"lucerne.museum\0naumburg.museum\0" -"society.museum\0name.my\0" -"tinn.no\0" -"co.tt\0" -"unj\xc3\xa1rga.no\0" -"co.ug\0" -"lib.wy.us\0" -"co.tz\0" -"ass.km\0" -"ok.us\0" -"tm.hu\0kongsvinger.no\0" -"ibestad.no\0" -"juedisches.museum\0co.us\0" -"cq.cn\0" -"rs.ba\0" -"wa.edu.au\0co.vi\0" -"co.uz\0" -"health.museum\0" -"grue.no\0" -"automotive.museum\0journalism.museum\0settlement.museum\0" -"qh.cn\0interactive.museum\0" -"snillfjord.no\0!national-library-scotland.uk\0" -"balsfjord.no\0lib.nh.us\0" -"kolobrzeg.pl\0" -"gs.tm.no\0" -"h\xc3\xb8nefoss.no\0" -"ol.no\0" -"music.museum\0moareke.no\0" -"b\xc3\xb8.nordland.no\0" -"name.mk\0lier.no\0" -"eidfjord.no\0" -"sc.cn\0tm.km\0" -"jelenia-gora.pl\0sanok.pl\0" -"intelligence.museum\0" -"srv.br\0elblag.pl\0" -"judygarland.museum\0" -"padua.it\0" -"k12.co.us\0" -"lindesnes.no\0" -"name.jo\0izhevsk.ru\0" -"yorkshire.museum\0mel\xc3\xb8y.no\0" -"tm.mc\0lib.pr.us\0" -"hjartdal.no\0" -"tm.mg\0" -"bari.it\0milano.it\0" -"lg.jp\0" -"zgrad.ru\0" -"sm\xc3\xb8la.no\0" -"communications.museum\0" -"arts.co\0seoul.kr\0engerdal.no\0" -"oster\xc3\xb8y.no\0" -"\xe6\x95\x8e\xe8\x82\xb2.hk\0foggia.it\0verran.no\0" -"orskog.no\0voronezh.ru\0kv.ua\0" -"av.it\0" -"tm.no\0nissedal.no\0" -"historisches.museum\0gs.mr.no\0" -"medecin.fr\0" -"montreal.museum\0" -"o.se\0" -"!metro.tokyo.jp\0sola.no\0" -"k12.tn.us\0" -"floro.no\0" -"milan.it\0*.shiga.jp\0" -"berkeley.museum\0" -"maintenance.aero\0" -"ws.na\0" -"lindas.no\0cc.ia.us\0" -"brescia.it\0embroidery.museum\0" -"arezzo.it\0tm.pl\0" -"r\xc3\xa6lingen.no\0" -"burghof.museum\0" -"rec.br\0" -"q.bg\0" -"!nawras.om\0" -"hammarfeasta.no\0" -"moss.no\0" -"on.ca\0" -"gouv.rw\0" -"luxembourg.museum\0" -"rec.co\0british.museum\0" -"reggio-emilia.it\0" -"gouv.sn\0lib.wv.us\0" -"avocat.fr\0" -"simbirsk.ru\0" -"jar.ru\0" -"monza-brianza.it\0" -"tm.ro\0" -"imageandsound.museum\0" -"jpn.com\0mr.no\0" -"siracusa.it\0" -"norilsk.ru\0tm.se\0" -"tn.it\0" -"jeju.kr\0" -"!pref.fukuoka.jp\0" -"*.hyogo.jp\0portlligat.museum\0" -"!pref.osaka.jp\0" -"siena.it\0sc.kr\0omaha.museum\0saskatchewan.museum\0" -"phoenix.museum\0vanylven.no\0" -"botanicalgarden.museum\0" -"turek.pl\0" -"vagsoy.no\0" -"riodejaneiro.museum\0" -"vi.it\0" -"uy.com\0" -"kristiansand.no\0" -"sd.cn\0trento.it\0" -"muncie.museum\0" -"berg.no\0meldal.no\0" -"nes.buskerud.no\0" -"saratov.ru\0" -"gs.oslo.no\0" -"harstad.no\0vaga.no\0" -"research.museum\0" -"brunel.museum\0ia.us\0" -"test.tj\0" -"columbia.museum\0" -"ms.it\0stockholm.museum\0" -"reklam.hu\0" -"pomorskie.pl\0lg.ua\0" -"bg.it\0historicalsociety.museum\0rns.tn\0" -"mallorca.museum\0surgut.ru\0cc.sc.us\0" -"ushistory.museum\0" -"palana.ru\0" -"snoasa.no\0" -"naturalsciences.museum\0" -"yaroslavl.ru\0" -"unjarga.no\0" -"p.se\0" -"ingatlan.hu\0" -"irc.pl\0" -"savona.it\0" -"cr.it\0" -"test.ru\0cc.tn.us\0" -"ms.kr\0museumvereniging.museum\0" -"time.no\0k12.ia.us\0" -"vladimir.ru\0" -"correios-e-telecomunica\xc3\xa7\xc3\xb5""es.museum\0" -"gouv.km\0nationalfirearms.museum\0" -"m\xc3\xa1latvuopmi.no\0" -"aero\0yosemite.museum\0" -"r.bg\0school.na\0" -"cc.vi.us\0" -"*.wakayama.jp\0" -"beauxarts.museum\0averoy.no\0ullensvang.no\0bar.pro\0" -"!city.hiroshima.jp\0" -"b\xc3\xa1hccavuotna.no\0" -"frosta.no\0" -"gdynia.pl\0" -"medical.museum\0" -"embaixada.st\0" -"balsan.it\0vantaa.museum\0" -"za.net\0" -"!city.saitama.jp\0lib.ks.us\0" -"fnd.br\0" -"ru.com\0se.com\0hol.no\0modalen.no\0" -"gouv.ml\0chukotka.ru\0" -"malopolska.pl\0" -"mansion.museum\0" -"iki.fi\0children.museum\0" -"cyber.museum\0rec.nf\0mo\xc3\xa5reke.no\0" -"to.it\0" -"hasvik.no\0" -"\xc3\xb8yer.no\0" -"arts.ro\0sc.ug\0" -"lib.ar.us\0" -"sc.tz\0cc.ms.us\0cc.nc.us\0" -"etc.br\0poznan.pl\0" -"cnt.br\0viking.museum\0" -"*.miyazaki.jp\0" -"melhus.no\0" -"skodje.no\0vevelstad.no\0" -"sc.us\0" -"upow.gov.pl\0" -"!city.fukuoka.jp\0brandywinevalley.museum\0natuurwetenschappen.museum\0tranby.no\0" -"bahn.museum\0msk.ru\0" -"delmenhorst.museum\0" -"russia.museum\0fuoisku.no\0" -"shell.museum\0" -"r\xc3\xa1isa.no\0" -"hs.kr\0udmurtia.ru\0" -"palermo.it\0" -"pilot.aero\0" -"tn.us\0" -"priv.hu\0" -"li.it\0" -"kr\xc3\xa5""anghke.no\0mosreg.ru\0" -"lib.fl.us\0" -"plants.museum\0" -"ulsan.kr\0national.museum\0" -"mil.ac\0!pref.nara.jp\0surgeonshall.museum\0" -"mil.ae\0santacruz.museum\0vi.us\0" -"wlocl.pl\0" -"mt.it\0napoli.it\0alaska.museum\0arts.nf\0" -"missoula.museum\0" -"rec.ro\0" -"mil.al\0" -"marburg.museum\0waw.pl\0" -"pharmaciens.km\0indianapolis.museum\0larsson.museum\0" -"cc.sd.us\0" -"mil.ba\0mobi\0" -"indianmarket.museum\0" -"recreation.aero\0padova.it\0" -"varese.it\0parti.se\0" -"mil.az\0" -"mil.bo\0!pref.kagoshima.jp\0khmelnitskiy.ua\0" -"rygge.no\0" -"os\xc3\xb8yro.no\0" -"mil.br\0" -"cs.it\0" -"austevoll.no\0fjell.no\0" -"mil.by\0" -"!pref.tokushima.jp\0org\0" -"mil.cn\0gs.svalbard.no\0" -"mil.co\0" -"pz.it\0lib.va.us\0\xd1\x80\xd1\x84\0" -"\xe4\xb8\xaa\xe4\xba\xba.hk\0ms.us\0nc.us\0k12.wi.us\0" -"s.bg\0drangedal.no\0" -"en.it\0" -"culturalcenter.museum\0" -"house.museum\0divttasvuotna.no\0" -"fhs.no\0" -"circus.museum\0" -"priv.at\0" -"mil.ec\0" -"ruovat.no\0" -"midsund.no\0vagan.no\0" -"casadelamoneda.museum\0" -"bristol.museum\0" -"and.museum\0" -"ascolipiceno.it\0computerhistory.museum\0vyatka.ru\0" -"uhren.museum\0" -"lahppi.no\0" -"*.yokohama.jp\0cody.museum\0lib.al.us\0" -"colonialwilliamsburg.museum\0indian.museum\0cc.ky.us\0" -"tp.it\0biev\xc3\xa1t.no\0" -"can.br\0royken.no\0" -"id.ir\0" -"mediocampidano.it\0tromso.no\0" -"kartuzy.pl\0k12.ok.us\0" -"*.saitama.jp\0stjohn.museum\0m\xc3\xa1tta-v\xc3\xa1rjjat.no\0" -"mil.ge\0trani-barletta-andria.it\0" -"lib.as.us\0" -"swiebodzin.pl\0cc.mt.us\0cc.nd.us\0" -"mil.gh\0" -"science-fiction.museum\0\xd9\x82\xd8\xb7\xd8\xb1\0" -"airtraffic.aero\0" -"konskowola.pl\0" -"scienceandhistory.museum\0nysa.pl\0sd.us\0" -"balestrand.no\0" -"oygarden.no\0" -"her\xc3\xb8y.nordland.no\0" -"!pref.ishikawa.jp\0strand.no\0" -"\xe7\xb5\x84\xe7\xbb\x87.hk\0mil.hn\0" -"gob.bo\0volda.no\0" -"losangeles.museum\0larvik.no\0" -"university.museum\0" -"cc.dc.us\0" -"mil.id\0" -"sorfold.no\0" -"watch-and-clock.museum\0" -"flor\xc3\xb8.no\0" -"nittedal.no\0oppeg\xc3\xa5rd.no\0" -"k12.ri.us\0" -"gob.cl\0" -"komi.ru\0" -"government.aero\0mil.in\0" -"mil.iq\0id.lv\0" -"culture.museum\0" -"id.ly\0" -"raholt.no\0" -"lubin.pl\0grozny.ru\0" -"kchr.ru\0" -"nikolaev.ua\0" -"lib.sd.us\0" -"de.com\0" -"mil.jo\0" -"*.kanagawa.jp\0gaular.no\0miasta.pl\0" -"bi.it\0rnu.tn\0uzhgorod.ua\0" -"idrett.no\0v\xc3\xa5gs\xc3\xb8y.no\0" -"wroclaw.pl\0" -"res.aero\0ne.jp\0mil.kg\0" -"\xc3\xa5mli.no\0" -"education.museum\0" -"dgca.aero\0" -"mil.km\0" -"trolley.museum\0" -"cci.fr\0r.se\0" -"archaeological.museum\0" -"monzaedellabrianza.it\0mil.kr\0" -"gob.es\0kvafjord.no\0ky.us\0" -"lecco.it\0" -"ct.it\0" -"magazine.aero\0" -"operaunite.com\0ne.kr\0" -"mil.kz\0skoczow.pl\0" -"nf.ca\0" -"western.museum\0" -"kunst.museum\0gaivuotna.no\0karpacz.pl\0spb.ru\0cc.id.us\0" -"slask.pl\0" -"youth.museum\0" -"adv.br\0campidanomedio.it\0!songfest.om\0" -"geelvinck.museum\0\xd8\xa7\xd9\x85\xd8\xa7\xd8\xb1\xd8\xa7\xd8\xaa\0" -"mil.lv\0" -"fie.ee\0mil.mg\0mt.us\0nd.us\0k12.vt.us\0" -"t.bg\0ushuaia.museum\0" -"off.ai\0" -"irkutsk.ru\0" -"stor-elvdal.no\0tourism.tn\0" -"penza.ru\0" -"bj.cn\0\xe4\xb8\xad\xe5\x9b\xbd\0" -"civilwar.museum\0mil.mv\0opole.pl\0" -"nes.akershus.no\0" -"mil.my\0karelia.ru\0" -"como.it\0sande.vestfold.no\0" -"\xe4\xb8\xad\xe5\x9c\x8b\0" -"gob.hn\0lib.la.us\0" -"mil.no\0cc.wv.us\0" -"boleslawiec.pl\0" -"!pref.niigata.jp\0gs.sf.no\0dc.us\0k12.mi.us\0" -"museum\0dep.no\0kv\xc3\xa6nangen.no\0l\xc3\xa1hppi.no\0" -"film.museum\0" -"frei.no\0" -"notodden.no\0risor.no\0" -"messina.it\0" -"eidsberg.no\0" -"krakow.pl\0lib.mt.us\0lib.nd.us\0" -"rauma.no\0" -"mulhouse.museum\0" -"sibenik.museum\0grong.no\0mil.pe\0" -"budejju.no\0k12.nv.us\0" -"stavanger.no\0mil.ph\0" -"forli-cesena.it\0" -"naples.it\0cc.ne.us\0" -"s\xc3\xb8r-aurdal.no\0" -"mil.pl\0" -"vibo-valentia.it\0ski.museum\0siedlce.pl\0" -"bus.museum\0" -"tozsde.hu\0" -"!pref.shizuoka.jp\0santabarbara.museum\0" -"zhitomir.ua\0" -"pro.az\0" -"ne.pw\0" -"pro.br\0orkanger.no\0b\xc3\xb8.telemark.no\0" -"roma.it\0cc.ct.us\0" -"heritage.museum\0giske.no\0" -"!pref.kumamoto.jp\0prof.pr\0" -"*.kochi.jp\0" -"andria-barletta-trani.it\0*.toyama.jp\0sveio.no\0" -"id.us\0" -"bolt.hu\0" -"fetsund.no\0porsgrunn.no\0" -"iglesias-carbonia.it\0" -"sf.no\0" -"mil.ru\0" -"from.hr\0asnes.no\0mil.rw\0" -"alesund.no\0sos.pl\0" -"livorno.it\0" -"crafts.museum\0" -"aquila.it\0" -"vega.no\0" -"jewelry.museum\0" -"sk\xc3\xa1nit.no\0chita.ru\0" -"pro.ec\0" -"fortmissoula.museum\0j\xc3\xb8lster.no\0" -"pro\0mil.st\0" -"busan.kr\0lib.ga.us\0" -"dellogliastra.it\0" -"aosta.it\0chungnam.kr\0gob.mx\0" -"mil.sy\0k12.hi.us\0" -"mil.tj\0" -"ulan-ude.ru\0mil.to\0wv.us\0" -"luster.no\0volgograd.ru\0" -"pa.it\0kommunalforbund.se\0lib.tx.us\0" -"s.se\0" -"qsl.br\0" -"mil.tw\0" -"est.pr\0ens.tn\0" -"lib.id.us\0" -"mil.tz\0" -"uscountryestate.museum\0" -"agents.aero\0" -"\xc3\xb8vre-eiker.no\0ne.ug\0" -"pb.ao\0" -"gob.pa\0ne.tz\0" -"tur.br\0" -"mil.vc\0" -"or.at\0gob.pe\0" -"s\xc3\xb8r-fron.no\0" -"or.bi\0ne.us\0" -"u.bg\0gob.pk\0" -"stavern.no\0" -"brindisi.it\0" -"aknoluokta.no\0" -"!pref.kyoto.jp\0tydal.no\0" -"plc.ly\0muos\xc3\xa1t.no\0" -"or.ci\0hamaroy.no\0priv.pl\0" -"vestre-slidre.no\0gniezno.pl\0" -"\xe7\xae\x87\xe4\xba\xba.hk\0" -"andebu.no\0" -"nieruchomosci.pl\0\xd8\xa7\xd9\x84\xd8\xb3\xd8\xb9\xd9\x88\xd8\xaf\xd9\x8a\xd8\xa9\0" -"or.cr\0pro.ht\0bolzano.it\0" -"ct.us\0k12.md.us\0" -"za.org\0" -"!icnet.uk\0" -"localhistory.museum\0" -"firm.ht\0" -"lel.br\0tr.it\0kvanangen.no\0" -"sondre-land.no\0t\xc3\xb8nsberg.no\0vefsn.no\0" -"nature.museum\0yamal.ru\0" -"rv.ua\0" -"lans.museum\0lib.ne.us\0" -"lur\xc3\xb8y.no\0" -"eu.com\0firm.in\0" -"hjelmeland.no\0" -"gs.tr.no\0" -"casino.hu\0essex.museum\0tourism.pl\0" -"rennesoy.no\0" -"priv.no\0" -"baths.museum\0mytis.ru\0" -"tingvoll.no\0" -"cc.az.us\0" -"sh.cn\0" -"!pref.miyazaki.jp\0s\xc3\xb8rfold.no\0" -"aurskog-holand.no\0malatvuopmi.no\0" -"lib.ct.us\0" -"cc.pa.us\0" -"pa.gov.pl\0" -"firm.co\0cc.de.us\0" -"nrw.museum\0" -"daejeon.kr\0livinghistory.museum\0" -"gildeskal.no\0lund.no\0" -"\xc3\xb8ksnes.no\0stavropol.ru\0" -"b\xc3\xa6rum.no\0r\xc3\xb8yrvik.no\0" -"osoyro.no\0" -"priv.me\0sula.no\0!parliament.uk\0" -"nationalheritage.museum\0" -"jaworzno.pl\0" -"dinosaur.museum\0" -"garden.museum\0trust.museum\0" -"turen.tn\0" -"kautokeino.no\0" -"pro.na\0" -"gorizia.it\0" -"siljan.no\0" -"or.id\0pro.mv\0" -"bieszczady.pl\0www.ro\0" -"lib.ee\0antiques.museum\0brasil.museum\0tr.no\0" -"aejrie.no\0" -"!pref.hokkaido.jp\0" -"schlesisches.museum\0" -"huissier-justice.fr\0or.it\0" -"t.se\0" -"environment.museum\0" -"vindafjord.no\0" -"edu.ac\0or.jp\0" -"tree.museum\0" -"groundhandling.aero\0edu.af\0" -"rochester.museum\0sanfrancisco.museum\0" -"ebiz.tw\0" -"kirovograd.ua\0" -"edu.al\0" -"edu.an\0\xc3\xa1k\xc5\x8boluokta.no\0v\xc3\xa5g\xc3\xa5.no\0" -"v.bg\0" -"edu.ba\0" -"edu.bb\0nesset.no\0" -"hornindal.no\0pro.pr\0" -"or.kr\0" -"az.us\0" -"edu.bh\0volkenkunde.museum\0" -"edu.bi\0" -"edu.az\0" -"b\xc3\xb8mlo.no\0" -"edu.bm\0" -"edu.bo\0tyumen.ru\0" -"edu.br\0" -"edu.bs\0pa.us\0" -"alto-adige.it\0whaling.museum\0" -"*.iwate.jp\0" -"edu.ci\0law.pro\0" -"edu.bz\0de.us\0" -"lib.ak.us\0" -"edu.cn\0" -"edu.co\0" -"laspezia.it\0" -"baidar.no\0" -"ts.it\0" -"or.na\0" -"edu.cu\0hotel.lk\0" -"show.aero\0or.mu\0" -"sandnes.no\0" -"museumcenter.museum\0" -"edu.dm\0kazan.ru\0" -"biz\0caltanissetta.it\0odessa.ua\0k12.oh.us\0" -"crimea.ua\0" -"research.aero\0lom.no\0" -"edu.ec\0florence.it\0clock.museum\0sshn.se\0" -"edu.ee\0game.tw\0" -"!pref.okinawa.jp\0" -"ilawa.pl\0" -"edu.dz\0indiana.museum\0" -"gs.jan-mayen.no\0" -"publ.pt\0" -"nom.ad\0" -"skanit.no\0gdansk.pl\0k12.pa.us\0" -"nom.ag\0edu.es\0" -"if.ua\0" -"pro.tt\0lib.de.us\0" -"environmentalconservation.museum\0cc.or.us\0" -"bern.museum\0nat.tn\0" -"rubtsovsk.ru\0" -"!educ.ar\0masoy.no\0" -"bologna.it\0" -"\xc3\xa5snes.no\0fhv.se\0" -"*.tottori.jp\0radoy.no\0" -"romskog.no\0" -"malbork.pl\0" -"olbiatempio.it\0" -"edu.ge\0" -"edu.gh\0" -"edu.gi\0" -"or.pw\0" -"hob\xc3\xb8l.no\0" -"nom.br\0edu.gn\0virginia.museum\0mbone.pl\0!nls.uk\0" -"seljord.no\0pro.vn\0" -"edu.gp\0" -"edu.gr\0" -"!uba.ar\0!pref.saitama.jp\0" -"greta.fr\0gs.aa.no\0kvinnherad.no\0" -"lib.sc.us\0" -"js.cn\0nom.co\0edu.hk\0" -"lesja.no\0" -"bl.it\0" -"edu.hn\0\xc3\xb8ystre-slidre.no\0mari-el.ru\0" -"hotel.hu\0" -"rindal.no\0" -"edu.ht\0" -"!pref.miyagi.jp\0" -"midtre-gauldal.no\0" -"xj.cn\0australia.museum\0" -"ab.ca\0salvadordali.museum\0olawa.pl\0" -"pc.it\0" -"u.se\0" -"edu.in\0b\xc3\xa1l\xc3\xa1t.no\0" -"ln.cn\0alta.no\0" -"chelyabinsk.ru\0" -"edu.iq\0" -"ontario.museum\0" -"edu.is\0" -"edu.it\0" -"b\xc3\xa5tsfjord.no\0" -"trysil.no\0or.th\0" -"utsira.no\0" -"nom.es\0edu.jo\0fhsk.se\0" -"bale.museum\0" -"w.bg\0" -"lillesand.no\0" -"edu.kg\0" -"amusement.aero\0" -"edu.ki\0" -"fauske.no\0or.ug\0" -"int.az\0askvoll.no\0eidskog.no\0cv.ua\0" -"algard.no\0" -"edu.km\0or.tz\0" -"nom.fr\0edu.kn\0" -"*.ibaraki.jp\0hoylandet.no\0" -"int.bo\0edu.kp\0" -"edu.la\0" -"si.it\0edu.lb\0travel.pl\0" -"edu.lc\0mx.na\0n\xc3\xa1vuotna.no\0ovre-eiker.no\0" -"aa.no\0!siemens.om\0" -"sciences.museum\0or.us\0" -"cat\0" -"edu.ky\0" -"int.ci\0edu.kz\0firm.ro\0cc.wy.us\0" -"edu.lk\0vaapste.no\0" -"!pref.tochigi.jp\0" -"int.co\0podlasie.pl\0" -"edu.lr\0" -"karikatur.museum\0jamal.ru\0" -"gjovik.no\0krager\xc3\xb8.no\0k12.az.us\0" -"edu.me\0" -"ud.it\0edu.lv\0entomology.museum\0" -"edu.mg\0moskenes.no\0" -"\xe6\x94\xbf\xe5\xba\x9c.hk\0edu.ly\0" -"stpetersburg.museum\0" -"edu.mk\0" -"edu.ml\0nordreisa.no\0" -"!pref.fukui.jp\0lib.ms.us\0lib.nc.us\0" -"edu.mn\0\xd9\x81\xd9\x84\xd8\xb3\xd8\xb7\xd9\x8a\xd9\x86\0" -"fot.br\0edu.mo\0" -"iron.museum\0" -"asti.it\0annefrank.museum\0stv.ru\0cc.nh.us\0" -"edu.mv\0" -"lodi.it\0edu.mw\0edu.ng\0" -"gwangju.kr\0edu.mx\0" -"edu.my\0" -"soundandvision.museum\0" -"lenvik.no\0" -"ballooning.aero\0" -"name\0" -"jogasz.hu\0frogn.no\0" -"history.museum\0" -"consultant.aero\0edu.nr\0" -"manchester.museum\0" -"*.hiroshima.jp\0" -"pol.dz\0" -"*.tochigi.jp\0heimatunduhren.museum\0" -"!pref.kanagawa.jp\0" -"firm.nf\0edu.pa\0" -"coop.ht\0pc.pl\0" -"chicago.museum\0" -"vn.ua\0" -"edu.pe\0" -"tana.no\0edu.pf\0" -"edu.ph\0" -"nom.km\0" -"travel.tt\0" -"edu.pk\0" -"experts-comptables.fr\0edu.pl\0bryansk.ru\0" -"edu.pn\0" -"evje-og-hornnes.no\0warszawa.pl\0" -"ac.ae\0" -"edu.pr\0" -"vaksdal.no\0edu.ps\0dni.us\0" -"po.gov.pl\0edu.pt\0" -"nordre-land.no\0vadso.no\0" -"rnrt.tn\0" -"sport.hu\0!pref.gifu.jp\0voss.no\0targi.pl\0" -"flesberg.no\0" -"photography.museum\0" -"modena.it\0tonsberg.no\0" -"ac.at\0" -"ac.be\0coop.br\0" -"services.aero\0" -"nom.mg\0" -"wielun.pl\0" -"jefferson.museum\0wy.us\0" -"pd.it\0ot.it\0neues.museum\0slattum.no\0" -"vdonsk.ru\0" -"ar.com\0edu.sa\0" -"\xc3\xa5l.no\0edu.sb\0" -"edu.rs\0edu.sc\0" -"ac.ci\0int.is\0edu.sd\0!tsk.tr\0" -"br\xc3\xb8nn\xc3\xb8ysund.no\0and\xc3\xb8y.no\0edu.ru\0" -"pol.ht\0" -"edu.rw\0edu.sg\0" -"gyeongnam.kr\0olecko.pl\0" -"ac.cn\0" -"graz.museum\0" -"coldwar.museum\0edu.sl\0" -"ac.cr\0" -"edu.sn\0" -"hamar.no\0" -"histoire.museum\0" -"!city.shizuoka.jp\0" -"edu.st\0" -"oceanographic.museum\0nh.us\0" -"x.bg\0" -"surnadal.no\0" -"fc.it\0costume.museum\0stalowa-wola.pl\0" -"valer.ostfold.no\0edu.sy\0" -"edu.tj\0" -"arq.br\0" -"aeroclub.aero\0odo.br\0pe.ca\0\xe7\xb6\xb2\xe7\xb5\xa1.cn\0bronnoysund.no\0nom.pa\0" -"edu.to\0" -"paleo.museum\0nom.pe\0edu.ua\0" -"int.la\0trustee.museum\0forsand.no\0krasnoyarsk.ru\0" -"!pref.hyogo.jp\0" -"edu.tt\0" -"zarow.pl\0" -"edu.tw\0" -"nom.pl\0" -"community.museum\0kvitsoy.no\0" -"int.lk\0tychy.pl\0" -"k12.me.us\0" -"jondal.no\0edu.vc\0" -"illustration.museum\0" -"clinton.museum\0" -"tas.au\0es.kr\0" -"production.aero\0" -"rodoy.no\0" -"database.museum\0bodo.no\0" -"anthro.museum\0landes.museum\0edu.vn\0" -"nom.re\0" -"altai.ru\0" -"filatelia.museum\0" -"sk.ca\0lezajsk.pl\0" -"rockart.museum\0int.mv\0" -"int.mw\0herad.no\0" -"eti.br\0ac.gn\0" -"fedje.no\0nom.ro\0" -"money.museum\0" -"\xd9\x85\xd8\xb5\xd8\xb1\0" -"horten.no\0" -"gangaviika.no\0mielec.pl\0" -"uw.gov.pl\0" -"moma.museum\0" -"edu.ws\0" -"go.ci\0" -"tv.bo\0technology.museum\0" -"s\xc3\xb8ndre-land.no\0" -"tv.br\0" -"jor.br\0lib.dc.us\0" -"arboretum.museum\0" -"go.cr\0" -"artsandcrafts.museum\0\xd8\xaa\xd9\x88\xd9\x86\xd8\xb3\0" -"psc.br\0ac.id\0!city.chiba.jp\0" -"wa.au\0" -"rome.it\0" -"amli.no\0" -"ac.im\0lo.it\0" -"ac.in\0" -"\xe7\xb6\xb2\xe7\xb5\xa1.hk\0durham.museum\0" -"ac.ir\0" -"torino.museum\0" -"loabat.no\0" -"com\0" -"nalchik.ru\0" -"yakutia.ru\0" -"settlers.museum\0" -"!promocion.ar\0int.pt\0" -"union.aero\0" -"utah.museum\0" -"giehtavuoatna.no\0" -"ac.jp\0" -"air-traffic-control.aero\0" -"silk.museum\0usantiques.museum\0" -"bn.it\0" -"kalisz.pl\0" -"perm.ru\0" -"aoste.it\0bindal.no\0" -"coloradoplateau.museum\0k12.gu.us\0" -"frosinone.it\0forde.no\0" -"epilepsy.museum\0" -"olbia-tempio.it\0" -"journalist.aero\0ac.kr\0*.sch.uk\0" -"nic.im\0sciencesnaturelles.museum\0bedzin.pl\0" -"nic.in\0pe.it\0" -"w.se\0" -"!pref.okayama.jp\0" -"urn.arpa\0" -"cinema.museum\0" -"monza.it\0versailles.museum\0int.ru\0" -"andasuolo.no\0skj\xc3\xa5k.no\0chernovtsy.ua\0" -"nyc.museum\0int.rw\0paroch.k12.ma.us\0" -"ringerike.no\0" -"ac.ma\0" -"org.ac\0civilaviation.aero\0" -"rakkestad.no\0" -"org.ae\0ac.me\0" -"org.af\0" -"org.ag\0" -"org.ai\0stokke.no\0" -"airport.aero\0" -"finnoy.no\0" -"org.al\0" -"org.an\0y.bg\0habmer.no\0" -"stadt.museum\0holtalen.no\0" -"int.tj\0" -"org.ba\0gjerdrum.no\0" -"org.bb\0ascoli-piceno.it\0molde.no\0r\xc3\xb8st.no\0tysfjord.no\0" -"pe.kr\0rybnik.pl\0" -"go.id\0" -"ac.mu\0" -"ac.mw\0ac.ng\0" -"org.bh\0\xc3\xa5mot.no\0rana.no\0" -"org.bi\0" -"org.az\0belgorod.ru\0int.tt\0" -"ae.org\0" -"group.aero\0posts-and-telecommunications.museum\0" -"org.bm\0salerno.it\0" -"etnedal.no\0" -"org.bo\0*.hokkaido.jp\0donetsk.ua\0" -"ostroda.pl\0" -"org.br\0" -"org.bs\0" -"go.it\0h\xc3\xb8ylandet.no\0" -"zgorzelec.pl\0" -"org.bw\0" -"org.ci\0" -"org.bz\0vicenza.it\0resistance.museum\0" -"missile.museum\0" -"org.cn\0" -"org.co\0assassination.museum\0" -"go.jp\0" -"tv.it\0austrheim.no\0ac.pa\0" -"verbania.it\0" -"palace.museum\0" -"tmp.br\0int.vn\0" -"org.cu\0" -"paris.museum\0" -"media.aero\0hokksund.no\0" -"arts.museum\0gemological.museum\0hammerfest.no\0" -"k12.ny.us\0" -"org.dm\0hemsedal.no\0ringsaker.no\0sklep.pl\0" -"h\xc3\xa5.no\0cc.nj.us\0" -"rzeszow.pl\0" -"go.kr\0gjesdal.no\0ac.pr\0" -"org.ec\0" -"org.ee\0" -"media.museum\0" -"terni.it\0touch.museum\0zakopane.pl\0" -"journal.aero\0org.dz\0" -"incheon.kr\0" -"b\xc3\xa1hcavuotna.no\0" -"leksvik.no\0ulvik.no\0" -"plantation.museum\0" -"org.es\0loyalist.museum\0" -"gildesk\xc3\xa5l.no\0bytom.pl\0" -"bo.nordland.no\0" -"ambulance.aero\0iglesiascarbonia.it\0" -"tw.cn\0\xe6\x96\xb0\xe5\x8a\xa0\xe5\x9d\xa1\0" -"chocolate.museum\0" -"pittsburgh.museum\0" -"royrvik.no\0sor-odal.no\0ac.rs\0" -"kaluga.ru\0" -"org.ge\0erotica.hu\0ac.ru\0ac.se\0" -"org.gg\0leangaviika.no\0ac.rw\0" -"org.gh\0v\xc3\xa6r\xc3\xb8y.no\0" -"org.gi\0" -"jevnaker.no\0" -"org.gn\0tv.na\0leikanger.no\0" -"org.gp\0" -"ask\xc3\xb8y.no\0" -"org.gr\0wroc.pl\0" -"ad.jp\0" -"powiat.pl\0" -"tj\xc3\xb8me.no\0" -"coop.tt\0" -"ac.th\0" -"mragowo.pl\0ac.sz\0ac.tj\0" -"org.hk\0bo.it\0" -"philately.museum\0" -"org.hn\0" -"fet.no\0" -"axis.museum\0mansions.museum\0" -"wiki.br\0" -"org.ht\0" -"org.hu\0piacenza.it\0scotland.museum\0cpa.pro\0" -"ac.ug\0" -"coop.mv\0x.se\0" -"coop.mw\0ac.tz\0" -"bmd.br\0" -"org.im\0ralingen.no\0" -"org.in\0" -"cz.it\0lib.ia.us\0" -"org.iq\0" -"org.ir\0" -"org.is\0" -"nl.ca\0" -"org.je\0" -"childrensgarden.museum\0" -"kvits\xc3\xb8y.no\0go.pw\0" -"sokndal.no\0" -"ra.it\0grimstad.no\0" -"denmark.museum\0" -"ac.vn\0" -"ecn.br\0org.jo\0" -"bialystok.pl\0nj.us\0" -"z.bg\0bilbao.museum\0stargard.pl\0nic.tj\0" -"eisenbahn.museum\0" -"fe.it\0bryne.no\0vrn.ru\0" -"cc.wa.us\0" -"sex.hu\0skierva.no\0" -"org.kg\0" -"org.ki\0" -"org.km\0" -"org.kn\0khakassia.ru\0" -"org.kp\0" -"org.la\0" -"org.lb\0" -"org.lc\0" -"francaise.museum\0" -"panama.museum\0" -"rotorcraft.aero\0gateway.museum\0olkusz.pl\0" -"org.ky\0czeladz.pl\0ryazan.ru\0" -"org.kz\0" -"org.lk\0dyr\xc3\xb8y.no\0" -"raisa.no\0" -"dlugoleka.pl\0" -"org.ma\0" -"org.lr\0prochowice.pl\0" -"org.ls\0" -"org.me\0sandoy.no\0s\xc3\xb8r-varanger.no\0" -"org.lv\0" -"org.mg\0" -"tel\0go.th\0" -"org.ly\0" -"steam.museum\0go.tj\0" -"org.mk\0pasadena.museum\0jessheim.no\0lib.mn.us\0" -"org.ml\0" -"software.aero\0" -"org.mn\0" -"org.mo\0" -"*.fukui.jp\0decorativearts.museum\0" -"spy.museum\0org.na\0jorpeland.no\0" -"vads\xc3\xb8.no\0" -"org.mu\0building.museum\0gausdal.no\0" -"org.mv\0nannestad.no\0" -"org.mw\0org.ng\0go.ug\0" -"vr.it\0org.mx\0" -"org.my\0" -"go.tz\0" -"oppdal.no\0" -"uk.net\0" -"coop.km\0" -"*.kyoto.jp\0" -"sarpsborg.no\0org.nr\0" -"chernigov.ua\0" -"ha.cn\0no.com\0" -"space.museum\0" -"org.pa\0" -"*.ar\0" -"usgarden.museum\0" -"*.bd\0org.pe\0" -"*.au\0org.pf\0um.gov.pl\0" -"bio.br\0" -"org.ph\0" -"org.pk\0" -"fr\xc3\xa6na.no\0org.pl\0" -"nord-aurdal.no\0org.pn\0" -"*.bn\0handson.museum\0agrinet.tn\0" -"kviteseid.no\0" -"rel.ht\0virtuel.museum\0atm.pl\0org.pr\0" -"org.ps\0cherkassy.ua\0" -"org.pt\0wa.us\0" -"*.bt\0arendal.no\0magnitka.ru\0" -"depot.museum\0porsangu.no\0" -"laakesvuemie.no\0" -"sor-fron.no\0" -"heroy.more-og-romsdal.no\0" -"*.ck\0" -"!rakpetroleum.om\0" -"kr\xc3\xb8""dsherad.no\0mail.pl\0" -"mod.gi\0" -"gs.nl.no\0" -"mb.ca\0" -"pavia.it\0" -"civilisation.museum\0folldal.no\0" -"suli.hu\0" -"brumunddal.no\0" -"*.cy\0" -"pg.it\0troms\xc3\xb8.no\0" -"sex.pl\0y.se\0" -"org.ro\0" -"*.do\0" -"caserta.it\0org.sa\0" -"za.com\0halloffame.museum\0org.sb\0lviv.ua\0" -"mill.museum\0org.rs\0org.sc\0" -"org.sd\0" -"idv.hk\0!omanmobile.om\0org.ru\0org.se\0" -"langev\xc3\xa5g.no\0r\xc3\xa5holt.no\0starostwo.gov.pl\0" -"trani-andria-barletta.it\0org.sg\0" -"*.eg\0hvaler.no\0" -"*.ehime.jp\0" -"gmina.pl\0" -"bod\xc3\xb8.no\0org.sl\0" -"edu\0org.sn\0" -"org.so\0lib.wi.us\0" -"kommune.no\0" -"nome.pt\0" -"*.er\0namdalseid.no\0k12.wa.us\0" -"nm.cn\0org.st\0" -"*.et\0d\xc3\xb8nna.no\0" -"jewish.museum\0preservation.museum\0" -"slupsk.pl\0org.sy\0" -"art.br\0org.sz\0org.tj\0" -"ntr.br\0*.fj\0ski.no\0" -"*.fk\0rimini.it\0grajewo.pl\0" -"loppa.no\0" -"franziskaner.museum\0notteroy.no\0org.tn\0" -"org.to\0" -"nesoddtangen.no\0" -"org.ua\0" -"discovery.museum\0wloclawek.pl\0" -"lakas.hu\0org.tt\0" -"kurgan.ru\0" -"baltimore.museum\0nkz.ru\0org.tw\0" -"com.ac\0castle.museum\0" -"*.fukuoka.jp\0sandefjord.no\0varggat.no\0" -"com.af\0" -"com.ag\0" -"ato.br\0k12.nj.us\0" -"com.ai\0" -"city.hu\0oryol.ru\0" -"com.al\0nl.no\0mielno.pl\0cc.ma.us\0" -"org.vc\0" -"com.an\0g12.br\0" -"*.gt\0" -"*.gu\0" -"com.ba\0" -"com.bb\0americanart.museum\0" -"org.vi\0" -"kunstsammlung.museum\0" -"com.aw\0" -"flight.aero\0com.bh\0lib.mo.us\0org.vn\0" -"com.bi\0adygeya.ru\0" -"com.az\0" -"art.dz\0" -"com.bm\0" -"dr\xc3\xb8""bak.no\0" -"com.bo\0isla.pr\0" -"com.br\0" -"com.bs\0ustka.pl\0kuban.ru\0" -"press.aero\0" -"vs.it\0" -"meloy.no\0" -"*.il\0ulm.museum\0" -"com.by\0com.ci\0genoa.it\0" -"com.bz\0sn.cn\0" -"lib.or.us\0" -"santafe.museum\0org.ws\0" -}; - -QT_END_NAMESPACE - -#endif // QNETWORKCOOKIEJARTLD_P_H diff --git a/src/network/access/qnetworkcookiejartlds_p.h.INFO b/src/network/access/qnetworkcookiejartlds_p.h.INFO deleted file mode 100644 index 57a8d0e..0000000 --- a/src/network/access/qnetworkcookiejartlds_p.h.INFO +++ /dev/null @@ -1,17 +0,0 @@ -The file qnetworkcookiejartlds_p.h is generated from the Public Suffix -List (see [1] and [2]), by the program residing at -util/network/cookiejar-generateTLDs in the Qt source tree. - -That program generates a character array and an index array from the -list to provide fast lookups of elements within C++. - -Those arrays in qnetworkcookiejartlds_p.h are derived from the Public -Suffix List ([2]), which was originally provided by -Jo Hermans . - -The file qnetworkcookiejartlds_p.h was last generated Friday, -November 19th 15:24 2010. - ----- -[1] list: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -[2] homepage: http://publicsuffix.org/ diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 178f6d8..1f7c269 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -42,7 +42,7 @@ #include #include -#include "private/qnetworkcookiejar_p.h" +#include "private/qtldurl_p.h" class tst_QNetworkCookieJar: public QObject { @@ -438,7 +438,7 @@ void tst_QNetworkCookieJar::effectiveTLDs() #endif QFETCH(QString, domain); QFETCH(bool, isTLD); - QCOMPARE(QNetworkCookieJarPrivate::isEffectiveTLD(domain), isTLD); + QCOMPARE(qIsEffectiveTLD(domain), isTLD); } QTEST_MAIN(tst_QNetworkCookieJar) diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 336ee36..85aae1f 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -49,6 +49,7 @@ #include #include #include +#include "private/qtldurl_p.h" // For testsuites #define IDNA_ACE_PREFIX "xn--" @@ -88,6 +89,8 @@ public slots: void init(); void cleanup(); private slots: + void effectiveTLDs_data(); + void effectiveTLDs(); void getSetCheck(); void constructing(); void assignment(); @@ -4005,5 +4008,28 @@ void tst_QUrl::taskQTBUG_8701() QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString()); } +void tst_QUrl::effectiveTLDs_data() +{ + QTest::addColumn("domain"); + QTest::addColumn("TLD"); + + QTest::newRow("yes0") << QUrl::fromEncoded("http://test.co.uk") << ".co.uk"; + QTest::newRow("yes1") << QUrl::fromEncoded("http://test.com") << ".com"; + QTest::newRow("yes2") << QUrl::fromEncoded("http://www.test.de") << ".de"; + QTest::newRow("yes3") << QUrl::fromEncoded("http://test.ulm.museum") << ".ulm.museum"; + QTest::newRow("yes4") << QUrl::fromEncoded("http://www.com.krodsherad.no") << ".krodsherad.no"; + QTest::newRow("yes5") << QUrl::fromEncoded("http://www.co.uk.1.bg") << ".1.bg"; + QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn"; + QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws"; + QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum"; +} + +void tst_QUrl::effectiveTLDs() +{ + QFETCH(QUrl, domain); + QFETCH(QString, TLD); + QCOMPARE(domain.topLevelDomain(), TLD); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" diff --git a/util/corelib/qurl-generateTLDs/main.cpp b/util/corelib/qurl-generateTLDs/main.cpp new file mode 100644 index 0000000..baaf256 --- /dev/null +++ b/util/corelib/qurl-generateTLDs/main.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the utils of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +static QString utf8encode(const QByteArray &array) // turns e.g. tranøy.no to tran\xc3\xb8y.no +{ + QString result; + result.reserve(array.length() + array.length() / 3); + for (int i = 0; i < array.length(); ++i) { + char c = array.at(i); + // if char is non-ascii, escape it + if (c < 0x20 || uchar(c) >= 0x7f) { + result += "\\x" + QString::number(uchar(c), 16); + } else { + // if previous char was escaped, we need to make sure the next char is not + // interpreted as part of the hex value, e.g. "äc.com" -> "\xabc.com"; this + // should be "\xab""c.com" + QRegExp hexEscape("\\\\x[a-fA-F0-9][a-fA-F0-9]$"); + bool isHexChar = ((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F')); + if (result.contains(hexEscape) && isHexChar) + result += "\"\""; + result += c; + } + } + return result; +} + +int main(int argc, char **argv) { + + QCoreApplication app(argc, argv); + if (argc < 3) { + printf("\nusage: %s inputFile outputFile\n\n", argv[0]); + printf("'inputFile' should be a list of effective TLDs, one per line,\n"); + printf("as obtained from http://publicsuffix.org . To create indices and data file\n"); + printf("file, do the following:\n\n"); + printf(" wget http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -O effective_tld_names.dat\n"); + printf(" grep '^[^\\/\\/]' effective_tld_names.dat > effective_tld_names.dat.trimmed\n"); + printf(" %s effective_tld_names.dat.trimmed effective_tld_names.dat.qt\n\n", argv[0]); + printf("Now copy the data from effective_tld_names.dat.qt to the file src/corelib/io/qurltlds_p.h in your Qt repo\n\n"); + exit(1); + } + QFile file(argv[1]); + QFile outFile(argv[2]); + file.open(QIODevice::ReadOnly); + outFile.open(QIODevice::WriteOnly); + + QByteArray outIndicesBufferBA; + QBuffer outIndicesBuffer(&outIndicesBufferBA); + outIndicesBuffer.open(QIODevice::WriteOnly); + + QByteArray outDataBufferBA; + QBuffer outDataBuffer(&outDataBufferBA); + outDataBuffer.open(QIODevice::WriteOnly); + + int lineCount = 0; + while (!file.atEnd()) { + file.readLine(); + lineCount++; + } + file.reset(); + QVector strings(lineCount); + while (!file.atEnd()) { + QString s = QString::fromUtf8(file.readLine()); + QString st = s.trimmed(); + int num = qHash(st) % lineCount; + + QString utf8String = utf8encode(st.toUtf8()); + + // for domain 1.com, we could get something like + // a.com\01.com, which would be interpreted as octal 01, + // so we need to separate those strings with quotes + QRegExp regexpOctalEscape(QLatin1String("^[0-9]")); + if (!strings.at(num).isEmpty() && st.contains(regexpOctalEscape)) + strings[num].append("\"\""); + + strings[num].append(utf8String); + strings[num].append("\\0"); + } + + outIndicesBuffer.write("static const quint16 tldCount = "); + outIndicesBuffer.write(QByteArray::number(lineCount)); + outIndicesBuffer.write(";\n"); + outIndicesBuffer.write("static const quint16 tldIndices["); +// outIndicesBuffer.write(QByteArray::number(lineCount+1)); // not needed + outIndicesBuffer.write("] = {\n"); + + int utf8Size = 0; +// int charSize = 0; + for (int a = 0; a < lineCount; a++) { + bool lineIsEmpty = strings.at(a).isEmpty(); + if (!lineIsEmpty) { + strings[a].prepend("\""); + strings[a].append("\""); + } + int zeroCount = strings.at(a).count(QLatin1String("\\0")); + int utf8CharsCount = strings.at(a).count(QLatin1String("\\x")); + int quoteCount = strings.at(a).count('"'); + outDataBuffer.write(strings.at(a).toUtf8()); + if (!lineIsEmpty) + outDataBuffer.write("\n"); + outIndicesBuffer.write(QByteArray::number(utf8Size)); + outIndicesBuffer.write(",\n"); + utf8Size += strings.at(a).count() - (zeroCount + quoteCount + utf8CharsCount * 3); +// charSize += strings.at(a).count(); + } + outIndicesBuffer.write(QByteArray::number(utf8Size)); + outIndicesBuffer.write("};\n"); + outIndicesBuffer.close(); + outFile.write(outIndicesBufferBA); + + outDataBuffer.close(); + outFile.write("\nstatic const char tldData["); +// outFile.write(QByteArray::number(charSize)); // not needed + outFile.write("] = {\n"); + outFile.write(outDataBufferBA); + outFile.write("};\n"); + outFile.close(); + printf("data generated to %s . Now copy the data from this file to src/corelib/io/qurltlds_p.h in your Qt repo\n", argv[2]); + exit(0); +} diff --git a/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro new file mode 100644 index 0000000..9d5f1cf --- /dev/null +++ b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +QT = core + +# Input +SOURCES += main.cpp diff --git a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro b/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro deleted file mode 100644 index 9d5f1cf..0000000 --- a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -QT = core - -# Input -SOURCES += main.cpp diff --git a/util/network/cookiejar-generateTLDs/main.cpp b/util/network/cookiejar-generateTLDs/main.cpp deleted file mode 100644 index 5cdc97c..0000000 --- a/util/network/cookiejar-generateTLDs/main.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -static QString utf8encode(const QByteArray &array) // turns e.g. tranøy.no to tran\xc3\xb8y.no -{ - QString result; - result.reserve(array.length() + array.length() / 3); - for (int i = 0; i < array.length(); ++i) { - char c = array.at(i); - // if char is non-ascii, escape it - if (c < 0x20 || uchar(c) >= 0x7f) { - result += "\\x" + QString::number(uchar(c), 16); - } else { - // if previous char was escaped, we need to make sure the next char is not - // interpreted as part of the hex value, e.g. "äc.com" -> "\xabc.com"; this - // should be "\xab""c.com" - QRegExp hexEscape("\\\\x[a-fA-F0-9][a-fA-F0-9]$"); - bool isHexChar = ((c >= '0' && c <= '9') || - (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F')); - if (result.contains(hexEscape) && isHexChar) - result += "\"\""; - result += c; - } - } - return result; -} - -int main(int argc, char **argv) { - - QCoreApplication app(argc, argv); - if (argc < 3) { - printf("\nusage: %s inputFile outputFile\n\n", argv[0]); - printf("'inputFile' should be a list of effective TLDs, one per line,\n"); - printf("as obtained from http://publicsuffix.org . To create indices and data file\n"); - printf("file, do the following:\n\n"); - printf(" wget http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -O effective_tld_names.dat\n"); - printf(" grep '^[^\\/\\/]' effective_tld_names.dat > effective_tld_names.dat.trimmed\n"); - printf(" %s effective_tld_names.dat.trimmed effective_tld_names.dat.qt\n\n", argv[0]); - printf("Now copy the data from effective_tld_names.dat.qt to the file src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n\n"); - exit(1); - } - QFile file(argv[1]); - QFile outFile(argv[2]); - file.open(QIODevice::ReadOnly); - outFile.open(QIODevice::WriteOnly); - - QByteArray outIndicesBufferBA; - QBuffer outIndicesBuffer(&outIndicesBufferBA); - outIndicesBuffer.open(QIODevice::WriteOnly); - - QByteArray outDataBufferBA; - QBuffer outDataBuffer(&outDataBufferBA); - outDataBuffer.open(QIODevice::WriteOnly); - - int lineCount = 0; - while (!file.atEnd()) { - file.readLine(); - lineCount++; - } - file.reset(); - QVector strings(lineCount); - while (!file.atEnd()) { - QString s = QString::fromUtf8(file.readLine()); - QString st = s.trimmed(); - int num = qHash(st) % lineCount; - - QString utf8String = utf8encode(st.toUtf8()); - - // for domain 1.com, we could get something like - // a.com\01.com, which would be interpreted as octal 01, - // so we need to separate those strings with quotes - QRegExp regexpOctalEscape(QLatin1String("^[0-9]")); - if (!strings.at(num).isEmpty() && st.contains(regexpOctalEscape)) - strings[num].append("\"\""); - - strings[num].append(utf8String); - strings[num].append("\\0"); - } - - outIndicesBuffer.write("static const quint16 tldCount = "); - outIndicesBuffer.write(QByteArray::number(lineCount)); - outIndicesBuffer.write(";\n"); - outIndicesBuffer.write("static const quint16 tldIndices["); -// outIndicesBuffer.write(QByteArray::number(lineCount+1)); // not needed - outIndicesBuffer.write("] = {\n"); - - int utf8Size = 0; -// int charSize = 0; - for (int a = 0; a < lineCount; a++) { - bool lineIsEmpty = strings.at(a).isEmpty(); - if (!lineIsEmpty) { - strings[a].prepend("\""); - strings[a].append("\""); - } - int zeroCount = strings.at(a).count(QLatin1String("\\0")); - int utf8CharsCount = strings.at(a).count(QLatin1String("\\x")); - int quoteCount = strings.at(a).count('"'); - outDataBuffer.write(strings.at(a).toUtf8()); - if (!lineIsEmpty) - outDataBuffer.write("\n"); - outIndicesBuffer.write(QByteArray::number(utf8Size)); - outIndicesBuffer.write(",\n"); - utf8Size += strings.at(a).count() - (zeroCount + quoteCount + utf8CharsCount * 3); -// charSize += strings.at(a).count(); - } - outIndicesBuffer.write(QByteArray::number(utf8Size)); - outIndicesBuffer.write("};\n"); - outIndicesBuffer.close(); - outFile.write(outIndicesBufferBA); - - outDataBuffer.close(); - outFile.write("\nstatic const char tldData["); -// outFile.write(QByteArray::number(charSize)); // not needed - outFile.write("] = {\n"); - outFile.write(outDataBufferBA); - outFile.write("};\n"); - outFile.close(); - printf("data generated to %s . Now copy the data from this file to src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n", argv[2]); - exit(0); -} -- cgit v0.12 From 9face4b88de2db6f552149d2f96257620e971a59 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 24 May 2011 12:05:10 +0200 Subject: QUrl TLD: fix documentation file for "Add QUrl::topLevelDomain() ..." see previous commit Task-number: QTBUG-13601 --- src/corelib/io/qurltlds_p.h.INFO | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qurltlds_p.h.INFO b/src/corelib/io/qurltlds_p.h.INFO index 57a8d0e..5781c2c 100644 --- a/src/corelib/io/qurltlds_p.h.INFO +++ b/src/corelib/io/qurltlds_p.h.INFO @@ -1,15 +1,15 @@ -The file qnetworkcookiejartlds_p.h is generated from the Public Suffix +The file qurltlds_p.h is generated from the Public Suffix List (see [1] and [2]), by the program residing at -util/network/cookiejar-generateTLDs in the Qt source tree. +util/corelib/qurl-generateTLDs in the Qt source tree. That program generates a character array and an index array from the list to provide fast lookups of elements within C++. -Those arrays in qnetworkcookiejartlds_p.h are derived from the Public +Those arrays in qurltlds_p.h are derived from the Public Suffix List ([2]), which was originally provided by Jo Hermans . -The file qnetworkcookiejartlds_p.h was last generated Friday, +The file qurltlds_p.h was last generated Friday, November 19th 15:24 2010. ---- -- cgit v0.12 From 0c9338a7c756efae99370b74d7fe49871d67fe38 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Tue, 24 May 2011 12:30:57 +0200 Subject: Move wayland headers files to 3rdparty due to copyright issues Reviewed-by: Paul Olav Tvete --- .../qwaylandwindowmanager-client-protocol.h | 82 ++++++++++++++++++++++ .../wayland/wayland-windowmanager-protocol.c | 36 ++++++++++ .../qwaylandwindowmanager-client-protocol.h | 82 ---------------------- .../wayland-windowmanager-protocol.c | 36 ---------- 4 files changed, 118 insertions(+), 118 deletions(-) create mode 100644 src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h create mode 100644 src/3rdparty/wayland/wayland-windowmanager-protocol.c delete mode 100644 src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h delete mode 100644 src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c diff --git a/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h b/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h new file mode 100644 index 0000000..ec776c5 --- /dev/null +++ b/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h @@ -0,0 +1,82 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H +#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; + +struct wl_windowmanager; + +extern const struct wl_interface wl_windowmanager_interface; + +#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 + +static inline struct wl_windowmanager * +wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/) +{ + // ### does not run without latest wayland. must be enabled later + //wl_display_bind(display, id, "wl_windowmanager", version); + + return (struct wl_windowmanager *) + wl_proxy_create_for_id(display, &wl_windowmanager_interface, id); +} + +static inline void +wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data); +} + +static inline void * +wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager); +} + +static inline void +wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager) +{ + wl_proxy_destroy((struct wl_proxy *) wl_windowmanager); +} + +static inline void +wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid) +{ + wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, + WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-windowmanager-protocol.c b/src/3rdparty/wayland/wayland-windowmanager-protocol.c new file mode 100644 index 0000000..48049d8 --- /dev/null +++ b/src/3rdparty/wayland/wayland-windowmanager-protocol.c @@ -0,0 +1,36 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#include +#include +#include "wayland-util.h" + +static const struct wl_message wl_windowmanager_requests[] = { + { "map_client_to_process", "u", NULL }, +}; + +WL_EXPORT const struct wl_interface wl_windowmanager_interface = { + "wl_windowmanager", 1, + ARRAY_LENGTH(wl_windowmanager_requests), wl_windowmanager_requests, + 0, NULL, +}; diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h deleted file mode 100644 index ec776c5..0000000 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H -#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-util.h" - -struct wl_client; - -struct wl_windowmanager; - -extern const struct wl_interface wl_windowmanager_interface; - -#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 - -static inline struct wl_windowmanager * -wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/) -{ - // ### does not run without latest wayland. must be enabled later - //wl_display_bind(display, id, "wl_windowmanager", version); - - return (struct wl_windowmanager *) - wl_proxy_create_for_id(display, &wl_windowmanager_interface, id); -} - -static inline void -wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data); -} - -static inline void * -wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager); -} - -static inline void -wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager) -{ - wl_proxy_destroy((struct wl_proxy *) wl_windowmanager); -} - -static inline void -wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid) -{ - wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, - WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c deleted file mode 100644 index 48049d8..0000000 --- a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#include -#include -#include "wayland-util.h" - -static const struct wl_message wl_windowmanager_requests[] = { - { "map_client_to_process", "u", NULL }, -}; - -WL_EXPORT const struct wl_interface wl_windowmanager_interface = { - "wl_windowmanager", 1, - ARRAY_LENGTH(wl_windowmanager_requests), wl_windowmanager_requests, - 0, NULL, -}; -- cgit v0.12 From 727f5e50447bf47040746a7a37d488204b279171 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Tue, 24 May 2011 12:31:16 +0200 Subject: Refer to 3rdparty in windowmanagerintegration headers Reviewed-by: Paul Olav Tvete --- .../windowmanager_integration/windowmanager_integration.pri | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri index a282182..664389a 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri +++ b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri @@ -3,14 +3,14 @@ DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) { HEADERS += \ - $$PWD/qwaylandwindowmanager-client-protocol.h \ $$PWD/qwaylandwindowmanagerintegration.h SOURCES += \ - $$PWD/qwaylandwindowmanagerintegration.cpp \ - $$PWD/wayland-windowmanager-protocol.c + $$PWD/qwaylandwindowmanagerintegration.cpp + INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wayland + HEADERS += \ + $$QT_SOURCE_TREE/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h + SOURCES += \ + $$QT_SOURCE_TREE/src/3rdparty/wayland/wayland-windowmanager-protocol.c } - - - -- cgit v0.12 From b001e886b35d06ca2551709280f0541cdc75c34a Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Tue, 24 May 2011 13:43:45 +0300 Subject: Fix the state of default network configuration. PMO Bug 257336 - Default configuration remains in QNetworkConfiguration::Active state even when device moves out of WLAN coverage This fix sets the default network configuration (of type UserChoice) back to Discovered when the network session is disconnected. Reviewed-by: Cristiano di Flora --- src/plugins/bearer/icd/qnetworksession_impl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index f08d8bf..a99c0a7 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -183,6 +183,12 @@ void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState) icdConfig->mutex.lock(); icdConfig->state = QNetworkConfiguration::Defined; icdConfig->mutex.unlock(); + + // Reset the state of the default configuration to Discovered + icdConfig = toIcdConfig(privateConfiguration(publicConfig)); + icdConfig->mutex.lock(); + icdConfig->state = QNetworkConfiguration::Discovered; + icdConfig->mutex.unlock(); } else { if (!activeConfig.isValid()) { // Active configuration (IAP) was removed from system -- cgit v0.12 From 1a8d59ba46dda3f0951f399f75528961127243b2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 24 May 2011 13:38:25 +0200 Subject: QDeclarativeDebug: Fix autotest on Windows/MSVC --- tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 8871e45..9c20bd6 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -224,7 +224,7 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe QCOMPARE(p.name(), QString::fromUtf8(pmeta.name())); - if (pmeta.type() < QVariant::UserType) // TODO test complex types + if (pmeta.type() > 0 && pmeta.type() < QVariant::UserType) // TODO test complex types QCOMPARE(p.value(), pmeta.read(o)); if (p.name() == "parent") -- cgit v0.12 From 7214d84f3296a05e6db09f0ed12702b21c3fcb30 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 24 May 2011 14:18:23 +0200 Subject: Fix xToCursor issue due to backporting from 4.8 Task-number: QTBUG-19260 Reviewed-by: TrustMe --- src/gui/text/qtextlayout.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 5857f33..a9179ed 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2659,6 +2659,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (gs <= ge) { if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } pos -= glyphs.effectiveAdvance(gs); @@ -2668,6 +2669,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (gs <= ge) { if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } pos += glyphs.effectiveAdvance(gs); -- cgit v0.12 From 73060143c30d38ea99e6d7a77ff81c94f58899d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 24 May 2011 11:22:29 +0200 Subject: DeclarativeObserver: Removed the SubcomponentEditorTool This tool made selecting items in your QML app more complicated than necessary. Now, left-click will always just select the top-most item under the mouse and right-click will allow you to select any of the items below. Also, the highlighted bounding rect now always applies to just one item, instead of also including the children bounding rect. Reviewed-by: Kai Koehne Change-Id: I17b5ab397d951fd68711590469ca6e723a9cb0e6 --- .../declarativeobserver/declarativeobserver.pro | 2 - .../editor/abstractliveedittool.cpp | 5 - .../editor/abstractliveedittool_p.h | 2 - .../editor/boundingrecthighlighter.cpp | 8 +- .../editor/liveselectiontool.cpp | 4 - .../editor/subcomponenteditortool.cpp | 364 --------------------- .../editor/subcomponenteditortool_p.h | 131 -------- .../qdeclarativeobserverprotocol.h | 2 - .../qdeclarativeviewobserver.cpp | 169 +--------- .../qdeclarativeviewobserver_p.h | 7 - .../qdeclarativeviewobserver_p_p.h | 20 +- 11 files changed, 17 insertions(+), 697 deletions(-) delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h diff --git a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro b/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro index bccabcb..e7a69f2 100644 --- a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro +++ b/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro @@ -17,7 +17,6 @@ SOURCES += \ editor/liveselectionrectangle.cpp \ editor/liveselectionindicator.cpp \ editor/boundingrecthighlighter.cpp \ - editor/subcomponenteditortool.cpp \ editor/subcomponentmasklayeritem.cpp \ editor/zoomtool.cpp \ editor/colorpickertool.cpp \ @@ -38,7 +37,6 @@ HEADERS += \ editor/liveselectionrectangle_p.h \ editor/liveselectionindicator_p.h \ editor/boundingrecthighlighter_p.h \ - editor/subcomponenteditortool_p.h \ editor/subcomponentmasklayeritem_p.h \ editor/zoomtool_p.h \ editor/colorpickertool_p.h \ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp index c2ea17c..a97a537 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp @@ -85,11 +85,6 @@ QList AbstractLiveEditTool::items() const return observer()->selectedItems(); } -void AbstractLiveEditTool::enterContext(QGraphicsItem *itemToEnter) -{ - observer()->data->enterContext(itemToEnter); -} - bool AbstractLiveEditTool::topItemIsMovable(const QList & itemList) { QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h index 7d46db6..97aac35 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h +++ b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h @@ -89,8 +89,6 @@ public: void updateSelectedItems(); QList items() const; - void enterContext(QGraphicsItem *itemToEnter); - bool topItemIsMovable(const QList &itemList); bool topItemIsResizeHandle(const QList &itemList); bool topSelectedItemIsMovable(const QList &itemList); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp index 068f6de..e9594d5 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp @@ -253,12 +253,10 @@ void BoundingRectHighlighter::highlightAll(bool animate) return; } QGraphicsObject *item = box->highlightedObject.data(); - QRectF itemAndChildRect = item->boundingRect() | item->childrenBoundingRect(); - QPolygonF boundingRectInSceneSpace(item->mapToScene(itemAndChildRect)); - QPolygonF boundingRectInLayerItemSpace = mapFromScene(boundingRectInSceneSpace); - QRectF bboxRect - = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace.boundingRect()); + QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); + QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); + QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); QRectF edgeRect = bboxRect; edgeRect.adjust(-1, -1, 1, 1); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp index 62b6e01..872832c 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp @@ -134,9 +134,6 @@ void LiveSelectionTool::mousePressEvent(QMouseEvent *event) void LiveSelectionTool::createContextMenu(QList itemList, QPoint globalPos) { - if (!QDeclarativeViewObserverPrivate::get(observer())->mouseInsideContextItem()) - return; - QMenu contextMenu; connect(&contextMenu, SIGNAL(hovered(QAction*)), this, SLOT(contextMenuElementHovered(QAction*))); @@ -192,7 +189,6 @@ void LiveSelectionTool::contextMenuElementSelected() QList() << item, false); m_singleSelectionManipulator.end(updatePt); - enterContext(item); } } diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp deleted file mode 100644 index c3790e4..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "subcomponenteditortool_p.h" -#include "subcomponentmasklayeritem_p.h" -#include "livelayeritem_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -const qreal MaxOpacity = 0.5f; - -SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeViewObserver *view) - : AbstractLiveEditTool(view), - m_animIncrement(0.05f), - m_animTimer(new QTimer(this)) -{ - QDeclarativeViewObserverPrivate *observerPrivate = - QDeclarativeViewObserverPrivate::get(view); - m_mask = new SubcomponentMaskLayerItem(view, observerPrivate->manipulatorLayer); - connect(m_animTimer, SIGNAL(timeout()), SLOT(animate())); - m_animTimer->setInterval(20); -} - -SubcomponentEditorTool::~SubcomponentEditorTool() -{ - -} - -void SubcomponentEditorTool::mousePressEvent(QMouseEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::mouseMoveEvent(QMouseEvent * /*event*/) -{ - -} - -bool SubcomponentEditorTool::containsCursor(const QPoint &mousePos) const -{ - if (!m_currentContext.size()) - return false; - - QPointF scenePos = view()->mapToScene(mousePos); - QRectF itemRect = m_currentContext.top()->boundingRect() - | m_currentContext.top()->childrenBoundingRect(); - QRectF polyRect = m_currentContext.top()->mapToScene(itemRect).boundingRect(); - - return polyRect.contains(scenePos); -} - -void SubcomponentEditorTool::mouseReleaseEvent(QMouseEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::mouseDoubleClickEvent(QMouseEvent *event) -{ - if (event->buttons() & Qt::LeftButton - && !containsCursor(event->pos()) - && m_currentContext.size() > 1) - { - aboutToPopContext(); - } -} - -void SubcomponentEditorTool::hoverMoveEvent(QMouseEvent *event) -{ - if (!containsCursor(event->pos()) && m_currentContext.size() > 1) { - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); - } -} - -void SubcomponentEditorTool::wheelEvent(QWheelEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::keyPressEvent(QKeyEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ - -} - -void SubcomponentEditorTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ - -} - -void SubcomponentEditorTool::animate() -{ - if (m_animIncrement > 0) { - if (m_mask->opacity() + m_animIncrement < MaxOpacity) { - m_mask->setOpacity(m_mask->opacity() + m_animIncrement); - } else { - m_animTimer->stop(); - m_mask->setOpacity(MaxOpacity); - } - } else { - if (m_mask->opacity() + m_animIncrement > 0) { - m_mask->setOpacity(m_mask->opacity() + m_animIncrement); - } else { - m_animTimer->stop(); - m_mask->setOpacity(0); - popContext(); - emit contextPathChanged(m_path); - } - } - -} - -void SubcomponentEditorTool::clear() -{ - m_currentContext.clear(); - m_mask->setCurrentItem(0); - m_animTimer->stop(); - m_mask->hide(); - m_path.clear(); - - emit contextPathChanged(m_path); - emit cleared(); -} - -void SubcomponentEditorTool::selectedItemsChanged(const QList &/*itemList*/) -{ - -} - -void SubcomponentEditorTool::setCurrentItem(QGraphicsItem* contextItem) -{ - if (!contextItem) - return; - - QGraphicsObject *gfxObject = contextItem->toGraphicsObject(); - if (!gfxObject) - return; - - //QString parentClassName = gfxObject->metaObject()->className(); - //if (parentClassName.contains(QRegExp("_QMLTYPE_\\d+"))) - - bool containsSelectableItems = false; - foreach (QGraphicsItem *item, gfxObject->childItems()) { - if (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType) - { - continue; - } - containsSelectableItems = true; - break; - } - - if (containsSelectableItems) { - m_mask->setCurrentItem(gfxObject); - m_mask->setOpacity(0); - m_mask->show(); - m_animIncrement = 0.05f; - m_animTimer->start(); - - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); - observer()->setSelectedItems(QList()); - - pushContext(gfxObject); - } -} - -QGraphicsItem *SubcomponentEditorTool::firstChildOfContext(QGraphicsItem *item) const -{ - if (!item) - return 0; - - if (isDirectChildOfContext(item)) - return item; - - QGraphicsItem *parent = item->parentItem(); - while (parent) { - if (isDirectChildOfContext(parent)) - return parent; - parent = parent->parentItem(); - } - - return 0; -} - -bool SubcomponentEditorTool::isChildOfContext(QGraphicsItem *item) const -{ - return (firstChildOfContext(item) != 0); -} - -bool SubcomponentEditorTool::isDirectChildOfContext(QGraphicsItem *item) const -{ - return (item->parentItem() == m_currentContext.top()); -} - -bool SubcomponentEditorTool::itemIsChildOfQmlSubComponent(QGraphicsItem *item) const -{ - if (item->parentItem() && item->parentItem() != m_currentContext.top()) { - QGraphicsObject *parent = item->parentItem()->toGraphicsObject(); - QString parentClassName = QLatin1String(parent->metaObject()->className()); - - if (parentClassName.contains(QRegExp(QLatin1String("_QMLTYPE_\\d+")))) { - return true; - } else { - return itemIsChildOfQmlSubComponent(parent); - } - } - - return false; -} - -void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem) -{ - connect(contextItem, SIGNAL(destroyed(QObject*)), this, SLOT(contextDestroyed(QObject*))); - connect(contextItem, SIGNAL(xChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(yChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(widthChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(heightChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(rotationChanged()), this, SLOT(resizeMask())); - - m_currentContext.push(contextItem); - QString title = titleForItem(contextItem); - emit contextPushed(title); - - m_path << title; - emit contextPathChanged(m_path); -} - -void SubcomponentEditorTool::aboutToPopContext() -{ - if (m_currentContext.size() > 2) { - popContext(); - emit contextPathChanged(m_path); - } else { - m_animIncrement = -0.05f; - m_animTimer->start(); - } -} - -QGraphicsObject *SubcomponentEditorTool::popContext() -{ - QGraphicsObject *popped = m_currentContext.pop(); - m_path.removeLast(); - - emit contextPopped(); - - disconnect(popped, SIGNAL(xChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(yChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(scaleChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(widthChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(heightChanged()), this, SLOT(resizeMask())); - - if (m_currentContext.size() > 1) { - QGraphicsObject *item = m_currentContext.top(); - m_mask->setCurrentItem(item); - m_mask->setOpacity(MaxOpacity); - m_mask->setVisible(true); - } else { - m_mask->setVisible(false); - } - - return popped; -} - -void SubcomponentEditorTool::resizeMask() -{ - QGraphicsObject *item = m_currentContext.top(); - m_mask->setCurrentItem(item); -} - -QGraphicsObject *SubcomponentEditorTool::currentRootItem() const -{ - return m_currentContext.top(); -} - -void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy) -{ - disconnect(contextToDestroy, SIGNAL(destroyed(QObject*)), - this, SLOT(contextDestroyed(QObject*))); - - // pop out the whole context - it might not be safe anymore. - while (m_currentContext.size() > 1) { - m_currentContext.pop(); - m_path.removeLast(); - emit contextPopped(); - } - m_mask->setVisible(false); - - emit contextPathChanged(m_path); -} - -QGraphicsObject *SubcomponentEditorTool::setContext(int contextIndex) -{ - Q_ASSERT(contextIndex >= 0); - - // sometimes we have to delete the context while user was still clicking around, - // so just bail out. - if (contextIndex >= m_currentContext.size() -1) - return 0; - - while (m_currentContext.size() - 1 > contextIndex) { - popContext(); - } - emit contextPathChanged(m_path); - - return m_currentContext.top(); -} - -int SubcomponentEditorTool::contextIndex() const -{ - return m_currentContext.size() - 1; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h deleted file mode 100644 index 29b2956..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SUBCOMPONENTEDITORTOOL_H -#define SUBCOMPONENTEDITORTOOL_H - -#include "abstractliveedittool_p.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QPoint) -QT_FORWARD_DECLARE_CLASS(QTimer) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class SubcomponentMaskLayerItem; - -class SubcomponentEditorTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - SubcomponentEditorTool(QDeclarativeViewObserver *view); - ~SubcomponentEditorTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void itemsAboutToRemoved(const QList &itemList); - - void clear(); - - bool containsCursor(const QPoint &mousePos) const; - bool itemIsChildOfQmlSubComponent(QGraphicsItem *item) const; - - bool isChildOfContext(QGraphicsItem *item) const; - bool isDirectChildOfContext(QGraphicsItem *item) const; - QGraphicsItem *firstChildOfContext(QGraphicsItem *item) const; - - void setCurrentItem(QGraphicsItem *contextObject); - - void pushContext(QGraphicsObject *contextItem); - - QGraphicsObject *currentRootItem() const; - QGraphicsObject *setContext(int contextIndex); - int contextIndex() const; - -signals: - void exitContextRequested(); - void cleared(); - void contextPushed(const QString &contextTitle); - void contextPopped(); - void contextPathChanged(const QStringList &path); - -protected: - void selectedItemsChanged(const QList &itemList); - -private slots: - void animate(); - void contextDestroyed(QObject *context); - void resizeMask(); - -private: - QGraphicsObject *popContext(); - void aboutToPopContext(); - -private: - QStack m_currentContext; - QStringList m_path; - - qreal m_animIncrement; - SubcomponentMaskLayerItem *m_mask; - QTimer *m_animTimer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // SUBCOMPONENTEDITORTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h index 836163e..62722acc 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h @@ -65,7 +65,6 @@ public: ChangeTool = 1, ClearComponentCache = 2, ColorChanged = 3, - ContextPathUpdated = 4, CreateObject = 5, CurrentObjectsChanged = 6, DestroyObject = 7, @@ -75,7 +74,6 @@ public: Reloaded = 11, SetAnimationSpeed = 12, SetAnimationPaused = 18, - SetContextPathIdx = 13, SetCurrentObjects = 14, SetDesignMode = 15, ShowAppOnTop = 16, diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp index 5d2ab09..a49a758 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp @@ -51,7 +51,6 @@ #include "editor/colorpickertool_p.h" #include "editor/livelayeritem_p.h" #include "editor/boundingrecthighlighter_p.h" -#include "editor/subcomponenteditortool_p.h" #include "editor/qmltoolbar_p.h" #include @@ -138,7 +137,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, data->zoomTool = new ZoomTool(this); data->colorPickerTool = new ColorPickerTool(this); data->boundingRectHighlighter = new BoundingRectHighlighter(this); - data->subcomponentEditorTool = new SubcomponentEditorTool(this); data->currentTool = data->selectionTool; // to capture ChildRemoved event when viewport changes @@ -158,14 +156,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), this, SLOT(sendColorChanged(QColor))); - connect(data->subcomponentEditorTool, SIGNAL(cleared()), SIGNAL(inspectorContextCleared())); - connect(data->subcomponentEditorTool, SIGNAL(contextPushed(QString)), - SIGNAL(inspectorContextPushed(QString))); - connect(data->subcomponentEditorTool, SIGNAL(contextPopped()), - SIGNAL(inspectorContextPopped())); - connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), - this, SLOT(sendContextPathUpdated(QStringList))); - data->_q_changeToSingleSelectTool(); } @@ -173,15 +163,6 @@ QDeclarativeViewObserver::~QDeclarativeViewObserver() { } -void QDeclarativeViewObserver::setObserverContext(int contextIndex) -{ - if (data->subcomponentEditorTool->contextIndex() != contextIndex) { - QGraphicsObject *object = data->subcomponentEditorTool->setContext(contextIndex); - if (object) - setSelectedItems(QList() << object); - } -} - void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) { #if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) @@ -196,7 +177,6 @@ void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) void QDeclarativeViewObserverPrivate::_q_reloadView() { - subcomponentEditorTool->clear(); clearHighlight(); emit q->reloadRequested(); } @@ -318,10 +298,8 @@ bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) declarativeView()->setToolTip(QString()); } if (event->buttons()) { - data->subcomponentEditorTool->mouseMoveEvent(event); data->currentTool->mouseMoveEvent(event); } else { - data->subcomponentEditorTool->hoverMoveEvent(event); data->currentTool->hoverMoveEvent(event); } return true; @@ -331,7 +309,6 @@ bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event) { if (!data->designModeBehavior) return false; - data->subcomponentEditorTool->mouseReleaseEvent(event); data->cursorPos = event->pos(); data->currentTool->mouseReleaseEvent(event); @@ -366,11 +343,6 @@ bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) case Qt::Key_Z: data->_q_changeToZoomTool(); break; - case Qt::Key_Enter: - case Qt::Key_Return: - if (!data->selectedItems().isEmpty()) - data->subcomponentEditorTool->setCurrentItem(data->selectedItems().first()); - break; case Qt::Key_Space: setAnimationPaused(!data->animationPaused); break; @@ -435,41 +407,11 @@ void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) setSelectedItems(items); } -QGraphicsItem *QDeclarativeViewObserverPrivate::currentRootItem() const -{ - return subcomponentEditorTool->currentRootItem(); -} - -bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent *event) +bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/) { if (!data->designModeBehavior) return false; - if (data->currentToolMode != Constants::SelectionToolMode - && data->currentToolMode != Constants::MarqueeSelectionToolMode) - return true; - - QGraphicsItem *itemToEnter = 0; - QList itemList = data->view->items(event->pos()); - data->filterForSelection(itemList); - - if (data->selectedItems().isEmpty() && !itemList.isEmpty()) { - itemToEnter = itemList.first(); - } else if (!data->selectedItems().isEmpty() && !itemList.isEmpty()) { - itemToEnter = itemList.first(); - } - - if (itemToEnter) - itemToEnter = data->subcomponentEditorTool->firstChildOfContext(itemToEnter); - - data->subcomponentEditorTool->setCurrentItem(itemToEnter); - data->subcomponentEditorTool->mouseDoubleClickEvent(event); - - if ((event->buttons() & Qt::LeftButton) && itemToEnter) { - if (QGraphicsObject *objectToEnter = itemToEnter->toGraphicsObject()) - setSelectedItems(QList() << objectToEnter); - } - return true; } @@ -481,16 +423,6 @@ bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) return true; } -void QDeclarativeViewObserverPrivate::enterContext(QGraphicsItem *itemToEnter) -{ - QGraphicsItem *itemUnderCurrentContext = itemToEnter; - if (itemUnderCurrentContext) - itemUnderCurrentContext = subcomponentEditorTool->firstChildOfContext(itemToEnter); - - if (itemUnderCurrentContext) - subcomponentEditorTool->setCurrentItem(itemToEnter); -} - void QDeclarativeViewObserver::setDesignModeBehavior(bool value) { emit designModeBehaviorChanged(value); @@ -500,14 +432,6 @@ void QDeclarativeViewObserver::setDesignModeBehavior(bool value) sendDesignModeBehavior(value); data->designModeBehavior = value; - if (data->subcomponentEditorTool) { - data->subcomponentEditorTool->clear(); - data->clearHighlight(); - data->setSelectedItems(QList()); - - if (data->view->rootObject()) - data->subcomponentEditorTool->pushContext(data->view->rootObject()); - } if (!data->designModeBehavior) data->clearEditorItems(); @@ -628,13 +552,7 @@ void QDeclarativeViewObserverPrivate::clearHighlight() boundingRectHighlighter->clear(); } -void QDeclarativeViewObserverPrivate::highlight(QGraphicsObject * item, ContextFlags flags) -{ - highlight(QList() << item, flags); -} - -void QDeclarativeViewObserverPrivate::highlight(const QList &items, - ContextFlags flags) +void QDeclarativeViewObserverPrivate::highlight(const QList &items) { if (items.isEmpty()) return; @@ -642,8 +560,6 @@ void QDeclarativeViewObserverPrivate::highlight(const QList & QList objectList; foreach (QGraphicsItem *item, items) { QGraphicsItem *child = item; - if (flags & ContextSensitive) - child = subcomponentEditorTool->firstChildOfContext(item); if (child) { QGraphicsObject *childObject = child->toGraphicsObject(); @@ -655,30 +571,24 @@ void QDeclarativeViewObserverPrivate::highlight(const QList & boundingRectHighlighter->highlight(objectList); } -bool QDeclarativeViewObserverPrivate::mouseInsideContextItem() const -{ - return subcomponentEditorTool->containsCursor(cursorPos.toPoint()); -} - QList QDeclarativeViewObserverPrivate::selectableItems( const QPointF &scenePos) const { QList itemlist = view->scene()->items(scenePos); - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } QList QDeclarativeViewObserverPrivate::selectableItems(const QPoint &pos) const { QList itemlist = view->items(pos); - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } QList QDeclarativeViewObserverPrivate::selectableItems( const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const { QList itemlist = view->scene()->items(sceneRect, selectionMode); - - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() @@ -738,11 +648,6 @@ void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() q->sendCurrentTool(Constants::ColorPickerMode); } -void QDeclarativeViewObserverPrivate::_q_changeContextPathIndex(int index) -{ - subcomponentEditorTool->setContext(index); -} - void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) { Q_ASSERT(slowDownFactor > 0); @@ -794,38 +699,13 @@ QList QDeclarativeViewObserverPrivate::filterForSelection( QList &itemlist) const { foreach (QGraphicsItem *item, itemlist) { - if (isEditorItem(item) || !subcomponentEditorTool->isChildOfContext(item)) + if (isEditorItem(item)) itemlist.removeOne(item); } return itemlist; } -QList QDeclarativeViewObserverPrivate::filterForCurrentContext( - QList &itemlist) const -{ - foreach (QGraphicsItem *item, itemlist) { - - if (isEditorItem(item) || !subcomponentEditorTool->isDirectChildOfContext(item)) { - - // if we're a child, but not directly, replace with the parent that is directly in context. - if (QGraphicsItem *contextParent = subcomponentEditorTool->firstChildOfContext(item)) { - if (contextParent != item) { - if (itemlist.contains(contextParent)) { - itemlist.removeOne(item); - } else { - itemlist.replace(itemlist.indexOf(item), contextParent); - } - } - } else { - itemlist.removeOne(item); - } - } - } - - return itemlist; -} - bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const { return (item->type() == Constants::EditorItemType @@ -835,14 +715,8 @@ bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Status status) { - if (status == QDeclarativeView::Ready) { - if (view->rootObject()) { - if (subcomponentEditorTool->contextIndex() != -1) - subcomponentEditorTool->clear(); - subcomponentEditorTool->pushContext(view->rootObject()); - } + if (status == QDeclarativeView::Ready) q->sendReloaded(); - } } void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList objects) @@ -850,17 +724,15 @@ void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList QList items; QList gfxObjects; foreach (QObject *obj, objects) { - QDeclarativeItem* declarativeItem = qobject_cast(obj); - if (declarativeItem) { + if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { items << declarativeItem; - if (QGraphicsObject *gfxObj = declarativeItem->toGraphicsObject()) - gfxObjects << gfxObj; + gfxObjects << declarativeItem; } } if (designModeBehavior) { setSelectedItemsForTools(items); clearHighlight(); - highlight(gfxObjects, QDeclarativeViewObserverPrivate::IgnoreContext); + highlight(gfxObjects); } } @@ -943,9 +815,7 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) for (int i = 0; i < itemCount; ++i) { int debugId = -1; ds >> debugId; - QObject *obj = QDeclarativeDebugService::objectForId(debugId); - - if (obj) + if (QObject *obj = QDeclarativeDebugService::objectForId(debugId)) selectedObjects << obj; } @@ -1039,12 +909,6 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) } break; } - case ObserverProtocol::SetContextPathIdx: { - int contextPathIndex; - ds >> contextPathIndex; - data->_q_changeContextPathIndex(contextPathIndex); - break; - } case ObserverProtocol::ClearComponentCache: { data->_q_clearComponentCache(); break; @@ -1145,17 +1009,6 @@ void QDeclarativeViewObserver::sendColorChanged(const QColor &color) data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendContextPathUpdated(const QStringList &contextPath) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::ContextPathUpdated - << contextPath; - - data->debugService->sendMessage(message); -} - QString QDeclarativeViewObserver::idStringForObject(QObject *obj) const { int id = QDeclarativeDebugService::idForObject(obj); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h index 86d0d95..5c70c98 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h @@ -89,7 +89,6 @@ public: public Q_SLOTS: void sendColorChanged(const QColor &color); - void sendContextPathUpdated(const QStringList &contextPath); void setDesignModeBehavior(bool value); bool designModeBehavior(); @@ -99,8 +98,6 @@ public Q_SLOTS: void setAnimationSpeed(qreal factor); void setAnimationPaused(bool paused); - void setObserverContext(int contextIndex); - Q_SIGNALS: void designModeBehaviorChanged(bool inDesignMode); void showAppOnTopChanged(bool showAppOnTop); @@ -114,10 +111,6 @@ Q_SIGNALS: void animationSpeedChanged(qreal factor); void animationPausedChanged(bool paused); - void inspectorContextCleared(); - void inspectorContextPushed(const QString &contextTitle); - void inspectorContextPopped(); - protected: bool eventFilter(QObject *obj, QEvent *event); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h index 8809591..19e4898 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h @@ -61,7 +61,6 @@ class ZoomTool; class ColorPickerTool; class LiveLayerItem; class BoundingRectHighlighter; -class SubcomponentEditorTool; class ToolBox; class AbstractLiveEditTool; @@ -69,11 +68,6 @@ class QDeclarativeViewObserverPrivate : public QObject { Q_OBJECT public: - enum ContextFlags { - IgnoreContext, - ContextSensitive - }; - QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *); ~QDeclarativeViewObserverPrivate(); @@ -92,7 +86,6 @@ public: LiveSelectionTool *selectionTool; ZoomTool *zoomTool; ColorPickerTool *colorPickerTool; - SubcomponentEditorTool *subcomponentEditorTool; LiveLayerItem *manipulatorLayer; BoundingRectHighlighter *boundingRectHighlighter; @@ -110,7 +103,6 @@ public: void clearEditorItems(); void createToolBox(); void changeToSelectTool(); - QList filterForCurrentContext(QList &itemlist) const; QList filterForSelection(QList &itemlist) const; QList selectableItems(const QPoint &pos) const; @@ -125,17 +117,12 @@ public: Constants::ToolFlags flags = Constants::NoToolFlags); void clearHighlight(); - void highlight(const QList &item, - ContextFlags flags = ContextSensitive); - void highlight(QGraphicsObject *item, ContextFlags flags = ContextSensitive); + void highlight(const QList &item); + inline void highlight(QGraphicsObject *item) + { highlight(QList() << item); } - bool mouseInsideContextItem() const; bool isEditorItem(QGraphicsItem *item) const; - QGraphicsItem *currentRootItem() const; - - void enterContext(QGraphicsItem *itemToEnter); - public slots: void _q_setToolBoxVisible(bool visible); @@ -151,7 +138,6 @@ public slots: void _q_changeToMarqueeSelectTool(); void _q_changeToZoomTool(); void _q_changeToColorPickerTool(); - void _q_changeContextPathIndex(int index); void _q_clearComponentCache(); void _q_removeFromSelection(QObject *); -- cgit v0.12 From c4727a85eed57a4db698326a1bed4aa75b6e5284 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 24 May 2011 14:05:48 +0100 Subject: sockets: limit buffer size of the internal sockets in proxy engines The application can normally control the amount of buffering of a socket or QNetworkReply by using the setReadBufferSize API. This allows the application to flow control the TCP connection, and avoids out of memory errors when the data being downloaded is received faster than the application can process it. However when using a proxy, the proxy socket engine has an internal socket which is used to communicate with the proxy server. It is not visible to the user, and does not have awareness of the buffer size of the external socket. To solve this, we limit the internal sockets' buffer size to 64k bytes. Under normal operation, the data is swiftly copied to the external socket where the buffer can grow (or not) based on the application's set value for read buffer size. Task-number: QT-4966 Reviewed-by: Markus Goetz --- src/network/socket/qhttpsocketengine.cpp | 2 ++ src/network/socket/qsocks5socketengine.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 81a2c61..b002bec 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -145,6 +145,8 @@ bool QHttpSocketEngine::connectInternal() // Handshake isn't done. If unconnected, start connecting. if (d->state == None && d->socket->state() == QAbstractSocket::UnconnectedState) { setState(QAbstractSocket::ConnectingState); + //limit buffer in internal socket, data is buffered in the external socket under application control + d->socket->setReadBufferSize(65536); d->socket->connectToHost(d->proxy.hostName(), d->proxy.port()); } diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 87e7700..f7acc4e 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1119,6 +1119,8 @@ bool QSocks5SocketEngine::connectInternal() if (d->socks5State == QSocks5SocketEnginePrivate::Uninitialized && d->socketState != QAbstractSocket::ConnectingState) { setState(QAbstractSocket::ConnectingState); + //limit buffer in internal socket, data is buffered in the external socket under application control + d->data->controlSocket->setReadBufferSize(65536); d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port()); return false; } -- cgit v0.12 From 67ed18497705fa938728c505d165173dc5d3de68 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 25 May 2011 13:01:33 +1000 Subject: Flickable could flick in wrong direction if given too few touch samples If we got <= QML_FLICK_DISCARDSAMPLES the previous velocity was not cleared, so the view would continue flicking with the previous velocity, and therefore the previous direction. Change-Id: I876610f4522f32c814449309b01ec3787c5f6cc6 Task-number: QT-4903 Reviewed-by: Andrew den Exter --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 82ed18c..2bf863b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -232,8 +232,8 @@ void QDeclarativeFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal ma void QDeclarativeFlickablePrivate::AxisData::updateVelocity() { + velocity = 0; if (velocityBuffer.count() > QML_FLICK_DISCARDSAMPLES) { - velocity = 0; int count = velocityBuffer.count()-QML_FLICK_DISCARDSAMPLES; for (int i = 0; i < count; ++i) { qreal v = velocityBuffer.at(i); -- cgit v0.12 From 3dcfbdc67b79944950ba7b24749e9d1642178bb1 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 25 May 2011 10:51:57 +0200 Subject: license header check: fix exception for URL TLD table the file was renamed and moved to corelib Task-number: QTBUG-13601 --- tests/auto/headers/tst_headers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 2686a00..335e832 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -177,7 +177,7 @@ void tst_Headers::allSourceFilesData() || sourceFile.endsWith("/src/corelib/global/qconfig.h") || sourceFile.endsWith("/src/corelib/global/qconfig.cpp") || sourceFile.endsWith("/src/tools/uic/qclass_lib_map.h") - || sourceFile.endsWith("src/network/access/qnetworkcookiejartlds_p.h") + || sourceFile.endsWith("src/corelib/io/qurltlds_p.h") ) continue; -- cgit v0.12 From 00bf2e2605b97ff77efdcb68b7968375b3e9d195 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 May 2011 11:27:40 +0200 Subject: uic: Use QString::fromUtf8 for QUrl properties. As otherwise the compilation of ui_-files fails when using QT_NO_CAST_FROM_ASCII. Bug reported on mailing list. Reviewed-by: Jarek Kobus --- src/tools/uic/cpp/cppwriteinitialization.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 37d012c..ab8c9f3 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1527,7 +1527,7 @@ void WriteInitialization::writeProperties(const QString &varName, case DomProperty::Url: { const DomUrl* u = p->elementUrl(); - propertyValue = QString::fromLatin1("QUrl(%1)") + propertyValue = QString::fromLatin1("QUrl(QString::fromUtf8(%1))") .arg(fixString(u->elementString()->text(), m_dindent)); break; } -- cgit v0.12 From 4ab5a2bc78e142d0035299090e3ad8bee81eed9f Mon Sep 17 00:00:00 2001 From: shiroki Date: Wed, 25 May 2011 11:11:51 +0200 Subject: fix "Host" header of ipv6 URLs in QNAM Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnection.cpp | 12 +++++++++++- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 18 +++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index a471559..dd80a07 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -261,7 +261,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // set the host value = request.headerField("host"); if (value.isEmpty()) { - QByteArray host = QUrl::toAce(hostName); + QHostAddress add; + QByteArray host; + if(add.setAddress(hostName)) { + if(add.protocol() == QAbstractSocket::IPv6Protocol) { + host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + } else { + host = QUrl::toAce(hostName); + } + } else { + host = QUrl::toAce(hostName); + } int port = request.url().port(); if (port != -1) { diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 203de5b..113b64b 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -457,9 +457,9 @@ public: : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), multiple(false), totalConnections(0) { - if( useipv6 ){ + if(useipv6) { listen(QHostAddress::AnyIPv6); - }else{ + } else { listen(); } if (thread) { @@ -2329,8 +2329,9 @@ void tst_QNetworkReply::connectToIPv6Address_data() QTest::addColumn("url"); QTest::addColumn("error"); QTest::addColumn("dataToSend"); - QTest::addColumn("serverVerifyData"); - QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("\r\nHost: [::1]\r\n"); + QTest::addColumn("hostfield"); + QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("[::1]"); + //QTest::newRow("ipv4localhost") << QUrl(QByteArray("http://127.0.0.1")) << QNetworkReply::NoError<< QByteArray("ipv4localhost") << QByteArray("127.0.0.1"); //to add more test data here } @@ -2339,7 +2340,7 @@ void tst_QNetworkReply::connectToIPv6Address() QFETCH(QUrl, url); QFETCH(QNetworkReply::NetworkError, error); QFETCH(QByteArray, dataToSend); - QFETCH(QByteArray, serverVerifyData); + QFETCH(QByteArray, hostfield); QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: "); httpResponse += QByteArray::number(dataToSend.size()); @@ -2357,10 +2358,9 @@ void tst_QNetworkReply::connectToIPv6Address() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); QByteArray content = reply->readAll(); - if( !serverVerifyData.isEmpty()){ - //qDebug() << server.receivedData; - //QVERIFY(server.receivedData.contains(serverVerifyData)); //got a bug here - } + //qDebug() << server.receivedData; + QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QVERIFY(server.receivedData.contains(hostinfo)); QVERIFY(content == dataToSend); QCOMPARE(reply->url(), request.url()); QVERIFY(reply->error() == error); -- cgit v0.12 From 2552c99cfeaaba44db77467bf50176173ff14457 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 10:55:52 +0200 Subject: Fix cursor position test on CursorOnCharacter case Reviewed-by: TrustMe --- src/gui/text/qtextengine.cpp | 5 ++++- src/gui/text/qtextengine_p.h | 2 +- src/gui/text/qtextlayout.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 0df543b..9bbc4a4 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2844,7 +2844,8 @@ int QTextEngine::getClusterLength(unsigned short *logClusters, } int QTextEngine::positionInLigature(const QScriptItem *si, int end, - QFixed x, QFixed edge, int glyph_pos) + QFixed x, QFixed edge, int glyph_pos, + bool cursorOnCharacter) { unsigned short *logClusters = this->logClusters(si); int clusterStart = -1; @@ -2882,6 +2883,8 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, int n = ((x - left) / perItemWidth).floor().toInt(); QFixed dist = x - left - n * perItemWidth; int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; + if (cursorOnCharacter && closestItem > 0) + closestItem--; int pos = si->position + clusterStart + closestItem; // Jump to the next charStop while (!attrs[pos].charStop && pos < end) diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 8e1d796..90e931c 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -620,7 +620,7 @@ public: QFixed leadingSpaceWidth(const QScriptLine &line); QFixed offsetInLigature(const QScriptItem *si, int pos, int max, int glyph_pos); - int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos); + int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter); int previousLogicalPosition(int oldPos) const; int nextLogicalPosition(int oldPos) const; int lineNumberForTextPosition(int pos); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 20edb87..8ec3edf 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2780,11 +2780,13 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (rtl && nchars > 0) return insertionPoints[lastLine ? nchars : nchars - 1]; } - return eng->positionInLigature(&si, end, x, pos, -1); + return eng->positionInLigature(&si, end, x, pos, -1, + cpos == QTextLine::CursorOnCharacter); } } Q_ASSERT(glyph_pos != -1); - return eng->positionInLigature(&si, end, x, edge, glyph_pos); + return eng->positionInLigature(&si, end, x, edge, glyph_pos, + cpos == QTextLine::CursorOnCharacter); } } // right of last item -- cgit v0.12 From 1013cf05d579dbcf61890b5529a6e970aa562a19 Mon Sep 17 00:00:00 2001 From: shiroki Date: Wed, 25 May 2011 11:26:23 +0200 Subject: fix the "Host" header for ipv6 URLs in QNAM Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnection.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 61230fc..d76a5fd 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -256,7 +256,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // set the host value = request.headerField("host"); if (value.isEmpty()) { - QByteArray host = QUrl::toAce(hostName); + QHostAddress add; + QByteArray host; + if(add.setAddress(hostName)) { + if(add.protocol() == QAbstractSocket::IPv6Protocol) { + host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + } else { + host = QUrl::toAce(hostName); + } + } else { + host = QUrl::toAce(hostName); + } int port = request.url().port(); if (port != -1) { -- cgit v0.12 From a6642e4659b3d45ffa94f9a3c6413124d49f2b91 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 11:21:53 +0200 Subject: Fix QFontEngineX11FT compilation xglyph_format is only available when XRender is present. Reviewed-by: Fabien Freling --- src/gui/text/qfontengine_x11.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index 4260b85..9775e10 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -1205,7 +1205,9 @@ QFontEngine *QFontEngineX11FT::cloneWithSize(qreal pixelSize) const delete fe; return 0; } else { +#ifndef QT_NO_XRENDER fe->xglyph_format = xglyph_format; +#endif return fe; } } -- cgit v0.12 From e38aaf9f7c91efb6197f7f579e3064e0e6dcce1e Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 10:55:52 +0200 Subject: Fix cursor position test on CursorOnCharacter case Reviewed-by: TrustMe --- src/gui/text/qtextengine.cpp | 5 ++++- src/gui/text/qtextengine_p.h | 2 +- src/gui/text/qtextlayout.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 62de1fe..69598cf 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2716,7 +2716,8 @@ int QTextEngine::getClusterLength(unsigned short *logClusters, } int QTextEngine::positionInLigature(const QScriptItem *si, int end, - QFixed x, QFixed edge, int glyph_pos) + QFixed x, QFixed edge, int glyph_pos, + bool cursorOnCharacter) { unsigned short *logClusters = this->logClusters(si); int clusterStart = -1; @@ -2754,6 +2755,8 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, int n = ((x - left) / perItemWidth).floor().toInt(); QFixed dist = x - left - n * perItemWidth; int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; + if (cursorOnCharacter && closestItem > 0) + closestItem--; int pos = si->position + clusterStart + closestItem; // Jump to the next charStop while (!attrs[pos].charStop && pos < end) diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index f8939e3..09610ff 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -594,7 +594,7 @@ public: void shapeLine(const QScriptLine &line); QFixed leadingSpaceWidth(const QScriptLine &line); - int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos); + int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter); private: void setBoundary(int strPos) const; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a9179ed..4b3c9e7 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2677,10 +2677,12 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } } if (qAbs(x-pos) < dist) - return eng->positionInLigature(&si, end, x, pos, -1); + return eng->positionInLigature(&si, end, x, pos, -1, + cpos == QTextLine::CursorOnCharacter); } Q_ASSERT(glyph_pos != -1); - return eng->positionInLigature(&si, end, x, edge, glyph_pos); + return eng->positionInLigature(&si, end, x, edge, glyph_pos, + cpos == QTextLine::CursorOnCharacter); } } // right of last item -- cgit v0.12 From 04cde562a0be446234e33725c999bdb61fab3ff2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 25 May 2011 11:39:12 +0200 Subject: Revert "Fixing Linux compatibility issues for Symbian" Changing the library names to lowercase breaks 5.0-based Linux builds. It will be investigated if it is possible to change the SDKs instead. If not, the patch will have to be extended to use the original names for 5.0 and the lowercased ones otherwise. This reverts commit 5933d4e4fb8b48ebed641e7f6b1d032df253df30. --- .../mobile/quickhit/plugins/LevelOne/levelone.pro | 6 ++-- .../plugins/LevelTemplate/leveltemplate.pro | 6 ++-- .../mobile/quickhit/plugins/LevelTwo/leveltwo.pro | 6 ++-- mkspecs/features/symbian/application_icon.prf | 4 +-- src/gui/dialogs/dialogs.pri | 2 +- src/gui/styles/styles.pri | 6 +++- src/plugins/bearer/symbian/symbian.pri | 9 +++-- src/plugins/phonon/mmf/mmf.pro | 4 +-- src/plugins/s60/5_0/5_0.pro | 8 +++-- src/s60installs/qt.iby | 42 +++++++++++----------- src/s60installs/s60installs.pro | 6 ++-- tests/auto/qcssparser/qcssparser.pro | 2 +- 12 files changed, 57 insertions(+), 44 deletions(-) diff --git a/demos/mobile/quickhit/plugins/LevelOne/levelone.pro b/demos/mobile/quickhit/plugins/LevelOne/levelone.pro index b936721..fcbfc56 100644 --- a/demos/mobile/quickhit/plugins/LevelOne/levelone.pro +++ b/demos/mobile/quickhit/plugins/LevelOne/levelone.pro @@ -57,11 +57,11 @@ BLD_INF_RULES.prj_exports += "gfx/background3.png ../winscw/c/Data/gfx/backgroun myQml.sources = level.qml -myQml.path = c:/system/quickhitdata/levelone +myQml.path = c:/System/quickhitdata/levelone myGraphic.sources = gfx/* -myGraphic.path = c:/system/quickhitdata/levelone/gfx +myGraphic.path = c:/System/quickhitdata/levelone/gfx mySound.sources = sound/* -mySound.path = c:/system/quickhitdata/levelone/sound +mySound.path = c:/System/quickhitdata/levelone/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro b/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro index 1370956..a4f5900 100644 --- a/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro +++ b/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro @@ -60,11 +60,11 @@ BLD_INF_RULES.prj_exports += "gfx/enemy1.png ../winscw/c/Data/gfx/enemy1.png" \ myQml.sources = qml/* -myQml.path = c:/system/quickhitdata/leveltemplate +myQml.path = c:/System/quickhitdata/leveltemplate myGraphic.sources = gfx/* -myGraphic.path = c:/system/quickhitdata/leveltemplate/gfx +myGraphic.path = c:/System/quickhitdata/leveltemplate/gfx mySound.sources = sound/* -mySound.path = c:/system/quickhitdata/leveltemplate/sound +mySound.path = c:/System/quickhitdata/leveltemplate/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro b/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro index e5c144f..171ee6c 100644 --- a/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro +++ b/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro @@ -64,11 +64,11 @@ BLD_INF_RULES.prj_exports += "gfx/background2.png ../winscw/c/Data/gfx/backgroun myQml.sources = qml/* -myQml.path = c:/system/quickhitdata/leveltwo +myQml.path = c:/System/quickhitdata/leveltwo myGraphic.sources = gfx/* -myGraphic.path = c:/system/quickhitdata/leveltwo/gfx +myGraphic.path = c:/System/quickhitdata/leveltwo/gfx mySound.sources = sound/* -mySound.path = c:/system/quickhitdata/leveltwo/sound +mySound.path = c:/System/quickhitdata/leveltwo/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 56d1ea8..06f5b31 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -65,8 +65,8 @@ contains(CONFIG, no_icon) { mifconv.target = $$replace(mifconv.target, /, \\) } # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library - # svg-t icons should always use -c32 depth - mifconv.commands = mifconv $$mifconv.target -c32 $$ICON_backslashed + # svg-t icons should always use /c32 depth + mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed mifconv.depends = $$ICON PRE_TARGETDEPS += $$mifconv.target diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index c25b6d5..12e3a71 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -109,7 +109,7 @@ SOURCES += \ dialogs/qprintpreviewdialog.cpp symbian:contains(QT_CONFIG, s60) { - LIBS += -lcommondialogs + LIBS += -lCommonDialogs SOURCES += dialogs/qfiledialog_symbian.cpp \ dialogs/qcolordialog_symbian.cpp } diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index c595ee8..b22a908 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -172,7 +172,11 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { symbian { SOURCES += styles/qs60style_s60.cpp LIBS += -legul -lbmpanim - LIBS += -laknicon -laknskins -laknskinsrv -lfontutils + contains(CONFIG, is_using_gnupoc) { + LIBS += -laknicon -laknskins -laknskinsrv -lfontutils + } else { + LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils + } } else { SOURCES += styles/qs60style_simulated.cpp RESOURCES += styles/qstyle_s60_simulated.qrc diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri index 121cefb..8d92f57 100644 --- a/src/plugins/bearer/symbian/symbian.pri +++ b/src/plugins/bearer/symbian/symbian.pri @@ -19,8 +19,13 @@ LIBS += -lcommdb \ -linsock \ -lecom \ -lefsrv \ - -lnetmeta \ - -lconnmon + -lnetmeta + +is_using_gnupoc { + LIBS += -lconnmon +} else { + LIBS += -lConnMon +} QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 3b8184b..a9e5746 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -103,7 +103,7 @@ symbian { exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { HEADERS += $$PHONON_MMF_DIR/download.h SOURCES += $$PHONON_MMF_DIR/download.cpp - LIBS += -ldownloadmgr + LIBS += -lDownloadMgr DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD } } @@ -125,7 +125,7 @@ symbian { LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream # These are for effects. - LIBS += -laudioequalizereffect -lbassboosteffect -ldistanceattenuationeffect -ldopplerbase -leffectbase -lenvironmentalreverbeffect -llistenerdopplereffect -llistenerlocationeffect -llistenerorientationeffect -llocationbase -lloudnesseffect -lorientationbase -lsourcedopplereffect -lsourcelocationeffect -lsourceorientationeffect -lstereowideningeffect + LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect # This is to allow IAP to be specified LIBS += -lcommdb diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro index 1617a1e..00aea1b 100644 --- a/src/plugins/s60/5_0/5_0.pro +++ b/src/plugins/s60/5_0/5_0.pro @@ -10,8 +10,12 @@ contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_2.cpp \ ../src/qdesktopservices_3_2.cpp \ ../src/qcoreapplication_3_2.cpp - LIBS += -lefsrv \ - -ldirectorylocalizer + contains(CONFIG, is_using_gnupoc) { + LIBS += -ldirectorylocalizer + } else { + LIBS += -lDirectoryLocalizer + } + LIBS += -lefsrv INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index 9f2c979..d6b36e0 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -40,7 +40,7 @@ file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll // Phonon MMF backend file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin +data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin // graphicssystems file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll @@ -54,41 +54,41 @@ file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll // imageformats stubs -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin +data=\epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin +data=\epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin +data=\epoc32\data\z\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin +data=\epoc32\data\z\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin +data=\epoc32\data\z\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin +data=\epoc32\data\z\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin // codecs stubs -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin +data=\epoc32\data\z\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin +data=\epoc32\data\z\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin +data=\epoc32\data\z\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin +data=\epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin // iconengines stubs -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin +data=\epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin // qml import plugins file=ABI_DIR\BUILD_DIR\qmlfolderlistmodelplugin.dll SHARED_LIB_DIR\qmlfolderlistmodelplugin.dll file=ABI_DIR\BUILD_DIR\qmlgesturesplugin.dll SHARED_LIB_DIR\qmlgesturesplugin.dll file=ABI_DIR\BUILD_DIR\qmlparticlesplugin.dll SHARED_LIB_DIR\qmlparticlesplugin.dll -data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin +data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin +data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin +data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir -data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir -data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir +data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir +data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir +data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir // graphicssystems -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin +data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin +data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin // bearer stub -data=EPOCROOT##epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin +data=\epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin // Stub sis file data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 17b229f..d1bb48b 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -10,10 +10,10 @@ symbian: { TARGET = "Qt$${QT_LIBINFIX}" isEmpty(QT_LIBINFIX) { - TARGET.UID3 = 0x2001e61c + TARGET.UID3 = 0x2001E61C } else { # Always use experimental UID for infixed configuration to avoid UID clash - TARGET.UID3 = 0xe001e61c + TARGET.UID3 = 0xE001E61C } VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} @@ -116,7 +116,7 @@ symbian: { # Support backup & restore for Qt libraries qtbackup.sources = backup_registration.xml - qtbackup.path = c:/private/10202d56/import/packages/$$replace(TARGET.UID3, 0x,) + qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) DEPLOYMENT += qtlibraries \ qtbackup \ diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 4953490..674064f 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -10,7 +10,7 @@ requires(contains(QT_CONFIG,private_tests)) wince*|symbian: { addFiles.sources = testdata addFiles.path = . - timesFont.sources = c:/windows/fonts/times.ttf + timesFont.sources = C:/Windows/Fonts/times.ttf timesFont.path = . DEPLOYMENT += addFiles timesFont } -- cgit v0.12 From 3060da958981af8074ac68e47c30c519ff60eec9 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 25 May 2011 13:18:11 +0300 Subject: Document the Symbian main window size issue at application start. In Symbian, application main window will report incorrect size at show event handler because softkeys and status pane are constructed after the show is called. The right place to get the main window size is the the resize event handler. Task-number: QTBUG-19012 Reviewed-by: Laszlo Agocs --- doc/src/windows-and-dialogs/mainwindow.qdoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index f2b29c9..e1a5e82 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -145,6 +145,17 @@ depends on the result of QWidget::frameGeometry() and the capability of the window manager to do proper window placement, neither of which can be guaranteed. + + \section2 Symbian Peculiarities + + On Symbian, the status pane and softkeys are not created until + after QWidget::show() is called for the main window of the application. + This means that at the time when the application main window gets the + show event, the application main window width() and height() methods + still return full screen width and height instead of the client area + width and height as expected. The correct place to get the main window + size is the resize event handler of the main window, as the resize event + will be sent each time the client area of the window changes. */ /*! -- cgit v0.12 From f75fda0365a4e4bf1f26dedc40d96d37a2599174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 25 May 2011 13:42:48 +0200 Subject: DeclarativeObserver: Fixed duplicates in item selection Only add items to the current selection that aren't already part of it. Also removed checking item for null, since it doesn't make sense to include null pointers in the list of items to select. Task-number: QTCREATORBUG-3426 Change-Id: I5a365570f87f72665b3382d05ca9937f56e8956b Reviewed-by: Christiaan Janssen --- .../qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp index a49a758..bb23831 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp @@ -494,8 +494,8 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QListtoGraphicsObject()) { + if (QGraphicsObject *obj = item->toGraphicsObject()) { + if (!currentSelection.contains(obj)) { QObject::connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(_q_removeFromSelection(QObject*))); currentSelection.append(obj); -- cgit v0.12 From dffe4d8d180e34955ebe23540e37ce7ba0d76853 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Wed, 25 May 2011 11:24:37 +0200 Subject: Add authentication token support for wayland windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For compositors that support it, the wayland clients can associate themselves with an auth token, specified by WL_AUTHENTICATION_TOKEN env var, or by directly specifying it in the wayland client plugin. Reviewed-by: Samuel Rødal --- .../qwaylandwindowmanager-client-protocol.h | 40 ++++++++++++++++++---- .../wayland/wayland-windowmanager-protocol.c | 3 +- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 ++--- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + .../qwaylandwindowmanagerintegration.cpp | 13 +++++-- .../qwaylandwindowmanagerintegration.h | 1 + 6 files changed, 53 insertions(+), 14 deletions(-) diff --git a/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h b/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h index ec776c5..73673ae 100644 --- a/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h +++ b/src/3rdparty/wayland/qwaylandwindowmanager-client-protocol.h @@ -36,16 +36,37 @@ struct wl_client; struct wl_windowmanager; +struct wl_proxy; + +extern void +wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); +extern struct wl_proxy * +wl_proxy_create(struct wl_proxy *factory, + const struct wl_interface *interface); +extern struct wl_proxy * +wl_proxy_create_for_id(struct wl_display *display, + const struct wl_interface *interface, uint32_t id); +extern void +wl_proxy_destroy(struct wl_proxy *proxy); + +extern int +wl_proxy_add_listener(struct wl_proxy *proxy, + void (**implementation)(void), void *data); + +extern void +wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); + +extern void * +wl_proxy_get_user_data(struct wl_proxy *proxy); + extern const struct wl_interface wl_windowmanager_interface; -#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 +#define wl_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0 +#define wl_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1 static inline struct wl_windowmanager * -wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/) +wl_windowmanager_create(struct wl_display *display, uint32_t id) { - // ### does not run without latest wayland. must be enabled later - //wl_display_bind(display, id, "wl_windowmanager", version); - return (struct wl_windowmanager *) wl_proxy_create_for_id(display, &wl_windowmanager_interface, id); } @@ -72,7 +93,14 @@ static inline void wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid) { wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, - WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); + wl_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid); +} + +static inline void +wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *wl_authentication_token) +{ + wl_proxy_marshal((struct wl_proxy *) wl_windowmanager, + wl_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, wl_authentication_token); } #ifdef __cplusplus diff --git a/src/3rdparty/wayland/wayland-windowmanager-protocol.c b/src/3rdparty/wayland/wayland-windowmanager-protocol.c index 48049d8..0250801 100644 --- a/src/3rdparty/wayland/wayland-windowmanager-protocol.c +++ b/src/3rdparty/wayland/wayland-windowmanager-protocol.c @@ -26,7 +26,8 @@ #include "wayland-util.h" static const struct wl_message wl_windowmanager_requests[] = { - { "map_client_to_process", "u", NULL }, + { "map_client_to_process", "u" }, + { "authenticate_with_token", "s" }, }; WL_EXPORT const struct wl_interface wl_windowmanager_interface = { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index dcfaf0f..da908fb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -137,6 +137,11 @@ QWaylandDisplay::QWaylandDisplay(void) #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); #endif + +#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT + mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this); +#endif + blockingReadEvents(); qRegisterMetaType("uint32_t"); @@ -145,10 +150,6 @@ QWaylandDisplay::QWaylandDisplay(void) mEglIntegration->initialize(); #endif -#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT - mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this); -#endif - connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d2a7647..2bfc643 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -67,6 +67,7 @@ QWaylandWindow::QWaylandWindow(QWidget *window) #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid()); + mDisplay->windowManagerIntegration()->authenticateWithToken(); #endif mSurface = mDisplay->createSurface(this); diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp index b93e6d2..e4a6218 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp @@ -68,12 +68,11 @@ struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const return mWaylandWindowManager; } -void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, - uint32_t version, void *data) +void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data) { if (strcmp(interface, "wl_windowmanager") == 0) { QWaylandWindowManagerIntegration *integration = static_cast(data); - integration->mWaylandWindowManager = wl_windowmanager_create(display,id, version); + integration->mWaylandWindowManager = wl_windowmanager_create(display, id); } } @@ -83,3 +82,11 @@ void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId) wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId); } +void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token) +{ + QByteArray authToken = token; + if (authToken.isEmpty()) + authToken = qgetenv("WL_AUTHENTICATION_TOKEN"); + if (mWaylandWindowManager) + wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData()); +} diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h index 01a7bdd..a79f205 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h @@ -56,6 +56,7 @@ public: void mapSurfaceToProcess(struct wl_surface *surface, long long processId); void mapClientToProcess(long long processId); + void authenticateWithToken(const QByteArray &token = QByteArray()); private: static void wlHandleListenerGlobal(wl_display *display, uint32_t id, -- cgit v0.12 From db20b6c03b6a93ab3e483cd85d5d0a923c3d3430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Wed, 25 May 2011 14:19:14 +0300 Subject: Backported QML ShaderEffectItem from QML2.0 into Qt Quick 1.1 This issue is about backporting Scenegraph's ShaderEffectItem and ShaderEffectSource elements into Qt Quick 1.1 as a Qt labs plugin. Purpose of these elements is to provide an interface for utilizing OpenGL shaders in QML applications. Task-number: QTBUG-18346 Reviewed-by: Kim Gronholm --- src/imports/imports.pro | 1 + src/imports/shaders/glfunctions.h | 75 ++ src/imports/shaders/qmldir | 2 + src/imports/shaders/qmlshadersplugin_plugin.cpp | 55 ++ src/imports/shaders/qmlshadersplugin_plugin.h | 56 ++ src/imports/shaders/scenegraph/qsggeometry.cpp | 310 +++++++ src/imports/shaders/scenegraph/qsggeometry.h | 234 ++++++ src/imports/shaders/shadereffect.cpp | 192 +++++ src/imports/shaders/shadereffect.h | 81 ++ src/imports/shaders/shadereffectbuffer.cpp | 52 ++ src/imports/shaders/shadereffectbuffer.h | 62 ++ src/imports/shaders/shadereffectitem.cpp | 915 +++++++++++++++++++++ src/imports/shaders/shadereffectitem.h | 152 ++++ src/imports/shaders/shadereffectsource.cpp | 472 +++++++++++ src/imports/shaders/shadereffectsource.h | 158 ++++ src/imports/shaders/shaders.pro | 38 + tests/auto/declarative/declarative.pro | 2 + tests/auto/declarative/qmlshadersplugin/main.qml | 80 ++ .../qmlshadersplugin/qmlshadersplugin.pro | 18 + .../qmlshadersplugin/tst_qmlshadersplugin.cpp | 205 +++++ tests/benchmarks/declarative/declarative.pro | 2 +- .../declarative/qmlshadersplugin/GaussianBlur.qml | 43 + .../qmlshadersplugin/GaussianDirectionalBlur.qml | 168 ++++ .../qmlshadersplugin/GaussianDropShadow.qml | 41 + .../qmlshadersplugin/TestGaussianDropShadow.qml | 66 ++ .../declarative/qmlshadersplugin/TestWater.qml | 20 + .../declarative/qmlshadersplugin/Water.qml | 85 ++ .../benchmarks/declarative/qmlshadersplugin/bg.jpg | Bin 0 -> 10189 bytes .../qmlshadersplugin/drop_shadow_small.png | Bin 0 -> 46081 bytes .../qmlshadersplugin/qmlshadersplugin.pro | 23 + .../declarative/qmlshadersplugin/sky.jpg | Bin 0 -> 36734 bytes .../qmlshadersplugin/tst_performance.cpp | 110 +++ tests/manual/declarative/declarative.pro | 3 + tests/manual/declarative/qmlshadersplugin/main.cpp | 67 ++ .../qml/qmlshadersplugintest/TestActive.qml | 83 ++ .../qml/qmlshadersplugintest/TestBasic.qml | 57 ++ .../qml/qmlshadersplugintest/TestBlending.qml | 82 ++ .../qml/qmlshadersplugintest/TestBlendingModes.qml | 267 ++++++ .../qmlshadersplugintest/TestEffectHierarchy.qml | 133 +++ .../TestEffectInsideAnotherEffect.qml | 119 +++ .../qml/qmlshadersplugintest/TestFormat.qml | 89 ++ .../qmlshadersplugintest/TestFragmentShader.qml | 91 ++ .../qml/qmlshadersplugintest/TestGrab.qml | 89 ++ .../qml/qmlshadersplugintest/TestHideOriginal.qml | 97 +++ .../qmlshadersplugintest/TestHorizontalWrap.qml | 93 +++ .../qmlshadersplugintest/TestImageFiltering.qml | 84 ++ .../qml/qmlshadersplugintest/TestImageMargins.qml | 98 +++ .../TestImageMarginsWithTextureSize.qml | 96 +++ .../qml/qmlshadersplugintest/TestImageMipmap.qml | 95 +++ .../qml/qmlshadersplugintest/TestItemMargins.qml | 102 +++ .../TestItemMarginsWithTextureSize.qml | 101 +++ .../qml/qmlshadersplugintest/TestLive.qml | 104 +++ .../qmlshadersplugintest/TestMeshResolution.qml | 108 +++ .../qml/qmlshadersplugintest/TestOneSource.qml | 74 ++ .../qml/qmlshadersplugintest/TestOpacity.qml | 98 +++ .../qml/qmlshadersplugintest/TestRotation.qml | 95 +++ .../qml/qmlshadersplugintest/TestScale.qml | 95 +++ .../qml/qmlshadersplugintest/TestTextureSize.qml | 85 ++ .../qmlshadersplugintest/TestTwiceOnSameSource.qml | 92 +++ .../qml/qmlshadersplugintest/TestTwoSources.qml | 95 +++ .../qml/qmlshadersplugintest/TestVertexShader.qml | 109 +++ .../qml/qmlshadersplugintest/TestVerticalWrap.qml | 92 +++ .../qml/qmlshadersplugintest/TestWrapRepeat.qml | 92 +++ .../qml/qmlshadersplugintest/back.svg | 11 + .../green_image_transparent.png | Bin 0 -> 1153 bytes .../qml/qmlshadersplugintest/image.png | Bin 0 -> 219220 bytes .../qml/qmlshadersplugintest/image_opaque.png | Bin 0 -> 293803 bytes .../qml/qmlshadersplugintest/image_small.png | Bin 0 -> 40220 bytes .../qml/qmlshadersplugintest/main.qml | 236 ++++++ .../qml/qmlshadersplugintest/wallpaper.jpg | Bin 0 -> 337569 bytes .../qmlapplicationviewer/qmlapplicationviewer.cpp | 127 +++ .../qmlapplicationviewer/qmlapplicationviewer.h | 28 + .../qmlapplicationviewer/qmlapplicationviewer.pri | 152 ++++ .../qmlshadersplugin/qmlshadersplugin.pro | 29 + 74 files changed, 7285 insertions(+), 1 deletion(-) create mode 100755 src/imports/shaders/glfunctions.h create mode 100644 src/imports/shaders/qmldir create mode 100644 src/imports/shaders/qmlshadersplugin_plugin.cpp create mode 100644 src/imports/shaders/qmlshadersplugin_plugin.h create mode 100644 src/imports/shaders/scenegraph/qsggeometry.cpp create mode 100644 src/imports/shaders/scenegraph/qsggeometry.h create mode 100644 src/imports/shaders/shadereffect.cpp create mode 100644 src/imports/shaders/shadereffect.h create mode 100644 src/imports/shaders/shadereffectbuffer.cpp create mode 100644 src/imports/shaders/shadereffectbuffer.h create mode 100644 src/imports/shaders/shadereffectitem.cpp create mode 100644 src/imports/shaders/shadereffectitem.h create mode 100644 src/imports/shaders/shadereffectsource.cpp create mode 100644 src/imports/shaders/shadereffectsource.h create mode 100644 src/imports/shaders/shaders.pro create mode 100644 tests/auto/declarative/qmlshadersplugin/main.qml create mode 100644 tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro create mode 100644 tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml create mode 100755 tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml create mode 100755 tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/Water.qml create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/bg.jpg create mode 100755 tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/sky.jpg create mode 100644 tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp create mode 100644 tests/manual/declarative/declarative.pro create mode 100644 tests/manual/declarative/qmlshadersplugin/main.cpp create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml create mode 100755 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/back.svg create mode 100755 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/green_image_transparent.png create mode 100755 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image.png create mode 100755 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_opaque.png create mode 100755 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_small.png create mode 100644 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml create mode 100755 tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/wallpaper.jpg create mode 100644 tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp create mode 100644 tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h create mode 100644 tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri create mode 100644 tests/manual/declarative/qmlshadersplugin/qmlshadersplugin.pro diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 5e50b08..c1298e2 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs SUBDIRS += folderlistmodel particles gestures +contains(QT_CONFIG, opengl): SUBDIRS += shaders diff --git a/src/imports/shaders/glfunctions.h b/src/imports/shaders/glfunctions.h new file mode 100755 index 0000000..03b88d1 --- /dev/null +++ b/src/imports/shaders/glfunctions.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GLFUNCTIONS_H +#define GLFUNCTIONS_H + +#ifndef QT_OPENGL_ES + +#ifndef Q_WS_MAC +# ifndef QGLF_APIENTRYP +# ifdef QGLF_APIENTRY +# define QGLF_APIENTRYP QGLF_APIENTRY * +# else +# define QGLF_APIENTRY +# define QGLF_APIENTRYP * +# endif +# endif +#else +# define QGLF_APIENTRY +# define QGLF_APIENTRYP * +#endif + +#define GL_TEXTURE0 0x84C0 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_BGRA 0x80E1 + +typedef void (QGLF_APIENTRYP type_glActiveTexture)(GLenum texture); +typedef void (QGLF_APIENTRYP type_glGenerateMipmap)(GLenum target); +typedef void (QGLF_APIENTRYP type_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); + +#define glActiveTexture ((type_glActiveTexture)QGLContext::currentContext()->getProcAddress(QLatin1String("glActiveTexture"))) +#define glGenerateMipmap ((type_glGenerateMipmap)QGLContext::currentContext()->getProcAddress(QLatin1String("glGenerateMipmap"))) +#define glVertexAttribPointer ((type_glVertexAttribPointer)QGLContext::currentContext()->getProcAddress(QLatin1String("glVertexAttribPointer"))) + +#endif + +#endif // GLFUNCTIONS_H diff --git a/src/imports/shaders/qmldir b/src/imports/shaders/qmldir new file mode 100644 index 0000000..b2a9de21 --- /dev/null +++ b/src/imports/shaders/qmldir @@ -0,0 +1,2 @@ +plugin qmlshadersplugin + diff --git a/src/imports/shaders/qmlshadersplugin_plugin.cpp b/src/imports/shaders/qmlshadersplugin_plugin.cpp new file mode 100644 index 0000000..c03ef2c --- /dev/null +++ b/src/imports/shaders/qmlshadersplugin_plugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlshadersplugin_plugin.h" +#include "shadereffectitem.h" +#include "shadereffectsource.h" + +#include + +void qmlshaderspluginPlugin::registerTypes(const char *uri) +{ + qmlRegisterType(uri, 1, 0, "ShaderEffectItem"); + qmlRegisterType(uri, 1, 0, "ShaderEffectSource"); +} + +Q_EXPORT_PLUGIN2(qmlshadersplugin, qmlshaderspluginPlugin) + diff --git a/src/imports/shaders/qmlshadersplugin_plugin.h b/src/imports/shaders/qmlshadersplugin_plugin.h new file mode 100644 index 0000000..2614a44 --- /dev/null +++ b/src/imports/shaders/qmlshadersplugin_plugin.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLSHADERSPLUGIN_PLUGIN_H +#define QMLSHADERSPLUGIN_PLUGIN_H + +#include + +class qmlshaderspluginPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + +public: + void registerTypes(const char *uri); +}; + +#endif // QMLSHADERSPLUGIN_PLUGIN_H + diff --git a/src/imports/shaders/scenegraph/qsggeometry.cpp b/src/imports/shaders/scenegraph/qsggeometry.cpp new file mode 100644 index 0000000..14ee4db --- /dev/null +++ b/src/imports/shaders/scenegraph/qsggeometry.cpp @@ -0,0 +1,310 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt scene graph research project. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qsggeometry.h" + +QT_BEGIN_NAMESPACE + + +/*! + Convenience function which returns attributes to be used for 2D solid + color drawing. + */ + +const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_Point2D() +{ + static Attribute data[] = { + { 0, 2, GL_FLOAT } + }; + static AttributeSet attrs = { 1, sizeof(float) * 2, data }; + return attrs; +} + +/*! + Convenience function which returns attributes to be used for textured 2D drawing. + */ + +const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_TexturedPoint2D() +{ + static Attribute data[] = { + { 0, 2, GL_FLOAT }, + { 1, 2, GL_FLOAT } + }; + static AttributeSet attrs = { 2, sizeof(float) * 4, data }; + return attrs; +} + +/*! + Convenience function which returns attributes to be used for per vertex colored 2D drawing. + */ + +const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D() +{ + static Attribute data[] = { + { 0, 2, GL_FLOAT }, + { 1, 4, GL_UNSIGNED_BYTE } + }; + static AttributeSet attrs = { 2, 2 * sizeof(float) + 4 * sizeof(char), data }; + return attrs; +} + + +/*! + \class QSGGeometry + \brief The QSGGeometry class provides low-level storage for graphics primitives + in the QML Scene Graph. + + The QSGGeometry class provides a few convenience attributes and attribute accessors + by default. The defaultAttributes_Point2D() function returns attributes to be used + in normal solid color rectangles, while the defaultAttributes_TexturedPoint2D function + returns attributes to be used for the common pixmap usecase. + */ + + +/*! + Constructs a geometry object based on \a attributes. + + The object allocate space for \a vertexCount vertices based on the accumulated + size in \a attributes and for \a indexCount. + + Geometry objects are constructed with GL_TRIANGLE_STRIP as default drawing mode. + + The attribute structure is assumed to be POD and the geometry object + assumes this will not go away. There is no memory management involved. + */ + +QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, + int vertexCount, + int indexCount, + int indexType) + : m_drawing_mode(GL_TRIANGLE_STRIP) + , m_vertex_count(0) + , m_index_count(0) + , m_index_type(indexType) + , m_attributes(attributes) + , m_data(0) + , m_index_data_offset(-1) + , m_owns_data(false) +{ + Q_ASSERT(m_attributes.count > 0); + Q_ASSERT(m_attributes.stride > 0); + + // Because allocate reads m_vertex_count, m_index_count and m_owns_data, these + // need to be set before calling allocate... + allocate(vertexCount, indexCount); +} + +QSGGeometry::~QSGGeometry() +{ + if (m_owns_data) + qFree(m_data); +} + +/*! + \fn int QSGGeometry::vertexCount() const + + Returns the number of vertices in this geometry object. + */ + +/*! + \fn int QSGGeometry::indexCount() const + + Returns the number of indices in this geometry object. + */ + + + +/*! + \fn void *QSGGeometry::vertexData() + + Returns a pointer to the raw vertex data of this geometry object. + + \sa vertexDataAsPoint2D(), vertexDataAsTexturedPoint2D + */ + +/*! + \fn const void *QSGGeometry::vertexData() const + + Returns a pointer to the raw vertex data of this geometry object. + + \sa vertexDataAsPoint2D(), vertexDataAsTexturedPoint2D + */ + +/*! + Returns a pointer to the raw index data of this geometry object. + + \sa indexDataAsUShort(), indexDataAsUInt() + */ +void *QSGGeometry::indexData() +{ + return m_index_data_offset < 0 + ? 0 + : ((char *) m_data + m_index_data_offset); +} + +/*! + Returns a pointer to the raw index data of this geometry object. + + \sa indexDataAsUShort(), indexDataAsUInt() + */ +const void *QSGGeometry::indexData() const +{ + return m_index_data_offset < 0 + ? 0 + : ((char *) m_data + m_index_data_offset); +} + +/*! + Sets the drawing mode to be used for this geometry. + + The default value is GL_TRIANGLE_STRIP. + */ +void QSGGeometry::setDrawingMode(GLenum mode) +{ + m_drawing_mode = mode; +} + +/*! + \fn int QSGGeometry::drawingMode() const + + Returns the drawing mode of this geometry. + + The default value is GL_TRIANGLE_STRIP. + */ + +/*! + \fn int QSGGeometry::indexType() const + + Returns the primitive type used for indices in this + geometry object. + */ + + +/*! + Resizes the vertex and index data of this geometry object to fit \a vertexCount + vertices and \a indexCount indices. + + Vertex and index data will be invalidated after this call and the caller must + */ +void QSGGeometry::allocate(int vertexCount, int indexCount) +{ + if (vertexCount == m_vertex_count && indexCount == m_index_count) + return; + + m_vertex_count = vertexCount; + m_index_count = indexCount; + + bool canUsePrealloc = m_index_count <= 0; + int vertexByteSize = m_attributes.stride * m_vertex_count; + + if (m_owns_data) + qFree(m_data); + + if (canUsePrealloc && vertexByteSize <= (int) sizeof(m_prealloc)) { + m_data = (void *) &m_prealloc[0]; + m_index_data_offset = -1; + m_owns_data = false; + } else { + Q_ASSERT(m_index_type == GL_UNSIGNED_INT || m_index_type == GL_UNSIGNED_SHORT); + int indexByteSize = indexCount * (m_index_type == GL_UNSIGNED_SHORT ? sizeof(quint16) : sizeof(quint32)); + m_data = (void *) qMalloc(vertexByteSize + indexByteSize); + m_index_data_offset = vertexByteSize; + m_owns_data = true; + } + +} + +/*! + Updates the geometry \a g with the coordinates in \a rect. + + The function assumes the geometry object contains a single triangle strip + of QSGGeometry::Point2D vertices + */ +void QSGGeometry::updateRectGeometry(QSGGeometry *g, const QRectF &rect) +{ + Point2D *v = g->vertexDataAsPoint2D(); + v[0].x = rect.left(); + v[0].y = rect.top(); + + v[1].x = rect.right(); + v[1].y = rect.top(); + + v[2].x = rect.left(); + v[2].y = rect.bottom(); + + v[3].x = rect.right(); + v[3].y = rect.bottom(); +} + +/*! + Updates the geometry \a g with the coordinates in \a rect and texture + coordinates from \a textureRect. + + \a textureRect should be in normalized coordinates. + + \a g is assumed to be a triangle strip of four vertices of type + QSGGeometry::TexturedPoint2D. + */ +void QSGGeometry::updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &textureRect) +{ + TexturedPoint2D *v = g->vertexDataAsTexturedPoint2D(); + v[0].x = rect.left(); + v[0].y = rect.top(); + v[0].tx = textureRect.left(); + v[0].ty = textureRect.top(); + + v[1].x = rect.right(); + v[1].y = rect.top(); + v[1].tx = textureRect.right(); + v[1].ty = textureRect.top(); + + v[2].x = rect.left(); + v[2].y = rect.bottom(); + v[2].tx = textureRect.left(); + v[2].ty = textureRect.bottom(); + + v[3].x = rect.right(); + v[3].y = rect.bottom(); + v[3].tx = textureRect.right(); + v[3].ty = textureRect.bottom(); +} + +QT_END_NAMESPACE diff --git a/src/imports/shaders/scenegraph/qsggeometry.h b/src/imports/shaders/scenegraph/qsggeometry.h new file mode 100644 index 0000000..0055392 --- /dev/null +++ b/src/imports/shaders/scenegraph/qsggeometry.h @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt scene graph research project. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSGGEOMETRY_H +#define QSGGEOMETRY_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSGGeometry +{ +public: + struct Attribute + { + int position; + int tupleSize; + int type; + }; + + struct AttributeSet { + int count; + int stride; + const Attribute *attributes; + }; + + struct Point2D { float x, y; }; + struct TexturedPoint2D { float x, y; float tx, ty; }; + struct ColoredPoint2D { float x, y; unsigned char r, g, b, a; }; + + static const AttributeSet &defaultAttributes_Point2D(); + static const AttributeSet &defaultAttributes_TexturedPoint2D(); + static const AttributeSet &defaultAttributes_ColoredPoint2D(); + + QSGGeometry(const QSGGeometry::AttributeSet &attribs, + int vertexCount, + int indexCount = 0, + int indexType = GL_UNSIGNED_SHORT); + ~QSGGeometry(); + + void setDrawingMode(GLenum mode); + inline GLenum drawingMode() const { return m_drawing_mode; } + + void allocate(int vertexCount, int indexCount = 0); + + int vertexCount() const { return m_vertex_count; } + + void *vertexData() { return m_data; } + inline Point2D *vertexDataAsPoint2D(); + inline TexturedPoint2D *vertexDataAsTexturedPoint2D(); + inline ColoredPoint2D *vertexDataAsColoredPoint2D(); + + inline const void *vertexData() const { return m_data; } + inline const Point2D *vertexDataAsPoint2D() const; + inline const TexturedPoint2D *vertexDataAsTexturedPoint2D() const; + inline const ColoredPoint2D *vertexDataAsColoredPoint2D() const; + + inline int indexType() const { return m_index_type; } + + int indexCount() const { return m_index_count; } + + void *indexData(); + inline uint *indexDataAsUInt(); + inline quint16 *indexDataAsUShort(); + + const void *indexData() const; + inline const uint *indexDataAsUInt() const; + inline const quint16 *indexDataAsUShort() const; + + inline int attributeCount() const { return m_attributes.count; } + inline const Attribute *attributes() const { return m_attributes.attributes; } + inline int stride() const { return m_attributes.stride; } + + static void updateRectGeometry(QSGGeometry *g, const QRectF &rect); + static void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect); + +private: + int m_drawing_mode; + int m_vertex_count; + int m_index_count; + int m_index_type; + const AttributeSet &m_attributes; + void *m_data; + int m_index_data_offset; + + void *m_reserved_pointer; + + uint m_owns_data : 1; + uint m_reserved_bits : 31; + + float m_prealloc[16]; +}; + +inline uint *QSGGeometry::indexDataAsUInt() +{ + Q_ASSERT(m_index_type == GL_UNSIGNED_INT); + return (uint *) indexData(); +} + +inline quint16 *QSGGeometry::indexDataAsUShort() +{ + Q_ASSERT(m_index_type == GL_UNSIGNED_SHORT); + return (quint16 *) indexData(); +} + +inline const uint *QSGGeometry::indexDataAsUInt() const +{ + Q_ASSERT(m_index_type == GL_UNSIGNED_INT); + return (uint *) indexData(); +} + +inline const quint16 *QSGGeometry::indexDataAsUShort() const +{ + Q_ASSERT(m_index_type == GL_UNSIGNED_SHORT); + return (quint16 *) indexData(); +} + +inline QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() +{ + Q_ASSERT(m_attributes.count == 1); + Q_ASSERT(m_attributes.stride == 2 * sizeof(float)); + Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); + Q_ASSERT(m_attributes.attributes[0].position == 0); + return (Point2D *) m_data; +} + +inline QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() +{ + Q_ASSERT(m_attributes.count == 2); + Q_ASSERT(m_attributes.stride == 4 * sizeof(float)); + Q_ASSERT(m_attributes.attributes[0].position == 0); + Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); + Q_ASSERT(m_attributes.attributes[1].position == 1); + Q_ASSERT(m_attributes.attributes[1].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[1].type == GL_FLOAT); + return (TexturedPoint2D *) m_data; +} + +inline QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() +{ + Q_ASSERT(m_attributes.count == 2); + Q_ASSERT(m_attributes.stride == 2 * sizeof(float) + 4 * sizeof(char)); + Q_ASSERT(m_attributes.attributes[0].position == 0); + Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); + Q_ASSERT(m_attributes.attributes[1].position == 1); + Q_ASSERT(m_attributes.attributes[1].tupleSize == 4); + Q_ASSERT(m_attributes.attributes[1].type == GL_UNSIGNED_BYTE); + return (ColoredPoint2D *) m_data; +} + +inline const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const +{ + Q_ASSERT(m_attributes.count == 1); + Q_ASSERT(m_attributes.stride == 2 * sizeof(float)); + Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); + Q_ASSERT(m_attributes.attributes[0].position == 0); + return (const Point2D *) m_data; +} + +inline const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() const +{ + Q_ASSERT(m_attributes.count == 2); + Q_ASSERT(m_attributes.stride == 4 * sizeof(float)); + Q_ASSERT(m_attributes.attributes[0].position == 0); + Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); + Q_ASSERT(m_attributes.attributes[1].position == 1); + Q_ASSERT(m_attributes.attributes[1].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[1].type == GL_FLOAT); + return (const TexturedPoint2D *) m_data; +} + +inline const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() const +{ + Q_ASSERT(m_attributes.count == 2); + Q_ASSERT(m_attributes.stride == 2 * sizeof(float) + 4 * sizeof(char)); + Q_ASSERT(m_attributes.attributes[0].position == 0); + Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); + Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); + Q_ASSERT(m_attributes.attributes[1].position == 1); + Q_ASSERT(m_attributes.attributes[1].tupleSize == 4); + Q_ASSERT(m_attributes.attributes[1].type == GL_UNSIGNED_BYTE); + return (const ColoredPoint2D *) m_data; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSGGEOMETRY_H diff --git a/src/imports/shaders/shadereffect.cpp b/src/imports/shaders/shadereffect.cpp new file mode 100644 index 0000000..bbea43c --- /dev/null +++ b/src/imports/shaders/shadereffect.cpp @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shadereffect.h" +#include "shadereffectbuffer.h" +#include "shadereffectsource.h" + +#include +#include +#include + +static QTransform savedWorldTransform; + +ShaderEffect::ShaderEffect(QObject *parent) + : QGraphicsEffect(parent) + , m_changed(true) +{ +} + +ShaderEffect::~ShaderEffect() +{ +} + +void ShaderEffect::prepareBufferedDraw(QPainter *painter) +{ + // This workaround needed because QGraphicsEffect seems to always utilize default painters worldtransform + // instead of the active painters worldtransform. + const ShaderEffectBuffer *effectBuffer = dynamic_cast (painter->device()); + if (effectBuffer) { + savedWorldTransform = painter->worldTransform() * savedWorldTransform; + painter->setWorldTransform(savedWorldTransform); + } else { + savedWorldTransform = painter->worldTransform(); + } +} + +void ShaderEffect::draw (QPainter *painter) +{ + const QGLContext *context = QGLContext::currentContext(); + + prepareBufferedDraw(painter); + + if (context) { + updateRenderTargets(); + } + + if (!context || m_renderTargets.count() == 0 || !hideOriginal()) + drawSource(painter); +} + +void ShaderEffect::updateRenderTargets() +{ + if (!m_changed) + return; + + m_changed = false; + + int count = m_renderTargets.count(); + for (int i = 0; i < count; i++) { + if (m_renderTargets[i]->isLive() || m_renderTargets[i]->isDirtyTexture()) { + m_renderTargets[i]->updateBackbuffer(); + ShaderEffectBuffer* target = m_renderTargets[i]->fbo(); + if (target && target->isValid() && target->width() > 0 && target->height() > 0) { + QPainter p(target); + p.setCompositionMode(QPainter::CompositionMode_Clear); + p.fillRect(QRect(QPoint(0, 0), target->size()), Qt::transparent); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + + QRectF sourceRect = m_renderTargets[i]->sourceRect(); + QSize textureSize = m_renderTargets[i]->textureSize(); + + qreal yflip = m_renderTargets[i]->isMirrored() ? -1.0 : 1.0; // flip y to match scenegraph, it also flips texturecoordinates + qreal xscale = 1.0; + qreal yscale = 1.0 * yflip; + + qreal leftMargin = 0.0; + qreal rightMargin = 0.0; + qreal topMargin = 0.0; + qreal bottomMargin = 0.0; + + qreal width = m_renderTargets[i]->sourceItem()->width(); + qreal height = m_renderTargets[i]->sourceItem()->height(); + + if (!sourceRect.isEmpty()) { + leftMargin = -sourceRect.left(); + rightMargin = sourceRect.right() - width; + topMargin = -sourceRect.top(); + bottomMargin = sourceRect.bottom() - height; + } + + if ((width + leftMargin + rightMargin) > 0 && (height + topMargin + bottomMargin) > 0) { + if (!textureSize.isEmpty()) { + qreal textureWidth = textureSize.width(); + qreal textureHeight = textureSize.height(); + + xscale = width / (width + leftMargin + rightMargin); + yscale = height / (height + topMargin + bottomMargin); + + p.translate(textureWidth / 2, textureHeight / 2); + p.scale(xscale, yscale * yflip); + p.translate(-textureWidth / 2, -textureHeight / 2); + p.scale(textureWidth / width, textureHeight / height); + } else { + xscale = width / (width + leftMargin + rightMargin); + yscale = height / (height + topMargin + bottomMargin); + + p.translate(width / 2, height / 2); + p.scale(xscale, yscale * yflip); + p.translate(-width / 2, -height / 2); + } + } + + drawSource(&p); + p.end(); + m_renderTargets[i]->markSceneGraphDirty(); + } + } + } +} + +void ShaderEffect::sourceChanged (ChangeFlags flags) +{ + Q_UNUSED(flags); + m_changed = true; +} + +void ShaderEffect::addRenderTarget(ShaderEffectSource *target) +{ + if (!m_renderTargets.contains(target)) + m_renderTargets.append(target); +} + +void ShaderEffect::removeRenderTarget(ShaderEffectSource *target) +{ + int index = m_renderTargets.indexOf(target); + if (index >= 0) + m_renderTargets.remove(index); + else + qWarning() << "ShaderEffect::removeRenderTarget - did not find target."; +} + +bool ShaderEffect::hideOriginal() const +{ + if (m_renderTargets.count() == 0) + return false; + + // Just like scenegraph version, if there is even one source that says "hide original" we hide it. + int count = m_renderTargets.count(); + for (int i = 0; i < count; i++) { + if (m_renderTargets[i]->hideSource()) + return true; + } + return false; +} diff --git a/src/imports/shaders/shadereffect.h b/src/imports/shaders/shadereffect.h new file mode 100644 index 0000000..35a697b --- /dev/null +++ b/src/imports/shaders/shadereffect.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHADEREFFECT_H +#define SHADEREFFECT_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class ShaderEffectSource; + +class ShaderEffect : public QGraphicsEffect +{ + Q_OBJECT + +public: + ShaderEffect(QObject *parent = 0); + ~ShaderEffect(); + void addRenderTarget(ShaderEffectSource *target); + void removeRenderTarget(ShaderEffectSource *target); + +protected: + virtual void draw (QPainter *painter); + virtual void sourceChanged (ChangeFlags flags); + +private: + void prepareBufferedDraw(QPainter *painter); + void updateRenderTargets(); + bool hideOriginal() const; + +public: + QVector m_renderTargets; + bool m_changed : 1; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif // SHADEREFFECT_H diff --git a/src/imports/shaders/shadereffectbuffer.cpp b/src/imports/shaders/shadereffectbuffer.cpp new file mode 100644 index 0000000..4c76ada --- /dev/null +++ b/src/imports/shaders/shadereffectbuffer.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shadereffectbuffer.h" + +ShaderEffectBuffer::ShaderEffectBuffer(const QSize & size, const QGLFramebufferObjectFormat & format) + : QGLFramebufferObject(size, format) +{ +} + +ShaderEffectBuffer::~ShaderEffectBuffer() +{ +} + diff --git a/src/imports/shaders/shadereffectbuffer.h b/src/imports/shaders/shadereffectbuffer.h new file mode 100644 index 0000000..dcab6ec --- /dev/null +++ b/src/imports/shaders/shadereffectbuffer.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHADEREFFECTBUFFER_H +#define SHADEREFFECTBUFFER_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class ShaderEffectBuffer : public QGLFramebufferObject +{ +public: + ShaderEffectBuffer(const QSize &size, const QGLFramebufferObjectFormat &format); + ~ShaderEffectBuffer(); +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif // SHADEREFFECTBUFFER_H diff --git a/src/imports/shaders/shadereffectitem.cpp b/src/imports/shaders/shadereffectitem.cpp new file mode 100644 index 0000000..a32168e --- /dev/null +++ b/src/imports/shaders/shadereffectitem.cpp @@ -0,0 +1,915 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shadereffectitem.h" +#include "shadereffect.h" +#include "glfunctions.h" + +#include +#include + +static const char qt_default_vertex_code[] = + "uniform highp mat4 qt_ModelViewProjectionMatrix;\n" + "attribute highp vec4 qt_Vertex;\n" + "attribute highp vec2 qt_MultiTexCoord0;\n" + "varying highp vec2 qt_TexCoord0;\n" + "void main(void)\n" + "{\n" + "qt_TexCoord0 = qt_MultiTexCoord0;\n" + "gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;\n" + "}\n"; + +static const char qt_default_fragment_code[] = + "varying highp vec2 qt_TexCoord0;\n" + "uniform lowp sampler2D source;\n" + "void main(void)\n" + "{\n" + "gl_FragColor = texture2D(source, qt_TexCoord0.st);\n" + "}\n"; + +static const char qt_postion_attribute_name[] = "qt_Vertex"; +static const char qt_texcoord_attribute_name[] = "qt_MultiTexCoord0"; +static const char qt_emptyAttributeName[] = ""; + + +/*! + \qmlclass ShaderEffectItem ShaderEffectItem + \ingroup qmlshadersplugin + \brief The ShaderEffectItem object alters the output of given item with OpenGL shaders. + \inherits Item + + ShaderEffectItem is available in the \bold{Qt.labs.shaders 1.0} module. + \e {Elements in the Qt.labs module are not guaranteed to remain compatible + in future versions.} + + This element provides preliminary support for embedding OpenGL shader code into QML, + and may be heavily changed or removed in later versions. + + Requirement for the use of shaders is that the application is either using + Qt OpenGL graphicssystem or is forced to use OpenGL by setting QGLWidget as the viewport to QDeclarativeView (recommened way). + + ShaderEffectItem internal behaviour is such that during the paint event it first renders its + ShaderEffectSource items into a OpenGL framebuffer object which can be used as a texture. If the ShaderEffectSource is defined to be an image, + it is directly uploaded as a texture. The texture(s) containing the source pixelcontent are then bound to graphics + pipeline texture units. Finally a textured mesh is passed to the vertex- and fragmentshaders which + then produce the final output for the ShaderEffectItem. It is possible to alter the mesh structure by defining + the amount vertices it contains, but currently it is not possible to import complex 3D-models to be used as the mesh. + + It is possible to define one or more ShaderEffectItems to be a ShaderEffectSource for other ShaderEffectItems, but ShaderEffectItem + should never be declared as a child element of its source item(s) because it would cause circular loop in the painting. + + A standard set of vertex attributes are provided for the shaders: + + \list + \o qt_Vertex - The primary position of the vertex. + \o qt_MultiTexCoord0 - The texture co-ordinate at each vertex for texture unit 0. + \endlist + + Additionally following uniforms are available for shaders: + + \list + \o qt_Opacity - Effective opacity of the item. + \o qt_ModelViewProjectionMatrix - current 4x4 transformation matrix of the item. + \endlist + + Furthermore, it is possible to utilize automatic QML propertybinding into vertex- and fragment shader + uniforms. Conversions are done according to the table below: + + \table + \header + \o QML property + \o GLSL uniform + \row + \o property double foo: 1.0 + \o uniform highp float foo + \row + \o property real foo: 1.0 + \o uniform highp float foo + \row + \o property bool foo: true + \o uniform bool foo + \row + \o property int foo: 1 + \o uniform int foo + \row + \o property variant foo: Qt.point(1,1) + \o uniform highp vec2 foo + \row + \o property variant foo: Qt.size(1, 1) + \o uniform highp vec2 foo + \row + \o property variant foo: Qt.rect(1, 1, 2, 2) + \o uniform highp vec4 foo + \row + \o property color foo: "#00000000" + \o uniform lowp vec4 foo + \row + \o property variant foo: Qt.vector3d(1.0, 2.0, 0.0) + \o uniform highp vec3 foo + \row + \o property variant foo: ShaderEffectSource { SourceItem: bar } + \o uniform lowp sampler2D foo + \endtable + \note + The uniform precision definitions in the above table are not strict, it is possible to choose the uniform + precision based on what is the most suitable for the shader code for that particular uniform. + + + The below example uses fragment shader to create simple wiggly effect to a text label. + Automatic property binding takes care of binding the properties to the uniforms if their + names are identical. ShaderEffectSource referring to textLabel is bound to sampler2D uniform inside the fragment + shader code. + + \qml +import QtQuick 1.0 +import Qt.labs.shaders 1.0 + +Rectangle { + width: 300 + height: 300 + color: "black" + + Text { + id: textLabel + text: "Hello World" + anchors.centerIn: parent + font.pixelSize: 32 + color: "white" + + } + + ShaderEffectItem { + property variant source: ShaderEffectSource { sourceItem: textLabel; hideSource: true } + property real wiggleAmount: 0.005 + anchors.fill: textLabel + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + uniform highp float wiggleAmount; + void main(void) + { + highp vec2 wiggledTexCoord = qt_TexCoord0; + wiggledTexCoord.s += sin(4.0 * 3.141592653589 * wiggledTexCoord.t) * wiggleAmount; + gl_FragColor = texture2D(source, wiggledTexCoord.st); + } + " + } +} + \endqml + \image Example1.png + +*/ + +ShaderEffectItem::ShaderEffectItem(QDeclarativeItem *parent) + : QDeclarativeItem(parent) + , m_meshResolution(1, 1) + , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) + , m_blending(true) + , m_program_dirty(true) + , m_active(true) + , m_respectsMatrix(false) + , m_respectsOpacity(false) + , m_checkedViewportUpdateMode(false) + , m_checkedOpenGL(false) + , m_checkedShaderPrograms(false) + , m_hasShaderPrograms(false) + , m_mirrored(false) + , m_defaultVertexShader(true) +{ + setFlag(QGraphicsItem::ItemHasNoContents, false); + connect(this, SIGNAL(visibleChanged()), this, SLOT(handleVisibilityChange())); + m_active = isVisible(); +} + +ShaderEffectItem::~ShaderEffectItem() +{ + reset(); +} + + +/*! + \qmlproperty string ShaderEffectItem::fragmentShader + This property holds the OpenGL fragment shader code. + + The default fragment shader is following: + + \code + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + void main(void) + { + gl_FragColor = texture2D(source, qt_TexCoord0.st); + } + \endcode + +*/ + +/*! + \property ShaderEffectItem::fragmentShader + \brief the OpenGL fragment shader code. +*/ + +void ShaderEffectItem::setFragmentShader(const QString &code) +{ + if (m_fragment_code.constData() == code.constData()) + return; + + m_fragment_code = code; + if (isComponentComplete()) { + reset(); + updateProperties(); + } + emit fragmentShaderChanged(); +} + +/*! + \qmlproperty string ShaderEffectItem::vertexShader + This property holds the OpenGL vertex shader code. + + The default vertex shader is following: + + \code + uniform highp mat4 qt_ModelViewProjectionMatrix; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main(void) + { + qt_TexCoord0 = qt_MultiTexCoord0; + gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; + } + \endcode + +*/ + +/*! + \property ShaderEffectItem::vertexShader + \brief the OpenGL vertex shader code. +*/ + +void ShaderEffectItem::setVertexShader(const QString &code) +{ + if (m_vertex_code.constData() == code.constData()) + return; + + m_vertex_code = code; + m_defaultVertexShader = false; + if (isComponentComplete()) { + reset(); + updateProperties(); + } + emit vertexShaderChanged(); +} + +/*! + \qmlproperty bool ShaderEffectItem::blending + This property defines wheter item is drawn using blending. + + If true, the RGBA pixel output from the fragment shader is blended with + the pixel RGBA-values already in the framebuffer. + + If false, fragment shader output is written to framebuffer as such. + + Usually drawing without blending is slightly faster, thus disabling blending + might be a good choice when item is used as a background element. + + \note + By default the pixel data in textures is stored in 32-bit premultiplied alpha format. + This should be taken into account when blending or reading the pixel values + in the fragment shader code. + + The default value is true. +*/ + +/*! + \property ShaderEffectItem::blending + \brief the drawing is done using blending. +*/ + +void ShaderEffectItem::setBlending(bool enable) +{ + if (m_blending == enable) + return; + + m_blending = enable; + m_changed = true; + emit blendingChanged(); +} + + +/*! + \qmlproperty QSize ShaderEffectItem::meshResolution + This property defines to how many triangles the item is divided into before its + vertices are passed to the vertex shader. + + Triangles are defined as triangle strips and the amount of triangles can be controlled + separately for x and y-axis. + + The default value is QSize(1,1). +*/ + +/*! + \property ShaderEffectItem::meshResolution + \brief the amount of triangles in the mesh for both x and y-axis. +*/ + +void ShaderEffectItem::setMeshResolution(const QSize &size) +{ + if (size == m_meshResolution) + return; + + m_meshResolution = size; + emit meshResolutionChanged(); + updateGeometry(); +} + +void ShaderEffectItem::componentComplete() +{ + updateProperties(); + QDeclarativeItem::componentComplete(); +} + +void ShaderEffectItem::checkViewportUpdateMode() +{ + if (!m_checkedViewportUpdateMode) { + QGraphicsScene *s = scene(); + if (s){ + QList views = s->views(); + for (int i = 0; i < views.count(); i++) { + if (views[i]->viewportUpdateMode() != QGraphicsView::FullViewportUpdate) { + qWarning() << "ShaderEffectItem::checkViewportUpdateMode - consider setting QGraphicsView::FullViewportUpdate mode with OpenGL!"; + } + } + } + m_checkedViewportUpdateMode = true; + } +} + +void ShaderEffectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + if (!m_active) return; + + const QGLContext *context = QGLContext::currentContext(); + + if (context) { + if (!m_checkedShaderPrograms) { + m_hasShaderPrograms = QGLShaderProgram::hasOpenGLShaderPrograms(context); + m_checkedShaderPrograms = true; + + if (!m_hasShaderPrograms) + qWarning() << "ShaderEffectItem::paint - Shader programs are not supported"; + } + + if ( !m_hasShaderPrograms ) + return; + + checkViewportUpdateMode(); + painter->save(); + painter->beginNativePainting(); + QMatrix4x4 combinedMatrix = QMatrix4x4(painter->transform()); + renderEffect(painter, combinedMatrix); + painter->endNativePainting(); + painter->restore(); + } else { + if (!m_checkedOpenGL) { + qWarning() << "ShaderEffectItem::paint - OpenGL not available"; + m_checkedOpenGL = true; + } + } +} + +void ShaderEffectItem::renderEffect(QPainter *painter, const QMatrix4x4 &matrix) +{ + if (!painter || !painter->device()) + return; + + if (!m_program.isLinked() || m_program_dirty) + updateShaderProgram(); + + m_program.bind(); + + QMatrix4x4 combinedMatrix; + combinedMatrix.scale(2.0 / painter->device()->width(), -2.0 / painter->device()->height(), 1.0); + combinedMatrix.translate(-painter->device()->width() / 2.0, -painter->device()->height() / 2.0 ); + combinedMatrix *= matrix; + updateEffectState(combinedMatrix); + + for (int i = 0; i < m_attributeNames.size(); ++i) { + m_program.enableAttributeArray(m_geometry.attributes()[i].position); + } + + bindGeometry(); + + // Optimization, disable depth test when we know we don't need it. + if (m_defaultVertexShader) { + glDepthMask(false); + glDisable(GL_DEPTH_TEST); + } else { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_GREATER); + glDepthMask(true); +#if defined(QT_OPENGL_ES) + glClearDepthf(0); +#else + glClearDepth(0); +#endif + glClearColor(0, 0, 0, 0); + glClear(GL_DEPTH_BUFFER_BIT); + } + + if (m_blending){ + glEnable(GL_BLEND); + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glDisable(GL_BLEND); + } + + if (m_geometry.indexCount()) + glDrawElements(m_geometry.drawingMode(), m_geometry.indexCount(), m_geometry.indexType(), m_geometry.indexData()); + else + glDrawArrays(m_geometry.drawingMode(), 0, m_geometry.vertexCount()); + + glDepthMask(false); + glDisable(GL_DEPTH_TEST); + + for (int i = 0; i < m_attributeNames.size(); ++i) + m_program.disableAttributeArray(m_geometry.attributes()[i].position); +} + +void ShaderEffectItem::updateEffectState(const QMatrix4x4 &matrix) +{ + for (int i = m_sources.size() - 1; i >= 0; --i) { + const ShaderEffectItem::SourceData &source = m_sources.at(i); + if (!source.source) + continue; + + glActiveTexture(GL_TEXTURE0 + i); + source.source->bind(); + } + + if (m_respectsOpacity) + m_program.setUniformValue("qt_Opacity", static_cast (effectiveOpacity())); + + if (m_respectsMatrix){ + m_program.setUniformValue("qt_ModelViewProjectionMatrix", matrix); + } + + QSet::const_iterator it; + for (it = m_uniformNames.begin(); it != m_uniformNames.end(); ++it) { + const QByteArray &name = *it; + QVariant v = property(name.constData()); + + switch (v.type()) { + case QVariant::Color: + m_program.setUniformValue(name.constData(), qvariant_cast(v)); + break; + case QVariant::Double: + m_program.setUniformValue(name.constData(), (float) qvariant_cast(v)); + break; + case QVariant::Transform: + m_program.setUniformValue(name.constData(), qvariant_cast(v)); + break; + case QVariant::Int: + m_program.setUniformValue(name.constData(), v.toInt()); + break; + case QVariant::Bool: + m_program.setUniformValue(name.constData(), GLint(v.toBool())); + break; + case QVariant::Size: + case QVariant::SizeF: + m_program.setUniformValue(name.constData(), v.toSizeF()); + break; + case QVariant::Point: + case QVariant::PointF: + m_program.setUniformValue(name.constData(), v.toPointF()); + break; + case QVariant::Rect: + case QVariant::RectF: + { + QRectF r = v.toRectF(); + m_program.setUniformValue(name.constData(), r.x(), r.y(), r.width(), r.height()); + } + break; + case QVariant::Vector3D: + m_program.setUniformValue(name.constData(), qvariant_cast(v)); + break; + default: + break; + } + } +} + +static inline int size_of_type(GLenum type) +{ + static int sizes[] = { + sizeof(char), + sizeof(unsigned char), + sizeof(short), + sizeof(unsigned short), + sizeof(int), + sizeof(unsigned int), + sizeof(float), + 2, + 3, + 4, + sizeof(double) + }; + return sizes[type - GL_BYTE]; +} + +void ShaderEffectItem::bindGeometry() +{ + char const *const *attrNames = m_attributeNames.constData(); + int offset = 0; + for (int j = 0; j < m_attributeNames.size(); ++j) { + if (!*attrNames[j]) + continue; + Q_ASSERT_X(j < m_geometry.attributeCount(), "ShaderEffectItem::bindGeometry()", "Geometry lacks attribute required by material"); + const QSGGeometry::Attribute &a = m_geometry.attributes()[j]; + Q_ASSERT_X(j == a.position, "ShaderEffectItem::bindGeometry()", "Geometry does not have continous attribute positions"); +#if defined(QT_OPENGL_ES_2) + GLboolean normalize = a.type != GL_FLOAT; +#else + GLboolean normalize = a.type != GL_FLOAT && a.type != GL_DOUBLE; +#endif + if (normalize) + qWarning() << "ShaderEffectItem::bindGeometry() - non supported attribute type!"; + + m_program.setAttributeArray(a.position, (GLfloat*) (((char*) m_geometry.vertexData()) + offset), a.tupleSize, m_geometry.stride()); + //glVertexAttribPointer(a.position, a.tupleSize, a.type, normalize, m_geometry.stride(), (char *) m_geometry.vertexData() + offset); + offset += a.tupleSize * size_of_type(a.type); + } +} + +void ShaderEffectItem::updateGeometry() +{ + QRectF srcRect(0, 1, 1, -1); + + if (m_mirrored) + srcRect = QRectF(0, 0, 1, 1); + + QRectF dstRect = QRectF(0,0, width(), height()); + + int vmesh = m_meshResolution.height(); + int hmesh = m_meshResolution.width(); + + QSGGeometry *g = &m_geometry; + if (vmesh == 1 && hmesh == 1) { + if (g->vertexCount() != 4) + g->allocate(4); + QSGGeometry::updateTexturedRectGeometry(g, dstRect, srcRect); + return; + } + + g->allocate((vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2)); + + QSGGeometry::TexturedPoint2D *vdata = g->vertexDataAsTexturedPoint2D(); + + for (int iy = 0; iy <= vmesh; ++iy) { + float fy = iy / float(vmesh); + float y = float(dstRect.top()) + fy * float(dstRect.height()); + float ty = float(srcRect.top()) + fy * float(srcRect.height()); + for (int ix = 0; ix <= hmesh; ++ix) { + float fx = ix / float(hmesh); + vdata->x = float(dstRect.left()) + fx * float(dstRect.width()); + vdata->y = y; + vdata->tx = float(srcRect.left()) + fx * float(srcRect.width()); + vdata->ty = ty; + ++vdata; + } + } + + quint16 *indices = (quint16 *)g->indexDataAsUShort(); + int i = 0; + for (int iy = 0; iy < vmesh; ++iy) { + *(indices++) = i + hmesh + 1; + for (int ix = 0; ix <= hmesh; ++ix, ++i) { + *(indices++) = i + hmesh + 1; + *(indices++) = i; + } + *(indices++) = i - 1; + } +} + +void ShaderEffectItem::setActive(bool enable) +{ + if (m_active == enable) + return; + + if (m_active) { + for (int i = 0; i < m_sources.size(); ++i) { + ShaderEffectSource *source = m_sources.at(i).source; + if (!source) + continue; + disconnect(source, SIGNAL(repaintRequired()), this, SLOT(markDirty())); + source->derefFromEffectItem(); + } + } + + m_active = enable; + + if (m_active) { + for (int i = 0; i < m_sources.size(); ++i) { + ShaderEffectSource *source = m_sources.at(i).source; + if (!source) + continue; + source->refFromEffectItem(); + connect(source, SIGNAL(repaintRequired()), this, SLOT(markDirty())); + } + } + + emit activeChanged(); + markDirty(); +} + +void ShaderEffectItem::preprocess() +{ + for (int i = 0; i < m_sources.size(); ++i) { + ShaderEffectSource *source = m_sources.at(i).source; + if (source) + source->updateBackbuffer(); + } +} + +void ShaderEffectItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + if (newGeometry.size() != oldGeometry.size()) + updateGeometry(); + QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); +} + +void ShaderEffectItem::changeSource(int index) +{ + Q_ASSERT(index >= 0 && index < m_sources.size()); + QVariant v = property(m_sources.at(index).name.constData()); + setSource(v, index); +} + +void ShaderEffectItem::markDirty() { + update(); +} + +void ShaderEffectItem::setSource(const QVariant &var, int index) +{ + Q_ASSERT(index >= 0 && index < m_sources.size()); + + SourceData &source = m_sources[index]; + + source.source = 0; + source.item = 0; + if (var.isNull()) { + return; + } else if (!qVariantCanConvert(var)) { + qWarning("Could not assign source of type '%s' to property '%s'.", var.typeName(), source.name.constData()); + return; + } + + QObject *obj = qVariantValue(var); + + source.source = qobject_cast(obj); + source.item = qobject_cast(obj); + + if (!source.item) + qWarning("Could not assign property '%s', did not implement QDeclarativeItem.", source.name.constData()); + + if (!source.source) + qWarning("Could not assign property '%s', did not implement ShaderEffectSource.", source.name.constData()); + + // TODO: Find better solution. + // 'source.item' needs a canvas to get a scenegraph node. + // The easiest way to make sure it gets a canvas is to + // make it a part of the same item tree as 'this'. + if (source.item && source.item->parentItem() == 0) { + source.item->setParentItem(this); + // Unlike in scenegraph, we cannot set item invisible here because qgraphicsview would optimize it away. + } + + // Unlike in scenegraph, ref counting is used to optimize memory consumption. Sources themself may free fbos when not referenced. + if (m_active && source.source) { + source.source->refFromEffectItem(); + connect(source.source, SIGNAL(repaintRequired()), this, SLOT(markDirty())); + } +} + +void ShaderEffectItem::disconnectPropertySignals() +{ + disconnect(this, 0, this, SLOT(markDirty())); + for (int i = 0; i < m_sources.size(); ++i) { + SourceData &source = m_sources[i]; + disconnect(this, 0, source.mapper, 0); + disconnect(source.mapper, 0, this, 0); + } +} + +void ShaderEffectItem::connectPropertySignals() +{ + QSet::const_iterator it; + for (it = m_uniformNames.begin(); it != m_uniformNames.end(); ++it) { + int pi = metaObject()->indexOfProperty(it->constData()); + if (pi >= 0) { + QMetaProperty mp = metaObject()->property(pi); + if (!mp.hasNotifySignal()) + qWarning("ShaderEffectItem: property '%s' does not have notification method!", it->constData()); + QByteArray signalName("2"); + signalName.append(mp.notifySignal().signature()); + connect(this, signalName, this, SLOT(markDirty())); + } else { + qWarning("ShaderEffectItem: '%s' does not have a matching property!", it->constData()); + } + } + for (int i = 0; i < m_sources.size(); ++i) { + SourceData &source = m_sources[i]; + int pi = metaObject()->indexOfProperty(source.name.constData()); + if (pi >= 0) { + QMetaProperty mp = metaObject()->property(pi); + QByteArray signalName("2"); + signalName.append(mp.notifySignal().signature()); + connect(this, signalName, source.mapper, SLOT(map())); + source.mapper->setMapping(this, i); + connect(source.mapper, SIGNAL(mapped(int)), this, SLOT(changeSource(int))); + } else { + qWarning("ShaderEffectItem: '%s' does not have a matching source!", source.name.constData()); + } + } +} + +void ShaderEffectItem::reset() +{ + disconnectPropertySignals(); + + m_program.removeAllShaders(); + m_attributeNames.clear(); + m_uniformNames.clear(); + for (int i = 0; i < m_sources.size(); ++i) { + const SourceData &source = m_sources.at(i); + if (m_active && source.source) + source.source->derefFromEffectItem(); + delete source.mapper; + } + + m_sources.clear(); + m_program_dirty = true; +} + +void ShaderEffectItem::updateProperties() +{ + QString vertexCode = m_vertex_code; + QString fragmentCode = m_fragment_code; + + if (vertexCode.isEmpty()) + vertexCode = qt_default_vertex_code; + + if (fragmentCode.isEmpty()) + fragmentCode = qt_default_fragment_code; + + lookThroughShaderCode(vertexCode); + lookThroughShaderCode(fragmentCode); + + if (!m_attributeNames.contains(qt_postion_attribute_name)) + qWarning("ShaderEffectItem: Missing reference to \'%s\'.", qt_postion_attribute_name); + if (!m_attributeNames.contains(qt_texcoord_attribute_name)) + qWarning("ShaderEffectItem: Missing reference to \'%s\'.", qt_texcoord_attribute_name); + if (!m_respectsMatrix) + qWarning("ShaderEffectItem: Missing reference to \'qt_ModelViewProjectionMatrix\'."); + + for (int i = 0; i < m_sources.size(); ++i) { + QVariant v = property(m_sources.at(i).name); + setSource(v, i); // Property exists. + } + + connectPropertySignals(); +} + +void ShaderEffectItem::updateShaderProgram() +{ + QString vertexCode = m_vertex_code; + QString fragmentCode = m_fragment_code; + + if (vertexCode.isEmpty()) + vertexCode = QString::fromLatin1(qt_default_vertex_code); + + if (fragmentCode.isEmpty()) + fragmentCode = QString::fromLatin1(qt_default_fragment_code); + + m_program.addShaderFromSourceCode(QGLShader::Vertex, vertexCode); + m_program.addShaderFromSourceCode(QGLShader::Fragment, fragmentCode); + + for (int i = 0; i < m_attributeNames.size(); ++i) { + m_program.bindAttributeLocation(m_attributeNames.at(i), m_geometry.attributes()[i].position); + } + + if (!m_program.link()) { + qWarning("ShaderEffectItem: Shader compilation failed:"); + qWarning() << m_program.log(); + } + + if (!m_attributeNames.contains(qt_postion_attribute_name)) + qWarning("ShaderEffectItem: Missing reference to \'qt_Vertex\'."); + if (!m_attributeNames.contains(qt_texcoord_attribute_name)) + qWarning("ShaderEffectItem: Missing reference to \'qt_MultiTexCoord0\'."); + if (!m_respectsMatrix) + qWarning("ShaderEffectItem: Missing reference to \'qt_ModelViewProjectionMatrix\'."); + + if (m_program.isLinked()) { + m_program.bind(); + for (int i = 0; i < m_sources.size(); ++i) + m_program.setUniformValue(m_sources.at(i).name.constData(), i); + } + + m_program_dirty = false; +} + +void ShaderEffectItem::lookThroughShaderCode(const QString &code) +{ + // Regexp for matching attributes and uniforms. + // In human readable form: attribute|uniform [lowp|mediump|highp] + static QRegExp re(QLatin1String("\\b(attribute|uniform)\\b\\s*\\b(?:lowp|mediump|highp)?\\b\\s*\\b(\\w+)\\b\\s*\\b(\\w+)")); + Q_ASSERT(re.isValid()); + + int pos = -1; + + //QString wideCode = QString::fromLatin1(code.constData(), code.size()); + QString wideCode = code; + + while ((pos = re.indexIn(wideCode, pos + 1)) != -1) { + QByteArray decl = re.cap(1).toLatin1(); // uniform or attribute + QByteArray type = re.cap(2).toLatin1(); // type + QByteArray name = re.cap(3).toLatin1(); // variable name + + if (decl == "attribute") { + if (name == qt_postion_attribute_name) { + m_attributeNames.insert(0, qt_postion_attribute_name); + } else if (name == "qt_MultiTexCoord0") { + if (m_attributeNames.at(0) == 0) { + m_attributeNames.insert(0, qt_emptyAttributeName); + } + m_attributeNames.insert(1, qt_texcoord_attribute_name); + } else { + // TODO: Support user defined attributes. + qWarning("ShaderEffectItem: Attribute \'%s\' not recognized.", name.constData()); + } + } else { + Q_ASSERT(decl == "uniform"); + + if (name == "qt_ModelViewProjectionMatrix") { + m_respectsMatrix = true; + } else if (name == "qt_Opacity") { + m_respectsOpacity = true; + } else { + m_uniformNames.insert(name); + if (type == "sampler2D") { + SourceData d; + d.mapper = new QSignalMapper; + d.source = 0; + d.name = name; + d.item = 0; + m_sources.append(d); + } + } + } + } +} + +void ShaderEffectItem::handleVisibilityChange() +{ + setActive(isVisible()); +} diff --git a/src/imports/shaders/shadereffectitem.h b/src/imports/shaders/shadereffectitem.h new file mode 100644 index 0000000..1d27543 --- /dev/null +++ b/src/imports/shaders/shadereffectitem.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHADEREFFECTITEM_H +#define SHADEREFFECTITEM_H + +#include +#include +#include "shadereffectsource.h" +#include "scenegraph/qsggeometry.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class ShaderEffectItem : public QDeclarativeItem +{ + Q_OBJECT + Q_INTERFACES(QDeclarativeParserStatus) + Q_PROPERTY(QString fragmentShader READ fragmentShader WRITE setFragmentShader NOTIFY fragmentShaderChanged) + Q_PROPERTY(QString vertexShader READ vertexShader WRITE setVertexShader NOTIFY vertexShaderChanged) + Q_PROPERTY(bool blending READ blending WRITE setBlending NOTIFY blendingChanged) + Q_PROPERTY(QSize meshResolution READ meshResolution WRITE setMeshResolution NOTIFY meshResolutionChanged) + +public: + ShaderEffectItem(QDeclarativeItem* parent = 0); + ~ShaderEffectItem(); + + virtual void componentComplete(); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + QString fragmentShader() const { return m_fragment_code; } + void setFragmentShader(const QString &code); + + QString vertexShader() const { return m_vertex_code; } + void setVertexShader(const QString &code); + + bool blending() const { return m_blending; } + void setBlending(bool enable); + + QSize meshResolution() const { return m_meshResolution; } + void setMeshResolution(const QSize &size); + + void preprocess(); + +Q_SIGNALS: + void fragmentShaderChanged(); + void vertexShaderChanged(); + void blendingChanged(); + void activeChanged(); + void meshResolutionChanged(); + +protected: + virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + +private Q_SLOTS: + void changeSource(int index); + void handleVisibilityChange(); + void markDirty(); + +private: + void checkViewportUpdateMode(); + void renderEffect(QPainter *painter, const QMatrix4x4 &matrix); + void updateEffectState(const QMatrix4x4 &matrix); + void updateGeometry(); + void bindGeometry(); + void setSource(const QVariant &var, int index); + void disconnectPropertySignals(); + void connectPropertySignals(); + void reset(); + void updateProperties(); + void updateShaderProgram(); + void lookThroughShaderCode(const QString &code); + bool active() const { return m_active; } + void setActive(bool enable); + +private: + QString m_fragment_code; + QString m_vertex_code; + QGLShaderProgram m_program; + QVector m_attributeNames; + QSet m_uniformNames; + QSize m_meshResolution; + QSGGeometry m_geometry; + + struct SourceData + { + QSignalMapper *mapper; + QPointer source; + QPointer item; + QByteArray name; + }; + + QVector m_sources; + + bool m_changed : 1; + bool m_blending : 1; + bool m_program_dirty : 1; + bool m_active : 1; + bool m_respectsMatrix : 1; + bool m_respectsOpacity : 1; + bool m_checkedViewportUpdateMode : 1; + bool m_checkedOpenGL : 1; + bool m_checkedShaderPrograms : 1; + bool m_hasShaderPrograms : 1; + bool m_mirrored : 1; + bool m_defaultVertexShader : 1; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif // SHADEREFFECTITEM_H diff --git a/src/imports/shaders/shadereffectsource.cpp b/src/imports/shaders/shadereffectsource.cpp new file mode 100644 index 0000000..0a133bd --- /dev/null +++ b/src/imports/shaders/shadereffectsource.cpp @@ -0,0 +1,472 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shadereffectsource.h" +#include "shadereffectbuffer.h" +#include "shadereffect.h" +#include "glfunctions.h" + +#include + +/*! + \qmlclass ShaderEffectSource ShaderEffectSource + \ingroup qmlshadersplugin + \brief The ShaderEffectSource object encapsulates the source content for the ShaderEffectItem. + + ShaderEffectSource is available in the \bold{Qt.labs.shaders 1.0} module. + \e {Elements in the Qt.labs module are not guaranteed to remain compatible + in future versions.} + + This element provides preliminary support for OpenGL shaders in QML, + and may be heavily changed or removed in later versions. + + Requirement for the ability to use of shaders is that the application is either using + opengl graphicssystem or has set QGLWidget as the viewport to QDeclarativeView (recommended way). + + ShaderEffectSource object encapsulates the source content so that it can be utilized in ShaderEffectItem. + Source content can be a live QML object tree, or a snapshot of QML object tree. + +*/ + +ShaderEffectSource::ShaderEffectSource(QDeclarativeItem *parent) + : QDeclarativeItem(parent) + , m_sourceItem(0) + , m_wrapMode(ClampToEdge) + , m_sourceRect(0, 0, 0, 0) + , m_textureSize(0, 0) + , m_format(RGBA) + , m_size(0, 0) + , m_fbo(0) + , m_multisampledFbo(0) + , m_refs(0) + , m_dirtyTexture(true) + , m_dirtySceneGraph(true) + , m_multisamplingSupported(false) + , m_checkedForMultisamplingSupport(false) + , m_live(true) + , m_hideSource(false) + , m_mirrored(false) +{ +} + +ShaderEffectSource::~ShaderEffectSource() +{ + if (m_refs && m_sourceItem) + detachSourceItem(); + + delete m_fbo; + delete m_multisampledFbo; +} + +/*! + \qmlproperty Item ShaderEffectSource::sourceItem + This property holds the Item which is used as the source for the shader effect. + If the item has children, those are included as well. + + \note When source item content is passed to the ShaderEffectItem(s), it is always clipped to the boundingrect of the + sourceItem regardless of its clipping property. +*/ + +/*! + \property ShaderEffectSource::sourceItem + \brief the Item which is the source for the effect. +*/ + +void ShaderEffectSource::setSourceItem(QDeclarativeItem *item) +{ + if (item == m_sourceItem) + return; + + if (m_sourceItem) { + disconnect(m_sourceItem, SIGNAL(widthChanged()), this, SLOT(markSourceSizeDirty())); + disconnect(m_sourceItem, SIGNAL(heightChanged()), this, SLOT(markSourceSizeDirty())); + + if (m_refs) + detachSourceItem(); + } + + m_sourceItem = item; + + if (m_sourceItem) { + + // Must have some item as parent + if (m_sourceItem->parentItem() == 0) + m_sourceItem->setParentItem(this); + + if (m_refs) + attachSourceItem(); + + connect(m_sourceItem, SIGNAL(widthChanged()), this, SLOT(markSourceSizeDirty())); + connect(m_sourceItem, SIGNAL(heightChanged()), this, SLOT(markSourceSizeDirty())); + } + + updateSizeAndTexture(); + emit sourceItemChanged(); + emit repaintRequired(); +} + +/*! + \qmlproperty QRectF ShaderEffectSource::sourceRect + This property can be used to specify margins for the source content. + + If other value than Qt.rect(0,0,0,0) is assigned to this property, it is interpreted as + specifying a relative source rectangle for the source content. + + For example, setting Qt.rect(-10.0, -10.0, 120.0, 120.0) for a source that has width and height + of 100 pixels would produce 10 pixels margins to each side of the source. + + Margins are useful when the original content is wanted to be spread outside the original source area, + like when creating a dropshadow with the shader or in other similar effects. + + The default value is Qt.rect(0,0,0,0). +*/ + +/*! + \property ShaderEffectSource::sourceRect + \brief the relative sourceRect for the source. +*/ + +void ShaderEffectSource::setSourceRect(const QRectF &rect) +{ + if (rect == m_sourceRect) + return; + m_sourceRect = rect; + updateSizeAndTexture(); + updateBackbuffer(); + emit sourceRectChanged(); + emit repaintRequired(); + + if (m_sourceItem) { + ShaderEffect* effect = qobject_cast (m_sourceItem->graphicsEffect()); + if (effect) + effect->m_changed = true; + } +} + +/*! + \qmlproperty QSize ShaderEffectSource::textureSize + This property holds the size for the texture containing the source content. + + If value QSize(0,0) is assigned to this property, texture is resized + according to the source size. Otherwise source content is scaled to + the given size. + + The default value is QSize(0,0). +*/ + +/*! + \property ShaderEffectSource::textureSize + \brief the texture size for the source. +*/ + +void ShaderEffectSource::setTextureSize(const QSize &size) +{ + if (size == m_textureSize) + return; + + m_textureSize = size; + updateSizeAndTexture(); + emit textureSizeChanged(); + emit repaintRequired(); + + if (m_sourceItem) { + ShaderEffect* effect = qobject_cast (m_sourceItem->graphicsEffect()); + if (effect) + effect->m_changed = true; + } +} + +/*! + \qmlproperty bool ShaderEffectSource::live + This property holds the optimization flag to define wheter the source item content is changing or + static. + + If value true is assigned to this property, source item content is re-rendered into a + texture for every frame. Setting the value to false improves the performance as it skips + rendering the source item (and its chidleren) and instead immediately passes the previously + rendered and cached texture to the shaders. + + The default value is true. +*/ + +/*! + \property ShaderEffectSource::live + \brief the flag tells wheter source item content is changing between frames. +*/ + +void ShaderEffectSource::setLive(bool s) +{ + if (s == m_live) + return; + + m_live = s; + + emit liveChanged(); + emit repaintRequired(); +} + +/*! + \qmlproperty bool ShaderEffectSource::hideSource + This property holds the flag to define wheter the original source item is + hidden when the effect item is drawn. + + The default value is false. +*/ + +/*! + \property ShaderEffectSource::hideSource + \brief the flag tells wheter original source item content should be hidden. +*/ + +void ShaderEffectSource::setHideSource(bool hide) +{ + if (hide == m_hideSource) + return; + + m_hideSource = hide; + + emit hideSourceChanged(); + emit repaintRequired(); +} + +/*! + \qmlproperty enumeration ShaderEffectSource::wrapMode + + This property defines the wrap parameter for the source after it has been mapped as a texture. + + \list + \o WrapMode.ClampToEdge - Causes texturecoordinates to be clamped to the range [ 1/2*N , 1 - 1/2*N ], where N is the texture width. + \o WrapMode.RepeatHorizontally - Causes the integer part of the horizontal texturecoordinate to be ignored; the GL uses only the fractional part, thereby creating a horizontal repeating pattern. + \o WrapMode.RepeatVertically - Causes the integer part of the vertical texturecoordinate to be ignored; the GL uses only the fractional part, thereby creating a vertical repeating pattern. + \o WrapMode.Repeat - Causes the integer part of both the horizontal and vertical texturecoordinates to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. + \endlist + + The default value is ClampToEdge. + +*/ + +/*! + \property ShaderEffectSource::wrapMode + \brief the wrap parameter for the source after it has been mapped as a texture. +*/ + +void ShaderEffectSource::setWrapMode(WrapMode mode) +{ + if (mode == m_wrapMode) + return; + + m_wrapMode = mode; + updateBackbuffer(); + emit wrapModeChanged(); +} + +/*! + \qmlmethod ShaderEffectSource::grab() + + Repaints the source item content into the texture. + + This method is useful when ShaderEffectSource::live has been set to false and + the changes in the source item content is desired to be made visible for the shaders. + +*/ + +void ShaderEffectSource::grab() +{ + m_dirtyTexture = true; + emit repaintRequired(); +} + +void ShaderEffectSource::bind() const +{ + GLint filtering = smooth() ? GL_LINEAR : GL_NEAREST; + GLuint hwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatHorizontally) ? GL_REPEAT : GL_CLAMP_TO_EDGE; + GLuint vwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatVertically) ? GL_REPEAT : GL_CLAMP_TO_EDGE; + +#if !defined(QT_OPENGL_ES_2) + glEnable(GL_TEXTURE_2D); +#endif + if (m_fbo) { + glBindTexture(GL_TEXTURE_2D, m_fbo->texture()); + } else { + glBindTexture(GL_TEXTURE_2D, 0); + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, smooth() ? GL_LINEAR : GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, hwrap); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, vwrap); +} + +void ShaderEffectSource::refFromEffectItem() +{ + if (m_refs++ == 0) { + attachSourceItem(); + emit activeChanged(); + } +} + +void ShaderEffectSource::derefFromEffectItem() +{ + if (--m_refs == 0) { + detachSourceItem(); + emit activeChanged(); + } + Q_ASSERT(m_refs >= 0); +} + +void ShaderEffectSource::updateBackbuffer() +{ + if (!m_sourceItem) + return; + + // Multisampling is not (for now) supported. + QSize size = QSize(m_sourceItem->width(), m_sourceItem->height()); + if (!m_textureSize.isEmpty()) + size = m_textureSize; + + if (size.height() > 0 && size.width() > 0) { + QGLFramebufferObjectFormat format; + format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); + format.setInternalTextureFormat(m_format); + + if (!m_fbo) { + m_fbo = new ShaderEffectBuffer(size, format); + } else { + if (m_fbo->size() != size || m_fbo->format().internalTextureFormat() != GLenum(m_format)) { + delete m_fbo; + m_fbo = 0; + m_fbo = new ShaderEffectBuffer(size, format); + } + } + } + + // Note that real update for the source content happens in shadereffect.cpp + m_dirtyTexture = false; +} + +void ShaderEffectSource::markSceneGraphDirty() +{ + m_dirtySceneGraph = true; + emit repaintRequired(); +} + +void ShaderEffectSource::markSourceSizeDirty() +{ + Q_ASSERT(m_sourceItem); + if (m_textureSize.isEmpty()) + updateSizeAndTexture(); + if (m_refs) + emit repaintRequired(); +} + +void ShaderEffectSource::updateSizeAndTexture() +{ + if (m_sourceItem) { + QSize size = m_textureSize; + if (size.isEmpty()) + size = QSize(m_sourceItem->width(), m_sourceItem->height()); + if (size.width() < 1) + size.setWidth(1); + if (size.height() < 1) + size.setHeight(1); + if (m_fbo && m_fbo->size() != size) { + delete m_fbo; + m_fbo = 0; + delete m_multisampledFbo; + m_fbo = m_multisampledFbo = 0; + } + if (m_size.width() != size.width()) { + m_size.setWidth(size.width()); + emit widthChanged(); + } + if (m_size.height() != size.height()) { + m_size.setHeight(size.height()); + emit heightChanged(); + } + m_dirtyTexture = true; + } else { + if (m_size.width() != 0) { + m_size.setWidth(0); + emit widthChanged(); + } + if (m_size.height() != 0) { + m_size.setHeight(0); + emit heightChanged(); + } + } +} + +void ShaderEffectSource::attachSourceItem() +{ + if (!m_sourceItem) + return; + + ShaderEffect *effect = qobject_cast (m_sourceItem->graphicsEffect()); + + if (!effect) { + effect = new ShaderEffect(); + m_sourceItem->setGraphicsEffect(effect); + } + + if (effect) + effect->addRenderTarget(this); + + m_sourceItem->update(); +} + +void ShaderEffectSource::detachSourceItem() +{ + if (!m_sourceItem) + return; + + ShaderEffect* effect = qobject_cast (m_sourceItem->graphicsEffect()); + + if (effect) + effect->removeRenderTarget(this); + + delete m_fbo; + m_fbo = 0; + + delete m_multisampledFbo; + m_multisampledFbo = 0; + + m_dirtyTexture = true; +} diff --git a/src/imports/shaders/shadereffectsource.h b/src/imports/shaders/shadereffectsource.h new file mode 100644 index 0000000..275e5b2 --- /dev/null +++ b/src/imports/shaders/shadereffectsource.h @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHADEREFFECTSOURCE_H +#define SHADEREFFECTSOURCE_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class ShaderEffectBuffer; + +class ShaderEffectSource : public QDeclarativeItem +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeItem *sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged) + Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged) + Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged) + Q_PROPERTY(bool live READ isLive WRITE setLive NOTIFY liveChanged) + Q_PROPERTY(bool hideSource READ hideSource WRITE setHideSource NOTIFY hideSourceChanged) + Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) + Q_ENUMS(WrapMode) + Q_ENUMS(Format) + +public: + enum WrapMode { + ClampToEdge, + RepeatHorizontally, + RepeatVertically, + Repeat + }; + + enum Format { + Alpha = GL_ALPHA, + RGB = GL_RGB, + RGBA = GL_RGBA + }; + + ShaderEffectSource(QDeclarativeItem *parent = 0); + virtual ~ShaderEffectSource(); + + QDeclarativeItem *sourceItem() const { return m_sourceItem.data(); } + void setSourceItem(QDeclarativeItem *item); + + QRectF sourceRect() const { return m_sourceRect; }; + void setSourceRect(const QRectF &rect); + + QSize textureSize() const { return m_textureSize; } + void setTextureSize(const QSize &size); + + bool isLive() const { return m_live; } + void setLive(bool s); + + bool hideSource() const { return m_hideSource; } + void setHideSource(bool hide); + + WrapMode wrapMode() const { return m_wrapMode; }; + void setWrapMode(WrapMode mode); + + bool isActive() const { return m_refs; } + void bind() const; + void refFromEffectItem(); + void derefFromEffectItem(); + void updateBackbuffer(); + + ShaderEffectBuffer* fbo() { return m_fbo; } + bool isDirtyTexture() { return m_dirtyTexture; } + bool isMirrored() { return m_mirrored; } + + Q_INVOKABLE void grab(); + +Q_SIGNALS: + void sourceItemChanged(); + void sourceRectChanged(); + void textureSizeChanged(); + void formatChanged(); + void liveChanged(); + void hideSourceChanged(); + void activeChanged(); + void repaintRequired(); + void wrapModeChanged(); + +public Q_SLOTS: + void markSceneGraphDirty(); + void markSourceSizeDirty(); + +private: + void updateSizeAndTexture(); + void attachSourceItem(); + void detachSourceItem(); + +private: + QPointer m_sourceItem; + WrapMode m_wrapMode; + QRectF m_sourceRect; + QSize m_textureSize; + Format m_format; + QSize m_size; + + ShaderEffectBuffer *m_fbo; + ShaderEffectBuffer *m_multisampledFbo; + int m_refs; + bool m_dirtyTexture : 1; + bool m_dirtySceneGraph : 1; + bool m_multisamplingSupported : 1; + bool m_checkedForMultisamplingSupport : 1; + bool m_live : 1; + bool m_hideSource : 1; + bool m_mirrored : 1; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + + +#endif // SHADEREFFECTSOURCE_H diff --git a/src/imports/shaders/shaders.pro b/src/imports/shaders/shaders.pro new file mode 100644 index 0000000..d7a6275 --- /dev/null +++ b/src/imports/shaders/shaders.pro @@ -0,0 +1,38 @@ +TARGET = qmlshadersplugin +TARGETPATH = Qt/labs/shaders +include(../qimportbase.pri) + +QT += declarative opengl + +SOURCES += \ + qmlshadersplugin_plugin.cpp \ + shadereffect.cpp \ + shadereffectitem.cpp \ + shadereffectsource.cpp \ + scenegraph/qsggeometry.cpp \ + shadereffectbuffer.cpp + +HEADERS += \ + qmlshadersplugin_plugin.h \ + glfunctions.h \ + shadereffect.h \ + shadereffectitem.h \ + shadereffectsource.h \ + scenegraph/qsggeometry.h \ + shadereffectbuffer.h + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH +target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH + +qmldir.files += $$PWD/qmldir +qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH + +symbian:{ + TARGET.UID3 = 0x20034907 + isEmpty(DESTDIR):importFiles.sources = qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.sources = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir + importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH + DEPLOYMENT = importFiles +} + +INSTALLS += target qmldir diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 1f0d32a..1bcc26f 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -79,5 +79,7 @@ contains(QT_CONFIG, webkit) { qdeclarativewebview } +contains(QT_CONFIG, opengl): SUBDIRS += qmlshadersplugin + # Tests which should run in Pulse PULSE_TESTS = $$SUBDIRS diff --git a/tests/auto/declarative/qmlshadersplugin/main.qml b/tests/auto/declarative/qmlshadersplugin/main.qml new file mode 100644 index 0000000..fc80b39 --- /dev/null +++ b/tests/auto/declarative/qmlshadersplugin/main.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.shaders 1.0 + + Rectangle { + width: 300 + height: 300 + + Text { + id: textLabel + text: "Hello World" + anchors.centerIn: parent + font.pixelSize: 48 + } + + ShaderEffectItem { + objectName: "effectItem" + property variant source: ShaderEffectSource { objectName: "effectSource"; sourceItem: textLabel; hideSource: true } + property real wiggleAmount: 0.01 + anchors.fill: textLabel + + SequentialAnimation on wiggleAmount { + loops: Animation.Infinite + NumberAnimation { to: -0.01; duration: 500 } + NumberAnimation { to: 0.01; duration: 500 } + } + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + uniform highp float wiggleAmount; + void main(void) + { + highp vec2 wiggledTexCoord = qt_TexCoord0; + wiggledTexCoord.s += sin(4.0 * 3.141592653589 * wiggledTexCoord.t) * wiggleAmount; + gl_FragColor = texture2D(source, wiggledTexCoord.st); + } + " + } + } diff --git a/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro new file mode 100644 index 0000000..6225a8f --- /dev/null +++ b/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro @@ -0,0 +1,18 @@ +load(qttest_p4) + +QT += opengl declarative +SOURCES += tst_qmlshadersplugin.cpp + +SOURCES += \ + ../../../../src/imports/shaders/src/shadereffectitem.cpp \ + ../../../../src/imports/shaders/src/shadereffectsource.cpp \ + ../../../../src/imports/shaders/src/shadereffect.cpp \ + ../../../../src/imports/shaders/src/shadereffectbuffer.cpp \ + ../../../../src/imports/shaders/src/scenegraph/qsggeometry.cpp + +HEADERS += \ + ../../../../src/imports/shaders/src/shadereffectitem.h \ + ../../../../src/imports/shaders/src/shadereffectsource.h \ + ../../../../src/imports/shaders/src/shadereffect.h \ + ../../../../src/imports/shaders/src/shadereffectbuffer.h \ + ../../../../src/imports/shaders/src/scenegraph/qsggeometry.h diff --git a/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp b/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp new file mode 100644 index 0000000..61fe2ee --- /dev/null +++ b/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "../../../../src/imports/shaders/src/shadereffectitem.h" +#include "../../../../src/imports/shaders/src/shadereffectsource.h" +#include "../../../../src/imports/shaders/src/shadereffect.h" + +static const char qt_default_vertex_code[] = + "uniform highp mat4 qt_ModelViewProjectionMatrix;\n" + "attribute highp vec4 qt_Vertex;\n" + "attribute highp vec2 qt_MultiTexCoord0;\n" + "varying highp vec2 qt_TexCoord0;\n" + "void main(void)\n" + "{\n" + "qt_TexCoord0 = qt_MultiTexCoord0;\n" + "gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;\n" + "}\n"; + +static const char qt_default_fragment_code[] = + "varying highp vec2 qt_TexCoord0;\n" + "uniform lowp sampler2D source;\n" + "void main(void)\n" + "{\n" + "gl_FragColor = texture2D(source, qt_TexCoord0.st);\n" + "}\n"; + +class tst_qmlshadersplugin : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void shaderEffectItemAPI(); + void shaderEffectSourceAPI(); + void combined(); + +private: + QDeclarativeEngine engine; +}; + +void tst_qmlshadersplugin::initTestCase() +{ + const char *uri ="Qt.labs.shaders"; + qmlRegisterType(uri, 1, 0, "ShaderEffectItem"); + qmlRegisterType(uri, 1, 0, "ShaderEffectSource"); +} + + +void tst_qmlshadersplugin::shaderEffectItemAPI() +{ + // Creation + QString componentStr = "import QtQuick 1.0\n" + "import Qt.labs.shaders 1.0\n" + "ShaderEffectItem {\n" + "property variant source\n" + "width: 200; height: 300\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("width").toDouble(), 200.); + QCOMPARE(obj->property("height").toDouble(), 300.); + QCOMPARE(obj->property("fragmentShader").toString(), QString("")); + QCOMPARE(obj->property("vertexShader").toString(), QString("")); + QCOMPARE(obj->property("blending").toBool(), true); + QCOMPARE(obj->property("meshResolution").toSize(), QSize(1, 1)); + QCOMPARE(obj->property("visible").toBool(), true); + + // Seting the values + QVERIFY(obj->setProperty("fragmentShader", QString(qt_default_fragment_code))); + QVERIFY(obj->setProperty("vertexShader", QString(qt_default_vertex_code))); + QVERIFY(obj->setProperty("blending", false)); + QVERIFY(obj->setProperty("meshResolution", QSize(20, 10))); + QVERIFY(obj->setProperty("visible", false)); + + QCOMPARE(obj->property("fragmentShader").toString(), QString(qt_default_fragment_code)); + QCOMPARE(obj->property("vertexShader").toString(), QString(qt_default_vertex_code)); + QCOMPARE(obj->property("blending").toBool(), false); + QCOMPARE(obj->property("meshResolution").toSize(), QSize(20, 10)); + QCOMPARE(obj->property("visible").toBool(), false); + + delete obj; +} + +void tst_qmlshadersplugin::shaderEffectSourceAPI() +{ + // Creation + QString componentStr = "import QtQuick 1.0\n" + "import Qt.labs.shaders 1.0\n" + "ShaderEffectSource {}"; + QDeclarativeComponent shaderEffectSourceComponent(&engine); + shaderEffectSourceComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + + QObject *obj = shaderEffectSourceComponent.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("sourceRect").toRect(), QRect(0, 0, 0, 0)); + QCOMPARE(obj->property("textureSize").toSize(), QSize(0, 0)); + QCOMPARE(obj->property("live").toBool(), true); + QCOMPARE(obj->property("hideSource").toBool(), false); + QCOMPARE(obj->property("wrapMode").toUInt(), static_cast(ShaderEffectSource::ClampToEdge)); + + // Seting the values + componentStr = "import QtQuick 1.0\n" + "Item {}"; + QDeclarativeComponent itemComponent(&engine); + itemComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast (itemComponent.create()); + QVERIFY(item != 0); + + QVERIFY(obj->setProperty("sourceItem", QVariant::fromValue(item))); + QVERIFY(obj->setProperty("sourceRect", QRect(10, 20, 30, 40))); + QVERIFY(obj->setProperty("textureSize", QSize(50, 100))); + QVERIFY(obj->setProperty("live", false)); + QVERIFY(obj->setProperty("hideSource", true)); + QVERIFY(obj->setProperty("wrapMode", static_cast(ShaderEffectSource::Repeat))); + + QCOMPARE(obj->property("sourceItem"), QVariant::fromValue(item)); + QCOMPARE(obj->property("sourceRect").toRect(), QRect(10, 20, 30, 40)); + QCOMPARE(obj->property("textureSize").toSize(), QSize(50, 100)); + QCOMPARE(obj->property("live").toBool(), false); + QCOMPARE(obj->property("hideSource").toBool(), true); + QCOMPARE(obj->property("wrapMode").toUInt(), static_cast(ShaderEffectSource::Repeat)); + + delete item; + delete obj; +} + +void tst_qmlshadersplugin::combined() +{ + QGLFormat format = QGLFormat::defaultFormat(); + format.setSampleBuffers(false); + format.setSwapInterval(1); + + QGLWidget* glWidget = new QGLWidget(format); + glWidget->setAutoFillBackground(false); + + QDeclarativeView view; + view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + view.setAttribute(Qt::WA_OpaquePaintEvent); + view.setAttribute(Qt::WA_NoSystemBackground); + view.setViewport(glWidget); + view.setSource(QUrl::fromLocalFile("main.qml")); + view.show(); + QTest::qWait(1000); + + QObject *item = view.rootObject()->findChild("effectItem"); + QVERIFY(item != 0); + + QObject *src = view.rootObject()->findChild("effectSource"); + QVERIFY(src != 0); + + QCOMPARE(item->property("source"), QVariant::fromValue(src)); +} + +QTEST_MAIN(tst_qmlshadersplugin) + +#include "tst_qmlshadersplugin.moc" diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro index 5dd31f3..51bbfae 100644 --- a/tests/benchmarks/declarative/declarative.pro +++ b/tests/benchmarks/declarative/declarative.pro @@ -10,6 +10,6 @@ SUBDIRS += \ script \ qmltime -contains(QT_CONFIG, opengl): SUBDIRS += painting +contains(QT_CONFIG, opengl): SUBDIRS += painting qmlshadersplugin diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml new file mode 100644 index 0000000..4424b0b --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml @@ -0,0 +1,43 @@ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + id: gaussianBlur + property variant source: 0 + property real radius: 8; + property real deviation: Math.sqrt(-((radius+1) * (radius+1)) / (2 * Math.log(1.0 / 255.0))) + property bool live: true + + ShaderEffectItem { + id: cache + anchors.fill: parent + visible: !gaussianBlur.live + property variant source: ShaderEffectSource { sourceItem: verticalBlur; live: false; hideSource: true } + } + + GaussianDirectionalBlur { + id: verticalBlur + anchors.fill: parent + + deltaX: 0.0 + deltaY: 1.0/parent.height + + source: ShaderEffectSource { sourceItem: horizontalBlur; hideSource: true } + deviation: gaussianBlur.deviation + radius: gaussianBlur.radius + } + + GaussianDirectionalBlur { + id: horizontalBlur + anchors.fill: parent + blending: false + + deltaX: 1.0/parent.width + deltaY: 0.0 + + source: gaussianBlur.source + deviation: gaussianBlur.deviation + radius: gaussianBlur.radius + } + +} diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml new file mode 100644 index 0000000..33f576b --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml @@ -0,0 +1,168 @@ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +// Note 1. This shader implements gaussian blur without dynamic array access from inside shader loops (Optional feature in OpenGLES 2.0). +// Note 2. Shader code is generated to avoid ecessive if-else structure in fragment shader. Code re-generation (very slow!) happens if blur radius is changed. + +ShaderEffectItem { + id: effect + property variant source: 0 + property real deviation: Math.sqrt(-((radius+1) * (radius+1)) / (2 * Math.log(1.0 / 255.0))); + property real radius: 8; + property real deltaX: 0.0 + property real deltaY: 0.0 + + property real gaussianSum: 0.0 + property real startIndex: 0.0 + property real samples: radius * 2 + + property variant gwts: [] + property variant delta: Qt.vector3d(effect.deltaX, effect.deltaY, effect.startIndex); + property variant factor_0_2: Qt.vector3d(effect.gwts[0], effect.gwts[1], effect.gwts[2]); + property variant factor_3_5: Qt.vector3d(effect.gwts[3],effect.gwts[4],effect.gwts[5]); + property variant factor_6_8: Qt.vector3d(effect.gwts[6],effect.gwts[7],effect.gwts[8]); + property variant factor_9_11: Qt.vector3d(effect.gwts[9],effect.gwts[10],effect.gwts[11]); + property variant factor_12_14: Qt.vector3d(effect.gwts[12],effect.gwts[13],effect.gwts[14]); + property variant factor_15_17: Qt.vector3d(effect.gwts[15],effect.gwts[16],effect.gwts[17]); + property variant factor_18_20: Qt.vector3d(effect.gwts[18],effect.gwts[19],effect.gwts[20]); + property variant factor_21_23: Qt.vector3d(effect.gwts[21],effect.gwts[22],effect.gwts[23]); + property variant factor_24_26: Qt.vector3d(effect.gwts[24],effect.gwts[25],effect.gwts[26]); + property variant factor_27_29: Qt.vector3d(effect.gwts[27],effect.gwts[28],effect.gwts[29]); + property variant factor_30_32: Qt.vector3d(effect.gwts[30],effect.gwts[31],effect.gwts[32]); + + //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2))); + function gausFunc(x){ + return (1/Math.sqrt(2*3.1415926*(Math.pow(effect.deviation,2)))) * Math.pow(2.7182818,-((Math.pow(x,2))/(2*(Math.pow(effect.deviation,2))))); + } + + function calcGWTS() { + var n = new Array(Math.floor(effect.samples)); + var step + for (var i = 0; i < effect.samples; i++) { + step = -effect.samples/2 + i + 0.5 + n[i] = gausFunc(step); + } + return n; + } + + function buildFragmentShader() { + + var shaderSteps = [ + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;" + ] + + var shader = fragmentShader_begin + var samples = effect.samples + if (samples > 32) { + console.log("GaussianBlur: Maximum of 32 blur samples exceeded!") + samples = 32 + } + + for (var i = 0; i < samples; i++) { + shader += shaderSteps[i] + } + + shader += fragmentShader_end + effect.fragmentShader = shader + + } + + onDeviationChanged:{ + effect.startIndex = -effect.samples/2 + 0.5 + effect.gwts = calcGWTS(); + var sum = 0.0; + for (var j = 0; j < effect.samples; j++) { + sum += effect.gwts[j]; + } + effect.gaussianSum = sum + } + + Component.onCompleted:{ + effect.startIndex = -effect.samples/2 + 0.5 + effect.gwts = calcGWTS(); + var sum = 0.0; + for (var j = 0; j < effect.samples; j++) { + sum += effect.gwts[j]; + } + effect.gaussianSum = sum + buildFragmentShader() + } + + onSamplesChanged: { + buildFragmentShader() + } + + property string fragmentShader_begin: + " + varying mediump vec2 qt_TexCoord0; + uniform sampler2D source; + uniform highp vec3 delta; + uniform highp vec3 factor_0_2; + uniform highp vec3 factor_3_5; + uniform highp vec3 factor_6_8; + uniform highp vec3 factor_9_11; + uniform highp vec3 factor_12_14; + uniform highp vec3 factor_15_17; + uniform highp vec3 factor_18_20; + uniform highp vec3 factor_21_23; + uniform highp vec3 factor_24_26; + uniform highp vec3 factor_27_29; + uniform highp vec3 factor_30_32; + uniform highp float gaussianSum; + + void main() { + highp vec2 shift = vec2(delta.x, delta.y); + highp float index = delta.z; + mediump vec2 texCoord = qt_TexCoord0 + (shift * index); + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + " + + property string fragmentShader_end: + " + if (gaussianSum > 0.0) + gl_FragColor /= gaussianSum; + } + " +} diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml new file mode 100644 index 0000000..be78c86 --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml @@ -0,0 +1,41 @@ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + id: gaussianDropShadow + + property color shadowColor: Qt.rgba(0.5, 0.5, 0.5, 1.0) + property variant source: 0 + property real radius: 8 + property real deviation: Math.sqrt(-((radius+1) * (radius+1)) / (2 * Math.log(1.0 / 255.0))) + property bool live: true + + GaussianBlur { + id: blur + anchors.fill: parent + radius: gaussianDropShadow.radius + deviation: gaussianDropShadow.deviation + source: gaussianDropShadow.source + live: gaussianDropShadow.live + } + + ShaderEffectItem { + id: shadow + property color shadowColor: gaussianDropShadow.shadowColor + property variant source: ShaderEffectSource { sourceItem: blur; hideSource: true } + anchors.fill: parent + + fragmentShader: + " + varying mediump vec2 qt_TexCoord0; + uniform sampler2D source; + uniform lowp vec4 shadowColor; + + void main() { + lowp vec4 sourceColor = texture2D(source, qt_TexCoord0); + gl_FragColor = mix(vec4(0), shadowColor, sourceColor.a); + } + " + } +} + diff --git a/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml b/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml new file mode 100755 index 0000000..5843d55 --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml @@ -0,0 +1,66 @@ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + id: main + width: 360 + height: 640 + + property bool liveShadows: true + property real r: 0 + + NumberAnimation on r { + loops: Animation.Infinite + from: 0 + to: 360 + duration: 3000 + } + + Image { + id: background + width: main.width + height: main.height + fillMode: Image.Tile + source: "bg.jpg" + } + + GaussianDropShadow { + x: image1.x + 50 + y: image1.y + 50 + width: image1.width + height: image1.height + shadowColor: "#88000000" + source: ShaderEffectSource { sourceItem: image1; hideSource: false; sourceRect: Qt.rect(-10, -10, image1.width + 20, image1.height + 20) } + radius: 12.0 + deviation: 12 + rotation: r + } + + Image { + id: image1 + anchors.fill: parent + source: "drop_shadow_small.png" + smooth: true + rotation: r + } + + GaussianDropShadow { + x: image2.x + 50 + y: image2.y + 50 + width: image2.width + height: image2.height + shadowColor: "#88000000" + source: ShaderEffectSource { sourceItem: image2; hideSource: false; sourceRect: Qt.rect(-10, -10, image2.width + 20, image2.height + 20) } + radius: 12.0 + deviation: 12 + rotation: -r + } + + Image { + id: image2 + anchors.fill: parent + source: "drop_shadow_small.png" + smooth: true + rotation: -r + } +} diff --git a/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml b/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml new file mode 100755 index 0000000..4d90950 --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml @@ -0,0 +1,20 @@ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + width: 360 + height: 640 + + Image { + id: image + width: parent.width + height: parent.height * 0.65 + source: "sky.jpg" + smooth: true + } + Water { + sourceItem: image + intensity: 5 + height: parent.height - image.height + } +} diff --git a/tests/benchmarks/declarative/qmlshadersplugin/Water.qml b/tests/benchmarks/declarative/qmlshadersplugin/Water.qml new file mode 100644 index 0000000..02486dd --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/Water.qml @@ -0,0 +1,85 @@ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + id: root + property alias sourceItem: effectsource.sourceItem + property real intensity: 1 + property bool waving: true + anchors.top: sourceItem.bottom + width: sourceItem.width + height: sourceItem.height + + ShaderEffectItem { + anchors.fill: parent + property variant source: effectsource + property real f: 0 + property real f2: 0 + property alias intensity: root.intensity + smooth: true + + ShaderEffectSource { + id: effectsource + hideSource: false + smooth: true + } + + fragmentShader: + " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + uniform lowp float qt_Opacity; + uniform highp float f; + uniform highp float f2; + uniform highp float intensity; + + void main() { + const highp float twopi = 3.141592653589 * 2.0; + + highp float distanceFactorToPhase = pow(qt_TexCoord0.y + 0.5, 8.0) * 5.0; + highp float ofx = sin(f * twopi + distanceFactorToPhase) / 100.0; + highp float ofy = sin(f2 * twopi + distanceFactorToPhase * qt_TexCoord0.x) / 60.0; + + highp float intensityDampingFactor = (qt_TexCoord0.x + 0.1) * (qt_TexCoord0.y + 0.2); + highp float distanceFactor = (1.0 - qt_TexCoord0.y) * 4.0 * intensity * intensityDampingFactor; + + ofx *= distanceFactor; + ofy *= distanceFactor; + + highp float x = qt_TexCoord0.x + ofx; + highp float y = 1.0 - qt_TexCoord0.y + ofy; + + highp float fake = (sin((ofy + ofx) * twopi) + 0.5) * 0.05 * (1.2 - qt_TexCoord0.y) * intensity * intensityDampingFactor; + + highp vec4 pix = + texture2D(source, vec2(x, y)) * 0.6 + + texture2D(source, vec2(x-fake, y)) * 0.15 + + texture2D(source, vec2(x, y-fake)) * 0.15 + + texture2D(source, vec2(x+fake, y)) * 0.15 + + texture2D(source, vec2(x, y+fake)) * 0.15; + + highp float darken = 0.6 - (ofx - ofy) / 2.0; + pix.b *= 1.2 * darken; + pix.r *= 0.9 * darken; + pix.g *= darken; + + gl_FragColor = qt_Opacity * vec4(pix.r, pix.g, pix.b, 1.0); + } + " + + NumberAnimation on f { + running: root.waving + loops: Animation.Infinite + from: 0 + to: 1 + duration: 2410 + } + NumberAnimation on f2 { + running: root.waving + loops: Animation.Infinite + from: 0 + to: 1 + duration: 1754 + } + } +} diff --git a/tests/benchmarks/declarative/qmlshadersplugin/bg.jpg b/tests/benchmarks/declarative/qmlshadersplugin/bg.jpg new file mode 100644 index 0000000..4d22143 Binary files /dev/null and b/tests/benchmarks/declarative/qmlshadersplugin/bg.jpg differ diff --git a/tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png b/tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png new file mode 100755 index 0000000..4a9b283 Binary files /dev/null and b/tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png differ diff --git a/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro new file mode 100644 index 0000000..9fb8852 --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro @@ -0,0 +1,23 @@ +QT += opengl declarative testlib + +TARGET = tst_performance + +SOURCES += \ + tst_performance.cpp \ + ../../../../src/imports/shaders/src/shadereffectitem.cpp \ + ../../../../src/imports/shaders/src/shadereffectsource.cpp \ + ../../../../src/imports/shaders/src/shadereffect.cpp \ + ../../../../src/imports/shaders/src/shadereffectbuffer.cpp \ + ../../../../src/imports/shaders/src/scenegraph/qsggeometry.cpp + +HEADERS += \ + ../../../../src/imports/shaders/src/shadereffectitem.h \ + ../../../../src/imports/shaders/src/shadereffectsource.h \ + ../../../../src/imports/shaders/src/shadereffect.h \ + ../../../../src/imports/shaders/src/shadereffectbuffer.h \ + ../../../../src/imports/shaders/src/scenegraph/qsggeometry.h + +OTHER_FILES += \ + *.qml \ + *.png \ + *.jpg diff --git a/tests/benchmarks/declarative/qmlshadersplugin/sky.jpg b/tests/benchmarks/declarative/qmlshadersplugin/sky.jpg new file mode 100644 index 0000000..8fc19ed Binary files /dev/null and b/tests/benchmarks/declarative/qmlshadersplugin/sky.jpg differ diff --git a/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp b/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp new file mode 100644 index 0000000..6ee6979 --- /dev/null +++ b/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "../../../../src/imports/shaders/src/shadereffectitem.h" +#include "../../../../src/imports/shaders/src/shadereffectsource.h" +//#include "../../../src/shadereffect.h" + +class BenchmarkItem : public QDeclarativeItem +{ + Q_OBJECT + +public: + BenchmarkItem( QDeclarativeItem * parent = 0 ) : QDeclarativeItem(parent) + , m_frameCount(0) + { + setFlag(QGraphicsItem::ItemHasNoContents, false); + } + + void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + QDeclarativeItem::paint(painter, option, widget); + if (timer.restart() > 7) m_frameCount++; + } + + int frameCount() { return m_frameCount; } + +private: + int m_frameCount; + QTime timer; +}; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + view.setAttribute(Qt::WA_OpaquePaintEvent); + view.setAttribute(Qt::WA_NoSystemBackground); + view.setResizeMode(QDeclarativeView::SizeViewToRootObject); + + qmlRegisterType("Qt.labs.shaders", 1, 0, "ShaderEffectItem"); + qmlRegisterType("Qt.labs.shaders", 1, 0, "ShaderEffectSource"); + + QGLFormat format = QGLFormat::defaultFormat(); + format.setSampleBuffers(false); + format.setSwapInterval(1); + + QGLWidget* glWidget = new QGLWidget(format); + glWidget->setAutoFillBackground(false); + view.setViewport(glWidget); + view.show(); + + view.setSource(QUrl::fromLocalFile("TestWater.qml")); + BenchmarkItem *benchmarkItem; + + qDebug() << "Sea Water benchmark:"; + benchmarkItem = new BenchmarkItem(dynamic_cast(view.rootObject())); + QTest::qWait(5000); + qDebug() << "Rendered " << benchmarkItem->frameCount() << " frames in 5 seconds"; + qDebug() << "Average " << benchmarkItem->frameCount() / 5.0 << " frames per second"; + + qDebug() << "Gaussian drop shadow benchmark:"; + view.setSource(QUrl::fromLocalFile("TestGaussianDropShadow.qml")); + benchmarkItem = new BenchmarkItem(dynamic_cast(view.rootObject())); + QTest::qWait(5000); + qDebug() << "Rendered " << benchmarkItem->frameCount() << " frames in 5 seconds"; + qDebug() << "Average " << benchmarkItem->frameCount() / 5.0 << " frames per second"; +} + +#include "tst_performance.moc" diff --git a/tests/manual/declarative/declarative.pro b/tests/manual/declarative/declarative.pro new file mode 100644 index 0000000..337db2f --- /dev/null +++ b/tests/manual/declarative/declarative.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +contains(QT_CONFIG, opengl): SUBDIRS += qmlshadersplugin + diff --git a/tests/manual/declarative/qmlshadersplugin/main.cpp b/tests/manual/declarative/qmlshadersplugin/main.cpp new file mode 100644 index 0000000..3f40e92 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/main.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QGLFormat format = QGLFormat::defaultFormat(); + format.setSampleBuffers(false); + format.setSwapInterval(1); + + QGLWidget* glWidget = new QGLWidget(format); + glWidget->setAutoFillBackground(false); + + QmlApplicationViewer viewer; + viewer.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + viewer.setViewport(glWidget); + viewer.setAttribute(Qt::WA_OpaquePaintEvent); + viewer.setAttribute(Qt::WA_NoSystemBackground); + viewer.setOrientation(QmlApplicationViewer::Auto); + viewer.setMainQmlFile(QLatin1String("qml/qmlshadersplugintest/main.qml")); + viewer.show(); + + return app.exec(); +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml new file mode 100644 index 0000000..8aaee0d --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "red" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + //effect.active = !effect.active + effect.visible = !effect.visible + } + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + fragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + } + " + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: effect.visible ? "Effect active (display should be green)" : "Effect not active (display should be red)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml new file mode 100644 index 0000000..c7ec908 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + anchors.fill: parent; + + ShaderEffectItem { + anchors.fill: parent; + fragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); + } + " + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml new file mode 100644 index 0000000..d7ce837 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "green" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + effect.blending = !effect.blending + } + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + fragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0); + } + " + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: effect.blending ? "Effect blending (display should be orange)" : "Effect not blending (display should be red)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml new file mode 100644 index 0000000..bd60c68 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml @@ -0,0 +1,267 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Item { + id: blendModeTest + property real blendItemHeight: 60 + + anchors.fill: parent; + + Rectangle { + width: parent.width / 6 + height: parent.height + color: "black" + } + Rectangle { + x: parent.width/6 * 1 + width: parent.width / 6 + height: parent.height + color: "white" + } + Rectangle { + x: parent.width/6 * 2 + width: parent.width / 6 + height: parent.height + color: "gray" + } + Rectangle { + x: parent.width/6 * 3 + width: parent.width / 6 + height: parent.height + color: "red" + } + Rectangle { + x: parent.width/6 * 4 + width: parent.width / 6 + height: parent.height + color: "green" + } + Rectangle { + x: parent.width/6 * 5 + width: parent.width / 6 + height: parent.height + color: "blue" + } + + + Image { + anchors.fill: parent; + source: "image.png" + + } + + Rectangle { + id: first + anchors.top: parent.top + anchors.topMargin: 60 + width: parent.width + height: blendModeTest.blendItemHeight + color: "#8000ff00" + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " Rectangle color #8000ff00" + color: "white" + } + } + Rectangle { + id: second + anchors.top: first.bottom + anchors.topMargin: 5 + width: parent.width + height: blendModeTest.blendItemHeight + color: "#ff00ff00" + opacity: 0.5 + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " Rectangle color #ff00ff00, opacity 0.5" + color: "white" + } + } + + ShaderEffectItem { + id: effect + anchors.top: second.bottom + anchors.topMargin: 5 + width: parent.width + height: blendModeTest.blendItemHeight + fragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0.0, 1.0, 0.0, 0.5); + } + " + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " ShaderEffectItem gl_FragColor=vec4(0.0, 1.0, 0.0, 0.5)" + color: "white" + } + } + + ShaderEffectItem { + id: effect2 + anchors.top: effect.bottom + anchors.topMargin: 5 + width: parent.width + height: blendModeTest.blendItemHeight + fragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0.0, 0.5, 0.0, 0.5); + } + " + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " ShaderEffectItem gl_FragColor=vec4(0.0, 0.5, 0.0, 0.5)" + color: "white" + } + } + + + Image { + id: image1 + source: "green_image_transparent.png" + anchors.top: effect2.bottom + anchors.topMargin: 5 + width: parent.width + height: blendModeTest.blendItemHeight + } + Text { + anchors.bottom: image1.bottom + anchors.bottomMargin: 5 + text: " Image, green and 50% alpha" + color: "white" + } + + + ShaderEffectItem { + id: effect3 + property variant source: ShaderEffectSource { + sourceItem: image1 + hideSource: false + } + anchors.top: image1.bottom + anchors.topMargin: 5 + + width: parent.width + height: blendModeTest.blendItemHeight + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " ShaderEffectItem, source item green 50% alpha." + color: "white" + } + } + + ShaderEffectItem { + id: effect4 + property variant source: ShaderEffectSource { + sourceItem: Image { source: "green_image_transparent.png" } + hideSource: true + } + anchors.top: effect3.bottom + anchors.topMargin: 5 + width: parent.width + height: blendModeTest.blendItemHeight + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " ShaderEffectItem, source image green 50% alpha." + color: "white" + } + } + + + Rectangle { + id: greenRect2 + anchors.top: effect4.bottom + anchors.topMargin: 5 + width: parent.width + height: blendModeTest.blendItemHeight + opacity: 0.5 + color: "green" + } + + + ShaderEffectItem { + id: effect5 + property variant source: ShaderEffectSource { sourceItem: greenRect2; hideSource: true } + anchors.top: effect4.bottom + anchors.topMargin: 5 + + width: parent.width + height: blendModeTest.blendItemHeight + Text { + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + text: " ShaderEffectItem, source item green rect with 0.5 opacity." + color: "white" + } + } + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + } + } + + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: "Blending test" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml new file mode 100644 index 0000000..e3a4c80 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + id :root + anchors.fill: parent; + color: "green" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + effect1.visible = !effect1.visible + effect2.visible = !effect2.visible + //effect3.visible = !effect3.visible + } + } + + Rectangle { + id: a + x: 90 + y: 90 + color: "red" + width: 220 + height: 220 + Rectangle { + id: b + x: 10 + y: 10 + color: "blue" + width: 100 + height: 100 + rotation: 5 + Rectangle { + id: c + x: 10 + y: 10 + color: "black" + width: 80 + height: 80 + } + } + Rectangle { + id: d + x: 10 + y: 110 + color: "yellow" + width: 100 + height: 100 + } + } + + ShaderEffectItem { + id: effect1 + anchors.fill: a + property variant source: ShaderEffectSource{ sourceItem: a; hideSource: true } + } + + ShaderEffectItem { + id: effect2 + x: 100 + y: 100 + width: 100 + height: 100 + rotation: 5 + property variant source: ShaderEffectSource{ sourceItem: b; hideSource: true } + } + +// ShaderEffectItem { +// id: effect3 +// x: 110 +// y: 210 +// width: 80 +// height: 80 +// property variant source: ShaderEffectSource{ sourceItem: c; hideSource: true } +// } + + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: effect1.visible ? "Effects active" : "Effects NOT active" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml new file mode 100644 index 0000000..ab84557 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "green" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + + } + } + + Rectangle { + id: theSource + color: "red" + anchors.centerIn: parent; + width: parent.width/2 + height: parent.height/2 + } + + ShaderEffectItem { + id: effect1 + anchors.fill: theSource; + property variant source: ShaderEffectSource{ sourceItem: theSource; hideSource: true } + } + + ShaderEffectItem { + id: effect2 + anchors.fill: effect1; + property variant source: effect1 + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + void main(void) + { + gl_FragColor = vec4(texture2D(source, qt_TexCoord0.st).rgb, 1.0); + } + " + } + + ShaderEffectItem { + id: effect3 + x: effect2.x + y: effect2.y + width: effect2.width + height: effect2.height + + property variant source: ShaderEffectSource { sourceItem: effect2 ; hideSource: false } + + fragmentShader: + " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + void main(void) + { + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } + " + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: "Red rect inside green fullscreen rect." + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml new file mode 100644 index 0000000..9b1c697 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "gray" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (theSource.format == ShaderEffectSource.Alpha) + theSource.format = ShaderEffectSource.RGB + else if (theSource.format == ShaderEffectSource.RGB) + theSource.format = ShaderEffectSource.RGBA + else if (theSource.format == ShaderEffectSource.RGBA) + theSource.format = ShaderEffectSource.Alpha + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.centerIn: parent + width: parent.width + height: parent.height + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + Text { + id: label + anchors.centerIn: parent + text: "Source format test: " + theSource.format + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml new file mode 100644 index 0000000..0a7f261 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + effect.fragmentShader == effect.redFragmentShader ? effect.fragmentShader = effect.greenFragmentShader : effect.fragmentShader = effect.redFragmentShader + } + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + + property string redFragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } + " + + property string greenFragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + } + " + + fragmentShader: redFragmentShader + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: effect.fragmentShader == effect.redFragmentShader ? "Effect (display should be red)" : "Effect (display should be green)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml new file mode 100644 index 0000000..6a20835 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + console.log("Grabbed!") + theSource.grab(); + } + } + + Image { + id: theSourcImage + source: "image_opaque.png" + opacity: 0.5 + } + + ShaderEffectSource { + id: theSource + sourceItem: theSourcImage + } + + ShaderEffectItem { + id: effect + anchors.centerIn: parent + width: parent.width + height: parent.height + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + Text { + id: label + anchors.centerIn: parent + text: "Effect with grab (opacity 0.5)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml new file mode 100644 index 0000000..4027745 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "green" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + //theSource.hideOriginal = !theSource.hideOriginal + theSource.hideSource = !theSource.hideSource + } + } + + Rectangle { + id: redRect + anchors.fill: parent; + color: "red" + } + + ShaderEffectSource { + id: theSource + sourceItem: redRect + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + void main() { + // Empty fragmentshader, we do not write any pixels via this effect item. We only observe hideoriginal functionality. + } + " + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + //text: theSource.hideOriginal ? "Hideoriginal true (display should be green)" : "Hideoriginal false (display should be red)" + text: theSource.hideSource ? "HideSource true (display should be green)" : "HideSource false (display should be red)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml new file mode 100644 index 0000000..92436a8 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + theSource.wrapMode == ShaderEffectSource.RepeatHorizontally ? theSource.wrapMode = ShaderEffectSource.ClampToEdge : theSource.wrapMode = ShaderEffectSource.RepeatHorizontally + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image_small.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + vec2 tex = qt_TexCoord0 * 4.0; + gl_FragColor = texture2D(source, tex); + } + " + + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.wrapMode == ShaderEffectSource.RepeatHorizontally ? "HorizontalWrap RepeatHorizontally" : "HorizontalWrap ClampToEdge" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml new file mode 100644 index 0000000..07da7b8 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + theSource.smooth = !theSource.smooth + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + width: parent.width * 2.0 + height: parent.height * 2.0 + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: !theSource.smooth ? "Filtering nearest (faster)" : "Filtering linear (better quality)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml new file mode 100644 index 0000000..8bfafa9 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + id: imageMarginTester + anchors.fill: parent; + color: "green" + property real testMarginX: 10 + property real testMarginY: 10 + + Timer { + running: true + interval: 2000 + repeat: true + + onTriggered: { + if (imageMarginTester.testMarginX < 20) { + imageMarginTester.testMarginX = 50 + imageMarginTester.testMarginY = 120 + } + else { + imageMarginTester.testMarginX = 10 + imageMarginTester.testMarginY = 10 + } + + console.log("onTriggered...") + theSource.sourceRect = Qt.rect(-testMarginX, -testMarginY, parent.width + testMarginX*2, parent.height + testMarginY*2) + console.log("onTriggered done") + } + } + + ShaderEffectSource { + id: theSource + sourceImage: "image_opaque.png" + sourceRect: Qt.rect(-10,-10, parent.width + 2*10, parent.height + 2*10) + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.sourceRect.width == 0 ? "No margins" : "Green margins " + imageMarginTester.testMarginX + "x" + imageMarginTester.testMarginY + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml new file mode 100644 index 0000000..61f947a --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + id: marginTester + anchors.fill: parent; + color: "green" + property real testMarginX: 10 + property real testMarginY: 10 + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (marginTester.testMarginX < 20) { + marginTester.testMarginX = 50 + marginTester.testMarginY = 120 + } + else { + marginTester.testMarginX = 10 + marginTester.testMarginY = 10 + } + + theSource.sourceRect = Qt.rect(-testMarginX, -testMarginY, parent.width + testMarginX*2, parent.height + testMarginY*2) + } + } + + ShaderEffectSource { + id: theSource + sourceImage: "image_opaque.png" + textureSize: Qt.size(160,160) + sourceRect: Qt.rect(-10,-10, parent.width + 2*10, parent.height + 2*10) + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.sourceRect.width == 0 ? "No margins" : "Green margins " + marginTester.testMarginX + "x" + marginTester.testMarginY + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml new file mode 100644 index 0000000..56b8168 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (theSource.mipmap && theSource.smooth){ + theSource.smooth = false + } else if (theSource.mipmap && !theSource.smooth){ + theSource.smooth = true + theSource.mipmap = false + } else if (!theSource.mipmap && theSource.smooth){ + theSource.smooth = false + } else if (!theSource.mipmap && !theSource.smooth){ + theSource.smooth = true + theSource.mipmap = true + } + } + } + + ShaderEffectSource { + id: theSource + sourceImage: "wallpaper.jpg" + mipmap: false + smooth: false + } + + ShaderEffectItem { + id: effect + anchors.centerIn: parent; + width: parent.width * 0.8 + height: parent.height * 0.8 + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: "Mipmap: " + theSource.mipmap + ", Smooth: " + theSource.smooth + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml new file mode 100644 index 0000000..26c6f57 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + id: marginTester + anchors.fill: parent; + color: "green" + property real testMarginX: 10 + property real testMarginY: 10 + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (marginTester.testMarginX < 20) { + marginTester.testMarginX = 50 + marginTester.testMarginY = 120 + } + else { + marginTester.testMarginX = 10 + marginTester.testMarginY = 10 + } + + theSource.sourceRect = Qt.rect(-testMarginX, -testMarginY, parent.width + testMarginX*2, parent.height + testMarginY*2) + console.log("onTriggered") + } + } + + Image { + id: redrect + source: "image_opaque.png" + } + + + ShaderEffectSource { + id: theSource + sourceItem: redrect + sourceRect: Qt.rect(-10,-10, parent.width + 2*10, parent.height + 2*10) + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.sourceRect.width == 0 ? "No margins" : "Green margins " + marginTester.testMarginX + "x" + marginTester.testMarginY + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml new file mode 100644 index 0000000..abbf8f4 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + id: marginTester + anchors.fill: parent; + color: "green" + property real testMarginX: 10 + property real testMarginY: 10 + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (marginTester.testMarginX < 20) { + marginTester.testMarginX = 50 + marginTester.testMarginY = 120 + } + else { + marginTester.testMarginX = 10 + marginTester.testMarginY = 10 + } + + theSource.sourceRect = Qt.rect(-testMarginX, -testMarginY, parent.width + testMarginX*2, parent.height + testMarginY*2) + } + } + + Image { + id: redrect + source: "image_opaque.png" + } + + ShaderEffectSource { + id: theSource + sourceItem: redrect + textureSize: Qt.size(160,160) + sourceRect: Qt.rect(-10,-10, parent.width + 2*10, parent.height + 2*10) + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.sourceRect.width == 0 ? "No margins" : "Green margins " + marginTester.testMarginX + "x" + marginTester.testMarginY + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml new file mode 100644 index 0000000..0d3553b --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + theSource.live = !theSource.live + theSource.grab() // This tests grabbing screenshot from static source + } + } + + Rectangle { + id: greenRect + anchors.fill: parent; + color: theSource.live ? "green" : "red" // This works if we use grab() + property int counter: 0 + Text { + id: counterText + anchors.centerIn: parent + text: greenRect.counter + font.pixelSize: 48 + } + Timer { + running: true + interval: 100 + repeat: true + onTriggered: { + greenRect.counter++ + } + } + } + + ShaderEffectSource { + id: theSource + sourceItem: greenRect + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.live ? "live true (color green, number changes)" : "live false (color red, same number)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml new file mode 100644 index 0000000..e8ddc61 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "red" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + effect.meshResolution.width == 1 ? effect.meshResolution = Qt.size(40,40) : effect.meshResolution = Qt.size(1,1) + } + } + + Rectangle { + id: thesource + anchors.centerIn: parent; + color: "green" + width: parent.width + height: parent.height + Image { + anchors.centerIn: parent; + source: "image_opaque.png" + } + } + + + ShaderEffectItem { + id: effect + anchors.fill: thesource; + property variant source: ShaderEffectSource { sourceItem: thesource } + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_ModelViewProjectionMatrix; + varying highp vec2 qt_TexCoord0; + void main() { + qt_TexCoord0 = qt_MultiTexCoord0; + + highp vec4 shift = vec4(cos(1071. * qt_MultiTexCoord0.x + 1.0) + sin(2051. * qt_MultiTexCoord0.y + 1.0), + cos(1131. * qt_MultiTexCoord0.x + 1.0) + sin(3039. * qt_MultiTexCoord0.x + 1.0), 0, 0) * 3.0; + + if (qt_MultiTexCoord0.x < 0.01 || qt_MultiTexCoord0.x > 0.99) + shift.x = 0.; + if (qt_MultiTexCoord0.y < 0.01 || qt_MultiTexCoord0.y > 0.99) + shift.y = 0.; + + gl_Position = qt_ModelViewProjectionMatrix * (qt_Vertex + shift); + } + " + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + Text { + id: label + anchors.centerIn: parent + text: effect.meshResolution.width == 1 ? "Resolution (1,1) (image looks normal)" : "Resolution (40,40) (image looks distorted)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml new file mode 100644 index 0000000..8b92247 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "black" + + Text { + id: text + anchors.centerIn: parent + font.pixelSize: 80 + text: "Shaderz!" + } + + ShaderEffectSource { + id: source + sourceItem: text + hideSource: true + } + + ShaderEffectItem { + anchors.fill: text; + + property variant source: source + + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; + } + " + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml new file mode 100644 index 0000000..af5ecf7 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (effect.opacity > 0.9) + effect.opacity = 0.0 + else if (effect.opacity < 0.5) + effect.opacity = 0.5 + else if (effect.opacity < 0.9) + effect.opacity = 1.0 + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image_opaque.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.centerIn: parent + width: parent.width + height: parent.height + property variant source: theSource + + fragmentShader: " + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(texture2D(source, qt_TexCoord0).rgb, qt_Opacity); + } + " + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + Text { + id: label + anchors.centerIn: parent + text: "Effect with opacity: " + effect.opacity + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml new file mode 100644 index 0000000..4262ebc --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (effectWrapper.rotation < 45) + effectWrapper.rotation = 45 + else if (effectWrapper.rotation < 90) + effectWrapper.rotation = 90 + else if (effectWrapper.rotation < 180) + effectWrapper.rotation = 0 + + } + } + + Item { + id: effectWrapper + anchors.fill: parent; + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image_opaque.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.centerIn: parent + width: parent.width - 50 + height: parent.height - 50 + property variant source: theSource + } + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + Text { + id: label + anchors.centerIn: parent + text: "Effect is rotated " + effectWrapper.rotation + " degrees" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml new file mode 100644 index 0000000..b60747c --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + if (effectWrapper.scale < 0.3) + effectWrapper.scale = 0.3 + else if (effectWrapper.scale < 1.7) + effectWrapper.scale = 1.7 + else if (effectWrapper.scale < 2.0) + effectWrapper.scale = 0.1 + } + } + + Item { + id: effectWrapper + anchors.fill: parent; + scale: 0.1 + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image_opaque.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.centerIn: parent + width: parent.width - 50 + height: parent.height - 50 + property variant source: theSource + } + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + Text { + id: label + anchors.centerIn: parent + text: "Effect is scaled " + effectWrapper.scale + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml new file mode 100644 index 0000000..5ca08cb --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + theSource.textureSize.width == 64 ? theSource.textureSize = Qt.size(360,640) : theSource.textureSize = Qt.size(64,64) + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image.png" } + live: false + textureSize: Qt.size(64,64) + smooth: true + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: "textureSize:" + theSource.textureSize.width + "x" + theSource.textureSize.height + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml new file mode 100644 index 0000000..e84b84b --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "black" + + Text { + id: text + anchors.centerIn: parent + font.pixelSize: 80 + text: "Shaderz!" + } + + ShaderEffectSource { + id: source + sourceItem: text + hideSource: true + } + + ShaderEffectItem { + width: parent.width + height: parent.height / 2 + blending: false + + property variant source: source + + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; + } + " + } + + ShaderEffectItem { + width: parent.width + y: parent.height / 2 + height: parent.height / 2 + + property variant source: source + + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a; + } + " + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml new file mode 100644 index 0000000..c8f12af --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "black" + + Rectangle { + id: rect; + anchors.centerIn: parent + width: 1 + height: 10 + + gradient: Gradient { + GradientStop { position: 0; color: "#ff0000" } + GradientStop { position: 0.5; color: "#00ff00" } + GradientStop { position: 1; color: "#0000ff" } + } + } + + Text { + id: text + anchors.centerIn: parent + font.pixelSize: 80 + text: "Shaderz!" + } + + ShaderEffectSource { + id: maskSource + sourceItem: text + hideSource: true + } + + ShaderEffectSource { + id: colorSource + sourceItem: rect; + hideSource: true + } + + ShaderEffectItem { + anchors.fill: text; + + property variant colorSource: colorSource + property variant maskSource: maskSource; + + fragmentShader: " + uniform lowp sampler2D maskSource; + uniform lowp sampler2D colorSource; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = texture2D(maskSource, qt_TexCoord0).a * texture2D(colorSource, qt_TexCoord0.yx); + } + " + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml new file mode 100644 index 0000000..0e12257 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "red" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + effect.vertexShader == effect.defaultVertexShader ? effect.vertexShader = effect.dummyVertexShader : effect.vertexShader = effect.defaultVertexShader + } + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + + property string defaultVertexShader: " + uniform highp mat4 qt_ModelViewProjectionMatrix; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main(void) + { + qt_TexCoord0 = qt_MultiTexCoord0; + gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; + }; + " + + property string dummyVertexShader: " + uniform highp mat4 qt_ModelViewProjectionMatrix; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main(void) + { + qt_TexCoord0 = qt_MultiTexCoord0; + gl_Position = qt_Vertex * vec4(0.0, 0.0, 0.0, 0.0001); + }; + " + + vertexShader: defaultVertexShader + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + } + " + + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: effect.vertexShader == effect.defaultVertexShader ? "Effect (display shoud be green)" : "Effect (display shoud be red)" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml new file mode 100644 index 0000000..96171ef --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + theSource.wrapMode == ShaderEffectSource.RepeatVertically ? theSource.wrapMode = ShaderEffectSource.ClampToEdge : theSource.wrapMode = ShaderEffectSource.RepeatVertically + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image_small.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + vec2 tex = qt_TexCoord0 * 4.0; + gl_FragColor = texture2D(source, tex); + } + " + + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.wrapMode == ShaderEffectSource.RepeatVertically ? "Wrap RepeatVertically" : "VerticalWrap ClampToEdge" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml new file mode 100644 index 0000000..35f6b92 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +import Qt.labs.shaders 1.0 + +Rectangle { + anchors.fill: parent; + color: "white" + + Timer { + running: true + interval: 2000 + repeat: true + onTriggered: { + theSource.wrapMode == ShaderEffectSource.Repeat ? theSource.wrapMode = ShaderEffectSource.ClampToEdge : theSource.wrapMode = ShaderEffectSource.Repeat + } + } + + ShaderEffectSource { + id: theSource + sourceItem: Image { source: "image_small.png" } + live: false + hideSource: true + } + + ShaderEffectItem { + id: effect + anchors.fill: parent; + property variant source: theSource + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + vec2 tex = qt_TexCoord0 * 4.0; + gl_FragColor = texture2D(source, tex); + } + " + + } + + Rectangle { + width: parent.width + height: 40 + color: "#cc000000" + + Text { + id: label + anchors.centerIn: parent + text: theSource.wrapMode == ShaderEffectSource.Repeat ? "Wrap Repeat" : "Wrap ClampToEdge" + color: "white" + font.bold: true + } + } +} diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/back.svg b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/back.svg new file mode 100755 index 0000000..3005133 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/back.svg @@ -0,0 +1,11 @@ + + + + + + + diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/green_image_transparent.png b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/green_image_transparent.png new file mode 100755 index 0000000..f3024f7 Binary files /dev/null and b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/green_image_transparent.png differ diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image.png b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image.png new file mode 100755 index 0000000..144c02d Binary files /dev/null and b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image.png differ diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_opaque.png b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_opaque.png new file mode 100755 index 0000000..c73d389 Binary files /dev/null and b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_opaque.png differ diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_small.png b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_small.png new file mode 100755 index 0000000..b226773 Binary files /dev/null and b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/image_small.png differ diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml new file mode 100644 index 0000000..2a857a9 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml @@ -0,0 +1,236 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Item { + id: main + width: 360 + height: 640 + + Rectangle { + id: background + visible: testCaseList.visible + anchors.fill: parent + gradient: Gradient { + GradientStop { position: 0.0; color: "#EEEEEE" } + GradientStop { position: 1.0; color: "#AAAAAA" } + } + } + + Loader { + id: testLoader + width: parent.width + height: parent.height + visible: !testCaseList.visible + } + + ListModel { + id: testcaseModel + ListElement { name: "TestEffectHierarchy.qml"; group: "Effect source property tests" } + ListElement { name: "TestGrab.qml"; group: "Effect source property tests" } + ListElement { name: "TestLive.qml"; group: "Effect source property tests" } + ListElement { name: "TestImageFiltering.qml"; group: "Effect source property tests" } + ListElement { name: "TestWrapRepeat.qml"; group: "Effect source property tests" } + ListElement { name: "TestHorizontalWrap.qml"; group: "Effect source property tests" } + ListElement { name: "TestVerticalWrap.qml"; group: "Effect source property tests" } + ListElement { name: "TestTextureSize.qml"; group: "Effect source property tests" } + ListElement { name: "TestItemMargins.qml"; group: "Effect source property tests" } + ListElement { name: "TestEffectInsideAnotherEffect.qml"; group: "Effect source property tests" } + ListElement { name: "TestItemMarginsWithTextureSize.qml"; group: "Effect source property tests" } + ListElement { name: "TestHideOriginal.qml"; group: "Effect source property tests" } + ListElement { name: "TestActive.qml"; group: "Effect item property tests" } + ListElement { name: "TestBlending.qml"; group: "Effect item property tests" } + ListElement { name: "TestBlendingModes.qml"; group: "Effect item property tests" } + ListElement { name: "TestOpacity.qml"; group: "Effect item property tests" } + ListElement { name: "TestFragmentShader.qml"; group: "Effect item property tests" } + ListElement { name: "TestVertexShader.qml"; group: "Effect item property tests" } + ListElement { name: "TestMeshResolution.qml"; group: "Effect item property tests" } + ListElement { name: "TestRotation.qml"; group: "Shader effect transformation tests" } + ListElement { name: "TestScale.qml"; group: "Shader effect transformation tests" } + ListElement { name: "TestBasic.qml"; group: "Scenegraph effect tests" } + ListElement { name: "TestOneSource.qml"; group: "Scenegraph effect tests" } + ListElement { name: "TestTwiceOnSameSource.qml"; group: "Scenegraph effect tests" } + ListElement { name: "TestTwoSources.qml"; group: "Scenegraph effect tests" } + } + + Component { + id: sectionHeading + Rectangle { + width: testCaseList.width + height: 35 + color: "#00000000" + + Text { + text: section + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + anchors.fill: parent + anchors.leftMargin: 5 + font.bold: true + style: Text.Raised + styleColor: "white" + } + } + } + + ListView { + id: testCaseList + + property int hideTranslation: 0 + transform: Translate { + x: testCaseList.hideTranslation + } + + anchors.fill: parent + anchors.topMargin: 10 + anchors.leftMargin: 5 + anchors.rightMargin: 5 + anchors.bottomMargin: 10 + + model: testcaseModel + spacing: 3 + + state: "testStopped" + + section.property: "group" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + + delegate: Rectangle { + width: parent.width + height: 50 + radius: 5 + border.width: 1 + border.color: "#888888" + color: delegateMouseArea.pressed ? "#AAAAFF" : "#FFFFFF" + Text { + id: delegateText; + text: " " + name + width: parent.width + height: parent.height + font.pixelSize: 16 + verticalAlignment: Text.AlignVCenter + } + Text { + id: delegateText2; + text: "> " + width: parent.width + height: parent.height + font.pixelSize: 20 + smooth: true + color: "gray" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignRight + } + + MouseArea { + id: delegateMouseArea + anchors.fill: parent; + onClicked: { + testCaseList.state = "testRunning" + testLoader.source = name + console.log(name) + } + } + } + + states: [ + State { + name: "testRunning" + PropertyChanges { target: testCaseList; visible: false; hideTranslation: -main.width } + }, + State { + name: "testStopped" + PropertyChanges { target: testCaseList; visible: true; hideTranslation: 0 } + } + ] + + transitions: [ + Transition { + to: "testRunning" + SequentialAnimation { + NumberAnimation { properties: "hideTranslation"; easing.type: Easing.InQuad; duration: 300 } + PropertyAction { target: testCaseList; property: "visible"; value: false } + } + }, + Transition { + to: "testStopped" + SequentialAnimation { + PropertyAction { target: testCaseList; property: "visible"; value: true } + NumberAnimation { properties: "hideTranslation"; easing.type: Easing.InQuad; duration: 300 } + } + } + + ] + } + + Rectangle { + visible: true + anchors.bottom: main.bottom + anchors.left: main.left + anchors.right: main.right + height: 40 + color: "#cc000000" + Item { + anchors.top: parent.top + anchors.topMargin: 5 + anchors.left: parent.left + anchors.leftMargin: 20 + Image { + source: "back.svg" + } + } + + MouseArea { + anchors.fill: parent; + onClicked: { + if (testCaseList.visible){ + Qt.quit() + } else if (!testCaseList.state != "testStopped") { + testCaseList.state = "testStopped" + testLoader.source = "" + } + } + } + } +} + diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/wallpaper.jpg b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/wallpaper.jpg new file mode 100755 index 0000000..5bc7b58 Binary files /dev/null and b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/wallpaper.jpg differ diff --git a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..51b5fcc --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,127 @@ +// checksum 0xdf1f version 0x10008 +#include "qmlapplicationviewer.h" + +#include +#include +#include +#include +#include +#include + +#if defined(QMLJSDEBUGGER) +#include +#endif +#if defined(QMLOBSERVER) +#include +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include +#include +#include +#include +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#ifdef QMLJSDEBUGGER + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#ifdef QMLOBSERVER + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(Orientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != Auto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == LockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case LockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case LockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case Auto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::show() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + QDeclarativeView::show(); +#endif +} diff --git a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..ea78431 --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,28 @@ +// checksum 0x39ee version 0x10008 +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include + +class QmlApplicationViewer : public QDeclarativeView +{ +public: + enum Orientation { + LockPortrait, + LockLandscape, + Auto + }; + + QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(Orientation orientation); + void show(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..79e6a9f --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,152 @@ +# checksum 0xc123 version 0x10008 +# This file should not be edited. +# Future versions of Qt Creator might offer updated versions of this file. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +contains(DEFINES, QMLOBSERVER) { + DEFINES *= QMLJSDEBUGGER +} + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + + error("Qt version $$QT_VERSION too old for QmlJS Debugging. Aborting.") + } + isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + + error("QMLJSDEBUGGER defined, but no QMLJSDEBUGGER_PATH set on command line. Aborting.") + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file should not be edited. +# Future versions of Qt Creator might offer updated versions of this file. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/tests/manual/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/manual/declarative/qmlshadersplugin/qmlshadersplugin.pro new file mode 100644 index 0000000..98101fb --- /dev/null +++ b/tests/manual/declarative/qmlshadersplugin/qmlshadersplugin.pro @@ -0,0 +1,29 @@ +QT += declarative opengl + +# Add more folders to ship with the application, here +folder_01.source = qml/qmlshadersplugintest +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve Qml modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE40472A7 + +# Define QMLJSDEBUGGER to enable basic debugging (setting breakpoints etc) +# Define QMLOBSERVER for advanced features (requires experimental QmlInspector plugin!) +#DEFINES += QMLJSDEBUGGER +#DEFINES += QMLOBSERVER + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() -- cgit v0.12 From 9663956626fe95ace6baa4cf0ba30898a88147a7 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 25 May 2011 15:09:33 +0200 Subject: Update the detection of is_using_gnupoc for S3. The akndoc.h was moved to epoc32/include/mw. Reviewed-By: axis --- mkspecs/features/symbian/qt_config.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/qt_config.prf b/mkspecs/features/symbian/qt_config.prf index 82c1862..1afd22c 100644 --- a/mkspecs/features/symbian/qt_config.prf +++ b/mkspecs/features/symbian/qt_config.prf @@ -3,7 +3,7 @@ load(qt_config) !contains(QMAKE_HOST.os, "Windows") { # Test for the existence of lower cased headers, a sign of using Gnupoc. # Note that the qmake "exists" test won't do because it is case insensitive. - system("test -f $${EPOCROOT}epoc32/include/akndoc.h") { + system("test -f $${EPOCROOT}epoc32/include/akndoc.h") | system("test -f $${EPOCROOT}epoc32/include/mw/akndoc.h") { CONFIG += is_using_gnupoc } } -- cgit v0.12 From e0bc5834ce26f91e60d8ca839f8a80ffd6f11c90 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 18 May 2011 15:33:56 +0100 Subject: symbian socket engine: share ip address conversion code The helper function for converting TInetAddr -> QHostAddress is now used in qhostinfo_symbian.cpp as well. This should slightly improve performance by avoiding conversion to/from strings, and also remove some duplicated code. Reviewed-by: Markus Goetz --- src/network/kernel/qhostaddress_p.h | 5 +++++ src/network/kernel/qhostinfo_symbian.cpp | 21 ++++++--------------- src/network/kernel/qnetworkinterface_symbian.cpp | 4 +--- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/network/kernel/qhostaddress_p.h b/src/network/kernel/qhostaddress_p.h index 255d706..0349ff3 100644 --- a/src/network/kernel/qhostaddress_p.h +++ b/src/network/kernel/qhostaddress_p.h @@ -71,6 +71,11 @@ public: void setPrefixLength(QAbstractSocket::NetworkLayerProtocol proto, int len); }; +#ifdef Q_OS_SYMBIAN +class TInetAddr; +QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr); +#endif + QT_END_NAMESPACE #endif diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp index 042899d..86c157c 100644 --- a/src/network/kernel/qhostinfo_symbian.cpp +++ b/src/network/kernel/qhostinfo_symbian.cpp @@ -52,6 +52,7 @@ #include #include #include +#include // Header does not exist in the S60 5.0 SDK //#include @@ -152,23 +153,17 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer hostAddresses; TInetAddr hostAdd = nameResult().iAddr; - // 39 is the maximum length of an IPv6 address. - TBuf<39> ipAddr; - // Fill ipAddr with the IP address from hostAdd - hostAdd.Output(ipAddr); - if (ipAddr.Length() > 0) - hostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); + if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) + hostAddresses.append(qt_QHostAddressFromTInetAddr(hostAdd)); // Check if there's more than one IP address linkd to this name while (hostResolver.Next(nameResult) == KErrNone) { hostAdd = nameResult().iAddr; - hostAdd.Output(ipAddr); // Ensure that record is valid (not an alias and with length greater than 0) - if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) { - hostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); - } + if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) + hostAddresses.append(qt_QHostAddressFromTInetAddr(hostAdd)); } hostResolver.Close(); @@ -414,14 +409,10 @@ void QSymbianHostResolver::processNameResult() { if (iStatus.Int() == KErrNone) { TInetAddr hostAdd = iNameResult().iAddr; - // 39 is the maximum length of an IPv6 address. - TBuf<39> ipAddr; - - hostAdd.Output(ipAddr); // Ensure that record is valid (not an alias and with length greater than 0) if (!(iNameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) { - iHostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); + iHostAddresses.append(qt_QHostAddressFromTInetAddr(hostAdd)); } iState = EGetByName; diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index e7d3ca9..dca6cf4 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -67,10 +67,8 @@ static QNetworkInterface::InterfaceFlags convertFlags(const TSoInetInterfaceInfo return flags; } -//TODO: share this, at least QHostInfo needs to do the same thing -static QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr) +QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr) { - //TODO: do we want to call v4 mapped addresses v4 or v6 outside of this file? if (addr.IsV4Mapped() || addr.Family() == KAfInet) { //convert v4 host address return QHostAddress(addr.Address()); -- cgit v0.12 From a7cf6e27c9e31833991d61685d4dc5b8b5f777b7 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 25 May 2011 14:46:01 +0100 Subject: Update bearer startup code in network autotests The bearer startup code I added to some of the network autotests to ensure the network was up before testing caused test failures on some linux configurations due to there being no default network defined. I've changed it to follow these steps: 1. update the configuration list & wait for update completed signal - due to the polling engines not having any config defined on the first run before the initial poll happens 2. check default configuration is valid before attempting to start it 3a. for valid configuration, start it and wait for started as before 3b. for invalid configuration, fail if bearer is mandatory, otherwise ignore - on symbian bearer use is "mandatory", on desktop platforms it is optional Reviewed-by: Markus Goetz --- tests/auto/networkselftest/tst_networkselftest.cpp | 15 +++++++++++---- .../tst_qabstractnetworkcache.cpp | 15 +++++++++++---- tests/auto/qftp/tst_qftp.cpp | 21 +++++++++++++++++---- tests/auto/qhostinfo/tst_qhostinfo.cpp | 16 +++++++++++----- .../qnetworkinterface/tst_qnetworkinterface.cpp | 15 +++++++++++---- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 15 +++++++++++---- tests/auto/qtcpserver/tst_qtcpserver.cpp | 19 +++++++++++++++---- tests/auto/qudpsocket/tst_qudpsocket.cpp | 15 +++++++++++---- 8 files changed, 98 insertions(+), 33 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index c21fd03..b2ce5ca 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -371,11 +371,18 @@ void tst_NetworkSelfTest::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index e4372c5..aefe0b9 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -141,11 +141,18 @@ void tst_QAbstractNetworkCache::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 1fa0787..7e431cf 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -155,6 +155,7 @@ private: QFtp *ftp; #ifndef QT_NO_BEARERMANAGEMENT + QNetworkConfigurationManager *netConfMan; QSharedPointer networkSessionExplicit; QSharedPointer networkSessionImplicit; #endif @@ -225,10 +226,20 @@ void tst_QFtp::initTestCase_data() void tst_QFtp::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT - QNetworkConfigurationManager manager; - networkSessionImplicit = QSharedPointer(new QNetworkSession(manager.defaultConfiguration())); - networkSessionImplicit->open(); - QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect + netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration(); + if (networkConfiguration.isValid()) { + networkSessionImplicit = QSharedPointer(new QNetworkSession(networkConfiguration)); + if (!networkSessionImplicit->isOpen()) { + networkSessionImplicit->open(); + QVERIFY(networkSessionImplicit->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); + } #endif } @@ -254,6 +265,8 @@ void tst_QFtp::init() } #ifndef QT_NO_BEARERMANAGEMENT if (setSession) { + if (!networkSessionImplicit) + QSKIP("test requires a valid default network configuration", SkipSingle); networkSessionExplicit = networkSessionImplicit; if (!networkSessionExplicit->isOpen()) { networkSessionExplicit->open(); diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index 93c08cd..2fa5e76 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -197,13 +197,19 @@ tst_QHostInfo::~tst_QHostInfo() void tst_QHostInfo::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT - //start the default network netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp index ae3436d..2077717 100644 --- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp @@ -89,11 +89,18 @@ void tst_QNetworkInterface::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index c70075f..97ffead 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -1283,11 +1283,18 @@ void tst_QNetworkReply::initTestCase() #endif #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index 3416a7c..a7c2604 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -116,6 +116,7 @@ private slots: private: #ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; + QNetworkConfigurationManager *netConfMan; #endif }; @@ -154,10 +155,20 @@ void tst_QTcpServer::initTestCase_data() void tst_QTcpServer::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT - QNetworkConfigurationManager man; - networkSession = new QNetworkSession(man.defaultConfiguration(), this); - networkSession->open(); - QVERIFY(networkSession->waitForOpened()); + netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration(); + if (networkConfiguration.isValid()) { + networkSession = new QNetworkSession(networkConfiguration); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); + } #endif } diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp index 9ca049b..a38082e 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp @@ -148,11 +148,18 @@ void tst_QUdpSocket::initTestCase_data() #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession = QSharedPointer(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession = QSharedPointer(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } -- cgit v0.12 From 31110bf84bb06d57983501fa65fe0db3f7c61927 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 18:24:30 +0200 Subject: Fix boundry conditions for cursor hit test Clicking at the edge of a glyph means lookup for the left glyph. Reviewed-by: TrustMe --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 9bbc4a4..5bf2b12 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2867,7 +2867,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, if (glyph_pos == -1 && end > 0) glyph_pos = logClusters[end - 1]; else { - if (x < edge) + if (x <= edge) glyph_pos--; } -- cgit v0.12 From 3f82ecbd0e2cdf477e57c7fe41b63c09d7e84787 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 18:24:30 +0200 Subject: Fix boundry conditions for cursor hit test Clicking at the edge of a glyph means lookup for the left glyph. Reviewed-by: TrustMe (cherry picked from commit 31110bf84bb06d57983501fa65fe0db3f7c61927) --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 69598cf..9271f34 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2739,7 +2739,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, if (glyph_pos == -1 && end > 0) glyph_pos = logClusters[end - 1]; else { - if (x < edge) + if (x <= edge) glyph_pos--; } -- cgit v0.12 From c9eb2ffd1ed940133392831747605bf735d92086 Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Wed, 18 May 2011 17:43:14 +0300 Subject: Fixing Linux compatibility issues for Symbian The patch applies everything from the original, except for the filename case changes in LIBS which are handled differently based on the auto-detected is_using_gnupoc CONFIG value. Reviewed-by: Laszlo Agocs --- .../mobile/quickhit/plugins/LevelOne/levelone.pro | 6 ++-- .../plugins/LevelTemplate/leveltemplate.pro | 6 ++-- .../mobile/quickhit/plugins/LevelTwo/leveltwo.pro | 6 ++-- mkspecs/features/symbian/application_icon.prf | 4 +-- src/gui/dialogs/dialogs.pri | 6 +++- src/plugins/phonon/mmf/mmf.pro | 12 +++++-- src/s60installs/qt.iby | 42 +++++++++++----------- src/s60installs/s60installs.pro | 6 ++-- tests/auto/qcssparser/qcssparser.pro | 2 +- 9 files changed, 51 insertions(+), 39 deletions(-) diff --git a/demos/mobile/quickhit/plugins/LevelOne/levelone.pro b/demos/mobile/quickhit/plugins/LevelOne/levelone.pro index fcbfc56..b936721 100644 --- a/demos/mobile/quickhit/plugins/LevelOne/levelone.pro +++ b/demos/mobile/quickhit/plugins/LevelOne/levelone.pro @@ -57,11 +57,11 @@ BLD_INF_RULES.prj_exports += "gfx/background3.png ../winscw/c/Data/gfx/backgroun myQml.sources = level.qml -myQml.path = c:/System/quickhitdata/levelone +myQml.path = c:/system/quickhitdata/levelone myGraphic.sources = gfx/* -myGraphic.path = c:/System/quickhitdata/levelone/gfx +myGraphic.path = c:/system/quickhitdata/levelone/gfx mySound.sources = sound/* -mySound.path = c:/System/quickhitdata/levelone/sound +mySound.path = c:/system/quickhitdata/levelone/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro b/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro index a4f5900..1370956 100644 --- a/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro +++ b/demos/mobile/quickhit/plugins/LevelTemplate/leveltemplate.pro @@ -60,11 +60,11 @@ BLD_INF_RULES.prj_exports += "gfx/enemy1.png ../winscw/c/Data/gfx/enemy1.png" \ myQml.sources = qml/* -myQml.path = c:/System/quickhitdata/leveltemplate +myQml.path = c:/system/quickhitdata/leveltemplate myGraphic.sources = gfx/* -myGraphic.path = c:/System/quickhitdata/leveltemplate/gfx +myGraphic.path = c:/system/quickhitdata/leveltemplate/gfx mySound.sources = sound/* -mySound.path = c:/System/quickhitdata/leveltemplate/sound +mySound.path = c:/system/quickhitdata/leveltemplate/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro b/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro index 171ee6c..e5c144f 100644 --- a/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro +++ b/demos/mobile/quickhit/plugins/LevelTwo/leveltwo.pro @@ -64,11 +64,11 @@ BLD_INF_RULES.prj_exports += "gfx/background2.png ../winscw/c/Data/gfx/backgroun myQml.sources = qml/* -myQml.path = c:/System/quickhitdata/leveltwo +myQml.path = c:/system/quickhitdata/leveltwo myGraphic.sources = gfx/* -myGraphic.path = c:/System/quickhitdata/leveltwo/gfx +myGraphic.path = c:/system/quickhitdata/leveltwo/gfx mySound.sources = sound/* -mySound.path = c:/System/quickhitdata/leveltwo/sound +mySound.path = c:/system/quickhitdata/leveltwo/sound # Takes qml, graphics and sounds into Symbian SIS package file (.pkg) DEPLOYMENT += myQml myGraphic mySound diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 06f5b31..56d1ea8 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -65,8 +65,8 @@ contains(CONFIG, no_icon) { mifconv.target = $$replace(mifconv.target, /, \\) } # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library - # svg-t icons should always use /c32 depth - mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed + # svg-t icons should always use -c32 depth + mifconv.commands = mifconv $$mifconv.target -c32 $$ICON_backslashed mifconv.depends = $$ICON PRE_TARGETDEPS += $$mifconv.target diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 12e3a71..365f589 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -109,7 +109,11 @@ SOURCES += \ dialogs/qprintpreviewdialog.cpp symbian:contains(QT_CONFIG, s60) { - LIBS += -lCommonDialogs + contains(CONFIG, is_using_gnupoc) { + LIBS += -lcommondialogs + } else { + LIBS += -lCommonDialogs + } SOURCES += dialogs/qfiledialog_symbian.cpp \ dialogs/qcolordialog_symbian.cpp } diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index a9e5746..75e42af 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -103,7 +103,11 @@ symbian { exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { HEADERS += $$PHONON_MMF_DIR/download.h SOURCES += $$PHONON_MMF_DIR/download.cpp - LIBS += -lDownloadMgr + contains(CONFIG, is_using_gnupoc) { + LIBS += -ldownloadmgr + } else { + LIBS += -lDownloadMgr + } DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD } } @@ -125,7 +129,11 @@ symbian { LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream # These are for effects. - LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + CONTAINS(config, is_using_gnupoc) { + LIBS += -laudioequalizereffect -lbassboosteffect -ldistanceattenuationeffect -ldopplerbase -leffectbase -lenvironmentalreverbeffect -llistenerdopplereffect -llistenerlocationeffect -llistenerorientationeffect -llocationbase -lloudnesseffect -lorientationbase -lsourcedopplereffect -lsourcelocationeffect -lsourceorientationeffect -lstereowideningeffect + } else { + LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + } # This is to allow IAP to be specified LIBS += -lcommdb diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index d6b36e0..9f2c979 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -40,7 +40,7 @@ file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll // Phonon MMF backend file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll -data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin // graphicssystems file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll @@ -54,41 +54,41 @@ file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll // imageformats stubs -data=\epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin -data=\epoc32\data\z\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin // codecs stubs -data=\epoc32\data\z\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin -data=\epoc32\data\z\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin -data=\epoc32\data\z\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin -data=\epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin // iconengines stubs -data=\epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin // qml import plugins file=ABI_DIR\BUILD_DIR\qmlfolderlistmodelplugin.dll SHARED_LIB_DIR\qmlfolderlistmodelplugin.dll file=ABI_DIR\BUILD_DIR\qmlgesturesplugin.dll SHARED_LIB_DIR\qmlgesturesplugin.dll file=ABI_DIR\BUILD_DIR\qmlparticlesplugin.dll SHARED_LIB_DIR\qmlparticlesplugin.dll -data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin -data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin -data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin -data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir -data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir -data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir +data=EPOCROOT##epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir // graphicssystems -data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin -data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin // bearer stub -data=\epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin +data=EPOCROOT##epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin // Stub sis file data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index d1bb48b..17b229f 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -10,10 +10,10 @@ symbian: { TARGET = "Qt$${QT_LIBINFIX}" isEmpty(QT_LIBINFIX) { - TARGET.UID3 = 0x2001E61C + TARGET.UID3 = 0x2001e61c } else { # Always use experimental UID for infixed configuration to avoid UID clash - TARGET.UID3 = 0xE001E61C + TARGET.UID3 = 0xe001e61c } VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} @@ -116,7 +116,7 @@ symbian: { # Support backup & restore for Qt libraries qtbackup.sources = backup_registration.xml - qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + qtbackup.path = c:/private/10202d56/import/packages/$$replace(TARGET.UID3, 0x,) DEPLOYMENT += qtlibraries \ qtbackup \ diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 674064f..4953490 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -10,7 +10,7 @@ requires(contains(QT_CONFIG,private_tests)) wince*|symbian: { addFiles.sources = testdata addFiles.path = . - timesFont.sources = C:/Windows/Fonts/times.ttf + timesFont.sources = c:/windows/fonts/times.ttf timesFont.path = . DEPLOYMENT += addFiles timesFont } -- cgit v0.12 From e35d0af6ef3016b27bfd6dca1cf5c8f8a153fc04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Thu, 26 May 2011 10:11:17 +0300 Subject: Fixed CI-errors caused by qmlshadersplugin addition. These are fixes for CI-issues caused by db20b6c03b6a93ab3e483cd85d5d0a923c3d3430 Reviewed-by: Kim Gronholm --- src/imports/shaders/scenegraph/qsggeometry.cpp | 4 +- src/imports/shaders/scenegraph/qsggeometry.h | 4 +- src/imports/shaders/shadereffectitem.cpp | 4 +- src/imports/shaders/shadereffectsource.cpp | 6 +-- .../qmlshadersplugin/qmlshadersplugin.pro | 20 +++++----- .../qmlshadersplugin/tst_qmlshadersplugin.cpp | 6 +-- .../declarative/qmlshadersplugin/GaussianBlur.qml | 43 +++++++++++++++++++++- .../qmlshadersplugin/GaussianDirectionalBlur.qml | 43 +++++++++++++++++++++- .../qmlshadersplugin/GaussianDropShadow.qml | 43 +++++++++++++++++++++- .../qmlshadersplugin/TestGaussianDropShadow.qml | 43 +++++++++++++++++++++- .../declarative/qmlshadersplugin/TestWater.qml | 42 ++++++++++++++++++++- .../declarative/qmlshadersplugin/Water.qml | 43 +++++++++++++++++++++- .../qmlshadersplugin/qmlshadersplugin.pro | 20 +++++----- .../qmlshadersplugin/tst_performance.cpp | 4 +- .../qml/qmlshadersplugintest/TestActive.qml | 2 +- .../qml/qmlshadersplugintest/TestBasic.qml | 2 +- .../qml/qmlshadersplugintest/TestBlending.qml | 2 +- .../qml/qmlshadersplugintest/TestBlendingModes.qml | 2 +- .../qmlshadersplugintest/TestEffectHierarchy.qml | 2 +- .../TestEffectInsideAnotherEffect.qml | 2 +- .../qml/qmlshadersplugintest/TestFormat.qml | 2 +- .../qmlshadersplugintest/TestFragmentShader.qml | 2 +- .../qml/qmlshadersplugintest/TestGrab.qml | 2 +- .../qml/qmlshadersplugintest/TestHideOriginal.qml | 2 +- .../qmlshadersplugintest/TestHorizontalWrap.qml | 2 +- .../qmlshadersplugintest/TestImageFiltering.qml | 2 +- .../qml/qmlshadersplugintest/TestImageMargins.qml | 2 +- .../TestImageMarginsWithTextureSize.qml | 2 +- .../qml/qmlshadersplugintest/TestImageMipmap.qml | 2 +- .../qml/qmlshadersplugintest/TestItemMargins.qml | 2 +- .../TestItemMarginsWithTextureSize.qml | 2 +- .../qml/qmlshadersplugintest/TestLive.qml | 2 +- .../qmlshadersplugintest/TestMeshResolution.qml | 2 +- .../qml/qmlshadersplugintest/TestOneSource.qml | 2 +- .../qml/qmlshadersplugintest/TestOpacity.qml | 2 +- .../qml/qmlshadersplugintest/TestRotation.qml | 2 +- .../qml/qmlshadersplugintest/TestScale.qml | 2 +- .../qml/qmlshadersplugintest/TestTextureSize.qml | 2 +- .../qmlshadersplugintest/TestTwiceOnSameSource.qml | 2 +- .../qml/qmlshadersplugintest/TestTwoSources.qml | 2 +- .../qml/qmlshadersplugintest/TestVertexShader.qml | 2 +- .../qml/qmlshadersplugintest/TestVerticalWrap.qml | 2 +- .../qml/qmlshadersplugintest/TestWrapRepeat.qml | 2 +- .../qml/qmlshadersplugintest/main.qml | 2 +- 44 files changed, 315 insertions(+), 70 deletions(-) diff --git a/src/imports/shaders/scenegraph/qsggeometry.cpp b/src/imports/shaders/scenegraph/qsggeometry.cpp index 14ee4db..05c111a 100644 --- a/src/imports/shaders/scenegraph/qsggeometry.cpp +++ b/src/imports/shaders/scenegraph/qsggeometry.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt scene graph research project. +** This file is part of the QML Shaders plugin of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/imports/shaders/scenegraph/qsggeometry.h b/src/imports/shaders/scenegraph/qsggeometry.h index 0055392..b6663f8 100644 --- a/src/imports/shaders/scenegraph/qsggeometry.h +++ b/src/imports/shaders/scenegraph/qsggeometry.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt scene graph research project. +** This file is part of the QML Shaders plugin of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/imports/shaders/shadereffectitem.cpp b/src/imports/shaders/shadereffectitem.cpp index a32168e..5bb906c 100644 --- a/src/imports/shaders/shadereffectitem.cpp +++ b/src/imports/shaders/shadereffectitem.cpp @@ -302,7 +302,7 @@ void ShaderEffectItem::setVertexShader(const QString &code) /*! \qmlproperty bool ShaderEffectItem::blending - This property defines wheter item is drawn using blending. + This property defines whether item is drawn using blending. If true, the RGBA pixel output from the fragment shader is blended with the pixel RGBA-values already in the framebuffer. @@ -565,7 +565,7 @@ void ShaderEffectItem::bindGeometry() continue; Q_ASSERT_X(j < m_geometry.attributeCount(), "ShaderEffectItem::bindGeometry()", "Geometry lacks attribute required by material"); const QSGGeometry::Attribute &a = m_geometry.attributes()[j]; - Q_ASSERT_X(j == a.position, "ShaderEffectItem::bindGeometry()", "Geometry does not have continous attribute positions"); + Q_ASSERT_X(j == a.position, "ShaderEffectItem::bindGeometry()", "Geometry does not have continuous attribute positions"); #if defined(QT_OPENGL_ES_2) GLboolean normalize = a.type != GL_FLOAT; #else diff --git a/src/imports/shaders/shadereffectsource.cpp b/src/imports/shaders/shadereffectsource.cpp index 0a133bd..7ceb7c2 100644 --- a/src/imports/shaders/shadereffectsource.cpp +++ b/src/imports/shaders/shadereffectsource.cpp @@ -229,7 +229,7 @@ void ShaderEffectSource::setTextureSize(const QSize &size) /*! \property ShaderEffectSource::live - \brief the flag tells wheter source item content is changing between frames. + \brief the flag tells whether source item content is changing between frames. */ void ShaderEffectSource::setLive(bool s) @@ -245,7 +245,7 @@ void ShaderEffectSource::setLive(bool s) /*! \qmlproperty bool ShaderEffectSource::hideSource - This property holds the flag to define wheter the original source item is + This property holds the flag to define whether the original source item is hidden when the effect item is drawn. The default value is false. @@ -253,7 +253,7 @@ void ShaderEffectSource::setLive(bool s) /*! \property ShaderEffectSource::hideSource - \brief the flag tells wheter original source item content should be hidden. + \brief the flag tells whether original source item content should be hidden. */ void ShaderEffectSource::setHideSource(bool hide) diff --git a/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro index 6225a8f..aa0e07a 100644 --- a/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro +++ b/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro @@ -4,15 +4,15 @@ QT += opengl declarative SOURCES += tst_qmlshadersplugin.cpp SOURCES += \ - ../../../../src/imports/shaders/src/shadereffectitem.cpp \ - ../../../../src/imports/shaders/src/shadereffectsource.cpp \ - ../../../../src/imports/shaders/src/shadereffect.cpp \ - ../../../../src/imports/shaders/src/shadereffectbuffer.cpp \ - ../../../../src/imports/shaders/src/scenegraph/qsggeometry.cpp + ../../../../src/imports/shaders/shadereffectitem.cpp \ + ../../../../src/imports/shaders/shadereffectsource.cpp \ + ../../../../src/imports/shaders/shadereffect.cpp \ + ../../../../src/imports/shaders/shadereffectbuffer.cpp \ + ../../../../src/imports/shaders/scenegraph/qsggeometry.cpp HEADERS += \ - ../../../../src/imports/shaders/src/shadereffectitem.h \ - ../../../../src/imports/shaders/src/shadereffectsource.h \ - ../../../../src/imports/shaders/src/shadereffect.h \ - ../../../../src/imports/shaders/src/shadereffectbuffer.h \ - ../../../../src/imports/shaders/src/scenegraph/qsggeometry.h + ../../../../src/imports/shaders/shadereffectitem.h \ + ../../../../src/imports/shaders/shadereffectsource.h \ + ../../../../src/imports/shaders/shadereffect.h \ + ../../../../src/imports/shaders/shadereffectbuffer.h \ + ../../../../src/imports/shaders/scenegraph/qsggeometry.h diff --git a/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp b/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp index 61fe2ee..a904a88 100644 --- a/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp +++ b/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp @@ -41,9 +41,9 @@ #include #include -#include "../../../../src/imports/shaders/src/shadereffectitem.h" -#include "../../../../src/imports/shaders/src/shadereffectsource.h" -#include "../../../../src/imports/shaders/src/shadereffect.h" +#include "../../../../src/imports/shaders/shadereffectitem.h" +#include "../../../../src/imports/shaders/shadereffectsource.h" +#include "../../../../src/imports/shaders/shadereffect.h" static const char qt_default_vertex_code[] = "uniform highp mat4 qt_ModelViewProjectionMatrix;\n" diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml index 4424b0b..ee4c029 100644 --- a/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml +++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml @@ -1,4 +1,45 @@ -import Qt 4.7 +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml index 33f576b..e09dde2 100644 --- a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml +++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml @@ -1,4 +1,45 @@ -import Qt 4.7 +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 import Qt.labs.shaders 1.0 // Note 1. This shader implements gaussian blur without dynamic array access from inside shader loops (Optional feature in OpenGLES 2.0). diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml index be78c86..4e8c8d3 100644 --- a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml +++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml @@ -1,4 +1,45 @@ -import Qt 4.7 +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml b/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml index 5843d55..4831758 100755 --- a/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml +++ b/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml @@ -1,4 +1,45 @@ -import Qt 4.7 +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml b/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml index 4d90950..c4fbc2a 100755 --- a/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml +++ b/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml @@ -1,4 +1,44 @@ -import Qt 4.7 +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/benchmarks/declarative/qmlshadersplugin/Water.qml b/tests/benchmarks/declarative/qmlshadersplugin/Water.qml index 02486dd..6a1ec1c 100644 --- a/tests/benchmarks/declarative/qmlshadersplugin/Water.qml +++ b/tests/benchmarks/declarative/qmlshadersplugin/Water.qml @@ -1,4 +1,45 @@ -import Qt 4.7 +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro index 9fb8852..c4f6925 100644 --- a/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro +++ b/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro @@ -4,18 +4,18 @@ TARGET = tst_performance SOURCES += \ tst_performance.cpp \ - ../../../../src/imports/shaders/src/shadereffectitem.cpp \ - ../../../../src/imports/shaders/src/shadereffectsource.cpp \ - ../../../../src/imports/shaders/src/shadereffect.cpp \ - ../../../../src/imports/shaders/src/shadereffectbuffer.cpp \ - ../../../../src/imports/shaders/src/scenegraph/qsggeometry.cpp + ../../../../src/imports/shaders/shadereffectitem.cpp \ + ../../../../src/imports/shaders/shadereffectsource.cpp \ + ../../../../src/imports/shaders/shadereffect.cpp \ + ../../../../src/imports/shaders/shadereffectbuffer.cpp \ + ../../../../src/imports/shaders/scenegraph/qsggeometry.cpp HEADERS += \ - ../../../../src/imports/shaders/src/shadereffectitem.h \ - ../../../../src/imports/shaders/src/shadereffectsource.h \ - ../../../../src/imports/shaders/src/shadereffect.h \ - ../../../../src/imports/shaders/src/shadereffectbuffer.h \ - ../../../../src/imports/shaders/src/scenegraph/qsggeometry.h + ../../../../src/imports/shaders/shadereffectitem.h \ + ../../../../src/imports/shaders/shadereffectsource.h \ + ../../../../src/imports/shaders/shadereffect.h \ + ../../../../src/imports/shaders/shadereffectbuffer.h \ + ../../../../src/imports/shaders/scenegraph/qsggeometry.h OTHER_FILES += \ *.qml \ diff --git a/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp b/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp index 6ee6979..728334a 100644 --- a/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp +++ b/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp @@ -41,8 +41,8 @@ #include #include -#include "../../../../src/imports/shaders/src/shadereffectitem.h" -#include "../../../../src/imports/shaders/src/shadereffectsource.h" +#include "../../../../src/imports/shaders/shadereffectitem.h" +#include "../../../../src/imports/shaders/shadereffectsource.h" //#include "../../../src/shadereffect.h" class BenchmarkItem : public QDeclarativeItem diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml index 8aaee0d..303c7db 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestActive.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml index c7ec908..b70cac0 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBasic.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml index d7ce837..0c31419 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlending.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml index bd60c68..47f5bc3 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestBlendingModes.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Item { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml index e3a4c80..1cad5b1 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectHierarchy.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml index ab84557..1446f9b 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestEffectInsideAnotherEffect.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml index 9b1c697..df5e06d 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFormat.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml index 0a7f261..d170358 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestFragmentShader.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml index 6a20835..08e9319 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestGrab.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml index 4027745..1cd449f 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHideOriginal.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml index 92436a8..3b94389 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml index 07da7b8..9d990d0 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageFiltering.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml index 8bfafa9..3ad2b50 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMargins.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml index 61f947a..453bbaf 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMarginsWithTextureSize.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml index 56b8168..a51068d 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestImageMipmap.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml index 26c6f57..94f7824 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMargins.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml index abbf8f4..83784c3 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestItemMarginsWithTextureSize.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml index 0d3553b..6db568d 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestLive.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml index e8ddc61..255df36 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestMeshResolution.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml index 8b92247..117ae65 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOneSource.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml index af5ecf7..00af373 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestOpacity.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml index 4262ebc..c4435fa 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestRotation.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml index b60747c..3488eab 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestScale.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml index 5ca08cb..7369efc 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTextureSize.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml index e84b84b..8098a4d 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwiceOnSameSource.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml index c8f12af..e651cd9 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestTwoSources.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml index 0e12257..a7530dc 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml index 96171ef..726b237 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml index 35f6b92..514e150 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.shaders 1.0 Rectangle { diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml index 2a857a9..1abf524 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/main.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: main -- cgit v0.12 From 75e5a7a285a505a56e237bdf3f2c626f7865341e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 26 May 2011 11:42:30 +0200 Subject: remove duplicate message search and replace in a non-plaintext file. how intelligent. --- translations/qt_gl.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/translations/qt_gl.ts b/translations/qt_gl.ts index 2431a5d..a77bcc7 100644 --- a/translations/qt_gl.ts +++ b/translations/qt_gl.ts @@ -3728,18 +3728,6 @@ ou comercial onde non é preciso compartir ningún código fonte con terceiras p <p>Qt é un produto de Nokia. Consulte <a href="http://qt.nokia.com/">qt.nokia.com</a> para máis información.</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt é un toolkit de C++ para o desenvolvemento de programas multiplataforma.</p> <p>Qt fornece portabilidade entre MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux e as principais variantes comerciais de Unix cun único código fonte. Qt tamén está dispoñíbel para dispositivos incrustados como Qt para Embedded Linux e Qt para Windows CE.</p> -<p>Qt está dispoñíbel en tres opcións de licenzas diferentes deseñadas para adaptarse ás necesidades dos diferentes usuarios.</p> -</p>Qt distribuída sob o acordo de licenza comercial é adecuado para o desenvolvemento de software propietario -ou comercial onde non é preciso compartir ningún código fonte con terceiras partes ou que non poden cumprir os termos das licenzas GNU LGPL versión 2.1 nin da versión 3.0.</p> -<p>Qt sob a licenza GNU General Public License versión 2.1 é apropiada para o desenvolvemento de programas Qt (propietario ou de fontes abertas) supoñendo que poda cumprir cos termos e condicións da licenza GNU GPL versión 2.1.</p> -<p>Qt sob a licenza GNU General Public License versión 3.0 é apropiada para o desenvolvemento de programas Qt onde desexe empregar tales programas en combinación con software suxeito aos termos da GNU GPL versión 3.0 ou onde desexe cumprir cos termos da GNU GPL versión 3.0.</p> -<p>Consulte <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> para ler un resumo das licenzas de Qt.</p> -<p>Copyright (C) 2011 Nokia Corporation ou as súas subsidiarias.</p> -<p>Qt é un produto de Nokia. Consulte <a href="http://qt.nokia.com/">qt.nokia.com</a> para máis información.</p> - - About Qt Acerca de Qt -- cgit v0.12 From 180e6ca43cde0c80dd6e3f9539236ffd259d2bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Thu, 26 May 2011 15:01:49 +0300 Subject: Fixed more CI-errors caused by qmlshadersplugin addition. These are additional fixes for CI-issues caused by db20b6c03b6a93ab3e483cd85d5d0a923c3d3430 Reviewed-by: Kim Gronholm --- src/imports/shaders/shadereffectsource.cpp | 2 +- .../qmlapplicationviewer/qmlapplicationviewer.cpp | 41 ++++++++++++++++++++++ .../qmlapplicationviewer/qmlapplicationviewer.h | 41 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/imports/shaders/shadereffectsource.cpp b/src/imports/shaders/shadereffectsource.cpp index 7ceb7c2..dec3bb0 100644 --- a/src/imports/shaders/shadereffectsource.cpp +++ b/src/imports/shaders/shadereffectsource.cpp @@ -216,7 +216,7 @@ void ShaderEffectSource::setTextureSize(const QSize &size) /*! \qmlproperty bool ShaderEffectSource::live - This property holds the optimization flag to define wheter the source item content is changing or + This property holds the optimization flag to define whether the source item content is changing or static. If value true is assigned to this property, source item content is re-rendered into a diff --git a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp index 51b5fcc..b5b43bf 100644 --- a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // checksum 0xdf1f version 0x10008 #include "qmlapplicationviewer.h" diff --git a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h index ea78431..4d1a38c 100644 --- a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h +++ b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QML Shaders plugin of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // checksum 0x39ee version 0x10008 #ifndef QMLAPPLICATIONVIEWER_H #define QMLAPPLICATIONVIEWER_H -- cgit v0.12 From 1a5efee93dd78d5c4962e69ee1f6d6b99d8b9aab Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 26 May 2011 16:26:04 +0300 Subject: Predictive text is not committed when writing in a QLineEdit QCoeFepInputContext is very aggressive committing its preedit string. When AVKON FEP opens any of its subwindows, it steals the focus from editable widget, which causes preedit string to get committed. This makes the input context almost unusable with T9 word prediction. As it is rather difficult to prevent focus loss in these types of use scenarios, replace the committed string with user selected word when suggested word list is closed. Task-number: QTBUG-15031 Reviewed-by: Miikka Heikkinen --- src/gui/inputmethod/qcoefepinputcontext_p.h | 1 + src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 32 +++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 913d198..e929880 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -159,6 +159,7 @@ private: MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; QBasicTimer m_tempPreeditStringTimeout; bool m_hasTempPreeditString; + QString m_cachedPreeditString; int m_splitViewResizeBy; Qt::WindowStates m_splitViewPreviousWindowStates; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 4f9c4c9..67330e2 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -136,6 +136,16 @@ QCoeFepInputContext::~QCoeFepInputContext() void QCoeFepInputContext::reset() { + Qt::InputMethodHints currentHints = Qt::ImhNone; + if (focusWidget()) { + QWidget *proxy = focusWidget()->focusProxy(); + currentHints = proxy ? proxy->inputMethodHints() : focusWidget()->inputMethodHints(); + } + // Store a copy of preedit text, if prediction is active and input context is reseted. + // This is to ensure that we can replace preedit string after losing focus to FEP manager's + // internal sub-windows. + if (m_cachedPreeditString.isEmpty() && !(currentHints & Qt::ImhNoPredictiveText)) + m_cachedPreeditString = m_preeditString; commitCurrentString(true); } @@ -170,6 +180,8 @@ void QCoeFepInputContext::setFocusWidget(QWidget *w) void QCoeFepInputContext::widgetDestroyed(QWidget *w) { + m_cachedPreeditString.clear(); + // Make sure that the input capabilities of whatever new widget got focused are queried. CCoeControl *ctrl = w->effectiveWinId(); if (ctrl->IsFocused()) { @@ -903,6 +915,8 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, if (!w) return; + m_cachedPreeditString.clear(); + commitTemporaryPreeditString(); QList attributes; @@ -959,7 +973,10 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, QVariant())); QString newPreeditString = qt_TDesC2QString(aNewInlineText); QInputMethodEvent event(newPreeditString, attributes); - if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) { + if (!m_cachedPreeditString.isEmpty()) { + event.setCommitString(QLatin1String(""), -m_cachedPreeditString.length(), m_cachedPreeditString.length()); + m_cachedPreeditString.clear(); + } else if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) { // In Symbian world this means "erase last character". event.setCommitString(QLatin1String(""), -1, 1); } @@ -1149,7 +1166,18 @@ void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) m_hasTempPreeditString = false; - if (cancelFepTransaction) { + //Only cancel FEP transactions with prediction, when there is still active window. + Qt::InputMethodHints currentHints = Qt::ImhNone; + if (focusWidget()) { + if (focusWidget()->focusProxy()) + currentHints = focusWidget()->focusProxy()->inputMethodHints(); + else + currentHints = focusWidget()->inputMethodHints(); + } + bool predictive = !(currentHints & Qt::ImhNoPredictiveText); + bool widgetAndWindowAvailable = QApplication::activeWindow() && focusWidget(); + + if (cancelFepTransaction && ((predictive && widgetAndWindowAvailable) || !predictive)) { CCoeFep* fep = CCoeEnv::Static()->Fep(); if (fep) fep->CancelTransaction(); -- cgit v0.12 From dd33e048451ffc5420adbca9f30dba65f5dcf5e2 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 May 2011 15:05:35 +0200 Subject: Added some of my Qt 4.8 changes to the changelog Change-Id: I8913c88e5bd68145e0587d51ee9896fd5d21054a Reviewed-on: http://codereview.qt.nokia.com/140 Reviewed-by: Olivier Goffart (cherry picked from commit bc7ea289ea84dcff22aeea78c01a5447ccf076f7) --- dist/changes-4.8.0 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0 index b8cc626..1703633 100644 --- a/dist/changes-4.8.0 +++ b/dist/changes-4.8.0 @@ -39,12 +39,29 @@ QtCore - Removed support for QT_NO_THREAD define for QHostInfo. - Optimized plugin loading on ELF platforms. Print failure reason at runtime with QT_DEBUG_PLUGINS=1 in environment. + - QMutexLocker: improved performence of the non contended case by inlining some function + - QThreadStorage: Added possibility to store object by value instead of by pointer [QTBUG-15033] + - QThread: fixed few race conditions [QTBUG-17257, QTBUG-15030] + - QtConcurrent: added support for c++0x lambda in few functions + - QObject: Improved performence of the signal activation + - QObject: added ways to connect signals using QMetaMethod + - QObject: deprecated qFindChild and qFindChildren + - QObject: optimize constructions and destruction of objects + - QObject: Qt::BlockingQueuedConnection can handle the return value [QTBUG-10440] + - QList/QVector/QStringList: added C++0x initilizer lists constructors. + - QVarLenghtArray: added method for consistency with QVector + - QStringBuilder: added support for QByteArray + - qSwap now uses std::swap, specialized std::swap for our container to work better with stl algoritms + - QVariant: deprecated global function qVariantSetValue, qVariantValue, qVariantCanConvert, qVariantFromValue QtGui ----- - QTabBar: reduced minimumSizeHint if ElideMode is set. - QComboBox: Fixed a color propagation issue with the lineedit. [QTBUG-5950] + - Deprecate qGenericMatrixFromMatrix4x4 and qGenericMatrixToMatrix4x4 + - QListView diverses optimisations [QTBUG-11438] + - QTreeWidget/QListWidget: use localeAwareCompare for string comparisons [QTBUG-10839] QtOpenGL -------- @@ -54,6 +71,10 @@ QtGui - Including will not work in combination with GLEW, as QGLFunctions will undefine GLEW's defines. +QtScript +-------- + - Deprecated qScriptValueFromQMetaObject, qScriptValueToValue, qScriptValueFromValue + **************************************************************************** * Database Drivers * @@ -136,6 +157,7 @@ Qt for Windows CE - qtconfig + * removed Qt3support dependency - qt3to4 -- cgit v0.12 From 72c31196fdba0cd297ed42cb35959b4b305296c7 Mon Sep 17 00:00:00 2001 From: shiroki Date: Thu, 26 May 2011 16:12:42 +0200 Subject: skip the ipv6 Host checking for the moment, since it fails on Windows XP. will fix later Reviewed-by: Peter Hartmann --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 113b64b..71c40a0 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2360,6 +2360,7 @@ void tst_QNetworkReply::connectToIPv6Address() QByteArray content = reply->readAll(); //qDebug() << server.receivedData; QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QSKIP("Fix this -- Host Info verification failed on Windows XP", SkipAll); QVERIFY(server.receivedData.contains(hostinfo)); QVERIFY(content == dataToSend); QCOMPARE(reply->url(), request.url()); -- cgit v0.12 From fbe0d24bdd429248dbf9e9be592f15fd7b1648bc Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 14 Apr 2011 10:36:38 +0300 Subject: Remove unnecessary QtQuick 1.1 effectiveLayoutDirection, effectiveHorizontalAlignment and anchors.mirror properties * these properties are seldomly used * they confuse developers that do not care about right-to-left user interfaces * LayoutMirroring.enabled property can be used instead to determine if mirroring is enabled * if needed, you can easily determine the effective layout directions and alignments with a little bit of JavaScript: function effectiveLayoutDirection() { if (LayoutMirroring.enabled) return (listView.layoutDirection == Qt.LeftToRight) ? Qt.RightToLeft : Qt.LeftToRight; else return listView.layoutDirection; } Task-number: QTBUG-11042 Reviewed-by: Martin Jones --- doc/src/declarative/righttoleft.qdoc | 17 +++---- doc/src/declarative/whatsnew.qdoc | 14 +---- .../layoutdirection/layoutdirection.qml | 12 ++++- .../graphicsitems/qdeclarativeanchors_p.h | 2 - .../graphicsitems/qdeclarativegridview.cpp | 22 +++----- .../graphicsitems/qdeclarativegridview_p.h | 2 - src/declarative/graphicsitems/qdeclarativeitem.cpp | 1 - .../graphicsitems/qdeclarativelistview.cpp | 20 +++----- .../graphicsitems/qdeclarativelistview_p.h | 2 - .../graphicsitems/qdeclarativepositioners.cpp | 59 +++++++--------------- .../graphicsitems/qdeclarativepositioners_p.h | 6 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 9 +--- src/declarative/graphicsitems/qdeclarativetext_p.h | 2 - .../graphicsitems/qdeclarativetextedit.cpp | 8 +-- .../graphicsitems/qdeclarativetextedit_p.h | 2 - .../graphicsitems/qdeclarativetextinput.cpp | 9 ++-- .../graphicsitems/qdeclarativetextinput_p.h | 2 - .../tst_qdeclarativeanchors.cpp | 5 +- 18 files changed, 58 insertions(+), 136 deletions(-) diff --git a/doc/src/declarative/righttoleft.qdoc b/doc/src/declarative/righttoleft.qdoc index 7db6136..cafc702 100644 --- a/doc/src/declarative/righttoleft.qdoc +++ b/doc/src/declarative/righttoleft.qdoc @@ -64,8 +64,7 @@ This default locale-based alignment can be overriden by setting the \c horizonta property for the text element, or by enabling layout mirroring using the \l LayoutMirroring attached property, which causes any explicit left and right horizontal alignments to be mirrored. Note that when \l LayoutMirroring is set, the \c horizontalAlignment property value remains unchanged; -the effective alignment of the text element that takes the mirroring into account can be read from the -\c effectiveHorizontalAlignment property. +use the property \c LayoutMirroring.enabled instead to query whether the mirroring is in effect. \snippet doc/src/snippets/declarative/righttoleft.qml 0 @@ -79,9 +78,9 @@ property for controlling the horizontal direction of the layouts. Setting \c lay the left-to-right layout direction. The horizontal layout direction can also be reversed through the \l LayoutMirroring attached property. -This causes the effective \c layoutDirection of positioners and views to be mirrored. Note the actual value -of the \c layoutDirection property will remain unchanged; the effective layout direction of positioners and -views that takes the mirroring into account can be read from the \c effectiveLayoutDirection property. +This causes the effective \c layoutDirection of positioners and views to be mirrored. Note though that the actual +value of the \c layoutDirection property will remain unchanged; use the property \c LayoutMirroring.enabled instead +to query whether the mirroring is in effect. \snippet doc/src/snippets/declarative/righttoleft.qml 1 @@ -101,12 +100,8 @@ Or set all child elements to also inherit the layout direction: \snippet doc/src/snippets/declarative/righttoleft.qml 3 Applying mirroring in this manner does not change the actual value of the relevant anchor, -\c layoutDirection or \c horizontalAlignment properties. The separate read-only property -\c effectiveLayoutDirection can be used to query the effective layout -direction of positioners and model views that takes the mirroring into account. Similarly the \l Text, -\l TextInput and \l TextEdit elements have gained the read-only property \c effectiveHorizontalAlignment -for querying the effective visual alignment of text. For anchors, the read only -\l {Item::anchors}{anchors.mirrored} property reflects whether anchors have been mirrored. +\c layoutDirection or \c horizontalAlignment properties. You can use \c LayoutMirroring.enabled to +query whether the mirroring is in effect. Note that application layouts and animations that are defined using \l {Item::}{x} property values (as opposed to anchors or positioner elements) are not affected by the \l LayoutMirroring attached property. diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index 6eb1548..c36a88c 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -41,13 +41,6 @@ PinchArea provides support for the common two finger pinch gesture. \l {LayoutMirroring}{Layout mirroring} is useful when you need to support both left-to-right and right-to-left layout versions of your application that target different language areas. -\section2 Anchors - -Added the following property: -\list -\o \l {Item::}{anchors.mirrored} -\endlist - \section2 Text Added the following properties: @@ -57,7 +50,6 @@ Added the following properties: \o \l {Text::}{lineCount} \o \l {Text::}{maximumLineCount} \o \l {Text::}{truncated} -\o \l {Text::}{effectiveHorizontalAlignment} \endlist horizontalAlignment now accepts Text.AlignJustify alignment mode. @@ -70,7 +62,6 @@ Added the following properties, methods and signal handlers: \o \l {TextEdit::}{lineCount} \o \l {TextEdit::}{inputMethodComposing} \o \l {TextEdit::}{mouseSelectionMode} -\o \l {TextEdit::}{effectiveHorizontalAlignment} \o \l {TextEdit::}{deselect()} \o \l {TextEdit::}{isRightToLeft()} \o \l {TextEdit::}{moveCursorSelection()} to enable selection by word @@ -84,7 +75,6 @@ Added the following properties and methods: \o \l {TextInput::}{canPaste} \o \l {TextInput::}{inputMethodComposing} \o \l {TextInput::}{mouseSelectionMode} -\o \l {TextInput::}{effectiveHorizontalAlignment} \o \l {TextInput::}{deselect()} \o \l {TextInput::}{isRightToLeft()} \o \l {TextInput::}{moveCursorSelection()} to enable selection by word @@ -125,17 +115,15 @@ Added the following property: Added the following properties and methods: \list \o \l{ListView::}{layoutDirection} -\o \l{ListView::}{effectiveLayoutDirection} \o \l{ListView::}{positionViewAtBeginning()} \o \l{ListView::}{positionViewAtEnd()} \endlist \section2 Flow, Grid and Row -Added the following properties: +Added the following property: \list \o \l{Flow::}{layoutDirection} -\o \l{Flow::}{effectiveLayoutDirection} \endlist \section2 Repeater diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml index b4efebe..197ea39 100644 --- a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml +++ b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml @@ -226,7 +226,17 @@ Rectangle { Component { id: viewDelegate Item { - width: (listView.effectiveLayoutDirection == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50 + function effectiveLayoutDirection() { + if (LayoutMirroring.enabled) + if (listView.layoutDirection == Qt.LeftToRight) + return Qt.RightToLeft; + else + return Qt.LeftToRight; + else + return listView.layoutDirection; + } + + width: (effectiveLayoutDirection() == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50 Rectangle { width: 40; height: 40 color: Qt.rgba(0.5+(48 - index)*Math.random()/48, diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h index 388d6b9..f07ac23 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h @@ -79,7 +79,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) - Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1) public: QDeclarativeAnchors(QObject *parent=0); @@ -184,7 +183,6 @@ Q_SIGNALS: void verticalCenterOffsetChanged(); void horizontalCenterOffsetChanged(); void baselineOffsetChanged(); - Q_REVISION(1) void mirroredChanged(); private: friend class QDeclarativeItem; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 460f2c3..184569e 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -206,7 +206,6 @@ public: void mirrorChange() { Q_Q(QDeclarativeGridView); regenerate(); - emit q->effectiveLayoutDirectionChanged(); } qreal position() const { @@ -1802,9 +1801,12 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode) on the \l GridView:flow property. \endlist - \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if - GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply - indicates that the flow is horizontal. + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the layout direction of the grid view will be mirrored. However, the actual property + \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeGridView::layoutDirection() const @@ -1820,21 +1822,9 @@ void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirectio d->layoutDirection = layoutDirection; d->regenerate(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration GridView::effectiveLayoutDirection - This property holds the effective layout direction of the grid. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid will be mirrored. However, the - property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged. - - \sa GridView::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeGridView::effectiveLayoutDirection() const { Q_D(const QDeclarativeGridView); diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 4d99a14..628e98e 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -75,7 +75,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) @@ -194,7 +193,6 @@ Q_SIGNALS: void delegateChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); void keyNavigationWrapsChanged(); void cacheBufferChanged(); void snapModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 6602dda..93d3222 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -898,7 +898,6 @@ void QDeclarativeItemPrivate::setLayoutMirror(bool mirror) _anchors->d_func()->fillChanged(); _anchors->d_func()->centerInChanged(); _anchors->d_func()->updateHorizontalAnchors(); - emit _anchors->mirroredChanged(); } mirrorChange(); if (attachedLayoutDirection) { diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 79d67e7..734c732 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -298,7 +298,6 @@ public: void mirrorChange() { Q_Q(QDeclarativeListView); regenerate(); - emit q->effectiveLayoutDirectionChanged(); } bool isRightToLeft() const { @@ -2169,7 +2168,12 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie \o Qt.RightToLeft - Items will be laid out from right to let. \endlist - \sa ListView::effectiveLayoutDirection + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the layout direction of the horizontal list will be mirrored. However, the actual property + \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeListView::layoutDirection() const @@ -2185,21 +2189,9 @@ void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirectio d->layoutDirection = layoutDirection; d->regenerate(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration ListView::effectiveLayoutDirection - This property holds the effective layout direction of the horizontal list. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the horizontal list will be mirrored. However, the - property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged. - - \sa ListView::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeListView::effectiveLayoutDirection() const { Q_D(const QDeclarativeListView); diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 3b12225..70ca9de 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -114,7 +114,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) @@ -229,7 +228,6 @@ Q_SIGNALS: void spacingChanged(); void orientationChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); void currentIndexChanged(); void currentSectionChanged(); void highlightMoveSpeedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index e76fc03..55ec961 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -597,7 +597,12 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) the right anchor remains to the right of the row. \endlist - \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the row positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeRow::layoutDirection() const { @@ -616,21 +621,9 @@ void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); prePositioning(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration Row::effectiveLayoutDirection - This property holds the effective layout direction of the row positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the row positioner will be mirrored. However, the - property \l {Row::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Row::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeRow::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); @@ -900,7 +893,12 @@ void QDeclarativeGrid::setFlow(Flow flow) \l Grid::flow property. \endlist - \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the grid positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const { @@ -918,22 +916,10 @@ void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection) else d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); prePositioning(); - emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); + emit layoutDirectionChanged();; } } -/*! - \qmlproperty enumeration Grid::effectiveLayoutDirection - This property holds the effective layout direction of the grid positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid positioner will be mirrored. However, the - property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Grid::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeGrid::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); @@ -1265,7 +1251,12 @@ void QDeclarativeFlow::setFlow(Flow flow) \l Flow::flow property. \endlist - \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the flow positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeFlow::layoutDirection() const @@ -1281,21 +1272,9 @@ void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->layoutDirection = layoutDirection; prePositioning(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration Flow::effectiveLayoutDirection - This property holds the effective layout direction of the flow positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid positioner will be mirrored. However, the - property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Flow::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeFlow::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 214c04f..5c6c3c8 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeRow(QDeclarativeItem *parent=0); @@ -140,7 +139,6 @@ public: Q_SIGNALS: Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -156,7 +154,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeGrid(QDeclarativeItem *parent=0); @@ -180,7 +177,6 @@ Q_SIGNALS: void columnsChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -199,7 +195,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner Q_OBJECT Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeFlow(QDeclarativeItem *parent=0); @@ -214,7 +209,6 @@ public: Q_SIGNALS: void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 1d51840..c2947be 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1063,7 +1063,6 @@ void QDeclarativeText::setStyleColor(const QColor &color) /*! \qmlproperty enumeration Text::horizontalAlignment \qmlproperty enumeration Text::verticalAlignment - \qmlproperty enumeration Text::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is vertically aligned to the top. Horizontal @@ -1079,10 +1078,10 @@ void QDeclarativeText::setStyleColor(const QColor &color) need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to that of the parent. - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of Text, use the read-only property \c effectiveHorizontalAlignment. + of Text, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeText::HAlignment QDeclarativeText::hAlign() const { @@ -1132,10 +1131,7 @@ bool QDeclarativeTextPrivate::setHAlign(QDeclarativeText::HAlignment alignment, if (hAlign != alignment || forceAlign) { QDeclarativeText::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; - emit q->horizontalAlignmentChanged(hAlign); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -1157,7 +1153,6 @@ void QDeclarativeTextPrivate::mirrorChange() if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeText::AlignRight || hAlign == QDeclarativeText::AlignLeft)) { updateLayout(); - emit q->effectiveHorizontalAlignmentChanged(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index a1153c2..d1f5906 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -70,7 +70,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -191,7 +190,6 @@ Q_SIGNALS: void paintedSizeChanged(); Q_REVISION(1) void lineHeightChanged(qreal lineHeight); Q_REVISION(1) void lineHeightModeChanged(LineHeightMode mode); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index af2c8f3..93fa8a5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -459,7 +459,6 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextEdit::horizontalAlignment \qmlproperty enumeration TextEdit::verticalAlignment - \qmlproperty enumeration TextEdit::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the TextEdit item's width and height. By default, the text alignment follows the natural alignment @@ -481,10 +480,10 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) \o TextEdit.AlignVCenter \endlist - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of TextEdit, use the read-only property \c effectiveHorizontalAlignment. + of TextEdit, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const { @@ -539,8 +538,6 @@ bool QDeclarativeTextEditPrivate::setHAlign(QDeclarativeTextEdit::HAlignment ali QDeclarativeTextEdit::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; emit q->horizontalAlignmentChanged(alignment); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -563,7 +560,6 @@ void QDeclarativeTextEditPrivate::mirrorChange() if (!hAlignImplicit && (hAlign == QDeclarativeTextEdit::AlignRight || hAlign == QDeclarativeTextEdit::AlignLeft)) { updateDefaultTextOption(); q->updateSize(); - emit q->effectiveHorizontalAlignmentChanged(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 25ca1e7..7a17bd8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -73,7 +73,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -249,7 +248,6 @@ Q_SIGNALS: Q_REVISION(1) void linkActivated(const QString &link); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); public Q_SLOTS: void selectAll(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 226cce9..0d10bb6 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -326,7 +326,6 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextInput::horizontalAlignment - \qmlproperty enumeration TextInput::effectiveHorizontalAlignment Sets the horizontal alignment of the text within the TextInput item's width and height. By default, the text alignment follows the natural alignment @@ -342,10 +341,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and \c TextInput.AlignHCenter. - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of TextInput, use the read-only property \c effectiveHorizontalAlignment. + of TextInput, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const { @@ -398,8 +397,6 @@ bool QDeclarativeTextInputPrivate::setHAlign(QDeclarativeTextInput::HAlignment a QDeclarativeTextInput::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; emit q->horizontalAlignmentChanged(alignment); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -422,7 +419,7 @@ void QDeclarativeTextInputPrivate::mirrorChange() if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeTextInput::AlignRight || hAlign == QDeclarativeTextInput::AlignLeft)) { q->updateCursorRectangle(); - emit q->effectiveHorizontalAlignmentChanged(); + updateHorizontalScroll(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 171db92..04c6ff4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -71,7 +71,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) @@ -247,7 +246,6 @@ Q_SIGNALS: Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: virtual void geometryChanged(const QRectF &newGeometry, diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 0442350..3d8d2d9 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -58,7 +58,6 @@ Q_DECLARE_METATYPE(QDeclarativeAnchors::Anchor) Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine) - class tst_qdeclarativeanchors : public QObject { Q_OBJECT @@ -291,7 +290,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() QDeclarativeItem* rootItem = qobject_cast(view->rootObject()); foreach(QObject *child, rootItem->children()) { - bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->mirrored(); QCOMPARE(mirrored, false); } @@ -299,7 +298,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() mirrorAnchors(qobject_cast(child)); foreach(QObject *child, rootItem->children()) { - bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->mirrored(); QCOMPARE(mirrored, true); } -- cgit v0.12 From 53cdd1c64b0c73fa5fc4833512c0253224b6f013 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 27 May 2011 10:48:18 +0300 Subject: Fix SYMBIAN_VERSION_* ifdeffing QFileDialog and QSoftkeyManager broke in S60 5.3 platform because incorrect version ifdeffing. Task-number: QT-5065 Reviewed-by: Sami Merila --- src/gui/dialogs/qfiledialog_symbian.cpp | 6 +++--- src/gui/kernel/qsoftkeymanager.cpp | 6 +++--- src/gui/kernel/qsoftkeymanager_common_p.h | 2 +- src/gui/kernel/qsoftkeymanager_s60.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp index a4a7a22..16ef5b6 100644 --- a/src/gui/dialogs/qfiledialog_symbian.cpp +++ b/src/gui/dialogs/qfiledialog_symbian.cpp @@ -44,7 +44,7 @@ #ifndef QT_NO_FILEDIALOG #include -#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) #include #include #include @@ -58,7 +58,7 @@ extern QStringList qt_make_filter_list(const QString &filter); // defined in qfi extern QStringList qt_clean_filter_list(const QString &filter); // defined in qfiledialog.cpp enum DialogMode { DialogOpen, DialogSave, DialogFolder }; -#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) class CExtensionFilter : public MAknFileFilter { public: @@ -104,7 +104,7 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st const QString filter, DialogMode dialogMode) { QString selection; -#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) TFileName startFolder; if (!startDirectory.isEmpty()) { QString dir = QDir::toNativeSeparators(QFileDialogPrivate::workingDirectory(startDirectory)); diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 7d7c56f..c2c4fb2 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -50,7 +50,7 @@ #include "private/qsoftkeymanager_s60_p.h" #endif -#ifdef SYMBIAN_VERSION_SYMBIAN3 +#ifndef SYMBIAN_VERSION_9_4 #include "private/qt_s60_p.h" #endif @@ -105,7 +105,7 @@ QSoftKeyManager::QSoftKeyManager() : QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget) { QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget); -#ifdef SYMBIAN_VERSION_SYMBIAN3 +#ifndef SYMBIAN_VERSION_9_4 int key = 0; switch (standardKey) { case OkSoftKey: @@ -171,7 +171,7 @@ void QSoftKeyManager::cleanupHash(QObject *obj) Q_D(QSoftKeyManager); QAction *action = qobject_cast(obj); d->keyedActions.remove(action); -#ifdef SYMBIAN_VERSION_SYMBIAN3 +#ifndef SYMBIAN_VERSION_9_4 d->softKeyCommandActions.remove(action); #endif } diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h index bf4c747..830881d 100644 --- a/src/gui/kernel/qsoftkeymanager_common_p.h +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -72,7 +72,7 @@ protected: QMultiHash requestedSoftKeyActions; QWidget *initialSoftKeySource; bool pendingUpdate; -#ifdef SYMBIAN_VERSION_SYMBIAN3 +#ifndef SYMBIAN_VERSION_9_4 QHash softKeyCommandActions; #endif }; diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index cd1b444..503277b 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -113,7 +113,7 @@ void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonG void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba) { -#ifdef SYMBIAN_VERSION_SYMBIAN3 +#ifndef SYMBIAN_VERSION_9_4 QT_TRAP_THROWING( //EAknSoftkeyEmpty is used, because using -1 adds softkeys without actions on Symbian3 cba.SetCommandL(0, EAknSoftkeyEmpty, KNullDesC); @@ -303,7 +303,7 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba, QString text = softkeyText(*action); TPtrC nativeText = qt_QString2TPtrC(text); int command = S60_COMMAND_START + position; -#ifdef SYMBIAN_VERSION_SYMBIAN3 +#ifndef SYMBIAN_VERSION_9_4 if (softKeyCommandActions.contains(action)) command = softKeyCommandActions.value(action); #endif -- cgit v0.12 From 552bdd2b5f4ff71fe04574172abca24c898e3f41 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 27 May 2011 12:34:08 +0300 Subject: Fix non-Symbian builds broken by previous commit. Task-number: QT-5065 Reviewed-by: Sami Merila --- src/gui/kernel/qsoftkeymanager.cpp | 6 +++--- src/gui/kernel/qsoftkeymanager_common_p.h | 2 +- src/gui/kernel/qsoftkeymanager_s60.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index c2c4fb2..1150601 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -50,7 +50,7 @@ #include "private/qsoftkeymanager_s60_p.h" #endif -#ifndef SYMBIAN_VERSION_9_4 +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) #include "private/qt_s60_p.h" #endif @@ -105,7 +105,7 @@ QSoftKeyManager::QSoftKeyManager() : QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget) { QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget); -#ifndef SYMBIAN_VERSION_9_4 +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) int key = 0; switch (standardKey) { case OkSoftKey: @@ -171,7 +171,7 @@ void QSoftKeyManager::cleanupHash(QObject *obj) Q_D(QSoftKeyManager); QAction *action = qobject_cast(obj); d->keyedActions.remove(action); -#ifndef SYMBIAN_VERSION_9_4 +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) d->softKeyCommandActions.remove(action); #endif } diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h index 830881d..5b76e60 100644 --- a/src/gui/kernel/qsoftkeymanager_common_p.h +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -72,7 +72,7 @@ protected: QMultiHash requestedSoftKeyActions; QWidget *initialSoftKeySource; bool pendingUpdate; -#ifndef SYMBIAN_VERSION_9_4 +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) QHash softKeyCommandActions; #endif }; diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 503277b..773743a 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -113,7 +113,7 @@ void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonG void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba) { -#ifndef SYMBIAN_VERSION_9_4 +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) QT_TRAP_THROWING( //EAknSoftkeyEmpty is used, because using -1 adds softkeys without actions on Symbian3 cba.SetCommandL(0, EAknSoftkeyEmpty, KNullDesC); @@ -303,7 +303,7 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba, QString text = softkeyText(*action); TPtrC nativeText = qt_QString2TPtrC(text); int command = S60_COMMAND_START + position; -#ifndef SYMBIAN_VERSION_9_4 +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) if (softKeyCommandActions.contains(action)) command = softKeyCommandActions.value(action); #endif -- cgit v0.12 From b68dffb7d852915d3962afcf947606e0cb1e05d2 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 27 May 2011 13:45:34 +0300 Subject: Documented Symbian peculiarity about QDesktopWidget::availableGeometry In Symbian QDesktopWidget::availableGeometry() is not guaranteed to return correct values at the time the resize event related to the geometry change is passed to the widgets. There is a similar issue with QDesktopWidget::screenGeometry(). Documented this fact. Task-number: QTBUG-14058 Reviewed-by: Sami Merila --- src/gui/kernel/qdesktopwidget.qdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/gui/kernel/qdesktopwidget.qdoc index f71155e..b93bcb3 100644 --- a/src/gui/kernel/qdesktopwidget.qdoc +++ b/src/gui/kernel/qdesktopwidget.qdoc @@ -151,6 +151,11 @@ on Mac OS X, or the task bar on Windows). The default screen is used if \a screen is -1. + \note In Symbian devices the available geometry reported by QDesktopWidget is + not guaranteed to be correct at the time the geometry change resize event + is passed to widgets. The correct way to listen for available geometry changes + is to connect to the workAreaResized() signal of QDesktopWidget. + \sa screenNumber(), screenGeometry() */ @@ -179,6 +184,11 @@ Returns the geometry of the screen with index \a screen. The default screen is used if \a screen is -1. + \note In Symbian devices the screen geometry reported by QDesktopWidget is + not guaranteed to be correct at the time the geometry change resize event + is passed to widgets. The correct way to listen for screen geometry changes + is to connect to the resized() signal of QDesktopWidget. + \sa screenNumber() */ -- cgit v0.12 From 8f3b6f7b294b9ad52e9fdc812f13f1e7b7720e0d Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Fri, 27 May 2011 14:35:32 +0300 Subject: Fix the build break caused by the missing parameter for QSKIP macro. This commit fixes the build break caused by the missing parameter for QSKIP macro, introduced in commit 05d8caa4c42b5539d993a898830307c21cb942b6. Reviewed by: Guoqing Zhang --- tests/auto/qstring/tst_qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index 11fd986..c19b168 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -4334,7 +4334,7 @@ void tst_QString::localeAwareCompare_data() void tst_QString::localeAwareCompare() { #ifdef Q_OS_SYMBIAN - QSKIP("QTBUG-16921: There is no way to set up the system locale, so this test is not reliable in Symbian."); + QSKIP("QTBUG-16921: There is no way to set up the system locale, so this test is not reliable in Symbian.", SkipSingle); #else #ifdef Q_OS_WIN # ifndef Q_OS_WINCE -- cgit v0.12 From 1ad251132816e0cde703d41138a002b7b3b74867 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 27 May 2011 16:31:56 +0300 Subject: QToolButton autotest trigger() fails in E6 In E6 device, QToolButton autotest trigger() fails due to mouse click not hitting the context menu at all. Task-number: QT-5055 Reviewed-by: Miikka Heikkinen --- tests/auto/qtoolbutton/tst_qtoolbutton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp index 427a505..a4aa312 100644 --- a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp @@ -231,7 +231,7 @@ void tst_QToolButton::task176137_autoRepeatOfAction() void tst_QToolButton::sendMouseClick() { - QTest::mouseClick(w, Qt::LeftButton, 0, QPoint(7,7)); + QTest::mouseClick(w, Qt::LeftButton, 0); } QTEST_MAIN(tst_QToolButton) -- cgit v0.12 From 35421a9313a324ff63df6ba27e03b8090c964717 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 27 May 2011 14:24:21 +0200 Subject: Fix compile for systems with old fontconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia26796bdbab7988d14163d3c1290111c0cb22bf7 Reviewed-on: http://codereview.qt.nokia.com/182 Reviewed-by: Samuel Rødal (cherry picked from commit 93339428c040a2576e4e0da315b1a6a4e4c1916f) --- src/gui/text/qfontdatabase_x11.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 0c0c4c8..cb63844 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -1996,6 +1996,11 @@ void QFontDatabase::load(const QFontPrivate *d, int script) QFontCache::instance()->insertEngine(key, fe); } +// Needed for fontconfig version < 2.2.97 +#ifndef FC_FAMILYLANG +#define FC_FAMILYLANG "familylang" +#endif + static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) { #if defined(QT_NO_FONTCONFIG) -- cgit v0.12 From 706fc1c894addd6602470b25aba686491c891a14 Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Sun, 29 May 2011 11:19:35 +0300 Subject: Fix bug about daylight saving missing on Symbian platfrom. Daylight saving support for QDateTime is missing from Symbian platform. This is bug fix for QTBUG-6859. This bug was fixed by commit 2a20705. However, this original fix was removed by 01cf310d2 because of different implementation before S60 5.0 platform. This fix is re-applied since Qt is not going to support S60 3.x platform. Task-number: QTBUG-6859 Reviewed-by: Trust Me --- src/corelib/corelib.pro | 1 + src/corelib/tools/qdatetime.cpp | 60 +++++++++++++++++++++------------- tests/auto/qdatetime/qdatetime.pro | 4 +-- tests/auto/qdatetime/tst_qdatetime.cpp | 7 ++++ 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 58d2c7b..9673861 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -45,4 +45,5 @@ symbian: { "UNPAGED" \ "$${LITERAL_HASH}endif" MMP_RULES += pagingBlock + LIBS += -ltzclient } diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 4303731..a6fee43 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -75,6 +75,7 @@ #if defined(Q_OS_SYMBIAN) #include +#include #endif QT_BEGIN_NAMESPACE @@ -4029,23 +4030,32 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) #elif defined(Q_OS_SYMBIAN) // months and days are zero index based _LIT(KUnixEpoch, "19700000:000000.000000"); - TTimeIntervalSeconds utcOffset = User::UTCOffset(); TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); TTime epochTTime; TInt err = epochTTime.Set(KUnixEpoch); tm res; if(err == KErrNone) { TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; - utcTTime = utcTTime + utcOffset; - TDateTime utcDateTime = utcTTime.DateTime(); - res.tm_sec = utcDateTime.Second(); - res.tm_min = utcDateTime.Minute(); - res.tm_hour = utcDateTime.Hour(); - res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct - res.tm_mon = utcDateTime.Month(); - res.tm_year = utcDateTime.Year() - 1900; - res.tm_isdst = 0; - brokenDown = &res; + TRAP(err, + RTz tz; + User::LeaveIfError(tz.Connect()); + CleanupClosePushL(tz); + res.tm_isdst = tz.IsDaylightSavingOnL(*tz.GetTimeZoneIdL(),utcTTime); + User::LeaveIfError(tz.ConvertToLocalTime(utcTTime)); + CleanupStack::PopAndDestroy(&tz)); + if (KErrNone == err) { + TDateTime localDateTime = utcTTime.DateTime(); + res.tm_sec = localDateTime.Second(); + res.tm_min = localDateTime.Minute(); + res.tm_hour = localDateTime.Hour(); + res.tm_mday = localDateTime.Day() + 1; // non-zero based index for tm struct + res.tm_mon = localDateTime.Month(); + res.tm_year = localDateTime.Year() - 1900; + // Symbian's timezone server doesn't know how to handle DST before year 1997 + if (res.tm_year < 97) + res.tm_isdst = -1; + brokenDown = &res; + } } #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of localtime() where available @@ -4120,23 +4130,27 @@ static void localToUtc(QDate &date, QTime &time, int isdst) #elif defined(Q_OS_SYMBIAN) // months and days are zero index based _LIT(KUnixEpoch, "19700000:000000.000000"); - TTimeIntervalSeconds utcOffset = TTimeIntervalSeconds(0 - User::UTCOffset().Int()); TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC); TTime epochTTime; TInt err = epochTTime.Set(KUnixEpoch); tm res; if(err == KErrNone) { - TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; - utcTTime = utcTTime + utcOffset; - TDateTime utcDateTime = utcTTime.DateTime(); - res.tm_sec = utcDateTime.Second(); - res.tm_min = utcDateTime.Minute(); - res.tm_hour = utcDateTime.Hour(); - res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct - res.tm_mon = utcDateTime.Month(); - res.tm_year = utcDateTime.Year() - 1900; - res.tm_isdst = (int)isdst; - brokenDown = &res; + TTime localTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC; + RTz tz; + if (KErrNone == tz.Connect()) { + if (KErrNone == tz.ConvertToUniversalTime(localTTime)) { + TDateTime utcDateTime = localTTime.DateTime(); + res.tm_sec = utcDateTime.Second(); + res.tm_min = utcDateTime.Minute(); + res.tm_hour = utcDateTime.Hour(); + res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct + res.tm_mon = utcDateTime.Month(); + res.tm_year = utcDateTime.Year() - 1900; + res.tm_isdst = (int)isdst; + brokenDown = &res; + } + tz.Close(); + } } #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of gmtime() where available diff --git a/tests/auto/qdatetime/qdatetime.pro b/tests/auto/qdatetime/qdatetime.pro index 08a321e..a3f3091 100644 --- a/tests/auto/qdatetime/qdatetime.pro +++ b/tests/auto/qdatetime/qdatetime.pro @@ -1,5 +1,4 @@ load(qttest_p4) - SOURCES += tst_qdatetime.cpp QT = core @@ -10,6 +9,5 @@ win32-msvc|win32-msvc9x { QMAKE_CFLAGS_RELEASE -= -O1 QMAKE_CXXFLAGS_RELEASE -= -O1 } - - CONFIG += parallel_test +HEADERS = tst_qdatetime.loc diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 95995e8..5462250 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -155,9 +155,16 @@ Q_DECLARE_METATYPE(QTime) tst_QDateTime::tst_QDateTime() { +#ifdef Q_OS_SYMBIAN + // Symbian's timezone server cannot handle DST correctly for dates before year 1997 + uint x1 = QDateTime(QDate(2000, 1, 1), QTime()).toTime_t(); + uint x2 = QDateTime(QDate(2000, 6, 1), QTime()).toTime_t(); + europeanTimeZone = (x1 == 946681200 && x2 == 959810400); +#else uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t(); uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t(); europeanTimeZone = (x1 == 631148400 && x2 == 644191200); +#endif } tst_QDateTime::~tst_QDateTime() -- cgit v0.12 From b9d5cb9334e7d9da71af169802a01f8d344151a7 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 30 May 2011 15:26:06 +1000 Subject: ListView segmentation fault when setting highlight to null Setting view highlight to null due to focus change caused a crash since graphicsview accessed the highlight item after it had been deleted. Remove highlight item from scene and deleteLater(), as is done for delegates. Change-Id: I5bfd59095aca90d3adca805bc4f61c92c192ee1b Task-number: QTBUG-19509 Reviewed-by: Bea Lam --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 4 +++- src/declarative/graphicsitems/qdeclarativelistview.cpp | 4 +++- src/declarative/graphicsitems/qdeclarativepathview.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 34925f1..36f6e29 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -818,7 +818,9 @@ void QDeclarativeGridViewPrivate::createHighlight() if (highlight) { if (trackedItem == highlight) trackedItem = 0; - delete highlight->item; + if (highlight->item->scene()) + highlight->item->scene()->removeItem(highlight->item); + highlight->item->deleteLater(); delete highlight; highlight = 0; delete highlightXAnimator; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index b52b6fc..225b031 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -943,7 +943,9 @@ void QDeclarativeListViewPrivate::createHighlight() if (highlight) { if (trackedItem == highlight) trackedItem = 0; - delete highlight->item; + if (highlight->item->scene()) + highlight->item->scene()->removeItem(highlight->item); + highlight->item->deleteLater(); delete highlight; highlight = 0; delete highlightPosAnimator; diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 79e52cd..94f128d 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -203,7 +203,9 @@ void QDeclarativePathViewPrivate::createHighlight() bool changed = false; if (highlightItem) { - delete highlightItem; + if (highlightItem->scene()) + highlightItem->scene()->removeItem(highlightItem); + highlightItem->deleteLater(); highlightItem = 0; changed = true; } -- cgit v0.12 From 49a94f19b6a4407df42b8462e52922bec42de1ba Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 30 May 2011 09:14:38 +0200 Subject: qmlplugindump: Fix --path usage with drive letters on Windows. Since we can't import by such a path, we instead use a "." import and set the uri of the component to the correct path. Mirrors a change to qmldump in qt-creator/0c8b4e38fab1862e3427aac7e7db68623bc7f174 Reviewed-by: Thomas Hartmann (cherry picked from commit 3904e604f453b43b2a0e45a882283e26a27eaa18) --- tools/qmlplugindump/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 5667c7a..03bc313 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -65,6 +65,8 @@ #include #endif +QString pluginImportPath; + void collectReachableMetaObjects(const QMetaObject *meta, QSet *metas) { if (! meta || metas->contains(meta)) @@ -194,7 +196,7 @@ QSet collectReachableMetaObjects(const QString &importCode, code += " {}\n"; QDeclarativeComponent c(engine); - c.setData(code, QUrl("typeinstance")); + c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typeinstance.qml")); QObject *object = c.create(); if (object) @@ -451,7 +453,6 @@ int main(int argc, char *argv[]) QString pluginImportUri; QString pluginImportVersion; - QString pluginImportPath; bool relocatable = true; bool pathImport = false; if (args.size() >= 3) { @@ -488,7 +489,7 @@ int main(int argc, char *argv[]) qWarning() << "Incorrect number of positional arguments"; return EXIT_INVALIDARGUMENTS; } - pluginImportPath = positionalArgs[1]; + pluginImportPath = QDir::fromNativeSeparators(positionalArgs[1]); if (positionalArgs.size() == 3) pluginImportVersion = positionalArgs[2]; } @@ -514,7 +515,7 @@ int main(int argc, char *argv[]) importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii(); } else { // pluginImportVersion can be empty - importCode += QString("import \"%1\" %2\n").arg(pluginImportPath, pluginImportVersion).toAscii(); + importCode += QString("import \".\" %2\n").arg(pluginImportVersion).toAscii(); } // create a component with these imports to make sure the imports are valid @@ -524,7 +525,7 @@ int main(int argc, char *argv[]) code += "QtObject {}"; QDeclarativeComponent c(engine); - c.setData(code, QUrl("typelist")); + c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typelist.qml")); c.create(); if (!c.errors().isEmpty()) { foreach (const QDeclarativeError &error, c.errors()) -- cgit v0.12 From b0392d398e2f28682cdce6e85546d38a838440f7 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 30 May 2011 09:24:20 +0200 Subject: qmlplugindump: Dump revision property. Mirrors a change to qmldump in qt-creator/6e3274240077fc356a37d3de735b3b2da9654d2e Reviewed-by: Roberto Raggi --- tools/qmlplugindump/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 03bc313..acc1b19 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -336,6 +336,10 @@ private: qml->writeStartObject("Property"); qml->writeScriptBinding(QLatin1String("name"), enquote(QString::fromUtf8(prop.name()))); +#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 4)) + if (int revision = prop.revision()) + qml->writeScriptBinding(QLatin1String("revision"), QString::number(revision)); +#endif writeTypeProperties(prop.typeName(), prop.isWritable()); qml->writeEndObject(); @@ -364,6 +368,11 @@ private: qml->writeScriptBinding(QLatin1String("name"), enquote(name)); +#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 4)) + if (int revision = meth.revision()) + qml->writeScriptBinding(QLatin1String("revision"), QString::number(revision)); +#endif + const QString typeName = convertToId(meth.typeName()); if (! typeName.isEmpty()) qml->writeScriptBinding(QLatin1String("type"), enquote(typeName)); -- cgit v0.12 From 10f16bc55b9e5535bc3353260f97a32e18d70cf1 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 30 May 2011 10:20:29 +0200 Subject: qmlplugindump: Bump QtQuick.tooling version to 1.1. Mirrors a change to qmlplugindump in qtcreator/715cee76a9e46efb7f8245004aaa8a1c47b1618d Reviewed-by: Kai Koehne --- tools/qmlplugindump/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index acc1b19..f398358 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -510,7 +510,7 @@ int main(int argc, char *argv[]) engine->addImportPath(pluginImportPath); // find all QMetaObjects reachable from the builtin module - QByteArray importCode("import QtQuick 1.0\n"); + QByteArray importCode("import QtQuick 1.1\n"); QSet defaultReachable = collectReachableMetaObjects(importCode, engine); // this will hold the meta objects we want to dump information of -- cgit v0.12 From f32377e2038369cbf2822875cd8836b1f70feb6e Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Mon, 30 May 2011 12:50:29 +0300 Subject: Fixed contains check casing in mmf.pro file Contains check in mmf.pro was spelled in upper case, but qmake's internal contains function isn't case-insensitive and needs to be spelled in lower case. Reviewed-by: Miikka Heikkinen --- src/plugins/phonon/mmf/mmf.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 75e42af..752c403 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -129,7 +129,7 @@ symbian { LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream # These are for effects. - CONTAINS(config, is_using_gnupoc) { + contains(CONFIG, is_using_gnupoc) { LIBS += -laudioequalizereffect -lbassboosteffect -ldistanceattenuationeffect -ldopplerbase -leffectbase -lenvironmentalreverbeffect -llistenerdopplereffect -llistenerlocationeffect -llistenerorientationeffect -llocationbase -lloudnesseffect -lorientationbase -lsourcedopplereffect -lsourcelocationeffect -lsourceorientationeffect -lstereowideningeffect } else { LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From f370dd07560c449ba17d13475721f7d3b46e6b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 30 May 2011 09:38:47 +0200 Subject: Fixed clipping errors for non-extended paint engines. Partially revert change a33ef62469fd71bec for the non-extended paint engine path. Task-number: QTBUG-19525 Reviewed-by: Andy Shaw --- src/gui/painting/qpainter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index dfb9a04..a4ab00a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2788,6 +2788,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = rect; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -2843,6 +2846,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = r; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -3248,6 +3254,9 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipPath = path; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) -- cgit v0.12 From 48ff7e5af99923396243940979d15d4ec2e2730c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 30 May 2011 11:39:18 +0200 Subject: Missing glyphs transforming QStaticText on X11/raster with subpixel AA Static text took an untested and broken code path for the combo of subpixel AA, X11, raster engine and transformation. This would cause missing glyphs. The reason was that QStaticText took an unused code path which turned out not to work. The workaround is to use gray AA on transformed text, like we already do for the GL engine. In Qt 4.8, the static text code path has been rewritten to use the Freetype cache instead of the image glyph cache, so the bug will be fixed more properly there. Reviewed-by: Samuel --- src/gui/painting/qpaintengine_raster.cpp | 10 +++++++++- src/gui/painting/qtextureglyphcache.cpp | 8 ++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 01b22da..cd9206c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3105,7 +3105,15 @@ void QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; + QFontEngineGlyphCache::Type glyphType; + if (fontEngine->glyphFormat >= 0) { + glyphType = QFontEngineGlyphCache::Type(fontEngine->glyphFormat); + } else if (s->matrix.type() > QTransform::TxTranslate + && d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask) { + glyphType = QFontEngineGlyphCache::Raster_A8; + } else { + glyphType = d->glyphCacheType; + } QImageTextureGlyphCache *cache = static_cast(fontEngine->glyphCache(0, glyphType, s->matrix)); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 16df6c1..2c1da24 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -178,14 +178,10 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g) const { #if defined(Q_WS_X11) - if (m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { + if (m_type != Raster_RGBMask && m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None; QImage::Format imageFormat = QImage::Format_Invalid; switch (m_type) { - case Raster_RGBMask: - format = QFontEngineFT::Format_A32; - imageFormat = QImage::Format_RGB32; - break; case Raster_A8: format = QFontEngineFT::Format_A8; imageFormat = QImage::Format_Indexed8; @@ -266,7 +262,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), m_image.format()); -- cgit v0.12 From a9c76a7403b573ebe69d324d0b2f16f367c3a458 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 30 May 2011 13:22:06 +0300 Subject: Fix QMenuBar autotest failures for Symbian Effectively three fixes to reach same autotest results as on other Symbian devices and to make the case not crash (itself, or Qt). a) Fix null pointer usage in QWidget. This is mostly theoretic case, since it requires that previous focus widget has widget, yet it doesn't have internal winId. Still test case manages to make this happen, so lets prevent the null pointer use. b) Skip activatedCount_noQt3() test case, since it would require shortcut support and leads to test crash. Qt for Symbian should have shortcut support as a result of task http://bugreports.qt.nokia.com/browse/QTBUG-5730 c) Ensure that menu has at least 360 width in tests that send keypresses to the menu. Otherwise, menuitems might get set into menu extension, which makes highlight tests fail (since item is not visible). Task-number: QT-5053 Reviewed-by: Tomi Vihria --- src/gui/kernel/qapplication_s60.cpp | 2 +- tests/auto/qmenubar/tst_qmenubar.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index b3f9eec..96ac6f4 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2005,7 +2005,7 @@ void QApplicationPrivate::openPopup(QWidget *popup) QApplicationPrivate::popupWidgets->append(popup); // Cancel focus widget pointer capture and long tap timer - if (QApplication::focusWidget()) { + if (QApplication::focusWidget() && QApplication::focusWidget()->effectiveWinId()) { static_cast(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer(); QApplication::focusWidget()->effectiveWinId()->SetPointerCapture(false); } diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 72048d9..d548a51 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -515,6 +515,10 @@ void tst_QMenuBar::activatedCount_noQt3() #if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) QSKIP("On Mac/WinCE, native key events are needed to test menu action activation", SkipAll); #endif +#ifdef Q_OS_SYMBIAN + QSKIP("On Symbian OS, native key events are needed to test menu action activation", SkipAll); +#endif + // create a popup menu with menu items set the accelerators later... initSimpleMenubar_noQt3(); @@ -1573,6 +1577,12 @@ void tst_QMenuBar::task256322_highlight() file2->setText("file2"); QAction *nothing = win.menuBar()->addAction("nothing"); +#ifdef Q_WS_S60 + // Set minimum width to ensure that menu items are not added to the menu extension. + // Minimum width 360 is the minimal screen width in any supported Symbian device. + win.menuBar()->setMinimumWidth(360); +#endif + win.show(); QTest::qWait(200); -- cgit v0.12 From 93bce7874721de905af0181da95c58fe13a2e015 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 24 May 2011 11:50:16 +0200 Subject: Keep line consistency with text baseline Also revert previous underline patch. Reviewed-by: Eskil --- src/gui/painting/qpaintengine_raster.cpp | 3 ++- src/gui/painting/qpainter.cpp | 3 +-- src/gui/painting/qtextureglyphcache.cpp | 4 +++- src/gui/text/qfontengine_coretext.mm | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 592bf12..730f6a2 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2880,6 +2880,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); + const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); const uchar *bits = image.bits(); for (int i=0; iunderlinePosition().toReal(); // deliberately ceil the offset to avoid the underline coming too close to // the text above it. - const qreal aliasedCoordinateDelta = 0.5 - 0.015625; - const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta; + const qreal underlinePos = pos.y() + qCeil(underlineOffset); if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index e9e56a2..5d397be 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -367,7 +367,9 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { -#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) +#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) + return 1; +#elif defined(Q_WS_X11) return 0; #else return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index d14db3a..982c271 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -730,10 +730,10 @@ void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *position } } -QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, int /*margin*/, bool aa) +QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, int margin, bool aa) { const glyph_metrics_t br = boundingBox(glyph); - QImage im(qRound(br.width)+2, qRound(br.height)+2, QImage::Format_RGB32); + QImage im(qRound(br.width) + margin * 2, qRound(br.height) + margin * 2, QImage::Format_RGB32); im.fill(0); CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); @@ -765,8 +765,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextSetFont(ctx, cgFont); - qreal pos_x = -br.x.toReal() + subPixelPosition.toReal(); - qreal pos_y = im.height() + br.y.toReal() - 1; + qreal pos_x = -br.x.toReal() + subPixelPosition.toReal() + margin; + qreal pos_y = im.height() + br.y.toReal() - margin; CGContextSetTextPosition(ctx, pos_x, pos_y); CGSize advance; -- cgit v0.12 From a5926145407103ed2e3e6ee0369358709a50c551 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Fri, 15 Apr 2011 16:26:44 +0200 Subject: QmlDebugger: parsing packets iteratively in the communication protocol Reviewed-by: Kai Koehne (reapplied commit fea13a449c59690ae7b7f43aa64f50c0a290a2cf from qtcreator) Change-Id: I0c78188994029b2ac7daa3d59182566c5ec6c8b5 --- src/declarative/debugger/qpacketprotocol.cpp | 73 +++++++++++++--------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index c24df61..77c5f44 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -164,47 +164,44 @@ public Q_SLOTS: void readyToRead() { - if(-1 == inProgressSize) { - // We need a size header of sizeof(qint32) - if(sizeof(qint32) > (uint)dev->bytesAvailable()) - return; - - // Read size header - int read = dev->read((char *)&inProgressSize, sizeof(qint32)); - Q_ASSERT(read == sizeof(qint32)); - Q_UNUSED(read); - - // Check sizing constraints - if(inProgressSize > maxPacketSize) { - QObject::disconnect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::disconnect(dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); - dev = 0; - emit invalidPacket(); - return; - } - - inProgressSize -= sizeof(qint32); - + while (true) { // Need to get trailing data - readyToRead(); - } else { - inProgress.append(dev->read(inProgressSize - inProgress.size())); - - if(inProgressSize == inProgress.size()) { - // Packet has arrived! - packets.append(inProgress); - inProgressSize = -1; - inProgress.clear(); + if (-1 == inProgressSize) { + // We need a size header of sizeof(qint32) + if (sizeof(qint32) > (uint)dev->bytesAvailable()) + return; + + // Read size header + int read = dev->read((char *)&inProgressSize, sizeof(qint32)); + Q_ASSERT(read == sizeof(qint32)); + Q_UNUSED(read); + + // Check sizing constraints + if (inProgressSize > maxPacketSize) { + QObject::disconnect(dev, SIGNAL(readyRead()), + this, SLOT(readyToRead())); + QObject::disconnect(dev, SIGNAL(aboutToClose()), + this, SLOT(aboutToClose())); + QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), + this, SLOT(bytesWritten(qint64))); + dev = 0; + emit invalidPacket(); + return; + } + + inProgressSize -= sizeof(qint32); + } else { + inProgress.append(dev->read(inProgressSize - inProgress.size())); - emit readyRead(); - waitingForPacket = false; + if (inProgressSize == inProgress.size()) { + // Packet has arrived! + packets.append(inProgress); + inProgressSize = -1; + inProgress.clear(); - // Need to get trailing data - readyToRead(); + emit readyRead(); + } else + return; } } } -- cgit v0.12 From f564f2786ddea1cf9bdc5cceee68ff206f0c5c69 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Fri, 27 May 2011 17:40:16 +0200 Subject: QmlDebugger: adding slots to items in Live Preview Reviewed-by: Kai Koehne (reapplied commit 89d9b83aa26db4f528250c3fe4716b81955c6929 from qtcreator) Change-Id: I4cbfba2e854dd98a4e1012c71c40520f57fa9664 --- src/declarative/debugger/qdeclarativedebug.cpp | 5 +++-- src/declarative/debugger/qdeclarativedebug_p.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp index 32c2b47..620ee1d 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -638,14 +638,15 @@ QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult bool QDeclarativeEngineDebug::setBindingForObject(int objectDebugId, const QString &propertyName, const QVariant &bindingExpression, - bool isLiteralValue) + bool isLiteralValue, + QString source, int line) { Q_D(QDeclarativeEngineDebug); if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue; + ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue << source << line; d->client->sendMessage(message); return true; } else { diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index ae92d6a..f822637 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -101,7 +101,8 @@ public: const QString &expr, QObject *parent = 0); bool setBindingForObject(int objectDebugId, const QString &propertyName, - const QVariant &bindingExpression, bool isLiteralValue); + const QVariant &bindingExpression, bool isLiteralValue, + QString source = QString(), int line = -1); bool resetBindingForObject(int objectDebugId, const QString &propertyName); bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody); -- cgit v0.12 From 8fb90ce32dde5d4045c23ff44f29d19054db0d9b Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 30 May 2011 14:02:15 +0300 Subject: Fix for BCM2727 chip detection on Symbian QSymbianGraphcisSystemEx::hasBCM2727() uses bool QApplicationPrivate::useTranslucentEGLSurfaces to decide if Symbian is running on BCM2727 chip which is not entirely correct. bool QApplicationPrivate::useTranslucentEGLSurfaces should be assigned according to QSymbianGraphcisSystemEx::hasBCM2727() and QSymbianGraphcisSystemEx::hasBCM2727() should be also static function. Task-number: QTBUG-19578 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qapplication_s60.cpp | 23 ++++------------ src/gui/painting/qgraphicssystemex_symbian.cpp | 36 +++++++++++++++++++++----- src/gui/painting/qgraphicssystemex_symbian_p.h | 3 ++- src/opengl/qgl_symbian.cpp | 4 +-- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 96ac6f4..6d1b96f 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -74,6 +74,7 @@ # include # include "qs60mainappui.h" # include "qinputcontext.h" +# include #endif #if defined(Q_WS_S60) @@ -1835,26 +1836,12 @@ void qt_init(QApplicationPrivate * /* priv */, int) #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE QApplicationPrivate::instance()->useTranslucentEGLSurfaces = true; - const TUid KIvePropertyCat = {0x2726beef}; - enum TIvePropertyChipType { - EVCBCM2727B1 = 0x00000000, - EVCBCM2763A0 = 0x04000100, - EVCBCM2763B0 = 0x04000102, - EVCBCM2763C0 = 0x04000103, - EVCBCM2763C1 = 0x04000104, - EVCBCMUnknown = 0x7fffffff - }; - - TInt chipType = EVCBCMUnknown; - if (RProperty::Get(KIvePropertyCat, 0 /*chip type*/, chipType) == KErrNone) { - if (chipType == EVCBCM2727B1) { - // We have only 32MB GPU memory. Use raster surfaces - // for transparent TLWs. - QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; - } - } else { + if (QSymbianGraphicsSystemEx::hasBCM2727()) { + // We have only 32MB GPU memory. Use raster surfaces + // for transparent TLWs. QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; } + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; #else diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp index 980f72c..dc4dd92 100644 --- a/src/gui/painting/qgraphicssystemex_symbian.cpp +++ b/src/gui/painting/qgraphicssystemex_symbian.cpp @@ -45,10 +45,39 @@ #include "private/qapplication_p.h" #include "qwidget_p.h" -#include +#include QT_BEGIN_NAMESPACE +static bool bcm2727Initialized = false; +static bool bcm2727 = false; + +bool QSymbianGraphicsSystemEx::hasBCM2727() +{ + if (bcm2727Initialized) + return bcm2727; + + const TUid KIvePropertyCat = {0x2726beef}; + enum TIvePropertyChipType { + EVCBCM2727B1 = 0x00000000, + EVCBCM2763A0 = 0x04000100, + EVCBCM2763B0 = 0x04000102, + EVCBCM2763C0 = 0x04000103, + EVCBCM2763C1 = 0x04000104, + EVCBCMUnknown = 0x7fffffff + }; + + TInt chipType = EVCBCMUnknown; + if (RProperty::Get(KIvePropertyCat, 0, chipType) == KErrNone) { + if (chipType == EVCBCM2727B1) + bcm2727 = true; + } + + bcm2727Initialized = true; + + return bcm2727; +} + void QSymbianGraphicsSystemEx::releaseCachedGpuResources() { // Do nothing here @@ -65,11 +94,6 @@ void QSymbianGraphicsSystemEx::releaseAllGpuResources() } } -bool QSymbianGraphicsSystemEx::hasBCM2727() -{ - return !QApplicationPrivate::instance()->useTranslucentEGLSurfaces; -} - void QSymbianGraphicsSystemEx::forceToRaster(QWidget *window) { if (window && window->isWindow()) { diff --git a/src/gui/painting/qgraphicssystemex_symbian_p.h b/src/gui/painting/qgraphicssystemex_symbian_p.h index c1d1bdf..1f2a7c6 100644 --- a/src/gui/painting/qgraphicssystemex_symbian_p.h +++ b/src/gui/painting/qgraphicssystemex_symbian_p.h @@ -62,9 +62,10 @@ class QWidget; class Q_GUI_EXPORT QSymbianGraphicsSystemEx : public QGraphicsSystemEx { public: + static bool hasBCM2727(); + virtual void releaseCachedGpuResources(); virtual void releaseAllGpuResources(); - virtual bool hasBCM2727(); virtual void forceToRaster(QWidget *window); }; diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index 91904d0..86176c9 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -183,9 +183,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); - QGraphicsSystemEx *ex = QApplicationPrivate::graphicsSystem()->platformExtension(); - QSymbianGraphicsSystemEx *symex = static_cast(ex); - if (symex && !symex->hasBCM2727()) { + if (!QSymbianGraphicsSystemEx::hasBCM2727()) { // Most likely we have hw support for multisampling // so let's enable it. d->glFormat.setSampleBuffers(1); -- cgit v0.12 From 20dbb967f030041d1dc94b989b0b085ca84baa33 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 30 May 2011 14:23:00 +0300 Subject: Fix QHeaderView test case for VGA Symbian devices. Minimum section size is bigger than expected in VGA devices, which was not taken into accound in two test cases. Task-number: QT-5049 Reviewed-by: Sami Merila --- tests/auto/qheaderview/tst_qheaderview.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 3a659aa..52eeee4 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -563,7 +563,7 @@ void tst_QHeaderView::sectionSize() QFETCH(int, lastVisibleSectionSize); QFETCH(int, persistentSectionSize); -#ifdef Q_OS_WINCE +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) // We test on a device with doubled pixels. Therefore we need to specify // different boundaries. initialDefaultSize = qMax(view->minimumSectionSize(), 30); @@ -676,6 +676,16 @@ void tst_QHeaderView::visualIndexAt() QFETCH(QList, coordinate); QFETCH(QList, visual); +#ifdef Q_OS_SYMBIAN + // Some Symbian devices have larger minimum section size than what is expected. + // Need to do this here instead of visualIndexAt_data() as view pointer doesn't + // seem to be valid there. + int minSize = view->minimumSectionSize(); + if (minSize > 30) { + coordinate.clear(); + coordinate << -1 << 0 << minSize + 1 << (minSize * 3) + 1 << 99999; + } +#endif view->setStretchLastSection(true); topLevel->show(); -- cgit v0.12 From 206ebd5af21d94c3f3b49d2cb645105a63e6f5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 30 May 2011 12:51:45 +0200 Subject: Renamed declarativeobserver plugin to qmldbg_inspector Mainly since it's a good idea to prefix the plugin on Symbian, and at the same time it's now consistency called 'inspector' rather than 'observer'. Symbian .def files will need to be updated. Change-Id: I43071331c8002f8844efd14105d01c730d97e946 Reviewed-by: Kai Koehne --- src/declarative/debugger/debugger.pri | 6 +- .../debugger/qdeclarativeinspectorinterface_p.h | 69 ++ .../debugger/qdeclarativeinspectorservice.cpp | 137 +++ .../debugger/qdeclarativeinspectorservice_p.h | 91 ++ .../debugger/qdeclarativeobserverinterface_p.h | 69 -- .../debugger/qdeclarativeobserverservice.cpp | 137 --- .../debugger/qdeclarativeobserverservice_p.h | 91 -- src/declarative/util/qdeclarativeview.cpp | 6 +- .../declarativeobserver/declarativeobserver.pro | 51 - .../editor/abstractliveedittool.cpp | 195 ---- .../editor/abstractliveedittool_p.h | 119 --- .../editor/boundingrecthighlighter.cpp | 282 ------ .../editor/boundingrecthighlighter_p.h | 126 --- .../declarativeobserver/editor/colorpickertool.cpp | 131 --- .../declarativeobserver/editor/colorpickertool_p.h | 99 -- .../declarativeobserver/editor/editor.qrc | 24 - .../editor/images/color-picker-24.png | Bin 3440 -> 0 bytes .../editor/images/color-picker-hicontrast.png | Bin 3192 -> 0 bytes .../editor/images/color-picker.png | Bin 3173 -> 0 bytes .../editor/images/from-qml-24.png | Bin 3395 -> 0 bytes .../declarativeobserver/editor/images/from-qml.png | Bin 3205 -> 0 bytes .../editor/images/observermode-24.png | Bin 1283 -> 0 bytes .../editor/images/observermode.png | Bin 3539 -> 0 bytes .../declarativeobserver/editor/images/pause-24.png | Bin 3307 -> 0 bytes .../declarativeobserver/editor/images/pause.png | Bin 3097 -> 0 bytes .../declarativeobserver/editor/images/play-24.png | Bin 3655 -> 0 bytes .../declarativeobserver/editor/images/play.png | Bin 3363 -> 0 bytes .../declarativeobserver/editor/images/reload.png | Bin 3418 -> 0 bytes .../editor/images/resize_handle.png | Bin 160 -> 0 bytes .../editor/images/select-24.png | Bin 3510 -> 0 bytes .../editor/images/select-marquee-24.png | Bin 2891 -> 0 bytes .../editor/images/select-marquee.png | Bin 2871 -> 0 bytes .../declarativeobserver/editor/images/select.png | Bin 3308 -> 0 bytes .../editor/images/to-qml-24.png | Bin 3407 -> 0 bytes .../declarativeobserver/editor/images/to-qml.png | Bin 3227 -> 0 bytes .../declarativeobserver/editor/images/zoom-24.png | Bin 3566 -> 0 bytes .../declarativeobserver/editor/images/zoom.png | Bin 3347 -> 0 bytes .../declarativeobserver/editor/livelayeritem.cpp | 92 -- .../declarativeobserver/editor/livelayeritem_p.h | 73 -- .../editor/liverubberbandselectionmanipulator.cpp | 165 ---- .../editor/liverubberbandselectionmanipulator_p.h | 102 -- .../editor/liveselectionindicator.cpp | 117 --- .../editor/liveselectionindicator_p.h | 86 -- .../editor/liveselectionrectangle.cpp | 113 --- .../editor/liveselectionrectangle_p.h | 83 -- .../editor/liveselectiontool.cpp | 438 --------- .../editor/liveselectiontool_p.h | 126 --- .../editor/livesingleselectionmanipulator.cpp | 151 --- .../editor/livesingleselectionmanipulator_p.h | 95 -- .../declarativeobserver/editor/qmltoolbar.cpp | 328 ------- .../declarativeobserver/editor/qmltoolbar_p.h | 138 --- .../editor/subcomponentmasklayeritem.cpp | 130 --- .../editor/subcomponentmasklayeritem_p.h | 77 -- .../declarativeobserver/editor/toolbarcolorbox.cpp | 134 --- .../declarativeobserver/editor/toolbarcolorbox_p.h | 87 -- .../declarativeobserver/editor/zoomtool.cpp | 336 ------- .../declarativeobserver/editor/zoomtool_p.h | 113 --- .../qdeclarativeobserverplugin.cpp | 81 -- .../qdeclarativeobserverplugin.h | 71 -- .../qdeclarativeobserverprotocol.h | 143 --- .../qdeclarativeviewobserver.cpp | 1021 -------------------- .../qdeclarativeviewobserver_p.h | 147 --- .../qdeclarativeviewobserver_p_p.h | 152 --- .../declarativeobserver/qmlobserverconstants_p.h | 90 -- .../editor/abstractliveedittool.cpp | 195 ++++ .../editor/abstractliveedittool_p.h | 119 +++ .../editor/boundingrecthighlighter.cpp | 282 ++++++ .../editor/boundingrecthighlighter_p.h | 126 +++ .../qmldbg_inspector/editor/colorpickertool.cpp | 131 +++ .../qmldbg_inspector/editor/colorpickertool_p.h | 99 ++ .../qmltooling/qmldbg_inspector/editor/editor.qrc | 24 + .../editor/images/color-picker-24.png | Bin 0 -> 3440 bytes .../editor/images/color-picker-hicontrast.png | Bin 0 -> 3192 bytes .../editor/images/color-picker.png | Bin 0 -> 3173 bytes .../qmldbg_inspector/editor/images/from-qml-24.png | Bin 0 -> 3395 bytes .../qmldbg_inspector/editor/images/from-qml.png | Bin 0 -> 3205 bytes .../editor/images/inspectormode-24.png | Bin 0 -> 1283 bytes .../editor/images/inspectormode.png | Bin 0 -> 3539 bytes .../qmldbg_inspector/editor/images/pause-24.png | Bin 0 -> 3307 bytes .../qmldbg_inspector/editor/images/pause.png | Bin 0 -> 3097 bytes .../qmldbg_inspector/editor/images/play-24.png | Bin 0 -> 3655 bytes .../qmldbg_inspector/editor/images/play.png | Bin 0 -> 3363 bytes .../qmldbg_inspector/editor/images/reload.png | Bin 0 -> 3418 bytes .../editor/images/resize_handle.png | Bin 0 -> 160 bytes .../qmldbg_inspector/editor/images/select-24.png | Bin 0 -> 3510 bytes .../editor/images/select-marquee-24.png | Bin 0 -> 2891 bytes .../editor/images/select-marquee.png | Bin 0 -> 2871 bytes .../qmldbg_inspector/editor/images/select.png | Bin 0 -> 3308 bytes .../qmldbg_inspector/editor/images/to-qml-24.png | Bin 0 -> 3407 bytes .../qmldbg_inspector/editor/images/to-qml.png | Bin 0 -> 3227 bytes .../qmldbg_inspector/editor/images/zoom-24.png | Bin 0 -> 3566 bytes .../qmldbg_inspector/editor/images/zoom.png | Bin 0 -> 3347 bytes .../qmldbg_inspector/editor/livelayeritem.cpp | 92 ++ .../qmldbg_inspector/editor/livelayeritem_p.h | 73 ++ .../editor/liverubberbandselectionmanipulator.cpp | 165 ++++ .../editor/liverubberbandselectionmanipulator_p.h | 102 ++ .../editor/liveselectionindicator.cpp | 117 +++ .../editor/liveselectionindicator_p.h | 86 ++ .../editor/liveselectionrectangle.cpp | 113 +++ .../editor/liveselectionrectangle_p.h | 83 ++ .../qmldbg_inspector/editor/liveselectiontool.cpp | 438 +++++++++ .../qmldbg_inspector/editor/liveselectiontool_p.h | 126 +++ .../editor/livesingleselectionmanipulator.cpp | 151 +++ .../editor/livesingleselectionmanipulator_p.h | 95 ++ .../qmldbg_inspector/editor/qmltoolbar.cpp | 328 +++++++ .../qmldbg_inspector/editor/qmltoolbar_p.h | 138 +++ .../editor/subcomponentmasklayeritem.cpp | 130 +++ .../editor/subcomponentmasklayeritem_p.h | 77 ++ .../qmldbg_inspector/editor/toolbarcolorbox.cpp | 134 +++ .../qmldbg_inspector/editor/toolbarcolorbox_p.h | 87 ++ .../qmldbg_inspector/editor/zoomtool.cpp | 336 +++++++ .../qmldbg_inspector/editor/zoomtool_p.h | 113 +++ .../qdeclarativeinspectorplugin.cpp | 81 ++ .../qmldbg_inspector/qdeclarativeinspectorplugin.h | 71 ++ .../qdeclarativeinspectorprotocol.h | 143 +++ .../qmldbg_inspector/qdeclarativeviewinspector.cpp | 1021 ++++++++++++++++++++ .../qmldbg_inspector/qdeclarativeviewinspector_p.h | 147 +++ .../qdeclarativeviewinspector_p_p.h | 152 +++ .../qmldbg_inspector/qmldbg_inspector.pro | 51 + .../qmldbg_inspector/qmlinspectorconstants_p.h | 90 ++ src/plugins/qmltooling/qmltooling.pro | 2 +- 121 files changed, 6020 insertions(+), 6020 deletions(-) create mode 100644 src/declarative/debugger/qdeclarativeinspectorinterface_p.h create mode 100644 src/declarative/debugger/qdeclarativeinspectorservice.cpp create mode 100644 src/declarative/debugger/qdeclarativeinspectorservice_p.h delete mode 100644 src/declarative/debugger/qdeclarativeobserverinterface_p.h delete mode 100644 src/declarative/debugger/qdeclarativeobserverservice.cpp delete mode 100644 src/declarative/debugger/qdeclarativeobserverservice_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/editor.qrc delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/pause.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/play.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/reload.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/select.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp delete mode 100644 src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h delete mode 100644 src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 044db3c..3134c79 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -9,7 +9,7 @@ SOURCES += \ $$PWD/qdeclarativedebugtrace.cpp \ $$PWD/qdeclarativedebughelper.cpp \ $$PWD/qdeclarativedebugserver.cpp \ - $$PWD/qdeclarativeobserverservice.cpp \ + $$PWD/qdeclarativeinspectorservice.cpp \ $$PWD/qjsdebuggeragent.cpp \ $$PWD/qjsdebugservice.cpp @@ -24,7 +24,7 @@ HEADERS += \ $$PWD/qdeclarativedebughelper_p.h \ $$PWD/qdeclarativedebugserver_p.h \ $$PWD/qdeclarativedebugserverconnection_p.h \ - $$PWD/qdeclarativeobserverservice_p.h \ - $$PWD/qdeclarativeobserverinterface_p.h \ + $$PWD/qdeclarativeinspectorservice_p.h \ + $$PWD/qdeclarativeinspectorinterface_p.h \ $$PWD/qjsdebuggeragent_p.h \ $$PWD/qjsdebugservice_p.h diff --git a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h new file mode 100644 index 0000000..aa29d68 --- /dev/null +++ b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEOBSERVERINTERFACE_H +#define QDECLARATIVEOBSERVERINTERFACE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class Q_DECLARATIVE_EXPORT QDeclarativeInspectorInterface +{ +public: + QDeclarativeInspectorInterface() {} + virtual ~QDeclarativeInspectorInterface() {} + + virtual void activate() = 0; + virtual void deactivate() = 0; +}; + +Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, "com.trolltech.Qt.QDeclarativeInspectorInterface/1.0") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEOBSERVERINTERFACE_H diff --git a/src/declarative/debugger/qdeclarativeinspectorservice.cpp b/src/declarative/debugger/qdeclarativeinspectorservice.cpp new file mode 100644 index 0000000..9fec006 --- /dev/null +++ b/src/declarative/debugger/qdeclarativeinspectorservice.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qdeclarativeinspectorservice_p.h" +#include "private/qdeclarativeinspectorinterface_p.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance) + +QDeclarativeInspectorService::QDeclarativeInspectorService() + : QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode")) + , m_inspectorPlugin(0) +{ +} + +QDeclarativeInspectorService *QDeclarativeInspectorService::instance() +{ + return serviceInstance(); +} + +void QDeclarativeInspectorService::addView(QDeclarativeView *view) +{ + m_views.append(view); +} + +void QDeclarativeInspectorService::removeView(QDeclarativeView *view) +{ + m_views.removeAll(view); +} + +void QDeclarativeInspectorService::sendMessage(const QByteArray &message) +{ + if (status() != Enabled) + return; + + QDeclarativeDebugService::sendMessage(message); +} + +void QDeclarativeInspectorService::statusChanged(Status status) +{ + if (m_views.isEmpty()) + return; + + if (status == Enabled) { + if (!m_inspectorPlugin) + m_inspectorPlugin = loadInspectorPlugin(); + + if (!m_inspectorPlugin) { + qWarning() << "Error while loading inspector plugin"; + return; + } + + m_inspectorPlugin->activate(); + } else { + if (m_inspectorPlugin) + m_inspectorPlugin->deactivate(); + } +} + +void QDeclarativeInspectorService::messageReceived(const QByteArray &message) +{ + emit gotMessage(message); +} + +QDeclarativeInspectorInterface *QDeclarativeInspectorService::loadInspectorPlugin() +{ + QStringList pluginCandidates; + const QStringList paths = QCoreApplication::libraryPaths(); + foreach (const QString &libPath, paths) { + const QDir dir(libPath + QLatin1String("/qmltooling")); + if (dir.exists()) + foreach (const QString &pluginPath, dir.entryList(QDir::Files)) + pluginCandidates << dir.absoluteFilePath(pluginPath); + } + + foreach (const QString &pluginPath, pluginCandidates) { + QPluginLoader loader(pluginPath); + if (!loader.load()) + continue; + + QDeclarativeInspectorInterface *inspector = + qobject_cast(loader.instance()); + + if (inspector) + return inspector; + loader.unload(); + } + return 0; +} + +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativeinspectorservice_p.h b/src/declarative/debugger/qdeclarativeinspectorservice_p.h new file mode 100644 index 0000000..9fe0d601f --- /dev/null +++ b/src/declarative/debugger/qdeclarativeinspectorservice_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEOBSERVERSERVICE_H +#define QDECLARATIVEOBSERVERSERVICE_H + +#include "private/qdeclarativedebugservice_p.h" +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeView; +class QDeclarativeInspectorInterface; + +class Q_DECLARATIVE_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService +{ + Q_OBJECT + +public: + QDeclarativeInspectorService(); + static QDeclarativeInspectorService *instance(); + + void addView(QDeclarativeView *); + void removeView(QDeclarativeView *); + QList views() const { return m_views; } + + void sendMessage(const QByteArray &message); + +Q_SIGNALS: + void gotMessage(const QByteArray &message); + +protected: + virtual void statusChanged(Status status); + virtual void messageReceived(const QByteArray &); + +private: + static QDeclarativeInspectorInterface *loadInspectorPlugin(); + + QList m_views; + QDeclarativeInspectorInterface *m_inspectorPlugin; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEOBSERVERSERVICE_H diff --git a/src/declarative/debugger/qdeclarativeobserverinterface_p.h b/src/declarative/debugger/qdeclarativeobserverinterface_p.h deleted file mode 100644 index efb47fa..0000000 --- a/src/declarative/debugger/qdeclarativeobserverinterface_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEOBSERVERINTERFACE_H -#define QDECLARATIVEOBSERVERINTERFACE_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QDeclarativeObserverInterface -{ -public: - QDeclarativeObserverInterface() {} - virtual ~QDeclarativeObserverInterface() {} - - virtual void activate() = 0; - virtual void deactivate() = 0; -}; - -Q_DECLARE_INTERFACE(QDeclarativeObserverInterface, "com.trolltech.Qt.QDeclarativeObserverInterface/1.0") - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEOBSERVERINTERFACE_H diff --git a/src/declarative/debugger/qdeclarativeobserverservice.cpp b/src/declarative/debugger/qdeclarativeobserverservice.cpp deleted file mode 100644 index 43d9281..0000000 --- a/src/declarative/debugger/qdeclarativeobserverservice.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "private/qdeclarativeobserverservice_p.h" -#include "private/qdeclarativeobserverinterface_p.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QDeclarativeObserverService, serviceInstance) - -QDeclarativeObserverService::QDeclarativeObserverService() - : QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode")) - , m_observer(0) -{ -} - -QDeclarativeObserverService *QDeclarativeObserverService::instance() -{ - return serviceInstance(); -} - -void QDeclarativeObserverService::addView(QDeclarativeView *view) -{ - m_views.append(view); -} - -void QDeclarativeObserverService::removeView(QDeclarativeView *view) -{ - m_views.removeAll(view); -} - -void QDeclarativeObserverService::sendMessage(const QByteArray &message) -{ - if (status() != Enabled) - return; - - QDeclarativeDebugService::sendMessage(message); -} - -void QDeclarativeObserverService::statusChanged(Status status) -{ - if (m_views.isEmpty()) - return; - - if (status == Enabled) { - if (!m_observer) - m_observer = loadObserverPlugin(); - - if (!m_observer) { - qWarning() << "Error while loading observer plugin"; - return; - } - - m_observer->activate(); - } else { - if (m_observer) - m_observer->deactivate(); - } -} - -void QDeclarativeObserverService::messageReceived(const QByteArray &message) -{ - emit gotMessage(message); -} - -QDeclarativeObserverInterface *QDeclarativeObserverService::loadObserverPlugin() -{ - QStringList pluginCandidates; - const QStringList paths = QCoreApplication::libraryPaths(); - foreach (const QString &libPath, paths) { - const QDir dir(libPath + QLatin1String("/qmltooling")); - if (dir.exists()) - foreach (const QString &pluginPath, dir.entryList(QDir::Files)) - pluginCandidates << dir.absoluteFilePath(pluginPath); - } - - foreach (const QString &pluginPath, pluginCandidates) { - QPluginLoader loader(pluginPath); - if (!loader.load()) - continue; - - QDeclarativeObserverInterface *observer = - qobject_cast(loader.instance()); - - if (observer) - return observer; - loader.unload(); - } - return 0; -} - -QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativeobserverservice_p.h b/src/declarative/debugger/qdeclarativeobserverservice_p.h deleted file mode 100644 index c883d4b..0000000 --- a/src/declarative/debugger/qdeclarativeobserverservice_p.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEOBSERVERSERVICE_H -#define QDECLARATIVEOBSERVERSERVICE_H - -#include "private/qdeclarativedebugservice_p.h" -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeView; -class QDeclarativeObserverInterface; - -class Q_DECLARATIVE_EXPORT QDeclarativeObserverService : public QDeclarativeDebugService -{ - Q_OBJECT - -public: - QDeclarativeObserverService(); - static QDeclarativeObserverService *instance(); - - void addView(QDeclarativeView *); - void removeView(QDeclarativeView *); - QList views() const { return m_views; } - - void sendMessage(const QByteArray &message); - -Q_SIGNALS: - void gotMessage(const QByteArray &message); - -protected: - virtual void statusChanged(Status status); - virtual void messageReceived(const QByteArray &); - -private: - static QDeclarativeObserverInterface *loadObserverPlugin(); - - QList m_views; - QDeclarativeObserverInterface *m_observer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEOBSERVERSERVICE_H diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index f6be2d7..bab991b 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include @@ -301,7 +301,7 @@ void QDeclarativeViewPrivate::init() q->viewport()->setAttribute(Qt::WA_NoSystemBackground); #endif - QDeclarativeObserverService::instance()->addView(q); + QDeclarativeInspectorService::instance()->addView(q); } /*! @@ -309,7 +309,7 @@ void QDeclarativeViewPrivate::init() */ QDeclarativeView::~QDeclarativeView() { - QDeclarativeObserverService::instance()->removeView(this); + QDeclarativeInspectorService::instance()->removeView(this); } /*! \property QDeclarativeView::source diff --git a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro b/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro deleted file mode 100644 index e7a69f2..0000000 --- a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro +++ /dev/null @@ -1,51 +0,0 @@ -TARGET = declarativeobserver -QT += declarative - -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling -QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" - -SOURCES += \ - qdeclarativeobserverplugin.cpp \ - qdeclarativeviewobserver.cpp \ - editor/abstractliveedittool.cpp \ - editor/liveselectiontool.cpp \ - editor/livelayeritem.cpp \ - editor/livesingleselectionmanipulator.cpp \ - editor/liverubberbandselectionmanipulator.cpp \ - editor/liveselectionrectangle.cpp \ - editor/liveselectionindicator.cpp \ - editor/boundingrecthighlighter.cpp \ - editor/subcomponentmasklayeritem.cpp \ - editor/zoomtool.cpp \ - editor/colorpickertool.cpp \ - editor/qmltoolbar.cpp \ - editor/toolbarcolorbox.cpp - -HEADERS += \ - qdeclarativeobserverplugin.h \ - qdeclarativeobserverprotocol.h \ - qdeclarativeviewobserver_p.h \ - qdeclarativeviewobserver_p_p.h \ - qmlobserverconstants_p.h \ - editor/abstractliveedittool_p.h \ - editor/liveselectiontool_p.h \ - editor/livelayeritem_p.h \ - editor/livesingleselectionmanipulator_p.h \ - editor/liverubberbandselectionmanipulator_p.h \ - editor/liveselectionrectangle_p.h \ - editor/liveselectionindicator_p.h \ - editor/boundingrecthighlighter_p.h \ - editor/subcomponentmasklayeritem_p.h \ - editor/zoomtool_p.h \ - editor/colorpickertool_p.h \ - editor/qmltoolbar_p.h \ - editor/toolbarcolorbox_p.h - -RESOURCES += editor/editor.qrc - -target.path += $$[QT_INSTALL_PLUGINS]/qmltooling -INSTALLS += target - -symbian:TARGET.UID3=0x20031E90 diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp deleted file mode 100644 index a97a537..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "abstractliveedittool_p.h" -#include "../qdeclarativeviewobserver_p_p.h" - -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewObserver *editorView) - : QObject(editorView), m_observer(editorView) -{ -} - - -AbstractLiveEditTool::~AbstractLiveEditTool() -{ -} - -QDeclarativeViewObserver *AbstractLiveEditTool::observer() const -{ - return m_observer; -} - -QDeclarativeView *AbstractLiveEditTool::view() const -{ - return m_observer->declarativeView(); -} - -QGraphicsScene* AbstractLiveEditTool::scene() const -{ - return view()->scene(); -} - -void AbstractLiveEditTool::updateSelectedItems() -{ - selectedItemsChanged(items()); -} - -QList AbstractLiveEditTool::items() const -{ - return observer()->selectedItems(); -} - -bool AbstractLiveEditTool::topItemIsMovable(const QList & itemList) -{ - QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); - if (firstSelectableItem == 0) - return false; - if (toQDeclarativeItem(firstSelectableItem) != 0) - return true; - - return false; - -} - -bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList &itemList) -{ - QList selectedItems = observer()->selectedItems(); - - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem - && selectedItems.contains(declarativeItem) - /*&& (declarativeItem->qmlItemNode().hasShowContent() || selectNonContentItems)*/) - return true; - } - - return false; - -} - -bool AbstractLiveEditTool::topItemIsResizeHandle(const QList &/*itemList*/) -{ - return false; -} - -QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item) -{ - return qobject_cast(item->toGraphicsObject()); -} - -QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - if (item->flags().testFlag(QGraphicsItem::ItemIsMovable)) - return item; - } - return 0; -} - -QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList - &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/) - return declarativeItem; - } - - return 0; -} - -QList AbstractLiveEditTool::toGraphicsObjectList(const QList - &itemList) -{ - QList gfxObjects; - foreach (QGraphicsItem *item, itemList) { - QGraphicsObject *obj = item->toGraphicsObject(); - if (obj) - gfxObjects << obj; - } - - return gfxObjects; -} - -QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) -{ - QString className(QLatin1String("QGraphicsItem")); - QString objectStringId; - - QString constructedName; - - QGraphicsObject *gfxObject = item->toGraphicsObject(); - if (gfxObject) { - className = QLatin1String(gfxObject->metaObject()->className()); - - className.remove(QRegExp(QLatin1String("_QMLTYPE_\\d+"))); - className.remove(QRegExp(QLatin1String("_QML_\\d+"))); - if (className.startsWith(QLatin1String("QDeclarative"))) - className = className.remove(QLatin1String("QDeclarative")); - - QDeclarativeItem *declarativeItem = qobject_cast(gfxObject); - if (declarativeItem) { - objectStringId = m_observer->idStringForObject(declarativeItem); - } - - if (!objectStringId.isEmpty()) { - constructedName = objectStringId + QLatin1String(" (") + className + QLatin1Char(')'); - } else { - if (!gfxObject->objectName().isEmpty()) { - constructedName = gfxObject->objectName() + QLatin1String(" (") + className + QLatin1Char(')'); - } else { - constructedName = className; - } - } - } - - return constructedName; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h deleted file mode 100644 index 97aac35..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ABSTRACTLIVEEDITTOOL_H -#define ABSTRACTLIVEEDITTOOL_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QMouseEvent; -class QGraphicsItem; -class QDeclarativeItem; -class QKeyEvent; -class QGraphicsScene; -class QGraphicsObject; -class QWheelEvent; -class QDeclarativeView; -QT_END_NAMESPACE - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; - -class AbstractLiveEditTool : public QObject -{ - Q_OBJECT -public: - AbstractLiveEditTool(QDeclarativeViewObserver *observer); - - virtual ~AbstractLiveEditTool(); - - virtual void mousePressEvent(QMouseEvent *event) = 0; - virtual void mouseMoveEvent(QMouseEvent *event) = 0; - virtual void mouseReleaseEvent(QMouseEvent *event) = 0; - virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0; - - virtual void hoverMoveEvent(QMouseEvent *event) = 0; - virtual void wheelEvent(QWheelEvent *event) = 0; - - virtual void keyPressEvent(QKeyEvent *event) = 0; - virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0; - virtual void itemsAboutToRemoved(const QList &itemList) = 0; - - virtual void clear() = 0; - - void updateSelectedItems(); - QList items() const; - - bool topItemIsMovable(const QList &itemList); - bool topItemIsResizeHandle(const QList &itemList); - bool topSelectedItemIsMovable(const QList &itemList); - - QString titleForItem(QGraphicsItem *item); - - static QList toGraphicsObjectList(const QList &itemList); - static QGraphicsItem* topMovableGraphicsItem(const QList &itemList); - static QDeclarativeItem* topMovableDeclarativeItem(const QList &itemList); - static QDeclarativeItem *toQDeclarativeItem(QGraphicsItem *item); - -protected: - virtual void selectedItemsChanged(const QList &objectList) = 0; - - QDeclarativeViewObserver *observer() const; - QDeclarativeView *view() const; - QGraphicsScene *scene() const; - -private: - QDeclarativeViewObserver *m_observer; - QList m_itemList; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // ABSTRACTLIVEEDITTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp deleted file mode 100644 index e9594d5..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "boundingrecthighlighter_p.h" - -#include "../qdeclarativeviewobserver_p.h" -#include "../qmlobserverconstants_p.h" - -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -const qreal AnimDelta = 0.025f; -const int AnimInterval = 30; -const int AnimFrames = 10; - -BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent) - : QObject(parent), - highlightedObject(itemToHighlight), - highlightPolygon(0), - highlightPolygonEdge(0) -{ - highlightPolygon = new BoundingBoxPolygonItem(parentItem); - highlightPolygonEdge = new BoundingBoxPolygonItem(parentItem); - - highlightPolygon->setPen(QPen(QColor(0, 22, 159))); - highlightPolygonEdge->setPen(QPen(QColor(158, 199, 255))); - - highlightPolygon->setFlag(QGraphicsItem::ItemIsSelectable, false); - highlightPolygonEdge->setFlag(QGraphicsItem::ItemIsSelectable, false); -} - -BoundingBox::~BoundingBox() -{ - highlightedObject.clear(); -} - -BoundingBoxPolygonItem::BoundingBoxPolygonItem(QGraphicsItem *item) : QGraphicsPolygonItem(item) -{ - QPen pen; - pen.setColor(QColor(108, 141, 221)); - pen.setWidth(1); - setPen(pen); -} - -int BoundingBoxPolygonItem::type() const -{ - return Constants::EditorItemType; -} - -BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewObserver *view) : - LiveLayerItem(view->declarativeView()->scene()), - m_view(view), - m_animFrame(0) -{ - m_animTimer = new QTimer(this); - m_animTimer->setInterval(AnimInterval); - connect(m_animTimer, SIGNAL(timeout()), SLOT(animTimeout())); -} - -BoundingRectHighlighter::~BoundingRectHighlighter() -{ - -} - -void BoundingRectHighlighter::animTimeout() -{ - ++m_animFrame; - if (m_animFrame == AnimFrames) { - m_animTimer->stop(); - } - - qreal alpha = m_animFrame / float(AnimFrames); - - foreach (BoundingBox *box, m_boxes) { - box->highlightPolygonEdge->setOpacity(alpha); - } -} - -void BoundingRectHighlighter::clear() -{ - if (m_boxes.length()) { - m_animTimer->stop(); - - foreach (BoundingBox *box, m_boxes) { - freeBoundingBox(box); - } - } -} - -BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const -{ - foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == item) { - return box; - } - } - return 0; -} - -void BoundingRectHighlighter::highlight(QList items) -{ - if (items.isEmpty()) - return; - - bool animate = false; - - QList newBoxes; - foreach (QGraphicsObject *itemToHighlight, items) { - BoundingBox *box = boxFor(itemToHighlight); - if (!box) { - box = createBoundingBox(itemToHighlight); - animate = true; - } - - newBoxes << box; - } - qSort(newBoxes); - - if (newBoxes != m_boxes) { - clear(); - m_boxes << newBoxes; - } - - highlightAll(animate); -} - -void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) -{ - if (!itemToHighlight) - return; - - bool animate = false; - - BoundingBox *box = boxFor(itemToHighlight); - if (!box) { - box = createBoundingBox(itemToHighlight); - m_boxes << box; - animate = true; - qSort(m_boxes); - } - - highlightAll(animate); -} - -BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight) -{ - if (!m_freeBoxes.isEmpty()) { - BoundingBox *box = m_freeBoxes.last(); - if (box->highlightedObject.isNull()) { - box->highlightedObject = itemToHighlight; - box->highlightPolygon->show(); - box->highlightPolygonEdge->show(); - m_freeBoxes.removeLast(); - return box; - } - } - - BoundingBox *box = new BoundingBox(itemToHighlight, this, this); - - connect(itemToHighlight, SIGNAL(xChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(yChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(widthChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(heightChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(rotationChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*))); - - return box; -} - -void BoundingRectHighlighter::removeBoundingBox(BoundingBox *box) -{ - delete box; - box = 0; -} - -void BoundingRectHighlighter::freeBoundingBox(BoundingBox *box) -{ - if (!box->highlightedObject.isNull()) { - disconnect(box->highlightedObject.data(), SIGNAL(xChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(yChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(widthChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(heightChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(rotationChanged()), this, SLOT(refresh())); - } - - box->highlightedObject.clear(); - box->highlightPolygon->hide(); - box->highlightPolygonEdge->hide(); - m_boxes.removeOne(box); - m_freeBoxes << box; -} - -void BoundingRectHighlighter::itemDestroyed(QObject *obj) -{ - foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == obj) { - freeBoundingBox(box); - break; - } - } -} - -void BoundingRectHighlighter::highlightAll(bool animate) -{ - foreach (BoundingBox *box, m_boxes) { - if (box && box->highlightedObject.isNull()) { - // clear all highlights - clear(); - return; - } - QGraphicsObject *item = box->highlightedObject.data(); - - QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); - QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); - QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); - QRectF edgeRect = bboxRect; - edgeRect.adjust(-1, -1, 1, 1); - - box->highlightPolygon->setPolygon(QPolygonF(bboxRect)); - box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect)); - - if (animate) - box->highlightPolygonEdge->setOpacity(0); - } - - if (animate) { - m_animFrame = 0; - m_animTimer->start(); - } -} - -void BoundingRectHighlighter::refresh() -{ - if (!m_boxes.isEmpty()) - highlightAll(true); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h b/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h deleted file mode 100644 index ab7e595..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter_p.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BOUNDINGRECTHIGHLIGHTER_H -#define BOUNDINGRECTHIGHLIGHTER_H - -#include "livelayeritem_p.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QPainter) -QT_FORWARD_DECLARE_CLASS(QWidget) -QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QTimer) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; -class BoundingBox; - -class BoundingRectHighlighter : public LiveLayerItem -{ - Q_OBJECT -public: - explicit BoundingRectHighlighter(QDeclarativeViewObserver *view); - ~BoundingRectHighlighter(); - void clear(); - void highlight(QList items); - void highlight(QGraphicsObject* item); - -private slots: - void refresh(); - void animTimeout(); - void itemDestroyed(QObject *); - -private: - BoundingBox *boxFor(QGraphicsObject *item) const; - void highlightAll(bool animate); - BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight); - void removeBoundingBox(BoundingBox *box); - void freeBoundingBox(BoundingBox *box); - -private: - Q_DISABLE_COPY(BoundingRectHighlighter) - - QDeclarativeViewObserver *m_view; - QList m_boxes; - QList m_freeBoxes; - QTimer *m_animTimer; - qreal m_animScale; - int m_animFrame; - -}; - -class BoundingBox : public QObject -{ - Q_OBJECT -public: - explicit BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent = 0); - ~BoundingBox(); - QWeakPointer highlightedObject; - QGraphicsPolygonItem *highlightPolygon; - QGraphicsPolygonItem *highlightPolygonEdge; - -private: - Q_DISABLE_COPY(BoundingBox) - -}; - -class BoundingBoxPolygonItem : public QGraphicsPolygonItem -{ -public: - explicit BoundingBoxPolygonItem(QGraphicsItem *item); - int type() const; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // BOUNDINGRECTHIGHLIGHTER_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp deleted file mode 100644 index 50d724e..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "colorpickertool_p.h" - -#include "../qdeclarativeviewobserver_p.h" - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -ColorPickerTool::ColorPickerTool(QDeclarativeViewObserver *view) : - AbstractLiveEditTool(view) -{ - m_selectedColor.setRgb(0,0,0); -} - -ColorPickerTool::~ColorPickerTool() -{ - -} - -void ColorPickerTool::mousePressEvent(QMouseEvent * /*event*/) -{ -} - -void ColorPickerTool::mouseMoveEvent(QMouseEvent *event) -{ - pickColor(event->pos()); -} - -void ColorPickerTool::mouseReleaseEvent(QMouseEvent *event) -{ - pickColor(event->pos()); -} - -void ColorPickerTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ -} - - -void ColorPickerTool::hoverMoveEvent(QMouseEvent * /*event*/) -{ -} - -void ColorPickerTool::keyPressEvent(QKeyEvent * /*event*/) -{ -} - -void ColorPickerTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ -} -void ColorPickerTool::wheelEvent(QWheelEvent * /*event*/) -{ -} - -void ColorPickerTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ -} - -void ColorPickerTool::clear() -{ - view()->setCursor(Qt::CrossCursor); -} - -void ColorPickerTool::selectedItemsChanged(const QList &/*itemList*/) -{ -} - -void ColorPickerTool::pickColor(const QPoint &pos) -{ - QRgb fillColor = view()->backgroundBrush().color().rgb(); - if (view()->backgroundBrush().style() == Qt::NoBrush) - fillColor = view()->palette().color(QPalette::Base).rgb(); - - QRectF target(0,0, 1, 1); - QRect source(pos.x(), pos.y(), 1, 1); - QImage img(1, 1, QImage::Format_ARGB32); - img.fill(fillColor); - QPainter painter(&img); - view()->render(&painter, target, source); - m_selectedColor = QColor::fromRgb(img.pixel(0, 0)); - - emit selectedColorChanged(m_selectedColor); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h deleted file mode 100644 index b955eee..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/colorpickertool_p.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef COLORPICKERTOOL_H -#define COLORPICKERTOOL_H - -#include "abstractliveedittool_p.h" - -#include - -QT_FORWARD_DECLARE_CLASS(QPoint) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ColorPickerTool : public AbstractLiveEditTool -{ - Q_OBJECT -public: - explicit ColorPickerTool(QDeclarativeViewObserver *view); - - virtual ~ColorPickerTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - - void wheelEvent(QWheelEvent *event); - - void itemsAboutToRemoved(const QList &itemList); - - void clear(); - -signals: - void selectedColorChanged(const QColor &color); - -protected: - - void selectedItemsChanged(const QList &itemList); - -private: - void pickColor(const QPoint &pos); - -private: - QColor m_selectedColor; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // COLORPICKERTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/editor.qrc b/src/plugins/qmltooling/declarativeobserver/editor/editor.qrc deleted file mode 100644 index 77744d5..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/editor.qrc +++ /dev/null @@ -1,24 +0,0 @@ - - - images/resize_handle.png - images/select.png - images/select-marquee.png - images/color-picker.png - images/play.png - images/pause.png - images/from-qml.png - images/to-qml.png - images/color-picker-hicontrast.png - images/zoom.png - images/color-picker-24.png - images/from-qml-24.png - images/pause-24.png - images/play-24.png - images/to-qml-24.png - images/zoom-24.png - images/select-24.png - images/select-marquee-24.png - images/observermode.png - images/observermode-24.png - - diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png deleted file mode 100644 index cff4721..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png b/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png deleted file mode 100644 index b953d08..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker-hicontrast.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png b/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png deleted file mode 100644 index 026c31b..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/color-picker.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png deleted file mode 100644 index 0ad21f3..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png b/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png deleted file mode 100644 index 666382c..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/from-qml.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png deleted file mode 100644 index 5e74d86..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png b/src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png deleted file mode 100644 index daed21c..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/observermode.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png deleted file mode 100644 index d9a2f6f..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/pause-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/pause.png b/src/plugins/qmltooling/declarativeobserver/editor/images/pause.png deleted file mode 100644 index 114d89b..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/pause.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png deleted file mode 100644 index e2b9fbc..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/play-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/play.png b/src/plugins/qmltooling/declarativeobserver/editor/images/play.png deleted file mode 100644 index 011598a..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/play.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/reload.png b/src/plugins/qmltooling/declarativeobserver/editor/images/reload.png deleted file mode 100644 index 7042bec..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/reload.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png b/src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png deleted file mode 100644 index 2934f25..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/resize_handle.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png deleted file mode 100644 index 5388a9d..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/select-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png deleted file mode 100644 index 0111dda..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png b/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png deleted file mode 100644 index 92fe40d..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/select-marquee.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/select.png b/src/plugins/qmltooling/declarativeobserver/editor/images/select.png deleted file mode 100644 index 6722855..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/select.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png deleted file mode 100644 index b72450d..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png b/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png deleted file mode 100644 index 2ab951f..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/to-qml.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png b/src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png deleted file mode 100644 index 0346200..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom-24.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png b/src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png deleted file mode 100644 index 17f0da6..0000000 Binary files a/src/plugins/qmltooling/declarativeobserver/editor/images/zoom.png and /dev/null differ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp b/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp deleted file mode 100644 index 73cc5a0..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "livelayeritem_p.h" - -#include "../qmlobserverconstants_p.h" - -#include - -QT_BEGIN_NAMESPACE - -LiveLayerItem::LiveLayerItem(QGraphicsScene* scene) - : QGraphicsObject() -{ - scene->addItem(this); - setZValue(1); - setFlag(QGraphicsItem::ItemIsMovable, false); -} - -LiveLayerItem::~LiveLayerItem() -{ -} - -void LiveLayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, - QWidget * /*widget*/) -{ -} - -int LiveLayerItem::type() const -{ - return Constants::EditorItemType; -} - -QRectF LiveLayerItem::boundingRect() const -{ - return childrenBoundingRect(); -} - -QList LiveLayerItem::findAllChildItems() const -{ - return findAllChildItems(this); -} - -QList LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const -{ - QList itemList(item->childItems()); - - foreach (QGraphicsItem *childItem, item->childItems()) - itemList += findAllChildItems(childItem); - - return itemList; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h b/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h deleted file mode 100644 index da622e1..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/livelayeritem_p.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LIVELAYERITEM_H -#define LIVELAYERITEM_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class LiveLayerItem : public QGraphicsObject -{ -public: - LiveLayerItem(QGraphicsScene *scene); - ~LiveLayerItem(); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - QRectF boundingRect() const; - int type() const; - - QList findAllChildItems() const; - -protected: - QList findAllChildItems(const QGraphicsItem *item) const; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // LIVELAYERITEM_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp deleted file mode 100644 index 18341de..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "liverubberbandselectionmanipulator_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewObserver *editorView) - : m_selectionRectangleElement(layerItem), - m_editorView(editorView), - m_beginFormEditorItem(0), - m_isActive(false) -{ - m_selectionRectangleElement.hide(); -} - -void LiveRubberBandSelectionManipulator::clear() -{ - m_selectionRectangleElement.clear(); - m_isActive = false; - m_beginPoint = QPointF(); - m_itemList.clear(); - m_oldSelectionList.clear(); -} - -QGraphicsItem *LiveRubberBandSelectionManipulator::topFormEditorItem(const QList - &itemList) -{ - if (itemList.isEmpty()) - return 0; - - return itemList.first(); -} - -void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint) -{ - m_beginPoint = beginPoint; - m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint); - m_selectionRectangleElement.show(); - m_isActive = true; - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(m_editorView); - m_beginFormEditorItem = topFormEditorItem(observerPrivate->selectableItems(beginPoint)); - m_oldSelectionList = m_editorView->selectedItems(); -} - -void LiveRubberBandSelectionManipulator::update(const QPointF &updatePoint) -{ - m_selectionRectangleElement.setRect(m_beginPoint, updatePoint); -} - -void LiveRubberBandSelectionManipulator::end() -{ - m_oldSelectionList.clear(); - m_selectionRectangleElement.hide(); - m_isActive = false; -} - -void LiveRubberBandSelectionManipulator::select(SelectionType selectionType) -{ - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(m_editorView); - QList itemList - = observerPrivate->selectableItems(m_selectionRectangleElement.rect(), - Qt::IntersectsItemShape); - QList newSelectionList; - - foreach (QGraphicsItem* item, itemList) { - if (item - && item->parentItem() - && !newSelectionList.contains(item) - //&& m_beginFormEditorItem->childItems().contains(item) // TODO activate this test - ) - { - newSelectionList.append(item); - } - } - - if (newSelectionList.isEmpty() && m_beginFormEditorItem) - newSelectionList.append(m_beginFormEditorItem); - - QList resultList; - - switch (selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - resultList.append(newSelectionList); - } - break; - case ReplaceSelection: { - resultList.append(newSelectionList); - } - break; - case RemoveFromSelection: { - QSet oldSelectionSet(m_oldSelectionList.toSet()); - QSet newSelectionSet(newSelectionList.toSet()); - resultList.append(oldSelectionSet.subtract(newSelectionSet).toList()); - } - } - - m_editorView->setSelectedItems(resultList); -} - - -void LiveRubberBandSelectionManipulator::setItems(const QList &itemList) -{ - m_itemList = itemList; -} - -QPointF LiveRubberBandSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -bool LiveRubberBandSelectionManipulator::isActive() const -{ - return m_isActive; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h b/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h deleted file mode 100644 index a71caa2..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liverubberbandselectionmanipulator_p.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef RUBBERBANDSELECTIONMANIPULATOR_H -#define RUBBERBANDSELECTIONMANIPULATOR_H - -#include "liveselectionrectangle_p.h" - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; - -class LiveRubberBandSelectionManipulator -{ -public: - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection - }; - - LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewObserver *editorView); - - void setItems(const QList &itemList); - - void begin(const QPointF& beginPoint); - void update(const QPointF& updatePoint); - void end(); - - void clear(); - - void select(SelectionType selectionType); - - QPointF beginPoint() const; - - bool isActive() const; - -protected: - QGraphicsItem *topFormEditorItem(const QList &itemList); - -private: - QList m_itemList; - QList m_oldSelectionList; - LiveSelectionRectangle m_selectionRectangleElement; - QPointF m_beginPoint; - QDeclarativeViewObserver *m_editorView; - QGraphicsItem *m_beginFormEditorItem; - bool m_isActive; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // RUBBERBANDSELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp deleted file mode 100644 index 2752957..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "liveselectionindicator_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" -#include "../qmlobserverconstants_p.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, - QGraphicsObject *layerItem) - : m_layerItem(layerItem) - , m_view(viewObserver) -{ -} - -LiveSelectionIndicator::~LiveSelectionIndicator() -{ - clear(); -} - -void LiveSelectionIndicator::show() -{ - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) - item->show(); -} - -void LiveSelectionIndicator::hide() -{ - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) - item->hide(); -} - -void LiveSelectionIndicator::clear() -{ - if (!m_layerItem.isNull()) { - QGraphicsScene *scene = m_layerItem.data()->scene(); - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) { - scene->removeItem(item); - delete item; - } - } - - m_indicatorShapeHash.clear(); - -} - -void LiveSelectionIndicator::setItems(const QList > &itemList) -{ - clear(); - - foreach (const QWeakPointer &object, itemList) { - if (object.isNull()) - continue; - - QGraphicsItem *item = object.data(); - - if (!m_indicatorShapeHash.contains(item)) { - QGraphicsRectItem *selectionIndicator = new QGraphicsRectItem(m_layerItem.data()); - m_indicatorShapeHash.insert(item, selectionIndicator); - - const QRectF boundingRect = m_view->adjustToScreenBoundaries(item->mapRectToScene(item->boundingRect())); - const QRectF boundingRectInLayerItemSpace = m_layerItem.data()->mapRectFromScene(boundingRect); - - selectionIndicator->setData(Constants::EditorItemDataKey, true); - selectionIndicator->setFlag(QGraphicsItem::ItemIsSelectable, false); - selectionIndicator->setRect(boundingRectInLayerItemSpace); - selectionIndicator->setPen(QColor(108, 141, 221)); - } - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h deleted file mode 100644 index efd2c5f..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LIVESELECTIONINDICATOR_H -#define LIVESELECTIONINDICATOR_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QGraphicsObject; -class QGraphicsRectItem; -class QGraphicsItem; -class QPolygonF; -QT_END_NAMESPACE - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; - -class LiveSelectionIndicator -{ -public: - LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, QGraphicsObject *layerItem); - ~LiveSelectionIndicator(); - - void show(); - void hide(); - - void clear(); - - void setItems(const QList > &itemList); - -private: - QHash m_indicatorShapeHash; - QWeakPointer m_layerItem; - QDeclarativeViewObserver *m_view; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // LIVESELECTIONINDICATOR_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp deleted file mode 100644 index 6da1d6f..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "liveselectionrectangle_p.h" - -#include "../qmlobserverconstants_p.h" - -#include -#include -#include -#include - -#include - -#include - -QT_BEGIN_NAMESPACE - -class SelectionRectShape : public QGraphicsRectItem -{ -public: - SelectionRectShape(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {} - int type() const { return Constants::EditorItemType; } -}; - -LiveSelectionRectangle::LiveSelectionRectangle(QGraphicsObject *layerItem) - : m_controlShape(new SelectionRectShape(layerItem)), - m_layerItem(layerItem) -{ - m_controlShape->setPen(QPen(Qt::black)); - m_controlShape->setBrush(QColor(128, 128, 128, 50)); -} - -LiveSelectionRectangle::~LiveSelectionRectangle() -{ - if (m_layerItem) - m_layerItem.data()->scene()->removeItem(m_controlShape); -} - -void LiveSelectionRectangle::clear() -{ - hide(); -} -void LiveSelectionRectangle::show() -{ - m_controlShape->show(); -} - -void LiveSelectionRectangle::hide() -{ - m_controlShape->hide(); -} - -QRectF LiveSelectionRectangle::rect() const -{ - return m_controlShape->mapFromScene(m_controlShape->rect()).boundingRect(); -} - -void LiveSelectionRectangle::setRect(const QPointF &firstPoint, - const QPointF &secondPoint) -{ - double firstX = std::floor(firstPoint.x()) + 0.5; - double firstY = std::floor(firstPoint.y()) + 0.5; - double secondX = std::floor(secondPoint.x()) + 0.5; - double secondY = std::floor(secondPoint.y()) + 0.5; - QPointF topLeftPoint(firstX < secondX ? firstX : secondX, - firstY < secondY ? firstY : secondY); - QPointF bottomRightPoint(firstX > secondX ? firstX : secondX, - firstY > secondY ? firstY : secondY); - - QRectF rect(topLeftPoint, bottomRightPoint); - m_controlShape->setRect(rect); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h deleted file mode 100644 index 5da9fb8..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionrectangle_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LIVESELECTIONRECTANGLE_H -#define LIVESELECTIONRECTANGLE_H - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem) -QT_FORWARD_DECLARE_CLASS(QPointF) -QT_FORWARD_DECLARE_CLASS(QRectF) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class LiveSelectionRectangle -{ -public: - LiveSelectionRectangle(QGraphicsObject *layerItem); - ~LiveSelectionRectangle(); - - void show(); - void hide(); - - void clear(); - - void setRect(const QPointF &firstPoint, - const QPointF &secondPoint); - - QRectF rect() const; - -private: - QGraphicsRectItem *m_controlShape; - QWeakPointer m_layerItem; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // LIVESELECTIONRECTANGLE_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp deleted file mode 100644 index 872832c..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "liveselectiontool_p.h" -#include "livelayeritem_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -LiveSelectionTool::LiveSelectionTool(QDeclarativeViewObserver *editorView) : - AbstractLiveEditTool(editorView), - m_rubberbandSelectionMode(false), - m_rubberbandSelectionManipulator( - QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer, editorView), - m_singleSelectionManipulator(editorView), - m_selectionIndicator(editorView, - QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer), - //m_resizeIndicator(editorView->manipulatorLayer()), - m_selectOnlyContentItems(true) -{ - -} - -LiveSelectionTool::~LiveSelectionTool() -{ -} - -void LiveSelectionTool::setRubberbandSelectionMode(bool value) -{ - m_rubberbandSelectionMode = value; -} - -LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionType(Qt::KeyboardModifiers - modifiers) -{ - LiveSingleSelectionManipulator::SelectionType selectionType - = LiveSingleSelectionManipulator::ReplaceSelection; - if (modifiers.testFlag(Qt::ControlModifier)) { - selectionType = LiveSingleSelectionManipulator::RemoveFromSelection; - } else if (modifiers.testFlag(Qt::ShiftModifier)) { - selectionType = LiveSingleSelectionManipulator::AddToSelection; - } - return selectionType; -} - -bool LiveSelectionTool::alreadySelected(const QList &itemList) const -{ - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - const QList selectedItems = observerPrivate->selectedItems(); - - if (selectedItems.isEmpty()) - return false; - - foreach (QGraphicsItem *item, itemList) - if (selectedItems.contains(item)) - return true; - - return false; -} - -void LiveSelectionTool::mousePressEvent(QMouseEvent *event) -{ - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - QList itemList = observerPrivate->selectableItems(event->pos()); - LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers()); - - if (event->buttons() & Qt::LeftButton) { - m_mousePressTimer.start(); - - if (m_rubberbandSelectionMode) { - m_rubberbandSelectionManipulator.begin(event->pos()); - } else { - m_singleSelectionManipulator.begin(event->pos()); - m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems); - } - } else if (event->buttons() & Qt::RightButton) { - createContextMenu(itemList, event->globalPos()); - } -} - -void LiveSelectionTool::createContextMenu(QList itemList, QPoint globalPos) -{ - QMenu contextMenu; - connect(&contextMenu, SIGNAL(hovered(QAction*)), - this, SLOT(contextMenuElementHovered(QAction*))); - - m_contextMenuItemList = itemList; - - contextMenu.addAction(tr("Items")); - contextMenu.addSeparator(); - int shortcutKey = Qt::Key_1; - bool addKeySequence = true; - int i = 0; - - foreach (QGraphicsItem * const item, itemList) { - QString itemTitle = titleForItem(item); - QAction *elementAction = contextMenu.addAction(itemTitle, this, - SLOT(contextMenuElementSelected())); - - if (observer()->selectedItems().contains(item)) { - QFont boldFont = elementAction->font(); - boldFont.setBold(true); - elementAction->setFont(boldFont); - } - - elementAction->setData(i); - if (addKeySequence) - elementAction->setShortcut(QKeySequence(shortcutKey)); - - shortcutKey++; - if (shortcutKey > Qt::Key_9) - addKeySequence = false; - - ++i; - } - // add root item separately - // QString itemTitle = QString(tr("%1")).arg(titleForItem(view()->currentRootItem())); - // contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected())); - // m_contextMenuItemList.append(view()->currentRootItem()); - - contextMenu.exec(globalPos); - m_contextMenuItemList.clear(); -} - -void LiveSelectionTool::contextMenuElementSelected() -{ - QAction *senderAction = static_cast(sender()); - int itemListIndex = senderAction->data().toInt(); - if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { - - QPointF updatePt(0, 0); - QGraphicsItem *item = m_contextMenuItemList.at(itemListIndex); - m_singleSelectionManipulator.begin(updatePt); - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - QList() << item, - false); - m_singleSelectionManipulator.end(updatePt); - } -} - -void LiveSelectionTool::contextMenuElementHovered(QAction *action) -{ - int itemListIndex = action->data().toInt(); - if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { - QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject(); - QDeclarativeViewObserverPrivate::get(observer())->highlight(item); - } -} - -void LiveSelectionTool::mouseMoveEvent(QMouseEvent *event) -{ - if (m_singleSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->pos(); - - if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) - && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) - { - m_singleSelectionManipulator.end(event->pos()); - //view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint()); - return; - } - } else if (m_rubberbandSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); - - if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) - && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) { - m_rubberbandSelectionManipulator.update(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::RemoveFromSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::AddToSelection); - else - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::ReplaceSelection); - } - } -} - -void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event) -{ -// ### commented out until move tool is re-enabled -// QList itemList = view()->items(event->pos()); -// if (!itemList.isEmpty() && !m_rubberbandSelectionMode) { -// -// foreach (QGraphicsItem *item, itemList) { -// if (item->type() == Constants::ResizeHandleItemType) { -// ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(item); -// if (resizeHandle) -// view()->changeTool(Constants::ResizeToolMode); -// return; -// } -// } -// if (topSelectedItemIsMovable(itemList)) -// view()->changeTool(Constants::MoveToolMode); -// } - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - - QList selectableItemList = observerPrivate->selectableItems(event->pos()); - if (!selectableItemList.isEmpty()) { - QGraphicsObject *item = selectableItemList.first()->toGraphicsObject(); - if (item) - QDeclarativeViewObserverPrivate::get(observer())->highlight(item); - - return; - } - - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); -} - -void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) -{ - if (m_singleSelectionManipulator.isActive()) { - m_singleSelectionManipulator.end(event->pos()); - } - else if (m_rubberbandSelectionManipulator.isActive()) { - - QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); - if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) { - m_singleSelectionManipulator.begin(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, - m_selectOnlyContentItems); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, - m_selectOnlyContentItems); - else - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - m_selectOnlyContentItems); - - m_singleSelectionManipulator.end(event->pos()); - } else { - m_rubberbandSelectionManipulator.update(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::RemoveFromSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::AddToSelection); - else - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::ReplaceSelection); - - m_rubberbandSelectionManipulator.end(); - } - } -} - -void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ -} - -void LiveSelectionTool::keyPressEvent(QKeyEvent *event) -{ - switch (event->key()) { - case Qt::Key_Left: - case Qt::Key_Right: - case Qt::Key_Up: - case Qt::Key_Down: - // disabled for now, cannot move stuff yet. - //view()->changeTool(Constants::MoveToolMode); - //view()->currentTool()->keyPressEvent(event); - break; - } -} - -void LiveSelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ - -} - -void LiveSelectionTool::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode) - return; - - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - QList itemList = observerPrivate->selectableItems(event->pos()); - - if (itemList.isEmpty()) - return; - - int selectedIdx = 0; - if (!observer()->selectedItems().isEmpty()) { - selectedIdx = itemList.indexOf(observer()->selectedItems().first()); - if (selectedIdx >= 0) { - if (event->delta() > 0) { - selectedIdx++; - if (selectedIdx == itemList.length()) - selectedIdx = 0; - } else if (event->delta() < 0) { - selectedIdx--; - if (selectedIdx == -1) - selectedIdx = itemList.length() - 1; - } - } else { - selectedIdx = 0; - } - } - - QPointF updatePt(0, 0); - m_singleSelectionManipulator.begin(updatePt); - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::ReplaceSelection, - QList() << itemList.at(selectedIdx), - false); - m_singleSelectionManipulator.end(updatePt); - -} - -void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems) -{ - m_selectOnlyContentItems = selectOnlyContentItems; -} - -void LiveSelectionTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ -} - -void LiveSelectionTool::clear() -{ - view()->setCursor(Qt::ArrowCursor); - m_rubberbandSelectionManipulator.clear(), - m_singleSelectionManipulator.clear(); - m_selectionIndicator.clear(); - //m_resizeIndicator.clear(); -} - -void LiveSelectionTool::selectedItemsChanged(const QList &itemList) -{ - foreach (const QWeakPointer &obj, m_selectedItemList) { - if (!obj.isNull()) { - disconnect(obj.data(), SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); - } - } - - QList objects = toGraphicsObjectList(itemList); - m_selectedItemList.clear(); - - foreach (QGraphicsObject *obj, objects) { - m_selectedItemList.append(obj); - connect(obj, SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); - } - - m_selectionIndicator.setItems(m_selectedItemList); - //m_resizeIndicator.setItems(toGraphicsObjectList(itemList)); -} - -void LiveSelectionTool::repaintBoundingRects() -{ - m_selectionIndicator.setItems(m_selectedItemList); -} - -void LiveSelectionTool::selectUnderPoint(QMouseEvent *event) -{ - m_singleSelectionManipulator.begin(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, - m_selectOnlyContentItems); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, - m_selectOnlyContentItems); - else - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - m_selectOnlyContentItems); - - m_singleSelectionManipulator.end(event->pos()); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h deleted file mode 100644 index 4ecf9f6..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool_p.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LIVESELECTIONTOOL_H -#define LIVESELECTIONTOOL_H - -#include "abstractliveedittool_p.h" -#include "liverubberbandselectionmanipulator_p.h" -#include "livesingleselectionmanipulator_p.h" -#include "liveselectionindicator_p.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QKeyEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class LiveSelectionTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - LiveSelectionTool(QDeclarativeViewObserver* editorView); - ~LiveSelectionTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void hoverMoveEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void wheelEvent(QWheelEvent *event); - - void itemsAboutToRemoved(const QList &itemList); -// QVariant itemChange(const QList &itemList, -// QGraphicsItem::GraphicsItemChange change, -// const QVariant &value ); - -// void update(); - - void clear(); - - void selectedItemsChanged(const QList &itemList); - - void selectUnderPoint(QMouseEvent *event); - - void setSelectOnlyContentItems(bool selectOnlyContentItems); - - void setRubberbandSelectionMode(bool value); - -private slots: - void contextMenuElementSelected(); - void contextMenuElementHovered(QAction *action); - void repaintBoundingRects(); - -private: - void createContextMenu(QList itemList, QPoint globalPos); - LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers); - bool alreadySelected(const QList &itemList) const; - -private: - bool m_rubberbandSelectionMode; - LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator; - LiveSingleSelectionManipulator m_singleSelectionManipulator; - LiveSelectionIndicator m_selectionIndicator; - //ResizeIndicator m_resizeIndicator; - QTime m_mousePressTimer; - bool m_selectOnlyContentItems; - - QList > m_selectedItemList; - - QList m_contextMenuItemList; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // LIVESELECTIONTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp deleted file mode 100644 index 1ffd7a9..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "livesingleselectionmanipulator_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include - -QT_BEGIN_NAMESPACE - -LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView) - : m_editorView(editorView), - m_isActive(false) -{ -} - - -void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint) -{ - m_beginPoint = beginPoint; - m_isActive = true; - m_oldSelectionList = QDeclarativeViewObserverPrivate::get(m_editorView)->selectedItems(); -} - -void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/) -{ - m_oldSelectionList.clear(); -} - -void LiveSingleSelectionManipulator::clear() -{ - m_beginPoint = QPointF(); - m_oldSelectionList.clear(); -} - - -void LiveSingleSelectionManipulator::end(const QPointF &/*updatePoint*/) -{ - m_oldSelectionList.clear(); - m_isActive = false; -} - -void LiveSingleSelectionManipulator::select(SelectionType selectionType, - const QList &items, - bool /*selectOnlyContentItems*/) -{ - QGraphicsItem *selectedItem = 0; - - foreach (QGraphicsItem* item, items) - { - //FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item); - if (item - /*&& !formEditorItem->qmlItemNode().isRootNode() - && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)*/) - { - selectedItem = item; - break; - } - } - - QList resultList; - - switch (selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - if (selectedItem && !m_oldSelectionList.contains(selectedItem)) - resultList.append(selectedItem); - } - break; - case ReplaceSelection: { - if (selectedItem) - resultList.append(selectedItem); - } - break; - case RemoveFromSelection: { - resultList.append(m_oldSelectionList); - if (selectedItem) - resultList.removeAll(selectedItem); - } - break; - case InvertSelection: { - if (selectedItem - && !m_oldSelectionList.contains(selectedItem)) - { - resultList.append(selectedItem); - } - } - } - - m_editorView->setSelectedItems(resultList); -} - -void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems) -{ - QDeclarativeViewObserverPrivate *observerPrivate = - QDeclarativeViewObserverPrivate::get(m_editorView); - QList itemList = observerPrivate->selectableItems(m_beginPoint); - select(selectionType, itemList, selectOnlyContentItems); -} - - -bool LiveSingleSelectionManipulator::isActive() const -{ - return m_isActive; -} - -QPointF LiveSingleSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h b/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h deleted file mode 100644 index ea0406b..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/livesingleselectionmanipulator_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LIVESINGLESELECTIONMANIPULATOR_H -#define LIVESINGLESELECTIONMANIPULATOR_H - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; - -class LiveSingleSelectionManipulator -{ -public: - LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView); - - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection, - InvertSelection - }; - - void begin(const QPointF& beginPoint); - void update(const QPointF& updatePoint); - void end(const QPointF& updatePoint); - - void select(SelectionType selectionType, const QList &items, - bool selectOnlyContentItems); - void select(SelectionType selectionType, bool selectOnlyContentItems); - - void clear(); - - QPointF beginPoint() const; - - bool isActive() const; - -private: - QList m_oldSelectionList; - QPointF m_beginPoint; - QDeclarativeViewObserver *m_editorView; - bool m_isActive; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // LIVESINGLESELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp b/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp deleted file mode 100644 index 9ad5b24..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmltoolbar_p.h" -#include "toolbarcolorbox_p.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -QmlToolBar::QmlToolBar(QWidget *parent) - : QToolBar(parent) - , m_emitSignals(true) - , m_paused(false) - , m_animationSpeed(1.0f) - , ui(new Ui) -{ - ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); - ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); - - ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/observermode-24.png")), - tr("Observer Mode"), this); - ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); - ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); - ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), - tr("Select (Marquee)"), this); - ui->zoom = new QAction(QIcon(QLatin1String(":/qml/images/zoom-24.png")), tr("Zoom"), this); - ui->colorPicker = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-24.png")), - tr("Color Picker"), this); - ui->toQml = new QAction(QIcon(QLatin1String(":/qml/images/to-qml-24.png")), - tr("Apply Changes to QML Viewer"), this); - ui->fromQml = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-24.png")), - tr("Apply Changes to Document"), this); - ui->designmode->setCheckable(true); - ui->designmode->setChecked(false); - - ui->play->setCheckable(false); - ui->select->setCheckable(true); - ui->selectMarquee->setCheckable(true); - ui->zoom->setCheckable(true); - ui->colorPicker->setCheckable(true); - - setWindowTitle(tr("Tools")); - - addAction(ui->designmode); - addAction(ui->play); - addSeparator(); - - addAction(ui->select); - // disabled because multi selection does not do anything useful without design mode - //addAction(ui->selectMarquee); - addSeparator(); - addAction(ui->zoom); - addAction(ui->colorPicker); - //addAction(ui->fromQml); - - ui->colorBox = new ToolBarColorBox(this); - ui->colorBox->setMinimumSize(24, 24); - ui->colorBox->setMaximumSize(28, 28); - ui->colorBox->setColor(Qt::black); - addWidget(ui->colorBox); - - setWindowFlags(Qt::Tool); - - QMenu *playSpeedMenu = new QMenu(this); - ui->playSpeedMenuActions = new QActionGroup(this); - ui->playSpeedMenuActions->setExclusive(true); - - QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setChecked(true); - speedAction->setData(1.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(2.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(4.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(8.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(10.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - ui->play->setMenu(playSpeedMenu); - - connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool))); - - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - - connect(ui->play, SIGNAL(triggered()), SLOT(activatePlayOnClick())); - - connect(ui->zoom, SIGNAL(triggered()), SLOT(activateZoomOnClick())); - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - connect(ui->select, SIGNAL(triggered()), SLOT(activateSelectToolOnClick())); - connect(ui->selectMarquee, SIGNAL(triggered()), SLOT(activateMarqueeSelectToolOnClick())); - - connect(ui->toQml, SIGNAL(triggered()), SLOT(activateToQml())); - connect(ui->fromQml, SIGNAL(triggered()), SLOT(activateFromQml())); -} - -QmlToolBar::~QmlToolBar() -{ - delete ui; -} - -void QmlToolBar::activateColorPicker() -{ - m_emitSignals = false; - activateColorPickerOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateSelectTool() -{ - m_emitSignals = false; - activateSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateMarqueeSelectTool() -{ - m_emitSignals = false; - activateMarqueeSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateZoom() -{ - m_emitSignals = false; - activateZoomOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::setAnimationSpeed(qreal slowDownFactor) -{ - if (m_animationSpeed == slowDownFactor) - return; - - m_emitSignals = false; - m_animationSpeed = slowDownFactor; - - foreach (QAction *action, ui->playSpeedMenuActions->actions()) { - if (action->data().toReal() == slowDownFactor) { - action->setChecked(true); - break; - } - } - - m_emitSignals = true; -} - -void QmlToolBar::setAnimationPaused(bool paused) -{ - if (m_paused == paused) - return; - - m_paused = paused; - updatePlayAction(); -} - -void QmlToolBar::changeAnimationSpeed() -{ - QAction *action = qobject_cast(sender()); - m_animationSpeed = action->data().toReal(); - emit animationSpeedChanged(m_animationSpeed); -} - -void QmlToolBar::setDesignModeBehavior(bool inDesignMode) -{ - m_emitSignals = false; - ui->designmode->setChecked(inDesignMode); - setDesignModeBehaviorOnClick(inDesignMode); - m_emitSignals = true; -} - -void QmlToolBar::setDesignModeBehaviorOnClick(bool checked) -{ - ui->select->setEnabled(checked); - ui->selectMarquee->setEnabled(checked); - ui->zoom->setEnabled(checked); - ui->colorPicker->setEnabled(checked); - ui->toQml->setEnabled(checked); - ui->fromQml->setEnabled(checked); - - if (m_emitSignals) - emit designModeBehaviorChanged(checked); -} - -void QmlToolBar::setColorBoxColor(const QColor &color) -{ - ui->colorBox->setColor(color); -} - -void QmlToolBar::activatePlayOnClick() -{ - m_paused = !m_paused; - emit animationPausedChanged(m_paused); - updatePlayAction(); -} - -void QmlToolBar::updatePlayAction() -{ - ui->play->setIcon(m_paused ? ui->playIcon : ui->pauseIcon); -} - -void QmlToolBar::activateColorPickerOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - - ui->colorPicker->setChecked(true); - if (m_activeTool != Constants::ColorPickerMode) { - m_activeTool = Constants::ColorPickerMode; - if (m_emitSignals) - emit colorPickerSelected(); - } -} - -void QmlToolBar::activateSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->select->setChecked(true); - if (m_activeTool != Constants::SelectionToolMode) { - m_activeTool = Constants::SelectionToolMode; - if (m_emitSignals) - emit selectToolSelected(); - } -} - -void QmlToolBar::activateMarqueeSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->selectMarquee->setChecked(true); - if (m_activeTool != Constants::MarqueeSelectionToolMode) { - m_activeTool = Constants::MarqueeSelectionToolMode; - if (m_emitSignals) - emit marqueeSelectToolSelected(); - } -} - -void QmlToolBar::activateZoomOnClick() -{ - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->zoom->setChecked(true); - if (m_activeTool != Constants::ZoomMode) { - m_activeTool = Constants::ZoomMode; - if (m_emitSignals) - emit zoomToolSelected(); - } -} - -void QmlToolBar::activateFromQml() -{ - if (m_emitSignals) - emit applyChangesFromQmlFileSelected(); -} - -void QmlToolBar::activateToQml() -{ - if (m_emitSignals) - emit applyChangesToQmlFileSelected(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h b/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h deleted file mode 100644 index a3da1f7..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/qmltoolbar_p.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLTOOLBAR_H -#define QMLTOOLBAR_H - -#include -#include - -#include "../qmlobserverconstants_p.h" - -QT_FORWARD_DECLARE_CLASS(QActionGroup) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ToolBarColorBox; - -class QmlToolBar : public QToolBar -{ - Q_OBJECT - -public: - explicit QmlToolBar(QWidget *parent = 0); - ~QmlToolBar(); - -public slots: - void setDesignModeBehavior(bool inDesignMode); - void setColorBoxColor(const QColor &color); - void activateColorPicker(); - void activateSelectTool(); - void activateMarqueeSelectTool(); - void activateZoom(); - - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - -signals: - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - - void designModeBehaviorChanged(bool inDesignMode); - void colorPickerSelected(); - void selectToolSelected(); - void marqueeSelectToolSelected(); - void zoomToolSelected(); - - void applyChangesToQmlFileSelected(); - void applyChangesFromQmlFileSelected(); - -private slots: - void setDesignModeBehaviorOnClick(bool inDesignMode); - void activatePlayOnClick(); - void activateColorPickerOnClick(); - void activateSelectToolOnClick(); - void activateMarqueeSelectToolOnClick(); - void activateZoomOnClick(); - - void activateFromQml(); - void activateToQml(); - - void changeAnimationSpeed(); - - void updatePlayAction(); - -private: - class Ui { - public: - QAction *designmode; - QAction *play; - QAction *select; - QAction *selectMarquee; - QAction *zoom; - QAction *colorPicker; - QAction *toQml; - QAction *fromQml; - QIcon playIcon; - QIcon pauseIcon; - ToolBarColorBox *colorBox; - - QActionGroup *playSpeedMenuActions; - }; - - bool m_emitSignals; - bool m_paused; - qreal m_animationSpeed; - - Constants::DesignTool m_activeTool; - - Ui *ui; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMLTOOLBAR_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp deleted file mode 100644 index 27e2079..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "subcomponentmasklayeritem_p.h" - -#include "../qmlobserverconstants_p.h" -#include "../qdeclarativeviewobserver_p.h" - -#include - -QT_BEGIN_NAMESPACE - -SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer, - QGraphicsItem *parentItem) : - QGraphicsPolygonItem(parentItem), - m_observer(observer), - m_currentItem(0), - m_borderRect(new QGraphicsRectItem(this)) -{ - m_borderRect->setRect(0,0,0,0); - m_borderRect->setPen(QPen(QColor(60, 60, 60), 1)); - m_borderRect->setData(Constants::EditorItemDataKey, QVariant(true)); - - setBrush(QBrush(QColor(160,160,160))); - setPen(Qt::NoPen); -} - -int SubcomponentMaskLayerItem::type() const -{ - return Constants::EditorItemType; -} - -static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect) -{ - QRectF result = newRect; - if (oldRect.left() < newRect.left()) - result.setLeft(oldRect.left()); - - if (oldRect.top() < newRect.top()) - result.setTop(oldRect.top()); - - if (oldRect.right() > newRect.right()) - result.setRight(oldRect.right()); - - if (oldRect.bottom() > newRect.bottom()) - result.setBottom(oldRect.bottom()); - - return result; -} - -static QPolygonF regionToPolygon(const QRegion ®ion) -{ - QPainterPath path; - foreach (const QRect &rect, region.rects()) - path.addRect(rect); - return path.toFillPolygon(); -} - -void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) -{ - QGraphicsItem *prevItem = m_currentItem; - m_currentItem = item; - - if (!m_currentItem) - return; - - QRect viewRect = m_observer->declarativeView()->rect(); - viewRect = m_observer->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); - - QRectF itemRect = item->boundingRect() | item->childrenBoundingRect(); - itemRect = item->mapRectToScene(itemRect); - - // if updating the same item as before, resize the rectangle only bigger, not smaller. - if (prevItem == item && prevItem != 0) { - m_itemPolyRect = resizeRect(itemRect, m_itemPolyRect); - } else { - m_itemPolyRect = itemRect; - } - QRectF borderRect = m_itemPolyRect; - borderRect.adjust(-1, -1, 1, 1); - m_borderRect->setRect(borderRect); - - const QRegion externalRegion = QRegion(viewRect).subtracted(m_itemPolyRect.toRect()); - setPolygon(regionToPolygon(externalRegion)); -} - -QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const -{ - return m_currentItem; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h b/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h deleted file mode 100644 index 7a77253..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SUBCOMPONENTMASKLAYERITEM_H -#define SUBCOMPONENTMASKLAYERITEM_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; - -class SubcomponentMaskLayerItem : public QGraphicsPolygonItem -{ -public: - explicit SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer, - QGraphicsItem *parentItem = 0); - int type() const; - void setCurrentItem(QGraphicsItem *item); - void setBoundingBox(const QRectF &boundingBox); - QGraphicsItem *currentItem() const; - QRectF itemRect() const; - -private: - QDeclarativeViewObserver *m_observer; - QGraphicsItem *m_currentItem; - QGraphicsRectItem *m_borderRect; - QRectF m_itemPolyRect; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // SUBCOMPONENTMASKLAYERITEM_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp b/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp deleted file mode 100644 index d3a5a37..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "toolbarcolorbox_p.h" - -#include "../qmlobserverconstants_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -ToolBarColorBox::ToolBarColorBox(QWidget *parent) : - QLabel(parent) -{ - m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")), - tr("Copy Color"), this); - connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); - setScaledContents(false); -} - -void ToolBarColorBox::setColor(const QColor &color) -{ - m_color = color; - - QPixmap pix = createDragPixmap(width()); - setPixmap(pix); - update(); -} - -void ToolBarColorBox::mousePressEvent(QMouseEvent *event) -{ - m_dragBeginPoint = event->pos(); - m_dragStarted = false; -} - -void ToolBarColorBox::mouseMoveEvent(QMouseEvent *event) -{ - - if (event->buttons() & Qt::LeftButton - && (QPoint(event->pos() - m_dragBeginPoint).manhattanLength() - > Constants::DragStartDistance) - && !m_dragStarted) - { - m_dragStarted = true; - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - - mimeData->setText(m_color.name()); - drag->setMimeData(mimeData); - drag->setPixmap(createDragPixmap()); - - drag->exec(); - } -} - -QPixmap ToolBarColorBox::createDragPixmap(int size) const -{ - QPixmap pix(size, size); - QPainter p(&pix); - - QColor borderColor1 = QColor(143, 143 ,143); - QColor borderColor2 = QColor(43, 43, 43); - - p.setBrush(QBrush(m_color)); - p.setPen(QPen(QBrush(borderColor2),1)); - - p.fillRect(0, 0, size, size, borderColor1); - p.drawRect(1,1, size - 3, size - 3); - return pix; -} - -void ToolBarColorBox::contextMenuEvent(QContextMenuEvent *ev) -{ - QMenu contextMenu; - contextMenu.addAction(m_copyHexColor); - contextMenu.exec(ev->globalPos()); -} - -void ToolBarColorBox::copyColorToClipboard() -{ - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(m_color.name()); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h b/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h deleted file mode 100644 index c3e064c..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/toolbarcolorbox_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TOOLBARCOLORBOX_H -#define TOOLBARCOLORBOX_H - -#include -#include -#include - -QT_FORWARD_DECLARE_CLASS(QContextMenuEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ToolBarColorBox : public QLabel -{ - Q_OBJECT - -public: - explicit ToolBarColorBox(QWidget *parent = 0); - void setColor(const QColor &color); - -protected: - void contextMenuEvent(QContextMenuEvent *ev); - void mousePressEvent(QMouseEvent *ev); - void mouseMoveEvent(QMouseEvent *ev); -private slots: - void copyColorToClipboard(); - -private: - QPixmap createDragPixmap(int size = 24) const; - -private: - bool m_dragStarted; - QPoint m_dragBeginPoint; - QAction *m_copyHexColor; - QColor m_color; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // TOOLBARCOLORBOX_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp deleted file mode 100644 index 68d67cc..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "zoomtool_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -ZoomTool::ZoomTool(QDeclarativeViewObserver *view) : - AbstractLiveEditTool(view), - m_rubberbandManipulator(), - m_smoothZoomMultiplier(0.05f), - m_currentScale(1.0f) -{ - m_zoomTo100Action = new QAction(tr("Zoom to &100%"), this); - m_zoomInAction = new QAction(tr("Zoom In"), this); - m_zoomOutAction = new QAction(tr("Zoom Out"), this); - m_zoomInAction->setShortcut(QKeySequence(Qt::Key_Plus)); - m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus)); - - - LiveLayerItem *layerItem = QDeclarativeViewObserverPrivate::get(view)->manipulatorLayer; - QGraphicsObject *layerObject = reinterpret_cast(layerItem); - m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view); - - - connect(m_zoomTo100Action, SIGNAL(triggered()), SLOT(zoomTo100())); - connect(m_zoomInAction, SIGNAL(triggered()), SLOT(zoomIn())); - connect(m_zoomOutAction, SIGNAL(triggered()), SLOT(zoomOut())); -} - -ZoomTool::~ZoomTool() -{ - delete m_rubberbandManipulator; -} - -void ZoomTool::mousePressEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - - QPointF scenePos = view()->mapToScene(event->pos()); - - if (event->buttons() & Qt::RightButton) { - QMenu contextMenu; - contextMenu.addAction(m_zoomTo100Action); - contextMenu.addSeparator(); - contextMenu.addAction(m_zoomInAction); - contextMenu.addAction(m_zoomOutAction); - contextMenu.exec(event->globalPos()); - } else if (event->buttons() & Qt::LeftButton) { - m_dragBeginPos = scenePos; - m_dragStarted = false; - } -} - -void ZoomTool::mouseMoveEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - - QPointF scenePos = view()->mapToScene(event->pos()); - - if (event->buttons() & Qt::LeftButton - && (QPointF(scenePos - m_dragBeginPos).manhattanLength() - > Constants::DragStartDistance / 3) - && !m_dragStarted) - { - m_dragStarted = true; - m_rubberbandManipulator->begin(m_dragBeginPos); - return; - } - - if (m_dragStarted) - m_rubberbandManipulator->update(scenePos); - -} - -void ZoomTool::mouseReleaseEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - QPointF scenePos = view()->mapToScene(event->pos()); - - if (m_dragStarted) { - m_rubberbandManipulator->end(); - - int x1 = qMin(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); - int x2 = qMax(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); - int y1 = qMin(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); - int y2 = qMax(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); - - QPointF scenePosTopLeft = QPoint(x1, y1); - QPointF scenePosBottomRight = QPoint(x2, y2); - - QRectF sceneArea(scenePosTopLeft, scenePosBottomRight); - - m_currentScale = qMin(view()->rect().width() / sceneArea.width(), - view()->rect().height() / sceneArea.height()); - - - QTransform transform; - transform.scale(m_currentScale, m_currentScale); - - view()->setTransform(transform); - view()->setSceneRect(sceneArea); - } else { - Qt::KeyboardModifier modifierKey = Qt::ControlModifier; -#ifdef Q_WS_MAC - modifierKey = Qt::AltModifier; -#endif - if (event->modifiers() & modifierKey) { - zoomOut(); - } else { - zoomIn(); - } - } -} - -void ZoomTool::zoomIn() -{ - m_currentScale = nextZoomScale(ZoomIn); - scaleView(view()->mapToScene(m_mousePos)); -} - -void ZoomTool::zoomOut() -{ - m_currentScale = nextZoomScale(ZoomOut); - scaleView(view()->mapToScene(m_mousePos)); -} - -void ZoomTool::mouseDoubleClickEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); -} - - -void ZoomTool::hoverMoveEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); -} - - -void ZoomTool::keyPressEvent(QKeyEvent * /*event*/) -{ -} - -void ZoomTool::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() != Qt::Vertical) - return; - - Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier; - if (event->modifiers() & smoothZoomModifier) { - int numDegrees = event->delta() / 8; - m_currentScale += m_smoothZoomMultiplier * (numDegrees / 15.0f); - - scaleView(view()->mapToScene(m_mousePos)); - - } else if (!event->modifiers()) { - if (event->delta() > 0) { - m_currentScale = nextZoomScale(ZoomIn); - } else if (event->delta() < 0) { - m_currentScale = nextZoomScale(ZoomOut); - } - scaleView(view()->mapToScene(m_mousePos)); - } -} - -void ZoomTool::keyReleaseEvent(QKeyEvent *event) -{ - switch (event->key()) { - case Qt::Key_Plus: - zoomIn(); - break; - case Qt::Key_Minus: - zoomOut(); - break; - case Qt::Key_1: - case Qt::Key_2: - case Qt::Key_3: - case Qt::Key_4: - case Qt::Key_5: - case Qt::Key_6: - case Qt::Key_7: - case Qt::Key_8: - case Qt::Key_9: - { - m_currentScale = ((event->key() - Qt::Key_0) * 1.0f); - scaleView(view()->mapToScene(m_mousePos)); // view()->mapToScene(view()->rect().center()) - break; - } - - default: - break; - } - -} - -void ZoomTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ -} - -void ZoomTool::clear() -{ - view()->setCursor(Qt::ArrowCursor); -} - -void ZoomTool::selectedItemsChanged(const QList &/*itemList*/) -{ -} - -void ZoomTool::scaleView(const QPointF ¢erPos) -{ - - QTransform transform; - transform.scale(m_currentScale, m_currentScale); - view()->setTransform(transform); - - QPointF adjustedCenterPos = centerPos; - QSize rectSize(view()->rect().width() / m_currentScale, - view()->rect().height() / m_currentScale); - - QRectF sceneRect; - if (qAbs(m_currentScale - 1.0f) < Constants::ZoomSnapDelta) { - adjustedCenterPos.rx() = rectSize.width() / 2; - adjustedCenterPos.ry() = rectSize.height() / 2; - } - - if (m_currentScale < 1.0f) { - adjustedCenterPos.rx() = rectSize.width() / 2; - adjustedCenterPos.ry() = rectSize.height() / 2; - sceneRect.setRect(view()->rect().width() / 2 -rectSize.width() / 2, - view()->rect().height() / 2 -rectSize.height() / 2, - rectSize.width(), - rectSize.height()); - } else { - sceneRect.setRect(adjustedCenterPos.x() - rectSize.width() / 2, - adjustedCenterPos.y() - rectSize.height() / 2, - rectSize.width(), - rectSize.height()); - } - - view()->setSceneRect(sceneRect); -} - -void ZoomTool::zoomTo100() -{ - m_currentScale = 1.0f; - scaleView(view()->mapToScene(view()->rect().center())); -} - -qreal ZoomTool::nextZoomScale(ZoomDirection direction) const -{ - static QList zoomScales = - QList() - << 0.125f - << 1.0f / 6.0f - << 0.25f - << 1.0f / 3.0f - << 0.5f - << 2.0f / 3.0f - << 1.0f - << 2.0f - << 3.0f - << 4.0f - << 5.0f - << 6.0f - << 7.0f - << 8.0f - << 12.0f - << 16.0f - << 32.0f - << 48.0f; - - if (direction == ZoomIn) { - for (int i = 0; i < zoomScales.length(); ++i) { - if (zoomScales[i] > m_currentScale || i == zoomScales.length() - 1) - return zoomScales[i]; - } - } else { - for (int i = zoomScales.length() - 1; i >= 0; --i) { - if (zoomScales[i] < m_currentScale || i == 0) - return zoomScales[i]; - } - } - - return 1.0f; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h deleted file mode 100644 index ef5c2e6..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/zoomtool_p.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ZOOMTOOL_H -#define ZOOMTOOL_H - -#include "abstractliveedittool_p.h" -#include "liverubberbandselectionmanipulator_p.h" - -QT_FORWARD_DECLARE_CLASS(QAction) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ZoomTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - enum ZoomDirection { - ZoomIn, - ZoomOut - }; - - explicit ZoomTool(QDeclarativeViewObserver *view); - - virtual ~ZoomTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void itemsAboutToRemoved(const QList &itemList); - - void clear(); - -protected: - void selectedItemsChanged(const QList &itemList); - -private slots: - void zoomTo100(); - void zoomIn(); - void zoomOut(); - -private: - qreal nextZoomScale(ZoomDirection direction) const; - void scaleView(const QPointF ¢erPos); - -private: - bool m_dragStarted; - QPoint m_mousePos; // in view coords - QPointF m_dragBeginPos; - QAction *m_zoomTo100Action; - QAction *m_zoomInAction; - QAction *m_zoomOutAction; - LiveRubberBandSelectionManipulator *m_rubberbandManipulator; - - qreal m_smoothZoomMultiplier; - qreal m_currentScale; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // ZOOMTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp deleted file mode 100644 index a00bc6f..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativeobserverplugin.h" - -#include "qdeclarativeviewobserver_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -QDeclarativeObserverPlugin::QDeclarativeObserverPlugin() : - m_observer(0) -{ -} - -QDeclarativeObserverPlugin::~QDeclarativeObserverPlugin() -{ - delete m_observer; -} - -void QDeclarativeObserverPlugin::activate() -{ - QDeclarativeObserverService *service = QDeclarativeObserverService::instance(); - QList views = service->views(); - if (views.isEmpty()) - return; - - // TODO: Support multiple views - QDeclarativeView *view = service->views().at(0); - m_observer = new QDeclarativeViewObserver(view, view); -} - -void QDeclarativeObserverPlugin::deactivate() -{ - delete m_observer; -} - -Q_EXPORT_PLUGIN2(declarativeobserver, QDeclarativeObserverPlugin) - -QT_END_NAMESPACE - diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h deleted file mode 100644 index 7bc7626..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverplugin.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEOBSERVERPLUGIN_H -#define QDECLARATIVEOBSERVERPLUGIN_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeViewObserver; - -class QDeclarativeObserverPlugin : public QObject, public QDeclarativeObserverInterface -{ - Q_OBJECT - Q_DISABLE_COPY(QDeclarativeObserverPlugin) - Q_INTERFACES(QDeclarativeObserverInterface) - -public: - QDeclarativeObserverPlugin(); - ~QDeclarativeObserverPlugin(); - - void activate(); - void deactivate(); - -private: - QPointer m_observer; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVEOBSERVERPLUGIN_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h deleted file mode 100644 index 62722acc..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEOBSERVERPROTOCOL_H -#define QDECLARATIVEOBSERVERPROTOCOL_H - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ObserverProtocol : public QObject -{ - Q_OBJECT - Q_ENUMS(Message Tool) - -public: - enum Message { - AnimationSpeedChanged = 0, - AnimationPausedChanged = 19, // highest value - ChangeTool = 1, - ClearComponentCache = 2, - ColorChanged = 3, - CreateObject = 5, - CurrentObjectsChanged = 6, - DestroyObject = 7, - MoveObject = 8, - ObjectIdList = 9, - Reload = 10, - Reloaded = 11, - SetAnimationSpeed = 12, - SetAnimationPaused = 18, - SetCurrentObjects = 14, - SetDesignMode = 15, - ShowAppOnTop = 16, - ToolChanged = 17 - }; - - enum Tool { - ColorPickerTool, - SelectMarqueeTool, - SelectTool, - ZoomTool - }; - - static inline QString toString(Message message) - { - return QLatin1String(staticMetaObject.enumerator(0).valueToKey(message)); - } - - static inline QString toString(Tool tool) - { - return QLatin1String(staticMetaObject.enumerator(1).valueToKey(tool)); - } -}; - -inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Message message) -{ - return stream << static_cast(message); -} - -inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Message &message) -{ - quint32 i; - stream >> i; - message = static_cast(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, ObserverProtocol::Message message) -{ - dbg << ObserverProtocol::toString(message); - return dbg; -} - -inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Tool tool) -{ - return stream << static_cast(tool); -} - -inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Tool &tool) -{ - quint32 i; - stream >> i; - tool = static_cast(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, ObserverProtocol::Tool tool) -{ - dbg << ObserverProtocol::toString(tool); - return dbg; -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEOBSERVERPROTOCOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp deleted file mode 100644 index bb23831..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp +++ /dev/null @@ -1,1021 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "QtDeclarative/private/qdeclarativeobserverservice_p.h" -#include "QtDeclarative/private/qdeclarativedebughelper_p.h" - -#include "qdeclarativeviewobserver_p.h" -#include "qdeclarativeviewobserver_p_p.h" -#include "qdeclarativeobserverprotocol.h" - -#include "editor/liveselectiontool_p.h" -#include "editor/zoomtool_p.h" -#include "editor/colorpickertool_p.h" -#include "editor/livelayeritem_p.h" -#include "editor/boundingrecthighlighter_p.h" -#include "editor/qmltoolbar_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static inline void initEditorResource() { Q_INIT_RESOURCE(editor); } - -QT_BEGIN_NAMESPACE - -const char * const KEY_TOOLBOX_GEOMETRY = "toolBox/geometry"; - -const int SceneChangeUpdateInterval = 5000; - - -class ToolBox : public QWidget -{ - Q_OBJECT - -public: - ToolBox(QWidget *parent = 0); - ~ToolBox(); - - QmlToolBar *toolBar() const { return m_toolBar; } - -private: - QSettings m_settings; - QmlToolBar *m_toolBar; -}; - -ToolBox::ToolBox(QWidget *parent) - : QWidget(parent, Qt::Tool) - , m_settings(QLatin1String("Nokia"), QLatin1String("QmlObserver"), this) - , m_toolBar(new QmlToolBar) -{ - setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); - setWindowTitle(tr("Qt Quick Toolbox")); - - QVBoxLayout *verticalLayout = new QVBoxLayout; - verticalLayout->setMargin(0); - verticalLayout->addWidget(m_toolBar); - setLayout(verticalLayout); - - restoreGeometry(m_settings.value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray()); -} - -ToolBox::~ToolBox() -{ - m_settings.setValue(QLatin1String(KEY_TOOLBOX_GEOMETRY), saveGeometry()); -} - - -QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *q) : - q(q), - designModeBehavior(false), - showAppOnTop(false), - animationPaused(false), - slowDownFactor(1.0f), - toolBox(0) -{ -} - -QDeclarativeViewObserverPrivate::~QDeclarativeViewObserverPrivate() -{ -} - -QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, - QObject *parent) : - QObject(parent), - data(new QDeclarativeViewObserverPrivate(this)) -{ - initEditorResource(); - - data->view = view; - data->manipulatorLayer = new LiveLayerItem(view->scene()); - data->selectionTool = new LiveSelectionTool(this); - data->zoomTool = new ZoomTool(this); - data->colorPickerTool = new ColorPickerTool(this); - data->boundingRectHighlighter = new BoundingRectHighlighter(this); - data->currentTool = data->selectionTool; - - // to capture ChildRemoved event when viewport changes - data->view->installEventFilter(this); - - data->setViewport(data->view->viewport()); - - data->debugService = QDeclarativeObserverService::instance(); - connect(data->debugService, SIGNAL(gotMessage(QByteArray)), - this, SLOT(handleMessage(QByteArray))); - - connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)), - data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status))); - - connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), - SIGNAL(selectedColorChanged(QColor))); - connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), - this, SLOT(sendColorChanged(QColor))); - - data->_q_changeToSingleSelectTool(); -} - -QDeclarativeViewObserver::~QDeclarativeViewObserver() -{ -} - -void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) -{ -#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) - if (!toolBox && visible) - createToolBox(); - if (toolBox) - toolBox->setVisible(visible); -#else - Q_UNUSED(visible) -#endif -} - -void QDeclarativeViewObserverPrivate::_q_reloadView() -{ - clearHighlight(); - emit q->reloadRequested(); -} - -void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget) -{ - if (viewport.data() == widget) - return; - - if (viewport) - viewport.data()->removeEventFilter(q); - - viewport = widget; - if (viewport) { - // make sure we get mouse move events - viewport.data()->setMouseTracking(true); - viewport.data()->installEventFilter(q); - } -} - -void QDeclarativeViewObserverPrivate::clearEditorItems() -{ - clearHighlight(); - setSelectedItems(QList()); -} - -bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == data->view) { - // Event from view - if (event->type() == QEvent::ChildRemoved) { - // Might mean that viewport has changed - if (data->view->viewport() != data->viewport.data()) - data->setViewport(data->view->viewport()); - } - return QObject::eventFilter(obj, event); - } - - // Event from viewport - switch (event->type()) { - case QEvent::Leave: { - if (leaveEvent(event)) - return true; - break; - } - case QEvent::MouseButtonPress: { - if (mousePressEvent(static_cast(event))) - return true; - break; - } - case QEvent::MouseMove: { - if (mouseMoveEvent(static_cast(event))) - return true; - break; - } - case QEvent::MouseButtonRelease: { - if (mouseReleaseEvent(static_cast(event))) - return true; - break; - } - case QEvent::KeyPress: { - if (keyPressEvent(static_cast(event))) - return true; - break; - } - case QEvent::KeyRelease: { - if (keyReleaseEvent(static_cast(event))) - return true; - break; - } - case QEvent::MouseButtonDblClick: { - if (mouseDoubleClickEvent(static_cast(event))) - return true; - break; - } - case QEvent::Wheel: { - if (wheelEvent(static_cast(event))) - return true; - break; - } - default: { - break; - } - } //switch - - // standard event processing - return QObject::eventFilter(obj, event); -} - -bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/) -{ - if (!data->designModeBehavior) - return false; - data->clearHighlight(); - return true; -} - -bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) - return false; - data->cursorPos = event->pos(); - data->currentTool->mousePressEvent(event); - return true; -} - -bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) { - data->clearEditorItems(); - return false; - } - data->cursorPos = event->pos(); - - QList selItems = data->selectableItems(event->pos()); - if (!selItems.isEmpty()) { - declarativeView()->setToolTip(data->currentTool->titleForItem(selItems.first())); - } else { - declarativeView()->setToolTip(QString()); - } - if (event->buttons()) { - data->currentTool->mouseMoveEvent(event); - } else { - data->currentTool->hoverMoveEvent(event); - } - return true; -} - -bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) - return false; - - data->cursorPos = event->pos(); - data->currentTool->mouseReleaseEvent(event); - return true; -} - -bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event) -{ - if (!data->designModeBehavior) - return false; - - data->currentTool->keyPressEvent(event); - return true; -} - -bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) -{ - if (!data->designModeBehavior) - return false; - - switch (event->key()) { - case Qt::Key_V: - data->_q_changeToSingleSelectTool(); - break; -// disabled because multiselection does not do anything useful without design mode -// case Qt::Key_M: -// data->_q_changeToMarqueeSelectTool(); -// break; - case Qt::Key_I: - data->_q_changeToColorPickerTool(); - break; - case Qt::Key_Z: - data->_q_changeToZoomTool(); - break; - case Qt::Key_Space: - setAnimationPaused(!data->animationPaused); - break; - default: - break; - } - - data->currentTool->keyReleaseEvent(event); - return true; -} - -void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QObject *parent, - const QStringList &importList, - const QString &filename) -{ - if (!parent) - return; - - QString imports; - foreach (const QString &s, importList) { - imports += s; - imports += QLatin1Char('\n'); - } - - QDeclarativeContext *parentContext = view->engine()->contextForObject(parent); - QDeclarativeComponent component(view->engine(), q); - QByteArray constructedQml = QString(imports + qml).toLatin1(); - - component.setData(constructedQml, QUrl::fromLocalFile(filename)); - QObject *newObject = component.create(parentContext); - if (newObject) { - newObject->setParent(parent); - QDeclarativeItem *parentItem = qobject_cast(parent); - QDeclarativeItem *newItem = qobject_cast(newObject); - if (parentItem && newItem) - newItem->setParentItem(parentItem); - } -} - -void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) -{ - if (!newParent) - return; - - object->setParent(newParent); - QDeclarativeItem *newParentItem = qobject_cast(newParent); - QDeclarativeItem *item = qobject_cast(object); - if (newParentItem && item) - item->setParentItem(newParentItem); -} - -void QDeclarativeViewObserverPrivate::_q_clearComponentCache() -{ - view->engine()->clearComponentCache(); -} - -void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) -{ - QList items = selectedItems(); - if (QGraphicsItem *item = qobject_cast(obj)) - items.removeOne(item); - setSelectedItems(items); -} - -bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ - if (!data->designModeBehavior) - return false; - - return true; -} - -bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) -{ - if (!data->designModeBehavior) - return false; - data->currentTool->wheelEvent(event); - return true; -} - -void QDeclarativeViewObserver::setDesignModeBehavior(bool value) -{ - emit designModeBehaviorChanged(value); - - if (data->toolBox) - data->toolBox->toolBar()->setDesignModeBehavior(value); - sendDesignModeBehavior(value); - - data->designModeBehavior = value; - - if (!data->designModeBehavior) - data->clearEditorItems(); -} - -bool QDeclarativeViewObserver::designModeBehavior() -{ - return data->designModeBehavior; -} - -bool QDeclarativeViewObserver::showAppOnTop() const -{ - return data->showAppOnTop; -} - -void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop) -{ - if (data->view) { - QWidget *window = data->view->window(); - Qt::WindowFlags flags = window->windowFlags(); - if (appOnTop) - flags |= Qt::WindowStaysOnTopHint; - else - flags &= ~Qt::WindowStaysOnTopHint; - - window->setWindowFlags(flags); - window->show(); - } - - data->showAppOnTop = appOnTop; - sendShowAppOnTop(appOnTop); - - emit showAppOnTopChanged(appOnTop); -} - -void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, - Constants::ToolFlags /*flags*/) -{ - switch (tool) { - case Constants::SelectionToolMode: - _q_changeToSingleSelectTool(); - break; - case Constants::NoTool: - default: - currentTool = 0; - break; - } -} - -void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QList &items) -{ - foreach (const QWeakPointer &obj, currentSelection) { - if (QGraphicsItem *item = obj.data()) { - if (!items.contains(item)) { - QObject::disconnect(obj.data(), SIGNAL(destroyed(QObject*)), - this, SLOT(_q_removeFromSelection(QObject*))); - currentSelection.removeOne(obj); - } - } - } - - foreach (QGraphicsItem *item, items) { - if (QGraphicsObject *obj = item->toGraphicsObject()) { - if (!currentSelection.contains(obj)) { - QObject::connect(obj, SIGNAL(destroyed(QObject*)), - this, SLOT(_q_removeFromSelection(QObject*))); - currentSelection.append(obj); - } - } - } - - currentTool->updateSelectedItems(); -} - -void QDeclarativeViewObserverPrivate::setSelectedItems(const QList &items) -{ - QList > oldList = currentSelection; - setSelectedItemsForTools(items); - if (oldList != currentSelection) { - QList objectList; - foreach (const QWeakPointer &graphicsObject, currentSelection) { - if (graphicsObject) - objectList << graphicsObject.data(); - } - - q->sendCurrentObjects(objectList); - } -} - -QList QDeclarativeViewObserverPrivate::selectedItems() const -{ - QList selection; - foreach (const QWeakPointer &selectedObject, currentSelection) { - if (selectedObject.data()) - selection << selectedObject.data(); - } - - return selection; -} - -void QDeclarativeViewObserver::setSelectedItems(QList items) -{ - data->setSelectedItems(items); -} - -QList QDeclarativeViewObserver::selectedItems() const -{ - return data->selectedItems(); -} - -QDeclarativeView *QDeclarativeViewObserver::declarativeView() -{ - return data->view; -} - -void QDeclarativeViewObserverPrivate::clearHighlight() -{ - boundingRectHighlighter->clear(); -} - -void QDeclarativeViewObserverPrivate::highlight(const QList &items) -{ - if (items.isEmpty()) - return; - - QList objectList; - foreach (QGraphicsItem *item, items) { - QGraphicsItem *child = item; - - if (child) { - QGraphicsObject *childObject = child->toGraphicsObject(); - if (childObject) - objectList << childObject; - } - } - - boundingRectHighlighter->highlight(objectList); -} - -QList QDeclarativeViewObserverPrivate::selectableItems( - const QPointF &scenePos) const -{ - QList itemlist = view->scene()->items(scenePos); - return filterForSelection(itemlist); -} - -QList QDeclarativeViewObserverPrivate::selectableItems(const QPoint &pos) const -{ - QList itemlist = view->items(pos); - return filterForSelection(itemlist); -} - -QList QDeclarativeViewObserverPrivate::selectableItems( - const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const -{ - QList itemlist = view->scene()->items(sceneRect, selectionMode); - return filterForSelection(itemlist); -} - -void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() -{ - currentToolMode = Constants::SelectionToolMode; - selectionTool->setRubberbandSelectionMode(false); - - changeToSelectTool(); - - emit q->selectToolActivated(); - q->sendCurrentTool(Constants::SelectionToolMode); -} - -void QDeclarativeViewObserverPrivate::changeToSelectTool() -{ - if (currentTool == selectionTool) - return; - - currentTool->clear(); - currentTool = selectionTool; - currentTool->clear(); - currentTool->updateSelectedItems(); -} - -void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool() -{ - changeToSelectTool(); - currentToolMode = Constants::MarqueeSelectionToolMode; - selectionTool->setRubberbandSelectionMode(true); - - emit q->marqueeSelectToolActivated(); - q->sendCurrentTool(Constants::MarqueeSelectionToolMode); -} - -void QDeclarativeViewObserverPrivate::_q_changeToZoomTool() -{ - currentToolMode = Constants::ZoomMode; - currentTool->clear(); - currentTool = zoomTool; - currentTool->clear(); - - emit q->zoomToolActivated(); - q->sendCurrentTool(Constants::ZoomMode); -} - -void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() -{ - if (currentTool == colorPickerTool) - return; - - currentToolMode = Constants::ColorPickerMode; - currentTool->clear(); - currentTool = colorPickerTool; - currentTool->clear(); - - emit q->colorPickerActivated(); - q->sendCurrentTool(Constants::ColorPickerMode); -} - -void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) -{ - Q_ASSERT(slowDownFactor > 0); - if (data->slowDownFactor == slowDownFactor) - return; - - animationSpeedChangeRequested(slowDownFactor); - sendAnimationSpeed(slowDownFactor); -} - -void QDeclarativeViewObserver::setAnimationPaused(bool paused) -{ - if (data->animationPaused == paused) - return; - - animationPausedChangeRequested(paused); - sendAnimationPaused(paused); -} - -void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor) -{ - if (data->slowDownFactor != factor) { - data->slowDownFactor = factor; - emit animationSpeedChanged(factor); - } - - const float effectiveFactor = data->animationPaused ? 0 : factor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); -} - -void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused) -{ - if (data->animationPaused != paused) { - data->animationPaused = paused; - emit animationPausedChanged(paused); - } - - const float effectiveFactor = paused ? 0 : data->slowDownFactor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); -} - - -void QDeclarativeViewObserverPrivate::_q_applyChangesFromClient() -{ -} - - -QList QDeclarativeViewObserverPrivate::filterForSelection( - QList &itemlist) const -{ - foreach (QGraphicsItem *item, itemlist) { - if (isEditorItem(item)) - itemlist.removeOne(item); - } - - return itemlist; -} - -bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const -{ - return (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType - || item->data(Constants::EditorItemDataKey).toBool()); -} - -void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Status status) -{ - if (status == QDeclarativeView::Ready) - q->sendReloaded(); -} - -void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList objects) -{ - QList items; - QList gfxObjects; - foreach (QObject *obj, objects) { - if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { - items << declarativeItem; - gfxObjects << declarativeItem; - } - } - if (designModeBehavior) { - setSelectedItemsForTools(items); - clearHighlight(); - highlight(gfxObjects); - } -} - -// adjusts bounding boxes on edges of screen to be visible -QRectF QDeclarativeViewObserver::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) -{ - int marginFromEdge = 1; - QRectF boundingRect(boundingRectInSceneSpace); - if (qAbs(boundingRect.left()) - 1 < 2) - boundingRect.setLeft(marginFromEdge); - - QRect rect = data->view->rect(); - - if (boundingRect.right() >= rect.right()) - boundingRect.setRight(rect.right() - marginFromEdge); - - if (qAbs(boundingRect.top()) - 1 < 2) - boundingRect.setTop(marginFromEdge); - - if (boundingRect.bottom() >= rect.bottom()) - boundingRect.setBottom(rect.bottom() - marginFromEdge); - - return boundingRect; -} - -void QDeclarativeViewObserverPrivate::createToolBox() -{ - toolBox = new ToolBox(q->declarativeView()); - - QmlToolBar *toolBar = toolBox->toolBar(); - - QObject::connect(q, SIGNAL(selectedColorChanged(QColor)), - toolBar, SLOT(setColorBoxColor(QColor))); - - QObject::connect(q, SIGNAL(designModeBehaviorChanged(bool)), - toolBar, SLOT(setDesignModeBehavior(bool))); - - QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)), - q, SLOT(setDesignModeBehavior(bool))); - QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), q, SLOT(setAnimationSpeed(qreal))); - QObject::connect(toolBar, SIGNAL(animationPausedChanged(bool)), q, SLOT(setAnimationPaused(bool))); - QObject::connect(toolBar, SIGNAL(colorPickerSelected()), this, SLOT(_q_changeToColorPickerTool())); - QObject::connect(toolBar, SIGNAL(zoomToolSelected()), this, SLOT(_q_changeToZoomTool())); - QObject::connect(toolBar, SIGNAL(selectToolSelected()), this, SLOT(_q_changeToSingleSelectTool())); - QObject::connect(toolBar, SIGNAL(marqueeSelectToolSelected()), - this, SLOT(_q_changeToMarqueeSelectTool())); - - QObject::connect(toolBar, SIGNAL(applyChangesFromQmlFileSelected()), - this, SLOT(_q_applyChangesFromClient())); - - QObject::connect(q, SIGNAL(animationSpeedChanged(qreal)), toolBar, SLOT(setAnimationSpeed(qreal))); - QObject::connect(q, SIGNAL(animationPausedChanged(bool)), toolBar, SLOT(setAnimationPaused(bool))); - - QObject::connect(q, SIGNAL(selectToolActivated()), toolBar, SLOT(activateSelectTool())); - - // disabled features - //connect(d->m_toolBar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient())); - //connect(q, SIGNAL(resizeToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); - //connect(q, SIGNAL(moveToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); - - QObject::connect(q, SIGNAL(colorPickerActivated()), toolBar, SLOT(activateColorPicker())); - QObject::connect(q, SIGNAL(zoomToolActivated()), toolBar, SLOT(activateZoom())); - QObject::connect(q, SIGNAL(marqueeSelectToolActivated()), - toolBar, SLOT(activateMarqueeSelectTool())); -} - -void QDeclarativeViewObserver::handleMessage(const QByteArray &message) -{ - QDataStream ds(message); - - ObserverProtocol::Message type; - ds >> type; - - switch (type) { - case ObserverProtocol::SetCurrentObjects: { - int itemCount = 0; - ds >> itemCount; - - QList selectedObjects; - for (int i = 0; i < itemCount; ++i) { - int debugId = -1; - ds >> debugId; - if (QObject *obj = QDeclarativeDebugService::objectForId(debugId)) - selectedObjects << obj; - } - - data->_q_onCurrentObjectsChanged(selectedObjects); - break; - } - case ObserverProtocol::Reload: { - data->_q_reloadView(); - break; - } - case ObserverProtocol::SetAnimationSpeed: { - qreal speed; - ds >> speed; - animationSpeedChangeRequested(speed); - break; - } - case ObserverProtocol::SetAnimationPaused: { - bool paused; - ds >> paused; - animationPausedChangeRequested(paused); - break; - } - case ObserverProtocol::ChangeTool: { - ObserverProtocol::Tool tool; - ds >> tool; - switch (tool) { - case ObserverProtocol::ColorPickerTool: - data->_q_changeToColorPickerTool(); - break; - case ObserverProtocol::SelectTool: - data->_q_changeToSingleSelectTool(); - break; - case ObserverProtocol::SelectMarqueeTool: - data->_q_changeToMarqueeSelectTool(); - break; - case ObserverProtocol::ZoomTool: - data->_q_changeToZoomTool(); - break; - default: - qWarning() << "Warning: Unhandled tool:" << tool; - } - break; - } - case ObserverProtocol::SetDesignMode: { - bool inDesignMode; - ds >> inDesignMode; - setDesignModeBehavior(inDesignMode); - break; - } - case ObserverProtocol::ShowAppOnTop: { - bool showOnTop; - ds >> showOnTop; - setShowAppOnTop(showOnTop); - break; - } - case ObserverProtocol::CreateObject: { - QString qml; - int parentId; - QString filename; - QStringList imports; - ds >> qml >> parentId >> imports >> filename; - data->_q_createQmlObject(qml, QDeclarativeDebugService::objectForId(parentId), - imports, filename); - break; - } - case ObserverProtocol::DestroyObject: { - int debugId; - ds >> debugId; - if (QObject* obj = QDeclarativeDebugService::objectForId(debugId)) - obj->deleteLater(); - break; - } - case ObserverProtocol::MoveObject: { - int debugId, newParent; - ds >> debugId >> newParent; - data->_q_reparentQmlObject(QDeclarativeDebugService::objectForId(debugId), - QDeclarativeDebugService::objectForId(newParent)); - break; - } - case ObserverProtocol::ObjectIdList: { - int itemCount; - ds >> itemCount; - data->stringIdForObjectId.clear(); - for (int i = 0; i < itemCount; ++i) { - int itemDebugId; - QString itemIdString; - ds >> itemDebugId - >> itemIdString; - - data->stringIdForObjectId.insert(itemDebugId, itemIdString); - } - break; - } - case ObserverProtocol::ClearComponentCache: { - data->_q_clearComponentCache(); - break; - } - default: - qWarning() << "Warning: Not handling message:" << type; - } -} - -void QDeclarativeViewObserver::sendDesignModeBehavior(bool inDesignMode) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::SetDesignMode - << inDesignMode; - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendCurrentObjects(const QList &objects) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::CurrentObjectsChanged - << objects.length(); - - foreach (QObject *object, objects) { - int id = QDeclarativeDebugService::idForObject(object); - ds << id; - } - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendCurrentTool(Constants::DesignTool toolId) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::ToolChanged - << toolId; - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendAnimationSpeed(qreal slowDownFactor) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::AnimationSpeedChanged - << slowDownFactor; - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendAnimationPaused(bool paused) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::AnimationPausedChanged - << paused; - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendReloaded() -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::Reloaded; - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendShowAppOnTop(bool showAppOnTop) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::ShowAppOnTop << showAppOnTop; - - data->debugService->sendMessage(message); -} - -void QDeclarativeViewObserver::sendColorChanged(const QColor &color) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::ColorChanged - << color; - - data->debugService->sendMessage(message); -} - -QString QDeclarativeViewObserver::idStringForObject(QObject *obj) const -{ - int id = QDeclarativeDebugService::idForObject(obj); - QString idString = data->stringIdForObjectId.value(id, QString()); - return idString; -} - -QT_END_NAMESPACE - -#include "qdeclarativeviewobserver.moc" diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h deleted file mode 100644 index 5c70c98..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIEWOBSERVER_P_H -#define QDECLARATIVEVIEWOBSERVER_P_H - -#include -#include "qmlobserverconstants_p.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QToolBar) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserverPrivate; - -class QDeclarativeViewObserver : public QObject -{ - Q_OBJECT - -public: - explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewObserver(); - - void setSelectedItems(QList items); - QList selectedItems() const; - - QDeclarativeView *declarativeView(); - - QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace); - - bool showAppOnTop() const; - - void sendDesignModeBehavior(bool inDesignMode); - void sendCurrentObjects(const QList &); - void sendAnimationSpeed(qreal slowDownFactor); - void sendAnimationPaused(bool paused); - void sendCurrentTool(Constants::DesignTool toolId); - void sendReloaded(); - void sendShowAppOnTop(bool showAppOnTop); - - QString idStringForObject(QObject *obj) const; - -public Q_SLOTS: - void sendColorChanged(const QColor &color); - - void setDesignModeBehavior(bool value); - bool designModeBehavior(); - - void setShowAppOnTop(bool appOnTop); - - void setAnimationSpeed(qreal factor); - void setAnimationPaused(bool paused); - -Q_SIGNALS: - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void marqueeSelectToolActivated(); - void selectToolActivated(); - void zoomToolActivated(); - void colorPickerActivated(); - void selectedColorChanged(const QColor &color); - - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - - bool leaveEvent(QEvent *); - bool mousePressEvent(QMouseEvent *event); - bool mouseMoveEvent(QMouseEvent *event); - bool mouseReleaseEvent(QMouseEvent *event); - bool keyPressEvent(QKeyEvent *event); - bool keyReleaseEvent(QKeyEvent *keyEvent); - bool mouseDoubleClickEvent(QMouseEvent *event); - bool wheelEvent(QWheelEvent *event); - - void setSelectedItemsForTools(QList items); - -private slots: - void handleMessage(const QByteArray &message); - - void animationSpeedChangeRequested(qreal factor); - void animationPausedChangeRequested(bool paused); - -private: - Q_DISABLE_COPY(QDeclarativeViewObserver) - - inline QDeclarativeViewObserverPrivate *d_func() { return data.data(); } - QScopedPointer data; - friend class QDeclarativeViewObserverPrivate; - friend class AbstractLiveEditTool; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEVIEWOBSERVER_P_H diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h deleted file mode 100644 index 19e4898..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIEWOBSERVER_P_P_H -#define QDECLARATIVEVIEWOBSERVER_P_P_H - -#include "qdeclarativeviewobserver_p.h" - -#include -#include - -#include "QtDeclarative/private/qdeclarativeobserverservice_p.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeViewObserver; -class LiveSelectionTool; -class ZoomTool; -class ColorPickerTool; -class LiveLayerItem; -class BoundingRectHighlighter; -class ToolBox; -class AbstractLiveEditTool; - -class QDeclarativeViewObserverPrivate : public QObject -{ - Q_OBJECT -public: - QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *); - ~QDeclarativeViewObserverPrivate(); - - QDeclarativeView *view; - QDeclarativeViewObserver *q; - QDeclarativeObserverService *debugService; - QWeakPointer viewport; - QHash stringIdForObjectId; - - QPointF cursorPos; - QList > currentSelection; - - Constants::DesignTool currentToolMode; - AbstractLiveEditTool *currentTool; - - LiveSelectionTool *selectionTool; - ZoomTool *zoomTool; - ColorPickerTool *colorPickerTool; - LiveLayerItem *manipulatorLayer; - - BoundingRectHighlighter *boundingRectHighlighter; - - bool designModeBehavior; - bool showAppOnTop; - - bool animationPaused; - qreal slowDownFactor; - - ToolBox *toolBox; - - void setViewport(QWidget *widget); - - void clearEditorItems(); - void createToolBox(); - void changeToSelectTool(); - QList filterForSelection(QList &itemlist) const; - - QList selectableItems(const QPoint &pos) const; - QList selectableItems(const QPointF &scenePos) const; - QList selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; - - void setSelectedItemsForTools(const QList &items); - void setSelectedItems(const QList &items); - QList selectedItems() const; - - void changeTool(Constants::DesignTool tool, - Constants::ToolFlags flags = Constants::NoToolFlags); - - void clearHighlight(); - void highlight(const QList &item); - inline void highlight(QGraphicsObject *item) - { highlight(QList() << item); } - - bool isEditorItem(QGraphicsItem *item) const; - -public slots: - void _q_setToolBoxVisible(bool visible); - - void _q_reloadView(); - void _q_onStatusChanged(QDeclarativeView::Status status); - void _q_onCurrentObjectsChanged(QList objects); - void _q_applyChangesFromClient(); - void _q_createQmlObject(const QString &qml, QObject *parent, - const QStringList &imports, const QString &filename = QString()); - void _q_reparentQmlObject(QObject *, QObject *); - - void _q_changeToSingleSelectTool(); - void _q_changeToMarqueeSelectTool(); - void _q_changeToZoomTool(); - void _q_changeToColorPickerTool(); - void _q_clearComponentCache(); - void _q_removeFromSelection(QObject *); - -public: - static QDeclarativeViewObserverPrivate *get(QDeclarativeViewObserver *v) { return v->d_func(); } -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEVIEWOBSERVER_P_P_H diff --git a/src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h b/src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h deleted file mode 100644 index 6d0a263..0000000 --- a/src/plugins/qmltooling/declarativeobserver/qmlobserverconstants_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLOBSERVERCONSTANTS_H -#define QMLOBSERVERCONSTANTS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -namespace Constants { - -enum DesignTool { - NoTool = 0, - SelectionToolMode = 1, - MarqueeSelectionToolMode = 2, - MoveToolMode = 3, - ResizeToolMode = 4, - ColorPickerMode = 5, - ZoomMode = 6 -}; - -enum ToolFlags { - NoToolFlags = 0, - UseCursorPos = 1 -}; - -static const int DragStartTime = 50; - -static const int DragStartDistance = 20; - -static const double ZoomSnapDelta = 0.04; - -static const int EditorItemDataKey = 1000; - -enum GraphicsItemTypes { - EditorItemType = 0xEAAA, - ResizeHandleItemType = 0xEAEA -}; - - -} // namespace Constants - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMLOBSERVERCONSTANTS_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp new file mode 100644 index 0000000..36e6ba0 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractliveedittool_p.h" +#include "../qdeclarativeviewinspector_p_p.h" + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) + : QObject(editorView), m_inspector(editorView) +{ +} + + +AbstractLiveEditTool::~AbstractLiveEditTool() +{ +} + +QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const +{ + return m_inspector; +} + +QDeclarativeView *AbstractLiveEditTool::view() const +{ + return m_inspector->declarativeView(); +} + +QGraphicsScene* AbstractLiveEditTool::scene() const +{ + return view()->scene(); +} + +void AbstractLiveEditTool::updateSelectedItems() +{ + selectedItemsChanged(items()); +} + +QList AbstractLiveEditTool::items() const +{ + return inspector()->selectedItems(); +} + +bool AbstractLiveEditTool::topItemIsMovable(const QList & itemList) +{ + QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); + if (firstSelectableItem == 0) + return false; + if (toQDeclarativeItem(firstSelectableItem) != 0) + return true; + + return false; + +} + +bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList &itemList) +{ + QList selectedItems = inspector()->selectedItems(); + + foreach (QGraphicsItem *item, itemList) { + QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); + if (declarativeItem + && selectedItems.contains(declarativeItem) + /*&& (declarativeItem->qmlItemNode().hasShowContent() || selectNonContentItems)*/) + return true; + } + + return false; + +} + +bool AbstractLiveEditTool::topItemIsResizeHandle(const QList &/*itemList*/) +{ + return false; +} + +QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item) +{ + return qobject_cast(item->toGraphicsObject()); +} + +QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList &itemList) +{ + foreach (QGraphicsItem *item, itemList) { + if (item->flags().testFlag(QGraphicsItem::ItemIsMovable)) + return item; + } + return 0; +} + +QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList + &itemList) +{ + foreach (QGraphicsItem *item, itemList) { + QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); + if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/) + return declarativeItem; + } + + return 0; +} + +QList AbstractLiveEditTool::toGraphicsObjectList(const QList + &itemList) +{ + QList gfxObjects; + foreach (QGraphicsItem *item, itemList) { + QGraphicsObject *obj = item->toGraphicsObject(); + if (obj) + gfxObjects << obj; + } + + return gfxObjects; +} + +QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) +{ + QString className(QLatin1String("QGraphicsItem")); + QString objectStringId; + + QString constructedName; + + QGraphicsObject *gfxObject = item->toGraphicsObject(); + if (gfxObject) { + className = QLatin1String(gfxObject->metaObject()->className()); + + className.remove(QRegExp(QLatin1String("_QMLTYPE_\\d+"))); + className.remove(QRegExp(QLatin1String("_QML_\\d+"))); + if (className.startsWith(QLatin1String("QDeclarative"))) + className = className.remove(QLatin1String("QDeclarative")); + + QDeclarativeItem *declarativeItem = qobject_cast(gfxObject); + if (declarativeItem) { + objectStringId = m_inspector->idStringForObject(declarativeItem); + } + + if (!objectStringId.isEmpty()) { + constructedName = objectStringId + QLatin1String(" (") + className + QLatin1Char(')'); + } else { + if (!gfxObject->objectName().isEmpty()) { + constructedName = gfxObject->objectName() + QLatin1String(" (") + className + QLatin1Char(')'); + } else { + constructedName = className; + } + } + } + + return constructedName; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h new file mode 100644 index 0000000..17eb6ea --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTLIVEEDITTOOL_H +#define ABSTRACTLIVEEDITTOOL_H + +#include +#include + +QT_BEGIN_NAMESPACE +class QMouseEvent; +class QGraphicsItem; +class QDeclarativeItem; +class QKeyEvent; +class QGraphicsScene; +class QGraphicsObject; +class QWheelEvent; +class QDeclarativeView; +QT_END_NAMESPACE + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; + +class AbstractLiveEditTool : public QObject +{ + Q_OBJECT +public: + AbstractLiveEditTool(QDeclarativeViewInspector *inspector); + + virtual ~AbstractLiveEditTool(); + + virtual void mousePressEvent(QMouseEvent *event) = 0; + virtual void mouseMoveEvent(QMouseEvent *event) = 0; + virtual void mouseReleaseEvent(QMouseEvent *event) = 0; + virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0; + + virtual void hoverMoveEvent(QMouseEvent *event) = 0; + virtual void wheelEvent(QWheelEvent *event) = 0; + + virtual void keyPressEvent(QKeyEvent *event) = 0; + virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0; + virtual void itemsAboutToRemoved(const QList &itemList) = 0; + + virtual void clear() = 0; + + void updateSelectedItems(); + QList items() const; + + bool topItemIsMovable(const QList &itemList); + bool topItemIsResizeHandle(const QList &itemList); + bool topSelectedItemIsMovable(const QList &itemList); + + QString titleForItem(QGraphicsItem *item); + + static QList toGraphicsObjectList(const QList &itemList); + static QGraphicsItem* topMovableGraphicsItem(const QList &itemList); + static QDeclarativeItem* topMovableDeclarativeItem(const QList &itemList); + static QDeclarativeItem *toQDeclarativeItem(QGraphicsItem *item); + +protected: + virtual void selectedItemsChanged(const QList &objectList) = 0; + + QDeclarativeViewInspector *inspector() const; + QDeclarativeView *view() const; + QGraphicsScene *scene() const; + +private: + QDeclarativeViewInspector *m_inspector; + QList m_itemList; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTLIVEEDITTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp new file mode 100644 index 0000000..8e551d2 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp @@ -0,0 +1,282 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "boundingrecthighlighter_p.h" + +#include "../qdeclarativeviewinspector_p.h" +#include "../qmlinspectorconstants_p.h" + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +const qreal AnimDelta = 0.025f; +const int AnimInterval = 30; +const int AnimFrames = 10; + +BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, + QObject *parent) + : QObject(parent), + highlightedObject(itemToHighlight), + highlightPolygon(0), + highlightPolygonEdge(0) +{ + highlightPolygon = new BoundingBoxPolygonItem(parentItem); + highlightPolygonEdge = new BoundingBoxPolygonItem(parentItem); + + highlightPolygon->setPen(QPen(QColor(0, 22, 159))); + highlightPolygonEdge->setPen(QPen(QColor(158, 199, 255))); + + highlightPolygon->setFlag(QGraphicsItem::ItemIsSelectable, false); + highlightPolygonEdge->setFlag(QGraphicsItem::ItemIsSelectable, false); +} + +BoundingBox::~BoundingBox() +{ + highlightedObject.clear(); +} + +BoundingBoxPolygonItem::BoundingBoxPolygonItem(QGraphicsItem *item) : QGraphicsPolygonItem(item) +{ + QPen pen; + pen.setColor(QColor(108, 141, 221)); + pen.setWidth(1); + setPen(pen); +} + +int BoundingBoxPolygonItem::type() const +{ + return Constants::EditorItemType; +} + +BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) : + LiveLayerItem(view->declarativeView()->scene()), + m_view(view), + m_animFrame(0) +{ + m_animTimer = new QTimer(this); + m_animTimer->setInterval(AnimInterval); + connect(m_animTimer, SIGNAL(timeout()), SLOT(animTimeout())); +} + +BoundingRectHighlighter::~BoundingRectHighlighter() +{ + +} + +void BoundingRectHighlighter::animTimeout() +{ + ++m_animFrame; + if (m_animFrame == AnimFrames) { + m_animTimer->stop(); + } + + qreal alpha = m_animFrame / float(AnimFrames); + + foreach (BoundingBox *box, m_boxes) { + box->highlightPolygonEdge->setOpacity(alpha); + } +} + +void BoundingRectHighlighter::clear() +{ + if (m_boxes.length()) { + m_animTimer->stop(); + + foreach (BoundingBox *box, m_boxes) { + freeBoundingBox(box); + } + } +} + +BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const +{ + foreach (BoundingBox *box, m_boxes) { + if (box->highlightedObject.data() == item) { + return box; + } + } + return 0; +} + +void BoundingRectHighlighter::highlight(QList items) +{ + if (items.isEmpty()) + return; + + bool animate = false; + + QList newBoxes; + foreach (QGraphicsObject *itemToHighlight, items) { + BoundingBox *box = boxFor(itemToHighlight); + if (!box) { + box = createBoundingBox(itemToHighlight); + animate = true; + } + + newBoxes << box; + } + qSort(newBoxes); + + if (newBoxes != m_boxes) { + clear(); + m_boxes << newBoxes; + } + + highlightAll(animate); +} + +void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) +{ + if (!itemToHighlight) + return; + + bool animate = false; + + BoundingBox *box = boxFor(itemToHighlight); + if (!box) { + box = createBoundingBox(itemToHighlight); + m_boxes << box; + animate = true; + qSort(m_boxes); + } + + highlightAll(animate); +} + +BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight) +{ + if (!m_freeBoxes.isEmpty()) { + BoundingBox *box = m_freeBoxes.last(); + if (box->highlightedObject.isNull()) { + box->highlightedObject = itemToHighlight; + box->highlightPolygon->show(); + box->highlightPolygonEdge->show(); + m_freeBoxes.removeLast(); + return box; + } + } + + BoundingBox *box = new BoundingBox(itemToHighlight, this, this); + + connect(itemToHighlight, SIGNAL(xChanged()), this, SLOT(refresh())); + connect(itemToHighlight, SIGNAL(yChanged()), this, SLOT(refresh())); + connect(itemToHighlight, SIGNAL(widthChanged()), this, SLOT(refresh())); + connect(itemToHighlight, SIGNAL(heightChanged()), this, SLOT(refresh())); + connect(itemToHighlight, SIGNAL(rotationChanged()), this, SLOT(refresh())); + connect(itemToHighlight, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*))); + + return box; +} + +void BoundingRectHighlighter::removeBoundingBox(BoundingBox *box) +{ + delete box; + box = 0; +} + +void BoundingRectHighlighter::freeBoundingBox(BoundingBox *box) +{ + if (!box->highlightedObject.isNull()) { + disconnect(box->highlightedObject.data(), SIGNAL(xChanged()), this, SLOT(refresh())); + disconnect(box->highlightedObject.data(), SIGNAL(yChanged()), this, SLOT(refresh())); + disconnect(box->highlightedObject.data(), SIGNAL(widthChanged()), this, SLOT(refresh())); + disconnect(box->highlightedObject.data(), SIGNAL(heightChanged()), this, SLOT(refresh())); + disconnect(box->highlightedObject.data(), SIGNAL(rotationChanged()), this, SLOT(refresh())); + } + + box->highlightedObject.clear(); + box->highlightPolygon->hide(); + box->highlightPolygonEdge->hide(); + m_boxes.removeOne(box); + m_freeBoxes << box; +} + +void BoundingRectHighlighter::itemDestroyed(QObject *obj) +{ + foreach (BoundingBox *box, m_boxes) { + if (box->highlightedObject.data() == obj) { + freeBoundingBox(box); + break; + } + } +} + +void BoundingRectHighlighter::highlightAll(bool animate) +{ + foreach (BoundingBox *box, m_boxes) { + if (box && box->highlightedObject.isNull()) { + // clear all highlights + clear(); + return; + } + QGraphicsObject *item = box->highlightedObject.data(); + + QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); + QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); + QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); + QRectF edgeRect = bboxRect; + edgeRect.adjust(-1, -1, 1, 1); + + box->highlightPolygon->setPolygon(QPolygonF(bboxRect)); + box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect)); + + if (animate) + box->highlightPolygonEdge->setOpacity(0); + } + + if (animate) { + m_animFrame = 0; + m_animTimer->start(); + } +} + +void BoundingRectHighlighter::refresh() +{ + if (!m_boxes.isEmpty()) + highlightAll(true); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h new file mode 100644 index 0000000..89a9cf2 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BOUNDINGRECTHIGHLIGHTER_H +#define BOUNDINGRECTHIGHLIGHTER_H + +#include "livelayeritem_p.h" + +#include +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsItem) +QT_FORWARD_DECLARE_CLASS(QPainter) +QT_FORWARD_DECLARE_CLASS(QWidget) +QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem) +QT_FORWARD_DECLARE_CLASS(QTimer) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; +class BoundingBox; + +class BoundingRectHighlighter : public LiveLayerItem +{ + Q_OBJECT +public: + explicit BoundingRectHighlighter(QDeclarativeViewInspector *view); + ~BoundingRectHighlighter(); + void clear(); + void highlight(QList items); + void highlight(QGraphicsObject* item); + +private slots: + void refresh(); + void animTimeout(); + void itemDestroyed(QObject *); + +private: + BoundingBox *boxFor(QGraphicsObject *item) const; + void highlightAll(bool animate); + BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight); + void removeBoundingBox(BoundingBox *box); + void freeBoundingBox(BoundingBox *box); + +private: + Q_DISABLE_COPY(BoundingRectHighlighter) + + QDeclarativeViewInspector *m_view; + QList m_boxes; + QList m_freeBoxes; + QTimer *m_animTimer; + qreal m_animScale; + int m_animFrame; + +}; + +class BoundingBox : public QObject +{ + Q_OBJECT +public: + explicit BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, + QObject *parent = 0); + ~BoundingBox(); + QWeakPointer highlightedObject; + QGraphicsPolygonItem *highlightPolygon; + QGraphicsPolygonItem *highlightPolygonEdge; + +private: + Q_DISABLE_COPY(BoundingBox) + +}; + +class BoundingBoxPolygonItem : public QGraphicsPolygonItem +{ +public: + explicit BoundingBoxPolygonItem(QGraphicsItem *item); + int type() const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // BOUNDINGRECTHIGHLIGHTER_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp new file mode 100644 index 0000000..bdae3d8 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "colorpickertool_p.h" + +#include "../qdeclarativeviewinspector_p.h" + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) : + AbstractLiveEditTool(view) +{ + m_selectedColor.setRgb(0,0,0); +} + +ColorPickerTool::~ColorPickerTool() +{ + +} + +void ColorPickerTool::mousePressEvent(QMouseEvent * /*event*/) +{ +} + +void ColorPickerTool::mouseMoveEvent(QMouseEvent *event) +{ + pickColor(event->pos()); +} + +void ColorPickerTool::mouseReleaseEvent(QMouseEvent *event) +{ + pickColor(event->pos()); +} + +void ColorPickerTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) +{ +} + + +void ColorPickerTool::hoverMoveEvent(QMouseEvent * /*event*/) +{ +} + +void ColorPickerTool::keyPressEvent(QKeyEvent * /*event*/) +{ +} + +void ColorPickerTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) +{ +} +void ColorPickerTool::wheelEvent(QWheelEvent * /*event*/) +{ +} + +void ColorPickerTool::itemsAboutToRemoved(const QList &/*itemList*/) +{ +} + +void ColorPickerTool::clear() +{ + view()->setCursor(Qt::CrossCursor); +} + +void ColorPickerTool::selectedItemsChanged(const QList &/*itemList*/) +{ +} + +void ColorPickerTool::pickColor(const QPoint &pos) +{ + QRgb fillColor = view()->backgroundBrush().color().rgb(); + if (view()->backgroundBrush().style() == Qt::NoBrush) + fillColor = view()->palette().color(QPalette::Base).rgb(); + + QRectF target(0,0, 1, 1); + QRect source(pos.x(), pos.y(), 1, 1); + QImage img(1, 1, QImage::Format_ARGB32); + img.fill(fillColor); + QPainter painter(&img); + view()->render(&painter, target, source); + m_selectedColor = QColor::fromRgb(img.pixel(0, 0)); + + emit selectedColorChanged(m_selectedColor); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h new file mode 100644 index 0000000..580c175 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef COLORPICKERTOOL_H +#define COLORPICKERTOOL_H + +#include "abstractliveedittool_p.h" + +#include + +QT_FORWARD_DECLARE_CLASS(QPoint) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class ColorPickerTool : public AbstractLiveEditTool +{ + Q_OBJECT +public: + explicit ColorPickerTool(QDeclarativeViewInspector *view); + + virtual ~ColorPickerTool(); + + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + + void hoverMoveEvent(QMouseEvent *event); + + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *keyEvent); + + void wheelEvent(QWheelEvent *event); + + void itemsAboutToRemoved(const QList &itemList); + + void clear(); + +signals: + void selectedColorChanged(const QColor &color); + +protected: + + void selectedItemsChanged(const QList &itemList); + +private: + void pickColor(const QPoint &pos); + +private: + QColor m_selectedColor; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // COLORPICKERTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc b/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc new file mode 100644 index 0000000..fb2393c --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc @@ -0,0 +1,24 @@ + + + images/resize_handle.png + images/select.png + images/select-marquee.png + images/color-picker.png + images/play.png + images/pause.png + images/from-qml.png + images/to-qml.png + images/color-picker-hicontrast.png + images/zoom.png + images/color-picker-24.png + images/from-qml-24.png + images/pause-24.png + images/play-24.png + images/to-qml-24.png + images/zoom-24.png + images/select-24.png + images/select-marquee-24.png + images/inspectormode.png + images/inspectormode-24.png + + diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png new file mode 100644 index 0000000..cff4721 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png new file mode 100644 index 0000000..b953d08 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png new file mode 100644 index 0000000..026c31b Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png new file mode 100644 index 0000000..0ad21f3 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png new file mode 100644 index 0000000..666382c Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png new file mode 100644 index 0000000..5e74d86 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png new file mode 100644 index 0000000..daed21c Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png new file mode 100644 index 0000000..d9a2f6f Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png new file mode 100644 index 0000000..114d89b Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png new file mode 100644 index 0000000..e2b9fbc Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png new file mode 100644 index 0000000..011598a Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png new file mode 100644 index 0000000..7042bec Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png new file mode 100644 index 0000000..2934f25 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png new file mode 100644 index 0000000..5388a9d Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png new file mode 100644 index 0000000..0111dda Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png new file mode 100644 index 0000000..92fe40d Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png new file mode 100644 index 0000000..6722855 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png new file mode 100644 index 0000000..b72450d Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png new file mode 100644 index 0000000..2ab951f Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png new file mode 100644 index 0000000..0346200 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png new file mode 100644 index 0000000..17f0da6 Binary files /dev/null and b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png differ diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp new file mode 100644 index 0000000..c28893e --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "livelayeritem_p.h" + +#include "../qmlinspectorconstants_p.h" + +#include + +QT_BEGIN_NAMESPACE + +LiveLayerItem::LiveLayerItem(QGraphicsScene* scene) + : QGraphicsObject() +{ + scene->addItem(this); + setZValue(1); + setFlag(QGraphicsItem::ItemIsMovable, false); +} + +LiveLayerItem::~LiveLayerItem() +{ +} + +void LiveLayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, + QWidget * /*widget*/) +{ +} + +int LiveLayerItem::type() const +{ + return Constants::EditorItemType; +} + +QRectF LiveLayerItem::boundingRect() const +{ + return childrenBoundingRect(); +} + +QList LiveLayerItem::findAllChildItems() const +{ + return findAllChildItems(this); +} + +QList LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const +{ + QList itemList(item->childItems()); + + foreach (QGraphicsItem *childItem, item->childItems()) + itemList += findAllChildItems(childItem); + + return itemList; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h new file mode 100644 index 0000000..da622e1 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIVELAYERITEM_H +#define LIVELAYERITEM_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class LiveLayerItem : public QGraphicsObject +{ +public: + LiveLayerItem(QGraphicsScene *scene); + ~LiveLayerItem(); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget = 0); + QRectF boundingRect() const; + int type() const; + + QList findAllChildItems() const; + +protected: + QList findAllChildItems(const QGraphicsItem *item) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // LIVELAYERITEM_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp new file mode 100644 index 0000000..d32847d --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "liverubberbandselectionmanipulator_p.h" + +#include "../qdeclarativeviewinspector_p_p.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, + QDeclarativeViewInspector *editorView) + : m_selectionRectangleElement(layerItem), + m_editorView(editorView), + m_beginFormEditorItem(0), + m_isActive(false) +{ + m_selectionRectangleElement.hide(); +} + +void LiveRubberBandSelectionManipulator::clear() +{ + m_selectionRectangleElement.clear(); + m_isActive = false; + m_beginPoint = QPointF(); + m_itemList.clear(); + m_oldSelectionList.clear(); +} + +QGraphicsItem *LiveRubberBandSelectionManipulator::topFormEditorItem(const QList + &itemList) +{ + if (itemList.isEmpty()) + return 0; + + return itemList.first(); +} + +void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint) +{ + m_beginPoint = beginPoint; + m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint); + m_selectionRectangleElement.show(); + m_isActive = true; + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(m_editorView); + m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint)); + m_oldSelectionList = m_editorView->selectedItems(); +} + +void LiveRubberBandSelectionManipulator::update(const QPointF &updatePoint) +{ + m_selectionRectangleElement.setRect(m_beginPoint, updatePoint); +} + +void LiveRubberBandSelectionManipulator::end() +{ + m_oldSelectionList.clear(); + m_selectionRectangleElement.hide(); + m_isActive = false; +} + +void LiveRubberBandSelectionManipulator::select(SelectionType selectionType) +{ + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(m_editorView); + QList itemList + = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(), + Qt::IntersectsItemShape); + QList newSelectionList; + + foreach (QGraphicsItem* item, itemList) { + if (item + && item->parentItem() + && !newSelectionList.contains(item) + //&& m_beginFormEditorItem->childItems().contains(item) // TODO activate this test + ) + { + newSelectionList.append(item); + } + } + + if (newSelectionList.isEmpty() && m_beginFormEditorItem) + newSelectionList.append(m_beginFormEditorItem); + + QList resultList; + + switch (selectionType) { + case AddToSelection: { + resultList.append(m_oldSelectionList); + resultList.append(newSelectionList); + } + break; + case ReplaceSelection: { + resultList.append(newSelectionList); + } + break; + case RemoveFromSelection: { + QSet oldSelectionSet(m_oldSelectionList.toSet()); + QSet newSelectionSet(newSelectionList.toSet()); + resultList.append(oldSelectionSet.subtract(newSelectionSet).toList()); + } + } + + m_editorView->setSelectedItems(resultList); +} + + +void LiveRubberBandSelectionManipulator::setItems(const QList &itemList) +{ + m_itemList = itemList; +} + +QPointF LiveRubberBandSelectionManipulator::beginPoint() const +{ + return m_beginPoint; +} + +bool LiveRubberBandSelectionManipulator::isActive() const +{ + return m_isActive; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h new file mode 100644 index 0000000..9abcb2b --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef RUBBERBANDSELECTIONMANIPULATOR_H +#define RUBBERBANDSELECTIONMANIPULATOR_H + +#include "liveselectionrectangle_p.h" + +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsItem) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; + +class LiveRubberBandSelectionManipulator +{ +public: + enum SelectionType { + ReplaceSelection, + AddToSelection, + RemoveFromSelection + }; + + LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, + QDeclarativeViewInspector *editorView); + + void setItems(const QList &itemList); + + void begin(const QPointF& beginPoint); + void update(const QPointF& updatePoint); + void end(); + + void clear(); + + void select(SelectionType selectionType); + + QPointF beginPoint() const; + + bool isActive() const; + +protected: + QGraphicsItem *topFormEditorItem(const QList &itemList); + +private: + QList m_itemList; + QList m_oldSelectionList; + LiveSelectionRectangle m_selectionRectangleElement; + QPointF m_beginPoint; + QDeclarativeViewInspector *m_editorView; + QGraphicsItem *m_beginFormEditorItem; + bool m_isActive; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // RUBBERBANDSELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp new file mode 100644 index 0000000..4450fc5 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "liveselectionindicator_p.h" + +#include "../qdeclarativeviewinspector_p_p.h" +#include "../qmlinspectorconstants_p.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, + QGraphicsObject *layerItem) + : m_layerItem(layerItem) + , m_view(viewInspector) +{ +} + +LiveSelectionIndicator::~LiveSelectionIndicator() +{ + clear(); +} + +void LiveSelectionIndicator::show() +{ + foreach (QGraphicsRectItem *item, m_indicatorShapeHash) + item->show(); +} + +void LiveSelectionIndicator::hide() +{ + foreach (QGraphicsRectItem *item, m_indicatorShapeHash) + item->hide(); +} + +void LiveSelectionIndicator::clear() +{ + if (!m_layerItem.isNull()) { + QGraphicsScene *scene = m_layerItem.data()->scene(); + foreach (QGraphicsRectItem *item, m_indicatorShapeHash) { + scene->removeItem(item); + delete item; + } + } + + m_indicatorShapeHash.clear(); + +} + +void LiveSelectionIndicator::setItems(const QList > &itemList) +{ + clear(); + + foreach (const QWeakPointer &object, itemList) { + if (object.isNull()) + continue; + + QGraphicsItem *item = object.data(); + + if (!m_indicatorShapeHash.contains(item)) { + QGraphicsRectItem *selectionIndicator = new QGraphicsRectItem(m_layerItem.data()); + m_indicatorShapeHash.insert(item, selectionIndicator); + + const QRectF boundingRect = m_view->adjustToScreenBoundaries(item->mapRectToScene(item->boundingRect())); + const QRectF boundingRectInLayerItemSpace = m_layerItem.data()->mapRectFromScene(boundingRect); + + selectionIndicator->setData(Constants::EditorItemDataKey, true); + selectionIndicator->setFlag(QGraphicsItem::ItemIsSelectable, false); + selectionIndicator->setRect(boundingRectInLayerItemSpace); + selectionIndicator->setPen(QColor(108, 141, 221)); + } + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h new file mode 100644 index 0000000..fa6eb30 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIVESELECTIONINDICATOR_H +#define LIVESELECTIONINDICATOR_H + +#include +#include + +QT_BEGIN_NAMESPACE +class QGraphicsObject; +class QGraphicsRectItem; +class QGraphicsItem; +class QPolygonF; +QT_END_NAMESPACE + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; + +class LiveSelectionIndicator +{ +public: + LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem); + ~LiveSelectionIndicator(); + + void show(); + void hide(); + + void clear(); + + void setItems(const QList > &itemList); + +private: + QHash m_indicatorShapeHash; + QWeakPointer m_layerItem; + QDeclarativeViewInspector *m_view; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // LIVESELECTIONINDICATOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp new file mode 100644 index 0000000..267079a --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "liveselectionrectangle_p.h" + +#include "../qmlinspectorconstants_p.h" + +#include +#include +#include +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +class SelectionRectShape : public QGraphicsRectItem +{ +public: + SelectionRectShape(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {} + int type() const { return Constants::EditorItemType; } +}; + +LiveSelectionRectangle::LiveSelectionRectangle(QGraphicsObject *layerItem) + : m_controlShape(new SelectionRectShape(layerItem)), + m_layerItem(layerItem) +{ + m_controlShape->setPen(QPen(Qt::black)); + m_controlShape->setBrush(QColor(128, 128, 128, 50)); +} + +LiveSelectionRectangle::~LiveSelectionRectangle() +{ + if (m_layerItem) + m_layerItem.data()->scene()->removeItem(m_controlShape); +} + +void LiveSelectionRectangle::clear() +{ + hide(); +} +void LiveSelectionRectangle::show() +{ + m_controlShape->show(); +} + +void LiveSelectionRectangle::hide() +{ + m_controlShape->hide(); +} + +QRectF LiveSelectionRectangle::rect() const +{ + return m_controlShape->mapFromScene(m_controlShape->rect()).boundingRect(); +} + +void LiveSelectionRectangle::setRect(const QPointF &firstPoint, + const QPointF &secondPoint) +{ + double firstX = std::floor(firstPoint.x()) + 0.5; + double firstY = std::floor(firstPoint.y()) + 0.5; + double secondX = std::floor(secondPoint.x()) + 0.5; + double secondY = std::floor(secondPoint.y()) + 0.5; + QPointF topLeftPoint(firstX < secondX ? firstX : secondX, + firstY < secondY ? firstY : secondY); + QPointF bottomRightPoint(firstX > secondX ? firstX : secondX, + firstY > secondY ? firstY : secondY); + + QRectF rect(topLeftPoint, bottomRightPoint); + m_controlShape->setRect(rect); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h new file mode 100644 index 0000000..5da9fb8 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIVESELECTIONRECTANGLE_H +#define LIVESELECTIONRECTANGLE_H + +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsObject) +QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem) +QT_FORWARD_DECLARE_CLASS(QPointF) +QT_FORWARD_DECLARE_CLASS(QRectF) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class LiveSelectionRectangle +{ +public: + LiveSelectionRectangle(QGraphicsObject *layerItem); + ~LiveSelectionRectangle(); + + void show(); + void hide(); + + void clear(); + + void setRect(const QPointF &firstPoint, + const QPointF &secondPoint); + + QRectF rect() const; + +private: + QGraphicsRectItem *m_controlShape; + QWeakPointer m_layerItem; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // LIVESELECTIONRECTANGLE_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp new file mode 100644 index 0000000..c55cba3 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp @@ -0,0 +1,438 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "liveselectiontool_p.h" +#include "livelayeritem_p.h" + +#include "../qdeclarativeviewinspector_p_p.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) : + AbstractLiveEditTool(editorView), + m_rubberbandSelectionMode(false), + m_rubberbandSelectionManipulator( + QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView), + m_singleSelectionManipulator(editorView), + m_selectionIndicator(editorView, + QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer), + //m_resizeIndicator(editorView->manipulatorLayer()), + m_selectOnlyContentItems(true) +{ + +} + +LiveSelectionTool::~LiveSelectionTool() +{ +} + +void LiveSelectionTool::setRubberbandSelectionMode(bool value) +{ + m_rubberbandSelectionMode = value; +} + +LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionType(Qt::KeyboardModifiers + modifiers) +{ + LiveSingleSelectionManipulator::SelectionType selectionType + = LiveSingleSelectionManipulator::ReplaceSelection; + if (modifiers.testFlag(Qt::ControlModifier)) { + selectionType = LiveSingleSelectionManipulator::RemoveFromSelection; + } else if (modifiers.testFlag(Qt::ShiftModifier)) { + selectionType = LiveSingleSelectionManipulator::AddToSelection; + } + return selectionType; +} + +bool LiveSelectionTool::alreadySelected(const QList &itemList) const +{ + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + const QList selectedItems = inspectorPrivate->selectedItems(); + + if (selectedItems.isEmpty()) + return false; + + foreach (QGraphicsItem *item, itemList) + if (selectedItems.contains(item)) + return true; + + return false; +} + +void LiveSelectionTool::mousePressEvent(QMouseEvent *event) +{ + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + QList itemList = inspectorPrivate->selectableItems(event->pos()); + LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers()); + + if (event->buttons() & Qt::LeftButton) { + m_mousePressTimer.start(); + + if (m_rubberbandSelectionMode) { + m_rubberbandSelectionManipulator.begin(event->pos()); + } else { + m_singleSelectionManipulator.begin(event->pos()); + m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems); + } + } else if (event->buttons() & Qt::RightButton) { + createContextMenu(itemList, event->globalPos()); + } +} + +void LiveSelectionTool::createContextMenu(QList itemList, QPoint globalPos) +{ + QMenu contextMenu; + connect(&contextMenu, SIGNAL(hovered(QAction*)), + this, SLOT(contextMenuElementHovered(QAction*))); + + m_contextMenuItemList = itemList; + + contextMenu.addAction(tr("Items")); + contextMenu.addSeparator(); + int shortcutKey = Qt::Key_1; + bool addKeySequence = true; + int i = 0; + + foreach (QGraphicsItem * const item, itemList) { + QString itemTitle = titleForItem(item); + QAction *elementAction = contextMenu.addAction(itemTitle, this, + SLOT(contextMenuElementSelected())); + + if (inspector()->selectedItems().contains(item)) { + QFont boldFont = elementAction->font(); + boldFont.setBold(true); + elementAction->setFont(boldFont); + } + + elementAction->setData(i); + if (addKeySequence) + elementAction->setShortcut(QKeySequence(shortcutKey)); + + shortcutKey++; + if (shortcutKey > Qt::Key_9) + addKeySequence = false; + + ++i; + } + // add root item separately + // QString itemTitle = QString(tr("%1")).arg(titleForItem(view()->currentRootItem())); + // contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected())); + // m_contextMenuItemList.append(view()->currentRootItem()); + + contextMenu.exec(globalPos); + m_contextMenuItemList.clear(); +} + +void LiveSelectionTool::contextMenuElementSelected() +{ + QAction *senderAction = static_cast(sender()); + int itemListIndex = senderAction->data().toInt(); + if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { + + QPointF updatePt(0, 0); + QGraphicsItem *item = m_contextMenuItemList.at(itemListIndex); + m_singleSelectionManipulator.begin(updatePt); + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, + QList() << item, + false); + m_singleSelectionManipulator.end(updatePt); + } +} + +void LiveSelectionTool::contextMenuElementHovered(QAction *action) +{ + int itemListIndex = action->data().toInt(); + if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { + QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject(); + QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); + } +} + +void LiveSelectionTool::mouseMoveEvent(QMouseEvent *event) +{ + if (m_singleSelectionManipulator.isActive()) { + QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->pos(); + + if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) + && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) + { + m_singleSelectionManipulator.end(event->pos()); + //view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint()); + return; + } + } else if (m_rubberbandSelectionManipulator.isActive()) { + QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); + + if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) + && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) { + m_rubberbandSelectionManipulator.update(event->pos()); + + if (event->modifiers().testFlag(Qt::ControlModifier)) + m_rubberbandSelectionManipulator.select( + LiveRubberBandSelectionManipulator::RemoveFromSelection); + else if (event->modifiers().testFlag(Qt::ShiftModifier)) + m_rubberbandSelectionManipulator.select( + LiveRubberBandSelectionManipulator::AddToSelection); + else + m_rubberbandSelectionManipulator.select( + LiveRubberBandSelectionManipulator::ReplaceSelection); + } + } +} + +void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event) +{ +// ### commented out until move tool is re-enabled +// QList itemList = view()->items(event->pos()); +// if (!itemList.isEmpty() && !m_rubberbandSelectionMode) { +// +// foreach (QGraphicsItem *item, itemList) { +// if (item->type() == Constants::ResizeHandleItemType) { +// ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(item); +// if (resizeHandle) +// view()->changeTool(Constants::ResizeToolMode); +// return; +// } +// } +// if (topSelectedItemIsMovable(itemList)) +// view()->changeTool(Constants::MoveToolMode); +// } + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + + QList selectableItemList = inspectorPrivate->selectableItems(event->pos()); + if (!selectableItemList.isEmpty()) { + QGraphicsObject *item = selectableItemList.first()->toGraphicsObject(); + if (item) + QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); + + return; + } + + QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight(); +} + +void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) +{ + if (m_singleSelectionManipulator.isActive()) { + m_singleSelectionManipulator.end(event->pos()); + } + else if (m_rubberbandSelectionManipulator.isActive()) { + + QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); + if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) { + m_singleSelectionManipulator.begin(event->pos()); + + if (event->modifiers().testFlag(Qt::ControlModifier)) + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, + m_selectOnlyContentItems); + else if (event->modifiers().testFlag(Qt::ShiftModifier)) + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, + m_selectOnlyContentItems); + else + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, + m_selectOnlyContentItems); + + m_singleSelectionManipulator.end(event->pos()); + } else { + m_rubberbandSelectionManipulator.update(event->pos()); + + if (event->modifiers().testFlag(Qt::ControlModifier)) + m_rubberbandSelectionManipulator.select( + LiveRubberBandSelectionManipulator::RemoveFromSelection); + else if (event->modifiers().testFlag(Qt::ShiftModifier)) + m_rubberbandSelectionManipulator.select( + LiveRubberBandSelectionManipulator::AddToSelection); + else + m_rubberbandSelectionManipulator.select( + LiveRubberBandSelectionManipulator::ReplaceSelection); + + m_rubberbandSelectionManipulator.end(); + } + } +} + +void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) +{ +} + +void LiveSelectionTool::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Left: + case Qt::Key_Right: + case Qt::Key_Up: + case Qt::Key_Down: + // disabled for now, cannot move stuff yet. + //view()->changeTool(Constants::MoveToolMode); + //view()->currentTool()->keyPressEvent(event); + break; + } +} + +void LiveSelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) +{ + +} + +void LiveSelectionTool::wheelEvent(QWheelEvent *event) +{ + if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode) + return; + + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + QList itemList = inspectorPrivate->selectableItems(event->pos()); + + if (itemList.isEmpty()) + return; + + int selectedIdx = 0; + if (!inspector()->selectedItems().isEmpty()) { + selectedIdx = itemList.indexOf(inspector()->selectedItems().first()); + if (selectedIdx >= 0) { + if (event->delta() > 0) { + selectedIdx++; + if (selectedIdx == itemList.length()) + selectedIdx = 0; + } else if (event->delta() < 0) { + selectedIdx--; + if (selectedIdx == -1) + selectedIdx = itemList.length() - 1; + } + } else { + selectedIdx = 0; + } + } + + QPointF updatePt(0, 0); + m_singleSelectionManipulator.begin(updatePt); + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::ReplaceSelection, + QList() << itemList.at(selectedIdx), + false); + m_singleSelectionManipulator.end(updatePt); + +} + +void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems) +{ + m_selectOnlyContentItems = selectOnlyContentItems; +} + +void LiveSelectionTool::itemsAboutToRemoved(const QList &/*itemList*/) +{ +} + +void LiveSelectionTool::clear() +{ + view()->setCursor(Qt::ArrowCursor); + m_rubberbandSelectionManipulator.clear(), + m_singleSelectionManipulator.clear(); + m_selectionIndicator.clear(); + //m_resizeIndicator.clear(); +} + +void LiveSelectionTool::selectedItemsChanged(const QList &itemList) +{ + foreach (const QWeakPointer &obj, m_selectedItemList) { + if (!obj.isNull()) { + disconnect(obj.data(), SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); + disconnect(obj.data(), SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); + disconnect(obj.data(), SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); + disconnect(obj.data(), SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); + disconnect(obj.data(), SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); + } + } + + QList objects = toGraphicsObjectList(itemList); + m_selectedItemList.clear(); + + foreach (QGraphicsObject *obj, objects) { + m_selectedItemList.append(obj); + connect(obj, SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); + connect(obj, SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); + connect(obj, SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); + connect(obj, SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); + connect(obj, SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); + } + + m_selectionIndicator.setItems(m_selectedItemList); + //m_resizeIndicator.setItems(toGraphicsObjectList(itemList)); +} + +void LiveSelectionTool::repaintBoundingRects() +{ + m_selectionIndicator.setItems(m_selectedItemList); +} + +void LiveSelectionTool::selectUnderPoint(QMouseEvent *event) +{ + m_singleSelectionManipulator.begin(event->pos()); + + if (event->modifiers().testFlag(Qt::ControlModifier)) + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, + m_selectOnlyContentItems); + else if (event->modifiers().testFlag(Qt::ShiftModifier)) + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, + m_selectOnlyContentItems); + else + m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, + m_selectOnlyContentItems); + + m_singleSelectionManipulator.end(event->pos()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h new file mode 100644 index 0000000..7562f3e --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIVESELECTIONTOOL_H +#define LIVESELECTIONTOOL_H + +#include "abstractliveedittool_p.h" +#include "liverubberbandselectionmanipulator_p.h" +#include "livesingleselectionmanipulator_p.h" +#include "liveselectionindicator_p.h" + +#include +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsItem) +QT_FORWARD_DECLARE_CLASS(QMouseEvent) +QT_FORWARD_DECLARE_CLASS(QKeyEvent) +QT_FORWARD_DECLARE_CLASS(QAction) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class LiveSelectionTool : public AbstractLiveEditTool +{ + Q_OBJECT + +public: + LiveSelectionTool(QDeclarativeViewInspector* editorView); + ~LiveSelectionTool(); + + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + void hoverMoveEvent(QMouseEvent *event); + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *keyEvent); + void wheelEvent(QWheelEvent *event); + + void itemsAboutToRemoved(const QList &itemList); +// QVariant itemChange(const QList &itemList, +// QGraphicsItem::GraphicsItemChange change, +// const QVariant &value ); + +// void update(); + + void clear(); + + void selectedItemsChanged(const QList &itemList); + + void selectUnderPoint(QMouseEvent *event); + + void setSelectOnlyContentItems(bool selectOnlyContentItems); + + void setRubberbandSelectionMode(bool value); + +private slots: + void contextMenuElementSelected(); + void contextMenuElementHovered(QAction *action); + void repaintBoundingRects(); + +private: + void createContextMenu(QList itemList, QPoint globalPos); + LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers); + bool alreadySelected(const QList &itemList) const; + +private: + bool m_rubberbandSelectionMode; + LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator; + LiveSingleSelectionManipulator m_singleSelectionManipulator; + LiveSelectionIndicator m_selectionIndicator; + //ResizeIndicator m_resizeIndicator; + QTime m_mousePressTimer; + bool m_selectOnlyContentItems; + + QList > m_selectedItemList; + + QList m_contextMenuItemList; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // LIVESELECTIONTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp new file mode 100644 index 0000000..ee9843b --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "livesingleselectionmanipulator_p.h" + +#include "../qdeclarativeviewinspector_p_p.h" + +#include + +QT_BEGIN_NAMESPACE + +LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView) + : m_editorView(editorView), + m_isActive(false) +{ +} + + +void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint) +{ + m_beginPoint = beginPoint; + m_isActive = true; + m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems(); +} + +void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/) +{ + m_oldSelectionList.clear(); +} + +void LiveSingleSelectionManipulator::clear() +{ + m_beginPoint = QPointF(); + m_oldSelectionList.clear(); +} + + +void LiveSingleSelectionManipulator::end(const QPointF &/*updatePoint*/) +{ + m_oldSelectionList.clear(); + m_isActive = false; +} + +void LiveSingleSelectionManipulator::select(SelectionType selectionType, + const QList &items, + bool /*selectOnlyContentItems*/) +{ + QGraphicsItem *selectedItem = 0; + + foreach (QGraphicsItem* item, items) + { + //FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item); + if (item + /*&& !formEditorItem->qmlItemNode().isRootNode() + && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)*/) + { + selectedItem = item; + break; + } + } + + QList resultList; + + switch (selectionType) { + case AddToSelection: { + resultList.append(m_oldSelectionList); + if (selectedItem && !m_oldSelectionList.contains(selectedItem)) + resultList.append(selectedItem); + } + break; + case ReplaceSelection: { + if (selectedItem) + resultList.append(selectedItem); + } + break; + case RemoveFromSelection: { + resultList.append(m_oldSelectionList); + if (selectedItem) + resultList.removeAll(selectedItem); + } + break; + case InvertSelection: { + if (selectedItem + && !m_oldSelectionList.contains(selectedItem)) + { + resultList.append(selectedItem); + } + } + } + + m_editorView->setSelectedItems(resultList); +} + +void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems) +{ + QDeclarativeViewInspectorPrivate *inspectorPrivate = + QDeclarativeViewInspectorPrivate::get(m_editorView); + QList itemList = inspectorPrivate->selectableItems(m_beginPoint); + select(selectionType, itemList, selectOnlyContentItems); +} + + +bool LiveSingleSelectionManipulator::isActive() const +{ + return m_isActive; +} + +QPointF LiveSingleSelectionManipulator::beginPoint() const +{ + return m_beginPoint; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h new file mode 100644 index 0000000..40b5fc0 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIVESINGLESELECTIONMANIPULATOR_H +#define LIVESINGLESELECTIONMANIPULATOR_H + +#include +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsItem) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; + +class LiveSingleSelectionManipulator +{ +public: + LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView); + + enum SelectionType { + ReplaceSelection, + AddToSelection, + RemoveFromSelection, + InvertSelection + }; + + void begin(const QPointF& beginPoint); + void update(const QPointF& updatePoint); + void end(const QPointF& updatePoint); + + void select(SelectionType selectionType, const QList &items, + bool selectOnlyContentItems); + void select(SelectionType selectionType, bool selectOnlyContentItems); + + void clear(); + + QPointF beginPoint() const; + + bool isActive() const; + +private: + QList m_oldSelectionList; + QPointF m_beginPoint; + QDeclarativeViewInspector *m_editorView; + bool m_isActive; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // LIVESINGLESELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp new file mode 100644 index 0000000..0a72674 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp @@ -0,0 +1,328 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmltoolbar_p.h" +#include "toolbarcolorbox_p.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QmlToolBar::QmlToolBar(QWidget *parent) + : QToolBar(parent) + , m_emitSignals(true) + , m_paused(false) + , m_animationSpeed(1.0f) + , ui(new Ui) +{ + ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); + ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); + + ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")), + tr("Inspector Mode"), this); + ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); + ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); + ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), + tr("Select (Marquee)"), this); + ui->zoom = new QAction(QIcon(QLatin1String(":/qml/images/zoom-24.png")), tr("Zoom"), this); + ui->colorPicker = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-24.png")), + tr("Color Picker"), this); + ui->toQml = new QAction(QIcon(QLatin1String(":/qml/images/to-qml-24.png")), + tr("Apply Changes to QML Viewer"), this); + ui->fromQml = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-24.png")), + tr("Apply Changes to Document"), this); + ui->designmode->setCheckable(true); + ui->designmode->setChecked(false); + + ui->play->setCheckable(false); + ui->select->setCheckable(true); + ui->selectMarquee->setCheckable(true); + ui->zoom->setCheckable(true); + ui->colorPicker->setCheckable(true); + + setWindowTitle(tr("Tools")); + + addAction(ui->designmode); + addAction(ui->play); + addSeparator(); + + addAction(ui->select); + // disabled because multi selection does not do anything useful without design mode + //addAction(ui->selectMarquee); + addSeparator(); + addAction(ui->zoom); + addAction(ui->colorPicker); + //addAction(ui->fromQml); + + ui->colorBox = new ToolBarColorBox(this); + ui->colorBox->setMinimumSize(24, 24); + ui->colorBox->setMaximumSize(28, 28); + ui->colorBox->setColor(Qt::black); + addWidget(ui->colorBox); + + setWindowFlags(Qt::Tool); + + QMenu *playSpeedMenu = new QMenu(this); + ui->playSpeedMenuActions = new QActionGroup(this); + ui->playSpeedMenuActions->setExclusive(true); + + QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setChecked(true); + speedAction->setData(1.0f); + ui->playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(2.0f); + ui->playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(4.0f); + ui->playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(8.0f); + ui->playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(10.0f); + ui->playSpeedMenuActions->addAction(speedAction); + + ui->play->setMenu(playSpeedMenu); + + connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool))); + + connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); + + connect(ui->play, SIGNAL(triggered()), SLOT(activatePlayOnClick())); + + connect(ui->zoom, SIGNAL(triggered()), SLOT(activateZoomOnClick())); + connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); + connect(ui->select, SIGNAL(triggered()), SLOT(activateSelectToolOnClick())); + connect(ui->selectMarquee, SIGNAL(triggered()), SLOT(activateMarqueeSelectToolOnClick())); + + connect(ui->toQml, SIGNAL(triggered()), SLOT(activateToQml())); + connect(ui->fromQml, SIGNAL(triggered()), SLOT(activateFromQml())); +} + +QmlToolBar::~QmlToolBar() +{ + delete ui; +} + +void QmlToolBar::activateColorPicker() +{ + m_emitSignals = false; + activateColorPickerOnClick(); + m_emitSignals = true; +} + +void QmlToolBar::activateSelectTool() +{ + m_emitSignals = false; + activateSelectToolOnClick(); + m_emitSignals = true; +} + +void QmlToolBar::activateMarqueeSelectTool() +{ + m_emitSignals = false; + activateMarqueeSelectToolOnClick(); + m_emitSignals = true; +} + +void QmlToolBar::activateZoom() +{ + m_emitSignals = false; + activateZoomOnClick(); + m_emitSignals = true; +} + +void QmlToolBar::setAnimationSpeed(qreal slowDownFactor) +{ + if (m_animationSpeed == slowDownFactor) + return; + + m_emitSignals = false; + m_animationSpeed = slowDownFactor; + + foreach (QAction *action, ui->playSpeedMenuActions->actions()) { + if (action->data().toReal() == slowDownFactor) { + action->setChecked(true); + break; + } + } + + m_emitSignals = true; +} + +void QmlToolBar::setAnimationPaused(bool paused) +{ + if (m_paused == paused) + return; + + m_paused = paused; + updatePlayAction(); +} + +void QmlToolBar::changeAnimationSpeed() +{ + QAction *action = qobject_cast(sender()); + m_animationSpeed = action->data().toReal(); + emit animationSpeedChanged(m_animationSpeed); +} + +void QmlToolBar::setDesignModeBehavior(bool inDesignMode) +{ + m_emitSignals = false; + ui->designmode->setChecked(inDesignMode); + setDesignModeBehaviorOnClick(inDesignMode); + m_emitSignals = true; +} + +void QmlToolBar::setDesignModeBehaviorOnClick(bool checked) +{ + ui->select->setEnabled(checked); + ui->selectMarquee->setEnabled(checked); + ui->zoom->setEnabled(checked); + ui->colorPicker->setEnabled(checked); + ui->toQml->setEnabled(checked); + ui->fromQml->setEnabled(checked); + + if (m_emitSignals) + emit designModeBehaviorChanged(checked); +} + +void QmlToolBar::setColorBoxColor(const QColor &color) +{ + ui->colorBox->setColor(color); +} + +void QmlToolBar::activatePlayOnClick() +{ + m_paused = !m_paused; + emit animationPausedChanged(m_paused); + updatePlayAction(); +} + +void QmlToolBar::updatePlayAction() +{ + ui->play->setIcon(m_paused ? ui->playIcon : ui->pauseIcon); +} + +void QmlToolBar::activateColorPickerOnClick() +{ + ui->zoom->setChecked(false); + ui->select->setChecked(false); + ui->selectMarquee->setChecked(false); + + ui->colorPicker->setChecked(true); + if (m_activeTool != Constants::ColorPickerMode) { + m_activeTool = Constants::ColorPickerMode; + if (m_emitSignals) + emit colorPickerSelected(); + } +} + +void QmlToolBar::activateSelectToolOnClick() +{ + ui->zoom->setChecked(false); + ui->selectMarquee->setChecked(false); + ui->colorPicker->setChecked(false); + + ui->select->setChecked(true); + if (m_activeTool != Constants::SelectionToolMode) { + m_activeTool = Constants::SelectionToolMode; + if (m_emitSignals) + emit selectToolSelected(); + } +} + +void QmlToolBar::activateMarqueeSelectToolOnClick() +{ + ui->zoom->setChecked(false); + ui->select->setChecked(false); + ui->colorPicker->setChecked(false); + + ui->selectMarquee->setChecked(true); + if (m_activeTool != Constants::MarqueeSelectionToolMode) { + m_activeTool = Constants::MarqueeSelectionToolMode; + if (m_emitSignals) + emit marqueeSelectToolSelected(); + } +} + +void QmlToolBar::activateZoomOnClick() +{ + ui->select->setChecked(false); + ui->selectMarquee->setChecked(false); + ui->colorPicker->setChecked(false); + + ui->zoom->setChecked(true); + if (m_activeTool != Constants::ZoomMode) { + m_activeTool = Constants::ZoomMode; + if (m_emitSignals) + emit zoomToolSelected(); + } +} + +void QmlToolBar::activateFromQml() +{ + if (m_emitSignals) + emit applyChangesFromQmlFileSelected(); +} + +void QmlToolBar::activateToQml() +{ + if (m_emitSignals) + emit applyChangesToQmlFileSelected(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h new file mode 100644 index 0000000..0401804 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLTOOLBAR_H +#define QMLTOOLBAR_H + +#include +#include + +#include "../qmlinspectorconstants_p.h" + +QT_FORWARD_DECLARE_CLASS(QActionGroup) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class ToolBarColorBox; + +class QmlToolBar : public QToolBar +{ + Q_OBJECT + +public: + explicit QmlToolBar(QWidget *parent = 0); + ~QmlToolBar(); + +public slots: + void setDesignModeBehavior(bool inDesignMode); + void setColorBoxColor(const QColor &color); + void activateColorPicker(); + void activateSelectTool(); + void activateMarqueeSelectTool(); + void activateZoom(); + + void setAnimationSpeed(qreal slowDownFactor); + void setAnimationPaused(bool paused); + +signals: + void animationSpeedChanged(qreal factor); + void animationPausedChanged(bool paused); + + void designModeBehaviorChanged(bool inDesignMode); + void colorPickerSelected(); + void selectToolSelected(); + void marqueeSelectToolSelected(); + void zoomToolSelected(); + + void applyChangesToQmlFileSelected(); + void applyChangesFromQmlFileSelected(); + +private slots: + void setDesignModeBehaviorOnClick(bool inDesignMode); + void activatePlayOnClick(); + void activateColorPickerOnClick(); + void activateSelectToolOnClick(); + void activateMarqueeSelectToolOnClick(); + void activateZoomOnClick(); + + void activateFromQml(); + void activateToQml(); + + void changeAnimationSpeed(); + + void updatePlayAction(); + +private: + class Ui { + public: + QAction *designmode; + QAction *play; + QAction *select; + QAction *selectMarquee; + QAction *zoom; + QAction *colorPicker; + QAction *toQml; + QAction *fromQml; + QIcon playIcon; + QIcon pauseIcon; + ToolBarColorBox *colorBox; + + QActionGroup *playSpeedMenuActions; + }; + + bool m_emitSignals; + bool m_paused; + qreal m_animationSpeed; + + Constants::DesignTool m_activeTool; + + Ui *ui; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMLTOOLBAR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp new file mode 100644 index 0000000..2ed3179 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "subcomponentmasklayeritem_p.h" + +#include "../qmlinspectorconstants_p.h" +#include "../qdeclarativeviewinspector_p.h" + +#include + +QT_BEGIN_NAMESPACE + +SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, + QGraphicsItem *parentItem) : + QGraphicsPolygonItem(parentItem), + m_inspector(inspector), + m_currentItem(0), + m_borderRect(new QGraphicsRectItem(this)) +{ + m_borderRect->setRect(0,0,0,0); + m_borderRect->setPen(QPen(QColor(60, 60, 60), 1)); + m_borderRect->setData(Constants::EditorItemDataKey, QVariant(true)); + + setBrush(QBrush(QColor(160,160,160))); + setPen(Qt::NoPen); +} + +int SubcomponentMaskLayerItem::type() const +{ + return Constants::EditorItemType; +} + +static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect) +{ + QRectF result = newRect; + if (oldRect.left() < newRect.left()) + result.setLeft(oldRect.left()); + + if (oldRect.top() < newRect.top()) + result.setTop(oldRect.top()); + + if (oldRect.right() > newRect.right()) + result.setRight(oldRect.right()); + + if (oldRect.bottom() > newRect.bottom()) + result.setBottom(oldRect.bottom()); + + return result; +} + +static QPolygonF regionToPolygon(const QRegion ®ion) +{ + QPainterPath path; + foreach (const QRect &rect, region.rects()) + path.addRect(rect); + return path.toFillPolygon(); +} + +void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) +{ + QGraphicsItem *prevItem = m_currentItem; + m_currentItem = item; + + if (!m_currentItem) + return; + + QRect viewRect = m_inspector->declarativeView()->rect(); + viewRect = m_inspector->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); + + QRectF itemRect = item->boundingRect() | item->childrenBoundingRect(); + itemRect = item->mapRectToScene(itemRect); + + // if updating the same item as before, resize the rectangle only bigger, not smaller. + if (prevItem == item && prevItem != 0) { + m_itemPolyRect = resizeRect(itemRect, m_itemPolyRect); + } else { + m_itemPolyRect = itemRect; + } + QRectF borderRect = m_itemPolyRect; + borderRect.adjust(-1, -1, 1, 1); + m_borderRect->setRect(borderRect); + + const QRegion externalRegion = QRegion(viewRect).subtracted(m_itemPolyRect.toRect()); + setPolygon(regionToPolygon(externalRegion)); +} + +QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const +{ + return m_currentItem; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h new file mode 100644 index 0000000..07ce881 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SUBCOMPONENTMASKLAYERITEM_H +#define SUBCOMPONENTMASKLAYERITEM_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; + +class SubcomponentMaskLayerItem : public QGraphicsPolygonItem +{ +public: + explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, + QGraphicsItem *parentItem = 0); + int type() const; + void setCurrentItem(QGraphicsItem *item); + void setBoundingBox(const QRectF &boundingBox); + QGraphicsItem *currentItem() const; + QRectF itemRect() const; + +private: + QDeclarativeViewInspector *m_inspector; + QGraphicsItem *m_currentItem; + QGraphicsRectItem *m_borderRect; + QRectF m_itemPolyRect; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // SUBCOMPONENTMASKLAYERITEM_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp new file mode 100644 index 0000000..154ddf2 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "toolbarcolorbox_p.h" + +#include "../qmlinspectorconstants_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +ToolBarColorBox::ToolBarColorBox(QWidget *parent) : + QLabel(parent) +{ + m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")), + tr("Copy Color"), this); + connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); + setScaledContents(false); +} + +void ToolBarColorBox::setColor(const QColor &color) +{ + m_color = color; + + QPixmap pix = createDragPixmap(width()); + setPixmap(pix); + update(); +} + +void ToolBarColorBox::mousePressEvent(QMouseEvent *event) +{ + m_dragBeginPoint = event->pos(); + m_dragStarted = false; +} + +void ToolBarColorBox::mouseMoveEvent(QMouseEvent *event) +{ + + if (event->buttons() & Qt::LeftButton + && (QPoint(event->pos() - m_dragBeginPoint).manhattanLength() + > Constants::DragStartDistance) + && !m_dragStarted) + { + m_dragStarted = true; + QDrag *drag = new QDrag(this); + QMimeData *mimeData = new QMimeData; + + mimeData->setText(m_color.name()); + drag->setMimeData(mimeData); + drag->setPixmap(createDragPixmap()); + + drag->exec(); + } +} + +QPixmap ToolBarColorBox::createDragPixmap(int size) const +{ + QPixmap pix(size, size); + QPainter p(&pix); + + QColor borderColor1 = QColor(143, 143 ,143); + QColor borderColor2 = QColor(43, 43, 43); + + p.setBrush(QBrush(m_color)); + p.setPen(QPen(QBrush(borderColor2),1)); + + p.fillRect(0, 0, size, size, borderColor1); + p.drawRect(1,1, size - 3, size - 3); + return pix; +} + +void ToolBarColorBox::contextMenuEvent(QContextMenuEvent *ev) +{ + QMenu contextMenu; + contextMenu.addAction(m_copyHexColor); + contextMenu.exec(ev->globalPos()); +} + +void ToolBarColorBox::copyColorToClipboard() +{ + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(m_color.name()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h new file mode 100644 index 0000000..c3e064c --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TOOLBARCOLORBOX_H +#define TOOLBARCOLORBOX_H + +#include +#include +#include + +QT_FORWARD_DECLARE_CLASS(QContextMenuEvent) +QT_FORWARD_DECLARE_CLASS(QAction) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class ToolBarColorBox : public QLabel +{ + Q_OBJECT + +public: + explicit ToolBarColorBox(QWidget *parent = 0); + void setColor(const QColor &color); + +protected: + void contextMenuEvent(QContextMenuEvent *ev); + void mousePressEvent(QMouseEvent *ev); + void mouseMoveEvent(QMouseEvent *ev); +private slots: + void copyColorToClipboard(); + +private: + QPixmap createDragPixmap(int size = 24) const; + +private: + bool m_dragStarted; + QPoint m_dragBeginPoint; + QAction *m_copyHexColor; + QColor m_color; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // TOOLBARCOLORBOX_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp new file mode 100644 index 0000000..969c9d5 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp @@ -0,0 +1,336 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "zoomtool_p.h" + +#include "../qdeclarativeviewinspector_p_p.h" + +#include +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +ZoomTool::ZoomTool(QDeclarativeViewInspector *view) : + AbstractLiveEditTool(view), + m_rubberbandManipulator(), + m_smoothZoomMultiplier(0.05f), + m_currentScale(1.0f) +{ + m_zoomTo100Action = new QAction(tr("Zoom to &100%"), this); + m_zoomInAction = new QAction(tr("Zoom In"), this); + m_zoomOutAction = new QAction(tr("Zoom Out"), this); + m_zoomInAction->setShortcut(QKeySequence(Qt::Key_Plus)); + m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus)); + + + LiveLayerItem *layerItem = QDeclarativeViewInspectorPrivate::get(view)->manipulatorLayer; + QGraphicsObject *layerObject = reinterpret_cast(layerItem); + m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view); + + + connect(m_zoomTo100Action, SIGNAL(triggered()), SLOT(zoomTo100())); + connect(m_zoomInAction, SIGNAL(triggered()), SLOT(zoomIn())); + connect(m_zoomOutAction, SIGNAL(triggered()), SLOT(zoomOut())); +} + +ZoomTool::~ZoomTool() +{ + delete m_rubberbandManipulator; +} + +void ZoomTool::mousePressEvent(QMouseEvent *event) +{ + m_mousePos = event->pos(); + + QPointF scenePos = view()->mapToScene(event->pos()); + + if (event->buttons() & Qt::RightButton) { + QMenu contextMenu; + contextMenu.addAction(m_zoomTo100Action); + contextMenu.addSeparator(); + contextMenu.addAction(m_zoomInAction); + contextMenu.addAction(m_zoomOutAction); + contextMenu.exec(event->globalPos()); + } else if (event->buttons() & Qt::LeftButton) { + m_dragBeginPos = scenePos; + m_dragStarted = false; + } +} + +void ZoomTool::mouseMoveEvent(QMouseEvent *event) +{ + m_mousePos = event->pos(); + + QPointF scenePos = view()->mapToScene(event->pos()); + + if (event->buttons() & Qt::LeftButton + && (QPointF(scenePos - m_dragBeginPos).manhattanLength() + > Constants::DragStartDistance / 3) + && !m_dragStarted) + { + m_dragStarted = true; + m_rubberbandManipulator->begin(m_dragBeginPos); + return; + } + + if (m_dragStarted) + m_rubberbandManipulator->update(scenePos); + +} + +void ZoomTool::mouseReleaseEvent(QMouseEvent *event) +{ + m_mousePos = event->pos(); + QPointF scenePos = view()->mapToScene(event->pos()); + + if (m_dragStarted) { + m_rubberbandManipulator->end(); + + int x1 = qMin(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); + int x2 = qMax(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); + int y1 = qMin(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); + int y2 = qMax(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); + + QPointF scenePosTopLeft = QPoint(x1, y1); + QPointF scenePosBottomRight = QPoint(x2, y2); + + QRectF sceneArea(scenePosTopLeft, scenePosBottomRight); + + m_currentScale = qMin(view()->rect().width() / sceneArea.width(), + view()->rect().height() / sceneArea.height()); + + + QTransform transform; + transform.scale(m_currentScale, m_currentScale); + + view()->setTransform(transform); + view()->setSceneRect(sceneArea); + } else { + Qt::KeyboardModifier modifierKey = Qt::ControlModifier; +#ifdef Q_WS_MAC + modifierKey = Qt::AltModifier; +#endif + if (event->modifiers() & modifierKey) { + zoomOut(); + } else { + zoomIn(); + } + } +} + +void ZoomTool::zoomIn() +{ + m_currentScale = nextZoomScale(ZoomIn); + scaleView(view()->mapToScene(m_mousePos)); +} + +void ZoomTool::zoomOut() +{ + m_currentScale = nextZoomScale(ZoomOut); + scaleView(view()->mapToScene(m_mousePos)); +} + +void ZoomTool::mouseDoubleClickEvent(QMouseEvent *event) +{ + m_mousePos = event->pos(); +} + + +void ZoomTool::hoverMoveEvent(QMouseEvent *event) +{ + m_mousePos = event->pos(); +} + + +void ZoomTool::keyPressEvent(QKeyEvent * /*event*/) +{ +} + +void ZoomTool::wheelEvent(QWheelEvent *event) +{ + if (event->orientation() != Qt::Vertical) + return; + + Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier; + if (event->modifiers() & smoothZoomModifier) { + int numDegrees = event->delta() / 8; + m_currentScale += m_smoothZoomMultiplier * (numDegrees / 15.0f); + + scaleView(view()->mapToScene(m_mousePos)); + + } else if (!event->modifiers()) { + if (event->delta() > 0) { + m_currentScale = nextZoomScale(ZoomIn); + } else if (event->delta() < 0) { + m_currentScale = nextZoomScale(ZoomOut); + } + scaleView(view()->mapToScene(m_mousePos)); + } +} + +void ZoomTool::keyReleaseEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Plus: + zoomIn(); + break; + case Qt::Key_Minus: + zoomOut(); + break; + case Qt::Key_1: + case Qt::Key_2: + case Qt::Key_3: + case Qt::Key_4: + case Qt::Key_5: + case Qt::Key_6: + case Qt::Key_7: + case Qt::Key_8: + case Qt::Key_9: + { + m_currentScale = ((event->key() - Qt::Key_0) * 1.0f); + scaleView(view()->mapToScene(m_mousePos)); // view()->mapToScene(view()->rect().center()) + break; + } + + default: + break; + } + +} + +void ZoomTool::itemsAboutToRemoved(const QList &/*itemList*/) +{ +} + +void ZoomTool::clear() +{ + view()->setCursor(Qt::ArrowCursor); +} + +void ZoomTool::selectedItemsChanged(const QList &/*itemList*/) +{ +} + +void ZoomTool::scaleView(const QPointF ¢erPos) +{ + + QTransform transform; + transform.scale(m_currentScale, m_currentScale); + view()->setTransform(transform); + + QPointF adjustedCenterPos = centerPos; + QSize rectSize(view()->rect().width() / m_currentScale, + view()->rect().height() / m_currentScale); + + QRectF sceneRect; + if (qAbs(m_currentScale - 1.0f) < Constants::ZoomSnapDelta) { + adjustedCenterPos.rx() = rectSize.width() / 2; + adjustedCenterPos.ry() = rectSize.height() / 2; + } + + if (m_currentScale < 1.0f) { + adjustedCenterPos.rx() = rectSize.width() / 2; + adjustedCenterPos.ry() = rectSize.height() / 2; + sceneRect.setRect(view()->rect().width() / 2 -rectSize.width() / 2, + view()->rect().height() / 2 -rectSize.height() / 2, + rectSize.width(), + rectSize.height()); + } else { + sceneRect.setRect(adjustedCenterPos.x() - rectSize.width() / 2, + adjustedCenterPos.y() - rectSize.height() / 2, + rectSize.width(), + rectSize.height()); + } + + view()->setSceneRect(sceneRect); +} + +void ZoomTool::zoomTo100() +{ + m_currentScale = 1.0f; + scaleView(view()->mapToScene(view()->rect().center())); +} + +qreal ZoomTool::nextZoomScale(ZoomDirection direction) const +{ + static QList zoomScales = + QList() + << 0.125f + << 1.0f / 6.0f + << 0.25f + << 1.0f / 3.0f + << 0.5f + << 2.0f / 3.0f + << 1.0f + << 2.0f + << 3.0f + << 4.0f + << 5.0f + << 6.0f + << 7.0f + << 8.0f + << 12.0f + << 16.0f + << 32.0f + << 48.0f; + + if (direction == ZoomIn) { + for (int i = 0; i < zoomScales.length(); ++i) { + if (zoomScales[i] > m_currentScale || i == zoomScales.length() - 1) + return zoomScales[i]; + } + } else { + for (int i = zoomScales.length() - 1; i >= 0; --i) { + if (zoomScales[i] < m_currentScale || i == 0) + return zoomScales[i]; + } + } + + return 1.0f; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h new file mode 100644 index 0000000..14fa4d5 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ZOOMTOOL_H +#define ZOOMTOOL_H + +#include "abstractliveedittool_p.h" +#include "liverubberbandselectionmanipulator_p.h" + +QT_FORWARD_DECLARE_CLASS(QAction) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class ZoomTool : public AbstractLiveEditTool +{ + Q_OBJECT + +public: + enum ZoomDirection { + ZoomIn, + ZoomOut + }; + + explicit ZoomTool(QDeclarativeViewInspector *view); + + virtual ~ZoomTool(); + + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + + void hoverMoveEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent *event); + + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *keyEvent); + void itemsAboutToRemoved(const QList &itemList); + + void clear(); + +protected: + void selectedItemsChanged(const QList &itemList); + +private slots: + void zoomTo100(); + void zoomIn(); + void zoomOut(); + +private: + qreal nextZoomScale(ZoomDirection direction) const; + void scaleView(const QPointF ¢erPos); + +private: + bool m_dragStarted; + QPoint m_mousePos; // in view coords + QPointF m_dragBeginPos; + QAction *m_zoomTo100Action; + QAction *m_zoomInAction; + QAction *m_zoomOutAction; + LiveRubberBandSelectionManipulator *m_rubberbandManipulator; + + qreal m_smoothZoomMultiplier; + qreal m_currentScale; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ZOOMTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp new file mode 100644 index 0000000..a266eb9 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativeinspectorplugin.h" + +#include "qdeclarativeviewinspector_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +QDeclarativeInspectorPlugin::QDeclarativeInspectorPlugin() : + m_inspector(0) +{ +} + +QDeclarativeInspectorPlugin::~QDeclarativeInspectorPlugin() +{ + delete m_inspector; +} + +void QDeclarativeInspectorPlugin::activate() +{ + QDeclarativeInspectorService *service = QDeclarativeInspectorService::instance(); + QList views = service->views(); + if (views.isEmpty()) + return; + + // TODO: Support multiple views + QDeclarativeView *view = service->views().at(0); + m_inspector = new QDeclarativeViewInspector(view, view); +} + +void QDeclarativeInspectorPlugin::deactivate() +{ + delete m_inspector; +} + +Q_EXPORT_PLUGIN2(declarativeinspector, QDeclarativeInspectorPlugin) + +QT_END_NAMESPACE + diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h new file mode 100644 index 0000000..3e28643 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEINSPECTORPLUGIN_H +#define QDECLARATIVEINSPECTORPLUGIN_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeViewInspector; + +class QDeclarativeInspectorPlugin : public QObject, public QDeclarativeInspectorInterface +{ + Q_OBJECT + Q_DISABLE_COPY(QDeclarativeInspectorPlugin) + Q_INTERFACES(QDeclarativeInspectorInterface) + +public: + QDeclarativeInspectorPlugin(); + ~QDeclarativeInspectorPlugin(); + + void activate(); + void deactivate(); + +private: + QPointer m_inspector; +}; + +QT_END_NAMESPACE + +#endif // QDECLARATIVEINSPECTORPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h new file mode 100644 index 0000000..2878bc1 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEINSPECTORPROTOCOL_H +#define QDECLARATIVEINSPECTORPROTOCOL_H + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class InspectorProtocol : public QObject +{ + Q_OBJECT + Q_ENUMS(Message Tool) + +public: + enum Message { + AnimationSpeedChanged = 0, + AnimationPausedChanged = 19, // highest value + ChangeTool = 1, + ClearComponentCache = 2, + ColorChanged = 3, + CreateObject = 5, + CurrentObjectsChanged = 6, + DestroyObject = 7, + MoveObject = 8, + ObjectIdList = 9, + Reload = 10, + Reloaded = 11, + SetAnimationSpeed = 12, + SetAnimationPaused = 18, + SetCurrentObjects = 14, + SetDesignMode = 15, + ShowAppOnTop = 16, + ToolChanged = 17 + }; + + enum Tool { + ColorPickerTool, + SelectMarqueeTool, + SelectTool, + ZoomTool + }; + + static inline QString toString(Message message) + { + return QLatin1String(staticMetaObject.enumerator(0).valueToKey(message)); + } + + static inline QString toString(Tool tool) + { + return QLatin1String(staticMetaObject.enumerator(1).valueToKey(tool)); + } +}; + +inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message) +{ + return stream << static_cast(message); +} + +inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message) +{ + quint32 i; + stream >> i; + message = static_cast(i); + return stream; +} + +inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message) +{ + dbg << InspectorProtocol::toString(message); + return dbg; +} + +inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool) +{ + return stream << static_cast(tool); +} + +inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool) +{ + quint32 i; + stream >> i; + tool = static_cast(i); + return stream; +} + +inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool) +{ + dbg << InspectorProtocol::toString(tool); + return dbg; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEINSPECTORPROTOCOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp new file mode 100644 index 0000000..19bfdaa --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp @@ -0,0 +1,1021 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" +#include "QtDeclarative/private/qdeclarativedebughelper_p.h" + +#include "qdeclarativeviewinspector_p.h" +#include "qdeclarativeviewinspector_p_p.h" +#include "qdeclarativeinspectorprotocol.h" + +#include "editor/liveselectiontool_p.h" +#include "editor/zoomtool_p.h" +#include "editor/colorpickertool_p.h" +#include "editor/livelayeritem_p.h" +#include "editor/boundingrecthighlighter_p.h" +#include "editor/qmltoolbar_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static inline void initEditorResource() { Q_INIT_RESOURCE(editor); } + +QT_BEGIN_NAMESPACE + +const char * const KEY_TOOLBOX_GEOMETRY = "toolBox/geometry"; + +const int SceneChangeUpdateInterval = 5000; + + +class ToolBox : public QWidget +{ + Q_OBJECT + +public: + ToolBox(QWidget *parent = 0); + ~ToolBox(); + + QmlToolBar *toolBar() const { return m_toolBar; } + +private: + QSettings m_settings; + QmlToolBar *m_toolBar; +}; + +ToolBox::ToolBox(QWidget *parent) + : QWidget(parent, Qt::Tool) + , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this) + , m_toolBar(new QmlToolBar) +{ + setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); + setWindowTitle(tr("Qt Quick Toolbox")); + + QVBoxLayout *verticalLayout = new QVBoxLayout; + verticalLayout->setMargin(0); + verticalLayout->addWidget(m_toolBar); + setLayout(verticalLayout); + + restoreGeometry(m_settings.value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray()); +} + +ToolBox::~ToolBox() +{ + m_settings.setValue(QLatin1String(KEY_TOOLBOX_GEOMETRY), saveGeometry()); +} + + +QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) : + q(q), + designModeBehavior(false), + showAppOnTop(false), + animationPaused(false), + slowDownFactor(1.0f), + toolBox(0) +{ +} + +QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate() +{ +} + +QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, + QObject *parent) : + QObject(parent), + data(new QDeclarativeViewInspectorPrivate(this)) +{ + initEditorResource(); + + data->view = view; + data->manipulatorLayer = new LiveLayerItem(view->scene()); + data->selectionTool = new LiveSelectionTool(this); + data->zoomTool = new ZoomTool(this); + data->colorPickerTool = new ColorPickerTool(this); + data->boundingRectHighlighter = new BoundingRectHighlighter(this); + data->currentTool = data->selectionTool; + + // to capture ChildRemoved event when viewport changes + data->view->installEventFilter(this); + + data->setViewport(data->view->viewport()); + + data->debugService = QDeclarativeInspectorService::instance(); + connect(data->debugService, SIGNAL(gotMessage(QByteArray)), + this, SLOT(handleMessage(QByteArray))); + + connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)), + data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status))); + + connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), + SIGNAL(selectedColorChanged(QColor))); + connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), + this, SLOT(sendColorChanged(QColor))); + + data->_q_changeToSingleSelectTool(); +} + +QDeclarativeViewInspector::~QDeclarativeViewInspector() +{ +} + +void QDeclarativeViewInspectorPrivate::_q_setToolBoxVisible(bool visible) +{ +#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) + if (!toolBox && visible) + createToolBox(); + if (toolBox) + toolBox->setVisible(visible); +#else + Q_UNUSED(visible) +#endif +} + +void QDeclarativeViewInspectorPrivate::_q_reloadView() +{ + clearHighlight(); + emit q->reloadRequested(); +} + +void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget) +{ + if (viewport.data() == widget) + return; + + if (viewport) + viewport.data()->removeEventFilter(q); + + viewport = widget; + if (viewport) { + // make sure we get mouse move events + viewport.data()->setMouseTracking(true); + viewport.data()->installEventFilter(q); + } +} + +void QDeclarativeViewInspectorPrivate::clearEditorItems() +{ + clearHighlight(); + setSelectedItems(QList()); +} + +bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == data->view) { + // Event from view + if (event->type() == QEvent::ChildRemoved) { + // Might mean that viewport has changed + if (data->view->viewport() != data->viewport.data()) + data->setViewport(data->view->viewport()); + } + return QObject::eventFilter(obj, event); + } + + // Event from viewport + switch (event->type()) { + case QEvent::Leave: { + if (leaveEvent(event)) + return true; + break; + } + case QEvent::MouseButtonPress: { + if (mousePressEvent(static_cast(event))) + return true; + break; + } + case QEvent::MouseMove: { + if (mouseMoveEvent(static_cast(event))) + return true; + break; + } + case QEvent::MouseButtonRelease: { + if (mouseReleaseEvent(static_cast(event))) + return true; + break; + } + case QEvent::KeyPress: { + if (keyPressEvent(static_cast(event))) + return true; + break; + } + case QEvent::KeyRelease: { + if (keyReleaseEvent(static_cast(event))) + return true; + break; + } + case QEvent::MouseButtonDblClick: { + if (mouseDoubleClickEvent(static_cast(event))) + return true; + break; + } + case QEvent::Wheel: { + if (wheelEvent(static_cast(event))) + return true; + break; + } + default: { + break; + } + } //switch + + // standard event processing + return QObject::eventFilter(obj, event); +} + +bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/) +{ + if (!data->designModeBehavior) + return false; + data->clearHighlight(); + return true; +} + +bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event) +{ + if (!data->designModeBehavior) + return false; + data->cursorPos = event->pos(); + data->currentTool->mousePressEvent(event); + return true; +} + +bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event) +{ + if (!data->designModeBehavior) { + data->clearEditorItems(); + return false; + } + data->cursorPos = event->pos(); + + QList selItems = data->selectableItems(event->pos()); + if (!selItems.isEmpty()) { + declarativeView()->setToolTip(data->currentTool->titleForItem(selItems.first())); + } else { + declarativeView()->setToolTip(QString()); + } + if (event->buttons()) { + data->currentTool->mouseMoveEvent(event); + } else { + data->currentTool->hoverMoveEvent(event); + } + return true; +} + +bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event) +{ + if (!data->designModeBehavior) + return false; + + data->cursorPos = event->pos(); + data->currentTool->mouseReleaseEvent(event); + return true; +} + +bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event) +{ + if (!data->designModeBehavior) + return false; + + data->currentTool->keyPressEvent(event); + return true; +} + +bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event) +{ + if (!data->designModeBehavior) + return false; + + switch (event->key()) { + case Qt::Key_V: + data->_q_changeToSingleSelectTool(); + break; +// disabled because multiselection does not do anything useful without design mode +// case Qt::Key_M: +// data->_q_changeToMarqueeSelectTool(); +// break; + case Qt::Key_I: + data->_q_changeToColorPickerTool(); + break; + case Qt::Key_Z: + data->_q_changeToZoomTool(); + break; + case Qt::Key_Space: + setAnimationPaused(!data->animationPaused); + break; + default: + break; + } + + data->currentTool->keyReleaseEvent(event); + return true; +} + +void QDeclarativeViewInspectorPrivate::_q_createQmlObject(const QString &qml, QObject *parent, + const QStringList &importList, + const QString &filename) +{ + if (!parent) + return; + + QString imports; + foreach (const QString &s, importList) { + imports += s; + imports += QLatin1Char('\n'); + } + + QDeclarativeContext *parentContext = view->engine()->contextForObject(parent); + QDeclarativeComponent component(view->engine(), q); + QByteArray constructedQml = QString(imports + qml).toLatin1(); + + component.setData(constructedQml, QUrl::fromLocalFile(filename)); + QObject *newObject = component.create(parentContext); + if (newObject) { + newObject->setParent(parent); + QDeclarativeItem *parentItem = qobject_cast(parent); + QDeclarativeItem *newItem = qobject_cast(newObject); + if (parentItem && newItem) + newItem->setParentItem(parentItem); + } +} + +void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) +{ + if (!newParent) + return; + + object->setParent(newParent); + QDeclarativeItem *newParentItem = qobject_cast(newParent); + QDeclarativeItem *item = qobject_cast(object); + if (newParentItem && item) + item->setParentItem(newParentItem); +} + +void QDeclarativeViewInspectorPrivate::_q_clearComponentCache() +{ + view->engine()->clearComponentCache(); +} + +void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj) +{ + QList items = selectedItems(); + if (QGraphicsItem *item = qobject_cast(obj)) + items.removeOne(item); + setSelectedItems(items); +} + +bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/) +{ + if (!data->designModeBehavior) + return false; + + return true; +} + +bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event) +{ + if (!data->designModeBehavior) + return false; + data->currentTool->wheelEvent(event); + return true; +} + +void QDeclarativeViewInspector::setDesignModeBehavior(bool value) +{ + emit designModeBehaviorChanged(value); + + if (data->toolBox) + data->toolBox->toolBar()->setDesignModeBehavior(value); + sendDesignModeBehavior(value); + + data->designModeBehavior = value; + + if (!data->designModeBehavior) + data->clearEditorItems(); +} + +bool QDeclarativeViewInspector::designModeBehavior() +{ + return data->designModeBehavior; +} + +bool QDeclarativeViewInspector::showAppOnTop() const +{ + return data->showAppOnTop; +} + +void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop) +{ + if (data->view) { + QWidget *window = data->view->window(); + Qt::WindowFlags flags = window->windowFlags(); + if (appOnTop) + flags |= Qt::WindowStaysOnTopHint; + else + flags &= ~Qt::WindowStaysOnTopHint; + + window->setWindowFlags(flags); + window->show(); + } + + data->showAppOnTop = appOnTop; + sendShowAppOnTop(appOnTop); + + emit showAppOnTopChanged(appOnTop); +} + +void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool, + Constants::ToolFlags /*flags*/) +{ + switch (tool) { + case Constants::SelectionToolMode: + _q_changeToSingleSelectTool(); + break; + case Constants::NoTool: + default: + currentTool = 0; + break; + } +} + +void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(const QList &items) +{ + foreach (const QWeakPointer &obj, currentSelection) { + if (QGraphicsItem *item = obj.data()) { + if (!items.contains(item)) { + QObject::disconnect(obj.data(), SIGNAL(destroyed(QObject*)), + this, SLOT(_q_removeFromSelection(QObject*))); + currentSelection.removeOne(obj); + } + } + } + + foreach (QGraphicsItem *item, items) { + if (QGraphicsObject *obj = item->toGraphicsObject()) { + if (!currentSelection.contains(obj)) { + QObject::connect(obj, SIGNAL(destroyed(QObject*)), + this, SLOT(_q_removeFromSelection(QObject*))); + currentSelection.append(obj); + } + } + } + + currentTool->updateSelectedItems(); +} + +void QDeclarativeViewInspectorPrivate::setSelectedItems(const QList &items) +{ + QList > oldList = currentSelection; + setSelectedItemsForTools(items); + if (oldList != currentSelection) { + QList objectList; + foreach (const QWeakPointer &graphicsObject, currentSelection) { + if (graphicsObject) + objectList << graphicsObject.data(); + } + + q->sendCurrentObjects(objectList); + } +} + +QList QDeclarativeViewInspectorPrivate::selectedItems() const +{ + QList selection; + foreach (const QWeakPointer &selectedObject, currentSelection) { + if (selectedObject.data()) + selection << selectedObject.data(); + } + + return selection; +} + +void QDeclarativeViewInspector::setSelectedItems(QList items) +{ + data->setSelectedItems(items); +} + +QList QDeclarativeViewInspector::selectedItems() const +{ + return data->selectedItems(); +} + +QDeclarativeView *QDeclarativeViewInspector::declarativeView() +{ + return data->view; +} + +void QDeclarativeViewInspectorPrivate::clearHighlight() +{ + boundingRectHighlighter->clear(); +} + +void QDeclarativeViewInspectorPrivate::highlight(const QList &items) +{ + if (items.isEmpty()) + return; + + QList objectList; + foreach (QGraphicsItem *item, items) { + QGraphicsItem *child = item; + + if (child) { + QGraphicsObject *childObject = child->toGraphicsObject(); + if (childObject) + objectList << childObject; + } + } + + boundingRectHighlighter->highlight(objectList); +} + +QList QDeclarativeViewInspectorPrivate::selectableItems( + const QPointF &scenePos) const +{ + QList itemlist = view->scene()->items(scenePos); + return filterForSelection(itemlist); +} + +QList QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const +{ + QList itemlist = view->items(pos); + return filterForSelection(itemlist); +} + +QList QDeclarativeViewInspectorPrivate::selectableItems( + const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const +{ + QList itemlist = view->scene()->items(sceneRect, selectionMode); + return filterForSelection(itemlist); +} + +void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool() +{ + currentToolMode = Constants::SelectionToolMode; + selectionTool->setRubberbandSelectionMode(false); + + changeToSelectTool(); + + emit q->selectToolActivated(); + q->sendCurrentTool(Constants::SelectionToolMode); +} + +void QDeclarativeViewInspectorPrivate::changeToSelectTool() +{ + if (currentTool == selectionTool) + return; + + currentTool->clear(); + currentTool = selectionTool; + currentTool->clear(); + currentTool->updateSelectedItems(); +} + +void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool() +{ + changeToSelectTool(); + currentToolMode = Constants::MarqueeSelectionToolMode; + selectionTool->setRubberbandSelectionMode(true); + + emit q->marqueeSelectToolActivated(); + q->sendCurrentTool(Constants::MarqueeSelectionToolMode); +} + +void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool() +{ + currentToolMode = Constants::ZoomMode; + currentTool->clear(); + currentTool = zoomTool; + currentTool->clear(); + + emit q->zoomToolActivated(); + q->sendCurrentTool(Constants::ZoomMode); +} + +void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool() +{ + if (currentTool == colorPickerTool) + return; + + currentToolMode = Constants::ColorPickerMode; + currentTool->clear(); + currentTool = colorPickerTool; + currentTool->clear(); + + emit q->colorPickerActivated(); + q->sendCurrentTool(Constants::ColorPickerMode); +} + +void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor) +{ + Q_ASSERT(slowDownFactor > 0); + if (data->slowDownFactor == slowDownFactor) + return; + + animationSpeedChangeRequested(slowDownFactor); + sendAnimationSpeed(slowDownFactor); +} + +void QDeclarativeViewInspector::setAnimationPaused(bool paused) +{ + if (data->animationPaused == paused) + return; + + animationPausedChangeRequested(paused); + sendAnimationPaused(paused); +} + +void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor) +{ + if (data->slowDownFactor != factor) { + data->slowDownFactor = factor; + emit animationSpeedChanged(factor); + } + + const float effectiveFactor = data->animationPaused ? 0 : factor; + QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); +} + +void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused) +{ + if (data->animationPaused != paused) { + data->animationPaused = paused; + emit animationPausedChanged(paused); + } + + const float effectiveFactor = paused ? 0 : data->slowDownFactor; + QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); +} + + +void QDeclarativeViewInspectorPrivate::_q_applyChangesFromClient() +{ +} + + +QList QDeclarativeViewInspectorPrivate::filterForSelection( + QList &itemlist) const +{ + foreach (QGraphicsItem *item, itemlist) { + if (isEditorItem(item)) + itemlist.removeOne(item); + } + + return itemlist; +} + +bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const +{ + return (item->type() == Constants::EditorItemType + || item->type() == Constants::ResizeHandleItemType + || item->data(Constants::EditorItemDataKey).toBool()); +} + +void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status) +{ + if (status == QDeclarativeView::Ready) + q->sendReloaded(); +} + +void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList objects) +{ + QList items; + QList gfxObjects; + foreach (QObject *obj, objects) { + if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { + items << declarativeItem; + gfxObjects << declarativeItem; + } + } + if (designModeBehavior) { + setSelectedItemsForTools(items); + clearHighlight(); + highlight(gfxObjects); + } +} + +// adjusts bounding boxes on edges of screen to be visible +QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) +{ + int marginFromEdge = 1; + QRectF boundingRect(boundingRectInSceneSpace); + if (qAbs(boundingRect.left()) - 1 < 2) + boundingRect.setLeft(marginFromEdge); + + QRect rect = data->view->rect(); + + if (boundingRect.right() >= rect.right()) + boundingRect.setRight(rect.right() - marginFromEdge); + + if (qAbs(boundingRect.top()) - 1 < 2) + boundingRect.setTop(marginFromEdge); + + if (boundingRect.bottom() >= rect.bottom()) + boundingRect.setBottom(rect.bottom() - marginFromEdge); + + return boundingRect; +} + +void QDeclarativeViewInspectorPrivate::createToolBox() +{ + toolBox = new ToolBox(q->declarativeView()); + + QmlToolBar *toolBar = toolBox->toolBar(); + + QObject::connect(q, SIGNAL(selectedColorChanged(QColor)), + toolBar, SLOT(setColorBoxColor(QColor))); + + QObject::connect(q, SIGNAL(designModeBehaviorChanged(bool)), + toolBar, SLOT(setDesignModeBehavior(bool))); + + QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)), + q, SLOT(setDesignModeBehavior(bool))); + QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), q, SLOT(setAnimationSpeed(qreal))); + QObject::connect(toolBar, SIGNAL(animationPausedChanged(bool)), q, SLOT(setAnimationPaused(bool))); + QObject::connect(toolBar, SIGNAL(colorPickerSelected()), this, SLOT(_q_changeToColorPickerTool())); + QObject::connect(toolBar, SIGNAL(zoomToolSelected()), this, SLOT(_q_changeToZoomTool())); + QObject::connect(toolBar, SIGNAL(selectToolSelected()), this, SLOT(_q_changeToSingleSelectTool())); + QObject::connect(toolBar, SIGNAL(marqueeSelectToolSelected()), + this, SLOT(_q_changeToMarqueeSelectTool())); + + QObject::connect(toolBar, SIGNAL(applyChangesFromQmlFileSelected()), + this, SLOT(_q_applyChangesFromClient())); + + QObject::connect(q, SIGNAL(animationSpeedChanged(qreal)), toolBar, SLOT(setAnimationSpeed(qreal))); + QObject::connect(q, SIGNAL(animationPausedChanged(bool)), toolBar, SLOT(setAnimationPaused(bool))); + + QObject::connect(q, SIGNAL(selectToolActivated()), toolBar, SLOT(activateSelectTool())); + + // disabled features + //connect(d->m_toolBar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient())); + //connect(q, SIGNAL(resizeToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); + //connect(q, SIGNAL(moveToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); + + QObject::connect(q, SIGNAL(colorPickerActivated()), toolBar, SLOT(activateColorPicker())); + QObject::connect(q, SIGNAL(zoomToolActivated()), toolBar, SLOT(activateZoom())); + QObject::connect(q, SIGNAL(marqueeSelectToolActivated()), + toolBar, SLOT(activateMarqueeSelectTool())); +} + +void QDeclarativeViewInspector::handleMessage(const QByteArray &message) +{ + QDataStream ds(message); + + InspectorProtocol::Message type; + ds >> type; + + switch (type) { + case InspectorProtocol::SetCurrentObjects: { + int itemCount = 0; + ds >> itemCount; + + QList selectedObjects; + for (int i = 0; i < itemCount; ++i) { + int debugId = -1; + ds >> debugId; + if (QObject *obj = QDeclarativeDebugService::objectForId(debugId)) + selectedObjects << obj; + } + + data->_q_onCurrentObjectsChanged(selectedObjects); + break; + } + case InspectorProtocol::Reload: { + data->_q_reloadView(); + break; + } + case InspectorProtocol::SetAnimationSpeed: { + qreal speed; + ds >> speed; + animationSpeedChangeRequested(speed); + break; + } + case InspectorProtocol::SetAnimationPaused: { + bool paused; + ds >> paused; + animationPausedChangeRequested(paused); + break; + } + case InspectorProtocol::ChangeTool: { + InspectorProtocol::Tool tool; + ds >> tool; + switch (tool) { + case InspectorProtocol::ColorPickerTool: + data->_q_changeToColorPickerTool(); + break; + case InspectorProtocol::SelectTool: + data->_q_changeToSingleSelectTool(); + break; + case InspectorProtocol::SelectMarqueeTool: + data->_q_changeToMarqueeSelectTool(); + break; + case InspectorProtocol::ZoomTool: + data->_q_changeToZoomTool(); + break; + default: + qWarning() << "Warning: Unhandled tool:" << tool; + } + break; + } + case InspectorProtocol::SetDesignMode: { + bool inDesignMode; + ds >> inDesignMode; + setDesignModeBehavior(inDesignMode); + break; + } + case InspectorProtocol::ShowAppOnTop: { + bool showOnTop; + ds >> showOnTop; + setShowAppOnTop(showOnTop); + break; + } + case InspectorProtocol::CreateObject: { + QString qml; + int parentId; + QString filename; + QStringList imports; + ds >> qml >> parentId >> imports >> filename; + data->_q_createQmlObject(qml, QDeclarativeDebugService::objectForId(parentId), + imports, filename); + break; + } + case InspectorProtocol::DestroyObject: { + int debugId; + ds >> debugId; + if (QObject* obj = QDeclarativeDebugService::objectForId(debugId)) + obj->deleteLater(); + break; + } + case InspectorProtocol::MoveObject: { + int debugId, newParent; + ds >> debugId >> newParent; + data->_q_reparentQmlObject(QDeclarativeDebugService::objectForId(debugId), + QDeclarativeDebugService::objectForId(newParent)); + break; + } + case InspectorProtocol::ObjectIdList: { + int itemCount; + ds >> itemCount; + data->stringIdForObjectId.clear(); + for (int i = 0; i < itemCount; ++i) { + int itemDebugId; + QString itemIdString; + ds >> itemDebugId + >> itemIdString; + + data->stringIdForObjectId.insert(itemDebugId, itemIdString); + } + break; + } + case InspectorProtocol::ClearComponentCache: { + data->_q_clearComponentCache(); + break; + } + default: + qWarning() << "Warning: Not handling message:" << type; + } +} + +void QDeclarativeViewInspector::sendDesignModeBehavior(bool inDesignMode) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::SetDesignMode + << inDesignMode; + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendCurrentObjects(const QList &objects) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::CurrentObjectsChanged + << objects.length(); + + foreach (QObject *object, objects) { + int id = QDeclarativeDebugService::idForObject(object); + ds << id; + } + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendCurrentTool(Constants::DesignTool toolId) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::ToolChanged + << toolId; + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendAnimationSpeed(qreal slowDownFactor) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::AnimationSpeedChanged + << slowDownFactor; + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendAnimationPaused(bool paused) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::AnimationPausedChanged + << paused; + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendReloaded() +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::Reloaded; + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendShowAppOnTop(bool showAppOnTop) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::ShowAppOnTop << showAppOnTop; + + data->debugService->sendMessage(message); +} + +void QDeclarativeViewInspector::sendColorChanged(const QColor &color) +{ + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + + ds << InspectorProtocol::ColorChanged + << color; + + data->debugService->sendMessage(message); +} + +QString QDeclarativeViewInspector::idStringForObject(QObject *obj) const +{ + int id = QDeclarativeDebugService::idForObject(obj); + QString idString = data->stringIdForObjectId.value(id, QString()); + return idString; +} + +QT_END_NAMESPACE + +#include "qdeclarativeviewinspector.moc" diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h new file mode 100644 index 0000000..4efa093 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEVIEWINSPECTOR_P_H +#define QDECLARATIVEVIEWINSPECTOR_P_H + +#include +#include "qmlinspectorconstants_p.h" + +#include +#include + +QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) +QT_FORWARD_DECLARE_CLASS(QMouseEvent) +QT_FORWARD_DECLARE_CLASS(QToolBar) + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspectorPrivate; + +class QDeclarativeViewInspector : public QObject +{ + Q_OBJECT + +public: + explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0); + ~QDeclarativeViewInspector(); + + void setSelectedItems(QList items); + QList selectedItems() const; + + QDeclarativeView *declarativeView(); + + QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace); + + bool showAppOnTop() const; + + void sendDesignModeBehavior(bool inDesignMode); + void sendCurrentObjects(const QList &); + void sendAnimationSpeed(qreal slowDownFactor); + void sendAnimationPaused(bool paused); + void sendCurrentTool(Constants::DesignTool toolId); + void sendReloaded(); + void sendShowAppOnTop(bool showAppOnTop); + + QString idStringForObject(QObject *obj) const; + +public Q_SLOTS: + void sendColorChanged(const QColor &color); + + void setDesignModeBehavior(bool value); + bool designModeBehavior(); + + void setShowAppOnTop(bool appOnTop); + + void setAnimationSpeed(qreal factor); + void setAnimationPaused(bool paused); + +Q_SIGNALS: + void designModeBehaviorChanged(bool inDesignMode); + void showAppOnTopChanged(bool showAppOnTop); + void reloadRequested(); + void marqueeSelectToolActivated(); + void selectToolActivated(); + void zoomToolActivated(); + void colorPickerActivated(); + void selectedColorChanged(const QColor &color); + + void animationSpeedChanged(qreal factor); + void animationPausedChanged(bool paused); + +protected: + bool eventFilter(QObject *obj, QEvent *event); + + bool leaveEvent(QEvent *); + bool mousePressEvent(QMouseEvent *event); + bool mouseMoveEvent(QMouseEvent *event); + bool mouseReleaseEvent(QMouseEvent *event); + bool keyPressEvent(QKeyEvent *event); + bool keyReleaseEvent(QKeyEvent *keyEvent); + bool mouseDoubleClickEvent(QMouseEvent *event); + bool wheelEvent(QWheelEvent *event); + + void setSelectedItemsForTools(QList items); + +private slots: + void handleMessage(const QByteArray &message); + + void animationSpeedChangeRequested(qreal factor); + void animationPausedChangeRequested(bool paused); + +private: + Q_DISABLE_COPY(QDeclarativeViewInspector) + + inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); } + QScopedPointer data; + friend class QDeclarativeViewInspectorPrivate; + friend class AbstractLiveEditTool; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h new file mode 100644 index 0000000..11cbe0f --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEVIEWINSPECTOR_P_P_H +#define QDECLARATIVEVIEWINSPECTOR_P_P_H + +#include "qdeclarativeviewinspector_p.h" + +#include +#include + +#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeViewInspector; +class LiveSelectionTool; +class ZoomTool; +class ColorPickerTool; +class LiveLayerItem; +class BoundingRectHighlighter; +class ToolBox; +class AbstractLiveEditTool; + +class QDeclarativeViewInspectorPrivate : public QObject +{ + Q_OBJECT +public: + QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *); + ~QDeclarativeViewInspectorPrivate(); + + QDeclarativeView *view; + QDeclarativeViewInspector *q; + QDeclarativeInspectorService *debugService; + QWeakPointer viewport; + QHash stringIdForObjectId; + + QPointF cursorPos; + QList > currentSelection; + + Constants::DesignTool currentToolMode; + AbstractLiveEditTool *currentTool; + + LiveSelectionTool *selectionTool; + ZoomTool *zoomTool; + ColorPickerTool *colorPickerTool; + LiveLayerItem *manipulatorLayer; + + BoundingRectHighlighter *boundingRectHighlighter; + + bool designModeBehavior; + bool showAppOnTop; + + bool animationPaused; + qreal slowDownFactor; + + ToolBox *toolBox; + + void setViewport(QWidget *widget); + + void clearEditorItems(); + void createToolBox(); + void changeToSelectTool(); + QList filterForSelection(QList &itemlist) const; + + QList selectableItems(const QPoint &pos) const; + QList selectableItems(const QPointF &scenePos) const; + QList selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; + + void setSelectedItemsForTools(const QList &items); + void setSelectedItems(const QList &items); + QList selectedItems() const; + + void changeTool(Constants::DesignTool tool, + Constants::ToolFlags flags = Constants::NoToolFlags); + + void clearHighlight(); + void highlight(const QList &item); + inline void highlight(QGraphicsObject *item) + { highlight(QList() << item); } + + bool isEditorItem(QGraphicsItem *item) const; + +public slots: + void _q_setToolBoxVisible(bool visible); + + void _q_reloadView(); + void _q_onStatusChanged(QDeclarativeView::Status status); + void _q_onCurrentObjectsChanged(QList objects); + void _q_applyChangesFromClient(); + void _q_createQmlObject(const QString &qml, QObject *parent, + const QStringList &imports, const QString &filename = QString()); + void _q_reparentQmlObject(QObject *, QObject *); + + void _q_changeToSingleSelectTool(); + void _q_changeToMarqueeSelectTool(); + void _q_changeToZoomTool(); + void _q_changeToColorPickerTool(); + void _q_clearComponentCache(); + void _q_removeFromSelection(QObject *); + +public: + static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEVIEWINSPECTOR_P_P_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro new file mode 100644 index 0000000..f8d7ee8 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro @@ -0,0 +1,51 @@ +TARGET = qmldbg_inspector +QT += declarative + +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling +QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" + +SOURCES += \ + qdeclarativeinspectorplugin.cpp \ + qdeclarativeviewinspector.cpp \ + editor/abstractliveedittool.cpp \ + editor/liveselectiontool.cpp \ + editor/livelayeritem.cpp \ + editor/livesingleselectionmanipulator.cpp \ + editor/liverubberbandselectionmanipulator.cpp \ + editor/liveselectionrectangle.cpp \ + editor/liveselectionindicator.cpp \ + editor/boundingrecthighlighter.cpp \ + editor/subcomponentmasklayeritem.cpp \ + editor/zoomtool.cpp \ + editor/colorpickertool.cpp \ + editor/qmltoolbar.cpp \ + editor/toolbarcolorbox.cpp + +HEADERS += \ + qdeclarativeinspectorplugin.h \ + qdeclarativeinspectorprotocol.h \ + qdeclarativeviewinspector_p.h \ + qdeclarativeviewinspector_p_p.h \ + qmlinspectorconstants_p.h \ + editor/abstractliveedittool_p.h \ + editor/liveselectiontool_p.h \ + editor/livelayeritem_p.h \ + editor/livesingleselectionmanipulator_p.h \ + editor/liverubberbandselectionmanipulator_p.h \ + editor/liveselectionrectangle_p.h \ + editor/liveselectionindicator_p.h \ + editor/boundingrecthighlighter_p.h \ + editor/subcomponentmasklayeritem_p.h \ + editor/zoomtool_p.h \ + editor/colorpickertool_p.h \ + editor/qmltoolbar_p.h \ + editor/toolbarcolorbox_p.h + +RESOURCES += editor/editor.qrc + +target.path += $$[QT_INSTALL_PLUGINS]/qmltooling +INSTALLS += target + +symbian:TARGET.UID3=0x20031E90 diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h new file mode 100644 index 0000000..40ec325 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLINSPECTORCONSTANTS_H +#define QMLINSPECTORCONSTANTS_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +namespace Constants { + +enum DesignTool { + NoTool = 0, + SelectionToolMode = 1, + MarqueeSelectionToolMode = 2, + MoveToolMode = 3, + ResizeToolMode = 4, + ColorPickerMode = 5, + ZoomMode = 6 +}; + +enum ToolFlags { + NoToolFlags = 0, + UseCursorPos = 1 +}; + +static const int DragStartTime = 50; + +static const int DragStartDistance = 20; + +static const double ZoomSnapDelta = 0.04; + +static const int EditorItemDataKey = 1000; + +enum GraphicsItemTypes { + EditorItemType = 0xEAAA, + ResizeHandleItemType = 0xEAEA +}; + + +} // namespace Constants + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMLINSPECTORCONSTANTS_H diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 0d60eb1..8220109 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qmldbg_tcp declarativeobserver +SUBDIRS = qmldbg_tcp qmldbg_inspector symbian:SUBDIRS += qmldbg_ost -- cgit v0.12 From 0b4e028ec294992df01430bdf978982835c7df5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Thu, 26 May 2011 20:23:16 +0200 Subject: DeclarativeObserver: Don't fade in the highlight edge It feels more responsive when the highlight is immediately visible. Change-Id: Ie3dd0693ecc38f33b001c86970b220b45b37fdfc Reviewed-by: Kai Koehne --- .../editor/boundingrecthighlighter.cpp | 61 ++++------------------ .../editor/boundingrecthighlighter_p.h | 7 +-- 2 files changed, 10 insertions(+), 58 deletions(-) diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp index 8e551d2..3f95005 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp @@ -52,10 +52,6 @@ QT_BEGIN_NAMESPACE -const qreal AnimDelta = 0.025f; -const int AnimInterval = 30; -const int AnimFrames = 10; - BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, QObject *parent) : QObject(parent), @@ -93,12 +89,8 @@ int BoundingBoxPolygonItem::type() const BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) : LiveLayerItem(view->declarativeView()->scene()), - m_view(view), - m_animFrame(0) + m_view(view) { - m_animTimer = new QTimer(this); - m_animTimer->setInterval(AnimInterval); - connect(m_animTimer, SIGNAL(timeout()), SLOT(animTimeout())); } BoundingRectHighlighter::~BoundingRectHighlighter() @@ -106,37 +98,17 @@ BoundingRectHighlighter::~BoundingRectHighlighter() } -void BoundingRectHighlighter::animTimeout() -{ - ++m_animFrame; - if (m_animFrame == AnimFrames) { - m_animTimer->stop(); - } - - qreal alpha = m_animFrame / float(AnimFrames); - - foreach (BoundingBox *box, m_boxes) { - box->highlightPolygonEdge->setOpacity(alpha); - } -} - void BoundingRectHighlighter::clear() { - if (m_boxes.length()) { - m_animTimer->stop(); - - foreach (BoundingBox *box, m_boxes) { - freeBoundingBox(box); - } - } + foreach (BoundingBox *box, m_boxes) + freeBoundingBox(box); } BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const { foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == item) { + if (box->highlightedObject.data() == item) return box; - } } return 0; } @@ -146,15 +118,11 @@ void BoundingRectHighlighter::highlight(QList items) if (items.isEmpty()) return; - bool animate = false; - QList newBoxes; foreach (QGraphicsObject *itemToHighlight, items) { BoundingBox *box = boxFor(itemToHighlight); - if (!box) { + if (!box) box = createBoundingBox(itemToHighlight); - animate = true; - } newBoxes << box; } @@ -165,7 +133,7 @@ void BoundingRectHighlighter::highlight(QList items) m_boxes << newBoxes; } - highlightAll(animate); + highlightAll(); } void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) @@ -173,17 +141,14 @@ void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) if (!itemToHighlight) return; - bool animate = false; - BoundingBox *box = boxFor(itemToHighlight); if (!box) { box = createBoundingBox(itemToHighlight); m_boxes << box; - animate = true; qSort(m_boxes); } - highlightAll(animate); + highlightAll(); } BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight) @@ -244,7 +209,7 @@ void BoundingRectHighlighter::itemDestroyed(QObject *obj) } } -void BoundingRectHighlighter::highlightAll(bool animate) +void BoundingRectHighlighter::highlightAll() { foreach (BoundingBox *box, m_boxes) { if (box && box->highlightedObject.isNull()) { @@ -262,21 +227,13 @@ void BoundingRectHighlighter::highlightAll(bool animate) box->highlightPolygon->setPolygon(QPolygonF(bboxRect)); box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect)); - - if (animate) - box->highlightPolygonEdge->setOpacity(0); - } - - if (animate) { - m_animFrame = 0; - m_animTimer->start(); } } void BoundingRectHighlighter::refresh() { if (!m_boxes.isEmpty()) - highlightAll(true); + highlightAll(); } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h index 89a9cf2..e2928f7 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h @@ -74,12 +74,11 @@ public: private slots: void refresh(); - void animTimeout(); void itemDestroyed(QObject *); private: BoundingBox *boxFor(QGraphicsObject *item) const; - void highlightAll(bool animate); + void highlightAll(); BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight); void removeBoundingBox(BoundingBox *box); void freeBoundingBox(BoundingBox *box); @@ -90,10 +89,6 @@ private: QDeclarativeViewInspector *m_view; QList m_boxes; QList m_freeBoxes; - QTimer *m_animTimer; - qreal m_animScale; - int m_animFrame; - }; class BoundingBox : public QObject -- cgit v0.12 From bc800ea78418061bc379bfb206a99f64c2ee1ed9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 6 May 2011 18:36:43 +0200 Subject: Added Wayland selection support. --- src/gui/kernel/qclipboard.h | 1 + src/gui/kernel/qplatformclipboard_qpa.cpp | 7 + src/gui/kernel/qplatformclipboard_qpa.h | 1 + .../platforms/wayland/qwaylandclipboard.cpp | 242 +++++++++++++++++++++ src/plugins/platforms/wayland/qwaylandclipboard.h | 86 ++++++++ src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 +- src/plugins/platforms/wayland/qwaylanddisplay.h | 1 + .../platforms/wayland/qwaylandinputdevice.h | 1 + .../platforms/wayland/qwaylandintegration.cpp | 9 + .../platforms/wayland/qwaylandintegration.h | 3 + src/plugins/platforms/wayland/wayland.pro | 6 +- 11 files changed, 361 insertions(+), 3 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandclipboard.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandclipboard.h diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index b55bdc6..019917e 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -112,6 +112,7 @@ protected: friend class QBaseApplication; friend class QDragManager; friend class QMimeSource; + friend class QPlatformClipboard; private: Q_DISABLE_COPY(QClipboard) diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index 957a4df..33d2afc 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -42,6 +42,8 @@ #ifndef QT_NO_CLIPBOARD +#include + QT_BEGIN_NAMESPACE class QClipboardData @@ -100,6 +102,11 @@ bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const return mode == QClipboard::Clipboard; } +void QPlatformClipboard::emitChanged(QClipboard::Mode mode) +{ + QApplication::clipboard()->emitChanged(mode); +} + QT_END_NAMESPACE #endif //QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 3381c06..5444a1f 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -62,6 +62,7 @@ public: virtual const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard ) const; virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); virtual bool supportsMode(QClipboard::Mode mode) const; + void emitChanged(QClipboard::Mode mode); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp new file mode 100644 index 0000000..9c533aa --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclipboard.h" +#include "qwaylanddisplay.h" +#include "qwaylandinputdevice.h" +#include +#include +#include +#include +#include +#include + +static QWaylandClipboard *clipboard; + +class QWaylandSelection +{ +public: + QWaylandSelection(QWaylandDisplay *display, QMimeData *data); + ~QWaylandSelection(); + +private: + static uint32_t getTime(); + static void send(void *data, struct wl_selection *selection, const char *mime_type, int fd); + static void cancelled(void *data, struct wl_selection *selection); + static const struct wl_selection_listener selectionListener; + + QMimeData *mMimeData; + struct wl_selection *mSelection; +}; + +const struct wl_selection_listener QWaylandSelection::selectionListener = { + QWaylandSelection::send, + QWaylandSelection::cancelled +}; + +uint32_t QWaylandSelection::getTime() +{ + struct timeval tv; + gettimeofday(&tv, 0); + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} + +QWaylandSelection::QWaylandSelection(QWaylandDisplay *display, QMimeData *data) + : mMimeData(data), mSelection(0) +{ + struct wl_shell *shell = display->wl_shell(); + mSelection = wl_shell_create_selection(shell); + wl_selection_add_listener(mSelection, &selectionListener, this); + foreach (const QString &format, data->formats()) + wl_selection_offer(mSelection, format.toLatin1().constData()); + wl_selection_activate(mSelection, + display->inputDevices().at(0)->wl_input_device(), + getTime()); +} + +QWaylandSelection::~QWaylandSelection() +{ + if (mSelection) { + clipboard->unregisterSelection(this); + wl_selection_destroy(mSelection); + } + delete mMimeData; +} + +void QWaylandSelection::send(void *data, + struct wl_selection *selection, + const char *mime_type, + int fd) +{ + Q_UNUSED(selection); + QWaylandSelection *self = static_cast(data); + QString mimeType = QString::fromLatin1(mime_type); + QByteArray content = self->mMimeData->data(mimeType); + if (!content.isEmpty()) { + QFile f; + if (f.open(fd, QIODevice::WriteOnly)) + f.write(content); + } + close(fd); +} + +void QWaylandSelection::cancelled(void *data, struct wl_selection *selection) +{ + Q_UNUSED(selection); + delete static_cast(data); +} + +QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) + : mDisplay(display), mSelection(0), mMimeDataIn(0), mOffer(0) +{ + clipboard = this; +} + +QWaylandClipboard::~QWaylandClipboard() +{ + if (mOffer) + wl_selection_offer_destroy(mOffer); + delete mMimeDataIn; + qDeleteAll(mSelections); +} + +void QWaylandClipboard::unregisterSelection(QWaylandSelection *selection) +{ + mSelections.removeOne(selection); +} + +void QWaylandClipboard::syncCallback(void *data) +{ + *static_cast(data) = true; +} + +void QWaylandClipboard::forceRoundtrip(struct wl_display *display) +{ + bool done = false; + wl_display_sync_callback(display, syncCallback, &done); + wl_display_iterate(display, WL_DISPLAY_WRITABLE); + while (!done) + wl_display_iterate(display, WL_DISPLAY_READABLE); +} + +const QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) const +{ + Q_ASSERT(mode == QClipboard::Clipboard); + if (!mMimeDataIn) + mMimeDataIn = new QMimeData; + mMimeDataIn->clear(); + if (!mOfferedMimeTypes.isEmpty() && mOffer) { + foreach (const QString &mimeType, mOfferedMimeTypes) { + int pipefd[2]; + if (pipe(pipefd) == -1) { + qWarning("QWaylandClipboard::mimedata: pipe() failed"); + break; + } + QByteArray mimeTypeBa = mimeType.toLatin1(); + wl_selection_offer_receive(mOffer, mimeTypeBa.constData(), pipefd[1]); + QByteArray content; + forceRoundtrip(mDisplay->wl_display()); + char buf[256]; + int n; + close(pipefd[1]); + while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) + content.append(buf, n); + close(pipefd[0]); + mMimeDataIn->setData(mimeType, content); + } + } + return mMimeDataIn; +} + +void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + Q_ASSERT(mode == QClipboard::Clipboard); + if (!mDisplay->inputDevices().isEmpty()) { + if (!data) + data = new QMimeData; + mSelection = new QWaylandSelection(mDisplay, data); + } else { + qWarning("QWaylandClipboard::setMimeData: No input devices"); + } +} + +bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const +{ + return mode == QClipboard::Clipboard; +} + +const struct wl_selection_offer_listener QWaylandClipboard::selectionOfferListener = { + QWaylandClipboard::offer, + QWaylandClipboard::keyboardFocus +}; + +void QWaylandClipboard::createSelectionOffer(uint32_t id) +{ + mOfferedMimeTypes.clear(); + if (mOffer) + wl_selection_offer_destroy(mOffer); + mOffer = 0; + struct wl_selection_offer *offer = wl_selection_offer_create(mDisplay->wl_display(), id, 1); + wl_selection_offer_add_listener(offer, &selectionOfferListener, this); +} + +void QWaylandClipboard::offer(void *data, + struct wl_selection_offer *selection_offer, + const char *type) +{ + Q_UNUSED(selection_offer); + QWaylandClipboard *self = static_cast(data); + self->mOfferedMimeTypes.append(QString::fromLatin1(type)); +} + +void QWaylandClipboard::keyboardFocus(void *data, + struct wl_selection_offer *selection_offer, + wl_input_device *input_device) +{ + QWaylandClipboard *self = static_cast(data); + if (!input_device) { + wl_selection_offer_destroy(selection_offer); + self->mOffer = 0; + return; + } + self->mOffer = selection_offer; + self->emitChanged(QClipboard::Clipboard); +} diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h new file mode 100644 index 0000000..606a1f6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIPBOARD_H +#define QWAYLANDCLIPBOARD_H + +#include +#include + +class QWaylandDisplay; +class QWaylandSelection; +struct wl_selection_offer; + +class QWaylandClipboard : public QPlatformClipboard +{ +public: + QWaylandClipboard(QWaylandDisplay *display); + ~QWaylandClipboard(); + + const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) const; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); + bool supportsMode(QClipboard::Mode mode) const; + + void unregisterSelection(QWaylandSelection *selection); + + void createSelectionOffer(uint32_t id); + +private: + static void offer(void *data, + struct wl_selection_offer *selection_offer, + const char *type); + static void keyboardFocus(void *data, + struct wl_selection_offer *selection_offer, + struct wl_input_device *input_device); + static const struct wl_selection_offer_listener selectionOfferListener; + + static void syncCallback(void *data); + static void forceRoundtrip(struct wl_display *display); + + QWaylandDisplay *mDisplay; + QWaylandSelection *mSelection; + mutable QMimeData *mMimeDataIn; + QList mSelections; + QStringList mOfferedMimeTypes; + struct wl_selection_offer *mOffer; +}; + +#endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index da908fb..c3eb7f4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -45,6 +45,7 @@ #include "qwaylandscreen.h" #include "qwaylandcursor.h" #include "qwaylandinputdevice.h" +#include "qwaylandclipboard.h" #ifdef QT_WAYLAND_GL_SUPPORT #include "gl_integration/qwaylandglintegration.h" @@ -56,6 +57,7 @@ #include #include +#include #include #include @@ -265,7 +267,6 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, uint32_t version) { Q_UNUSED(version); - if (interface == "wl_output") { struct wl_output *output = wl_output_create(mDisplay, id, 1); wl_output_add_listener(output, &outputListener, this); @@ -280,5 +281,9 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, QWaylandInputDevice *inputDevice = new QWaylandInputDevice(mDisplay, id); mInputDevices.append(inputDevice); + } else if (interface == "wl_selection_offer") { + QPlatformIntegration *plat = QApplicationPrivate::platformIntegration(); + QWaylandClipboard *clipboard = static_cast(plat->clipboard()); + clipboard->createSelectionOffer(id); } } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 81deb3d..6266360 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -87,6 +87,7 @@ public: void frameCallback(wl_display_frame_func_t func, struct wl_surface *surface, void *data); struct wl_display *wl_display() const { return mDisplay; } + struct wl_shell *wl_shell() const { return mShell; } QList inputDevices() const { return mInputDevices; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.h b/src/plugins/platforms/wayland/qwaylandinputdevice.h index 3c83252..251259b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.h @@ -60,6 +60,7 @@ public: QWaylandInputDevice(struct wl_display *display, uint32_t id); void attach(QWaylandBuffer *buffer, int x, int y); void handleWindowDestroyed(QWaylandWindow *window); + struct wl_input_device *wl_input_device() const { return mInputDevice; } private: struct wl_display *mDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b6401f6..6166c14 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -45,6 +45,7 @@ #include "qwaylandshmsurface.h" #include "qwaylandshmwindow.h" #include "qwaylandnativeinterface.h" +#include "qwaylandclipboard.h" #include "qgenericunixfontdatabase.h" @@ -64,6 +65,7 @@ QWaylandIntegration::QWaylandIntegration(bool useOpenGL) , mDisplay(new QWaylandDisplay()) , mUseOpenGL(useOpenGL) , mNativeInterface(new QWaylandNativeInterface) + , mClipboard(0) { } @@ -132,3 +134,10 @@ bool QWaylandIntegration::hasOpenGL() const return false; #endif } + +QPlatformClipboard *QWaylandIntegration::clipboard() const +{ + if (!mClipboard) + mClipboard = new QWaylandClipboard(mDisplay); + return mClipboard; +} diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 71f6d9c..fc748b0 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -65,6 +65,8 @@ public: QPlatformNativeInterface *nativeInterface() const; + QPlatformClipboard *clipboard() const; + private: bool hasOpenGL() const; @@ -72,6 +74,7 @@ private: QWaylandDisplay *mDisplay; bool mUseOpenGL; QPlatformNativeInterface *mNativeInterface; + mutable QPlatformClipboard *mClipboard; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index d2498b2..19f7ca3 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -15,7 +15,8 @@ SOURCES = main.cpp \ qwaylanddisplay.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ - qwaylandshmwindow.cpp + qwaylandshmwindow.cpp \ + qwaylandclipboard.cpp HEADERS = qwaylandintegration.h \ qwaylandnativeinterface.h \ @@ -25,7 +26,8 @@ HEADERS = qwaylandintegration.h \ qwaylandscreen.h \ qwaylandshmsurface.h \ qwaylandbuffer.h \ - qwaylandshmwindow.h + qwaylandshmwindow.h \ + qwaylandclipboard.h INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND LIBS += $$QMAKE_LIBS_WAYLAND -- cgit v0.12 From 1a17ab72726ba5d15396ee152c78a1aa921533a6 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 10 May 2011 09:17:27 +0200 Subject: Retrieve the actual data in the Wayland clipboard only when requested. --- .../platforms/wayland/qwaylandclipboard.cpp | 86 ++++++++++++++++------ src/plugins/platforms/wayland/qwaylandclipboard.h | 6 +- 2 files changed, 69 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 9c533aa..9a363b5 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -48,9 +48,48 @@ #include #include #include +#include static QWaylandClipboard *clipboard; +class QWaylandMimeData : public QInternalMimeData +{ +public: + void clearAll(); + void setFormats(const QStringList &formatList); + bool hasFormat_sys(const QString &mimeType) const; + QStringList formats_sys() const; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; +private: + QStringList mFormatList; +}; + +void QWaylandMimeData::clearAll() +{ + clear(); + mFormatList.clear(); +} + +void QWaylandMimeData::setFormats(const QStringList &formatList) +{ + mFormatList = formatList; +} + +bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const +{ + return formats().contains(mimeType); +} + +QStringList QWaylandMimeData::formats_sys() const +{ + return mFormatList; +} + +QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const +{ + return clipboard->retrieveData(mimeType, type); +} + class QWaylandSelection { public: @@ -157,32 +196,35 @@ void QWaylandClipboard::forceRoundtrip(struct wl_display *display) wl_display_iterate(display, WL_DISPLAY_READABLE); } +QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type type) const +{ + Q_UNUSED(type); + int pipefd[2]; + if (pipe(pipefd) == -1) { + qWarning("QWaylandClipboard: pipe() failed"); + return QVariant(); + } + QByteArray mimeTypeBa = mimeType.toLatin1(); + wl_selection_offer_receive(mOffer, mimeTypeBa.constData(), pipefd[1]); + QByteArray content; + forceRoundtrip(mDisplay->wl_display()); + char buf[256]; + int n; + close(pipefd[1]); + while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) + content.append(buf, n); + close(pipefd[0]); + return content; +} + const QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) const { Q_ASSERT(mode == QClipboard::Clipboard); if (!mMimeDataIn) - mMimeDataIn = new QMimeData; - mMimeDataIn->clear(); - if (!mOfferedMimeTypes.isEmpty() && mOffer) { - foreach (const QString &mimeType, mOfferedMimeTypes) { - int pipefd[2]; - if (pipe(pipefd) == -1) { - qWarning("QWaylandClipboard::mimedata: pipe() failed"); - break; - } - QByteArray mimeTypeBa = mimeType.toLatin1(); - wl_selection_offer_receive(mOffer, mimeTypeBa.constData(), pipefd[1]); - QByteArray content; - forceRoundtrip(mDisplay->wl_display()); - char buf[256]; - int n; - close(pipefd[1]); - while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) - content.append(buf, n); - close(pipefd[0]); - mMimeDataIn->setData(mimeType, content); - } - } + mMimeDataIn = new QWaylandMimeData; + mMimeDataIn->clearAll(); + if (!mOfferedMimeTypes.isEmpty() && mOffer) + mMimeDataIn->setFormats(mOfferedMimeTypes); return mMimeDataIn; } diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h index 606a1f6..b0d6394 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -44,9 +44,11 @@ #include #include +#include class QWaylandDisplay; class QWaylandSelection; +class QWaylandMimeData; struct wl_selection_offer; class QWaylandClipboard : public QPlatformClipboard @@ -63,6 +65,8 @@ public: void createSelectionOffer(uint32_t id); + QVariant retrieveData(const QString &mimeType, QVariant::Type type) const; + private: static void offer(void *data, struct wl_selection_offer *selection_offer, @@ -77,7 +81,7 @@ private: QWaylandDisplay *mDisplay; QWaylandSelection *mSelection; - mutable QMimeData *mMimeDataIn; + mutable QWaylandMimeData *mMimeDataIn; QList mSelections; QStringList mOfferedMimeTypes; struct wl_selection_offer *mOffer; -- cgit v0.12 From 55a440589c186e389390b2fd18170768901fa618 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 10 May 2011 10:09:44 +0200 Subject: Remove const from QPlatformClipboard::mimeData(). Most implementations will anyway do non-const operations in there, the change avoids the need for const_cast or mutable. --- src/gui/kernel/qplatformclipboard_qpa.cpp | 2 +- src/gui/kernel/qplatformclipboard_qpa.h | 2 +- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 2 +- src/plugins/platforms/wayland/qwaylandclipboard.h | 4 ++-- src/plugins/platforms/xlib/qxlibclipboard.cpp | 8 +++----- src/plugins/platforms/xlib/qxlibclipboard.h | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index 33d2afc..302df68 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -83,7 +83,7 @@ QPlatformClipboard::~QPlatformClipboard() } -const QMimeData *QPlatformClipboard::mimeData(QClipboard::Mode mode) const +QMimeData *QPlatformClipboard::mimeData(QClipboard::Mode mode) { //we know its clipboard Q_UNUSED(mode); diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 5444a1f..e1be8aa 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -59,7 +59,7 @@ class Q_GUI_EXPORT QPlatformClipboard public: virtual ~QPlatformClipboard(); - virtual const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard ) const; + virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); virtual bool supportsMode(QClipboard::Mode mode) const; void emitChanged(QClipboard::Mode mode); diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 9a363b5..c1ac386 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -217,7 +217,7 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type return content; } -const QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) const +QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) { Q_ASSERT(mode == QClipboard::Clipboard); if (!mMimeDataIn) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h index b0d6394..6a02254 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -57,7 +57,7 @@ public: QWaylandClipboard(QWaylandDisplay *display); ~QWaylandClipboard(); - const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) const; + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); bool supportsMode(QClipboard::Mode mode) const; @@ -81,7 +81,7 @@ private: QWaylandDisplay *mDisplay; QWaylandSelection *mSelection; - mutable QWaylandMimeData *mMimeDataIn; + QWaylandMimeData *mMimeDataIn; QList mSelections; QStringList mOfferedMimeTypes; struct wl_selection_offer *mOffer; diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index dfaf552..fef6e3a 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -161,12 +161,11 @@ QXlibClipboard::QXlibClipboard(QXlibScreen *screen) { } -const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const +QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) { if (mode == QClipboard::Clipboard) { if (!m_xClipboard) { - QXlibClipboard *that = const_cast(this); - that->m_xClipboard = new QXlibClipboardMime(mode,that); + m_xClipboard = new QXlibClipboardMime(mode, this); } Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { @@ -176,8 +175,7 @@ const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const } } else if (mode == QClipboard::Selection) { if (!m_xSelection) { - QXlibClipboard *that = const_cast(this); - that->m_xSelection = new QXlibClipboardMime(mode,that); + m_xSelection = new QXlibClipboardMime(mode, this); } Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),XA_PRIMARY); if (clipboardOwner == owner()) { diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h index 15901b0..d61340d 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.h +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -51,7 +51,7 @@ class QXlibClipboard : public QPlatformClipboard public: QXlibClipboard(QXlibScreen *screen); - const QMimeData *mimeData(QClipboard::Mode mode) const; + QMimeData *mimeData(QClipboard::Mode mode); void setMimeData(QMimeData *data, QClipboard::Mode mode); bool supportsMode(QClipboard::Mode mode) const; -- cgit v0.12 From 0b57fc57d2c52c3ac58ed7095f236446c9dd97e7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 10 May 2011 18:03:43 +0200 Subject: Prevent crash in wayland mimedata in case there is no offer. --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index c1ac386..47ca228 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -199,6 +199,8 @@ void QWaylandClipboard::forceRoundtrip(struct wl_display *display) QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type type) const { Q_UNUSED(type); + if (mOfferedMimeTypes.isEmpty() || !mOffer) + return QVariant(); int pipefd[2]; if (pipe(pipefd) == -1) { qWarning("QWaylandClipboard: pipe() failed"); -- cgit v0.12 From 053aef5972636ad76fe9aea0e7425394e91756c5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 12 May 2011 16:20:03 +0200 Subject: Fix deadlocks in wayland clipboard that can occur in special scenarios. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setMimeData() emits the changed signal always so to prevent duplicated signals keyboardFocus() must only emit when the change came from another wayland client. However direct connection may cause issues when invoking the slot from a wayland callback, so use a metacall to make sure we return from the callback. Unnecessary data transfer and potential deadlock is now also avoided when a client is requesting the mime data from itself. Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandclipboard.cpp | 25 ++++++++++++++-------- src/plugins/platforms/wayland/qwaylandclipboard.h | 9 +++++++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 47ca228..cf9c5a7 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -96,7 +96,6 @@ public: QWaylandSelection(QWaylandDisplay *display, QMimeData *data); ~QWaylandSelection(); -private: static uint32_t getTime(); static void send(void *data, struct wl_selection *selection, const char *mime_type, int fd); static void cancelled(void *data, struct wl_selection *selection); @@ -164,7 +163,7 @@ void QWaylandSelection::cancelled(void *data, struct wl_selection *selection) } QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) - : mDisplay(display), mSelection(0), mMimeDataIn(0), mOffer(0) + : mDisplay(display), mMimeDataIn(0), mOffer(0) { clipboard = this; } @@ -222,6 +221,8 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) { Q_ASSERT(mode == QClipboard::Clipboard); + if (!mSelections.isEmpty()) + return mSelections.last()->mMimeData; if (!mMimeDataIn) mMimeDataIn = new QWaylandMimeData; mMimeDataIn->clearAll(); @@ -236,7 +237,7 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (!mDisplay->inputDevices().isEmpty()) { if (!data) data = new QMimeData; - mSelection = new QWaylandSelection(mDisplay, data); + mSelections.append(new QWaylandSelection(mDisplay, data)); } else { qWarning("QWaylandClipboard::setMimeData: No input devices"); } @@ -266,21 +267,27 @@ void QWaylandClipboard::offer(void *data, struct wl_selection_offer *selection_offer, const char *type) { + Q_UNUSED(data); Q_UNUSED(selection_offer); - QWaylandClipboard *self = static_cast(data); - self->mOfferedMimeTypes.append(QString::fromLatin1(type)); + clipboard->mOfferedMimeTypes.append(QString::fromLatin1(type)); } void QWaylandClipboard::keyboardFocus(void *data, struct wl_selection_offer *selection_offer, wl_input_device *input_device) { - QWaylandClipboard *self = static_cast(data); + Q_UNUSED(data); if (!input_device) { wl_selection_offer_destroy(selection_offer); - self->mOffer = 0; + clipboard->mOffer = 0; return; } - self->mOffer = selection_offer; - self->emitChanged(QClipboard::Clipboard); + clipboard->mOffer = selection_offer; + if (clipboard->mSelections.isEmpty()) + QMetaObject::invokeMethod(&clipboard->mEmitter, "emitChanged", Qt::QueuedConnection); +} + +void QWaylandClipboardSignalEmitter::emitChanged() +{ + clipboard->emitChanged(QClipboard::Clipboard); } diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h index 6a02254..db436b8 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -51,6 +51,13 @@ class QWaylandSelection; class QWaylandMimeData; struct wl_selection_offer; +class QWaylandClipboardSignalEmitter : public QObject +{ + Q_OBJECT +public slots: + void emitChanged(); +}; + class QWaylandClipboard : public QPlatformClipboard { public: @@ -80,11 +87,11 @@ private: static void forceRoundtrip(struct wl_display *display); QWaylandDisplay *mDisplay; - QWaylandSelection *mSelection; QWaylandMimeData *mMimeDataIn; QList mSelections; QStringList mOfferedMimeTypes; struct wl_selection_offer *mOffer; + QWaylandClipboardSignalEmitter mEmitter; }; #endif // QWAYLANDCLIPBOARD_H -- cgit v0.12 From 7c2d885d98761fca7624933a92cde7bad113c862 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 23 May 2011 12:29:54 +0200 Subject: Track Wayland changes The wl_display_get_xxxx_visual() functions have been removed, and are replaced by a compositor event. Reviewed-by: Samuel --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 34 +++++++++++++++++++++-- src/plugins/platforms/wayland/qwaylanddisplay.h | 6 ++++ src/plugins/platforms/wayland/wayland_sha1.txt | 3 ++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/plugins/platforms/wayland/wayland_sha1.txt diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c3eb7f4..aee1fa4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -81,17 +81,17 @@ struct wl_buffer *QWaylandDisplay::createShmBuffer(int fd, struct wl_visual *QWaylandDisplay::rgbVisual() { - return wl_display_get_rgb_visual(mDisplay); + return rgb_visual; } struct wl_visual *QWaylandDisplay::argbVisual() { - return wl_display_get_argb_visual(mDisplay); + return argb_visual; } struct wl_visual *QWaylandDisplay::argbPremultipliedVisual() { - return wl_display_get_premultiplied_argb_visual(mDisplay); + return premultiplied_argb_visual; } #ifdef QT_WAYLAND_GL_SUPPORT @@ -127,6 +127,7 @@ const struct wl_shell_listener QWaylandDisplay::shellListener = { }; QWaylandDisplay::QWaylandDisplay(void) + : argb_visual(0), premultiplied_argb_visual(0), rgb_visual(0) { mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { @@ -244,6 +245,11 @@ const struct wl_output_listener QWaylandDisplay::outputListener = { QWaylandDisplay::outputHandleGeometry }; +const struct wl_compositor_listener QWaylandDisplay::compositorListener = { + QWaylandDisplay::handleVisual, +}; + + void QWaylandDisplay::waitForScreens() { flushRequests(); @@ -272,6 +278,8 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, wl_output_add_listener(output, &outputListener, this); } else if (interface == "wl_compositor") { mCompositor = wl_compositor_create(mDisplay, id, 1); + wl_compositor_add_listener(mCompositor, + &compositorListener, this); } else if (interface == "wl_shm") { mShm = wl_shm_create(mDisplay, id, 1); } else if (interface == "wl_shell"){ @@ -287,3 +295,23 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, clipboard->createSelectionOffer(id); } } + +void QWaylandDisplay::handleVisual(void *data, + struct wl_compositor *compositor, + uint32_t id, uint32_t token) +{ + QWaylandDisplay *self = static_cast(data); + + switch (token) { + case WL_COMPOSITOR_VISUAL_ARGB32: + self->argb_visual = wl_visual_create(self->mDisplay, id, 1); + break; + case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32: + self->premultiplied_argb_visual = + wl_visual_create(self->mDisplay, id, 1); + break; + case WL_COMPOSITOR_VISUAL_XRGB32: + self->rgb_visual = wl_visual_create(self->mDisplay, id, 1); + break; + } +} diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 6266360..16ab3f7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -116,7 +116,10 @@ private: uint32_t mSocketMask; + struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual; + static const struct wl_output_listener outputListener; + static const struct wl_compositor_listener compositorListener; static int sourceUpdate(uint32_t mask, void *data); static void displayHandleGlobal(struct wl_display *display, uint32_t id, @@ -127,6 +130,9 @@ private: int32_t x, int32_t y, int32_t width, int32_t height); + static void handleVisual(void *data, + struct wl_compositor *compositor, + uint32_t id, uint32_t token); #ifdef QT_WAYLAND_GL_SUPPORT QWaylandGLIntegration *mEglIntegration; #endif diff --git a/src/plugins/platforms/wayland/wayland_sha1.txt b/src/plugins/platforms/wayland/wayland_sha1.txt new file mode 100644 index 0000000..d262437 --- /dev/null +++ b/src/plugins/platforms/wayland/wayland_sha1.txt @@ -0,0 +1,3 @@ +This version of the Qt Wayland plugin is checked against the following sha1 +from the Wayland repository: +eff7fc0d99be2e51eaa351785030c8d374ac71de -- cgit v0.12 From af3efefeefe686e5c35ed502de077c0bcb6f6fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 27 May 2011 02:12:02 -0700 Subject: We need to let the currentContext be in the same state after setting the new eglsurface --- .../wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp index d293019..aaba5ac 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp @@ -115,8 +115,15 @@ void *QWaylandGLContext::getProcAddress(const QString &string) void QWaylandGLContext::setEglSurface(EGLSurface surface) { - doneCurrent(); + bool wasCurrent = false; + if (QPlatformGLContext::currentContext() == this) { + wasCurrent = true; + doneCurrent(); + } mSurface = surface; + if (wasCurrent) { + makeCurrent(); + } } EGLConfig QWaylandGLContext::eglConfig() const -- cgit v0.12 From 322c96eb9564f930a63be820c22b053630663880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Sun, 8 May 2011 10:53:56 +0200 Subject: Fix the wayland windowsurface so that we have stencil and depth buffer --- .../platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp index ebe4c7b..7929ccb 100644 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp +++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp @@ -178,7 +178,7 @@ void QWaylandGLWindowSurface::resize(const QSize &size) QWindowSurface::resize(size); window()->platformWindow()->glContext()->makeCurrent(); delete mPaintDevice; - mPaintDevice = new QGLFramebufferObject(size); + mPaintDevice = new QGLFramebufferObject(size,QGLFramebufferObject::CombinedDepthStencil); } QT_END_NAMESPACE -- cgit v0.12 From 750071097f55be38dbdca1ed77064c8ed1a64f9e Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 12 May 2011 10:27:03 +0300 Subject: Symbian build failure for Armv5 1. Changed externs to Q_GUI_EXPORTs 2. ABSENTed missing exports from openGL's DEF-file Reviewed-by: Tomi Vihria --- src/gui/painting/qpainter.cpp | 2 +- src/opengl/qpaintengine_opengl.cpp | 4 ++-- src/openvg/qpaintengine_vg.cpp | 4 ++-- src/s60installs/eabi/QtOpenGLu.def | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 3cdf8fe..0a1e34e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -692,7 +692,7 @@ void QPainterPrivate::updateInvMatrix() invMatrix = state->matrix.inverted(); } -extern bool qt_isExtendedRadialGradient(const QBrush &brush); +Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush); void QPainterPrivate::updateEmulationSpecifier(QPainterState *s) { diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 5fa9f32..58ce6f8 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2119,7 +2119,7 @@ void QOpenGLPaintEnginePrivate::fillPath(const QPainterPath &path) updateGLMatrix(); } -extern bool qt_isExtendedRadialGradient(const QBrush &brush); +Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush); static inline bool needsEmulation(Qt::BrushStyle style) { @@ -5450,7 +5450,7 @@ void QOpenGLPaintEngine::transformChanged() updateMatrix(state()->matrix); } -extern QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); +Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); void QOpenGLPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 68a6a0b..70e26fb 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -280,7 +280,7 @@ public: inline bool needsEmulation(const QBrush &brush) const { - extern bool qt_isExtendedRadialGradient(const QBrush &brush); + Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush); return qt_isExtendedRadialGradient(brush); } @@ -1579,7 +1579,7 @@ void QVGPaintEngine::draw(const QVectorPath &path) vgDestroyPath(vgpath); } -extern QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); +Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index 44f7306..11ac503 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -759,11 +759,11 @@ EXPORTS _ZNK14QGLPaintDevice9isFlippedEv @ 758 NONAME _ZNK16QGLWindowSurface8featuresEv @ 759 NONAME _ZNK26QGLFramebufferObjectFormat6mipmapEv @ 760 NONAME - _ZTI22QGLContextResourceBase @ 761 NONAME - _ZTI27QGLContextGroupResourceBase @ 762 NONAME - _ZTV22QGLContextResourceBase @ 763 NONAME - _ZTV27QGLContextGroupResourceBase @ 764 NONAME - _ZThn104_N20QGLTextureGlyphCacheD0Ev @ 765 NONAME - _ZThn104_N20QGLTextureGlyphCacheD1Ev @ 766 NONAME - _ZThn8_NK16QGLWindowSurface8featuresEv @ 767 NONAME + _ZTI22QGLContextResourceBase @ 761 NONAME ABSENT + _ZTI27QGLContextGroupResourceBase @ 762 NONAME ABSENT + _ZTV22QGLContextResourceBase @ 763 NONAME ABSENT + _ZTV27QGLContextGroupResourceBase @ 764 NONAME ABSENT + _ZThn104_N20QGLTextureGlyphCacheD0Ev @ 765 NONAME ABSENT + _ZThn104_N20QGLTextureGlyphCacheD1Ev @ 766 NONAME ABSENT + _ZThn8_NK16QGLWindowSurface8featuresEv @ 767 NONAME ABSENT -- cgit v0.12 From 8293336590722f6a92a6b4af401485683b5508fa Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 31 May 2011 11:22:14 +0300 Subject: Fix tst_QGraphicsItem::sorting() test case for Symbian Some devices have bigger than expected minimum width for scrollbars, which broke the sorting test case as some objects that were expected to be painted were fully obscured by scrollbars and therefore skipped. Task-number: QT-5048 Reviewed-by: Janne Koskinen --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 15ed242..37893d8 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8029,7 +8029,16 @@ void tst_QGraphicsItem::sorting() QGraphicsView view(&scene); view.setResizeAnchor(QGraphicsView::NoAnchor); view.setTransformationAnchor(QGraphicsView::NoAnchor); +#ifdef Q_OS_SYMBIAN + // Adjust area in devices where scrollbars are thicker than 25 pixels as they will + // obstruct painting otherwise. + int scrollWidth = qMax(25, view.verticalScrollBar()->width()); + int scrollHeight = qMax(25, view.horizontalScrollBar()->height()); + + view.resize(95 + scrollWidth, 75 + scrollHeight); +#else view.resize(120, 100); +#endif view.setFrameStyle(0); view.show(); #ifdef Q_WS_X11 -- cgit v0.12 From 9d0104d3da01e262d2178c864b4ba94f620eaa3b Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 31 May 2011 11:51:10 +0200 Subject: Still use midpoint rendering of aliased ellipses 37c329a removed this, but it is required to get correct fills, particularly for small radii Reviewed-by: gunnar --- src/gui/painting/qpaintengine_raster.cpp | 160 +++++++++++++++++++++++++++++++ src/gui/painting/qpaintengine_raster_p.h | 1 + 2 files changed, 161 insertions(+) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 730f6a2..71bbbb1 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -160,6 +160,10 @@ enum LineDrawMode { LineDrawIncludeLastPixel }; +static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, + ProcessSpans pen_func, ProcessSpans brush_func, + QSpanData *pen_data, QSpanData *brush_data); + struct QRasterFloatPoint { qreal x; qreal y; @@ -3037,6 +3041,19 @@ QRasterPaintEnginePrivate::getBrushFunc(const QRectF &rect, return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; } +inline ProcessSpans +QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect, + const QSpanData *data) const +{ + Q_Q(const QRasterPaintEngine); + const QRasterPaintEngineState *s = q->state(); + + if (!s->flags.fast_pen && s->matrix.type() > QTransform::TxTranslate) + return data->blend; + const int penWidth = s->flags.fast_pen ? 1 : qCeil(s->lastPen.widthF()); + return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; +} + /*! \reimp */ @@ -3353,6 +3370,30 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) */ void QRasterPaintEngine::drawEllipse(const QRectF &rect) { + Q_D(QRasterPaintEngine); + QRasterPaintEngineState *s = state(); + + ensurePen(); + if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen) + || (qpen_style(s->lastPen) == Qt::NoPen)) + && !s->flags.antialiased + && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT + && !rect.isEmpty() + && s->matrix.type() <= QTransform::TxScale) // no shear + { + ensureBrush(); + const QRectF r = s->matrix.mapRect(rect); + ProcessSpans penBlend = d->getPenFunc(r, &s->penData); + ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData); + const QRect brect = QRect(int(r.x()), int(r.y()), + int_dim(r.x(), r.width()), + int_dim(r.y(), r.height())); + if (brect == r) { + drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend, + &s->penData, &s->brushData); + return; + } + } QPaintEngineEx::drawEllipse(rect); } @@ -5006,6 +5047,125 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _ adjustSpanMethods(); } +/*! + \internal + \a x and \a y is relative to the midpoint of \a rect. +*/ +static inline void drawEllipsePoints(int x, int y, int length, + const QRect &rect, + const QRect &clip, + ProcessSpans pen_func, ProcessSpans brush_func, + QSpanData *pen_data, QSpanData *brush_data) +{ + if (length == 0) + return; + + QT_FT_Span outline[4]; + const int midx = rect.x() + (rect.width() + 1) / 2; + const int midy = rect.y() + (rect.height() + 1) / 2; + + x = x + midx; + y = midy - y; + + // topleft + outline[0].x = midx + (midx - x) - (length - 1) - (rect.width() & 0x1); + outline[0].len = qMin(length, x - outline[0].x); + outline[0].y = y; + outline[0].coverage = 255; + + // topright + outline[1].x = x; + outline[1].len = length; + outline[1].y = y; + outline[1].coverage = 255; + + // bottomleft + outline[2].x = outline[0].x; + outline[2].len = outline[0].len; + outline[2].y = midy + (midy - y) - (rect.height() & 0x1); + outline[2].coverage = 255; + + // bottomright + outline[3].x = x; + outline[3].len = length; + outline[3].y = outline[2].y; + outline[3].coverage = 255; + + if (brush_func && outline[0].x + outline[0].len < outline[1].x) { + QT_FT_Span fill[2]; + + // top fill + fill[0].x = outline[0].x + outline[0].len - 1; + fill[0].len = qMax(0, outline[1].x - fill[0].x); + fill[0].y = outline[1].y; + fill[0].coverage = 255; + + // bottom fill + fill[1].x = outline[2].x + outline[2].len - 1; + fill[1].len = qMax(0, outline[3].x - fill[1].x); + fill[1].y = outline[3].y; + fill[1].coverage = 255; + + int n = (fill[0].y >= fill[1].y ? 1 : 2); + n = qt_intersect_spans(fill, n, clip); + if (n > 0) + brush_func(n, fill, brush_data); + } + if (pen_func) { + int n = (outline[1].y >= outline[2].y ? 2 : 4); + n = qt_intersect_spans(outline, n, clip); + if (n > 0) + pen_func(n, outline, pen_data); + } +} + +/*! + \internal + Draws an ellipse using the integer point midpoint algorithm. +*/ +static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, + ProcessSpans pen_func, ProcessSpans brush_func, + QSpanData *pen_data, QSpanData *brush_data) +{ + const qreal a = qreal(rect.width()) / 2; + const qreal b = qreal(rect.height()) / 2; + qreal d = b*b - (a*a*b) + 0.25*a*a; + + int x = 0; + int y = (rect.height() + 1) / 2; + int startx = x; + + // region 1 + while (a*a*(2*y - 1) > 2*b*b*(x + 1)) { + if (d < 0) { // select E + d += b*b*(2*x + 3); + ++x; + } else { // select SE + d += b*b*(2*x + 3) + a*a*(-2*y + 2); + drawEllipsePoints(startx, y, x - startx + 1, rect, clip, + pen_func, brush_func, pen_data, brush_data); + startx = ++x; + --y; + } + } + drawEllipsePoints(startx, y, x - startx + 1, rect, clip, + pen_func, brush_func, pen_data, brush_data); + + // region 2 + d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); + const int miny = rect.height() & 0x1; + while (y > miny) { + if (d < 0) { // select SE + d += b*b*(2*x + 2) + a*a*(-2*y + 3); + ++x; + } else { // select S + d += a*a*(-2*y + 3); + } + --y; + drawEllipsePoints(x, y, 1, rect, clip, + pen_func, brush_func, pen_data, brush_data); + } +} /*! \fn void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 122c2b8..61cf07b 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -325,6 +325,7 @@ public: bool isUnclipped_normalized(const QRect &rect) const; bool isUnclipped(const QRect &rect, int penWidth) const; bool isUnclipped(const QRectF &rect, int penWidth) const; + ProcessSpans getPenFunc(const QRectF &rect, const QSpanData *data) const; ProcessSpans getBrushFunc(const QRect &rect, const QSpanData *data) const; ProcessSpans getBrushFunc(const QRectF &rect, const QSpanData *data) const; -- cgit v0.12 From e159f97f6ecefb49d50a82b1084fd1b1b9e5e2cf Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 31 May 2011 11:29:46 +0200 Subject: Fix glyph metrics with QStaticText/Freetype/raster and light/no hinting This is a back-port of part of cad70d64d0bbada. In the raster engine's drawCachedGlyphs(), which is used by QStaticText, we would use the wrong metrics to lay out the glyphs, because loadGlyphMetrics() would assume full hinting. A visible effect of this was that the baseline of rotated text became wavy. Task-number: QTBUG-18185 Reviewed-by: Jiang Jiang --- src/gui/text/qfontengine_ft.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index c4e89d5..1056aed 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -762,9 +762,18 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph return g; int load_flags = FT_LOAD_DEFAULT | default_load_flags; + int load_target = default_hint_style == HintLight + ? FT_LOAD_TARGET_LIGHT + : FT_LOAD_TARGET_NORMAL; + if (set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; + if (default_hint_style == HintNone) + load_flags |= FT_LOAD_NO_HINTING; + else + load_flags |= load_target; + // apply our matrix to this, but note that the metrics will not be affected by this. FT_Face face = lockFace(); FT_Matrix matrix = this->matrix; -- cgit v0.12 From 348894a550510e54e7709d18676b4b10c9e5e9e3 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 31 May 2011 12:15:55 +0200 Subject: Avoid buffer overrun in QMacPixmapData resizing Shouldn't use size bigger than the original (source) pixels buffer or the new one (just allocated). Task-number: QTBUG-18547 Reviewed-by: aavit --- src/gui/image/qpixmap_mac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index aac159e..6872cfa 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -637,7 +637,7 @@ void QMacPixmapData::macCreatePixels() } if (pixels) - memcpy(base_pixels, pixels, pixelsSize); + memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes)); pixels = base_pixels; pixelsSize = numBytes; } -- cgit v0.12 From df4a40c6ecfac9ff7b3c03ffed62be87047db35e Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Tue, 31 May 2011 13:19:17 +0300 Subject: Fix the build break for QStyleSheetStyle autotest on Symbian This commit fixes the build break on Symbian caused by using Motif style which is not supported in Symbian. Reviewed by: Sami Merila --- tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 1799019..a4fc1a9 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1608,7 +1608,12 @@ class ChangeEventWidget : public QWidget static bool recurse = false; if (!recurse) { recurse = true; + +#ifdef Q_OS_SYMBIAN + QStyle *style = new QWindowsStyle(); +#else QStyle *style = new QMotifStyle; +#endif style->setParent(this); setStyle(style); recurse = false; -- cgit v0.12 From 4f46153bce807a5c178a60ce89c38fdd30d13f49 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 31 May 2011 12:29:40 +0200 Subject: Fix autotest to not depend on rasterization details This test broke with 37c329a. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 73e5656..5ffdf4f 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6413,6 +6413,7 @@ void tst_QGraphicsItem::boundingRegion_data() QTest::newRow("(0, 0, 10, 10) | 0.0 | identity | {(0, 0, 10, 10)}") << QLineF(0, 0, 10, 10) << qreal(0.0) << QTransform() << QRegion(QRect(0, 0, 10, 10)); +#if 0 { QRegion r; r += QRect(0, 0, 6, 2); @@ -6430,6 +6431,7 @@ void tst_QGraphicsItem::boundingRegion_data() r += QRect(6, 9, 4, 1); QTest::newRow("(0, 0, 10, 10) | 1.0 | identity | {(0, 0, 10, 10)}") << QLineF(0, 0, 10, 10) << qreal(1.0) << QTransform() << r; } +#endif QTest::newRow("(0, 0, 10, 0) | 0.0 | identity | {(0, 0, 10, 10)}") << QLineF(0, 0, 10, 0) << qreal(0.0) << QTransform() << QRegion(QRect(0, 0, 10, 1)); QTest::newRow("(0, 0, 10, 0) | 0.5 | identity | {(0, 0, 10, 1)}") << QLineF(0, 0, 10, 0) << qreal(0.5) << QTransform() -- cgit v0.12 From bedf245d3ee7c5760d56bb67e97d6a62a34105e9 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Mon, 23 May 2011 16:44:29 +0200 Subject: QDeclarative: fixed clean animation lists Change-Id: I9dd8b4fcd3f04193410710981a511b9f69e5dc19 --- src/declarative/util/qdeclarativeanimation.cpp | 10 +++++--- src/declarative/util/qdeclarativetransition.cpp | 30 +++++++++++++++++++++- .../util/qdeclarativetransitionmanager.cpp | 6 ++--- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index efaa7f0..ce21bcd 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1522,6 +1522,7 @@ void QDeclarativeAnimationGroupPrivate::append_animation(QDeclarativeListPropert QDeclarativeAnimationGroup *q = qobject_cast(list->object); if (q) { a->setGroup(q); + // This is an optimization for the parenting that already occurs via addAnimation QDeclarative_setParent_noEvent(a->qtAnimation(), q->d_func()->ag); q->d_func()->ag->addAnimation(a->qtAnimation()); } @@ -1531,9 +1532,12 @@ void QDeclarativeAnimationGroupPrivate::clear_animation(QDeclarativeListProperty { QDeclarativeAnimationGroup *q = qobject_cast(list->object); if (q) { - for (int i = 0; i < q->d_func()->animations.count(); ++i) - q->d_func()->animations.at(i)->setGroup(0); - q->d_func()->animations.clear(); + while (q->d_func()->animations.count()) { + QDeclarativeAbstractAnimation *firstAnim = q->d_func()->animations.at(0); + QDeclarative_setParent_noEvent(firstAnim->qtAnimation(), 0); + q->d_func()->ag->removeAnimation(firstAnim->qtAnimation()); + firstAnim->setGroup(0); + } } } diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 273060b..b63407c 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -130,6 +130,9 @@ public: endState->complete(); } static void append_animation(QDeclarativeListProperty *list, QDeclarativeAbstractAnimation *a); + static int animation_count(QDeclarativeListProperty *list); + static QDeclarativeAbstractAnimation* animation_at(QDeclarativeListProperty *list, int pos); + static void clear_animations(QDeclarativeListProperty *list); QList animations; }; @@ -141,6 +144,28 @@ void QDeclarativeTransitionPrivate::append_animation(QDeclarativeListPropertysetDisableUserControl(); } +int QDeclarativeTransitionPrivate::animation_count(QDeclarativeListProperty *list) +{ + QDeclarativeTransition *q = static_cast(list->object); + return q->d_func()->animations.count(); +} + +QDeclarativeAbstractAnimation* QDeclarativeTransitionPrivate::animation_at(QDeclarativeListProperty *list, int pos) +{ + QDeclarativeTransition *q = static_cast(list->object); + return q->d_func()->animations.at(pos); +} + +void QDeclarativeTransitionPrivate::clear_animations(QDeclarativeListProperty *list) +{ + QDeclarativeTransition *q = static_cast(list->object); + while (q->d_func()->animations.count()) { + QDeclarativeAbstractAnimation *firstAnim = q->d_func()->animations.at(0); + q->d_func()->group.removeAnimation(firstAnim->qtAnimation()); + q->d_func()->animations.removeAll(firstAnim); + } +} + void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { QParallelAnimationGroup::updateState(newState, oldState); @@ -309,7 +334,10 @@ void QDeclarativeTransition::setToState(const QString &t) QDeclarativeListProperty QDeclarativeTransition::animations() { Q_D(QDeclarativeTransition); - return QDeclarativeListProperty(this, &d->animations, QDeclarativeTransitionPrivate::append_animation); + return QDeclarativeListProperty(this, &d->animations, QDeclarativeTransitionPrivate::append_animation, + QDeclarativeTransitionPrivate::animation_count, + QDeclarativeTransitionPrivate::animation_at, + QDeclarativeTransitionPrivate::clear_animations); } QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 944b37f..6e96ac9 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -56,12 +56,12 @@ class QDeclarativeTransitionManagerPrivate { public: QDeclarativeTransitionManagerPrivate() - : state(0), transition(0) {} + : state(0) {} void applyBindings(); typedef QList SimpleActionList; QDeclarativeState *state; - QDeclarativeTransition *transition; + QDeclarativeGuard transition; QDeclarativeStateOperation::ActionList bindingsList; SimpleActionList completeList; }; @@ -253,7 +253,7 @@ void QDeclarativeTransitionManager::cancel() { if (d->transition) { // ### this could potentially trigger a complete in rare circumstances - d->transition->stop(); + d->transition->stop(); d->transition = 0; } -- cgit v0.12 From daba0c0d588c55e3f1591ab8ce0ef0946d1447fd Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 31 May 2011 12:51:05 +0100 Subject: Revert "Fix QNetworkConfigurationManager usage outside main thread first" This reverts commit 5f241ec1426447380b1e938ac7888fb16cde94f8. Reason for reverting: Some already published applications suffer from the deadlock behaviour, causing regressions. Conflicts: tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp --- src/network/bearer/qnetworkconfigmanager_p.cpp | 15 ++------ .../tst_qnetworkconfigurationmanager.cpp | 44 ---------------------- .../tst_qnetworkproxyfactory.cpp | 31 +-------------- 3 files changed, 4 insertions(+), 86 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 2391a34..7297b0e 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -392,6 +392,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); + + QMetaObject::invokeMethod(engine, "initialize"); } } @@ -421,19 +423,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() startPolling(); } - if (firstUpdate) { + if (firstUpdate) firstUpdate = false; - QList enginesToInitialize = sessionEngines; //shallow copy the list in case it is modified when we unlock mutex - Qt::ConnectionType connectionType; - if (QCoreApplicationPrivate::mainThread() == QThread::currentThread()) - connectionType = Qt::DirectConnection; - else - connectionType = Qt::BlockingQueuedConnection; - locker.unlock(); - foreach (QBearerEngine* engine, enginesToInitialize) { - QMetaObject::invokeMethod(engine, "initialize", connectionType); - } - } } void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp index d29ef77..57bf583 100644 --- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp +++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp @@ -62,7 +62,6 @@ public slots: void cleanup(); private slots: - void usedInThread(); // this test must be first, or it will falsely pass void allConfigurations(); void defaultConfiguration(); void configurationFromIdentifier(); @@ -330,49 +329,6 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier() QVERIFY(!invalid.isValid()); } -class QNCMTestThread : public QThread -{ -protected: - virtual void run() - { - QNetworkConfigurationManager manager; - preScanConfigs = manager.allConfigurations(); - QSignalSpy spy(&manager, SIGNAL(updateCompleted())); - manager.updateConfigurations(); //initiate scans - QTRY_VERIFY(spy.count() == 1); //wait for scan to complete - configs = manager.allConfigurations(); - } -public: - QList configs; - QList preScanConfigs; -}; - -// regression test for QTBUG-18795 -void tst_QNetworkConfigurationManager::usedInThread() -{ -#if defined Q_OS_MAC && !defined (QT_NO_COREWLAN) - QSKIP("QTBUG-19070 Mac CoreWlan plugin is broken", SkipAll); -#else - QNCMTestThread thread; - connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - thread.start(); - QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread - QVERIFY(!QTestEventLoop::instance().timeout()); - qDebug() << "prescan:" << thread.preScanConfigs.count(); - qDebug() << "postscan:" << thread.configs.count(); - - QNetworkConfigurationManager manager; - QList preScanConfigs = manager.allConfigurations(); - QSignalSpy spy(&manager, SIGNAL(updateCompleted())); - manager.updateConfigurations(); //initiate scans - QTRY_VERIFY(spy.count() == 1); //wait for scan to complete - QList configs = manager.allConfigurations(); - QCOMPARE(thread.configs, configs); - //Don't compare pre scan configs, because these may be cached and therefore give different results - //which makes the test unstable. The post scan results should have all configurations every time - //QCOMPARE(thread.preScanConfigs, preScanConfigs); -#endif -} QTEST_MAIN(tst_QNetworkConfigurationManager) #include "tst_qnetworkconfigurationmanager.moc" diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index c56fedb..954b369 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -41,17 +41,14 @@ #include -#include #include #include #include -#include class tst_QNetworkProxyFactory : public QObject { Q_OBJECT private slots: - void systemProxyForQueryCalledFromThread(); void systemProxyForQuery() const; private: @@ -99,31 +96,5 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const QFAIL("One or more system proxy lookup failures occurred."); } -class QSPFQThread : public QThread -{ -protected: - virtual void run() - { - proxies = QNetworkProxyFactory::systemProxyForQuery(query); - } -public: - QNetworkProxyQuery query; - QList proxies; -}; - -//regression test for QTBUG-18799 -void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread() -{ - QUrl url(QLatin1String("http://qt.nokia.com")); - QNetworkProxyQuery query(url); - QSPFQThread thread; - thread.query = query; - connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - thread.start(); - QTestEventLoop::instance().enterLoop(5); - QVERIFY(thread.isFinished()); - QCOMPARE(thread.proxies, QNetworkProxyFactory::systemProxyForQuery(query)); -} - QTEST_MAIN(tst_QNetworkProxyFactory) #include "tst_qnetworkproxyfactory.moc" -- cgit v0.12 From 9ca1ebfbe94228c565ff6ac86eac06c6b41721a2 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 31 May 2011 15:58:19 +0300 Subject: Fix pixel metrics for Symbian VGA devices Pixel metrics for focus frame (PM_FocusFrameVMargin and PM_FocusFrameHMargin) had invalid values for VGA screens. Additionally these same pixel metrics were adjusted for nHD. Now, all but one QTreeView test cases pass for either screensize. Task-number: QT-5056 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 168041d..d3e5957 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -108,10 +108,10 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** {5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, -{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,3,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,3,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106}, -{9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} +{9,0,-909,0,0,2,0,5,-1,30,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,2,2,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** }; -- cgit v0.12 From 53f60f45e7db106b9e41184ef83716c362142112 Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Tue, 31 May 2011 16:56:50 +0300 Subject: Fixed def files for ARMV5 Reviewed-by: Trust Me --- src/s60installs/eabi/QtGuiu.def | 21 ++++++++++++++++----- src/s60installs/eabi/QtOpenGLu.def | 11 +++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 8cd3dd4..ecdec9d 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12180,7 +12180,7 @@ EXPORTS _ZNK14QVolatileImage7toImageEv @ 12179 NONAME _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME - _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME + _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME ABSENT _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME _Z18qt_addBitmapToPathffPKhiiiP12QPainterPath @ 12184 NONAME _Z22qt_fontdata_from_indexi @ 12185 NONAME @@ -12288,7 +12288,7 @@ EXPORTS _ZN11QTextEngine27positionAfterVisualMovementEiN11QTextCursor13MoveOperationE @ 12287 NONAME _ZN11QTextEngine9alignLineERK11QScriptLine @ 12288 NONAME _ZN11QTextEngine9endOfLineEi @ 12289 NONAME - _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME ABSENT _ZN11QTextObject18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12291 NONAME _ZN11QTextObject25staticMetaObjectExtraDataE @ 12292 NONAME DATA 8 _ZN11QToolButton18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12293 NONAME @@ -12352,7 +12352,7 @@ EXPORTS _ZN13QSwipeGesture18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12351 NONAME _ZN13QSwipeGesture25staticMetaObjectExtraDataE @ 12352 NONAME DATA 8 _ZN13QTextDocument18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12353 NONAME - _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME ABSENT _ZN13QTextDocument25staticMetaObjectExtraDataE @ 12355 NONAME DATA 8 _ZN13QWidgetAction18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12356 NONAME _ZN13QWidgetAction25staticMetaObjectExtraDataE @ 12357 NONAME DATA 8 @@ -12641,7 +12641,7 @@ EXPORTS _ZN9QGroupBox18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12640 NONAME _ZN9QGroupBox25staticMetaObjectExtraDataE @ 12641 NONAME DATA 8 _ZN9QLineEdit18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12642 NONAME - _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME ABSENT _ZN9QLineEdit25staticMetaObjectExtraDataE @ 12644 NONAME DATA 8 _ZN9QListView18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12645 NONAME _ZN9QListView25staticMetaObjectExtraDataE @ 12646 NONAME DATA 8 @@ -12666,7 +12666,7 @@ EXPORTS _ZNK10QBlittable12capabilitiesEv @ 12665 NONAME _ZNK10QBlittable4sizeEv @ 12666 NONAME _ZNK10QTabWidget14heightForWidthEi @ 12667 NONAME - _ZNK10QTextBlock7isValidEv @ 12668 NONAME + _ZNK10QTextBlock7isValidEv @ 12668 NONAME ABSENT _ZNK10QZipWriter10isWritableEv @ 12669 NONAME _ZNK10QZipWriter17compressionPolicyEv @ 12670 NONAME _ZNK10QZipWriter19creationPermissionsEv @ 12671 NONAME @@ -12738,4 +12738,15 @@ EXPORTS _ZTV19QIdentityProxyModel @ 12737 NONAME _ZTV20QBlittablePixmapData @ 12738 NONAME _Zls6QDebugPK13QSymbianEvent @ 12739 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12740 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12741 NONAME + _ZN15QGraphicsSystem17platformExtensionEv @ 12742 NONAME + _ZN24QSymbianGraphicsSystemEx10hasBCM2727Ev @ 12743 NONAME + _ZN24QSymbianGraphicsSystemEx13forceToRasterEP7QWidget @ 12744 NONAME + _ZN24QSymbianGraphicsSystemEx22releaseAllGpuResourcesEv @ 12745 NONAME + _ZN24QSymbianGraphicsSystemEx25releaseCachedGpuResourcesEv @ 12746 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12747 NONAME + _ZTI17QGraphicsSystemEx @ 12748 NONAME + _ZTI24QSymbianGraphicsSystemEx @ 12749 NONAME + _ZTV24QSymbianGraphicsSystemEx @ 12750 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index c252484..695829c 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -719,7 +719,7 @@ EXPORTS _ZN13QGLPixmapData14reclaimTextureEv @ 718 NONAME _ZN13QGLPixmapData21detachTextureFromPoolEv @ 719 NONAME _ZN13QGLPixmapData9hibernateEv @ 720 NONAME - _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME + _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME ABSENT _ZN13QGLPixmapData11idealFormatER6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 722 NONAME _ZN13QGLPixmapData24releaseNativeImageHandleEv @ 723 NONAME _ZN13QGLPixmapData25initFromNativeImageHandleEPvRK7QString @ 724 NONAME @@ -763,9 +763,9 @@ EXPORTS _ZTI27QGLContextGroupResourceBase @ 762 NONAME ABSENT _ZTV22QGLContextResourceBase @ 763 NONAME ABSENT _ZTV27QGLContextGroupResourceBase @ 764 NONAME ABSENT - _ZThn104_N20QGLTextureGlyphCacheD0Ev @ 765 NONAME ABSENT - _ZThn104_N20QGLTextureGlyphCacheD1Ev @ 766 NONAME ABSENT - _ZThn8_NK16QGLWindowSurface8featuresEv @ 767 NONAME ABSENT + _ZThn104_N20QGLTextureGlyphCacheD0Ev @ 765 NONAME + _ZThn104_N20QGLTextureGlyphCacheD1Ev @ 766 NONAME + _ZThn8_NK16QGLWindowSurface8featuresEv @ 767 NONAME _ZN14QGLSignalProxy18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 768 NONAME _ZN14QGLSignalProxy25staticMetaObjectExtraDataE @ 769 NONAME DATA 8 _ZN16QGLShaderProgram18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 770 NONAME @@ -780,4 +780,7 @@ EXPORTS _ZN9QGLShader25staticMetaObjectExtraDataE @ 779 NONAME DATA 8 _ZN9QGLWidget18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 780 NONAME _ZN9QGLWidget25staticMetaObjectExtraDataE @ 781 NONAME DATA 8 + _ZN17QGLGraphicsSystem17platformExtensionEv @ 782 NONAME + _ZN17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 783 NONAME + _ZThn4_N17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 784 NONAME -- cgit v0.12 From c2022fa4cda76ba839b7ffe0f325da5c87efc916 Mon Sep 17 00:00:00 2001 From: Jaakko Koskenkorva Date: Tue, 31 May 2011 17:34:39 +0300 Subject: Increase SSL readbuffer 1 -> 16 kB Reading incoming data in Symbian is slow when it is done from the native RSocket in 1kB blocks. Typically other native apps use 16 kB or even 24 kB (browser). This contributes (among other slow tasks such as writing to mass memory) to the TCP window filling up. This case, even though it should be recoverable, has proven to be problematic in some scenarios including downloading from Ovi Store via 3G. The fix just increases the amount of data read, which speeds things up and makes the problematic window fill-up less common. Reviewed-by: Shane Kearns Task-number: QTBUG-18943 --- src/network/ssl/qsslsocket_openssl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 78699fc..565ab2c 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1291,9 +1291,9 @@ bool QSslSocketBackendPrivate::startHandshake() sslErrors.clear(); } - // if we have a max read buffer size, reset the plain socket's to 1k + // if we have a max read buffer size, reset the plain socket's to 16k if (readBufferMaxSize) - plainSocket->setReadBufferSize(1024); + plainSocket->setReadBufferSize(16384); connectionEncrypted = true; emit q->encrypted(); -- cgit v0.12 From fc55c05b411bd7cbfe6f04e269e63b8b1319140a Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Mon, 30 May 2011 11:30:42 +0159 Subject: Fix build in C++0x mode This fixes compiler errors (gcc 4.6 -std=gnu++0x on x86_64 Linux): embedded/qwslock.cpp: In function `bool forceLock(int, int, int)': embedded/qwslock.cpp:121:39: error: narrowing conversion of `semNum' from `int' to `short unsigned int' inside { } [-fpermissive] (and equivalent errors in other lines/files) See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf Section 8.5.4/6 Change-Id: I2cbac5482b87f33287a416af5a5c9bde621720bc Reviewed-By: Olivier Goffart Merge-Request: 1240 Reviewed-on: http://codereview.qt.nokia.com/275 Reviewed-by: Qt Sanity Bot Reviewed-by: Olivier Goffart (cherry picked from commit 15871d606a0a85cfcd2b68b95c0891165f61e402) --- src/gui/embedded/qmousepc_qws.cpp | 2 +- src/gui/embedded/qwslock.cpp | 10 +++++----- src/gui/text/qfontdatabase.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/embedded/qmousepc_qws.cpp b/src/gui/embedded/qmousepc_qws.cpp index 5d3b182..c22cab9 100644 --- a/src/gui/embedded/qmousepc_qws.cpp +++ b/src/gui/embedded/qmousepc_qws.cpp @@ -261,7 +261,7 @@ public: usleep(50000); QT_WRITE(fd,"@EeI!",5); usleep(10000); - static const char ibuf[] = { 246, 244 }; + static const unsigned char ibuf[] = { 246, 244 }; QT_WRITE(fd,ibuf,1); QT_WRITE(fd,ibuf+1,1); if (tcflush(fd,TCIOFLUSH) == -1) { diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index 0d65b61..a64dc3d 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -114,7 +114,7 @@ QWSLock::~QWSLock() QWSSignalHandler::instance()->removeSemaphore(semId); } -static bool forceLock(int semId, int semNum, int) +static bool forceLock(int semId, unsigned short semNum, int) { int ret; do { @@ -135,7 +135,7 @@ static bool forceLock(int semId, int semNum, int) return (ret != -1); } -static bool up(int semId, int semNum) +static bool up(int semId, unsigned short semNum) { int ret; do { @@ -148,7 +148,7 @@ static bool up(int semId, int semNum) return (ret != -1); } -static bool down(int semId, int semNum) +static bool down(int semId, unsigned short semNum) { int ret; do { @@ -161,7 +161,7 @@ static bool down(int semId, int semNum) return (ret != -1); } -static int getValue(int semId, int semNum) +static int getValue(int semId, unsigned short semNum) { int ret; do { @@ -210,7 +210,7 @@ void QWSLock::unlock(LockType type) return; } - const int semNum = type; + const unsigned short semNum = type; int ret; do { sembuf sops = {semNum, 1, 0}; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7a8a912..98186df 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -879,10 +879,10 @@ QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteA TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2); if (os2) { quint32 unicodeRange[4] = { - os2->ulUnicodeRange1, os2->ulUnicodeRange2, os2->ulUnicodeRange3, os2->ulUnicodeRange4 + static_cast(os2->ulUnicodeRange1), static_cast(os2->ulUnicodeRange2), static_cast(os2->ulUnicodeRange3), static_cast(os2->ulUnicodeRange4) }; quint32 codePageRange[2] = { - os2->ulCodePageRange1, os2->ulCodePageRange2 + static_cast(os2->ulCodePageRange1), static_cast(os2->ulCodePageRange2) }; writingSystems = qt_determine_writing_systems_from_truetype_bits(unicodeRange, codePageRange); -- cgit v0.12 From fac834807c1cc4f9fdc412f50a85780e4df8562d Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Wed, 1 Jun 2011 08:28:15 +0300 Subject: Fixed def files for WINSCW Reviewed-by: Trust Me --- src/s60installs/bwins/QtGuiu.def | 31 ++++++++++++++++++++++--------- src/s60installs/bwins/QtOpenGLu.def | 4 +++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3c9c16d..7468b85 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12979,7 +12979,7 @@ EXPORTS ?byteCount@QVolatileImage@@QBEHXZ @ 12978 NONAME ; int QVolatileImage::byteCount(void) const ??0QVolatileImage@@QAE@ABV0@@Z @ 12979 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) ?depth@QVolatileImage@@QBEHXZ @ 12980 NONAME ; int QVolatileImage::depth(void) const - ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ; void QGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ABSENT ; void QGraphicsSystem::releaseCachedResources(void) ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) png_access_version_number @ 12983 NONAME png_benign_error @ 12984 NONAME @@ -13228,7 +13228,7 @@ EXPORTS ?qt_static_metacall@QToolBox@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13227 NONAME ; void QToolBox::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QSplitter@@0UQMetaObjectExtraData@@B @ 13228 NONAME ; struct QMetaObjectExtraData const QSplitter::staticMetaObjectExtraData ?qt_static_metacall@QGraphicsTextItem@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13229 NONAME ; void QGraphicsTextItem::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13230 NONAME ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13230 NONAME ABSENT ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?qt_static_metacall@QGraphicsView@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13231 NONAME ; void QGraphicsView::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QGraphicsOpacityEffect@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13232 NONAME ; void QGraphicsOpacityEffect::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QGraphicsBlurEffect@@0UQMetaObjectExtraData@@B @ 13233 NONAME ; struct QMetaObjectExtraData const QGraphicsBlurEffect::staticMetaObjectExtraData @@ -13260,7 +13260,7 @@ EXPORTS ?qt_static_metacall@QGraphicsScene@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13259 NONAME ; void QGraphicsScene::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QTextList@@0UQMetaObjectExtraData@@B @ 13260 NONAME ; struct QMetaObjectExtraData const QTextList::staticMetaObjectExtraData ?qt_fontdata_from_index@@YA?AVQByteArray@@H@Z @ 13261 NONAME ; class QByteArray qt_fontdata_from_index(int) - ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13262 NONAME ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13262 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const ?offsetInLigature@QTextEngine@@QAE?AUQFixed@@PBUQScriptItem@@HHH@Z @ 13263 NONAME ; struct QFixed QTextEngine::offsetInLigature(struct QScriptItem const *, int, int, int) ?qt_static_metacall@QGraphicsAnchor@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13264 NONAME ; void QGraphicsAnchor::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?swap@QImage@@QAEXAAV1@@Z @ 13265 NONAME ; void QImage::swap(class QImage &) @@ -13333,7 +13333,7 @@ EXPORTS ?staticMetaObjectExtraData@QProxyModel@@0UQMetaObjectExtraData@@B @ 13332 NONAME ; struct QMetaObjectExtraData const QProxyModel::staticMetaObjectExtraData ?staticMetaObjectExtraData@QInputContextPlugin@@0UQMetaObjectExtraData@@B @ 13333 NONAME ; struct QMetaObjectExtraData const QInputContextPlugin::staticMetaObjectExtraData ?metaObject@QIdentityProxyModel@@UBEPBUQMetaObject@@XZ @ 13334 NONAME ; struct QMetaObject const * QIdentityProxyModel::metaObject(void) const - ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13335 NONAME ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const + ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13335 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const ?removeColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13336 NONAME ; bool QIdentityProxyModel::removeColumns(int, int, class QModelIndex const &) ?qt_static_metacall@QDirModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13337 NONAME ; void QDirModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QMdiSubWindow@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13338 NONAME ; void QMdiSubWindow::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13571,7 +13571,7 @@ EXPORTS ?d_func@QBlitterPaintEngine@@AAEPAVQBlitterPaintEnginePrivate@@XZ @ 13570 NONAME ; class QBlitterPaintEnginePrivate * QBlitterPaintEngine::d_func(void) ?setNumberPrefix@QTextListFormat@@QAEXABVQString@@@Z @ 13571 NONAME ; void QTextListFormat::setNumberPrefix(class QString const &) ?qt_static_metacall@QAbstractSpinBox@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13572 NONAME ; void QAbstractSpinBox::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13573 NONAME ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13573 NONAME ABSENT ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?lineHeight@QTextBlockFormat@@QBEMMM@Z @ 13574 NONAME ; float QTextBlockFormat::lineHeight(float, float) const ??0QIdentityProxyModel@@IAE@AAVQIdentityProxyModelPrivate@@PAVQObject@@@Z @ 13575 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QIdentityProxyModelPrivate &, class QObject *) ?staticMetaObjectExtraData@QGraphicsEffect@@0UQMetaObjectExtraData@@B @ 13576 NONAME ; struct QMetaObjectExtraData const QGraphicsEffect::staticMetaObjectExtraData @@ -13660,7 +13660,7 @@ EXPORTS ?swap@QIcon@@QAEXAAV1@@Z @ 13659 NONAME ; void QIcon::swap(class QIcon &) ?columnCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 13660 NONAME ; int QIdentityProxyModel::columnCount(class QModelIndex const &) const ?unmarkRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 13661 NONAME ; void QBlittablePixmapData::unmarkRasterOverlay(class QRectF const &) - ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13662 NONAME ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const + ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13662 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 13663 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *, int) ?brushOriginChanged@QBlitterPaintEngine@@UAEXXZ @ 13664 NONAME ; void QBlitterPaintEngine::brushOriginChanged(void) ?openFile@QFileOpenEvent@@QBE_NAAVQFile@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z @ 13665 NONAME ; bool QFileOpenEvent::openFile(class QFile &, class QFlags) const @@ -13683,7 +13683,7 @@ EXPORTS ?unlock@QBlittable@@QAEXXZ @ 13682 NONAME ; void QBlittable::unlock(void) ?swap@QRegion@@QAEXAAV1@@Z @ 13683 NONAME ; void QRegion::swap(class QRegion &) ?staticMetaObjectExtraData@QLCDNumber@@0UQMetaObjectExtraData@@B @ 13684 NONAME ; struct QMetaObjectExtraData const QLCDNumber::staticMetaObjectExtraData - ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13685 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13685 NONAME ABSENT ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) ?staticMetaObjectExtraData@QS60Style@@0UQMetaObjectExtraData@@B @ 13686 NONAME ; struct QMetaObjectExtraData const QS60Style::staticMetaObjectExtraData ?qt_static_metacall@QWidgetAction@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13687 NONAME ; void QWidgetAction::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QListView@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13688 NONAME ; void QListView::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13724,7 +13724,7 @@ EXPORTS ?staticMetaObjectExtraData@QProgressBar@@0UQMetaObjectExtraData@@B @ 13723 NONAME ; struct QMetaObjectExtraData const QProgressBar::staticMetaObjectExtraData ?qt_static_metacall@QLineEdit@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13724 NONAME ; void QLineEdit::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?drawStaticTextItem@QBlitterPaintEngine@@UAEXPAVQStaticTextItem@@@Z @ 13725 NONAME ; void QBlitterPaintEngine::drawStaticTextItem(class QStaticTextItem *) - ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13726 NONAME ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13726 NONAME ABSENT ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) ?lock@QBlittable@@QAEPAVQImage@@XZ @ 13727 NONAME ; class QImage * QBlittable::lock(void) ?setFontHintingPreference@QTextCharFormat@@QAEXW4HintingPreference@QFont@@@Z @ 13728 NONAME ; void QTextCharFormat::setFontHintingPreference(enum QFont::HintingPreference) ?qt_static_metacall@QPixmapColorizeFilter@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13729 NONAME ; void QPixmapColorizeFilter::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13776,7 +13776,7 @@ EXPORTS ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 13775 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *) ?qt_static_metacall@QRadioButton@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13776 NONAME ; void QRadioButton::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ??1QInternalMimeData@@UAE@XZ @ 13777 NONAME ; QInternalMimeData::~QInternalMimeData(void) - ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13778 NONAME ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13778 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const ?qt_addBitmapToPath@@YAXMMPBEHHHPAVQPainterPath@@@Z @ 13779 NONAME ; void qt_addBitmapToPath(float, float, unsigned char const *, int, int, int, class QPainterPath *) ?qt_static_metacall@QTextTable@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13780 NONAME ; void QTextTable::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QItemSelectionModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13781 NONAME ; void QItemSelectionModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) @@ -13786,4 +13786,17 @@ EXPORTS ?qt_static_metacall@QGraphicsWidget@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13785 NONAME ; void QGraphicsWidget::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?qt_static_metacall@QShortcut@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13786 NONAME ; void QShortcut::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?endOfLine@QTextEngine@@AAEHH@Z @ 13787 NONAME ; int QTextEngine::endOfLine(int) + ?setCursorMoveStyle@QTextLayout@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13788 NONAME ; void QTextLayout::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13789 NONAME ; enum Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13790 NONAME ; enum Qt::CursorMoveStyle QTextLayout::cursorMoveStyle(void) const + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13791 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum Qt::CursorMoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13792 NONAME ; void QLineControl::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?cursorMoveStyle@QLineEdit@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13793 NONAME ; enum Qt::CursorMoveStyle QLineEdit::cursorMoveStyle(void) const + ?forceToRaster@QSymbianGraphicsSystemEx@@UAEXPAVQWidget@@@Z @ 13794 NONAME ; void QSymbianGraphicsSystemEx::forceToRaster(class QWidget *) + ?releaseCachedGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13795 NONAME ; void QSymbianGraphicsSystemEx::releaseCachedGpuResources(void) + ?setCursorMoveStyle@QLineEdit@@QAEXW4CursorMoveStyle@Qt@@@Z @ 13796 NONAME ; void QLineEdit::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?platformExtension@QGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 13797 NONAME ; class QGraphicsSystemEx * QGraphicsSystem::platformExtension(void) + ?releaseAllGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 13798 NONAME ; void QSymbianGraphicsSystemEx::releaseAllGpuResources(void) + ?cursorMoveStyle@QLineControl@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 13799 NONAME ; enum Qt::CursorMoveStyle QLineControl::cursorMoveStyle(void) const + ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 13800 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index b4dcf4f..745bc9b 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -715,7 +715,7 @@ EXPORTS ?detachTextureFromPool@QGLPixmapData@@QAEXXZ @ 714 NONAME ; void QGLPixmapData::detachTextureFromPool(void) ?reclaimTexture@QGLPixmapData@@QAEXXZ @ 715 NONAME ; void QGLPixmapData::reclaimTexture(void) ?destroyTexture@QGLPixmapData@@QAEXXZ @ 716 NONAME ; void QGLPixmapData::destroyTexture(void) - ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ; void QGLGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ABSENT ; void QGLGraphicsSystem::releaseCachedResources(void) ?serialNumber@QGLTextureGlyphCache@@QBEHXZ @ 718 NONAME ; int QGLTextureGlyphCache::serialNumber(void) const ?forceToImage@QGLPixmapData@@QAEXXZ @ 719 NONAME ; void QGLPixmapData::forceToImage(void) ?idealFormat@QGLPixmapData@@QAE?AW4Format@QImage@@AAV3@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 720 NONAME ; enum QImage::Format QGLPixmapData::idealFormat(class QImage &, class QFlags) @@ -874,4 +874,6 @@ EXPORTS ?staticMetaObjectExtraData@QGraphicsShaderEffect@@0UQMetaObjectExtraData@@B @ 873 NONAME ; struct QMetaObjectExtraData const QGraphicsShaderEffect::staticMetaObjectExtraData ?staticMetaObjectExtraData@QGLEngineShaderManager@@0UQMetaObjectExtraData@@B @ 874 NONAME ; struct QMetaObjectExtraData const QGLEngineShaderManager::staticMetaObjectExtraData ?qt_static_metacall@QGLShaderProgram@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 875 NONAME ; void QGLShaderProgram::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?platformExtension@QGLGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 876 NONAME ; class QGraphicsSystemEx * QGLGraphicsSystem::platformExtension(void) + ?releaseCachedGpuResources@QGLGraphicsSystem@@UAEXXZ @ 877 NONAME ; void QGLGraphicsSystem::releaseCachedGpuResources(void) -- cgit v0.12 From 8c3a4568dcbb75c36ea3c22ced4d10d4b3522d9f Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Wed, 1 Jun 2011 10:53:29 +0300 Subject: Fix the build break for QUrl autotest on Symbian This commit fixes the linking problem for QUrl autotest on Symbian Reviewed by: Guoqing Zhang --- tests/auto/qurl/tst_qurl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 613053b..c23c633 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -3167,8 +3167,8 @@ void tst_QUrl::nameprep_testsuite_data() #ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE -extern void qt_nameprep(QString *source, int from); -extern bool qt_check_std3rules(const QChar *, int); +Q_CORE_EXPORT extern void qt_nameprep(QString *source, int from); +Q_CORE_EXPORT extern bool qt_check_std3rules(const QChar *, int); QT_END_NAMESPACE #endif -- cgit v0.12 From b771435fb98e575c0b990c044efd57120c533f7e Mon Sep 17 00:00:00 2001 From: Jyri Tahtela Date: Wed, 1 Jun 2011 11:27:31 +0300 Subject: Re-apply licenseheader text in source files for qt4.8 New files after previous license change round. Reviewed-by: Trust Me --- src/corelib/io/qtldurl.cpp | 34 +++++++++++++++++----------------- src/corelib/io/qtldurl_p.h | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp index 7db4bbd..7d06ca4 100644 --- a/src/corelib/io/qtldurl.cpp +++ b/src/corelib/io/qtldurl.cpp @@ -7,29 +7,29 @@ ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** ** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** ** ** diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h index 152ffa0..77c0a15 100644 --- a/src/corelib/io/qtldurl_p.h +++ b/src/corelib/io/qtldurl_p.h @@ -7,29 +7,29 @@ ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** ** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** ** ** -- cgit v0.12 From 4fd3f754104f56c625f7cbcca13fa12b4f633957 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 1 Jun 2011 17:13:51 +1000 Subject: Fixed compile of tst_qscriptextensionplugin on some Windows configurations The debug and release versions of staticplugin are qmake'd with the same destination directory. This causes the generated staticplugin .prl file to always refer to the debug versions of Qt libraries, even if Qt was configured with -release. The .prl mechanism is not useful for this test, so simply disable it to solve the problem. Reviewed-by: ckamm --- tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro index a003338..65c4e8f 100644 --- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro +++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += static plugin +CONFIG -= create_prl # not needed, and complicates debug/release SOURCES = staticplugin.cpp RESOURCES = staticplugin.qrc QT = core script -- cgit v0.12 From 0b92d6cc61a18ae18d254ac6ee463e74cb570db4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 12:34:59 +0200 Subject: use a printErr() function instead of std::cerr like in lupdate --- tools/linguist/lrelease/main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index b1beec8..8d2cf4a 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -55,8 +55,6 @@ #include #include -#include - QT_USE_NAMESPACE #ifdef QT_BOOTSTRAPPED @@ -84,6 +82,12 @@ static void printOut(const QString & out) stream << out; } +static void printErr(const QString & out) +{ + QTextStream stream(stderr); + stream << out; +} + static void printUsage() { printOut(LR::tr( @@ -119,7 +123,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo ConversionData cd; bool ok = tor.load(tsFileName, cd, QLatin1String("auto")); if (!ok) { - std::cerr << qPrintable(LR::tr("lrelease error: %1").arg(cd.error())); + printErr(LR::tr("lrelease error: %1").arg(cd.error())); } else { if (!cd.errors().isEmpty()) printOut(cd.error()); @@ -143,7 +147,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, QFile file(qmFileName); if (!file.open(QIODevice::WriteOnly)) { - std::cerr << qPrintable(LR::tr("lrelease error: cannot create '%1': %2\n") + printErr(LR::tr("lrelease error: cannot create '%1': %2\n") .arg(qmFileName, file.errorString())); return false; } @@ -153,7 +157,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, file.close(); if (!ok) { - std::cerr << qPrintable(LR::tr("lrelease error: cannot save '%1': %2") + printErr(LR::tr("lrelease error: cannot save '%1': %2") .arg(qmFileName, cd.error())); } else if (!cd.errors().isEmpty()) { printOut(cd.error()); @@ -274,13 +278,13 @@ int main(int argc, char **argv) visitor.setVerbose(cd.isVerbose()); if (!visitor.queryProFile(&pro)) { - std::cerr << qPrintable(LR::tr( + printErr(LR::tr( "lrelease error: cannot read project file '%1'.\n") .arg(inputFile)); continue; } if (!visitor.accept(&pro)) { - std::cerr << qPrintable(LR::tr( + printErr(LR::tr( "lrelease error: cannot process project file '%1'.\n") .arg(inputFile)); continue; @@ -288,7 +292,7 @@ int main(int argc, char **argv) QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); if (translations.isEmpty()) { - std::cerr << qPrintable(LR::tr( + printErr(LR::tr( "lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n") .arg(inputFile)); } else { -- cgit v0.12 From e31bcd340a24a8698ee4dc85dd2ccb2bd6ab10e7 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 26 May 2011 14:11:18 +0100 Subject: Schedule Symbian active objects with a round robin scheduler Each call to QEventDispatcherSymbian::processEvents allows pre-existing active objects with priority >= CActive::EPriorityStandard to run once. Active objects with lower priorities can only run if no higher priority active object has run. Task-number: QTBUG-15019 Reviewed-by: Tom Sutcliffe Reviewed-by: axis --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 205 +++++++++++++++++++----- src/gui/kernel/qeventdispatcher_s60.cpp | 34 +--- 2 files changed, 171 insertions(+), 68 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 1d7ecce..8ce806b 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE #define WAKE_UP_PRIORITY CActive::EPriorityStandard #define TIMER_PRIORITY CActive::EPriorityHigh -#define NULLTIMER_PRIORITY CActive::EPriorityLow #define COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY CActive::EPriorityIdle static inline int qt_pipe_write(int socket, const char *data, qint64 len) @@ -124,16 +123,8 @@ private: }; /* - * This class is designed to aid in implementing event handling in a more round robin fashion. We - * cannot change active objects that we do not own, but the active objects that Qt owns will use - * this as a base class with convenience functions. - * - * Here is how it works: On every RunL, the deriving class should call maybeQueueForLater(). - * This will return whether the active object has been queued, or whether it should run immediately. - * Queued objects will run again after other events have been processed. - * - * The QCompleteDeferredAOs class is a special object that runs after all others, which will - * reactivate the objects that were previously not run. + * This class can be used as a base class for Qt active objects, but currently does not offer + * any special functionality. */ QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher) : CActive(priority), @@ -146,25 +137,11 @@ QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher) QActiveObject::~QActiveObject() { - if (m_hasRunAgain) - m_dispatcher->removeDeferredActiveObject(this); } bool QActiveObject::maybeQueueForLater() { - Q_ASSERT(!m_hasRunAgain); - - if (!m_hasAlreadyRun || m_dispatcher->iterationCount() != m_iterationCount) { - // First occurrence of this event in this iteration. - m_hasAlreadyRun = true; - m_iterationCount = m_dispatcher->iterationCount(); - return false; - } else { - // The event has already occurred. - m_dispatcher->addDeferredActiveObject(this); - m_hasRunAgain = true; - return true; - } + return false; } bool QActiveObject::maybeDeferSocketEvent() @@ -233,7 +210,7 @@ void QWakeUpActiveObject::RunL() } QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo) - : QActiveObject((timerInfo->interval) ? TIMER_PRIORITY : NULLTIMER_PRIORITY , dispatcher), + : QActiveObject(TIMER_PRIORITY, dispatcher), m_timerInfo(timerInfo), m_expectedTimeSinceLastEvent(0) { // start the timeout timer to ensure initialisation @@ -708,6 +685,138 @@ void QSocketActiveObject::deleteLater() } } +/* Round robin active object scheduling for Qt apps. + * + * Qt and Symbian have different views on how events should be handled. Qt expects + * round-robin event processing, whereas Symbian implements a strict priority based + * system. + * + * This scheduler class, and its use in QEventDispatcherSymbian::processEvents, + * introduces round robin scheduling for high priority active objects, but leaves + * those with low priorities scheduled in priority order. + * The algorithm used is that, during each call to processEvents, any pre-existing + * runnable active object may run, but only once. Active objects with priority + * lower than EPriorityStandard can only run if no higher priority active object + * has run. + * This is done by implementing an alternative scheduling algorithm which requires + * access to the internal members of the active object system. The iSpare member of + * CActive is replaced with a flag indicating that the object is new (CBase zero + * initialization sets this), or not run, or ran. Only active objects with the + * not run flag are allowed to run. + */ +class QtRRActiveScheduler +{ +public: + static void MarkReadyToRun(); + enum RunResult { + NothingFound, + ObjectRun, + ObjectDelayed + }; + static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority); + static bool UseRRActiveScheduler(); + +private: + // active scheduler access kit, for gaining access to the internals of active objects for + // alternative active scheduler implementations. + class TRequestStatusAccess + { + public: + enum { ERequestActiveFlags = 3 }; // TRequestStatus::EActive | TRequestStatus::ERequestPending + TInt iStatus; + TUint iFlags; + }; + + class CActiveDataAccess : public CBase + { + public: + TRequestStatusAccess iStatus; + TPriQueLink iLink; + enum TMarks + { + ENewObject, // CBase zero initialization sets this, new objects cannot be run in the processEvents in which they are created + ENotRun, // This object has not yet run in the current processEvents call + ERan // This object has run in the current processEvents call + }; + int iMark; //TAny* iSpare; + }; + + class CActiveFuncAccess : public CActive + { + public: + // these functions are needed in RunMarkedIfReady + using CActive::RunL; + using CActive::RunError; + }; + + class CActiveSchedulerAccess : public CBase + { + public: + using CBase::Extension_; + struct TLoop; + TLoop* iStack; + TPriQue iActiveQ; + TAny* iSpare; + }; +}; + +void QtRRActiveScheduler::MarkReadyToRun() +{ + CActiveScheduler *pS=CActiveScheduler::Current(); + if (pS!=NULL) + { + TDblQueIter iterator(((CActiveSchedulerAccess*)pS)->iActiveQ); + for (CActive* active=iterator++; active!=NULL; active=iterator++) { + ((CActiveDataAccess*)active)->iMark = CActiveDataAccess::ENotRun; + } + } +} + +QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority) +{ + RunResult result = NothingFound; + TInt error=KErrNone; + CActiveScheduler *pS=CActiveScheduler::Current(); + if (pS!=NULL) { + TDblQueIter iterator(((CActiveSchedulerAccess*)pS)->iActiveQ); + for (CActiveFuncAccess *active=iterator++; active!=NULL; active=iterator++) { + CActiveDataAccess *dataAccess = (CActiveDataAccess*)active; + if (active->IsActive() && (active->iStatus!=KRequestPending)) { + int& mark = dataAccess->iMark; + if (mark == CActiveDataAccess::ENotRun && active->Priority()>=minimumPriority) { + mark = CActiveDataAccess::ERan; + runPriority = active->Priority(); + dataAccess->iStatus.iFlags&=~TRequestStatusAccess::ERequestActiveFlags; + int vptr = *(int*)active; // vptr can be used to identify type when debugging leaves + TRAP(error, active->RunL()); + if (error!=KErrNone) + error=active->RunError(error); + if (error) { + qWarning("Active object (ptr=0x%08x, vptr=0x%08x) leave: %i\n", active, vptr, error); + pS->Error(error); + } + return ObjectRun; + } + result = ObjectDelayed; + } + } + } + return result; +} + +bool QtRRActiveScheduler::UseRRActiveScheduler() +{ + // This code allows euser to declare incompatible active object / scheduler internal data structures + // in the future, disabling Qt's round robin scheduler use. + // By default the Extension_ function will set the second argument to NULL. We therefore use NULL to indicate + // that the data structures are compatible with before when this protocol was recognised. + // The extension id used is QtCore's UID. + CActiveSchedulerAccess *access = (CActiveSchedulerAccess *)CActiveScheduler::Current(); + TAny* schedulerCompatibilityNumber; + access->Extension_(0x2001B2DC, schedulerCompatibilityNumber, NULL); + return schedulerCompatibilityNumber == NULL; +} + #ifdef QT_SYMBIAN_PRIORITY_DROP class QIdleDetectorThread { @@ -864,6 +973,7 @@ void QEventDispatcherSymbian::closingDown() bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags flags ) { + const bool useRRScheduler = QtRRActiveScheduler::UseRRActiveScheduler(); bool handledAnyEvent = false; bool oldNoSocketEventsValue = m_noSocketEvents; bool oldInsideTimerEventValue = m_insideTimerEvent; @@ -894,8 +1004,9 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla handledAnyEvent = sendDeferredSocketEvents(); } - bool handledSymbianEvent = false; + QtRRActiveScheduler::RunResult handledSymbianEvent = QtRRActiveScheduler::NothingFound; m_interrupt = false; + int minPriority = KMinTInt; #ifdef QT_SYMBIAN_PRIORITY_DROP QElapsedTimer eventTimer; @@ -921,6 +1032,10 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla CActiveScheduler::Current()->WaitForAnyRequest(); } + if (useRRScheduler && handledSymbianEvent == QtRRActiveScheduler::NothingFound) { + QtRRActiveScheduler::MarkReadyToRun(); + } + #ifdef QT_SYMBIAN_PRIORITY_DROP if (idleDetectorThread()->hasRun()) { if (m_delay > baseDelay) @@ -936,11 +1051,31 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla eventTimer.start(); #endif - TInt error; - handledSymbianEvent = CActiveScheduler::RunIfReady(error, KMinTInt); - if (error) { - qWarning("CActiveScheduler::RunIfReady() returned error: %i\n", error); - CActiveScheduler::Current()->Error(error); + if (useRRScheduler) { + // Standard or above priority AOs are scheduled round robin. + // Lower priority AOs can only run if nothing higher priority has run. + int runPriority = minPriority; + handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority); + minPriority = qMin(runPriority, int(CActive::EPriorityStandard)); + } else { + TInt error; + handledSymbianEvent = + CActiveScheduler::RunIfReady(error, minPriority) + ? QtRRActiveScheduler::ObjectRun + : QtRRActiveScheduler::NothingFound; + if (error) { + qWarning("CActiveScheduler::RunIfReady() returned error: %i\n", error); + CActiveScheduler::Current()->Error(error); + } + } + + if (handledSymbianEvent == QtRRActiveScheduler::NothingFound) { + // no runnable or delayed active object was found, the signal that caused us to get here must be bad + qFatal("QEventDispatcherSymbian::processEvents(): Caught Symbian stray signal"); + } else if (handledSymbianEvent == QtRRActiveScheduler::ObjectDelayed) { + // signal the thread to compensate for the un-handled signal absorbed + RThread().RequestSignal(); + break; } #ifdef QT_SYMBIAN_PRIORITY_DROP @@ -949,10 +1084,8 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla m_avgEventTime = (m_avgEventTime * 95 + eventDur * 5) / 100; #endif - if (!handledSymbianEvent) { - qFatal("QEventDispatcherSymbian::processEvents(): Caught Symbian stray signal"); - } handledAnyEvent = true; + if (m_interrupt) { break; } diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp index 3f20c08..fd2280e 100644 --- a/src/gui/kernel/qeventdispatcher_s60.cpp +++ b/src/gui/kernel/qeventdispatcher_s60.cpp @@ -58,47 +58,17 @@ QtEikonEnv::~QtEikonEnv() void QtEikonEnv::RunL() { - QEventDispatcherS60 *dispatcher = qobject_cast(QAbstractEventDispatcher::instance()); - if (!dispatcher) { - CEikonEnv::RunL(); - return; - } - - if (m_lastIterationCount != dispatcher->iterationCount()) { - m_hasAlreadyRun = false; - m_lastIterationCount = dispatcher->iterationCount(); - } - - if (m_hasAlreadyRun) { - // Fool the active scheduler into believing we are still waiting for events. - // The window server thinks we are not, however. - m_savedStatusCode = iStatus.Int(); - iStatus = KRequestPending; - SetActive(); - dispatcher->queueDeferredActiveObjectsCompletion(); - } else { - m_hasAlreadyRun = true; - CEikonEnv::RunL(); - } + CEikonEnv::RunL(); + return; } void QtEikonEnv::DoCancel() { - complete(); - CEikonEnv::DoCancel(); } void QtEikonEnv::complete() { - if (m_hasAlreadyRun) { - if (m_savedStatusCode != KRequestPending) { - TRequestStatus *status = &iStatus; - QEventDispatcherSymbian::RequestComplete(status, m_savedStatusCode); - m_savedStatusCode = KRequestPending; - } - m_hasAlreadyRun = false; - } } QEventDispatcherS60::QEventDispatcherS60(QObject *parent) -- cgit v0.12 From cf573d54c588e1ee10a7d8979faef2e0ab8bb17e Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 1 Jun 2011 11:36:45 +0100 Subject: tst_qeventloop runs the event loop to ensure socket messages arrive Auto test tst_qeventloop assumed that socket messages would be received within a single call to processEvents(). But this is not necessarily the case, and in particular with the combination of Symbian round robin active scheduler and new socket engine. So tst_qeventloop now uses an event loop to complete the test rather than just a single call to processEvents(). Task-number: QTBUG-15019 Reviewed-by: brad --- tests/auto/qeventloop/tst_qeventloop.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index b31f8cd..9196a47 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/qeventloop/tst_qeventloop.cpp @@ -602,10 +602,12 @@ public slots: QTcpSocket *serverSocket = server->nextPendingConnection(); serverSocket->write(data, size); serverSocket->flush(); - QTest::qSleep(200); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read - QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers); + QEventLoop loop; + QTimer::singleShot(200, &loop, SLOT(quit())); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read + loop.exec(QEventLoop::ExcludeSocketNotifiers); testResult = dataArrived; - QCoreApplication::processEvents(); //check the deferred event is processed + QTimer::singleShot(200, &loop, SLOT(quit())); + loop.exec(); //check the deferred event is processed serverSocket->close(); QThread::currentThread()->exit(0); } -- cgit v0.12 From 8b55d8421f786d3f631ccca16ac0e229e23bbc9c Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 1 Jun 2011 12:14:30 +0100 Subject: Removing unused code after introduction of round robin scheduler Existing code that was used to defer active objects and otherwise alter their execution time is unnecessary and unused after the round robin scheduler introduction. So it is being removed here. Task-number: QTBUG-15019 Reviewed-by: Shane Kearns --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 194 +----------------------- src/corelib/kernel/qeventdispatcher_symbian_p.h | 40 +---- src/gui/kernel/qapplication_s60.cpp | 2 +- src/gui/kernel/qeventdispatcher_s60.cpp | 36 ----- src/gui/kernel/qeventdispatcher_s60_p.h | 27 ---- src/s60installs/bwins/QtCoreu.def | 14 +- src/s60installs/bwins/QtGuiu.def | 2 +- src/s60installs/eabi/QtCoreu.def | 10 +- src/s60installs/eabi/QtGuiu.def | 2 +- 9 files changed, 26 insertions(+), 301 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 8ce806b..b216075 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE #define WAKE_UP_PRIORITY CActive::EPriorityStandard #define TIMER_PRIORITY CActive::EPriorityHigh -#define COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY CActive::EPriorityIdle static inline int qt_pipe_write(int socket, const char *data, qint64 len) { @@ -123,15 +122,12 @@ private: }; /* - * This class can be used as a base class for Qt active objects, but currently does not offer - * any special functionality. + * This class can be used as a base class for Qt active objects. + * Socket active objects can use it to defer their activity. */ QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher) : CActive(priority), - m_dispatcher(dispatcher), - m_hasAlreadyRun(false), - m_hasRunAgain(false), - m_iterationCount(1) + m_dispatcher(dispatcher) { } @@ -139,19 +135,12 @@ QActiveObject::~QActiveObject() { } -bool QActiveObject::maybeQueueForLater() -{ - return false; -} - bool QActiveObject::maybeDeferSocketEvent() { - Q_ASSERT(!m_hasRunAgain); Q_ASSERT(m_dispatcher); if (!m_dispatcher->areSocketEventsBlocked()) { return false; } - m_hasRunAgain = true; m_dispatcher->addDeferredSocketActiveObject(this); return true; } @@ -163,13 +152,11 @@ void QActiveObject::reactivateAndComplete() SetActive(); TRequestStatus *status = &iStatus; QEventDispatcherSymbian::RequestComplete(status, error); - - m_hasRunAgain = false; - m_hasAlreadyRun = false; } QWakeUpActiveObject::QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher) - : QActiveObject(WAKE_UP_PRIORITY, dispatcher) + : CActive(WAKE_UP_PRIORITY), + m_dispatcher(dispatcher) { m_hostThreadId = RThread().Id(); CActiveScheduler::Add(this); @@ -201,17 +188,14 @@ void QWakeUpActiveObject::DoCancel() void QWakeUpActiveObject::RunL() { - if (maybeQueueForLater()) - return; - iStatus = KRequestPending; SetActive(); QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled()); } QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo) - : QActiveObject(TIMER_PRIORITY, dispatcher), - m_timerInfo(timerInfo), m_expectedTimeSinceLastEvent(0) + : CActive(TIMER_PRIORITY), + m_dispatcher(dispatcher), m_timerInfo(timerInfo), m_expectedTimeSinceLastEvent(0) { // start the timeout timer to ensure initialisation m_timeoutTimer.start(); @@ -288,9 +272,6 @@ void QTimerActiveObject::Run() return; } - if (maybeQueueForLater()) - return; - if (m_timerInfo->interval > 0) { // Start a new timer immediately so that we don't lose time. m_timerInfo->msLeft = m_timerInfo->interval; @@ -342,44 +323,6 @@ SymbianTimerInfo::~SymbianTimerInfo() delete timerAO; } -QCompleteDeferredAOs::QCompleteDeferredAOs(QEventDispatcherSymbian *dispatcher) - : CActive(COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY), - m_dispatcher(dispatcher) -{ - CActiveScheduler::Add(this); - iStatus = KRequestPending; - SetActive(); -} - -QCompleteDeferredAOs::~QCompleteDeferredAOs() -{ - Cancel(); -} - -void QCompleteDeferredAOs::complete() -{ - if (iStatus.Int() == KRequestPending) { - TRequestStatus *status = &iStatus; - QEventDispatcherSymbian::RequestComplete(status, KErrNone); - } -} - -void QCompleteDeferredAOs::DoCancel() -{ - if (iStatus.Int() == KRequestPending) { - TRequestStatus *status = &iStatus; - QEventDispatcherSymbian::RequestComplete(status, KErrNone); - } -} - -void QCompleteDeferredAOs::RunL() -{ - iStatus = KRequestPending; - SetActive(); - - QT_TRYCATCH_LEAVING(m_dispatcher->reactivateDeferredActiveObjects()); -} - QSelectThread::QSelectThread() : m_quit(false) { @@ -654,8 +597,6 @@ void QSocketActiveObject::RunL() { if (maybeDeferSocketEvent()) return; - if (maybeQueueForLater()) - return; QT_TRYCATCH_LEAVING(run()); } @@ -920,7 +861,6 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_selectThread(0), m_activeScheduler(0), m_wakeUpAO(0), - m_completeDeferredAOs(0), m_interrupt(false), m_wakeUpDone(0), m_iterationCount(0), @@ -945,7 +885,6 @@ void QEventDispatcherSymbian::startingUp() CActiveScheduler::Install(m_activeScheduler); } m_wakeUpAO = q_check_ptr(new QWakeUpActiveObject(this)); - m_completeDeferredAOs = q_check_ptr(new QCompleteDeferredAOs(this)); // We already might have posted events, wakeup once to process them wakeUp(); } @@ -964,7 +903,6 @@ void QEventDispatcherSymbian::closingDown() delete m_selectThread; m_selectThread = 0; - delete m_completeDeferredAOs; delete m_wakeUpAO; if (m_activeScheduler) { delete m_activeScheduler; @@ -1184,41 +1122,11 @@ bool QEventDispatcherSymbian::sendPostedEvents() //return false; } -inline void QEventDispatcherSymbian::addDeferredActiveObject(QActiveObject *object) -{ - queueDeferredActiveObjectsCompletion(); - m_deferredActiveObjects.append(object); -} - -inline void QEventDispatcherSymbian::removeDeferredActiveObject(QActiveObject *object) -{ - m_deferredActiveObjects.removeAll(object); - m_deferredSocketEvents.removeAll(object); -} - inline void QEventDispatcherSymbian::addDeferredSocketActiveObject(QActiveObject *object) { m_deferredSocketEvents.append(object); } -void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion() -{ - m_completeDeferredAOs->complete(); -} - -void QEventDispatcherSymbian::reactivateDeferredActiveObjects() -{ - while (!m_deferredActiveObjects.isEmpty()) { - QActiveObject *object = m_deferredActiveObjects.takeFirst(); - object->reactivateAndComplete(); - } - - // We do this because we want to return from processEvents. This is because - // each invocation of processEvents should only run each active object once. - // The active scheduler should run them continously, however. - m_interrupt = true; -} - bool QEventDispatcherSymbian::sendDeferredSocketEvents() { bool sentAnyEvents = false; @@ -1294,14 +1202,6 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject m_timerList.insert(timerId, timer); timer->timerAO->Start(); - - if (m_insideTimerEvent) - // If we are inside a timer event, we need to prevent event starvation - // by preventing newly created timers from running in the same event processing - // iteration. Do this by calling the maybeQueueForLater() function to "fake" that we have - // already run once. This will cause the next run to be added to the deferred - // queue instead. - timer->timerAO->maybeQueueForLater(); } bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) @@ -1364,86 +1264,6 @@ void CQtActiveScheduler::Error(TInt aError) const QT_CATCH (const std::bad_alloc&) {} // ignore alloc fails, nothing more can be done } -bool QActiveObject::wait(CActive* ao, int ms) -{ - if (!ao->IsActive()) - return true; //request already complete - bool timedout = false; - if (ms > 0) { - TRequestStatus tstat; - RTimer t; - if (KErrNone != t.CreateLocal()) - return false; - t.HighRes(tstat, ms*1000); - User::WaitForRequest(tstat, ao->iStatus); - if (tstat != KRequestPending) { - timedout = true; - } else { - t.Cancel(); - //balance thread semaphore - User::WaitForRequest(tstat); - } - t.Close(); - } else { - User::WaitForRequest(ao->iStatus); - } - if (timedout) - return false; - - //evil cast to allow calling of protected virtual - ((QActiveObject*)ao)->RunL(); - - //clear active & pending flags - ao->iStatus = TRequestStatus(); - - return true; -} - -bool QActiveObject::wait(QList aos, int ms) -{ - QVector stati; - stati.reserve(aos.count() + 1); - foreach (CActive* ao, aos) { - if (!ao->IsActive()) - return true; //request already complete - stati.append(&(ao->iStatus)); - } - bool timedout = false; - TRequestStatus tstat; - RTimer t; - if (ms > 0) { - if (KErrNone != t.CreateLocal()) - return false; - t.HighRes(tstat, ms*1000); - stati.append(&tstat); - } - User::WaitForNRequest(stati.data(), stati.count()); - if (ms > 0) { - if (tstat != KRequestPending) { - timedout = true; - } else { - t.Cancel(); - //balance thread semaphore - User::WaitForRequest(tstat); - } - t.Close(); - } - if (timedout) - return false; - - foreach (CActive* ao, aos) { - if (ao->iStatus != KRequestPending) { - //evil cast to allow calling of protected virtual - ((QActiveObject*)ao)->RunL(); - - //clear active & pending flags - ao->iStatus = TRequestStatus(); - break; //only call one - } - } - return true; -} - QT_END_NAMESPACE #include "moc_qeventdispatcher_symbian_p.cpp" diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index e327a9c..1b81599 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -83,23 +83,14 @@ public: QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher); ~QActiveObject(); - bool maybeQueueForLater(); bool maybeDeferSocketEvent(); void reactivateAndComplete(); - - static bool wait(CActive* ao, int ms); - static bool wait(QList aos, int ms); protected: QEventDispatcherSymbian *m_dispatcher; - -private: - bool m_hasAlreadyRun : 1; - bool m_hasRunAgain : 1; - int m_iterationCount; }; -class QWakeUpActiveObject : public QActiveObject +class QWakeUpActiveObject : public CActive { public: QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher); @@ -112,6 +103,7 @@ protected: void RunL(); private: + QEventDispatcherSymbian *m_dispatcher; TThreadId m_hostThreadId; }; @@ -132,7 +124,7 @@ struct SymbianTimerInfo : public QSharedData typedef QExplicitlySharedDataPointer SymbianTimerInfoPtr; // This is a bit of a proxy class. See comments in SetActive and Start for details. -class QTimerActiveObject : public QActiveObject +class QTimerActiveObject : public CActive { public: QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo); @@ -149,28 +141,13 @@ private: void StartTimer(); private: + QEventDispatcherSymbian *m_dispatcher; SymbianTimerInfo *m_timerInfo; QElapsedTimer m_timeoutTimer; int m_expectedTimeSinceLastEvent; RTimer m_rTimer; }; -class QCompleteDeferredAOs : public CActive -{ -public: - QCompleteDeferredAOs(QEventDispatcherSymbian *dispatcher); - ~QCompleteDeferredAOs(); - - void complete(); - -protected: - void DoCancel(); - void RunL(); - -private: - QEventDispatcherSymbian *m_dispatcher; -}; - class QSocketActiveObject : public QActiveObject { public: @@ -254,12 +231,6 @@ public: void wakeUpWasCalled(); void reactivateSocketNotifier(QSocketNotifier *notifier); - void addDeferredActiveObject(QActiveObject *object); - void removeDeferredActiveObject(QActiveObject *object); - void queueDeferredActiveObjectsCompletion(); - // Can be overridden to activate local active objects too, but do call baseclass! - virtual void reactivateDeferredActiveObjects(); - inline int iterationCount() const { return m_iterationCount; } void addDeferredSocketActiveObject(QActiveObject *object); @@ -282,7 +253,6 @@ private: QHash m_notifiers; QWakeUpActiveObject *m_wakeUpAO; - QCompleteDeferredAOs *m_completeDeferredAOs; volatile bool m_interrupt; QAtomicInt m_wakeUpDone; @@ -292,8 +262,6 @@ private: bool m_noSocketEvents; //deferred until socket events are enabled QList m_deferredSocketEvents; - //deferred until idle - QList m_deferredActiveObjects; int m_delay; int m_avgEventTime; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e9d58c7..899147f 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1694,7 +1694,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) if (commandLine) { // After this construction, CEikonEnv will be available from CEikonEnv::Static(). // (much like our qApp). - QtEikonEnv* coe = new QtEikonEnv; + CEikonEnv* coe = new CEikonEnv; //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there. TRAPD(err, coe->ConstructAppFromCommandLineL(factory, *commandLine)); if(err != KErrNone) { diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp index fd2280e..d5a2761 100644 --- a/src/gui/kernel/qeventdispatcher_s60.cpp +++ b/src/gui/kernel/qeventdispatcher_s60.cpp @@ -45,32 +45,6 @@ QT_BEGIN_NAMESPACE -QtEikonEnv::QtEikonEnv() - : m_lastIterationCount(0) - , m_savedStatusCode(KRequestPending) - , m_hasAlreadyRun(false) -{ -} - -QtEikonEnv::~QtEikonEnv() -{ -} - -void QtEikonEnv::RunL() -{ - CEikonEnv::RunL(); - return; -} - -void QtEikonEnv::DoCancel() -{ - CEikonEnv::DoCancel(); -} - -void QtEikonEnv::complete() -{ -} - QEventDispatcherS60::QEventDispatcherS60(QObject *parent) : QEventDispatcherSymbian(parent), m_noInputEvents(false) @@ -153,14 +127,4 @@ void QEventDispatcherS60::removeInputEventsForWidget(QObject *object) } } -// reimpl -void QEventDispatcherS60::reactivateDeferredActiveObjects() -{ - if (S60->qtOwnsS60Environment) { - static_cast(CCoeEnv::Static())->complete(); - } - - QEventDispatcherSymbian::reactivateDeferredActiveObjects(); -} - QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/gui/kernel/qeventdispatcher_s60_p.h index 49ec568..c7cf2b2 100644 --- a/src/gui/kernel/qeventdispatcher_s60_p.h +++ b/src/gui/kernel/qeventdispatcher_s60_p.h @@ -62,31 +62,6 @@ QT_BEGIN_NAMESPACE class QEventDispatcherS60; -class QtEikonEnv : public CEikonEnv -{ -public: - QtEikonEnv(); - ~QtEikonEnv(); - - // from CActive. - void RunL(); - void DoCancel(); - - void complete(); - -private: - // Workaround for a BC break from S60 3.2 -> 5.0, where the CEikonEnv override was removed. - // To avoid linking to that when we build against 3.2, define an empty body here. - // Reserved_*() have been verified to be empty in the S60 code. - void Reserved_1() {} - void Reserved_2() {} - -private: - int m_lastIterationCount; - TInt m_savedStatusCode; - bool m_hasAlreadyRun; -}; - class Q_GUI_EXPORT QEventDispatcherS60 : public QEventDispatcherSymbian { Q_OBJECT @@ -102,8 +77,6 @@ public: void saveInputEvent(QSymbianControl *control, QWidget *widget, QInputEvent *event); - void reactivateDeferredActiveObjects(); - private: bool sendDeferredInputEvents(); diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index 76a9a55..4ee3f39 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -1000,7 +1000,7 @@ EXPORTS ?addDays@QDate@@QBE?AV1@H@Z @ 999 NONAME ; class QDate QDate::addDays(int) const ?addDays@QDateTime@@QBE?AV1@H@Z @ 1000 NONAME ; class QDateTime QDateTime::addDays(int) const ?addDefaultAnimation@QStateMachine@@QAEXPAVQAbstractAnimation@@@Z @ 1001 NONAME ; void QStateMachine::addDefaultAnimation(class QAbstractAnimation *) - ?addDeferredActiveObject@QEventDispatcherSymbian@@QAEXPAVQActiveObject@@@Z @ 1002 NONAME ; void QEventDispatcherSymbian::addDeferredActiveObject(class QActiveObject *) + ?addDeferredActiveObject@QEventDispatcherSymbian@@QAEXPAVQActiveObject@@@Z @ 1002 NONAME ABSENT ; void QEventDispatcherSymbian::addDeferredActiveObject(class QActiveObject *) ?addEncodedQueryItem@QUrl@@QAEXABVQByteArray@@0@Z @ 1003 NONAME ; void QUrl::addEncodedQueryItem(class QByteArray const &, class QByteArray const &) ?addExtraNamespaceDeclaration@QXmlStreamReader@@QAEXABVQXmlStreamNamespaceDeclaration@@@Z @ 1004 NONAME ; void QXmlStreamReader::addExtraNamespaceDeclaration(class QXmlStreamNamespaceDeclaration const &) ?addExtraNamespaceDeclarations@QXmlStreamReader@@QAEXABV?$QVector@VQXmlStreamNamespaceDeclaration@@@@@Z @ 1005 NONAME ; void QXmlStreamReader::addExtraNamespaceDeclarations(class QVector const &) @@ -3062,7 +3062,7 @@ EXPORTS ?removeColumn@QAbstractItemModel@@QAE_NHABVQModelIndex@@@Z @ 3061 NONAME ; bool QAbstractItemModel::removeColumn(int, class QModelIndex const &) ?removeColumns@QAbstractItemModel@@UAE_NHHABVQModelIndex@@@Z @ 3062 NONAME ; bool QAbstractItemModel::removeColumns(int, int, class QModelIndex const &) ?removeDefaultAnimation@QStateMachine@@QAEXPAVQAbstractAnimation@@@Z @ 3063 NONAME ; void QStateMachine::removeDefaultAnimation(class QAbstractAnimation *) - ?removeDeferredActiveObject@QEventDispatcherSymbian@@QAEXPAVQActiveObject@@@Z @ 3064 NONAME ; void QEventDispatcherSymbian::removeDeferredActiveObject(class QActiveObject *) + ?removeDeferredActiveObject@QEventDispatcherSymbian@@QAEXPAVQActiveObject@@@Z @ 3064 NONAME ABSENT ; void QEventDispatcherSymbian::removeDeferredActiveObject(class QActiveObject *) ?removeEncodedQueryItem@QUrl@@QAEXABVQByteArray@@@Z @ 3065 NONAME ; void QUrl::removeEncodedQueryItem(class QByteArray const &) ?removeEventFilter@QObject@@QAEXPAV1@@Z @ 3066 NONAME ; void QObject::removeEventFilter(class QObject *) ?removeFormat@QMimeData@@QAEXABVQString@@@Z @ 3067 NONAME ; void QMimeData::removeFormat(class QString const &) @@ -4484,8 +4484,8 @@ EXPORTS ?selectThread@QEventDispatcherSymbian@@AAEAAVQSelectThread@@XZ @ 4483 NONAME ; class QSelectThread & QEventDispatcherSymbian::selectThread(void) ?qt_symbian_SetupThreadHeap@@YAHHAAUSStdEpocThreadCreateInfo@@@Z @ 4484 NONAME ; int qt_symbian_SetupThreadHeap(int, struct SStdEpocThreadCreateInfo &) ?objectNameChanged@QAbstractDeclarativeData@@2P6AXPAV1@PAVQObject@@@ZA @ 4485 NONAME ; void (*QAbstractDeclarativeData::objectNameChanged)(class QAbstractDeclarativeData *, class QObject *) - ?queueDeferredActiveObjectsCompletion@QEventDispatcherSymbian@@QAEXXZ @ 4486 NONAME ; void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion(void) - ?reactivateDeferredActiveObjects@QEventDispatcherSymbian@@UAEXXZ @ 4487 NONAME ; void QEventDispatcherSymbian::reactivateDeferredActiveObjects(void) + ?queueDeferredActiveObjectsCompletion@QEventDispatcherSymbian@@QAEXXZ @ 4486 NONAME ABSENT ; void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion(void) + ?reactivateDeferredActiveObjects@QEventDispatcherSymbian@@UAEXXZ @ 4487 NONAME ABSENT ; void QEventDispatcherSymbian::reactivateDeferredActiveObjects(void) ?contains@QString@@QBE?AVQBool@@ABVQStringRef@@W4CaseSensitivity@Qt@@@Z @ 4488 NONAME ; class QBool QString::contains(class QStringRef const &, enum Qt::CaseSensitivity) const ?swap@QRegExp@@QAEXAAV1@@Z @ 4489 NONAME ; void QRegExp::swap(class QRegExp &) ?indexOf@QStringRef@@QBEHABVQString@@HW4CaseSensitivity@Qt@@@Z @ 4490 NONAME ; int QStringRef::indexOf(class QString const &, int, enum Qt::CaseSensitivity) const @@ -4612,17 +4612,17 @@ EXPORTS ?reactivateAndComplete@QActiveObject@@QAEXXZ @ 4611 NONAME ; void QActiveObject::reactivateAndComplete(void) ?defaultConnection@QSymbianSocketManager@@QBEPAVRConnection@@XZ @ 4612 NONAME ; class RConnection * QSymbianSocketManager::defaultConnection(void) const ?qt_symbianGetSocketServer@@YAAAVRSocketServ@@XZ @ 4613 NONAME ; class RSocketServ & qt_symbianGetSocketServer(void) - ?maybeQueueForLater@QActiveObject@@QAE_NXZ @ 4614 NONAME ; bool QActiveObject::maybeQueueForLater(void) + ?maybeQueueForLater@QActiveObject@@QAE_NXZ @ 4614 NONAME ABSENT ; bool QActiveObject::maybeQueueForLater(void) ??_EQActiveObject@@UAE@I@Z @ 4615 NONAME ; QActiveObject::~QActiveObject(unsigned int) ?lookupSocket@QSymbianSocketManager@@QBE_NHAAVRSocket@@@Z @ 4616 NONAME ; bool QSymbianSocketManager::lookupSocket(int, class RSocket &) const - ?wait@QActiveObject@@SA_NPAVCActive@@H@Z @ 4617 NONAME ; bool QActiveObject::wait(class CActive *, int) + ?wait@QActiveObject@@SA_NPAVCActive@@H@Z @ 4617 NONAME ABSENT ; bool QActiveObject::wait(class CActive *, int) ?instance@QSymbianSocketManager@@SAAAV1@XZ @ 4618 NONAME ; class QSymbianSocketManager & QSymbianSocketManager::instance(void) ??0QSymbianSocketManager@@QAE@XZ @ 4619 NONAME ; QSymbianSocketManager::QSymbianSocketManager(void) ?create@QNonContiguousByteDeviceFactory@@SAPAVQNonContiguousByteDevice@@V?$QSharedPointer@VQRingBuffer@@@@@Z @ 4620 NONAME ; class QNonContiguousByteDevice * QNonContiguousByteDeviceFactory::create(class QSharedPointer) ??1QSymbianSocketManager@@QAE@XZ @ 4621 NONAME ; QSymbianSocketManager::~QSymbianSocketManager(void) ?isResetDisabled@QNonContiguousByteDevice@@QAE_NXZ @ 4622 NONAME ; bool QNonContiguousByteDevice::isResetDisabled(void) ??1QActiveObject@@UAE@XZ @ 4623 NONAME ; QActiveObject::~QActiveObject(void) - ?wait@QActiveObject@@SA_NV?$QList@PAVCActive@@@@H@Z @ 4624 NONAME ; bool QActiveObject::wait(class QList, int) + ?wait@QActiveObject@@SA_NV?$QList@PAVCActive@@@@H@Z @ 4624 NONAME ABSENT ; bool QActiveObject::wait(class QList, int) ?maybeDeferSocketEvent@QActiveObject@@QAE_NXZ @ 4625 NONAME ; bool QActiveObject::maybeDeferSocketEvent(void) ?lookupSocket@QSymbianSocketManager@@QBEHABVRSocket@@@Z @ 4626 NONAME ; int QSymbianSocketManager::lookupSocket(class RSocket const &) const ?areSocketEventsBlocked@QEventDispatcherSymbian@@QBE_NXZ @ 4627 NONAME ; bool QEventDispatcherSymbian::areSocketEventsBlocked(void) const diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 7468b85..8eabd00 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12902,7 +12902,7 @@ EXPORTS ??0QStaticTextItem@@QAE@ABV0@@Z @ 12901 NONAME ; QStaticTextItem::QStaticTextItem(class QStaticTextItem const &) ??4QStaticTextItem@@QAEXABV0@@Z @ 12902 NONAME ; void QStaticTextItem::operator=(class QStaticTextItem const &) ?fontEngine@QStaticTextItem@@QBEPAVQFontEngine@@XZ @ 12903 NONAME ; class QFontEngine * QStaticTextItem::fontEngine(void) const - ?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void) + ?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ABSENT ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void) ?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const ?populate@QTextureGlyphCache@@QAE_NPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12906 NONAME ; bool QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) ?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 12907 NONAME ; void QLineControl::resetCursorBlinkTimer(void) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 76b1568..d6b2e93 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -1294,7 +1294,7 @@ EXPORTS _ZN23QEventDispatcherSymbian24reactivateSocketNotifierEP15QSocketNotifier @ 1293 NONAME _ZN23QEventDispatcherSymbian24sendDeferredSocketEventsEv @ 1294 NONAME _ZN23QEventDispatcherSymbian24unregisterSocketNotifierEP15QSocketNotifier @ 1295 NONAME - _ZN23QEventDispatcherSymbian31reactivateDeferredActiveObjectsEv @ 1296 NONAME + _ZN23QEventDispatcherSymbian31reactivateDeferredActiveObjectsEv @ 1296 NONAME ABSENT _ZN23QEventDispatcherSymbian5flushEv @ 1297 NONAME _ZN23QEventDispatcherSymbian6wakeUpEv @ 1298 NONAME _ZN23QEventDispatcherSymbian9interruptEv @ 1299 NONAME @@ -3713,7 +3713,7 @@ EXPORTS _ZrsR11QDataStreamR12QEasingCurve @ 3712 NONAME _Z26qt_symbian_SetupThreadHeapiR24SStdEpocThreadCreateInfo @ 3713 NONAME _ZN24QAbstractDeclarativeData17objectNameChangedE @ 3714 NONAME DATA 4 - _ZN23QEventDispatcherSymbian36queueDeferredActiveObjectsCompletionEv @ 3715 NONAME + _ZN23QEventDispatcherSymbian36queueDeferredActiveObjectsCompletionEv @ 3715 NONAME ABSENT _ZN23QCoreApplicationPrivate18symbianCommandLineEv @ 3716 NONAME _ZNK11QMetaMethod8revisionEv @ 3717 NONAME _ZNK13QMetaProperty8revisionEv @ 3718 NONAME @@ -3850,11 +3850,11 @@ EXPORTS _ZN11QTranslator18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 3849 NONAME _ZN11QTranslator25staticMetaObjectExtraDataE @ 3850 NONAME DATA 8 _ZN11QTranslator4loadERK7QLocaleRK7QStringS5_S5_S5_ @ 3851 NONAME - _ZN13QActiveObject18maybeQueueForLaterEv @ 3852 NONAME + _ZN13QActiveObject18maybeQueueForLaterEv @ 3852 NONAME ABSENT _ZN13QActiveObject21maybeDeferSocketEventEv @ 3853 NONAME _ZN13QActiveObject21reactivateAndCompleteEv @ 3854 NONAME - _ZN13QActiveObject4waitE5QListIP7CActiveEi @ 3855 NONAME - _ZN13QActiveObject4waitEP7CActivei @ 3856 NONAME + _ZN13QActiveObject4waitE5QListIP7CActiveEi @ 3855 NONAME ABSENT + _ZN13QActiveObject4waitEP7CActivei @ 3856 NONAME ABSENT _ZN13QActiveObjectC2EiP23QEventDispatcherSymbian @ 3857 NONAME _ZN13QActiveObjectD0Ev @ 3858 NONAME _ZN13QActiveObjectD1Ev @ 3859 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index ecdec9d..fb09d5c 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12104,7 +12104,7 @@ EXPORTS _ZN15QStaticTextItem13setFontEngineEP11QFontEngine @ 12103 NONAME _ZN15QStaticTextItemD1Ev @ 12104 NONAME _ZN15QStaticTextItemD2Ev @ 12105 NONAME - _ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME + _ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME ABSENT _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12107 NONAME _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12108 NONAME _ZN12QLineControl21resetCursorBlinkTimerEv @ 12109 NONAME -- cgit v0.12 From 887b19ce9313d09eb996e765c18fa19a09a5cf95 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 1 Jun 2011 16:15:13 +0300 Subject: Fix QTreeWidget autotest cases on Symbian/VGA Make two autotest cases pass on Symbian/VGA devices. Task-number: QT-5057 Reviewed-by: Miikka Heikkinen --- tests/auto/qtreewidget/tst_qtreewidget.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index dc878c4..7d2cdfb 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include "../../shared/util.h" @@ -3102,10 +3104,21 @@ void tst_QTreeWidget::task206367_duplication() QWidget topLevel; QTreeWidget treeWidget(&topLevel); topLevel.show(); +#ifndef Q_WS_S60 treeWidget.resize(200, 200); +#endif treeWidget.setSortingEnabled(true); QTreeWidgetItem* rootItem = new QTreeWidgetItem( &treeWidget, QStringList("root") ); +#ifdef Q_WS_S60 + // Ensure that eight items fit into tree widget. In Symbian VGA devices 8 rows of + // data will take more than 200 pixels. + int calculatedHeight = treeWidget.visualItemRect(treeWidget.topLevelItem(0)).height() + + 2 * QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, 0); + calculatedHeight *= 8; // eight 'rows': header, root and 2 items with 2 children + treeWidget.resize(200, qMax(200, calculatedHeight)); +#endif + for (int nFile = 0; nFile < 2; nFile++ ) { QTreeWidgetItem* itemFile = new QTreeWidgetItem(rootItem, QStringList(QString::number(nFile))); for (int nRecord = 0; nRecord < 2; nRecord++) @@ -3211,6 +3224,13 @@ void tst_QTreeWidget::task239150_editorWidth() { //we check that an item with no text will get an editor with a correct size QTreeWidget tree; +#ifdef Q_OS_SYMBIAN + //By default widgets are 640*360 in Symbian. Call to create_sys() sets the real size of the widget. + //Therefore, with VGA Symbian devices, we need to update the widget width to match screen width. + //As VGA devices have larger font, longer texts wouldn't otherwise fit into tree widget. + if (QApplication::desktop() && QApplication::desktop()->availableGeometry().width() > tree.width()) + tree.resize(QApplication::desktop()->availableGeometry().size()); +#endif QStyleOptionFrameV2 opt; opt.init(&tree); -- cgit v0.12 From f8d71ee8c5f29eabb759ff4b0d5c8a153023a254 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 31 May 2011 17:57:14 +0200 Subject: QDeclarative: Fix QPerformanceTimer on Symbian QPerformanceTimer::elapsed() always returned 0 on Symbian. This is because Q_OS_UNIX define is also set for Symbian. Fixed by moving Q_OS_SYMBIAN before Q_OS_SYMBIAN, and fixing the logic. Reviewed-by: Alessandro Portale Task-number: QTBUG-19669 --- src/declarative/declarative.pro | 2 +- src/declarative/qml/qperformancetimer.cpp | 55 ++++++++++++++++--------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index f3a7db9..27ceaf0 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -26,7 +26,7 @@ include(debugger/debugger.pri) symbian: { TARGET.UID3=0x2001E623 - LIBS += -lefsrv + LIBS += -lefsrv -lhal } linux-g++-maemo:DEFINES += QDECLARATIVEVIEW_NOBACKGROUND diff --git a/src/declarative/qml/qperformancetimer.cpp b/src/declarative/qml/qperformancetimer.cpp index 1d7ca80..bdd5da1 100644 --- a/src/declarative/qml/qperformancetimer.cpp +++ b/src/declarative/qml/qperformancetimer.cpp @@ -45,14 +45,15 @@ #include #include #include -#elif defined(Q_OS_UNIX) -#include -#include -#include #elif defined(Q_OS_SYMBIAN) #include #include #include +#include +#elif defined(Q_OS_UNIX) +#include +#include +#include #elif defined(Q_OS_WIN) #include #endif @@ -84,6 +85,29 @@ qint64 QPerformanceTimer::elapsed() const return absoluteToNSecs(cpu_time - t1); } +////////////////////////////// Symbian ////////////////////////////// +#elif defined(Q_OS_SYMBIAN) + +static qint64 getTimeFromTick(quint64 elapsed) +{ + static TInt freq = 0; + if (!freq) + HAL::Get(HALData::EFastCounterFrequency, freq); + + return (elapsed * 1000000000) / freq; +} + +void QPerformanceTimer::start() +{ + t1 = User::FastCounter(); +} + +qint64 QPerformanceTimer::elapsed() const +{ + return getTimeFromTick(User::FastCounter() - t1); +} + + ////////////////////////////// Unix ////////////////////////////// #elif defined(Q_OS_UNIX) @@ -158,29 +182,6 @@ qint64 QPerformanceTimer::elapsed() const return sec * Q_INT64_C(1000000000) + frac; } -////////////////////////////// Symbian ////////////////////////////// -#elif defined(Q_OS_SYMBIAN) - -static qint64 getTimeFromTick(quint64 elapsed) -{ - static TInt freq; - if (!freq) - HAL::Get(HALData::EFastCounterFrequency, freq); - - // ### not sure on units - return elapsed / freq; -} - -void QPerformanceTimer::start() -{ - t1 = User::FastCounter(); -} - -qint64 QPerformanceTimer::elapsed() const -{ - return getTimeFromTick(User::FastCounter() - t1); -} - ////////////////////////////// Windows ////////////////////////////// #elif defined(Q_OS_WIN) -- cgit v0.12 From 9a4d1230b54c15af6f5448c1551c35242b668ccf Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:35 +0200 Subject: fix build with QT_NO_QWS_SIGNALHANDLER Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qlock.cpp | 11 ++++++++++- src/gui/embedded/qscreenlinuxfb_qws.cpp | 5 +++++ src/gui/embedded/qwslock.cpp | 16 +++++++++++++--- src/gui/embedded/qwssignalhandler.cpp | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index bb442e4..e7db7e6 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -173,7 +173,9 @@ QLock::QLock(const QString &filename, char id, bool create) arg.val = MAX_LOCKS; semctl(data->id,0,SETVAL,arg); +#ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addSemaphore(data->id); +#endif } #endif if (data->id == -1) { @@ -201,8 +203,15 @@ QLock::~QLock() unlink(data->file); } #else - if(data->owned) + if (data->owned) { +#ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->removeSemaphore(data->id); +#else + qt_semun semval; + semval.val = 0; + semctl(data->id, 0, IPC_RMID, semval); +#endif + } #endif delete data; } diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index 67c8a31..4b41b5b 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -110,7 +110,9 @@ QLinuxFbScreenPrivate::QLinuxFbScreenPrivate() #endif ttyfd(-1), oldKdMode(KD_TEXT) { +#ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addObject(this); +#endif } QLinuxFbScreenPrivate::~QLinuxFbScreenPrivate() @@ -263,6 +265,9 @@ QLinuxFbScreen::QLinuxFbScreen(int display_id) QLinuxFbScreen::~QLinuxFbScreen() { +#ifdef QT_NO_QWS_SIGNALHANDLER + delete d_ptr; +#endif } /*! diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index a64dc3d..1d9bfb6 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -76,7 +76,9 @@ QWSLock::QWSLock() perror("QWSLock::QWSLock"); qFatal("Unable to create semaphore"); } +#ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addSemaphore(semId); +#endif qt_semun semval; semval.val = 1; @@ -103,15 +105,23 @@ QWSLock::QWSLock() QWSLock::QWSLock(int id) { semId = id; +#ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addSemaphore(semId); +#endif lockCount[0] = lockCount[1] = 0; } QWSLock::~QWSLock() { - if (semId == -1) - return; - QWSSignalHandler::instance()->removeSemaphore(semId); + if (semId != -1) { +#ifndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->removeSemaphore(semId); +#else + qt_semun semval; + semval.val = 0; + semctl(semId, 0, IPC_RMID, semval); +#endif + } } static bool forceLock(int semId, unsigned short semNum, int) diff --git a/src/gui/embedded/qwssignalhandler.cpp b/src/gui/embedded/qwssignalhandler.cpp index 730dbae..2a20141 100644 --- a/src/gui/embedded/qwssignalhandler.cpp +++ b/src/gui/embedded/qwssignalhandler.cpp @@ -125,4 +125,4 @@ void QWSSignalHandler::handleSignal(int signum) QT_END_NAMESPACE -#endif // QT_QWS_NO_SIGNALHANDLER +#endif // QT_NO_QWS_SIGNALHANDLER -- cgit v0.12 From 02c7d2d114bf2f5fb2a1947e6370046f0141499b Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:36 +0200 Subject: make sure we really clear all locks Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index e7db7e6..8f24e7d 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -194,7 +194,7 @@ QLock::QLock(const QString &filename, char id, bool create) QLock::~QLock() { - if (locked()) + while (locked()) unlock(); #ifdef Q_NO_SEMAPHORE if(isValid()) { -- cgit v0.12 From 8d6e9dcc2eba13647b2c608fc20cf85ae9b99426 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:37 +0200 Subject: add a warning on an incorrect usage of QLock Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qlock.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index 8f24e7d..034f5fb 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -272,6 +272,8 @@ void QLock::lock(Type t) qDebug("Semop lock failure %s",strerror(errno)); } while (rv == -1 && errno == EINTR); #endif + } else if (type == Read && t == Write) { + qDebug("QLock::lock: Attempt to lock for write while locked for read"); } data->count++; } -- cgit v0.12 From e99f8f0db4e427bda280587d32b5e12d114043c4 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:38 +0200 Subject: minor refactoring of the QLock class use EINTR_LOOP macro to simplify the code; code cleanups; minor optimizations; more informative debug strings Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qlock.cpp | 128 ++++++++++++++++----------------------------- 1 file changed, 46 insertions(+), 82 deletions(-) diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index 034f5fb..ae18b05 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -99,7 +99,6 @@ QT_END_NAMESPACE #endif #include #include -#include #include // overrides QT_OPEN @@ -138,8 +137,6 @@ public: */ /*! - \fn QLock::QLock(const QString &filename, char id, bool create) - Creates a lock. \a filename is the file path of the Unix-domain socket the \l{Qt for Embedded Linux} client is using. \a id is the name of the particular lock to be created on that socket. If \a create is true @@ -147,82 +144,75 @@ public: create is false the lock should exist already (as the Qt for Embedded Linux client expects). */ - QLock::QLock(const QString &filename, char id, bool create) { data = new QLockData; data->count = 0; #ifdef Q_NO_SEMAPHORE - data->file = QString(filename+id).toLocal8Bit().constData(); - for(int x = 0; x < 2; x++) { - data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU); - if(data->id != -1 || !create) { + data->file = filename.toLocal8Bit() + id; + for (int x = 0; x < 2; ++x) { + data->id = QT_OPEN(data->file.constData(), O_RDWR | (x ? O_CREAT : 0), S_IRWXU); + if (data->id != -1 || !create) { data->owned = x; break; } } #else key_t semkey = ftok(filename.toLocal8Bit().constData(), id); - data->id = semget(semkey,0,0); + data->id = semget(semkey, 0, 0); data->owned = create; if (create) { - qt_semun arg; arg.val = 0; + qt_semun arg; + arg.val = 0; if (data->id != -1) - semctl(data->id,0,IPC_RMID,arg); - data->id = semget(semkey,1,IPC_CREAT|0600); + semctl(data->id, 0, IPC_RMID, arg); + data->id = semget(semkey, 1, IPC_CREAT | 0600); arg.val = MAX_LOCKS; - semctl(data->id,0,SETVAL,arg); + semctl(data->id, 0, SETVAL, arg); #ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addSemaphore(data->id); #endif } #endif - if (data->id == -1) { - int eno = errno; - qWarning("Cannot %s semaphore %s '%c'", (create ? "create" : "get"), - qPrintable(filename), id); - qDebug() << "Error" << eno << strerror(eno); + if (!isValid()) { + qWarning("QLock::QLock: Cannot %s semaphore %s '%c' (%d, %s)", + (create ? "create" : "get"), qPrintable(filename), id, + errno, strerror(errno)); } } /*! - \fn QLock::~QLock() - Destroys a lock */ - QLock::~QLock() { while (locked()) unlock(); #ifdef Q_NO_SEMAPHORE - if(isValid()) { + if (isValid()) QT_CLOSE(data->id); - if(data->owned) - unlink(data->file); - } -#else +#endif if (data->owned) { -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->removeSemaphore(data->id); +#ifdef Q_NO_SEMAPHORE + unlink(data->file.constData()); #else qt_semun semval; semval.val = 0; semctl(data->id, 0, IPC_RMID, semval); + +#ifndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->removeSemaphore(data->id); #endif - } #endif + } delete data; } /*! - \fn bool QLock::isValid() const - Returns true if the lock constructor was successful; returns false if the lock could not be created or was not available to connect to. */ - bool QLock::isValid() const { return (data->id != -1); @@ -239,98 +229,72 @@ bool QLock::isValid() const will only be unlocked after a corresponding number of unlock() calls. */ - void QLock::lock(Type t) { if (!data->count) { + type = t; + + int rv; #ifdef Q_NO_SEMAPHORE - int op = LOCK_SH; - if(t == Write) - op = LOCK_EX; - for(int rv=1; rv;) { - rv = flock(data->id, op); - if (rv == -1 && errno != EINTR) - qDebug("Semop lock failure %s",strerror(errno)); - } + int op = type == Write ? LOCK_EX : LOCK_SH; + + EINTR_LOOP(rv, flock(data->id, op)); #else sembuf sops; sops.sem_num = 0; + sops.sem_op = type == Write ? -MAX_LOCKS : -1; sops.sem_flg = SEM_UNDO; - if (t == Write) { - sops.sem_op = -MAX_LOCKS; - type = Write; - } else { - sops.sem_op = -1; - type = Read; - } - - int rv; - do { - rv = semop(data->id,&sops,1); - if (rv == -1 && errno != EINTR) - qDebug("Semop lock failure %s",strerror(errno)); - } while (rv == -1 && errno == EINTR); + EINTR_LOOP(rv, semop(data->id, &sops, 1)); #endif + if (rv == -1) { + qDebug("QLock::lock(): %s", strerror(errno)); + return; + } } else if (type == Read && t == Write) { - qDebug("QLock::lock: Attempt to lock for write while locked for read"); + qDebug("QLock::lock(): Attempt to lock for write while locked for read"); } data->count++; } /*! - \fn void QLock::unlock() - Unlocks the semaphore. If other processes were blocking waiting to lock() the semaphore, one of them will wake up and succeed in - lock()ing. + locking. */ - void QLock::unlock() { - if(data->count) { + if (data->count) { data->count--; - if(!data->count) { + if (!data->count) { + int rv; #ifdef Q_NO_SEMAPHORE - for(int rv=1; rv;) { - rv = flock(data->id, LOCK_UN); - if (rv == -1 && errno != EINTR) - qDebug("Semop lock failure %s",strerror(errno)); - } + EINTR_LOOP(rv, flock(data->id, LOCK_UN)); #else sembuf sops; sops.sem_num = 0; - sops.sem_op = 1; + sops.sem_op = type == Write ? MAX_LOCKS : 1; sops.sem_flg = SEM_UNDO; - if (type == Write) - sops.sem_op = MAX_LOCKS; - int rv; - do { - rv = semop(data->id,&sops,1); - if (rv == -1 && errno != EINTR) - qDebug("Semop unlock failure %s",strerror(errno)); - } while (rv == -1 && errno == EINTR); + EINTR_LOOP(rv, semop(data->id, &sops, 1)); #endif + if (rv == -1) + qDebug("QLock::unlock(): %s", strerror(errno)); } } else { - qDebug("Unlock without corresponding lock"); + qDebug("QLock::unlock(): Unlock without corresponding lock"); } } /*! - \fn bool QLock::locked() const - Returns true if the lock is currently held by the current process; otherwise returns false. */ - bool QLock::locked() const { - return (data->count > 0); + return isValid() && data->count > 0; } QT_END_NAMESPACE #endif // QT_NO_QWS_MULTIPROCESS - -- cgit v0.12 From b840d8255196241fa7c2684c0443471330f94046 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:39 +0200 Subject: simplify the semaphores initialization there is no need in 3 separate tests since, for local semaphores, semctl(2) always works. if it's not, well, 1 test is completely enough to check that Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qwslock.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index 1d9bfb6..ae168df 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -70,8 +70,9 @@ QT_BEGIN_NAMESPACE QWSLock::QWSLock() { - semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); + static unsigned short initialValues[3] = { 1, 1, 0 }; + semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); if (semId == -1) { perror("QWSLock::QWSLock"); qFatal("Unable to create semaphore"); @@ -81,25 +82,13 @@ QWSLock::QWSLock() #endif qt_semun semval; - semval.val = 1; - - if (semctl(semId, BackingStore, SETVAL, semval) == -1) { + semval.array = initialValues; + if (semctl(semId, 0, SETALL, semval) == -1) { perror("QWSLock::QWSLock"); - qFatal("Unable to initialize backingstore semaphore"); + qFatal("Unable to initialize semaphores"); } - lockCount[BackingStore] = 0; - if (semctl(semId, Communication, SETVAL, semval) == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to initialize communication semaphore"); - } - lockCount[Communication] = 0; - - semval.val = 0; - if (semctl(semId, RegionEvent, SETVAL, semval) == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to initialize region event semaphore"); - } + lockCount[0] = lockCount[1] = 0; } QWSLock::QWSLock(int id) -- cgit v0.12 From 4134cb7dfc04ca7721277772c41b678bac6b33a0 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:41 +0200 Subject: simplify the code by using the EINTR_LOOP macro the sembuf structure now initializes out of the loop (nano-opt) Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qwslock.cpp | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index ae168df..d8996d6 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -116,59 +116,59 @@ QWSLock::~QWSLock() static bool forceLock(int semId, unsigned short semNum, int) { int ret; - do { - sembuf sops = { semNum, -1, 0 }; - // As the BackingStore lock is a mutex, and only one process may own - // the lock, it's safe to use SEM_UNDO. On the other hand, the - // Communication lock is locked by the client but unlocked by the - // server and therefore can't use SEM_UNDO. - if (semNum == QWSLock::BackingStore) - sops.sem_flg |= SEM_UNDO; - - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::lock: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); + sembuf sops = { semNum, -1, 0 }; + // As the BackingStore lock is a mutex, and only one process may own + // the lock, it's safe to use SEM_UNDO. On the other hand, the + // Communication lock is locked by the client but unlocked by the + // server and therefore can't use SEM_UNDO. + if (semNum == QWSLock::BackingStore) + sops.sem_flg |= SEM_UNDO; + + EINTR_LOOP(ret, semop(semId, &sops, 1)); + if (ret == -1) { + qDebug("QWSLock::lock(): %s", strerror(errno)); + return false; + } - return (ret != -1); + return true; } static bool up(int semId, unsigned short semNum) { int ret; - do { - sembuf sops = { semNum, 1, 0 }; - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::up: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - return (ret != -1); + sembuf sops = { semNum, 1, 0 }; + + EINTR_LOOP(ret, semop(semId, &sops, 1)); + if (ret == -1) { + qDebug("QWSLock::up(): %s", strerror(errno)); + return false; + } + + return true; } static bool down(int semId, unsigned short semNum) { int ret; - do { - sembuf sops = { semNum, -1, 0 }; - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::down: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - return (ret != -1); + sembuf sops = { semNum, -1, 0 }; + + EINTR_LOOP(ret, semop(semId, &sops, 1)); + if (ret == -1) { + qDebug("QWSLock::down(): %s", strerror(errno)); + return false; + } + + return true; } static int getValue(int semId, unsigned short semNum) { - int ret; - do { - ret = semctl(semId, semNum, GETVAL, 0); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::getValue: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - + int ret = semctl(semId, semNum, GETVAL, 0); + if (ret == -1) + qDebug("QWSLock::getValue(): %s", strerror(errno)); return ret; } @@ -218,7 +218,7 @@ void QWSLock::unlock(LockType type) ret = semop(semId, &sops, 1); if (ret == -1 && errno != EINTR) - qDebug("QWSLock::unlock: %s", strerror(errno)); + qDebug("QWSLock::unlock(): %s", strerror(errno)); } while (ret == -1 && errno == EINTR); } -- cgit v0.12 From 6896244f266becfb5807985c5628c8f0a775ce76 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:42 +0200 Subject: minor refactoring of the QWSLock class unify both constructors in a single one; make the code cleaner and cheaper Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qwslock.cpp | 101 ++++++++++++++++--------------------------- src/gui/embedded/qwslock_p.h | 14 +++--- 2 files changed, 47 insertions(+), 68 deletions(-) diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index d8996d6..67f8bd8 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -45,8 +45,6 @@ #include "qwssignalhandler_p.h" -#include -#include #include #include #include @@ -68,36 +66,30 @@ QT_BEGIN_NAMESPACE #error QWSLock currently requires semaphores #endif -QWSLock::QWSLock() +QWSLock::QWSLock(int id) : semId(id) { static unsigned short initialValues[3] = { 1, 1, 0 }; - semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); if (semId == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to create semaphore"); - } -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addSemaphore(semId); -#endif + semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); + if (semId == -1) { + perror("QWSLock::QWSLock"); + qFatal("Unable to create semaphore"); + } - qt_semun semval; - semval.array = initialValues; - if (semctl(semId, 0, SETALL, semval) == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to initialize semaphores"); + qt_semun semval; + semval.array = initialValues; + if (semctl(semId, 0, SETALL, semval) == -1) { + perror("QWSLock::QWSLock"); + qFatal("Unable to initialize semaphores"); + } } lockCount[0] = lockCount[1] = 0; -} -QWSLock::QWSLock(int id) -{ - semId = id; #ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addSemaphore(semId); #endif - lockCount[0] = lockCount[1] = 0; } QWSLock::~QWSLock() @@ -113,35 +105,20 @@ QWSLock::~QWSLock() } } -static bool forceLock(int semId, unsigned short semNum, int) +bool QWSLock::up(unsigned short semNum) { int ret; - sembuf sops = { semNum, -1, 0 }; + sembuf sops = { semNum, 1, 0 }; // As the BackingStore lock is a mutex, and only one process may own // the lock, it's safe to use SEM_UNDO. On the other hand, the // Communication lock is locked by the client but unlocked by the // server and therefore can't use SEM_UNDO. - if (semNum == QWSLock::BackingStore) + if (semNum == BackingStore) sops.sem_flg |= SEM_UNDO; EINTR_LOOP(ret, semop(semId, &sops, 1)); if (ret == -1) { - qDebug("QWSLock::lock(): %s", strerror(errno)); - return false; - } - - return true; -} - -static bool up(int semId, unsigned short semNum) -{ - int ret; - - sembuf sops = { semNum, 1, 0 }; - - EINTR_LOOP(ret, semop(semId, &sops, 1)); - if (ret == -1) { qDebug("QWSLock::up(): %s", strerror(errno)); return false; } @@ -149,11 +126,17 @@ static bool up(int semId, unsigned short semNum) return true; } -static bool down(int semId, unsigned short semNum) +bool QWSLock::down(unsigned short semNum, int) { int ret; sembuf sops = { semNum, -1, 0 }; + // As the BackingStore lock is a mutex, and only one process may own + // the lock, it's safe to use SEM_UNDO. On the other hand, the + // Communication lock is locked by the client but unlocked by the + // server and therefore can't use SEM_UNDO. + if (semNum == BackingStore) + sops.sem_flg |= SEM_UNDO; EINTR_LOOP(ret, semop(semId, &sops, 1)); if (ret == -1) { @@ -164,7 +147,7 @@ static bool down(int semId, unsigned short semNum) return true; } -static int getValue(int semId, unsigned short semNum) +int QWSLock::getValue(unsigned short semNum) const { int ret = semctl(semId, semNum, GETVAL, 0); if (ret == -1) @@ -175,56 +158,48 @@ static int getValue(int semId, unsigned short semNum) bool QWSLock::lock(LockType type, int timeout) { if (type == RegionEvent) - return up(semId, RegionEvent); + return up(type); - if (hasLock(type)) { + if (lockCount[type] > 0) { ++lockCount[type]; return true; } - if (!forceLock(semId, type, timeout)) - return false; - ++lockCount[type]; - return true; + if (down(type, timeout)) { + ++lockCount[type]; + return true; + } + + return false; } bool QWSLock::hasLock(LockType type) { if (type == RegionEvent) - return (getValue(semId, RegionEvent) == 0); + return getValue(type) == 0; - return (lockCount[type] > 0); + return lockCount[type] > 0; } void QWSLock::unlock(LockType type) { if (type == RegionEvent) { - down(semId, RegionEvent); + down(type, -1); return; } - if (hasLock(type)) { + if (lockCount[type] > 0) { --lockCount[type]; - if (hasLock(type)) + if (lockCount[type] > 0) return; } - const unsigned short semNum = type; - int ret; - do { - sembuf sops = {semNum, 1, 0}; - if (semNum == QWSLock::BackingStore) - sops.sem_flg |= SEM_UNDO; - - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::unlock(): %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); + up(type); } bool QWSLock::wait(LockType type, int timeout) { - bool ok = forceLock(semId, type, timeout); + bool ok = down(type, timeout); if (ok) unlock(type); return ok; diff --git a/src/gui/embedded/qwslock_p.h b/src/gui/embedded/qwslock_p.h index 9a7f279..d020b22 100644 --- a/src/gui/embedded/qwslock_p.h +++ b/src/gui/embedded/qwslock_p.h @@ -55,17 +55,16 @@ #include -QT_BEGIN_NAMESPACE - #ifndef QT_NO_QWS_MULTIPROCESS +QT_BEGIN_NAMESPACE + class QWSLock { public: enum LockType { BackingStore, Communication, RegionEvent }; - QWSLock(); - QWSLock(int lockId); + QWSLock(int lockId = -1); ~QWSLock(); bool lock(LockType type, int timeout = -1); @@ -75,11 +74,16 @@ public: int id() const { return semId; } private: + bool up(unsigned short semNum); + bool down(unsigned short semNum, int timeout); + int getValue(unsigned short semNum) const; + int semId; int lockCount[2]; }; - QT_END_NAMESPACE + #endif // QT_NO_QWS_MULTIPROCESS + #endif // QWSLOCK_P_H -- cgit v0.12 From 9f71cffea1d5cdac94ae7368ffa7f54183ac33a4 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 1 Jun 2011 16:49:43 +0200 Subject: drop the SysV semaphores -specific code out from QWSSignalHandler it is safe to call the QLock/QWSLock desctructors instead on normal exit where both lists should be empty; on crash, we don't care about semi-alive objects and the only important thing is to unregister the system semaphores. Merge-request: 1237 Reviewed-by: Harald Fernengel --- src/gui/embedded/qlock.cpp | 19 ++++++------- src/gui/embedded/qwslock.cpp | 17 ++++++------ src/gui/embedded/qwssignalhandler.cpp | 50 +++++++++++++---------------------- src/gui/embedded/qwssignalhandler_p.h | 22 ++++++++++----- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index ae18b05..ac15431 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -169,10 +169,6 @@ QLock::QLock(const QString &filename, char id, bool create) data->id = semget(semkey, 1, IPC_CREAT | 0600); arg.val = MAX_LOCKS; semctl(data->id, 0, SETVAL, arg); - -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addSemaphore(data->id); -#endif } #endif if (!isValid()) { @@ -180,6 +176,10 @@ QLock::QLock(const QString &filename, char id, bool create) (create ? "create" : "get"), qPrintable(filename), id, errno, strerror(errno)); } + +#ifndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->addLock(this); +#endif } /*! @@ -187,6 +187,10 @@ QLock::QLock(const QString &filename, char id, bool create) */ QLock::~QLock() { +#ifndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->removeLock(this); +#endif + while (locked()) unlock(); #ifdef Q_NO_SEMAPHORE @@ -200,13 +204,10 @@ QLock::~QLock() qt_semun semval; semval.val = 0; semctl(data->id, 0, IPC_RMID, semval); - -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->removeSemaphore(data->id); -#endif #endif } delete data; + data = 0; } /*! @@ -215,7 +216,7 @@ QLock::~QLock() */ bool QLock::isValid() const { - return (data->id != -1); + return data && data->id != -1; } /*! diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index 67f8bd8..c14f50b 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -70,6 +70,10 @@ QWSLock::QWSLock(int id) : semId(id) { static unsigned short initialValues[3] = { 1, 1, 0 }; +#ifndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->addWSLock(this); +#endif + if (semId == -1) { semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); if (semId == -1) { @@ -86,22 +90,19 @@ QWSLock::QWSLock(int id) : semId(id) } lockCount[0] = lockCount[1] = 0; - -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addSemaphore(semId); -#endif } QWSLock::~QWSLock() { - if (semId != -1) { #ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->removeSemaphore(semId); -#else + QWSSignalHandler::instance()->removeWSLock(this); +#endif + + if (semId != -1) { qt_semun semval; semval.val = 0; semctl(semId, 0, IPC_RMID, semval); -#endif + semId = -1; } } diff --git a/src/gui/embedded/qwssignalhandler.cpp b/src/gui/embedded/qwssignalhandler.cpp index 2a20141..b13a57d 100644 --- a/src/gui/embedded/qwssignalhandler.cpp +++ b/src/gui/embedded/qwssignalhandler.cpp @@ -43,13 +43,10 @@ #ifndef QT_NO_QWS_SIGNALHANDLER -#include -#ifndef QT_NO_QWS_MULTIPROCESS -# include -# include +#include "qlock_p.h" +#include "qwslock_p.h" -# include -#endif +#include #include QT_BEGIN_NAMESPACE @@ -87,39 +84,30 @@ QWSSignalHandler::QWSSignalHandler() QWSSignalHandler::~QWSSignalHandler() { -#ifndef QT_NO_QWS_MULTIPROCESS - while (!semaphores.isEmpty()) - removeSemaphore(semaphores.last()); -#endif + clear(); } -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSSignalHandler::removeSemaphore(int semno) +void QWSSignalHandler::clear() { - const int index = semaphores.lastIndexOf(semno); - if (index != -1) { - qt_semun semval; - semval.val = 0; - semctl(semaphores.at(index), 0, IPC_RMID, semval); - semaphores.remove(index); - } +#if !defined(QT_NO_QWS_MULTIPROCESS) + // it is safe to call d-tors directly here since, on normal exit, + // lists should be empty; otherwise, we don't care about semi-alive objects + // and the only important thing here is to unregister the system semaphores. + while (!locks.isEmpty()) + locks.takeLast()->~QLock(); + while (!wslocks.isEmpty()) + wslocks.takeLast()->~QWSLock(); +#endif + objects.clear(); } -#endif // QT_NO_QWS_MULTIPROCESS void QWSSignalHandler::handleSignal(int signum) { QWSSignalHandler *h = instance(); - - signal(signum, h->oldHandlers[signum]); - -#ifndef QT_NO_QWS_MULTIPROCESS - qt_semun semval; - semval.val = 0; - for (int i = 0; i < h->semaphores.size(); ++i) - semctl(h->semaphores.at(i), 0, IPC_RMID, semval); -#endif - - h->objects.clear(); + if (h) { + signal(signum, h->oldHandlers[signum]); + h->clear(); + } raise(signum); } diff --git a/src/gui/embedded/qwssignalhandler_p.h b/src/gui/embedded/qwssignalhandler_p.h index dda9c76..217eda1 100644 --- a/src/gui/embedded/qwssignalhandler_p.h +++ b/src/gui/embedded/qwssignalhandler_p.h @@ -57,14 +57,17 @@ #ifndef QT_NO_QWS_SIGNALHANDLER -#include -#include +#include +#include #include QT_BEGIN_NAMESPACE typedef void (*qt_sighandler_t)(int); +class QLock; +class QWSLock; + class QWSSignalHandlerPrivate; class Q_GUI_EXPORT QWSSignalHandler @@ -75,17 +78,24 @@ public: ~QWSSignalHandler(); #ifndef QT_NO_QWS_MULTIPROCESS - inline void addSemaphore(int semno) { semaphores.append(semno); } - void removeSemaphore(int semno); + inline void addLock(QLock *lock) { locks.append(lock); } + inline void removeLock(QLock *lock) { locks.removeOne(lock); } + inline void addWSLock(QWSLock *wslock) { wslocks.append(wslock); } + inline void removeWSLock(QWSLock *wslock) { wslocks.removeOne(wslock); } #endif inline void addObject(QObject *object) { (void)objects.add(object); } private: QWSSignalHandler(); + + void clear(); + static void handleSignal(int signal); - QMap oldHandlers; + + QHash oldHandlers; #ifndef QT_NO_QWS_MULTIPROCESS - QVector semaphores; + QList locks; + QList wslocks; #endif QObjectCleanupHandler objects; -- cgit v0.12 From f1249f94c07654f0b76e7a90fb81ed5b58cd30f7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 17:08:39 +0200 Subject: synchronize qmake project parser with qt creator qt creator as of ddb918f. not feeling like replaying the whole history ... --- tools/linguist/lrelease/main.cpp | 61 +- tools/linguist/lupdate/main.cpp | 82 +- tools/linguist/shared/abstractproitemvisitor.h | 74 - tools/linguist/shared/ioutils.cpp | 152 + tools/linguist/shared/ioutils.h | 65 + tools/linguist/shared/profileevaluator.cpp | 4209 ++++++++++++++---------- tools/linguist/shared/profileevaluator.h | 209 +- tools/linguist/shared/profileparser.cpp | 1028 ++++++ tools/linguist/shared/profileparser.h | 186 ++ tools/linguist/shared/proitems.cpp | 485 +-- tools/linguist/shared/proitems.h | 354 +- tools/linguist/shared/proparser.pri | 13 +- tools/linguist/shared/proparser_global.h | 48 + tools/linguist/shared/proparserutils.h | 324 -- 14 files changed, 4709 insertions(+), 2581 deletions(-) delete mode 100644 tools/linguist/shared/abstractproitemvisitor.h create mode 100644 tools/linguist/shared/ioutils.cpp create mode 100644 tools/linguist/shared/ioutils.h create mode 100644 tools/linguist/shared/profileparser.cpp create mode 100644 tools/linguist/shared/profileparser.h create mode 100644 tools/linguist/shared/proparser_global.h delete mode 100644 tools/linguist/shared/proparserutils.h diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 96b1926..f9e08a0 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -40,7 +40,9 @@ ****************************************************************************/ #include "translator.h" -#include "profileevaluator.h" + +#include +#include #ifndef QT_BOOTSTRAPPED #include @@ -58,6 +60,8 @@ QT_USE_NAMESPACE #ifdef QT_BOOTSTRAPPED +static QString binDir; + static void initBinaryDir( #ifndef Q_OS_WIN const char *argv0 @@ -185,6 +189,40 @@ static bool releaseTsFile(const QString& tsFileName, return releaseTranslator(tor, qmFileName, cd, removeIdentical); } +static void print(const QString &fileName, int lineNo, const QString &msg) +{ + if (lineNo) + printErr(QString::fromLatin1("%2(%1): %3").arg(lineNo).arg(fileName, msg)); + else + printErr(msg); +} + +class ParseHandler : public ProFileParserHandler { +public: + virtual void parseError(const QString &fileName, int lineNo, const QString &msg) + { if (verbose) print(fileName, lineNo, msg); } + + bool verbose; +}; + +class EvalHandler : public ProFileEvaluatorHandler { +public: + virtual void configError(const QString &msg) + { printErr(msg); } + virtual void evalError(const QString &fileName, int lineNo, const QString &msg) + { if (verbose) print(fileName, lineNo, msg); } + virtual void fileMessage(const QString &msg) + { printErr(msg); } + + virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {} + virtual void doneWithEval(ProFile *) {} + + bool verbose; +}; + +static ParseHandler parseHandler; +static EvalHandler evalHandler; + int main(int argc, char **argv) { #ifdef QT_BOOTSTRAPPED @@ -272,23 +310,32 @@ int main(int argc, char **argv) if (inputFile.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) || inputFile.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { QFileInfo fi(inputFile); - ProFile pro(fi.absoluteFilePath()); - ProFileEvaluator visitor; - visitor.setVerbose(cd.isVerbose()); + parseHandler.verbose = evalHandler.verbose = cd.isVerbose(); + ProFileOption option; +#ifdef QT_BOOTSTRAPPED + option.initProperties(binDir + QLatin1String("/qmake")); +#else + option.initProperties(app.applicationDirPath() + QLatin1String("/qmake")); +#endif + ProFileParser parser(0, &parseHandler); + ProFileEvaluator visitor(&option, &parser, &evalHandler); - if (!visitor.queryProFile(&pro)) { + ProFile *pro; + if (!(pro = parser.parsedProFile(QDir::cleanPath(fi.absoluteFilePath())))) { printErr(LR::tr( "lrelease error: cannot read project file '%1'.\n") .arg(inputFile)); continue; } - if (!visitor.accept(&pro)) { + if (!visitor.accept(pro)) { printErr(LR::tr( "lrelease error: cannot process project file '%1'.\n") .arg(inputFile)); + pro->deref(); continue; } + pro->deref(); QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); if (translations.isEmpty()) { @@ -324,8 +371,6 @@ int main(int argc, char **argv) # include #endif -static QString binDir; - static void initBinaryDir( #ifndef Q_OS_WIN const char *_argv0 diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 737bfd0..34bb792 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -42,6 +42,7 @@ #include "lupdate.h" #include +#include #include #include @@ -227,6 +228,40 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil } } +static void print(const QString &fileName, int lineNo, const QString &msg) +{ + if (lineNo) + printErr(QString::fromLatin1("%2(%1): %3").arg(lineNo).arg(fileName, msg)); + else + printErr(msg); +} + +class ParseHandler : public ProFileParserHandler { +public: + virtual void parseError(const QString &fileName, int lineNo, const QString &msg) + { if (verbose) print(fileName, lineNo, msg); } + + bool verbose; +}; + +class EvalHandler : public ProFileEvaluatorHandler { +public: + virtual void configError(const QString &msg) + { printErr(msg); } + virtual void evalError(const QString &fileName, int lineNo, const QString &msg) + { if (verbose) print(fileName, lineNo, msg); } + virtual void fileMessage(const QString &msg) + { printErr(msg); } + + virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {} + virtual void doneWithEval(ProFile *) {} + + bool verbose; +}; + +static ParseHandler parseHandler; +static EvalHandler evalHandler; + static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, const QString &projectDir, const ProFileEvaluator &visitor) { @@ -288,12 +323,14 @@ static void processSources(Translator &fetchedTor, static void processProjects( bool topLevel, bool nestComplain, const QStringList &proFiles, + ProFileOption *option, ProFileParser *parser, UpdateOptions options, const QByteArray &codecForSource, const QString &targetLanguage, const QString &sourceLanguage, Translator *parentTor, bool *fail); static void processProject( - bool nestComplain, const QFileInfo &pfi, ProFileEvaluator &visitor, + bool nestComplain, const QFileInfo &pfi, + ProFileOption *option, ProFileParser *parser, ProFileEvaluator &visitor, UpdateOptions options, const QByteArray &_codecForSource, const QString &targetLanguage, const QString &sourceLanguage, Translator *fetchedTor, bool *fail) @@ -321,7 +358,7 @@ static void processProject( else subProFiles << subPro; } - processProjects(false, nestComplain, subProFiles, options, codecForSource, + processProjects(false, nestComplain, subProFiles, option, parser, options, codecForSource, targetLanguage, sourceLanguage, fetchedTor, fail); } else { ConversionData cd; @@ -347,23 +384,25 @@ static void processProject( static void processProjects( bool topLevel, bool nestComplain, const QStringList &proFiles, + ProFileOption *option, ProFileParser *parser, UpdateOptions options, const QByteArray &codecForSource, const QString &targetLanguage, const QString &sourceLanguage, Translator *parentTor, bool *fail) { foreach (const QString &proFile, proFiles) { - ProFileEvaluator visitor; - visitor.setVerbose(options & Verbose); - - QHash lupdateConfig; - lupdateConfig.insert(QLatin1String("CONFIG"), QStringList(QLatin1String("lupdate_run"))); - visitor.addVariables(lupdateConfig); - QFileInfo pfi(proFile); - ProFile pro(pfi.absoluteFilePath()); - if (!visitor.queryProFile(&pro) || !visitor.accept(&pro)) { + + ProFileEvaluator visitor(option, parser, &evalHandler); + ProFile *pro; + if (!(pro = parser->parsedProFile(QDir::cleanPath(pfi.absoluteFilePath())))) { + if (topLevel) + *fail = true; + continue; + } + if (!visitor.accept(pro)) { if (topLevel) *fail = true; + pro->deref(); continue; } @@ -376,6 +415,7 @@ static void processProjects( } else if (nestComplain) { printErr(LU::tr("lupdate warning: TS files from command line " "prevent recursing into %1.\n").arg(proFile)); + pro->deref(); continue; } } @@ -387,6 +427,7 @@ static void processProjects( // This might mean either a buggy PRO file or an intentional detach - // we can't know without seeing the actual RHS of the assignment ... // Just assume correctness and be silent. + pro->deref(); continue; } Translator tor; @@ -398,9 +439,10 @@ static void processProjects( tor.setCodecName(tmp.last().toLatin1()); setCodec = true; } - processProject(false, pfi, visitor, options, codecForSource, + processProject(false, pfi, option, parser, visitor, options, codecForSource, targetLanguage, sourceLanguage, &tor, fail); updateTsFiles(tor, tsFiles, setCodec, sourceLanguage, targetLanguage, options, fail); + pro->deref(); continue; } noTrans: @@ -409,12 +451,13 @@ static void processProjects( printErr(LU::tr("lupdate warning: no TS files specified. Only diagnostics " "will be produced for '%1'.\n").arg(proFile)); Translator tor; - processProject(nestComplain, pfi, visitor, options, codecForSource, + processProject(nestComplain, pfi, option, parser, visitor, options, codecForSource, targetLanguage, sourceLanguage, &tor, fail); } else { - processProject(nestComplain, pfi, visitor, options, codecForSource, + processProject(nestComplain, pfi, option, parser, visitor, options, codecForSource, targetLanguage, sourceLanguage, parentTor, fail); } + pro->deref(); } } @@ -714,15 +757,22 @@ int main(int argc, char **argv) " Both project and source files / include paths specified.\n")); return 1; } + + parseHandler.verbose = evalHandler.verbose = !!(options & Verbose); + ProFileOption option; + option.initProperties(app.applicationDirPath() + QLatin1String("/qmake")); + option.setCommandLineArguments(QStringList() << QLatin1String("CONFIG+=lupdate_run")); + ProFileParser parser(0, &parseHandler); + if (!tsFileNames.isEmpty()) { Translator fetchedTor; fetchedTor.setCodecName(codecForTr); - processProjects(true, true, proFiles, options, QByteArray(), + processProjects(true, true, proFiles, &option, &parser, options, QByteArray(), targetLanguage, sourceLanguage, &fetchedTor, &fail); updateTsFiles(fetchedTor, tsFileNames, !codecForTr.isEmpty(), sourceLanguage, targetLanguage, options, &fail); } else { - processProjects(true, false, proFiles, options, QByteArray(), + processProjects(true, false, proFiles, &option, &parser, options, QByteArray(), targetLanguage, sourceLanguage, 0, &fail); } } diff --git a/tools/linguist/shared/abstractproitemvisitor.h b/tools/linguist/shared/abstractproitemvisitor.h deleted file mode 100644 index 73614c5..0000000 --- a/tools/linguist/shared/abstractproitemvisitor.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ABSTRACTPROITEMVISITOR -#define ABSTRACTPROITEMVISITOR - -#include "proitems.h" - -QT_BEGIN_NAMESPACE - -struct AbstractProItemVisitor -{ - virtual ~AbstractProItemVisitor() {} - - virtual ProItem::ProItemReturn visitBeginProBlock(ProBlock *block) = 0; - virtual void visitEndProBlock(ProBlock *block) = 0; - - virtual ProItem::ProItemReturn visitProLoopIteration() = 0; - virtual void visitProLoopCleanup() = 0; - - virtual void visitBeginProVariable(ProVariable *variable) = 0; - virtual void visitEndProVariable(ProVariable *variable) = 0; - - virtual ProItem::ProItemReturn visitBeginProFile(ProFile *value) = 0; - virtual ProItem::ProItemReturn visitEndProFile(ProFile *value) = 0; - - virtual void visitProValue(ProValue *value) = 0; - virtual ProItem::ProItemReturn visitProFunction(ProFunction *function) = 0; - virtual void visitProOperator(ProOperator *function) = 0; - virtual void visitProCondition(ProCondition *function) = 0; -}; - -QT_END_NAMESPACE - -#endif // ABSTRACTPROITEMVISITOR - diff --git a/tools/linguist/shared/ioutils.cpp b/tools/linguist/shared/ioutils.cpp new file mode 100644 index 0000000..fbee8fc --- /dev/null +++ b/tools/linguist/shared/ioutils.cpp @@ -0,0 +1,152 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "ioutils.h" + +#include +#include + +#ifdef Q_OS_WIN +# include +#else +# include +# include +# include +#endif + +using namespace ProFileEvaluatorInternal; + +IoUtils::FileType IoUtils::fileType(const QString &fileName) +{ + Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName)); +#ifdef Q_OS_WIN + DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16()); + if (attr == INVALID_FILE_ATTRIBUTES) + return FileNotFound; + return (attr & FILE_ATTRIBUTE_DIRECTORY) ? FileIsDir : FileIsRegular; +#else + struct ::stat st; + if (::stat(fileName.toLocal8Bit().constData(), &st)) + return FileNotFound; + return S_ISDIR(st.st_mode) ? FileIsDir : FileIsRegular; +#endif +} + +bool IoUtils::isRelativePath(const QString &path) +{ + if (path.startsWith(QLatin1Char('/'))) + return false; +#ifdef Q_OS_WIN + if (path.startsWith(QLatin1Char('\\'))) + return false; + // Unlike QFileInfo, this won't accept a relative path with a drive letter. + // Such paths result in a royal mess anyway ... + if (path.length() >= 3 && path.at(1) == QLatin1Char(':') && path.at(0).isLetter() + && (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) + return false; +#endif + return true; +} + +QStringRef IoUtils::fileName(const QString &fileName) +{ + return fileName.midRef(fileName.lastIndexOf(QLatin1Char('/')) + 1); +} + +QString IoUtils::resolvePath(const QString &baseDir, const QString &fileName) +{ + if (fileName.isEmpty()) + return QString(); + if (isAbsolutePath(fileName)) + return QDir::cleanPath(fileName); + return QDir::cleanPath(baseDir + QLatin1Char('/') + fileName); +} + +#ifdef QT_BOOTSTRAPPED +inline static bool isSpecialChar(ushort c) +{ + // Chars that should be quoted (TM). This includes: +#ifdef Q_OS_WIN + // - control chars & space + // - the shell meta chars "&()<>^| + // - the potential separators ,;= + static const uchar iqm[] = { + 0xff, 0xff, 0xff, 0xff, 0x45, 0x13, 0x00, 0x78, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10 + }; +#else + static const uchar iqm[] = { + 0xff, 0xff, 0xff, 0xff, 0xdf, 0x07, 0x00, 0xd8, + 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x78 + }; // 0-32 \'"$`<>|;&(){}*?#!~[] +#endif + + return (c < sizeof(iqm) * 8) && (iqm[c / 8] & (1 << (c & 7))); +} + +inline static bool hasSpecialChars(const QString &arg) +{ + for (int x = arg.length() - 1; x >= 0; --x) + if (isSpecialChar(arg.unicode()[x].unicode())) + return true; + return false; +} + +QString IoUtils::shellQuote(const QString &arg) +{ + if (!arg.length()) + return QString::fromLatin1("\"\""); + + QString ret(arg); + if (hasSpecialChars(ret)) { +#ifdef Q_OS_WIN + // Quotes are escaped and their preceding backslashes are doubled. + // It's impossible to escape anything inside a quoted string on cmd + // level, so the outer quoting must be "suspended". + ret.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\"\\1\\1\\^\"\"")); + // The argument must not end with a \ since this would be interpreted + // as escaping the quote -- rather put the \ behind the quote: e.g. + // rather use "foo"\ than "foo\" + int i = ret.length(); + while (i > 0 && ret.at(i - 1) == QLatin1Char('\\')) + --i; + ret.insert(i, QLatin1Char('"')); + ret.prepend(QLatin1Char('"')); +#else // Q_OS_WIN + ret.replace(QLatin1Char('\''), QLatin1String("'\\''")); + ret.prepend(QLatin1Char('\'')); + ret.append(QLatin1Char('\'')); +#endif // Q_OS_WIN + } + return ret; +} +#endif diff --git a/tools/linguist/shared/ioutils.h b/tools/linguist/shared/ioutils.h new file mode 100644 index 0000000..d04ddc7 --- /dev/null +++ b/tools/linguist/shared/ioutils.h @@ -0,0 +1,65 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#ifndef IOUTILS_H +#define IOUTILS_H + +#include + +namespace ProFileEvaluatorInternal { + +/*! + This class provides replacement functionality for QFileInfo, QFile & QDir, + as these are abysmally slow. +*/ +class IoUtils { +public: + enum FileType { + FileNotFound = 0, + FileIsRegular = 1, + FileIsDir = 2 + }; + + static FileType fileType(const QString &fileName); + static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; } + static bool isRelativePath(const QString &fileName); + static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); } + static QStringRef fileName(const QString &fileName); // Requires normalized path + static QString resolvePath(const QString &baseDir, const QString &fileName); +#ifdef QT_BOOTSTRAPPED + static QString shellQuote(const QString &arg); +#endif +}; + +} + +#endif // IOUTILS_H diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 0393768..f3b4c3d 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1,47 +1,39 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** This file is part of the Qt Linguist of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage +** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** ** Other Usage +** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #include "profileevaluator.h" -#include "proparserutils.h" -#include "proitems.h" + +#include "profileparser.h" +#include "ioutils.h" #include #include @@ -56,6 +48,9 @@ #include #include #include +#ifdef PROEVALUATOR_THREAD_SAFE +# include +#endif #ifdef Q_OS_UNIX #include @@ -74,966 +69,1482 @@ #define QT_PCLOSE pclose #endif +using namespace ProFileEvaluatorInternal; + QT_BEGIN_NAMESPACE +using namespace ProStringConstants; + + +#define fL1S(s) QString::fromLatin1(s) + /////////////////////////////////////////////////////////////////////// // -// Option +// ProFileOption // /////////////////////////////////////////////////////////////////////// -QString -Option::fixString(QString string, uchar flags) +ProFileOption::ProFileOption() { - // XXX Ripped out caching, so this will be slow. Should not matter for current uses. +#ifdef Q_OS_WIN + dirlist_sep = QLatin1Char(';'); + dir_sep = QLatin1Char('\\'); +#else + dirlist_sep = QLatin1Char(':'); + dir_sep = QLatin1Char('/'); +#endif + qmakespec = getEnv(QLatin1String("QMAKESPEC")); - //fix the environment variables - if (flags & Option::FixEnvVars) { - int rep; - QRegExp reg_variableName(QLatin1String("\\$\\(.*\\)")); - reg_variableName.setMinimal(true); - while ((rep = reg_variableName.indexIn(string)) != -1) - string.replace(rep, reg_variableName.matchedLength(), - QString::fromLocal8Bit(qgetenv(string.mid(rep + 2, reg_variableName.matchedLength() - 3).toLatin1().constData()).constData())); - } + host_mode = HOST_UNKNOWN_MODE; + target_mode = TARG_UNKNOWN_MODE; - //canonicalize it (and treat as a path) - if (flags & Option::FixPathCanonicalize) { -#if 0 - string = QFileInfo(string).canonicalFilePath(); +#ifdef PROEVALUATOR_THREAD_SAFE + base_inProgress = false; #endif - string = QDir::cleanPath(string); - } +} - if (string.length() > 2 && string[0].isLetter() && string[1] == QLatin1Char(':')) - string[0] = string[0].toLower(); +ProFileOption::~ProFileOption() +{ +} - //fix separators - Q_ASSERT(!((flags & Option::FixPathToLocalSeparators) && (flags & Option::FixPathToTargetSeparators))); - if (flags & Option::FixPathToLocalSeparators) { -#if defined(Q_OS_WIN32) - string = string.replace(QLatin1Char('/'), QLatin1Char('\\')); -#else - string = string.replace(QLatin1Char('\\'), QLatin1Char('/')); -#endif - } else if (flags & Option::FixPathToTargetSeparators) { - string = string.replace(QLatin1Char('/'), Option::dir_sep) - .replace(QLatin1Char('\\'), Option::dir_sep); +void ProFileOption::setCommandLineArguments(const QStringList &args) +{ + QStringList _precmds, _preconfigs, _postcmds, _postconfigs; + bool after = false; + + bool isConf = false; + foreach (const QString &arg, args) { + if (isConf) { + isConf = false; + if (after) + _postconfigs << arg; + else + _preconfigs << arg; + } else if (arg.startsWith(QLatin1Char('-'))) { + if (arg == QLatin1String("-after")) { + after = true; + } else if (arg == QLatin1String("-config")) { + isConf = true; + } else if (arg == QLatin1String("-win32")) { + host_mode = HOST_WIN_MODE; + target_mode = TARG_WIN_MODE; + } else if (arg == QLatin1String("-unix")) { + host_mode = HOST_UNIX_MODE; + target_mode = TARG_UNIX_MODE; + } else if (arg == QLatin1String("-macx")) { + host_mode = HOST_MACX_MODE; + target_mode = TARG_MACX_MODE; + } + } else if (arg.contains(QLatin1Char('='))) { + if (after) + _postcmds << arg; + else + _precmds << arg; + } } - if ((string.startsWith(QLatin1Char('"')) && string.endsWith(QLatin1Char('"'))) || - (string.startsWith(QLatin1Char('\'')) && string.endsWith(QLatin1Char('\'')))) - string = string.mid(1, string.length() - 2); + if (!_preconfigs.isEmpty()) + _precmds << (fL1S("CONFIG += ") + _preconfigs.join(fL1S(" "))); + precmds = _precmds.join(fL1S("\n")); + if (!_postconfigs.isEmpty()) + _postcmds << (fL1S("CONFIG += ") + _postconfigs.join(fL1S(" "))); + postcmds = _postcmds.join(fL1S("\n")); - return string; + if (host_mode != HOST_UNKNOWN_MODE) + applyHostMode(); +} + +void ProFileOption::applyHostMode() +{ + if (host_mode == HOST_WIN_MODE) { + dir_sep = fL1S("\\"); + } else { + dir_sep = fL1S("/"); + } +} + +QString ProFileOption::getEnv(const QString &var) const +{ +#ifndef QT_BOOTSTRAPPED + if (!environment.isEmpty()) + return environment.value(var); +#endif + return QString::fromLocal8Bit(qgetenv(var.toLocal8Bit().constData())); } +#ifdef PROEVALUATOR_INIT_PROPS +bool ProFileOption::initProperties(const QString &qmake) +{ + QByteArray data; +#ifndef QT_BOOTSTRAPPED + QProcess proc; + proc.start(qmake, QStringList() << QLatin1String("-query")); + if (!proc.waitForFinished()) + return false; + data = proc.readAll(); +#else + if (FILE *proc = QT_POPEN(QString(IoUtils::shellQuote(qmake) + QLatin1String(" -query")) + .toLocal8Bit(), "r")) { + char buff[1024]; + while (!feof(proc)) + data.append(buff, int(fread(buff, 1, 1023, proc))); + QT_PCLOSE(proc); + } +#endif + foreach (QByteArray line, data.split('\n')) + if (!line.startsWith("QMAKE_")) { + int off = line.indexOf(':'); + if (off < 0) // huh? + continue; + if (line.endsWith('\r')) + line.chop(1); + properties.insert(QString::fromLatin1(line.left(off)), + QString::fromLocal8Bit(line.mid(off + 1))); + } + return true; +} +#endif + /////////////////////////////////////////////////////////////////////// // // ProFileEvaluator::Private // /////////////////////////////////////////////////////////////////////// -class ProFileEvaluator::Private : public AbstractProItemVisitor +class ProFileEvaluator::Private { public: - Private(ProFileEvaluator *q_); + static void initStatics(); + Private(ProFileEvaluator *q_, ProFileOption *option, ProFileParser *parser, + ProFileEvaluatorHandler *handler); + ~Private(); ProFileEvaluator *q; - int m_lineNo; // Error reporting - bool m_verbose; - - /////////////// Reading pro file - - bool read(ProFile *pro); - - ProBlock *currentBlock(); - void updateItem(); - bool parseLine(const QString &line); - void insertVariable(const QString &line, int *i); - void insertOperator(const char op); - void insertComment(const QString &comment); - void enterScope(bool multiLine); - void leaveScope(); - void finalizeBlock(); - - QStack m_blockstack; - ProBlock *m_block; - - ProItem *m_commentItem; - QString m_proitem; - QString m_pendingComment; - bool m_syntaxError; - bool m_contNextLine; - bool m_inQuote; - int m_parens; - - /////////////// Evaluating pro file contents - - // implementation of AbstractProItemVisitor - ProItem::ProItemReturn visitBeginProBlock(ProBlock *block); - void visitEndProBlock(ProBlock *block); - ProItem::ProItemReturn visitProLoopIteration(); - void visitProLoopCleanup(); - void visitBeginProVariable(ProVariable *variable); - void visitEndProVariable(ProVariable *variable); - ProItem::ProItemReturn visitBeginProFile(ProFile *value); - ProItem::ProItemReturn visitEndProFile(ProFile *value); - void visitProValue(ProValue *value); - ProItem::ProItemReturn visitProFunction(ProFunction *function); - void visitProOperator(ProOperator *oper); - void visitProCondition(ProCondition *condition); - - QStringList valuesDirect(const QString &variableName) const { return m_valuemap[variableName]; } - QStringList values(const QString &variableName) const; - QStringList values(const QString &variableName, const ProFile *pro) const; - QStringList values(const QString &variableName, const QHash &place, - const ProFile *pro) const; - QString propertyValue(const QString &val) const; + enum VisitReturn { + ReturnFalse, + ReturnTrue, + ReturnBreak, + ReturnNext, + ReturnReturn + }; + + static ALWAYS_INLINE uint getBlockLen(const ushort *&tokPtr); + ProString getStr(const ushort *&tokPtr); + ProString getHashStr(const ushort *&tokPtr); + void evaluateExpression(const ushort *&tokPtr, ProStringList *ret, bool joined); + static ALWAYS_INLINE void skipStr(const ushort *&tokPtr); + static ALWAYS_INLINE void skipHashStr(const ushort *&tokPtr); + void skipExpression(const ushort *&tokPtr); + + void visitCmdLine(const QString &cmds); + VisitReturn visitProFile(ProFile *pro, ProFileEvaluatorHandler::EvalFileType type, + ProFileEvaluator::LoadFlags flags); + VisitReturn visitProBlock(ProFile *pro, const ushort *tokPtr); + VisitReturn visitProBlock(const ushort *tokPtr); + VisitReturn visitProLoop(const ProString &variable, const ushort *exprPtr, + const ushort *tokPtr); + void visitProFunctionDef(ushort tok, const ProString &name, const ushort *tokPtr); + void visitProVariable(ushort tok, const ProStringList &curr, const ushort *&tokPtr); + + static inline const ProString &map(const ProString &var); + QHash *findValues(const ProString &variableName, + QHash::Iterator *it); + ProStringList &valuesRef(const ProString &variableName); + ProStringList valuesDirect(const ProString &variableName) const; + ProStringList values(const ProString &variableName) const; + QString propertyValue(const QString &val, bool complain) const; + + ProStringList split_value_list(const QString &vals, const ProFile *source = 0); bool isActiveConfig(const QString &config, bool regex = false); - QStringList expandVariableReferences(const QString &value); - void doVariableReplace(QString *str); - QStringList evaluateExpandFunction(const QString &function, const QString &arguments); - QString format(const char *format) const; + ProStringList expandVariableReferences(const ProString &value, int *pos = 0, bool joined = false); + ProStringList expandVariableReferences(const ushort *&tokPtr, int sizeHint = 0, bool joined = false); + ProStringList evaluateExpandFunction(const ProString &function, const ProString &arguments); + ProStringList evaluateExpandFunction(const ProString &function, const ushort *&tokPtr); + ProStringList evaluateExpandFunction(const ProString &function, const ProStringList &args); + void evalError(const QString &msg) const; QString currentFileName() const; QString currentDirectory() const; ProFile *currentProFile() const; - - ProItem::ProItemReturn evaluateConditionalFunction(const QString &function, const QString &arguments); - bool evaluateFile(const QString &fileName); + QString resolvePath(const QString &fileName) const + { return IoUtils::resolvePath(currentDirectory(), fileName); } + + VisitReturn evaluateConditionalFunction(const ProString &function, const ProString &arguments); + VisitReturn evaluateConditionalFunction(const ProString &function, const ushort *&tokPtr); + VisitReturn evaluateConditionalFunction(const ProString &function, const ProStringList &args); + bool evaluateFileDirect(const QString &fileName, ProFileEvaluatorHandler::EvalFileType type, + ProFileEvaluator::LoadFlags flags); + bool evaluateFile(const QString &fileName, ProFileEvaluatorHandler::EvalFileType type, + ProFileEvaluator::LoadFlags flags); bool evaluateFeatureFile(const QString &fileName); + enum EvalIntoMode { EvalProOnly, EvalWithDefaults, EvalWithSetup }; + bool evaluateFileInto(const QString &fileName, ProFileEvaluatorHandler::EvalFileType type, + QHash *values, FunctionDefs *defs, + EvalIntoMode mode); // values are output-only, defs are input-only + + static ALWAYS_INLINE VisitReturn returnBool(bool b) + { return b ? ReturnTrue : ReturnFalse; } + + QList prepareFunctionArgs(const ushort *&tokPtr); + QList prepareFunctionArgs(const ProString &arguments); + ProStringList evaluateFunction(const FunctionDef &func, const QList &argumentsList, bool *ok); + VisitReturn evaluateBoolFunction(const FunctionDef &func, const QList &argumentsList, + const ProString &function); + + bool modesForGenerator(const QString &gen, + ProFileOption::HOST_MODE *host_mode, ProFileOption::TARG_MODE *target_mode) const; + void validateModes() const; + QStringList qmakeMkspecPaths() const; + QStringList qmakeFeaturePaths() const; + + QString expandEnvVars(const QString &str) const; + QString fixPathToLocalOS(const QString &str) const; + QString sysrootify(const QString &path, const QString &baseDir) const; + +#ifndef QT_BOOTSTRAPPED + void runProcess(QProcess *proc, const QString &command, QProcess::ProcessChannel chan) const; +#endif - static inline ProItem::ProItemReturn returnBool(bool b) - { return b ? ProItem::ReturnTrue : ProItem::ReturnFalse; } - - QStringList evaluateFunction(ProBlock *funcPtr, const QStringList &argumentsList, bool *ok); - - QStringList qmakeFeaturePaths(); - - struct State { - bool condition; - bool prevCondition; - } m_sts; - bool m_invertNext; // Short-lived, so not in State int m_skipLevel; + int m_loopLevel; // To report unexpected break() and next()s +#ifdef PROEVALUATOR_CUMULATIVE bool m_cumulative; - bool m_isFirstVariableValue; - QString m_lastVarName; - ProVariable::VariableOperator m_variableOperator; - QString m_origfile; - QString m_oldPath; // To restore the current path to the path - QStack m_profileStack; // To handle 'include(a.pri), so we can track back to 'a.pro' when finished with 'a.pri' - struct ProLoop { - QString variable; - QStringList oldVarVal; - QStringList list; - int index; - bool infinite; +#else + enum { m_cumulative = 0 }; +#endif + + struct Location { + Location() : pro(0), line(0) {} + Location(ProFile *_pro, int _line) : pro(_pro), line(_line) {} + ProFile *pro; + int line; }; - QStack m_loopStack; - // we need the following two variables for handling - // CONFIG = foo bar $$CONFIG - QHash m_tempValuemap; // used while evaluating (variable operator value1 value2 ...) - QHash > m_tempFilevaluemap; // used while evaluating (variable operator value1 value2 ...) + Location m_current; // Currently evaluated location + QStack m_locationStack; // All execution location changes + QStack m_profileStack; // Includes only - QHash m_valuemap; // VariableName must be us-ascii, the content however can be non-us-ascii. - QHash > m_filevaluemap; // Variables per include file - QHash m_properties; QString m_outputDir; - bool m_definingTest; - QString m_definingFunc; - QHash m_testFunctions; - QHash m_replaceFunctions; - QStringList m_returnValue; - QStack > m_valuemapStack; - QStack > > m_filevaluemapStack; + int m_listCount; + FunctionDefs m_functionDefs; + ProStringList m_returnValue; + QStack > m_valuemapStack; // VariableName must be us-ascii, the content however can be non-us-ascii. + QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString + + ProFileOption *m_option; + ProFileParser *m_parser; + ProFileEvaluatorHandler *m_handler; + + enum ExpandFunc { + E_INVALID = 0, E_MEMBER, E_FIRST, E_LAST, E_SIZE, E_CAT, E_FROMFILE, E_EVAL, E_LIST, + E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION, + E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND, + E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, + E_REPLACE + }; + + enum TestFunc { + T_INVALID = 0, T_REQUIRES, T_GREATERTHAN, T_LESSTHAN, T_EQUALS, + T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM, + T_RETURN, T_BREAK, T_NEXT, T_DEFINED, T_CONTAINS, T_INFILE, + T_COUNT, T_ISEMPTY, T_INCLUDE, T_LOAD, T_DEBUG, T_MESSAGE, T_IF + }; - int m_prevLineNo; // Checking whether we're assigning the same TARGET - ProFile *m_prevProFile; // See m_prevLineNo + enum VarName { + V_LITERAL_DOLLAR, V_LITERAL_HASH, V_LITERAL_WHITESPACE, + V_DIRLIST_SEPARATOR, V_DIR_SEPARATOR, + V_OUT_PWD, V_PWD, V_IN_PWD, + V__FILE_, V__LINE_, V__PRO_FILE_, V__PRO_FILE_PWD_, + V_QMAKE_HOST_arch, V_QMAKE_HOST_name, V_QMAKE_HOST_os, + V_QMAKE_HOST_version, V_QMAKE_HOST_version_string, + V__DATE_, V__QMAKE_CACHE_ + }; }; -Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::State, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::ProLoop, Q_MOVABLE_TYPE); +static struct { + QString field_sep; + QString strtrue; + QString strfalse; + QString strunix; + QString strmacx; + QString strmac; + QString strwin32; + QString strsymbian; + ProString strCONFIG; + ProString strARGS; + QString strDot; + QString strDotDot; + QString strever; + QString strforever; + ProString strTEMPLATE; + ProString strQMAKE_DIR_SEP; + QHash expands; + QHash functions; + QHash varList; + QHash varMap; + QRegExp reg_variableName; + ProStringList fakeValue; +} statics; + +void ProFileEvaluator::Private::initStatics() +{ + if (!statics.field_sep.isNull()) + return; + + statics.field_sep = QLatin1String(" "); + statics.strtrue = QLatin1String("true"); + statics.strfalse = QLatin1String("false"); + statics.strunix = QLatin1String("unix"); + statics.strmacx = QLatin1String("macx"); + statics.strmac = QLatin1String("mac"); + statics.strwin32 = QLatin1String("win32"); + statics.strsymbian = QLatin1String("symbian"); + statics.strCONFIG = ProString("CONFIG"); + statics.strARGS = ProString("ARGS"); + statics.strDot = QLatin1String("."); + statics.strDotDot = QLatin1String(".."); + statics.strever = QLatin1String("ever"); + statics.strforever = QLatin1String("forever"); + statics.strTEMPLATE = ProString("TEMPLATE"); + statics.strQMAKE_DIR_SEP = ProString("QMAKE_DIR_SEP"); + + statics.reg_variableName.setPattern(QLatin1String("\\$\\(.*\\)")); + statics.reg_variableName.setMinimal(true); + + statics.fakeValue.detach(); // It has to have a unique begin() value + + static const struct { + const char * const name; + const ExpandFunc func; + } expandInits[] = { + { "member", E_MEMBER }, + { "first", E_FIRST }, + { "last", E_LAST }, + { "size", E_SIZE }, + { "cat", E_CAT }, + { "fromfile", E_FROMFILE }, + { "eval", E_EVAL }, + { "list", E_LIST }, + { "sprintf", E_SPRINTF }, + { "join", E_JOIN }, + { "split", E_SPLIT }, + { "basename", E_BASENAME }, + { "dirname", E_DIRNAME }, + { "section", E_SECTION }, + { "find", E_FIND }, + { "system", E_SYSTEM }, + { "unique", E_UNIQUE }, + { "quote", E_QUOTE }, + { "escape_expand", E_ESCAPE_EXPAND }, + { "upper", E_UPPER }, + { "lower", E_LOWER }, + { "re_escape", E_RE_ESCAPE }, + { "files", E_FILES }, + { "prompt", E_PROMPT }, // interactive, so cannot be implemented + { "replace", E_REPLACE } + }; + for (unsigned i = 0; i < sizeof(expandInits)/sizeof(expandInits[0]); ++i) + statics.expands.insert(ProString(expandInits[i].name), expandInits[i].func); + + static const struct { + const char * const name; + const TestFunc func; + } testInits[] = { + { "requires", T_REQUIRES }, + { "greaterThan", T_GREATERTHAN }, + { "lessThan", T_LESSTHAN }, + { "equals", T_EQUALS }, + { "isEqual", T_EQUALS }, + { "exists", T_EXISTS }, + { "export", T_EXPORT }, + { "clear", T_CLEAR }, + { "unset", T_UNSET }, + { "eval", T_EVAL }, + { "CONFIG", T_CONFIG }, + { "if", T_IF }, + { "isActiveConfig", T_CONFIG }, + { "system", T_SYSTEM }, + { "return", T_RETURN }, + { "break", T_BREAK }, + { "next", T_NEXT }, + { "defined", T_DEFINED }, + { "contains", T_CONTAINS }, + { "infile", T_INFILE }, + { "count", T_COUNT }, + { "isEmpty", T_ISEMPTY }, + { "load", T_LOAD }, + { "include", T_INCLUDE }, + { "debug", T_DEBUG }, + { "message", T_MESSAGE }, + { "warning", T_MESSAGE }, + { "error", T_MESSAGE }, + }; + for (unsigned i = 0; i < sizeof(testInits)/sizeof(testInits[0]); ++i) + statics.functions.insert(ProString(testInits[i].name), testInits[i].func); + + static const char * const names[] = { + "LITERAL_DOLLAR", "LITERAL_HASH", "LITERAL_WHITESPACE", + "DIRLIST_SEPARATOR", "DIR_SEPARATOR", + "OUT_PWD", "PWD", "IN_PWD", + "_FILE_", "_LINE_", "_PRO_FILE_", "_PRO_FILE_PWD_", + "QMAKE_HOST.arch", "QMAKE_HOST.name", "QMAKE_HOST.os", + "QMAKE_HOST.version", "QMAKE_HOST.version_string", + "_DATE_", "_QMAKE_CACHE_" + }; + for (unsigned i = 0; i < sizeof(names)/sizeof(names[0]); ++i) + statics.varList.insert(ProString(names[i]), i); + + static const struct { + const char * const oldname, * const newname; + } mapInits[] = { + { "INTERFACES", "FORMS" }, + { "QMAKE_POST_BUILD", "QMAKE_POST_LINK" }, + { "TARGETDEPS", "POST_TARGETDEPS" }, + { "LIBPATH", "QMAKE_LIBDIR" }, + { "QMAKE_EXT_MOC", "QMAKE_EXT_CPP_MOC" }, + { "QMAKE_MOD_MOC", "QMAKE_H_MOD_MOC" }, + { "QMAKE_LFLAGS_SHAPP", "QMAKE_LFLAGS_APP" }, + { "PRECOMPH", "PRECOMPILED_HEADER" }, + { "PRECOMPCPP", "PRECOMPILED_SOURCE" }, + { "INCPATH", "INCLUDEPATH" }, + { "QMAKE_EXTRA_WIN_COMPILERS", "QMAKE_EXTRA_COMPILERS" }, + { "QMAKE_EXTRA_UNIX_COMPILERS", "QMAKE_EXTRA_COMPILERS" }, + { "QMAKE_EXTRA_WIN_TARGETS", "QMAKE_EXTRA_TARGETS" }, + { "QMAKE_EXTRA_UNIX_TARGETS", "QMAKE_EXTRA_TARGETS" }, + { "QMAKE_EXTRA_UNIX_INCLUDES", "QMAKE_EXTRA_INCLUDES" }, + { "QMAKE_EXTRA_UNIX_VARIABLES", "QMAKE_EXTRA_VARIABLES" }, + { "QMAKE_RPATH", "QMAKE_LFLAGS_RPATH" }, + { "QMAKE_FRAMEWORKDIR", "QMAKE_FRAMEWORKPATH" }, + { "QMAKE_FRAMEWORKDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS" } + }; + for (unsigned i = 0; i < sizeof(mapInits)/sizeof(mapInits[0]); ++i) + statics.varMap.insert(ProString(mapInits[i].oldname), + ProString(mapInits[i].newname)); +} + +const ProString &ProFileEvaluator::Private::map(const ProString &var) +{ + QHash::ConstIterator it = statics.varMap.constFind(var); + return (it != statics.varMap.constEnd()) ? it.value() : var; +} + -ProFileEvaluator::Private::Private(ProFileEvaluator *q_) - : q(q_) +ProFileEvaluator::Private::Private(ProFileEvaluator *q_, ProFileOption *option, + ProFileParser *parser, ProFileEvaluatorHandler *handler) + : q(q_), m_option(option), m_parser(parser), m_handler(handler) { - // Global parser state - m_prevLineNo = 0; - m_prevProFile = 0; + // So that single-threaded apps don't have to call initialize() for now. + initStatics(); // Configuration, more or less - m_verbose = true; +#ifdef PROEVALUATOR_CUMULATIVE m_cumulative = true; +#endif // Evaluator state - m_sts.condition = false; - m_sts.prevCondition = false; - m_invertNext = false; m_skipLevel = 0; - m_isFirstVariableValue = true; - m_definingFunc.clear(); + m_loopLevel = 0; + m_listCount = 0; + m_valuemapStack.push(QHash()); } -bool ProFileEvaluator::Private::read(ProFile *pro) +ProFileEvaluator::Private::~Private() { - QFile file(pro->fileName()); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - q->errorMessage(format("%1 not readable.").arg(pro->fileName())); - return false; - } - - // Parser state - m_block = 0; - m_commentItem = 0; - m_inQuote = false; - m_parens = 0; - m_contNextLine = false; - m_syntaxError = false; - m_lineNo = 1; - m_blockstack.clear(); - m_blockstack.push(pro); - - QTextStream ts(&file); - while (!ts.atEnd()) { - QString line = ts.readLine(); - if (!parseLine(line)) { - q->errorMessage(format(".pro parse failure.")); - return false; - } - ++m_lineNo; - } - return true; } -bool ProFileEvaluator::Private::parseLine(const QString &line0) -{ - if (m_blockstack.isEmpty()) - return false; - - int parens = m_parens; - bool inQuote = m_inQuote; - bool escaped = false; - QString line = line0.simplified(); +//////// Evaluator tools ///////// - for (int i = 0; !m_syntaxError && i < line.length(); ++i) { - ushort c = line.at(i).unicode(); - if (c == '#') { // Yep - no escaping possible - insertComment(line.mid(i + 1)); - escaped = m_contNextLine; - break; - } - if (!escaped) { - if (c == '\\') { - escaped = true; - m_proitem += c; - continue; - } else if (c == '"') { - inQuote = !inQuote; - m_proitem += c; - continue; - } - } else { - escaped = false; - } - if (!inQuote) { - if (c == '(') { - ++parens; - } else if (c == ')') { - --parens; - } else if (!parens) { - if (m_block && (m_block->blockKind() & ProBlock::VariableKind)) { - if (c == ' ') - updateItem(); - else - m_proitem += c; - continue; - } - if (c == ':') { - enterScope(false); - continue; - } - if (c == '{') { - enterScope(true); - continue; - } - if (c == '}') { - leaveScope(); - continue; - } - if (c == '=') { - insertVariable(line, &i); - continue; - } - if (c == '|' || c == '!') { - insertOperator(c); - continue; - } - } - } - - m_proitem += c; - } - m_inQuote = inQuote; - m_parens = parens; - m_contNextLine = escaped; - if (escaped) { - m_proitem.chop(1); - updateItem(); - return true; - } else { - if (!m_syntaxError) { - updateItem(); - finalizeBlock(); - return true; - } - return false; - } +uint ProFileEvaluator::Private::getBlockLen(const ushort *&tokPtr) +{ + uint len = *tokPtr++; + len |= (uint)*tokPtr++ << 16; + return len; } -void ProFileEvaluator::Private::finalizeBlock() +ProString ProFileEvaluator::Private::getStr(const ushort *&tokPtr) { - if (m_blockstack.isEmpty()) { - m_syntaxError = true; - } else { - if (m_blockstack.top()->blockKind() & ProBlock::SingleLine) - leaveScope(); - m_block = 0; - m_commentItem = 0; - } + uint len = *tokPtr++; + ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, NoHash); + ret.setSource(m_current.pro); + tokPtr += len; + return ret; } -void ProFileEvaluator::Private::insertVariable(const QString &line, int *i) +ProString ProFileEvaluator::Private::getHashStr(const ushort *&tokPtr) { - ProVariable::VariableOperator opkind; - - if (m_proitem.isEmpty()) // Line starting with '=', like a conflict marker - return; - - switch (m_proitem.at(m_proitem.length() - 1).unicode()) { - case '+': - m_proitem.chop(1); - opkind = ProVariable::AddOperator; - break; - case '-': - m_proitem.chop(1); - opkind = ProVariable::RemoveOperator; - break; - case '*': - m_proitem.chop(1); - opkind = ProVariable::UniqueAddOperator; - break; - case '~': - m_proitem.chop(1); - opkind = ProVariable::ReplaceOperator; - break; - default: - opkind = ProVariable::SetOperator; - } + uint hash = getBlockLen(tokPtr); + uint len = *tokPtr++; + ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, hash); + tokPtr += len; + return ret; +} - ProBlock *block = m_blockstack.top(); - m_proitem = m_proitem.trimmed(); - ProVariable *variable = new ProVariable(m_proitem, block); - variable->setLineNumber(m_lineNo); - variable->setVariableOperator(opkind); - block->appendItem(variable); - m_block = variable; - - if (!m_pendingComment.isEmpty()) { - m_block->setComment(m_pendingComment); - m_pendingComment.clear(); - } - m_commentItem = variable; +void ProFileEvaluator::Private::skipStr(const ushort *&tokPtr) +{ + uint len = *tokPtr++; + tokPtr += len; +} - m_proitem.clear(); +void ProFileEvaluator::Private::skipHashStr(const ushort *&tokPtr) +{ + tokPtr += 2; + uint len = *tokPtr++; + tokPtr += len; +} - if (opkind == ProVariable::ReplaceOperator) { - // skip util end of line or comment - while (1) { - ++(*i); +// FIXME: this should not build new strings for direct sections. +// Note that the E_SPRINTF and E_LIST implementations rely on the deep copy. +ProStringList ProFileEvaluator::Private::split_value_list(const QString &vals, const ProFile *source) +{ + QString build; + ProStringList ret; + QStack quote; - // end of line? - if (*i >= line.count()) - break; + const ushort SPACE = ' '; + const ushort LPAREN = '('; + const ushort RPAREN = ')'; + const ushort SINGLEQUOTE = '\''; + const ushort DOUBLEQUOTE = '"'; + const ushort BACKSLASH = '\\'; - // comment? - if (line.at(*i).unicode() == '#') { - --(*i); - break; - } + if (!source) + source = currentProFile(); + + ushort unicode; + const QChar *vals_data = vals.data(); + const int vals_len = vals.length(); + for (int x = 0, parens = 0; x < vals_len; x++) { + unicode = vals_data[x].unicode(); + if (x != (int)vals_len-1 && unicode == BACKSLASH && + (vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) { + build += vals_data[x++]; //get that 'escape' + } else if (!quote.isEmpty() && unicode == quote.top()) { + quote.pop(); + } else if (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE) { + quote.push(unicode); + } else if (unicode == RPAREN) { + --parens; + } else if (unicode == LPAREN) { + ++parens; + } - m_proitem += line.at(*i); + if (!parens && quote.isEmpty() && vals_data[x] == SPACE) { + ret << ProString(build, NoHash).setSource(source); + build.clear(); + } else { + build += vals_data[x]; } - m_proitem = m_proitem.trimmed(); } + if (!build.isEmpty()) + ret << ProString(build, NoHash).setSource(source); + return ret; } -void ProFileEvaluator::Private::insertOperator(const char op) +static void zipEmpty(ProStringList *value) { - updateItem(); - - ProOperator::OperatorKind opkind; - switch(op) { - case '!': - opkind = ProOperator::NotOperator; - break; - case '|': - opkind = ProOperator::OrOperator; - break; - default: - opkind = ProOperator::OrOperator; - } - - ProBlock * const block = currentBlock(); - ProOperator * const proOp = new ProOperator(opkind); - proOp->setLineNumber(m_lineNo); - block->appendItem(proOp); - m_commentItem = proOp; + for (int i = value->size(); --i >= 0;) + if (value->at(i).isEmpty()) + value->remove(i); } -void ProFileEvaluator::Private::insertComment(const QString &comment) +static void insertUnique(ProStringList *varlist, const ProStringList &value) { - updateItem(); - - QString strComment; - if (!m_commentItem) - strComment = m_pendingComment; - else - strComment = m_commentItem->comment(); - - if (strComment.isEmpty()) - strComment = comment; - else { - strComment += QLatin1Char('\n'); - strComment += comment.trimmed(); - } - - strComment = strComment.trimmed(); - - if (!m_commentItem) - m_pendingComment = strComment; - else - m_commentItem->setComment(strComment); + foreach (const ProString &str, value) + if (!str.isEmpty() && !varlist->contains(str)) + varlist->append(str); } -void ProFileEvaluator::Private::enterScope(bool multiLine) +static void removeAll(ProStringList *varlist, const ProString &value) { - updateItem(); - - ProBlock *parent = currentBlock(); - ProBlock *block = new ProBlock(parent); - block->setLineNumber(m_lineNo); - parent->setBlockKind(ProBlock::ScopeKind); - - parent->appendItem(block); - - if (multiLine) - block->setBlockKind(ProBlock::ScopeContentsKind); - else - block->setBlockKind(ProBlock::ScopeContentsKind|ProBlock::SingleLine); - - m_blockstack.push(block); - m_block = 0; + for (int i = varlist->size(); --i >= 0; ) + if (varlist->at(i) == value) + varlist->remove(i); } -void ProFileEvaluator::Private::leaveScope() +static void removeEach(ProStringList *varlist, const ProStringList &value) { - updateItem(); - m_blockstack.pop(); - finalizeBlock(); + foreach (const ProString &str, value) + if (!str.isEmpty()) + removeAll(varlist, str); } -ProBlock *ProFileEvaluator::Private::currentBlock() +static void replaceInList(ProStringList *varlist, + const QRegExp ®exp, const QString &replace, bool global, QString &tmp) { - if (m_block) - return m_block; - - ProBlock *parent = m_blockstack.top(); - m_block = new ProBlock(parent); - m_block->setLineNumber(m_lineNo); - parent->appendItem(m_block); - - if (!m_pendingComment.isEmpty()) { - m_block->setComment(m_pendingComment); - m_pendingComment.clear(); + for (ProStringList::Iterator varit = varlist->begin(); varit != varlist->end(); ) { + QString val = varit->toQString(tmp); + QString copy = val; // Force detach and have a reference value + val.replace(regexp, replace); + if (!val.isSharedWith(copy)) { + if (val.isEmpty()) { + varit = varlist->erase(varit); + } else { + (*varit).setValue(val, NoHash); + ++varit; + } + if (!global) + break; + } else { + ++varit; + } } +} - m_commentItem = m_block; - - return m_block; +QString ProFileEvaluator::Private::expandEnvVars(const QString &str) const +{ + QString string = str; + int rep; + QRegExp reg_variableName = statics.reg_variableName; // Copy for thread safety + while ((rep = reg_variableName.indexIn(string)) != -1) + string.replace(rep, reg_variableName.matchedLength(), + m_option->getEnv(string.mid(rep + 2, reg_variableName.matchedLength() - 3))); + return string; } -void ProFileEvaluator::Private::updateItem() +// This is braindead, but we want qmake compat +QString ProFileEvaluator::Private::fixPathToLocalOS(const QString &str) const { - m_proitem = m_proitem.trimmed(); - if (m_proitem.isEmpty()) - return; + QString string = expandEnvVars(str); - ProBlock *block = currentBlock(); - if (block->blockKind() & ProBlock::VariableKind) { - m_commentItem = new ProValue(m_proitem, static_cast(block)); - } else if (m_proitem.endsWith(QLatin1Char(')'))) { - m_commentItem = new ProFunction(m_proitem); - } else { - m_commentItem = new ProCondition(m_proitem); - } - m_commentItem->setLineNumber(m_lineNo); - block->appendItem(m_commentItem); + if (string.length() > 2 && string.at(0).isLetter() && string.at(1) == QLatin1Char(':')) + string[0] = string[0].toLower(); - m_proitem.clear(); +#if defined(Q_OS_WIN32) + string.replace(QLatin1Char('/'), QLatin1Char('\\')); +#else + string.replace(QLatin1Char('\\'), QLatin1Char('/')); +#endif + return string; } +static bool isTrue(const ProString &_str, QString &tmp) +{ + const QString &str = _str.toQString(tmp); + return !str.compare(statics.strtrue, Qt::CaseInsensitive) || str.toInt(); +} -ProItem::ProItemReturn ProFileEvaluator::Private::visitBeginProBlock(ProBlock *block) +//////// Evaluator ///////// + +static ALWAYS_INLINE void addStr( + const ProString &str, ProStringList *ret, bool &pending, bool joined) { - if (block->blockKind() & ProBlock::ScopeContentsKind) { - if (!m_definingFunc.isEmpty()) { - if (!m_skipLevel || m_cumulative) { - QHash *hash = - (m_definingTest ? &m_testFunctions : &m_replaceFunctions); - if (ProBlock *def = hash->value(m_definingFunc)) - def->deref(); - hash->insert(m_definingFunc, block); - block->ref(); - block->setBlockKind(block->blockKind() | ProBlock::FunctionBodyKind); - } - m_definingFunc.clear(); - return ProItem::ReturnSkip; - } else if (!(block->blockKind() & ProBlock::FunctionBodyKind)) { - if (!m_sts.condition) - ++m_skipLevel; - else - Q_ASSERT(!m_skipLevel); - } + if (joined) { + ret->last().append(str, &pending); } else { - if (!m_skipLevel) { - if (m_sts.condition) { - m_sts.prevCondition = true; - m_sts.condition = false; - } + if (!pending) { + pending = true; + *ret << str; } else { - Q_ASSERT(!m_sts.condition); + ret->last().append(str); } } - return ProItem::ReturnTrue; } -void ProFileEvaluator::Private::visitEndProBlock(ProBlock *block) +static ALWAYS_INLINE void addStrList( + const ProStringList &list, ushort tok, ProStringList *ret, bool &pending, bool joined) { - if ((block->blockKind() & ProBlock::ScopeContentsKind) - && !(block->blockKind() & ProBlock::FunctionBodyKind)) { - if (m_skipLevel) { - Q_ASSERT(!m_sts.condition); - --m_skipLevel; - } else if (!(block->blockKind() & ProBlock::SingleLine)) { - // Conditionals contained inside this block may have changed the state. - // So we reset it here to make an else following us do the right thing. - m_sts.condition = true; + if (!list.isEmpty()) { + if (joined) { + ret->last().append(list, &pending, !(tok & TokQuoted)); + } else { + if (tok & TokQuoted) { + if (!pending) { + pending = true; + *ret << ProString(); + } + ret->last().append(list); + } else { + if (!pending) { + // Another qmake bizzarity: if nothing is pending and the + // first element is empty, it will be eaten + if (!list.at(0).isEmpty()) { + // The common case + pending = true; + *ret += list; + return; + } + } else { + ret->last().append(list.at(0)); + } + // This is somewhat slow, but a corner case + for (int j = 1; j < list.size(); ++j) { + pending = true; + *ret << list.at(j); + } + } } } } -ProItem::ProItemReturn ProFileEvaluator::Private::visitProLoopIteration() -{ - ProLoop &loop = m_loopStack.top(); - - if (loop.infinite) { - if (!loop.variable.isEmpty()) - m_valuemap[loop.variable] = QStringList(QString::number(loop.index++)); - if (loop.index > 1000) { - q->errorMessage(format("ran into infinite loop (> 1000 iterations).")); - return ProItem::ReturnFalse; +void ProFileEvaluator::Private::evaluateExpression( + const ushort *&tokPtr, ProStringList *ret, bool joined) +{ + if (joined) + *ret << ProString(); + bool pending = false; + forever { + ushort tok = *tokPtr++; + if (tok & TokNewStr) + pending = false; + ushort maskedTok = tok & TokMask; + switch (maskedTok) { + case TokLine: + m_current.line = *tokPtr++; + break; + case TokLiteral: + addStr(getStr(tokPtr), ret, pending, joined); + break; + case TokHashLiteral: + addStr(getHashStr(tokPtr), ret, pending, joined); + break; + case TokVariable: + addStrList(values(map(getHashStr(tokPtr))), tok, ret, pending, joined); + break; + case TokProperty: + addStr(ProString(propertyValue( + getStr(tokPtr).toQString(m_tmp1), true), NoHash).setSource(currentProFile()), + ret, pending, joined); + break; + case TokEnvVar: + addStrList(split_value_list(m_option->getEnv(getStr(tokPtr).toQString(m_tmp1))), + tok, ret, pending, joined); + break; + case TokFuncName: { + ProString func = getHashStr(tokPtr); + addStrList(evaluateExpandFunction(func, tokPtr), tok, ret, pending, joined); + break; } + default: + tokPtr--; + return; } - } else { - QString val; - do { - if (loop.index >= loop.list.count()) - return ProItem::ReturnFalse; - val = loop.list.at(loop.index++); - } while (val.isEmpty()); // stupid, but qmake is like that - m_valuemap[loop.variable] = QStringList(val); } - return ProItem::ReturnTrue; } -void ProFileEvaluator::Private::visitProLoopCleanup() +void ProFileEvaluator::Private::skipExpression(const ushort *&pTokPtr) { - ProLoop &loop = m_loopStack.top(); - m_valuemap[loop.variable] = loop.oldVarVal; - m_loopStack.pop_back(); + const ushort *tokPtr = pTokPtr; + forever { + ushort tok = *tokPtr++; + switch (tok) { + case TokLine: + m_current.line = *tokPtr++; + break; + case TokValueTerminator: + case TokFuncTerminator: + pTokPtr = tokPtr; + return; + case TokArgSeparator: + break; + default: + switch (tok & TokMask) { + case TokLiteral: + case TokProperty: + case TokEnvVar: + skipStr(tokPtr); + break; + case TokHashLiteral: + case TokVariable: + skipHashStr(tokPtr); + break; + case TokFuncName: + skipHashStr(tokPtr); + pTokPtr = tokPtr; + skipExpression(pTokPtr); + tokPtr = pTokPtr; + break; + default: + Q_ASSERT_X(false, "skipExpression", "Unrecognized token"); + break; + } + } + } } -void ProFileEvaluator::Private::visitBeginProVariable(ProVariable *variable) -{ - m_lastVarName = variable->variable(); - m_variableOperator = variable->variableOperator(); - m_isFirstVariableValue = true; - m_tempValuemap = m_valuemap; - m_tempFilevaluemap = m_filevaluemap; +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProBlock( + ProFile *pro, const ushort *tokPtr) +{ + m_current.pro = pro; + m_current.line = 0; + return visitProBlock(tokPtr); +} + +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProBlock( + const ushort *tokPtr) +{ + ProStringList curr; + bool okey = true, or_op = false, invert = false; + uint blockLen; + VisitReturn ret = ReturnTrue; + while (ushort tok = *tokPtr++) { + switch (tok) { + case TokLine: + m_current.line = *tokPtr++; + continue; + case TokAssign: + case TokAppend: + case TokAppendUnique: + case TokRemove: + case TokReplace: + visitProVariable(tok, curr, tokPtr); + curr.clear(); + continue; + case TokBranch: + blockLen = getBlockLen(tokPtr); + if (m_cumulative) { + if (!okey) + m_skipLevel++; + ret = blockLen ? visitProBlock(tokPtr) : ReturnTrue; + tokPtr += blockLen; + blockLen = getBlockLen(tokPtr); + if (!okey) + m_skipLevel--; + else + m_skipLevel++; + if ((ret == ReturnTrue || ret == ReturnFalse) && blockLen) + ret = visitProBlock(tokPtr); + if (okey) + m_skipLevel--; + } else { + if (okey) + ret = blockLen ? visitProBlock(tokPtr) : ReturnTrue; + tokPtr += blockLen; + blockLen = getBlockLen(tokPtr); + if (!okey) + ret = blockLen ? visitProBlock(tokPtr) : ReturnTrue; + } + tokPtr += blockLen; + okey = true, or_op = false; // force next evaluation + break; + case TokForLoop: + if (m_cumulative) { // This is a no-win situation, so just pretend it's no loop + skipHashStr(tokPtr); + uint exprLen = getBlockLen(tokPtr); + tokPtr += exprLen; + blockLen = getBlockLen(tokPtr); + ret = visitProBlock(tokPtr); + } else if (okey != or_op) { + const ProString &variable = getHashStr(tokPtr); + uint exprLen = getBlockLen(tokPtr); + const ushort *exprPtr = tokPtr; + tokPtr += exprLen; + blockLen = getBlockLen(tokPtr); + ret = visitProLoop(variable, exprPtr, tokPtr); + } else { + skipHashStr(tokPtr); + uint exprLen = getBlockLen(tokPtr); + tokPtr += exprLen; + blockLen = getBlockLen(tokPtr); + ret = ReturnTrue; + } + tokPtr += blockLen; + okey = true, or_op = false; // force next evaluation + break; + case TokTestDef: + case TokReplaceDef: + if (m_cumulative || okey != or_op) { + const ProString &name = getHashStr(tokPtr); + blockLen = getBlockLen(tokPtr); + visitProFunctionDef(tok, name, tokPtr); + } else { + skipHashStr(tokPtr); + blockLen = getBlockLen(tokPtr); + } + tokPtr += blockLen; + okey = true, or_op = false; // force next evaluation + continue; + case TokNot: + invert ^= true; + continue; + case TokAnd: + or_op = false; + continue; + case TokOr: + or_op = true; + continue; + case TokCondition: + if (!m_skipLevel && okey != or_op) { + if (curr.size() != 1) { + if (!m_cumulative || !curr.isEmpty()) + evalError(fL1S("Conditional must expand to exactly one word.")); + okey = false; + } else { + okey = isActiveConfig(curr.at(0).toQString(m_tmp2), true) ^ invert; + } + } + or_op = !okey; // tentatively force next evaluation + invert = false; + curr.clear(); + continue; + case TokTestCall: + if (!m_skipLevel && okey != or_op) { + if (curr.size() != 1) { + if (!m_cumulative || !curr.isEmpty()) + evalError(fL1S("Test name must expand to exactly one word.")); + skipExpression(tokPtr); + okey = false; + } else { + ret = evaluateConditionalFunction(curr.at(0), tokPtr); + switch (ret) { + case ReturnTrue: okey = true; break; + case ReturnFalse: okey = false; break; + default: return ret; + } + okey ^= invert; + } + } else if (m_cumulative) { + m_skipLevel++; + if (curr.size() != 1) + skipExpression(tokPtr); + else + evaluateConditionalFunction(curr.at(0), tokPtr); + m_skipLevel--; + } else { + skipExpression(tokPtr); + } + or_op = !okey; // tentatively force next evaluation + invert = false; + curr.clear(); + continue; + default: { + const ushort *oTokPtr = --tokPtr; + evaluateExpression(tokPtr, &curr, false); + if (tokPtr != oTokPtr) + continue; + } + Q_ASSERT_X(false, "visitProBlock", "unexpected item type"); + } + if (ret != ReturnTrue && ret != ReturnFalse) + break; + } + return ret; } -void ProFileEvaluator::Private::visitEndProVariable(ProVariable *variable) -{ - Q_UNUSED(variable); - m_valuemap = m_tempValuemap; - m_filevaluemap = m_tempFilevaluemap; - m_lastVarName.clear(); -} -void ProFileEvaluator::Private::visitProOperator(ProOperator *oper) +void ProFileEvaluator::Private::visitProFunctionDef( + ushort tok, const ProString &name, const ushort *tokPtr) { - m_invertNext = (oper->operatorKind() == ProOperator::NotOperator); + QHash *hash = + (tok == TokTestDef + ? &m_functionDefs.testFunctions + : &m_functionDefs.replaceFunctions); + hash->insert(name, FunctionDef(m_current.pro, tokPtr - m_current.pro->tokPtr())); } -void ProFileEvaluator::Private::visitProCondition(ProCondition *cond) +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProLoop( + const ProString &_variable, const ushort *exprPtr, const ushort *tokPtr) { - if (!m_skipLevel) { - if (!cond->text().compare(QLatin1String("else"), Qt::CaseInsensitive)) { - m_sts.condition = !m_sts.prevCondition; - } else { - m_sts.prevCondition = false; - if (!m_sts.condition && isActiveConfig(cond->text(), true) ^ m_invertNext) - m_sts.condition = true; + VisitReturn ret = ReturnTrue; + bool infinite = false; + int index = 0; + ProString variable; + ProStringList oldVarVal; + ProString it_list = expandVariableReferences(exprPtr, 0, true).at(0); + if (_variable.isEmpty()) { + if (it_list != statics.strever) { + evalError(fL1S("Invalid loop expression.")); + return ReturnFalse; } + it_list = ProString(statics.strforever); + } else { + variable = map(_variable); + oldVarVal = valuesDirect(variable); } - m_invertNext = false; -} - -ProItem::ProItemReturn ProFileEvaluator::Private::visitBeginProFile(ProFile * pro) -{ - PRE(pro); - m_lineNo = pro->lineNumber(); - if (m_origfile.isEmpty()) - m_origfile = pro->fileName(); - if (m_oldPath.isEmpty()) { - // change the working directory for the initial profile we visit, since - // that is *the* profile. All the other times we reach this function will be due to - // include(file) or load(file) - - m_oldPath = QDir::currentPath(); - - m_profileStack.push(pro); - - const QString mkspecDirectory = propertyValue(QLatin1String("QMAKE_MKSPECS")); - if (!mkspecDirectory.isEmpty()) { - bool cumulative = m_cumulative; - m_cumulative = false; - // This is what qmake does, everything set in the mkspec is also set - // But this also creates a lot of problems - evaluateFile(mkspecDirectory + QLatin1String("/default/qmake.conf")); - evaluateFile(mkspecDirectory + QLatin1String("/features/default_pre.prf")); - m_cumulative = cumulative; - } - - return returnBool(QDir::setCurrent(pro->directoryName())); - } - - return ProItem::ReturnTrue; -} - -ProItem::ProItemReturn ProFileEvaluator::Private::visitEndProFile(ProFile * pro) -{ - PRE(pro); - m_lineNo = pro->lineNumber(); - if (m_profileStack.count() == 1 && !m_oldPath.isEmpty()) { - const QString &mkspecDirectory = propertyValue(QLatin1String("QMAKE_MKSPECS")); - if (!mkspecDirectory.isEmpty()) { - bool cumulative = m_cumulative; - m_cumulative = false; - - evaluateFile(mkspecDirectory + QLatin1String("/features/default_post.prf")); - - QSet processed; - forever { - bool finished = true; - QStringList configs = valuesDirect(QLatin1String("CONFIG")); - for (int i = configs.size() - 1; i >= 0; --i) { - const QString config = configs[i].toLower(); - if (!processed.contains(config)) { - processed.insert(config); - if (evaluateFile(mkspecDirectory + QLatin1String("/features/") - + config + QLatin1String(".prf"))) { - finished = false; - break; + ProStringList list = valuesDirect(it_list); + if (list.isEmpty()) { + if (it_list == statics.strforever) { + infinite = true; + } else { + const QString &itl = it_list.toQString(m_tmp1); + int dotdot = itl.indexOf(statics.strDotDot); + if (dotdot != -1) { + bool ok; + int start = itl.left(dotdot).toInt(&ok); + if (ok) { + int end = itl.mid(dotdot+2).toInt(&ok); + if (ok) { + if (start < end) { + for (int i = start; i <= end; i++) + list << ProString(QString::number(i), NoHash); + } else { + for (int i = start; i >= end; i--) + list << ProString(QString::number(i), NoHash); } } } - if (finished) - break; } - - foreach (ProBlock *itm, m_replaceFunctions) - itm->deref(); - m_replaceFunctions.clear(); - foreach (ProBlock *itm, m_testFunctions) - itm->deref(); - m_testFunctions.clear(); - - m_cumulative = cumulative; } - - m_profileStack.pop(); - return returnBool(QDir::setCurrent(m_oldPath)); } - return ProItem::ReturnTrue; -} - -static void replaceInList(QStringList *varlist, - const QRegExp ®exp, const QString &replace, bool global) -{ - for (QStringList::Iterator varit = varlist->begin(); varit != varlist->end(); ) { - if ((*varit).contains(regexp)) { - (*varit).replace(regexp, replace); - if ((*varit).isEmpty()) - varit = varlist->erase(varit); - else - ++varit; - if(!global) + m_loopLevel++; + forever { + if (infinite) { + if (!variable.isEmpty()) + m_valuemapStack.top()[variable] = ProStringList(ProString(QString::number(index++), NoHash)); + if (index > 1000) { + evalError(fL1S("ran into infinite loop (> 1000 iterations).")); break; + } } else { - ++varit; + ProString val; + do { + if (index >= list.count()) + goto do_break; + val = list.at(index++); + } while (val.isEmpty()); // stupid, but qmake is like that + m_valuemapStack.top()[variable] = ProStringList(val); + } + + ret = visitProBlock(tokPtr); + switch (ret) { + case ReturnTrue: + case ReturnFalse: + break; + case ReturnNext: + ret = ReturnTrue; + break; + case ReturnBreak: + ret = ReturnTrue; + goto do_break; + default: + goto do_break; } } + do_break: + m_loopLevel--; + + if (!variable.isEmpty()) + m_valuemapStack.top()[variable] = oldVarVal; + return ret; } -void ProFileEvaluator::Private::visitProValue(ProValue *value) +void ProFileEvaluator::Private::visitProVariable( + ushort tok, const ProStringList &curr, const ushort *&tokPtr) { - PRE(value); - m_lineNo = value->lineNumber(); - QString val = value->value(); + int sizeHint = *tokPtr++; - QString varName = m_lastVarName; + if (curr.size() != 1) { + skipExpression(tokPtr); + if (!m_cumulative || !curr.isEmpty()) + evalError(fL1S("Left hand side of assignment must expand to exactly one word.")); + return; + } + const ProString &varName = map(curr.first()); - QStringList v = expandVariableReferences(val); + if (tok == TokReplace) { // ~= + // DEFINES ~= s/a/b/?[gqi] - // Since qmake combines different values for the TARGET variable, we join - // TARGET values that are on the same line. We can't do this later with all - // values because this parser isn't scope-aware, so we'd risk joining - // scope-specific targets together. - if (varName == QLatin1String("TARGET") - && m_lineNo == m_prevLineNo - && currentProFile() == m_prevProFile) { - QStringList targets = m_tempValuemap.value(QLatin1String("TARGET")); - m_tempValuemap.remove(QLatin1String("TARGET")); - QStringList lastTarget(targets.takeLast()); - lastTarget << v.join(QLatin1String(" ")); - targets.push_back(lastTarget.join(QLatin1String(" "))); - v = targets; - } - m_prevLineNo = m_lineNo; - m_prevProFile = currentProFile(); + const ProStringList &varVal = expandVariableReferences(tokPtr, sizeHint, true); + const QString &val = varVal.at(0).toQString(m_tmp1); + if (val.length() < 4 || val.at(0) != QLatin1Char('s')) { + evalError(fL1S("the ~= operator can handle only the s/// function.")); + return; + } + QChar sep = val.at(1); + QStringList func = val.split(sep); + if (func.count() < 3 || func.count() > 4) { + evalError(fL1S("the s/// function expects 3 or 4 arguments.")); + return; + } + + bool global = false, quote = false, case_sense = false; + if (func.count() == 4) { + global = func[3].indexOf(QLatin1Char('g')) != -1; + case_sense = func[3].indexOf(QLatin1Char('i')) == -1; + quote = func[3].indexOf(QLatin1Char('q')) != -1; + } + QString pattern = func[1]; + QString replace = func[2]; + if (quote) + pattern = QRegExp::escape(pattern); + + QRegExp regexp(pattern, case_sense ? Qt::CaseSensitive : Qt::CaseInsensitive); - switch (m_variableOperator) { - case ProVariable::SetOperator: // = + if (!m_skipLevel || m_cumulative) { + // We could make a union of modified and unmodified values, + // but this will break just as much as it fixes, so leave it as is. + replaceInList(&valuesRef(varName), regexp, replace, global, m_tmp2); + } + } else { + ProStringList varVal = expandVariableReferences(tokPtr, sizeHint); + switch (tok) { + default: // whatever - cannot happen + case TokAssign: // = if (!m_cumulative) { if (!m_skipLevel) { - if (m_isFirstVariableValue) { - m_tempValuemap[varName] = v; - m_tempFilevaluemap[currentProFile()][varName] = v; - } else { // handle lines "CONFIG = foo bar" - m_tempValuemap[varName] += v; - m_tempFilevaluemap[currentProFile()][varName] += v; - } + zipEmpty(&varVal); + m_valuemapStack.top()[varName] = varVal; } } else { - // We are greedy for values. - m_tempValuemap[varName] += v; - m_tempFilevaluemap[currentProFile()][varName] += v; + zipEmpty(&varVal); + if (!varVal.isEmpty()) { + // We are greedy for values. But avoid exponential growth. + ProStringList &v = valuesRef(varName); + if (v.isEmpty()) { + v = varVal; + } else { + ProStringList old = v; + v = varVal; + QSet has; + has.reserve(v.size()); + foreach (const ProString &s, v) + has.insert(s); + v.reserve(v.size() + old.size()); + foreach (const ProString &s, old) + if (!has.contains(s)) + v << s; + } + } } break; - case ProVariable::UniqueAddOperator: // *= - if (!m_skipLevel || m_cumulative) { - insertUnique(&m_tempValuemap, varName, v); - insertUnique(&m_tempFilevaluemap[currentProFile()], varName, v); - } + case TokAppendUnique: // *= + if (!m_skipLevel || m_cumulative) + insertUnique(&valuesRef(varName), varVal); break; - case ProVariable::AddOperator: // += + case TokAppend: // += if (!m_skipLevel || m_cumulative) { - m_tempValuemap[varName] += v; - m_tempFilevaluemap[currentProFile()][varName] += v; + zipEmpty(&varVal); + valuesRef(varName) += varVal; } break; - case ProVariable::RemoveOperator: // -= + case TokRemove: // -= if (!m_cumulative) { - if (!m_skipLevel) { - removeEach(&m_tempValuemap, varName, v); - removeEach(&m_tempFilevaluemap[currentProFile()], varName, v); - } + if (!m_skipLevel) + removeEach(&valuesRef(varName), varVal); } else { // We are stingy with our values, too. } break; - case ProVariable::ReplaceOperator: // ~= - { - // DEFINES ~= s/a/b/?[gqi] + } + } +} - doVariableReplace(&val); - if (val.length() < 4 || val[0] != QLatin1Char('s')) { - q->logMessage(format("the ~= operator can handle only the s/// function.")); - break; +void ProFileEvaluator::Private::visitCmdLine(const QString &cmds) +{ + if (!cmds.isEmpty()) { + if (ProFile *pro = m_parser->parsedProBlock(fL1S("(command line)"), cmds)) { + m_locationStack.push(m_current); + visitProBlock(pro, pro->tokPtr()); + m_current = m_locationStack.pop(); + pro->deref(); + } + } +} + +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile( + ProFile *pro, ProFileEvaluatorHandler::EvalFileType type, + ProFileEvaluator::LoadFlags flags) +{ + if (!m_cumulative && !pro->isOk()) + return ReturnFalse; + + m_handler->aboutToEval(currentProFile(), pro, type); + m_profileStack.push(pro); + if (flags & LoadPreFiles) { +#ifdef PROEVALUATOR_THREAD_SAFE + { + QMutexLocker locker(&m_option->mutex); + if (m_option->base_inProgress) { + QThreadPool::globalInstance()->releaseThread(); + m_option->cond.wait(&m_option->mutex); + QThreadPool::globalInstance()->reserveThread(); + } else +#endif + if (m_option->base_valuemap.isEmpty()) { +#ifdef PROEVALUATOR_THREAD_SAFE + m_option->base_inProgress = true; + locker.unlock(); +#endif + +#ifdef PROEVALUATOR_CUMULATIVE + bool cumulative = m_cumulative; + m_cumulative = false; +#endif + + // ### init QMAKE_QMAKE, QMAKE_SH + // ### init QMAKE_EXT_{C,H,CPP,OBJ} + // ### init TEMPLATE_PREFIX + + QString qmake_cache = m_option->cachefile; + if (qmake_cache.isEmpty() && !m_outputDir.isEmpty()) { //find it as it has not been specified + QDir dir(m_outputDir); + forever { + qmake_cache = dir.path() + QLatin1String("/.qmake.cache"); + if (IoUtils::exists(qmake_cache)) + break; + if (!dir.cdUp() || dir.isRoot()) { + qmake_cache.clear(); + break; + } + } } - QChar sep = val.at(1); - QStringList func = val.split(sep); - if (func.count() < 3 || func.count() > 4) { - q->logMessage(format("the s/// function expects 3 or 4 arguments.")); - break; + if (!qmake_cache.isEmpty()) { + qmake_cache = resolvePath(qmake_cache); + QHash cache_valuemap; + if (evaluateFileInto(qmake_cache, ProFileEvaluatorHandler::EvalConfigFile, + &cache_valuemap, 0, EvalProOnly)) { + if (m_option->qmakespec.isEmpty()) { + const ProStringList &vals = cache_valuemap.value(ProString("QMAKESPEC")); + if (!vals.isEmpty()) + m_option->qmakespec = vals.first().toQString(); + } + } else { + qmake_cache.clear(); + } + } + m_option->cachefile = qmake_cache; + + QStringList mkspec_roots = qmakeMkspecPaths(); + + QString qmakespec = expandEnvVars(m_option->qmakespec); + if (qmakespec.isEmpty()) { + foreach (const QString &root, mkspec_roots) { + QString mkspec = root + QLatin1String("/default"); + if (IoUtils::fileType(mkspec) == IoUtils::FileIsDir) { + qmakespec = mkspec; + break; + } + } + if (qmakespec.isEmpty()) { + m_handler->configError(fL1S("Could not find qmake configuration directory")); + // Unlike in qmake, not finding the spec is not critical ... + } } - bool global = false, quote = false, case_sense = false; - if (func.count() == 4) { - global = func[3].indexOf(QLatin1Char('g')) != -1; - case_sense = func[3].indexOf(QLatin1Char('i')) == -1; - quote = func[3].indexOf(QLatin1Char('q')) != -1; + if (IoUtils::isRelativePath(qmakespec)) { + if (IoUtils::exists(currentDirectory() + QLatin1Char('/') + qmakespec + + QLatin1String("/qmake.conf"))) { + qmakespec = currentDirectory() + QLatin1Char('/') + qmakespec; + } else if (!m_outputDir.isEmpty() + && IoUtils::exists(m_outputDir + QLatin1Char('/') + qmakespec + + QLatin1String("/qmake.conf"))) { + qmakespec = m_outputDir + QLatin1Char('/') + qmakespec; + } else { + foreach (const QString &root, mkspec_roots) { + QString mkspec = root + QLatin1Char('/') + qmakespec; + if (IoUtils::exists(mkspec)) { + qmakespec = mkspec; + goto cool; + } + } + m_handler->configError(fL1S("Could not find qmake configuration file")); + // Unlike in qmake, a missing config is not critical ... + qmakespec.clear(); + cool: ; + } } - QString pattern = func[1]; - QString replace = func[2]; - if (quote) - pattern = QRegExp::escape(pattern); - - QRegExp regexp(pattern, case_sense ? Qt::CaseSensitive : Qt::CaseInsensitive); - - if (!m_skipLevel || m_cumulative) { - // We could make a union of modified and unmodified values, - // but this will break just as much as it fixes, so leave it as is. - replaceInList(&m_tempValuemap[varName], regexp, replace, global); - replaceInList(&m_tempFilevaluemap[currentProFile()][varName], regexp, replace, global); + + if (!qmakespec.isEmpty()) { + m_option->qmakespec = QDir::cleanPath(qmakespec); + + QString spec = m_option->qmakespec + QLatin1String("/qmake.conf"); + if (!evaluateFileDirect(spec, ProFileEvaluatorHandler::EvalConfigFile, + ProFileEvaluator::LoadProOnly)) { + m_handler->configError( + fL1S("Could not read qmake configuration file %1").arg(spec)); + } else if (!m_option->cachefile.isEmpty()) { + evaluateFileDirect(m_option->cachefile, + ProFileEvaluatorHandler::EvalConfigFile, + ProFileEvaluator::LoadProOnly); + } + m_option->qmakespec_name = IoUtils::fileName(m_option->qmakespec).toString(); + if (m_option->qmakespec_name == QLatin1String("default")) { +#ifdef Q_OS_UNIX + char buffer[1024]; + int l = ::readlink(m_option->qmakespec.toLocal8Bit().constData(), buffer, 1024); + if (l != -1) + m_option->qmakespec_name = + IoUtils::fileName(QString::fromLocal8Bit(buffer, l)).toString(); +#else + // We can't resolve symlinks as they do on Unix, so configure.exe puts + // the source of the qmake.conf at the end of the default/qmake.conf in + // the QMAKESPEC_ORG variable. + const ProStringList &spec_org = + m_option->base_valuemap.value(ProString("QMAKESPEC_ORIGINAL")); + if (!spec_org.isEmpty()) + m_option->qmakespec_name = + IoUtils::fileName(spec_org.first().toQString()).toString(); +#endif + } } + + evaluateFeatureFile(QLatin1String("default_pre.prf")); + + m_option->base_valuemap = m_valuemapStack.top(); + m_option->base_functions = m_functionDefs; + +#ifdef PROEVALUATOR_CUMULATIVE + m_cumulative = cumulative; +#endif + +#ifdef PROEVALUATOR_THREAD_SAFE + locker.relock(); + m_option->base_inProgress = false; + m_option->cond.wakeAll(); +#endif + goto fresh; } - break; +#ifdef PROEVALUATOR_THREAD_SAFE + } +#endif + + m_valuemapStack.top() = m_option->base_valuemap; + m_functionDefs = m_option->base_functions; + + fresh: + ProStringList &tgt = m_valuemapStack.top()[ProString("TARGET")]; + if (tgt.isEmpty()) + tgt.append(ProString(QFileInfo(pro->fileName()).baseName(), NoHash)); + visitCmdLine(m_option->precmds); } - m_isFirstVariableValue = false; -} -ProItem::ProItemReturn ProFileEvaluator::Private::visitProFunction(ProFunction *func) -{ - // Make sure that called subblocks don't inherit & destroy the state - bool invertThis = m_invertNext; - m_invertNext = false; - if (!m_skipLevel) - m_sts.prevCondition = false; - if (m_cumulative || !m_sts.condition) { - QString text = func->text(); - int lparen = text.indexOf(QLatin1Char('(')); - int rparen = text.lastIndexOf(QLatin1Char(')')); - Q_ASSERT(lparen < rparen); - QString arguments = text.mid(lparen + 1, rparen - lparen - 1); - QString funcName = text.left(lparen); - m_lineNo = func->lineNumber(); - ProItem::ProItemReturn result = evaluateConditionalFunction(funcName.trimmed(), arguments); - if (result != ProItem::ReturnFalse && result != ProItem::ReturnTrue) - return result; - if (!m_skipLevel && ((result == ProItem::ReturnTrue) ^ invertThis)) - m_sts.condition = true; + visitProBlock(pro, pro->tokPtr()); + + if (flags & LoadPostFiles) { + visitCmdLine(m_option->postcmds); + + evaluateFeatureFile(QLatin1String("default_post.prf")); + + QSet processed; + forever { + bool finished = true; + ProStringList configs = valuesDirect(statics.strCONFIG); + for (int i = configs.size() - 1; i >= 0; --i) { + QString config = configs.at(i).toQString(m_tmp1).toLower(); + if (!processed.contains(config)) { + config.detach(); + processed.insert(config); + if (evaluateFeatureFile(config)) { + finished = false; + break; + } + } + } + if (finished) + break; + } } - return ProItem::ReturnTrue; + m_profileStack.pop(); + m_handler->doneWithEval(currentProFile()); + + return ReturnTrue; } -QStringList ProFileEvaluator::Private::qmakeFeaturePaths() +QStringList ProFileEvaluator::Private::qmakeMkspecPaths() const +{ + QStringList ret; + const QString concat = QLatin1String("/mkspecs"); + + QString qmakepath = m_option->getEnv(QLatin1String("QMAKEPATH")); + if (!qmakepath.isEmpty()) + foreach (const QString &it, qmakepath.split(m_option->dirlist_sep)) + ret << QDir::cleanPath(it) + concat; + + QString builtIn = propertyValue(QLatin1String("QT_INSTALL_DATA"), false) + concat; + if (!ret.contains(builtIn)) + ret << builtIn; + + return ret; +} + +QStringList ProFileEvaluator::Private::qmakeFeaturePaths() const { + QString mkspecs_concat = QLatin1String("/mkspecs"); + QString features_concat = QLatin1String("/features"); QStringList concat; - { - const QString base_concat = QDir::separator() + QLatin1String("features"); - concat << base_concat + QDir::separator() + QLatin1String("mac"); - concat << base_concat + QDir::separator() + QLatin1String("macx"); - concat << base_concat + QDir::separator() + QLatin1String("unix"); - concat << base_concat + QDir::separator() + QLatin1String("win32"); - concat << base_concat + QDir::separator() + QLatin1String("mac9"); - concat << base_concat + QDir::separator() + QLatin1String("qnx6"); - concat << base_concat; + + validateModes(); + switch (m_option->target_mode) { + case ProFileOption::TARG_MACX_MODE: + concat << QLatin1String("/features/mac"); + concat << QLatin1String("/features/macx"); + concat << QLatin1String("/features/unix"); + break; + default: // Can't happen, just make the compiler shut up + case ProFileOption::TARG_UNIX_MODE: + concat << QLatin1String("/features/unix"); + break; + case ProFileOption::TARG_WIN_MODE: + concat << QLatin1String("/features/win32"); + break; + case ProFileOption::TARG_SYMBIAN_MODE: + concat << QLatin1String("/features/symbian"); + break; } - const QString mkspecs_concat = QDir::separator() + QLatin1String("mkspecs"); + concat << features_concat; + QStringList feature_roots; - QByteArray mkspec_path = qgetenv("QMAKEFEATURES"); - if (!mkspec_path.isNull()) - feature_roots += splitPathList(QString::fromLocal8Bit(mkspec_path)); - /* - if (prop) - feature_roots += splitPathList(prop->value("QMAKEFEATURES")); - if (!Option::mkfile::cachefile.isEmpty()) { - QString path; - int last_slash = Option::mkfile::cachefile.lastIndexOf(Option::dir_sep); - if (last_slash != -1) - path = Option::fixPathToLocalOS(Option::mkfile::cachefile.left(last_slash)); + + QString mkspec_path = m_option->getEnv(QLatin1String("QMAKEFEATURES")); + if (!mkspec_path.isEmpty()) + foreach (const QString &f, mkspec_path.split(m_option->dirlist_sep)) + feature_roots += resolvePath(f); + + feature_roots += propertyValue(QLatin1String("QMAKEFEATURES"), false).split( + m_option->dirlist_sep, QString::SkipEmptyParts); + + if (!m_option->cachefile.isEmpty()) { + QString path = m_option->cachefile.left(m_option->cachefile.lastIndexOf((ushort)'/')); foreach (const QString &concat_it, concat) feature_roots << (path + concat_it); } - */ - QByteArray qmakepath = qgetenv("QMAKEPATH"); + QString qmakepath = m_option->getEnv(QLatin1String("QMAKEPATH")); if (!qmakepath.isNull()) { - const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath)); + const QStringList lst = qmakepath.split(m_option->dirlist_sep); foreach (const QString &item, lst) { + QString citem = resolvePath(item); foreach (const QString &concat_it, concat) - feature_roots << (item + mkspecs_concat + concat_it); + feature_roots << (citem + mkspecs_concat + concat_it); } } - //if (!Option::mkfile::qmakespec.isEmpty()) - // feature_roots << Option::mkfile::qmakespec + QDir::separator() + "features"; - //if (!Option::mkfile::qmakespec.isEmpty()) { - // QFileInfo specfi(Option::mkfile::qmakespec); - // QDir specdir(specfi.absoluteFilePath()); - // while (!specdir.isRoot()) { - // if (!specdir.cdUp() || specdir.isRoot()) - // break; - // if (QFile::exists(specdir.path() + QDir::separator() + "features")) { - // foreach (const QString &concat_it, concat) - // feature_roots << (specdir.path() + concat_it); - // break; - // } - // } - //} + + if (!m_option->qmakespec.isEmpty()) { + QString qmakespec = resolvePath(m_option->qmakespec); + feature_roots << (qmakespec + features_concat); + + QDir specdir(qmakespec); + while (!specdir.isRoot()) { + if (!specdir.cdUp() || specdir.isRoot()) + break; + if (IoUtils::exists(specdir.path() + features_concat)) { + foreach (const QString &concat_it, concat) + feature_roots << (specdir.path() + concat_it); + break; + } + } + } + foreach (const QString &concat_it, concat) - feature_roots << (propertyValue(QLatin1String("QT_INSTALL_PREFIX")) + + feature_roots << (propertyValue(QLatin1String("QT_INSTALL_PREFIX"), false) + mkspecs_concat + concat_it); foreach (const QString &concat_it, concat) - feature_roots << (propertyValue(QLatin1String("QT_INSTALL_DATA")) + + feature_roots << (propertyValue(QLatin1String("QT_INSTALL_DATA"), false) + mkspecs_concat + concat_it); + + for (int i = 0; i < feature_roots.count(); ++i) + if (!feature_roots.at(i).endsWith((ushort)'/')) + feature_roots[i].append((ushort)'/'); + + feature_roots.removeDuplicates(); + return feature_roots; } -QString ProFileEvaluator::Private::propertyValue(const QString &name) const -{ - if (m_properties.contains(name)) - return m_properties.value(name); - if (name == QLatin1String("QT_INSTALL_PREFIX")) - return QLibraryInfo::location(QLibraryInfo::PrefixPath); - if (name == QLatin1String("QT_INSTALL_DATA")) - return QLibraryInfo::location(QLibraryInfo::DataPath); - if (name == QLatin1String("QT_INSTALL_DOCS")) - return QLibraryInfo::location(QLibraryInfo::DocumentationPath); - if (name == QLatin1String("QT_INSTALL_HEADERS")) - return QLibraryInfo::location(QLibraryInfo::HeadersPath); - if (name == QLatin1String("QT_INSTALL_LIBS")) - return QLibraryInfo::location(QLibraryInfo::LibrariesPath); - if (name == QLatin1String("QT_INSTALL_BINS")) - return QLibraryInfo::location(QLibraryInfo::BinariesPath); - if (name == QLatin1String("QT_INSTALL_PLUGINS")) - return QLibraryInfo::location(QLibraryInfo::PluginsPath); - if (name == QLatin1String("QT_INSTALL_TRANSLATIONS")) - return QLibraryInfo::location(QLibraryInfo::TranslationsPath); - if (name == QLatin1String("QT_INSTALL_CONFIGURATION")) - return QLibraryInfo::location(QLibraryInfo::SettingsPath); - if (name == QLatin1String("QT_INSTALL_EXAMPLES")) - return QLibraryInfo::location(QLibraryInfo::ExamplesPath); - if (name == QLatin1String("QT_INSTALL_DEMOS")) - return QLibraryInfo::location(QLibraryInfo::DemosPath); +QString ProFileEvaluator::Private::propertyValue(const QString &name, bool complain) const +{ + if (m_option->properties.contains(name)) + return m_option->properties.value(name); if (name == QLatin1String("QMAKE_MKSPECS")) - return qmake_mkspec_paths().join(Option::dirlist_sep); + return qmakeMkspecPaths().join(m_option->dirlist_sep); if (name == QLatin1String("QMAKE_VERSION")) return QLatin1String("1.0"); //### FIXME - //return qmake_version(); -#ifdef QT_VERSION_STR - if (name == QLatin1String("QT_VERSION")) - return QLatin1String(QT_VERSION_STR); -#endif - return QLatin1String("UNKNOWN"); //### + if (complain) + evalError(fL1S("Querying unknown property %1").arg(name)); + return QString(); } ProFile *ProFileEvaluator::Private::currentProFile() const @@ -1057,17 +1568,114 @@ QString ProFileEvaluator::Private::currentDirectory() const return cur->directoryName(); } -void ProFileEvaluator::Private::doVariableReplace(QString *str) +QString ProFileEvaluator::Private::sysrootify(const QString &path, const QString &baseDir) const { - *str = expandVariableReferences(*str).join(QString(Option::field_sep)); + const bool isHostSystemPath = m_option->sysroot.isEmpty() || path.startsWith(m_option->sysroot) + || path.startsWith(baseDir) || path.startsWith(m_outputDir); + return isHostSystemPath ? path : m_option->sysroot + path; } -QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &str) +#ifndef QT_BOOTSTRAPPED +void ProFileEvaluator::Private::runProcess(QProcess *proc, const QString &command, + QProcess::ProcessChannel chan) const { - QStringList ret; + proc->setWorkingDirectory(currentDirectory()); + if (!m_option->environment.isEmpty()) + proc->setProcessEnvironment(m_option->environment); +# ifdef Q_OS_WIN + proc->setNativeArguments(QLatin1String("/v:off /s /c \"") + command + QLatin1Char('"')); + proc->start(m_option->getEnv(QLatin1String("COMSPEC")), QStringList()); +# else + proc->start(QLatin1String("/bin/sh"), QStringList() << QLatin1String("-c") << command); +# endif + proc->waitForFinished(-1); + proc->setReadChannel(chan); + QByteArray errout = proc->readAll(); + if (errout.endsWith('\n')) + errout.chop(1); + m_handler->evalError(QString(), 0, QString::fromLocal8Bit(errout)); +} +#endif + +// The (QChar*)current->constData() constructs below avoid pointless detach() calls +// FIXME: This is inefficient. Should not make new string if it is a straight subsegment +static ALWAYS_INLINE void appendChar(ushort unicode, + QString *current, QChar **ptr, ProString *pending) +{ + if (!pending->isEmpty()) { + int len = pending->size(); + current->resize(current->size() + len); + ::memcpy((QChar*)current->constData(), pending->constData(), len * 2); + pending->clear(); + *ptr = (QChar*)current->constData() + len; + } + *(*ptr)++ = QChar(unicode); +} + +static void appendString(const ProString &string, + QString *current, QChar **ptr, ProString *pending) +{ + if (string.isEmpty()) + return; + QChar *uc = (QChar*)current->constData(); + int len; + if (*ptr != uc) { + len = *ptr - uc; + current->resize(current->size() + string.size()); + } else if (!pending->isEmpty()) { + len = pending->size(); + current->resize(current->size() + len + string.size()); + ::memcpy((QChar*)current->constData(), pending->constData(), len * 2); + pending->clear(); + } else { + *pending = string; + return; + } + *ptr = (QChar*)current->constData() + len; + ::memcpy(*ptr, string.constData(), string.size() * 2); + *ptr += string.size(); +} + +static void flushCurrent(ProStringList *ret, + QString *current, QChar **ptr, ProString *pending, bool joined) +{ + QChar *uc = (QChar*)current->constData(); + int len = *ptr - uc; + if (len) { + ret->append(ProString(QString(uc, len), NoHash)); + *ptr = uc; + } else if (!pending->isEmpty()) { + ret->append(*pending); + pending->clear(); + } else if (joined) { + ret->append(ProString()); + } +} + +static inline void flushFinal(ProStringList *ret, + const QString ¤t, const QChar *ptr, const ProString &pending, + const ProString &str, bool replaced, bool joined) +{ + int len = ptr - current.data(); + if (len) { + if (!replaced && len == str.size()) + ret->append(str); + else + ret->append(ProString(QString(current.data(), len), NoHash)); + } else if (!pending.isEmpty()) { + ret->append(pending); + } else if (joined) { + ret->append(ProString()); + } +} + +ProStringList ProFileEvaluator::Private::expandVariableReferences( + const ProString &str, int *pos, bool joined) +{ + ProStringList ret; // if (ok) // *ok = true; - if (str.isEmpty()) + if (str.isEmpty() && !pos) return ret; const ushort LSQUARE = '['; @@ -1082,42 +1690,45 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s const ushort DOT = '.'; const ushort SPACE = ' '; const ushort TAB = '\t'; + const ushort COMMA = ','; const ushort SINGLEQUOTE = '\''; const ushort DOUBLEQUOTE = '"'; - ushort unicode, quote = 0; - const QChar *str_data = str.data(); - const int str_len = str.length(); - - ushort term; - QString var, args; - - int replaced = 0; - QString current; - for (int i = 0; i < str_len; ++i) { - unicode = str_data[i].unicode(); - const int start_var = i; - if (unicode == DOLLAR && str_len > i+2) { - unicode = str_data[++i].unicode(); - if (unicode == DOLLAR) { - term = 0; - var.clear(); - args.clear(); + ushort unicode, quote = 0, parens = 0; + const ushort *str_data = (const ushort *)str.constData(); + const int str_len = str.size(); + + ProString var, args; + + bool replaced = false; + bool putSpace = false; + QString current; // Buffer for successively assembled string segments + current.resize(str.size()); + QChar *ptr = current.data(); + ProString pending; // Buffer for string segments from variables + // Only one of the above buffers can be filled at a given time. + for (int i = pos ? *pos : 0; i < str_len; ++i) { + unicode = str_data[i]; + if (unicode == DOLLAR) { + if (str_len > i+2 && str_data[i+1] == DOLLAR) { + ++i; + ushort term = 0; enum { VAR, ENVIRON, FUNCTION, PROPERTY } var_type = VAR; - unicode = str_data[++i].unicode(); + unicode = str_data[++i]; if (unicode == LSQUARE) { - unicode = str_data[++i].unicode(); + unicode = str_data[++i]; term = RSQUARE; var_type = PROPERTY; } else if (unicode == LCURLY) { - unicode = str_data[++i].unicode(); + unicode = str_data[++i]; var_type = VAR; term = RCURLY; } else if (unicode == LPAREN) { - unicode = str_data[++i].unicode(); + unicode = str_data[++i]; var_type = ENVIRON; term = RPAREN; } + int name_start = i; forever { if (!(unicode & (0xFF<<8)) && unicode != DOT && unicode != UNDERSCORE && @@ -1125,19 +1736,20 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s (unicode < 'a' || unicode > 'z') && (unicode < 'A' || unicode > 'Z') && (unicode < '0' || unicode > '9')) break; - var.append(QChar(unicode)); if (++i == str_len) break; - unicode = str_data[i].unicode(); + unicode = str_data[i]; // at this point, i points to either the 'term' or 'next' character (which is in unicode) } + var = str.mid(name_start, i - name_start); if (var_type == VAR && unicode == LPAREN) { var_type = FUNCTION; + name_start = i + 1; int depth = 0; forever { if (++i == str_len) break; - unicode = str_data[i].unicode(); + unicode = str_data[i]; if (unicode == LPAREN) { depth++; } else if (unicode == RPAREN) { @@ -1145,10 +1757,10 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s break; --depth; } - args.append(QChar(unicode)); } + args = str.mid(name_start, i - name_start); if (++i < str_len) - unicode = str_data[i].unicode(); + unicode = str_data[i]; else unicode = 0; // at this point i is pointing to the 'next' character (which is in unicode) @@ -1156,232 +1768,415 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s } if (term) { if (unicode != term) { - q->logMessage(format("Missing %1 terminator [found %2]") - .arg(QChar(term)) - .arg(unicode ? QString(unicode) : QString::fromLatin1(("end-of-line")))); + evalError(fL1S("Missing %1 terminator [found %2]") + .arg(QChar(term)) + .arg(unicode ? QString(unicode) : fL1S("end-of-line"))); // if (ok) // *ok = false; - return QStringList(); + if (pos) + *pos = str_len; + return ProStringList(); } } else { // move the 'cursor' back to the last char of the thing we were looking at --i; } - // since i never points to the 'next' character, there is no reason for this to be set - unicode = 0; - QStringList replacement; + ProStringList replacement; if (var_type == ENVIRON) { - replacement = split_value_list(QString::fromLocal8Bit(qgetenv(var.toLatin1().constData()))); + replacement = split_value_list(m_option->getEnv(var.toQString(m_tmp1))); } else if (var_type == PROPERTY) { - replacement << propertyValue(var); + replacement << ProString(propertyValue(var.toQString(m_tmp1), true), NoHash); } else if (var_type == FUNCTION) { - replacement << evaluateExpandFunction(var, args); + replacement += evaluateExpandFunction(var, args); } else if (var_type == VAR) { - replacement = values(var); + replacement = values(map(var)); } - if (!(replaced++) && start_var) - current = str.left(start_var); if (!replacement.isEmpty()) { - if (quote) { - current += replacement.join(QString(Option::field_sep)); + if (quote || joined) { + if (putSpace) { + putSpace = false; + if (!replacement.at(0).isEmpty()) // Bizarre, indeed + appendChar(' ', ¤t, &ptr, &pending); + } + appendString(ProString(replacement.join(statics.field_sep), NoHash), + ¤t, &ptr, &pending); } else { - current += replacement.takeFirst(); - if (!replacement.isEmpty()) { - if (!current.isEmpty()) - ret.append(current); - current = replacement.takeLast(); - if (!replacement.isEmpty()) - ret += replacement; + appendString(replacement.at(0), ¤t, &ptr, &pending); + if (replacement.size() > 1) { + flushCurrent(&ret, ¤t, &ptr, &pending, false); + int j = 1; + if (replacement.size() > 2) { + // FIXME: ret.reserve(ret.size() + replacement.size() - 2); + for (; j < replacement.size() - 1; ++j) + ret << replacement.at(j); + } + pending = replacement.at(j); } } + replaced = true; } - } else { - if (replaced) - current.append(QLatin1Char('$')); + continue; } - } - if (quote && unicode == quote) { - unicode = 0; - quote = 0; } else if (unicode == BACKSLASH) { - bool escape = false; - const char *symbols = "[]{}()$\\'\""; - for (const char *s = symbols; *s; ++s) { - if (str_data[i+1].unicode() == (ushort)*s) { - i++; - escape = true; - if (!(replaced++)) - current = str.left(start_var); - current.append(str.at(i)); - break; - } + static const char symbols[] = "[]{}()$\\'\""; + ushort unicode2 = str_data[i+1]; + if (!(unicode2 & 0xff00) && strchr(symbols, unicode2)) { + unicode = unicode2; + ++i; + } + } else if (quote) { + if (unicode == quote) { + quote = 0; + continue; } - if (escape || !replaced) - unicode =0; - } else if (!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) { - quote = unicode; - unicode = 0; - if (!(replaced++) && i) - current = str.left(i); - } else if (!quote && (unicode == SPACE || unicode == TAB)) { - unicode = 0; - if (!current.isEmpty()) { - ret.append(current); - current.clear(); + } else { + if (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE) { + quote = unicode; + continue; + } else if (unicode == SPACE || unicode == TAB) { + if (!joined) + flushCurrent(&ret, ¤t, &ptr, &pending, false); + else if ((ptr - (QChar*)current.constData()) || !pending.isEmpty()) + putSpace = true; + continue; + } else if (pos) { + if (unicode == LPAREN) { + ++parens; + } else if (unicode == RPAREN) { + --parens; + } else if (!parens && unicode == COMMA) { + if (!joined) { + *pos = i + 1; + flushFinal(&ret, current, ptr, pending, str, replaced, false); + return ret; + } + flushCurrent(&ret, ¤t, &ptr, &pending, true); + putSpace = false; + continue; + } } } - if (replaced && unicode) - current.append(QChar(unicode)); + if (putSpace) { + putSpace = false; + appendChar(' ', ¤t, &ptr, &pending); + } + appendChar(unicode, ¤t, &ptr, &pending); } - if (!replaced) - ret = QStringList(str); - else if (!current.isEmpty()) - ret.append(current); + if (pos) + *pos = str_len; + flushFinal(&ret, current, ptr, pending, str, replaced, joined); return ret; } +bool ProFileEvaluator::Private::modesForGenerator(const QString &gen, + ProFileOption::HOST_MODE *host_mode, ProFileOption::TARG_MODE *target_mode) const +{ + if (gen == fL1S("UNIX")) { +#ifdef Q_OS_MAC + *host_mode = ProFileOption::HOST_MACX_MODE; + *target_mode = ProFileOption::TARG_MACX_MODE; +#else + *host_mode = ProFileOption::HOST_UNIX_MODE; + *target_mode = ProFileOption::TARG_UNIX_MODE; +#endif + } else if (gen == fL1S("MSVC.NET") || gen == fL1S("BMAKE") || gen == fL1S("MSBUILD")) { + *host_mode = ProFileOption::HOST_WIN_MODE; + *target_mode = ProFileOption::TARG_WIN_MODE; + } else if (gen == fL1S("MINGW")) { +#if defined(Q_OS_MAC) + *host_mode = ProFileOption::HOST_MACX_MODE; +#elif defined(Q_OS_UNIX) + *host_mode = ProFileOption::HOST_UNIX_MODE; +#else + *host_mode = ProFileOption::HOST_WIN_MODE; +#endif + *target_mode = ProFileOption::TARG_WIN_MODE; + } else if (gen == fL1S("PROJECTBUILDER") || gen == fL1S("XCODE")) { + *host_mode = ProFileOption::HOST_MACX_MODE; + *target_mode = ProFileOption::TARG_MACX_MODE; + } else if (gen == fL1S("SYMBIAN_ABLD") || gen == fL1S("SYMBIAN_SBSV2") + || gen == fL1S("SYMBIAN_UNIX") || gen == fL1S("SYMBIAN_MINGW")) { +#if defined(Q_OS_MAC) + *host_mode = ProFileOption::HOST_MACX_MODE; +#elif defined(Q_OS_UNIX) + *host_mode = ProFileOption::HOST_UNIX_MODE; +#else + *host_mode = ProFileOption::HOST_WIN_MODE; +#endif + *target_mode = ProFileOption::TARG_SYMBIAN_MODE; + } else { + evalError(fL1S("Unknown generator specified: %1").arg(gen)); + return false; + } + return true; +} + +void ProFileEvaluator::Private::validateModes() const +{ + if (m_option->host_mode == ProFileOption::HOST_UNKNOWN_MODE + || m_option->target_mode == ProFileOption::TARG_UNKNOWN_MODE) { + const QHash &vals = + m_option->base_valuemap.isEmpty() ? m_valuemapStack[0] : m_option->base_valuemap; + ProFileOption::HOST_MODE host_mode; + ProFileOption::TARG_MODE target_mode; + const ProStringList &gen = vals.value(ProString("MAKEFILE_GENERATOR")); + if (gen.isEmpty()) { + evalError(fL1S("Using OS scope before setting MAKEFILE_GENERATOR")); + } else if (modesForGenerator(gen.at(0).toQString(), &host_mode, &target_mode)) { + if (m_option->host_mode == ProFileOption::HOST_UNKNOWN_MODE) { + m_option->host_mode = host_mode; + m_option->applyHostMode(); + } + + if (m_option->target_mode == ProFileOption::TARG_UNKNOWN_MODE) { + const ProStringList &tgt = vals.value(ProString("TARGET_PLATFORM")); + if (!tgt.isEmpty()) { + const QString &os = tgt.at(0).toQString(); + if (os == statics.strunix) + m_option->target_mode = ProFileOption::TARG_UNIX_MODE; + else if (os == statics.strmacx) + m_option->target_mode = ProFileOption::TARG_MACX_MODE; + else if (os == statics.strsymbian) + m_option->target_mode = ProFileOption::TARG_SYMBIAN_MODE; + else if (os == statics.strwin32) + m_option->target_mode = ProFileOption::TARG_WIN_MODE; + else + evalError(fL1S("Unknown target platform specified: %1").arg(os)); + } else { + m_option->target_mode = target_mode; + } + } + } + } +} + bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex) { // magic types for easy flipping - if (config == QLatin1String("true")) + if (config == statics.strtrue) return true; - if (config == QLatin1String("false")) + if (config == statics.strfalse) return false; - // mkspecs - if ((Option::target_mode == Option::TARG_MACX_MODE - || Option::target_mode == Option::TARG_QNX6_MODE - || Option::target_mode == Option::TARG_UNIX_MODE) - && config == QLatin1String("unix")) - return true; - if (Option::target_mode == Option::TARG_MACX_MODE && config == QLatin1String("macx")) - return true; - if (Option::target_mode == Option::TARG_QNX6_MODE && config == QLatin1String("qnx6")) - return true; - if (Option::target_mode == Option::TARG_MAC9_MODE && config == QLatin1String("mac9")) - return true; - if ((Option::target_mode == Option::TARG_MAC9_MODE - || Option::target_mode == Option::TARG_MACX_MODE) - && config == QLatin1String("mac")) - return true; - if (Option::target_mode == Option::TARG_WIN_MODE && config == QLatin1String("win32")) - return true; + if (config == statics.strunix) { + validateModes(); + return m_option->target_mode == ProFileOption::TARG_UNIX_MODE + || m_option->target_mode == ProFileOption::TARG_MACX_MODE + || m_option->target_mode == ProFileOption::TARG_SYMBIAN_MODE; + } else if (config == statics.strmacx || config == statics.strmac) { + validateModes(); + return m_option->target_mode == ProFileOption::TARG_MACX_MODE; + } else if (config == statics.strsymbian) { + validateModes(); + return m_option->target_mode == ProFileOption::TARG_SYMBIAN_MODE; + } else if (config == statics.strwin32) { + validateModes(); + return m_option->target_mode == ProFileOption::TARG_WIN_MODE; + } + + if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) { + QString cfg = config; + cfg.detach(); // Keep m_tmp out of QRegExp's cache + QRegExp re(cfg, Qt::CaseSensitive, QRegExp::Wildcard); + + // mkspecs + if (re.exactMatch(m_option->qmakespec_name)) + return true; + + // CONFIG variable + int t = 0; + foreach (const ProString &configValue, valuesDirect(statics.strCONFIG)) { + if (re.exactMatch(configValue.toQString(m_tmp[t]))) + return true; + t ^= 1; + } + } else { + // mkspecs + if (m_option->qmakespec_name == config) + return true; + + // CONFIG variable + if (valuesDirect(statics.strCONFIG).contains(ProString(config, NoHash))) + return true; + } + + return false; +} + +ProStringList ProFileEvaluator::Private::expandVariableReferences( + const ushort *&tokPtr, int sizeHint, bool joined) +{ + ProStringList ret; + ret.reserve(sizeHint); + forever { + evaluateExpression(tokPtr, &ret, joined); + switch (*tokPtr) { + case TokValueTerminator: + case TokFuncTerminator: + tokPtr++; + return ret; + case TokArgSeparator: + if (joined) { + tokPtr++; + continue; + } + // fallthrough + default: + Q_ASSERT_X(false, "expandVariableReferences", "Unrecognized token"); + break; + } + } +} - QRegExp re(config, Qt::CaseSensitive, QRegExp::Wildcard); - QString spec = Option::qmakespec; - if ((regex && re.exactMatch(spec)) || (!regex && spec == config)) - return true; +QList ProFileEvaluator::Private::prepareFunctionArgs(const ushort *&tokPtr) +{ + QList args_list; + if (*tokPtr != TokFuncTerminator) { + for (;; tokPtr++) { + ProStringList arg; + evaluateExpression(tokPtr, &arg, false); + args_list << arg; + if (*tokPtr == TokFuncTerminator) + break; + Q_ASSERT(*tokPtr == TokArgSeparator); + } + } + tokPtr++; + return args_list; +} - return false; +QList ProFileEvaluator::Private::prepareFunctionArgs(const ProString &arguments) +{ + QList args_list; + for (int pos = 0; pos < arguments.size(); ) + args_list << expandVariableReferences(arguments, &pos); + return args_list; } -QStringList ProFileEvaluator::Private::evaluateFunction( - ProBlock *funcPtr, const QStringList &argumentsList, bool *ok) +ProStringList ProFileEvaluator::Private::evaluateFunction( + const FunctionDef &func, const QList &argumentsList, bool *ok) { bool oki; - QStringList ret; + ProStringList ret; if (m_valuemapStack.count() >= 100) { - q->errorMessage(format("ran into infinite recursion (depth > 100).")); + evalError(fL1S("ran into infinite recursion (depth > 100).")); oki = false; } else { - State sts = m_sts; - m_valuemapStack.push(m_valuemap); - m_filevaluemapStack.push(m_filevaluemap); + m_valuemapStack.push(QHash()); + m_locationStack.push(m_current); + int loopLevel = m_loopLevel; + m_loopLevel = 0; - QStringList args; + ProStringList args; for (int i = 0; i < argumentsList.count(); ++i) { - QStringList theArgs = expandVariableReferences(argumentsList[i]); - args += theArgs; - m_valuemap[QString::number(i+1)] = theArgs; + args += argumentsList[i]; + m_valuemapStack.top()[ProString(QString::number(i+1))] = argumentsList[i]; } - m_valuemap[QLatin1String("ARGS")] = args; - oki = (funcPtr->Accept(this) != ProItem::ReturnFalse); // True || Return + m_valuemapStack.top()[statics.strARGS] = args; + oki = (visitProBlock(func.pro(), func.tokPtr()) != ReturnFalse); // True || Return ret = m_returnValue; m_returnValue.clear(); - m_valuemap = m_valuemapStack.pop(); - m_filevaluemap = m_filevaluemapStack.pop(); - m_sts = sts; + m_loopLevel = loopLevel; + m_current = m_locationStack.pop(); + m_valuemapStack.pop(); } if (ok) *ok = oki; if (oki) return ret; - return QStringList(); -} - -QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &func, const QString &arguments) -{ - QStringList argumentsList = split_arg_list(arguments); - - if (ProBlock *funcPtr = m_replaceFunctions.value(func, 0)) - return evaluateFunction(funcPtr, argumentsList, 0); - - QStringList args; - for (int i = 0; i < argumentsList.count(); ++i) - args += expandVariableReferences(argumentsList[i]).join(Option::field_sep); - - enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST, - E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION, - E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND, - E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, - E_REPLACE }; - - static QHash expands; - if (expands.isEmpty()) { - expands.insert(QLatin1String("member"), E_MEMBER); - expands.insert(QLatin1String("first"), E_FIRST); - expands.insert(QLatin1String("last"), E_LAST); - expands.insert(QLatin1String("cat"), E_CAT); - expands.insert(QLatin1String("fromfile"), E_FROMFILE); // implementation disabled (see comment below) - expands.insert(QLatin1String("eval"), E_EVAL); - expands.insert(QLatin1String("list"), E_LIST); - expands.insert(QLatin1String("sprintf"), E_SPRINTF); - expands.insert(QLatin1String("join"), E_JOIN); - expands.insert(QLatin1String("split"), E_SPLIT); - expands.insert(QLatin1String("basename"), E_BASENAME); - expands.insert(QLatin1String("dirname"), E_DIRNAME); - expands.insert(QLatin1String("section"), E_SECTION); - expands.insert(QLatin1String("find"), E_FIND); - expands.insert(QLatin1String("system"), E_SYSTEM); - expands.insert(QLatin1String("unique"), E_UNIQUE); - expands.insert(QLatin1String("quote"), E_QUOTE); - expands.insert(QLatin1String("escape_expand"), E_ESCAPE_EXPAND); - expands.insert(QLatin1String("upper"), E_UPPER); - expands.insert(QLatin1String("lower"), E_LOWER); - expands.insert(QLatin1String("re_escape"), E_RE_ESCAPE); - expands.insert(QLatin1String("files"), E_FILES); - expands.insert(QLatin1String("prompt"), E_PROMPT); // interactive, so cannot be implemented - expands.insert(QLatin1String("replace"), E_REPLACE); + return ProStringList(); +} + +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::evaluateBoolFunction( + const FunctionDef &func, const QList &argumentsList, + const ProString &function) +{ + bool ok; + ProStringList ret = evaluateFunction(func, argumentsList, &ok); + if (ok) { + if (ret.isEmpty()) + return ReturnTrue; + if (ret.at(0) != statics.strfalse) { + if (ret.at(0) == statics.strtrue) + return ReturnTrue; + int val = ret.at(0).toQString(m_tmp1).toInt(&ok); + if (ok) { + if (val) + return ReturnTrue; + } else { + evalError(fL1S("Unexpected return value from test '%1': %2") + .arg(function.toQString(m_tmp1)) + .arg(ret.join(QLatin1String(" :: ")))); + } + } } - ExpandFunc func_t = ExpandFunc(expands.value(func.toLower())); + return ReturnFalse; +} - QStringList ret; +ProStringList ProFileEvaluator::Private::evaluateExpandFunction( + const ProString &func, const ushort *&tokPtr) +{ + QHash::ConstIterator it = + m_functionDefs.replaceFunctions.constFind(func); + if (it != m_functionDefs.replaceFunctions.constEnd()) + return evaluateFunction(*it, prepareFunctionArgs(tokPtr), 0); + + //why don't the builtin functions just use args_list? --Sam + return evaluateExpandFunction(func, expandVariableReferences(tokPtr, 5, true)); +} + +ProStringList ProFileEvaluator::Private::evaluateExpandFunction( + const ProString &func, const ProString &arguments) +{ + QHash::ConstIterator it = + m_functionDefs.replaceFunctions.constFind(func); + if (it != m_functionDefs.replaceFunctions.constEnd()) + return evaluateFunction(*it, prepareFunctionArgs(arguments), 0); + + //why don't the builtin functions just use args_list? --Sam + int pos = 0; + return evaluateExpandFunction(func, expandVariableReferences(arguments, &pos, true)); +} + +ProStringList ProFileEvaluator::Private::evaluateExpandFunction( + const ProString &func, const ProStringList &args) +{ + ExpandFunc func_t = ExpandFunc(statics.expands.value(func)); + if (func_t == 0) { + const QString &fn = func.toQString(m_tmp1); + const QString &lfn = fn.toLower(); + if (!fn.isSharedWith(lfn)) + func_t = ExpandFunc(statics.expands.value(ProString(lfn))); + } + + ProStringList ret; switch (func_t) { case E_BASENAME: case E_DIRNAME: case E_SECTION: { bool regexp = false; - QString sep, var; + QString sep; + ProString var; int beg = 0; int end = -1; if (func_t == E_SECTION) { if (args.count() != 3 && args.count() != 4) { - q->logMessage(format("%1(var) section(var, sep, begin, end) " - "requires three or four arguments.").arg(func)); + evalError(fL1S("%1(var) section(var, sep, begin, end) requires" + " three or four arguments.").arg(func.toQString(m_tmp1))); } else { var = args[0]; - sep = args[1]; - beg = args[2].toInt(); + sep = args.at(1).toQString(); + beg = args.at(2).toQString(m_tmp2).toInt(); if (args.count() == 4) - end = args[3].toInt(); + end = args.at(3).toQString(m_tmp2).toInt(); } } else { if (args.count() != 1) { - q->logMessage(format("%1(var) requires one argument.").arg(func)); + evalError(fL1S("%1(var) requires one argument.").arg(func.toQString(m_tmp1))); } else { var = args[0]; regexp = true; @@ -1392,67 +2187,81 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun beg = -1; } } - if (!var.isNull()) { - foreach (const QString str, values(var)) { - if (regexp) - ret += str.section(QRegExp(sep), beg, end); - else - ret += str.section(sep, beg, end); + if (!var.isEmpty()) { + if (regexp) { + QRegExp sepRx(sep); + foreach (const ProString &str, values(map(var))) { + const QString &rstr = str.toQString(m_tmp1).section(sepRx, beg, end); + ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr, NoHash).setSource(str)); + } + } else { + foreach (const ProString &str, values(map(var))) { + const QString &rstr = str.toQString(m_tmp1).section(sep, beg, end); + ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr, NoHash).setSource(str)); + } } } break; } case E_SPRINTF: if(args.count() < 1) { - q->logMessage(format("sprintf(format, ...) requires at least one argument")); + evalError(fL1S("sprintf(format, ...) requires at least one argument")); } else { - QString tmp = args.at(0); + QString tmp = args.at(0).toQString(m_tmp1); for (int i = 1; i < args.count(); ++i) - tmp = tmp.arg(args.at(i)); + tmp = tmp.arg(args.at(i).toQString(m_tmp2)); + // Note: this depends on split_value_list() making a deep copy ret = split_value_list(tmp); } break; case E_JOIN: { if (args.count() < 1 || args.count() > 4) { - q->logMessage(format("join(var, glue, before, after) requires one to four arguments.")); + evalError(fL1S("join(var, glue, before, after) requires one to four arguments.")); } else { - QString glue, before, after; + QString glue; + ProString before, after; if (args.count() >= 2) - glue = args[1]; + glue = args.at(1).toQString(m_tmp1); if (args.count() >= 3) before = args[2]; if (args.count() == 4) after = args[3]; - const QStringList &var = values(args.first()); - if (!var.isEmpty()) - ret.append(before + var.join(glue) + after); + const ProStringList &var = values(map(args.at(0))); + if (!var.isEmpty()) { + const ProFile *src = currentProFile(); + foreach (const ProString &v, var) + if (const ProFile *s = v.sourceFile()) { + src = s; + break; + } + ret.append(ProString(before + var.join(glue) + after, NoHash).setSource(src)); + } } break; } - case E_SPLIT: { + case E_SPLIT: if (args.count() != 2) { - q->logMessage(format("split(var, sep) requires one or two arguments")); + evalError(fL1S("split(var, sep) requires one or two arguments")); } else { - const QString &sep = (args.count() == 2) ? args[1] : QString(Option::field_sep); - foreach (const QString &var, values(args.first())) - foreach (const QString &splt, var.split(sep)) - ret.append(splt); + const QString &sep = (args.count() == 2) ? args.at(1).toQString(m_tmp1) : statics.field_sep; + foreach (const ProString &var, values(map(args.at(0)))) + foreach (const QString &splt, var.toQString(m_tmp2).split(sep)) + ret << (splt.isSharedWith(m_tmp2) ? var : ProString(splt, NoHash).setSource(var)); } break; - } - case E_MEMBER: { + case E_MEMBER: if (args.count() < 1 || args.count() > 3) { - q->logMessage(format("member(var, start, end) requires one to three arguments.")); + evalError(fL1S("member(var, start, end) requires one to three arguments.")); } else { bool ok = true; - const QStringList var = values(args.first()); + const ProStringList &var = values(map(args.at(0))); int start = 0, end = 0; if (args.count() >= 2) { - QString start_str = args[1]; + const QString &start_str = args.at(1).toQString(m_tmp1); start = start_str.toInt(&ok); if (!ok) { if (args.count() == 2) { - int dotdot = start_str.indexOf(QLatin1String("..")); + int dotdot = start_str.indexOf(statics.strDotDot); if (dotdot != -1) { start = start_str.left(dotdot).toInt(&ok); if (ok) @@ -1460,15 +2269,15 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun } } if (!ok) - q->logMessage(format("member() argument 2 (start) '%2' invalid.") - .arg(start_str)); + evalError(fL1S("member() argument 2 (start) '%2' invalid.") + .arg(start_str)); } else { end = start; if (args.count() == 3) - end = args[2].toInt(&ok); + end = args.at(2).toQString(m_tmp1).toInt(&ok); if (!ok) - q->logMessage(format("member() argument 3 (end) '%2' invalid.\n") - .arg(args[2])); + evalError(fL1S("member() argument 3 (end) '%2' invalid.\n") + .arg(args.at(2).toQString(m_tmp1))); } } if (ok) { @@ -1488,13 +2297,12 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun } } break; - } case E_FIRST: - case E_LAST: { + case E_LAST: if (args.count() != 1) { - q->logMessage(format("%1(var) requires one argument.").arg(func)); + evalError(fL1S("%1(var) requires one argument.").arg(func.toQString(m_tmp1))); } else { - const QStringList var = values(args.first()); + const ProStringList &var = values(map(args.at(0))); if (!var.isEmpty()) { if (func_t == E_FIRST) ret.append(var[0]); @@ -1503,92 +2311,96 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun } } break; - } + case E_SIZE: + if (args.count() != 1) + evalError(fL1S("size(var) requires one argument.")); + else + ret.append(ProString(QString::number(values(map(args.at(0))).size()), NoHash)); + break; case E_CAT: if (args.count() < 1 || args.count() > 2) { - q->logMessage(format("cat(file, singleline=true) requires one or two arguments.")); + evalError(fL1S("cat(file, singleline=true) requires one or two arguments.")); } else { - QString file = args[0]; - file = Option::fixPathToLocalOS(file); + const QString &file = args.at(0).toQString(m_tmp1); bool singleLine = true; if (args.count() > 1) - singleLine = (!args[1].compare(QLatin1String("true"), Qt::CaseInsensitive)); + singleLine = isTrue(args.at(1), m_tmp2); - QFile qfile(file); + QFile qfile(resolvePath(expandEnvVars(file))); if (qfile.open(QIODevice::ReadOnly)) { QTextStream stream(&qfile); while (!stream.atEnd()) { ret += split_value_list(stream.readLine().trimmed()); if (!singleLine) - ret += QLatin1String("\n"); + ret += ProString("\n", NoHash); } qfile.close(); } } break; -#if 0 // Used only by Qt's configure for caching case E_FROMFILE: if (args.count() != 2) { - q->logMessage(format("fromfile(file, variable) requires two arguments.")); + evalError(fL1S("fromfile(file, variable) requires two arguments.")); } else { - QString file = args[0], seek_variableName = args[1]; - - ProFile pro(Option::fixPathToLocalOS(file)); - - ProFileEvaluator visitor; - visitor.setVerbose(m_verbose); - visitor.setCumulative(m_cumulative); - - if (!visitor.queryProFile(&pro)) - break; - - if (!visitor.accept(&pro)) - break; - - ret = visitor.values(seek_variableName); + QHash vars; + QString fn = resolvePath(expandEnvVars(args.at(0).toQString(m_tmp1))); + fn.detach(); + if (evaluateFileInto(fn, ProFileEvaluatorHandler::EvalAuxFile, + &vars, &m_functionDefs, EvalWithDefaults)) + ret = vars.value(map(args.at(1))); } break; -#endif - case E_EVAL: { + case E_EVAL: if (args.count() != 1) { - q->logMessage(format("eval(variable) requires one argument")); - + evalError(fL1S("eval(variable) requires one argument")); } else { - ret += values(args.at(0)); + ret += values(map(args.at(0))); } - break; } + break; case E_LIST: { - static int x = 0; QString tmp; - tmp.sprintf(".QMAKE_INTERNAL_TMP_variableName_%d", x++); - ret = QStringList(tmp); - QStringList lst; - foreach (const QString &arg, args) - lst += split_value_list(arg); - m_valuemap[tmp] = lst; + tmp.sprintf(".QMAKE_INTERNAL_TMP_variableName_%d", m_listCount++); + ret = ProStringList(ProString(tmp, NoHash)); + ProStringList lst; + foreach (const ProString &arg, args) + lst += split_value_list(arg.toQString(m_tmp1), arg.sourceFile()); // Relies on deep copy + m_valuemapStack.top()[ret.at(0)] = lst; break; } case E_FIND: if (args.count() != 2) { - q->logMessage(format("find(var, str) requires two arguments.")); + evalError(fL1S("find(var, str) requires two arguments.")); } else { - QRegExp regx(args[1]); - foreach (const QString &val, values(args.first())) - if (regx.indexIn(val) != -1) + QRegExp regx(args.at(1).toQString()); + int t = 0; + foreach (const ProString &val, values(map(args.at(0)))) { + if (regx.indexIn(val.toQString(m_tmp[t])) != -1) ret += val; + t ^= 1; + } } break; case E_SYSTEM: if (!m_skipLevel) { if (args.count() < 1 || args.count() > 2) { - q->logMessage(format("system(execute) requires one or two arguments.")); + evalError(fL1S("system(execute) requires one or two arguments.")); } else { - char buff[256]; - FILE *proc = QT_POPEN(args[0].toLatin1(), "r"); bool singleLine = true; if (args.count() > 1) - singleLine = (!args[1].compare(QLatin1String("true"), Qt::CaseInsensitive)); - QString output; + singleLine = isTrue(args.at(1), m_tmp2); + QByteArray output; +#ifndef QT_BOOTSTRAPPED + QProcess proc; + runProcess(&proc, args.at(0).toQString(m_tmp2), QProcess::StandardError); + output = proc.readAllStandardOutput(); + output.replace('\t', ' '); + if (singleLine) + output.replace('\n', ' '); +#else + char buff[256]; + FILE *proc = QT_POPEN(QString(QLatin1String("cd ") + + IoUtils::shellQuote(currentDirectory()) + + QLatin1String(" && ") + args[0]).toLocal8Bit(), "r"); while (proc && !feof(proc)) { int read_in = int(fread(buff, 1, 255, proc)); if (!read_in) @@ -1597,32 +2409,31 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun if ((singleLine && buff[i] == '\n') || buff[i] == '\t') buff[i] = ' '; } - buff[read_in] = '\0'; - output += QLatin1String(buff); + output.append(buff, read_in); } - ret += split_value_list(output); if (proc) QT_PCLOSE(proc); +#endif + ret += split_value_list(QString::fromLocal8Bit(output)); } } break; case E_UNIQUE: if(args.count() != 1) { - q->logMessage(format("unique(var) requires one argument.")); + evalError(fL1S("unique(var) requires one argument.")); } else { - foreach (const QString &var, values(args.first())) - if (!ret.contains(var)) - ret.append(var); + ret = values(map(args.at(0))); + ret.removeDuplicates(); } break; case E_QUOTE: - for (int i = 0; i < args.count(); ++i) - ret += QStringList(args.at(i)); + ret += args; break; case E_ESCAPE_EXPAND: for (int i = 0; i < args.size(); ++i) { - QChar *i_data = args[i].data(); - int i_len = args[i].length(); + QString str = args.at(i).toQString(); + QChar *i_data = str.data(); + int i_len = str.length(); for (int x = 0; x < i_len; ++x) { if (*(i_data+x) == QLatin1Char('\\') && x < i_len-1) { if (*(i_data+x+1) == QLatin1Char('\\')) { @@ -1648,299 +2459,238 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun } } } - ret.append(QString(i_data, i_len)); + ret.append(ProString(QString(i_data, i_len), NoHash).setSource(args.at(i))); } break; case E_RE_ESCAPE: - for (int i = 0; i < args.size(); ++i) - ret += QRegExp::escape(args[i]); + for (int i = 0; i < args.size(); ++i) { + const QString &rstr = QRegExp::escape(args.at(i).toQString(m_tmp1)); + ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr, NoHash).setSource(args.at(i))); + } break; case E_UPPER: case E_LOWER: - for (int i = 0; i < args.count(); ++i) - if (func_t == E_UPPER) - ret += args[i].toUpper(); - else - ret += args[i].toLower(); + for (int i = 0; i < args.count(); ++i) { + QString rstr = args.at(i).toQString(m_tmp1); + rstr = (func_t == E_UPPER) ? rstr.toUpper() : rstr.toLower(); + ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr, NoHash).setSource(args.at(i))); + } break; case E_FILES: if (args.count() != 1 && args.count() != 2) { - q->logMessage(format("files(pattern, recursive=false) requires one or two arguments")); + evalError(fL1S("files(pattern, recursive=false) requires one or two arguments")); } else { bool recursive = false; if (args.count() == 2) - recursive = (!args[1].compare(QLatin1String("true"), Qt::CaseInsensitive) || args[1].toInt()); + recursive = isTrue(args.at(1), m_tmp2); QStringList dirs; - QString r = Option::fixPathToLocalOS(args[0]); + QString r = fixPathToLocalOS(args.at(0).toQString(m_tmp1)); + QString pfx; + if (IoUtils::isRelativePath(r)) { + pfx = currentDirectory(); + if (!pfx.endsWith(QLatin1Char('/'))) + pfx += QLatin1Char('/'); + } int slash = r.lastIndexOf(QDir::separator()); if (slash != -1) { - dirs.append(r.left(slash)); + dirs.append(r.left(slash+1)); r = r.mid(slash+1); } else { dirs.append(QString()); } + r.detach(); // Keep m_tmp out of QRegExp's cache const QRegExp regex(r, Qt::CaseSensitive, QRegExp::Wildcard); for (int d = 0; d < dirs.count(); d++) { QString dir = dirs[d]; - if (!dir.isEmpty() && !dir.endsWith(Option::dir_sep)) - dir += QLatin1Char('/'); - - QDir qdir(dir); + QDir qdir(pfx + dir); for (int i = 0; i < (int)qdir.count(); ++i) { - if (qdir[i] == QLatin1String(".") || qdir[i] == QLatin1String("..")) + if (qdir[i] == statics.strDot || qdir[i] == statics.strDotDot) continue; QString fname = dir + qdir[i]; - if (QFileInfo(fname).isDir()) { + if (IoUtils::fileType(pfx + fname) == IoUtils::FileIsDir) { if (recursive) - dirs.append(fname); + dirs.append(fname + QDir::separator()); } if (regex.exactMatch(qdir[i])) - ret += fname; + ret += ProString(fname, NoHash).setSource(currentProFile()); } } } break; case E_REPLACE: if(args.count() != 3 ) { - q->logMessage(format("replace(var, before, after) requires three arguments")); + evalError(fL1S("replace(var, before, after) requires three arguments")); } else { - const QRegExp before(args[1]); - const QString after(args[2]); - foreach (QString val, values(args.first())) - ret += val.replace(before, after); + const QRegExp before(args.at(1).toQString()); + const QString &after(args.at(2).toQString(m_tmp2)); + foreach (const ProString &val, values(map(args.at(0)))) { + QString rstr = val.toQString(m_tmp1); + QString copy = rstr; // Force a detach on modify + rstr.replace(before, after); + ret << (rstr.isSharedWith(m_tmp1) ? val : ProString(rstr, NoHash).setSource(val)); + } } break; - case 0: - q->logMessage(format("'%1' is not a recognized replace function").arg(func)); + case E_INVALID: + evalError(fL1S("'%1' is not a recognized replace function") + .arg(func.toQString(m_tmp1))); break; default: - q->logMessage(format("Function '%1' is not implemented").arg(func)); + evalError(fL1S("Function '%1' is not implemented").arg(func.toQString(m_tmp1))); break; } return ret; } -ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( - const QString &function, const QString &arguments) +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::evaluateConditionalFunction( + const ProString &function, const ProString &arguments) { - QStringList argumentsList = split_arg_list(arguments); + QHash::ConstIterator it = + m_functionDefs.testFunctions.constFind(function); + if (it != m_functionDefs.testFunctions.constEnd()) + return evaluateBoolFunction(*it, prepareFunctionArgs(arguments), function); - if (ProBlock *funcPtr = m_testFunctions.value(function, 0)) { - bool ok; - QStringList ret = evaluateFunction(funcPtr, argumentsList, &ok); - if (ok) { - if (ret.isEmpty()) { - return ProItem::ReturnTrue; - } else { - if (ret.first() != QLatin1String("false")) { - if (ret.first() == QLatin1String("true")) { - return ProItem::ReturnTrue; - } else { - bool ok; - int val = ret.first().toInt(&ok); - if (ok) { - if (val) - return ProItem::ReturnTrue; - } else { - q->logMessage(format("Unexpected return value from test '%1': %2") - .arg(function).arg(ret.join(QLatin1String(" :: ")))); - } - } - } - } - } - return ProItem::ReturnFalse; - } + //why don't the builtin functions just use args_list? --Sam + int pos = 0; + return evaluateConditionalFunction(function, expandVariableReferences(arguments, &pos, true)); +} - QString sep; - sep.append(Option::field_sep); - QStringList args; - for (int i = 0; i < argumentsList.count(); ++i) - args += expandVariableReferences(argumentsList[i]).join(sep); - - enum TestFunc { T_REQUIRES=1, T_GREATERTHAN, T_LESSTHAN, T_EQUALS, - T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM, - T_RETURN, T_BREAK, T_NEXT, T_DEFINED, T_CONTAINS, T_INFILE, - T_COUNT, T_ISEMPTY, T_INCLUDE, T_LOAD, T_DEBUG, T_MESSAGE, T_IF, - T_FOR, T_DEFINE_TEST, T_DEFINE_REPLACE }; - - static QHash functions; - if (functions.isEmpty()) { - functions.insert(QLatin1String("requires"), T_REQUIRES); - functions.insert(QLatin1String("greaterThan"), T_GREATERTHAN); - functions.insert(QLatin1String("lessThan"), T_LESSTHAN); - functions.insert(QLatin1String("equals"), T_EQUALS); - functions.insert(QLatin1String("isEqual"), T_EQUALS); - functions.insert(QLatin1String("exists"), T_EXISTS); - functions.insert(QLatin1String("export"), T_EXPORT); - functions.insert(QLatin1String("clear"), T_CLEAR); - functions.insert(QLatin1String("unset"), T_UNSET); - functions.insert(QLatin1String("eval"), T_EVAL); - functions.insert(QLatin1String("CONFIG"), T_CONFIG); - functions.insert(QLatin1String("if"), T_IF); - functions.insert(QLatin1String("isActiveConfig"), T_CONFIG); - functions.insert(QLatin1String("system"), T_SYSTEM); - functions.insert(QLatin1String("return"), T_RETURN); - functions.insert(QLatin1String("break"), T_BREAK); - functions.insert(QLatin1String("next"), T_NEXT); - functions.insert(QLatin1String("defined"), T_DEFINED); - functions.insert(QLatin1String("contains"), T_CONTAINS); - functions.insert(QLatin1String("infile"), T_INFILE); - functions.insert(QLatin1String("count"), T_COUNT); - functions.insert(QLatin1String("isEmpty"), T_ISEMPTY); - functions.insert(QLatin1String("load"), T_LOAD); //v - functions.insert(QLatin1String("include"), T_INCLUDE); //v - functions.insert(QLatin1String("debug"), T_DEBUG); - functions.insert(QLatin1String("message"), T_MESSAGE); //v - functions.insert(QLatin1String("warning"), T_MESSAGE); //v - functions.insert(QLatin1String("error"), T_MESSAGE); //v - functions.insert(QLatin1String("for"), T_FOR); //v - functions.insert(QLatin1String("defineTest"), T_DEFINE_TEST); //v - functions.insert(QLatin1String("defineReplace"), T_DEFINE_REPLACE); //v - } +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::evaluateConditionalFunction( + const ProString &function, const ushort *&tokPtr) +{ + QHash::ConstIterator it = + m_functionDefs.testFunctions.constFind(function); + if (it != m_functionDefs.testFunctions.constEnd()) + return evaluateBoolFunction(*it, prepareFunctionArgs(tokPtr), function); + + //why don't the builtin functions just use args_list? --Sam + return evaluateConditionalFunction(function, expandVariableReferences(tokPtr, 5, true)); +} - TestFunc func_t = (TestFunc)functions.value(function); +ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::evaluateConditionalFunction( + const ProString &function, const ProStringList &args) +{ + TestFunc func_t = (TestFunc)statics.functions.value(function); switch (func_t) { - case T_DEFINE_TEST: - m_definingTest = true; - goto defineFunc; - case T_DEFINE_REPLACE: - m_definingTest = false; - defineFunc: - if (args.count() != 1) { - q->logMessage(format("%s(function) requires one argument.").arg(function)); - return ProItem::ReturnFalse; - } - m_definingFunc = args.first(); - return ProItem::ReturnTrue; case T_DEFINED: if (args.count() < 1 || args.count() > 2) { - q->logMessage(format("defined(function, [\"test\"|\"replace\"])" - " requires one or two arguments.")); - return ProItem::ReturnFalse; + evalError(fL1S("defined(function, [\"test\"|\"replace\"])" + " requires one or two arguments.")); + return ReturnFalse; } if (args.count() > 1) { if (args[1] == QLatin1String("test")) - return returnBool(m_testFunctions.contains(args[0])); + return returnBool(m_functionDefs.testFunctions.contains(args[0])); else if (args[1] == QLatin1String("replace")) - return returnBool(m_replaceFunctions.contains(args[0])); - q->logMessage(format("defined(function, type):" - " unexpected type [%1].\n").arg(args[1])); - return ProItem::ReturnFalse; + return returnBool(m_functionDefs.replaceFunctions.contains(args[0])); + evalError(fL1S("defined(function, type): unexpected type [%1].\n") + .arg(args.at(1).toQString(m_tmp1))); + return ReturnFalse; } - return returnBool(m_replaceFunctions.contains(args[0]) - || m_testFunctions.contains(args[0])); + return returnBool(m_functionDefs.replaceFunctions.contains(args[0]) + || m_functionDefs.testFunctions.contains(args[0])); case T_RETURN: m_returnValue = args; // It is "safe" to ignore returns - due to qmake brokeness // they cannot be used to terminate loops anyway. if (m_skipLevel || m_cumulative) - return ProItem::ReturnTrue; + return ReturnTrue; if (m_valuemapStack.isEmpty()) { - q->logMessage(format("unexpected return().")); - return ProItem::ReturnFalse; + evalError(fL1S("unexpected return().")); + return ReturnFalse; } - return ProItem::ReturnReturn; - case T_EXPORT: + return ReturnReturn; + case T_EXPORT: { if (m_skipLevel && !m_cumulative) - return ProItem::ReturnTrue; + return ReturnTrue; if (args.count() != 1) { - q->logMessage(format("export(variable) requires one argument.")); - return ProItem::ReturnFalse; + evalError(fL1S("export(variable) requires one argument.")); + return ReturnFalse; + } + const ProString &var = map(args.at(0)); + for (int i = m_valuemapStack.size(); --i > 0; ) { + QHash::Iterator it = m_valuemapStack[i].find(var); + if (it != m_valuemapStack.at(i).end()) { + if (it->constBegin() == statics.fakeValue.constBegin()) { + // This is stupid, but qmake doesn't propagate deletions + m_valuemapStack[0][var] = ProStringList(); + } else { + m_valuemapStack[0][var] = *it; + } + m_valuemapStack[i].erase(it); + while (--i) + m_valuemapStack[i].remove(var); + break; + } } - for (int i = 0; i < m_valuemapStack.size(); ++i) { - m_valuemapStack[i][args[0]] = m_valuemap[args[0]]; - m_filevaluemapStack[i][currentProFile()][args[0]] = - m_filevaluemap[currentProFile()][args[0]]; + return ReturnTrue; + } + case T_INFILE: + if (args.count() < 2 || args.count() > 3) { + evalError(fL1S("infile(file, var, [values]) requires two or three arguments.")); + } else { + QHash vars; + QString fn = resolvePath(expandEnvVars(args.at(0).toQString(m_tmp1))); + fn.detach(); + if (!evaluateFileInto(fn, ProFileEvaluatorHandler::EvalAuxFile, + &vars, &m_functionDefs, EvalWithDefaults)) + return ReturnFalse; + if (args.count() == 2) + return returnBool(vars.contains(args.at(1))); + QRegExp regx; + const QString &qry = args.at(2).toQString(m_tmp1); + if (qry != QRegExp::escape(qry)) { + QString copy = qry; + copy.detach(); + regx.setPattern(copy); + } + int t = 0; + foreach (const ProString &s, vars.value(map(args.at(1)))) { + if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[t]))) || s == qry) + return ReturnTrue; + t ^= 1; + } } - return ProItem::ReturnTrue; + return ReturnFalse; #if 0 - case T_INFILE: case T_REQUIRES: - case T_EVAL: #endif - case T_FOR: { - if (m_cumulative) // This is a no-win situation, so just pretend it's no loop - return ProItem::ReturnTrue; - if (m_skipLevel) - return ProItem::ReturnFalse; - if (args.count() > 2 || args.count() < 1) { - q->logMessage(format("for({var, list|var, forever|ever})" - " requires one or two arguments.")); - return ProItem::ReturnFalse; - } - ProLoop loop; - loop.infinite = false; - loop.index = 0; - QString it_list; - if (args.count() == 1) { - doVariableReplace(&args[0]); - it_list = args[0]; - if (args[0] != QLatin1String("ever")) { - q->logMessage(format("for({var, list|var, forever|ever})" - " requires one or two arguments.")); - return ProItem::ReturnFalse; - } - it_list = QLatin1String("forever"); - } else { - loop.variable = args[0]; - loop.oldVarVal = m_valuemap.value(loop.variable); - doVariableReplace(&args[1]); - it_list = args[1]; - } - loop.list = m_valuemap[it_list]; - if (loop.list.isEmpty()) { - if (it_list == QLatin1String("forever")) { - loop.infinite = true; - } else { - int dotdot = it_list.indexOf(QLatin1String("..")); - if (dotdot != -1) { - bool ok; - int start = it_list.left(dotdot).toInt(&ok); - if (ok) { - int end = it_list.mid(dotdot+2).toInt(&ok); - if (ok) { - if (start < end) { - for (int i = start; i <= end; i++) - loop.list << QString::number(i); - } else { - for (int i = start; i >= end; i--) - loop.list << QString::number(i); - } - } - } - } - } + case T_EVAL: { + ProFile *pro = m_parser->parsedProBlock(fL1S("(eval)"), + args.join(statics.field_sep)); + if (!pro) + return ReturnFalse; + m_locationStack.push(m_current); + VisitReturn ret = visitProBlock(pro, pro->tokPtr()); + m_current = m_locationStack.pop(); + pro->deref(); + return ret; } - m_loopStack.push(loop); - m_sts.condition = true; - return ProItem::ReturnLoop; - } case T_BREAK: if (m_skipLevel) - return ProItem::ReturnFalse; - if (!m_loopStack.isEmpty()) - return ProItem::ReturnBreak; - // ### missing: breaking out of multiline blocks - q->logMessage(format("unexpected break().")); - return ProItem::ReturnFalse; + return ReturnFalse; + if (m_loopLevel) + return ReturnBreak; + evalError(fL1S("unexpected break().")); + return ReturnFalse; case T_NEXT: if (m_skipLevel) - return ProItem::ReturnFalse; - if (!m_loopStack.isEmpty()) - return ProItem::ReturnNext; - q->logMessage(format("unexpected next().")); - return ProItem::ReturnFalse; + return ReturnFalse; + if (m_loopLevel) + return ReturnNext; + evalError(fL1S("unexpected next().")); + return ReturnFalse; case T_IF: { + if (m_skipLevel && !m_cumulative) + return ReturnFalse; if (args.count() != 1) { - q->logMessage(format("if(condition) requires one argument.")); - return ProItem::ReturnFalse; + evalError(fL1S("if(condition) requires one argument.")); + return ReturnFalse; } - QString cond = args.first(); - bool escaped = false; // This is more than qmake does + const ProString &cond = args.at(0); bool quoted = false; bool ret = true; bool orOp = false; @@ -1949,83 +2699,69 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( int parens = 0; QString test; test.reserve(20); - QString args; - args.reserve(50); - const QChar *d = cond.unicode(); - const QChar *ed = d + cond.length(); + QString argsString; + argsString.reserve(50); + const QChar *d = cond.constData(); + const QChar *ed = d + cond.size(); while (d < ed) { ushort c = (d++)->unicode(); - if (!escaped) { - if (c == '\\') { - escaped = true; - args += c; // Assume no-one quotes the test name - continue; - } else if (c == '"') { - quoted = !quoted; - args += c; // Ditto - continue; - } - } else { - escaped = false; - } + bool isOp = false; if (quoted) { - args += c; // Ditto + if (c == '"') + quoted = false; + else if (c == '!' && test.isEmpty()) + invert = true; + else + test += c; + } else if (c == '(') { + isFunc = true; + if (parens) + argsString += c; + ++parens; + } else if (c == ')') { + --parens; + if (parens) + argsString += c; + } else if (!parens) { + if (c == '"') + quoted = true; + else if (c == ':' || c == '|') + isOp = true; + else if (c == '!' && test.isEmpty()) + invert = true; + else + test += c; } else { - bool isOp = false; - if (c == '(') { - isFunc = true; - if (parens) - args += c; - ++parens; - } else if (c == ')') { - --parens; - if (parens) - args += c; - } else if (!parens) { - if (c == ':' || c == '|') - isOp = true; - else if (c == '!') - invert = true; - else - test += c; - } else { - args += c; - } - if (!parens && (isOp || d == ed)) { - // Yes, qmake doesn't shortcut evaluations here. We can't, either, - // as some test functions have side effects. - bool success; - if (isFunc) { - success = evaluateConditionalFunction(test, args); - } else { - success = isActiveConfig(test, true); - } - success ^= invert; - if (orOp) - ret |= success; + argsString += c; + } + if (!quoted && !parens && (isOp || d == ed)) { + if (m_cumulative || (orOp != ret)) { + test = test.trimmed(); + if (isFunc) + ret = evaluateConditionalFunction(ProString(test), ProString(argsString, NoHash)); else - ret &= success; - orOp = (c == '|'); - invert = false; - isFunc = false; - test.clear(); - args.clear(); + ret = isActiveConfig(test, true); + ret ^= invert; } + orOp = (c == '|'); + invert = false; + isFunc = false; + test.clear(); + argsString.clear(); } } return returnBool(ret); } case T_CONFIG: { if (args.count() < 1 || args.count() > 2) { - q->logMessage(format("CONFIG(config) requires one or two arguments.")); - return ProItem::ReturnFalse; - } - if (args.count() == 1) { - //cond = isActiveConfig(args.first()); XXX - return ProItem::ReturnFalse; + evalError(fL1S("CONFIG(config) requires one or two arguments.")); + return ReturnFalse; } - const QStringList mutuals = args[1].split(QLatin1Char('|')); - const QStringList &configs = valuesDirect(QLatin1String("CONFIG")); + if (args.count() == 1) + return returnBool(isActiveConfig(args.at(0).toQString(m_tmp2))); + const QStringList &mutuals = args.at(1).toQString(m_tmp2).split(QLatin1Char('|')); + const ProStringList &configs = valuesDirect(statics.strCONFIG); + for (int i = configs.size() - 1; i >= 0; i--) { for (int mut = 0; mut < mutuals.count(); mut++) { if (configs[i] == mutuals[mut].trimmed()) { @@ -2033,68 +2769,81 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( } } } - return ProItem::ReturnFalse; + return ReturnFalse; } case T_CONTAINS: { if (args.count() < 2 || args.count() > 3) { - q->logMessage(format("contains(var, val) requires two or three arguments.")); - return ProItem::ReturnFalse; + evalError(fL1S("contains(var, val) requires two or three arguments.")); + return ReturnFalse; } - QRegExp regx(args[1]); - const QStringList &l = values(args.first()); + const QString &qry = args.at(1).toQString(m_tmp1); + QRegExp regx; + if (qry != QRegExp::escape(qry)) { + QString copy = qry; + copy.detach(); + regx.setPattern(copy); + } + const ProStringList &l = values(map(args.at(0))); if (args.count() == 2) { + int t = 0; for (int i = 0; i < l.size(); ++i) { - const QString val = l[i]; - if (regx.exactMatch(val) || val == args[1]) { - return ProItem::ReturnTrue; - } + const ProString &val = l[i]; + if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[t]))) || val == qry) + return ReturnTrue; + t ^= 1; } } else { - const QStringList mutuals = args[2].split(QLatin1Char('|')); + const QStringList &mutuals = args.at(2).toQString(m_tmp3).split(QLatin1Char('|')); for (int i = l.size() - 1; i >= 0; i--) { - const QString val = l[i]; + const ProString val = l[i]; for (int mut = 0; mut < mutuals.count(); mut++) { if (val == mutuals[mut].trimmed()) { - return returnBool(regx.exactMatch(val) || val == args[1]); + return returnBool((!regx.isEmpty() + && regx.exactMatch(val.toQString(m_tmp2))) + || val == qry); } } } } - return ProItem::ReturnFalse; + return ReturnFalse; } case T_COUNT: { if (args.count() != 2 && args.count() != 3) { - q->logMessage(format("count(var, count, op=\"equals\") requires two or three arguments.")); - return ProItem::ReturnFalse; + evalError(fL1S("count(var, count, op=\"equals\") requires two or three arguments.")); + return ReturnFalse; } + int cnt = values(map(args.at(0))).count(); if (args.count() == 3) { - QString comp = args[2]; + const ProString &comp = args.at(2); + const int val = args.at(1).toQString(m_tmp1).toInt(); if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) { - return returnBool(values(args.first()).count() > args[1].toInt()); + return returnBool(cnt > val); } else if (comp == QLatin1String(">=")) { - return returnBool(values(args.first()).count() >= args[1].toInt()); + return returnBool(cnt >= val); } else if (comp == QLatin1String("<") || comp == QLatin1String("lessThan")) { - return returnBool(values(args.first()).count() < args[1].toInt()); + return returnBool(cnt < val); } else if (comp == QLatin1String("<=")) { - return returnBool(values(args.first()).count() <= args[1].toInt()); + return returnBool(cnt <= val); } else if (comp == QLatin1String("equals") || comp == QLatin1String("isEqual") || comp == QLatin1String("=") || comp == QLatin1String("==")) { - return returnBool(values(args.first()).count() == args[1].toInt()); + return returnBool(cnt == val); } else { - q->logMessage(format("unexpected modifier to count(%2)").arg(comp)); - return ProItem::ReturnFalse; + evalError(fL1S("unexpected modifier to count(%2)").arg(comp.toQString(m_tmp1))); + return ReturnFalse; } } - return returnBool(values(args.first()).count() == args[1].toInt()); + return returnBool(cnt == args.at(1).toQString(m_tmp1).toInt()); } case T_GREATERTHAN: case T_LESSTHAN: { if (args.count() != 2) { - q->logMessage(format("%1(variable, value) requires two arguments.").arg(function)); - return ProItem::ReturnFalse; + evalError(fL1S("%1(variable, value) requires two arguments.") + .arg(function.toQString(m_tmp1))); + return ReturnFalse; } - QString rhs(args[1]), lhs(values(args[0]).join(QString(Option::field_sep))); + const QString &rhs(args.at(1).toQString(m_tmp1)), + &lhs(values(map(args.at(0))).join(statics.field_sep)); bool ok; int rhs_int = rhs.toInt(&ok); if (ok) { // do integer compare @@ -2111,206 +2860,300 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( } case T_EQUALS: if (args.count() != 2) { - q->logMessage(format("%1(variable, value) requires two arguments.").arg(function)); - return ProItem::ReturnFalse; + evalError(fL1S("%1(variable, value) requires two arguments.") + .arg(function.toQString(m_tmp1))); + return ReturnFalse; } - return returnBool(values(args[0]).join(QString(Option::field_sep)) == args[1]); + return returnBool(values(map(args.at(0))).join(statics.field_sep) + == args.at(1).toQString(m_tmp1)); case T_CLEAR: { if (m_skipLevel && !m_cumulative) - return ProItem::ReturnFalse; + return ReturnFalse; if (args.count() != 1) { - q->logMessage(format("%1(variable) requires one argument.").arg(function)); - return ProItem::ReturnFalse; - } - QHash::Iterator it = m_valuemap.find(args[0]); - if (it == m_valuemap.end()) - return ProItem::ReturnFalse; - it->clear(); - return ProItem::ReturnTrue; + evalError(fL1S("%1(variable) requires one argument.") + .arg(function.toQString(m_tmp1))); + return ReturnFalse; + } + QHash *hsh; + QHash::Iterator it; + const ProString &var = map(args.at(0)); + if (!(hsh = findValues(var, &it))) + return ReturnFalse; + if (hsh == &m_valuemapStack.top()) + it->clear(); + else + m_valuemapStack.top()[var].clear(); + return ReturnTrue; } case T_UNSET: { if (m_skipLevel && !m_cumulative) - return ProItem::ReturnFalse; + return ReturnFalse; if (args.count() != 1) { - q->logMessage(format("%1(variable) requires one argument.").arg(function)); - return ProItem::ReturnFalse; - } - QHash::Iterator it = m_valuemap.find(args[0]); - if (it == m_valuemap.end()) - return ProItem::ReturnFalse; - m_valuemap.erase(it); - return ProItem::ReturnTrue; + evalError(fL1S("%1(variable) requires one argument.") + .arg(function.toQString(m_tmp1))); + return ReturnFalse; + } + QHash *hsh; + QHash::Iterator it; + const ProString &var = map(args.at(0)); + if (!(hsh = findValues(var, &it))) + return ReturnFalse; + if (m_valuemapStack.size() == 1) + hsh->erase(it); + else if (hsh == &m_valuemapStack.top()) + *it = statics.fakeValue; + else + m_valuemapStack.top()[var] = statics.fakeValue; + return ReturnTrue; } case T_INCLUDE: { if (m_skipLevel && !m_cumulative) - return ProItem::ReturnFalse; + return ReturnFalse; QString parseInto; // the third optional argument to include() controls warnings // and is not used here - if ((args.count() == 2) || (args.count() == 3)) { - parseInto = args[1]; + if ((args.count() == 2) || (args.count() == 3) ) { + parseInto = args.at(1).toQString(m_tmp2); } else if (args.count() != 1) { - q->logMessage(format("include(file) requires one, two or three arguments.")); - return ProItem::ReturnFalse; - } - QString fileName = args.first(); - // ### this breaks if we have include(c:/reallystupid.pri) but IMHO that's really bad style. - QDir currentProPath(currentDirectory()); - fileName = QDir::cleanPath(currentProPath.absoluteFilePath(fileName)); - State sts = m_sts; - bool ok = evaluateFile(fileName); - m_sts = sts; + evalError(fL1S("include(file, into, silent) requires one, two or three arguments.")); + return ReturnFalse; + } + QString fn = resolvePath(expandEnvVars(args.at(0).toQString(m_tmp1))); + fn.detach(); + bool ok; + if (parseInto.isEmpty()) { + ok = evaluateFile(fn, ProFileEvaluatorHandler::EvalIncludeFile, + ProFileEvaluator::LoadProOnly); + } else { + QHash symbols; + if ((ok = evaluateFileInto(fn, ProFileEvaluatorHandler::EvalAuxFile, + &symbols, 0, EvalWithSetup))) { + QHash newMap; + for (QHash::ConstIterator + it = m_valuemapStack.top().constBegin(), + end = m_valuemapStack.top().constEnd(); + it != end; ++it) { + const QString &ky = it.key().toQString(m_tmp1); + if (!(ky.startsWith(parseInto) && + (ky.length() == parseInto.length() + || ky.at(parseInto.length()) == QLatin1Char('.')))) + newMap[it.key()] = it.value(); + } + for (QHash::ConstIterator it = symbols.constBegin(); + it != symbols.constEnd(); ++it) { + const QString &ky = it.key().toQString(m_tmp1); + if (!ky.startsWith(QLatin1Char('.'))) + newMap.insert(ProString(parseInto + QLatin1Char('.') + ky), it.value()); + } + m_valuemapStack.top() = newMap; + } + } return returnBool(ok); } case T_LOAD: { if (m_skipLevel && !m_cumulative) - return ProItem::ReturnFalse; - QString parseInto; + return ReturnFalse; bool ignore_error = false; if (args.count() == 2) { - QString sarg = args[1]; - ignore_error = (!sarg.compare(QLatin1String("true"), Qt::CaseInsensitive) || sarg.toInt()); + ignore_error = isTrue(args.at(1), m_tmp2); } else if (args.count() != 1) { - q->logMessage(format("load(feature) requires one or two arguments.")); - return ProItem::ReturnFalse; + evalError(fL1S("load(feature) requires one or two arguments.")); + return ReturnFalse; } // XXX ignore_error unused - return returnBool(evaluateFeatureFile(args.first())); + return returnBool(evaluateFeatureFile(expandEnvVars(args.at(0).toQString()))); } case T_DEBUG: // Yup - do nothing. Nothing is going to enable debug output anyway. - return ProItem::ReturnFalse; + return ReturnFalse; case T_MESSAGE: { if (args.count() != 1) { - q->logMessage(format("%1(message) requires one argument.").arg(function)); - return ProItem::ReturnFalse; - } - QString msg = fixEnvVariables(args.first()); - q->fileMessage(QString::fromLatin1("Project %1: %2").arg(function.toUpper(), msg)); + evalError(fL1S("%1(message) requires one argument.") + .arg(function.toQString(m_tmp1))); + return ReturnFalse; + } + const QString &msg = expandEnvVars(args.at(0).toQString(m_tmp2)); + if (!m_skipLevel) + m_handler->fileMessage(fL1S("Project %1: %2") + .arg(function.toQString(m_tmp1).toUpper(), msg)); // ### Consider real termination in non-cumulative mode return returnBool(function != QLatin1String("error")); } #if 0 // Way too dangerous to enable. case T_SYSTEM: { if (args.count() != 1) { - q->logMessage(format("system(exec) requires one argument.")); - ProItem::ReturnFalse; - } - return returnBool(system(args.first().toLatin1().constData()) == 0); + evalError(fL1S("system(exec) requires one argument.")); + return ReturnFalse; + } +#ifndef QT_BOOTSTRAPPED + QProcess proc; + proc.setProcessChannelMode(QProcess::MergedChannels); + runProcess(&proc, args.at(0).toQString(m_tmp2), QProcess::StandardOutput); + return returnBool(proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0); +#else + return returnBool(system((QLatin1String("cd ") + + IoUtils::shellQuote(currentDirectory()) + + QLatin1String(" && ") + args.at(0)).toLocal8Bit().constData()) == 0); +#endif } #endif case T_ISEMPTY: { if (args.count() != 1) { - q->logMessage(format("isEmpty(var) requires one argument.")); - return ProItem::ReturnFalse; + evalError(fL1S("isEmpty(var) requires one argument.")); + return ReturnFalse; } - QStringList sl = values(args.first()); + const ProStringList &sl = values(map(args.at(0))); if (sl.count() == 0) { - return ProItem::ReturnTrue; + return ReturnTrue; } else if (sl.count() > 0) { - QString var = sl.first(); + const ProString &var = sl.first(); if (var.isEmpty()) - return ProItem::ReturnTrue; + return ReturnTrue; } - return ProItem::ReturnFalse; + return ReturnFalse; } case T_EXISTS: { if (args.count() != 1) { - q->logMessage(format("exists(file) requires one argument.")); - return ProItem::ReturnFalse; + evalError(fL1S("exists(file) requires one argument.")); + return ReturnFalse; } - QString file = args.first(); - file = Option::fixPathToLocalOS(file); + const QString &file = resolvePath(expandEnvVars(args.at(0).toQString(m_tmp1))); - if (QFile::exists(file)) { - return ProItem::ReturnTrue; + if (IoUtils::exists(file)) { + return ReturnTrue; } - //regular expression I guess - QString dirstr = currentDirectory(); - int slsh = file.lastIndexOf(Option::dir_sep); - if (slsh != -1) { - dirstr = file.left(slsh+1); - file = file.right(file.length() - slsh - 1); + int slsh = file.lastIndexOf(QLatin1Char('/')); + QString fn = file.mid(slsh+1); + if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) { + QString dirstr = file.left(slsh+1); + if (!QDir(dirstr).entryList(QStringList(fn)).isEmpty()) + return ReturnTrue; } - if (file.contains(QLatin1Char('*')) || file.contains(QLatin1Char('?'))) - if (!QDir(dirstr).entryList(QStringList(file)).isEmpty()) - return ProItem::ReturnTrue; - return ProItem::ReturnFalse; + return ReturnFalse; } - case 0: - q->logMessage(format("'%1' is not a recognized test function").arg(function)); - return ProItem::ReturnFalse; + case T_INVALID: + evalError(fL1S("'%1' is not a recognized test function") + .arg(function.toQString(m_tmp1))); + return ReturnFalse; default: - q->logMessage(format("Function '%1' is not implemented").arg(function)); - return ProItem::ReturnFalse; + evalError(fL1S("Function '%1' is not implemented").arg(function.toQString(m_tmp1))); + return ReturnFalse; + } +} + +QHash *ProFileEvaluator::Private::findValues( + const ProString &variableName, QHash::Iterator *rit) +{ + for (int i = m_valuemapStack.size(); --i >= 0; ) { + QHash::Iterator it = m_valuemapStack[i].find(variableName); + if (it != m_valuemapStack[i].end()) { + if (it->constBegin() == statics.fakeValue.constBegin()) + return 0; + *rit = it; + return &m_valuemapStack[i]; + } + } + return 0; +} + +ProStringList &ProFileEvaluator::Private::valuesRef(const ProString &variableName) +{ + QHash::Iterator it = m_valuemapStack.top().find(variableName); + if (it != m_valuemapStack.top().end()) + return *it; + for (int i = m_valuemapStack.size() - 1; --i >= 0; ) { + QHash::ConstIterator it = m_valuemapStack.at(i).constFind(variableName); + if (it != m_valuemapStack.at(i).constEnd()) { + ProStringList &ret = m_valuemapStack.top()[variableName]; + ret = *it; + return ret; + } + } + return m_valuemapStack.top()[variableName]; +} + +ProStringList ProFileEvaluator::Private::valuesDirect(const ProString &variableName) const +{ + for (int i = m_valuemapStack.size(); --i >= 0; ) { + QHash::ConstIterator it = m_valuemapStack.at(i).constFind(variableName); + if (it != m_valuemapStack.at(i).constEnd()) { + if (it->constBegin() == statics.fakeValue.constBegin()) + break; + return *it; + } } + return ProStringList(); } -QStringList ProFileEvaluator::Private::values(const QString &variableName, - const QHash &place, - const ProFile *pro) const -{ - if (variableName == QLatin1String("LITERAL_WHITESPACE")) //a real space in a token - return QStringList(QLatin1String("\t")); - if (variableName == QLatin1String("LITERAL_DOLLAR")) //a real $ - return QStringList(QLatin1String("$")); - if (variableName == QLatin1String("LITERAL_HASH")) //a real # - return QStringList(QLatin1String("#")); - if (variableName == QLatin1String("OUT_PWD")) //the out going dir - return QStringList(m_outputDir); - if (variableName == QLatin1String("PWD") || //current working dir (of _FILE_) - variableName == QLatin1String("IN_PWD")) - return QStringList(currentDirectory()); - if (variableName == QLatin1String("DIR_SEPARATOR")) - return QStringList(Option::dir_sep); - if (variableName == QLatin1String("DIRLIST_SEPARATOR")) - return QStringList(Option::dirlist_sep); - if (variableName == QLatin1String("_LINE_")) //parser line number - return QStringList(QString::number(m_lineNo)); - if (variableName == QLatin1String("_FILE_")) //parser file; qmake is a bit weird here - return QStringList(m_profileStack.size() == 1 ? pro->fileName() : QFileInfo(pro->fileName()).fileName()); - if (variableName == QLatin1String("_DATE_")) //current date/time - return QStringList(QDateTime::currentDateTime().toString()); - if (variableName == QLatin1String("_PRO_FILE_")) - return QStringList(m_origfile); - if (variableName == QLatin1String("_PRO_FILE_PWD_")) - return QStringList(QFileInfo(m_origfile).absolutePath()); - if (variableName == QLatin1String("_QMAKE_CACHE_")) - return QStringList(); // FIXME? - if (variableName.startsWith(QLatin1String("QMAKE_HOST."))) { - QString ret, type = variableName.mid(11); +ProStringList ProFileEvaluator::Private::values(const ProString &variableName) const +{ + QHash::ConstIterator vli = statics.varList.find(variableName); + if (vli != statics.varList.constEnd()) { + int vlidx = *vli; + QString ret; + switch ((VarName)vlidx) { + case V_LITERAL_WHITESPACE: ret = QLatin1String("\t"); break; + case V_LITERAL_DOLLAR: ret = QLatin1String("$"); break; + case V_LITERAL_HASH: ret = QLatin1String("#"); break; + case V_OUT_PWD: // the outgoing dir (shadow of _PRO_FILE_PWD_) + ret = m_outputDir; + break; + case V_PWD: // containing directory of most nested project/include file + case V_IN_PWD: + ret = currentDirectory(); + break; + case V_DIR_SEPARATOR: + validateModes(); + ret = m_option->dir_sep; + break; + case V_DIRLIST_SEPARATOR: + ret = m_option->dirlist_sep; + break; + case V__LINE_: // currently executed line number + ret = QString::number(m_current.line); + break; + case V__FILE_: // currently executed file + ret = m_current.pro->fileName(); + break; + case V__DATE_: //current date/time + ret = QDateTime::currentDateTime().toString(); + break; + case V__PRO_FILE_: + ret = m_profileStack.first()->fileName(); + break; + case V__PRO_FILE_PWD_: + ret = m_profileStack.first()->directoryName(); + break; + case V__QMAKE_CACHE_: + ret = m_option->cachefile; + break; #if defined(Q_OS_WIN32) - if (type == QLatin1String("os")) { - ret = QLatin1String("Windows"); - } else if (type == QLatin1String("name")) { + case V_QMAKE_HOST_os: ret = QLatin1String("Windows"); break; + case V_QMAKE_HOST_name: { DWORD name_length = 1024; - wchar_t name[1024]; + TCHAR name[1024]; if (GetComputerName(name, &name_length)) - ret = QString::fromWCharArray(name); - } else if (type == QLatin1String("version") || type == QLatin1String("version_string")) { - QSysInfo::WinVersion ver = QSysInfo::WindowsVersion; - if (type == QLatin1String("version")) - ret = QString::number(ver); - else if (ver == QSysInfo::WV_Me) - ret = QLatin1String("WinMe"); - else if (ver == QSysInfo::WV_95) - ret = QLatin1String("Win95"); - else if (ver == QSysInfo::WV_98) - ret = QLatin1String("Win98"); - else if (ver == QSysInfo::WV_NT) - ret = QLatin1String("WinNT"); - else if (ver == QSysInfo::WV_2000) - ret = QLatin1String("Win2000"); - else if (ver == QSysInfo::WV_2000) - ret = QLatin1String("Win2003"); - else if (ver == QSysInfo::WV_XP) - ret = QLatin1String("WinXP"); - else if (ver == QSysInfo::WV_VISTA) - ret = QLatin1String("WinVista"); - else - ret = QLatin1String("Unknown"); - } else if (type == QLatin1String("arch")) { + ret = QString::fromUtf16((ushort*)name, name_length); + break; + } + case V_QMAKE_HOST_version: + ret = QString::number(QSysInfo::WindowsVersion); + break; + case V_QMAKE_HOST_version_string: + switch (QSysInfo::WindowsVersion) { + case QSysInfo::WV_Me: ret = QLatin1String("WinMe"); break; + case QSysInfo::WV_95: ret = QLatin1String("Win95"); break; + case QSysInfo::WV_98: ret = QLatin1String("Win98"); break; + case QSysInfo::WV_NT: ret = QLatin1String("WinNT"); break; + case QSysInfo::WV_2000: ret = QLatin1String("Win2000"); break; + case QSysInfo::WV_2003: ret = QLatin1String("Win2003"); break; + case QSysInfo::WV_XP: ret = QLatin1String("WinXP"); break; + case QSysInfo::WV_VISTA: ret = QLatin1String("WinVista"); break; + default: ret = QLatin1String("Unknown"); break; + } + break; + case V_QMAKE_HOST_arch: SYSTEM_INFO info; GetSystemInfo(&info); switch(info.wProcessorArchitecture) { @@ -2332,115 +3175,154 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName, ret = QLatin1String("Unknown"); break; } - } + break; #elif defined(Q_OS_UNIX) - struct utsname name; - if (!uname(&name)) { - if (type == QLatin1String("os")) - ret = QString::fromLatin1(name.sysname); - else if (type == QLatin1String("name")) - ret = QString::fromLatin1(name.nodename); - else if (type == QLatin1String("version")) - ret = QString::fromLatin1(name.release); - else if (type == QLatin1String("version_string")) - ret = QString::fromLatin1(name.version); - else if (type == QLatin1String("arch")) - ret = QString::fromLatin1(name.machine); - } + case V_QMAKE_HOST_os: + case V_QMAKE_HOST_name: + case V_QMAKE_HOST_version: + case V_QMAKE_HOST_version_string: + case V_QMAKE_HOST_arch: + { + struct utsname name; + const char *what; + if (!uname(&name)) { + switch (vlidx) { + case V_QMAKE_HOST_os: what = name.sysname; break; + case V_QMAKE_HOST_name: what = name.nodename; break; + case V_QMAKE_HOST_version: what = name.release; break; + case V_QMAKE_HOST_version_string: what = name.version; break; + case V_QMAKE_HOST_arch: what = name.machine; break; + } + ret = QString::fromLocal8Bit(what); + } + } #endif - return QStringList(ret); + } + return ProStringList(ProString(ret, NoHash)); } - QStringList result = place[variableName]; + ProStringList result = valuesDirect(variableName); if (result.isEmpty()) { - if (variableName == QLatin1String("TARGET")) { - result.append(QFileInfo(m_origfile).baseName()); - } else if (variableName == QLatin1String("TEMPLATE")) { - result.append(QLatin1String("app")); - } else if (variableName == QLatin1String("QMAKE_DIR_SEP")) { - result.append(Option::dirlist_sep); + if (variableName == statics.strTEMPLATE) { + result.append(ProString("app", NoHash)); + } else if (variableName == statics.strQMAKE_DIR_SEP) { + result.append(ProString(m_option->dirlist_sep, NoHash)); } } return result; } -QStringList ProFileEvaluator::Private::values(const QString &variableName) const -{ - return values(variableName, m_valuemap, currentProFile()); -} - -QStringList ProFileEvaluator::Private::values(const QString &variableName, const ProFile *pro) const -{ - return values(variableName, m_filevaluemap[pro], pro); -} - -ProFile *ProFileEvaluator::parsedProFile(const QString &fileName) +bool ProFileEvaluator::Private::evaluateFileDirect( + const QString &fileName, ProFileEvaluatorHandler::EvalFileType type, + ProFileEvaluator::LoadFlags flags) { - QFileInfo fi(fileName); - if (fi.exists()) { - QString fn = QDir::cleanPath(fi.absoluteFilePath()); - foreach (const ProFile *pf, d->m_profileStack) - if (pf->fileName() == fn) { - errorMessage(d->format("circular inclusion of %1").arg(fn)); - return 0; - } - ProFile *pro = new ProFile(fn); - if (d->read(pro)) - return pro; - delete pro; + if (ProFile *pro = m_parser->parsedProFile(fileName, true)) { + m_locationStack.push(m_current); + bool ok = (visitProFile(pro, type, flags) == ReturnTrue); + m_current = m_locationStack.pop(); + pro->deref(); + return ok; + } else { + return false; } - return 0; -} - -void ProFileEvaluator::releaseParsedProFile(ProFile *proFile) -{ - delete proFile; } -bool ProFileEvaluator::Private::evaluateFile(const QString &fileName) +bool ProFileEvaluator::Private::evaluateFile( + const QString &fileName, ProFileEvaluatorHandler::EvalFileType type, + ProFileEvaluator::LoadFlags flags) { - ProFile *pro = q->parsedProFile(fileName); - if (pro) { - m_profileStack.push(pro); - bool ok = (pro->Accept(this) == ProItem::ReturnTrue); - m_profileStack.pop(); - q->releaseParsedProFile(pro); - return ok; - } else { + if (fileName.isEmpty()) return false; - } + foreach (const ProFile *pf, m_profileStack) + if (pf->fileName() == fileName) { + evalError(fL1S("circular inclusion of %1").arg(fileName)); + return false; + } + return evaluateFileDirect(fileName, type, flags); } bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName) { - QString fn; - foreach (const QString &path, qmakeFeaturePaths()) { - QString fname = path + QLatin1Char('/') + fileName; - if (QFileInfo(fname).exists()) { - fn = fname; - break; + QString fn = fileName; + if (!fn.endsWith(QLatin1String(".prf"))) + fn += QLatin1String(".prf"); + + if ((!fileName.contains((ushort)'/') && !fileName.contains((ushort)'\\')) + || !IoUtils::exists(resolvePath(fn))) { + if (m_option->feature_roots.isEmpty()) + m_option->feature_roots = qmakeFeaturePaths(); + int start_root = 0; + QString currFn = currentFileName(); + if (IoUtils::fileName(currFn) == IoUtils::fileName(fn)) { + for (int root = 0; root < m_option->feature_roots.size(); ++root) + if (currFn == m_option->feature_roots.at(root) + fn) { + start_root = root + 1; + break; + } } - fname += QLatin1String(".prf"); - if (QFileInfo(fname).exists()) { - fn = fname; - break; + for (int root = start_root; root < m_option->feature_roots.size(); ++root) { + QString fname = m_option->feature_roots.at(root) + fn; + if (IoUtils::exists(fname)) { + fn = fname; + goto cool; + } } - } - if (fn.isEmpty()) return false; + + cool: + // It's beyond me why qmake has this inside this if ... + ProStringList &already = valuesRef(ProString("QMAKE_INTERNAL_INCLUDED_FEATURES")); + ProString afn(fn, NoHash); + if (already.contains(afn)) + return true; + already.append(afn); + } else { + fn = resolvePath(fn); + } + +#ifdef PROEVALUATOR_CUMULATIVE bool cumulative = m_cumulative; m_cumulative = false; - bool ok = evaluateFile(fn); +#endif + + // The path is fully normalized already. + bool ok = evaluateFileDirect(fn, ProFileEvaluatorHandler::EvalFeatureFile, + ProFileEvaluator::LoadProOnly); + +#ifdef PROEVALUATOR_CUMULATIVE m_cumulative = cumulative; +#endif return ok; } -QString ProFileEvaluator::Private::format(const char *fmt) const +bool ProFileEvaluator::Private::evaluateFileInto( + const QString &fileName, ProFileEvaluatorHandler::EvalFileType type, + QHash *values, FunctionDefs *funcs, EvalIntoMode mode) { - ProFile *pro = currentProFile(); - QString fileName = pro ? pro->fileName() : QLatin1String("Not a file"); - int lineNumber = pro ? m_lineNo : 0; - return QString::fromLatin1("%1(%2):").arg(fileName).arg(lineNumber) + QString::fromAscii(fmt); + ProFileEvaluator visitor(m_option, m_parser, m_handler); +#ifdef PROEVALUATOR_CUMULATIVE + visitor.d->m_cumulative = false; +#endif + visitor.d->m_outputDir = m_outputDir; +// visitor.d->m_valuemapStack.top() = *values; + if (funcs) + visitor.d->m_functionDefs = *funcs; + if (mode == EvalWithDefaults) + visitor.d->evaluateFeatureFile(QLatin1String("default_pre.prf")); + if (!visitor.d->evaluateFile(fileName, type, + (mode == EvalWithSetup) ? ProFileEvaluator::LoadAll : ProFileEvaluator::LoadProOnly)) + return false; + *values = visitor.d->m_valuemapStack.top(); +// if (funcs) +// *funcs = visitor.d->m_functionDefs; + return true; +} + +void ProFileEvaluator::Private::evalError(const QString &message) const +{ + if (!m_skipLevel) + m_handler->evalError(m_current.line ? m_current.pro->fileName() : QString(), + m_current.line, message); } @@ -2450,10 +3332,15 @@ QString ProFileEvaluator::Private::format(const char *fmt) const // /////////////////////////////////////////////////////////////////////// -ProFileEvaluator::ProFileEvaluator() - : d(new Private(this)) +void ProFileEvaluator::initialize() +{ + Private::initStatics(); +} + +ProFileEvaluator::ProFileEvaluator(ProFileOption *option, ProFileParser *parser, + ProFileEvaluatorHandler *handler) + : d(new Private(this, option, parser, handler)) { - Option::init(); } ProFileEvaluator::~ProFileEvaluator() @@ -2463,26 +3350,38 @@ ProFileEvaluator::~ProFileEvaluator() bool ProFileEvaluator::contains(const QString &variableName) const { - return d->m_valuemap.contains(variableName); + return d->m_valuemapStack.top().contains(ProString(variableName)); } -inline QStringList fixEnvVariables(const QStringList &x) +QString ProFileEvaluator::value(const QString &variable) const { - QStringList ret; - foreach (const QString &str, x) - ret << Option::fixString(str, Option::FixEnvVars); - return ret; -} + const QStringList &vals = values(variable); + if (!vals.isEmpty()) + return vals.first(); + return QString(); +} QStringList ProFileEvaluator::values(const QString &variableName) const { - return fixEnvVariables(d->values(variableName)); + const ProStringList &values = d->values(ProString(variableName)); + QStringList ret; + ret.reserve(values.size()); + foreach (const ProString &str, values) + ret << d->expandEnvVars(str.toQString()); + return ret; } QStringList ProFileEvaluator::values(const QString &variableName, const ProFile *pro) const { - return fixEnvVariables(d->values(variableName, pro)); + // It makes no sense to put any kind of magic into expanding these + const ProStringList &values = d->m_valuemapStack.at(0).value(ProString(variableName)); + QStringList ret; + ret.reserve(values.size()); + foreach (const ProString &str, values) + if (str.sourceFile() == pro) + ret << d->expandEnvVars(str.toQString()); + return ret; } QStringList ProFileEvaluator::absolutePathValues( @@ -2490,9 +3389,10 @@ QStringList ProFileEvaluator::absolutePathValues( { QStringList result; foreach (const QString &el, values(variable)) { - const QFileInfo info = QFileInfo(baseDirectory, el); - if (info.isDir()) - result << QDir::cleanPath(info.absoluteFilePath()); + QString absEl = IoUtils::isAbsolutePath(el) + ? d->sysrootify(el, baseDirectory) : IoUtils::resolvePath(baseDirectory, el); + if (IoUtils::fileType(absEl) == IoUtils::FileIsDir) + result << QDir::cleanPath(absEl); } return result; } @@ -2503,34 +3403,40 @@ QStringList ProFileEvaluator::absoluteFileValues( { QStringList result; foreach (const QString &el, pro ? values(variable, pro) : values(variable)) { - QFileInfo info(el); - if (info.isAbsolute()) { - if (info.exists()) { - result << QDir::cleanPath(el); + QString absEl; + if (IoUtils::isAbsolutePath(el)) { + const QString elWithSysroot = d->sysrootify(el, baseDirectory); + if (IoUtils::exists(elWithSysroot)) { + result << QDir::cleanPath(elWithSysroot); goto next; } + absEl = elWithSysroot; } else { foreach (const QString &dir, searchDirs) { - QFileInfo info(dir, el); - if (info.isFile()) { - result << QDir::cleanPath(info.filePath()); + QString fn = dir + QLatin1Char('/') + el; + if (IoUtils::exists(fn)) { + result << QDir::cleanPath(fn); goto next; } } if (baseDirectory.isEmpty()) goto next; - info = QFileInfo(baseDirectory, el); + absEl = baseDirectory + QLatin1Char('/') + el; } { - QFileInfo baseInfo(info.absolutePath()); - if (baseInfo.exists()) { - QString wildcard = info.fileName(); + absEl = QDir::cleanPath(absEl); + int nameOff = absEl.lastIndexOf(QLatin1Char('/')); + QString absDir = d->m_tmp1.setRawData(absEl.constData(), nameOff); + if (IoUtils::exists(absDir)) { + QString wildcard = d->m_tmp2.setRawData(absEl.constData() + nameOff + 1, + absEl.length() - nameOff - 1); if (wildcard.contains(QLatin1Char('*')) || wildcard.contains(QLatin1Char('?'))) { - QDir theDir(QDir::cleanPath(baseInfo.filePath())); + wildcard.detach(); // Keep m_tmp out of QRegExp's cache + QDir theDir(absDir); foreach (const QString &fn, theDir.entryList(QStringList(wildcard))) - if (fn != QLatin1String(".") && fn != QLatin1String("..")) - result << theDir.absoluteFilePath(fn); - } + if (fn != statics.strDot && fn != statics.strDotDot) + result << absDir + QLatin1Char('/') + fn; + } // else if (acceptMissing) } } next: ; @@ -2538,86 +3444,41 @@ QStringList ProFileEvaluator::absoluteFileValues( return result; } -ProFileEvaluator::TemplateType ProFileEvaluator::templateType() +ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const { - QStringList templ = values(QLatin1String("TEMPLATE")); + const ProStringList &templ = d->values(statics.strTEMPLATE); if (templ.count() >= 1) { - const QString &t = templ.last(); + const QString &t = templ.at(0).toQString(); if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive)) return TT_Application; if (!t.compare(QLatin1String("lib"), Qt::CaseInsensitive)) return TT_Library; if (!t.compare(QLatin1String("script"), Qt::CaseInsensitive)) return TT_Script; + if (!t.compare(QLatin1String("aux"), Qt::CaseInsensitive)) + return TT_Aux; if (!t.compare(QLatin1String("subdirs"), Qt::CaseInsensitive)) return TT_Subdirs; } return TT_Unknown; } -bool ProFileEvaluator::queryProFile(ProFile *pro) -{ - return d->read(pro); -} - -bool ProFileEvaluator::accept(ProFile *pro) +bool ProFileEvaluator::accept(ProFile *pro, LoadFlags flags) { - return pro->Accept(d); + return d->visitProFile(pro, ProFileEvaluatorHandler::EvalProjectFile, flags) == Private::ReturnTrue; } QString ProFileEvaluator::propertyValue(const QString &name) const { - return d->propertyValue(name); -} - -namespace { - template void insert(QHash *out, const QHash &in) - { - typename QHash::const_iterator i = in.begin(); - while (i != in.end()) { - out->insert(i.key(), i.value()); - ++i; - } - } -} // anon namespace - -void ProFileEvaluator::addVariables(const QHash &variables) -{ - insert(&(d->m_valuemap), variables); -} - -void ProFileEvaluator::addProperties(const QHash &properties) -{ - insert(&(d->m_properties), properties); -} - -void ProFileEvaluator::logMessage(const QString &message) -{ - if (d->m_verbose && !d->m_skipLevel) - fprintf(stderr, "%s\n", qPrintable(message)); -} - -void ProFileEvaluator::fileMessage(const QString &message) -{ - if (!d->m_skipLevel) - fprintf(stderr, "%s\n", qPrintable(message)); -} - -void ProFileEvaluator::errorMessage(const QString &message) -{ - if (!d->m_skipLevel) - fprintf(stderr, "%s\n", qPrintable(message)); -} - -void ProFileEvaluator::setVerbose(bool on) -{ - d->m_verbose = on; + return d->propertyValue(name, false); } +#ifdef PROEVALUATOR_CUMULATIVE void ProFileEvaluator::setCumulative(bool on) { d->m_cumulative = on; } +#endif void ProFileEvaluator::setOutputDir(const QString &dir) { diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index d4cdbcd..003042b 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -1,93 +1,136 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** This file is part of the Qt Linguist of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage +** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** ** Other Usage +** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #ifndef PROFILEEVALUATOR_H #define PROFILEEVALUATOR_H +#include "proparser_global.h" #include "proitems.h" -#include "abstractproitemvisitor.h" -#include #include #include -#include - -#if (!defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && !defined(__SUNPRO_CC) -# define HAVE_TEMPLATE_CLASS_FRIENDS +#ifndef QT_BOOTSTRAPPED +# include +#endif +#ifdef PROEVALUATOR_THREAD_SAFE +# include +# include #endif QT_BEGIN_NAMESPACE -class ProFileEvaluator +struct ProFileOption; +class ProFileParser; + +class PROPARSER_EXPORT ProFileEvaluatorHandler { -#ifdef HAVE_TEMPLATE_CLASS_FRIENDS -private: -#else public: -#endif + // qmake/project configuration error + virtual void configError(const QString &msg) = 0; + // Some error during evaluation + virtual void evalError(const QString &filename, int lineNo, const QString &msg) = 0; + // error() and message() from .pro file + virtual void fileMessage(const QString &msg) = 0; + + enum EvalFileType { EvalProjectFile, EvalIncludeFile, EvalConfigFile, EvalFeatureFile, EvalAuxFile }; + virtual void aboutToEval(ProFile *parent, ProFile *proFile, EvalFileType type) = 0; + virtual void doneWithEval(ProFile *parent) = 0; +}; + + +class PROPARSER_EXPORT ProFileEvaluator +{ class Private; public: + class FunctionDef { + public: + FunctionDef(ProFile *pro, int offset) : m_pro(pro), m_offset(offset) { m_pro->ref(); } + FunctionDef(const FunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); } + ~FunctionDef() { m_pro->deref(); } + FunctionDef &operator=(const FunctionDef &o) + { + if (this != &o) { + m_pro->deref(); + m_pro = o.m_pro; + m_pro->ref(); + m_offset = o.m_offset; + } + return *this; + } + ProFile *pro() const { return m_pro; } + const ushort *tokPtr() const { return m_pro->tokPtr() + m_offset; } + private: + ProFile *m_pro; + int m_offset; + }; + + struct FunctionDefs { + QHash testFunctions; + QHash replaceFunctions; + }; + enum TemplateType { TT_Unknown = 0, TT_Application, TT_Library, TT_Script, + TT_Aux, TT_Subdirs }; - ProFileEvaluator(); - virtual ~ProFileEvaluator(); + // Call this from a concurrency-free context + static void initialize(); + + ProFileEvaluator(ProFileOption *option, ProFileParser *parser, ProFileEvaluatorHandler *handler); + ~ProFileEvaluator(); - ProFileEvaluator::TemplateType templateType(); - virtual bool contains(const QString &variableName) const; - void setVerbose(bool on); // Default is false + ProFileEvaluator::TemplateType templateType() const; +#ifdef PROEVALUATOR_CUMULATIVE void setCumulative(bool on); // Default is true! +#endif void setOutputDir(const QString &dir); // Default is empty - bool queryProFile(ProFile *pro); - bool accept(ProFile *pro); + enum LoadFlag { + LoadProOnly = 0, + LoadPreFiles = 1, + LoadPostFiles = 2, + LoadAll = LoadPreFiles|LoadPostFiles + }; + Q_DECLARE_FLAGS(LoadFlags, LoadFlag) + bool accept(ProFile *pro, LoadFlags flags = LoadAll); - void addVariables(const QHash &variables); - void addProperties(const QHash &properties); + bool contains(const QString &variableName) const; + QString value(const QString &variableName) const; QStringList values(const QString &variableName) const; QStringList values(const QString &variableName, const ProFile *pro) const; QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const; @@ -96,21 +139,83 @@ public: const ProFile *pro) const; QString propertyValue(const QString &val) const; - // for our descendents - virtual ProFile *parsedProFile(const QString &fileName); - virtual void releaseParsedProFile(ProFile *proFile); - virtual void logMessage(const QString &msg); - virtual void errorMessage(const QString &msg); // .pro parse errors - virtual void fileMessage(const QString &msg); // error() and message() from .pro file - private: Private *d; -#ifdef HAVE_TEMPLATE_CLASS_FRIENDS - template friend class QTypeInfo; + friend struct ProFileOption; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(ProFileEvaluator::LoadFlags) + +// This struct is from qmake, but we are not using everything. +struct PROPARSER_EXPORT ProFileOption +{ + ProFileOption(); + ~ProFileOption(); + + //simply global convenience + //QString libtool_ext; + //QString pkgcfg_ext; + //QString prf_ext; + //QString prl_ext; + //QString ui_ext; + //QStringList h_ext; + //QStringList cpp_ext; + //QString h_moc_ext; + //QString cpp_moc_ext; + //QString obj_ext; + //QString lex_ext; + //QString yacc_ext; + //QString h_moc_mod; + //QString cpp_moc_mod; + //QString lex_mod; + //QString yacc_mod; + QString dir_sep; + QString dirlist_sep; + QString qmakespec; + QString cachefile; + QHash properties; +#ifndef QT_BOOTSTRAPPED + QProcessEnvironment environment; +#endif + QString sysroot; + + //QString pro_ext; + //QString res_ext; + + // -nocache, -cache, -spec, QMAKESPEC + // -set persistent value + void setCommandLineArguments(const QStringList &args); +#ifdef PROEVALUATOR_INIT_PROPS + bool initProperties(const QString &qmake); +#endif + + private: + friend class ProFileEvaluator; + friend class ProFileEvaluator::Private; + + void applyHostMode(); + QString getEnv(const QString &) const; + + QHash base_valuemap; // Cached results of qmake.conf, .qmake.cache & default_pre.prf + ProFileEvaluator::FunctionDefs base_functions; + QStringList feature_roots; + QString qmakespec_name; + QString precmds, postcmds; + enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; + HOST_MODE host_mode; + enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, + TARG_SYMBIAN_MODE }; + TARG_MODE target_mode; +#ifdef PROEVALUATOR_THREAD_SAFE + QMutex mutex; + QWaitCondition cond; + bool base_inProgress; #endif }; +Q_DECLARE_TYPEINFO(ProFileEvaluator::FunctionDef, Q_MOVABLE_TYPE); + QT_END_NAMESPACE #endif // PROFILEEVALUATOR_H diff --git a/tools/linguist/shared/profileparser.cpp b/tools/linguist/shared/profileparser.cpp new file mode 100644 index 0000000..a541ab3 --- /dev/null +++ b/tools/linguist/shared/profileparser.cpp @@ -0,0 +1,1028 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "profileparser.h" + +#include "ioutils.h" +using namespace ProFileEvaluatorInternal; + +#include +#ifdef PROPARSER_THREAD_SAFE +# include +#endif + +QT_BEGIN_NAMESPACE + +/////////////////////////////////////////////////////////////////////// +// +// ProFileCache +// +/////////////////////////////////////////////////////////////////////// + +ProFileCache::~ProFileCache() +{ + foreach (const Entry &ent, parsed_files) + if (ent.pro) + ent.pro->deref(); +} + +void ProFileCache::discardFile(const QString &fileName) +{ +#ifdef PROPARSER_THREAD_SAFE + QMutexLocker lck(&mutex); +#endif + QHash::Iterator it = parsed_files.find(fileName); + if (it != parsed_files.end()) { + if (it->pro) + it->pro->deref(); + parsed_files.erase(it); + } +} + +void ProFileCache::discardFiles(const QString &prefix) +{ +#ifdef PROPARSER_THREAD_SAFE + QMutexLocker lck(&mutex); +#endif + QHash::Iterator + it = parsed_files.begin(), + end = parsed_files.end(); + while (it != end) + if (it.key().startsWith(prefix)) { + if (it->pro) + it->pro->deref(); + it = parsed_files.erase(it); + } else { + ++it; + } +} + + +////////// Parser /////////// + +#define fL1S(s) QString::fromLatin1(s) + +namespace { // MSVC2010 doesn't seem to know the semantics of "static" ... + +static struct { + QString strelse; + QString strfor; + QString strdefineTest; + QString strdefineReplace; +} statics; + +} + +void ProFileParser::initialize() +{ + if (!statics.strelse.isNull()) + return; + + statics.strelse = QLatin1String("else"); + statics.strfor = QLatin1String("for"); + statics.strdefineTest = QLatin1String("defineTest"); + statics.strdefineReplace = QLatin1String("defineReplace"); +} + +ProFileParser::ProFileParser(ProFileCache *cache, ProFileParserHandler *handler) + : m_cache(cache) + , m_handler(handler) +{ + // So that single-threaded apps don't have to call initialize() for now. + initialize(); +} + +ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const QString *contents) +{ + ProFile *pro; + if (cache && m_cache) { + ProFileCache::Entry *ent; +#ifdef PROPARSER_THREAD_SAFE + QMutexLocker locker(&m_cache->mutex); +#endif + QHash::Iterator it = m_cache->parsed_files.find(fileName); + if (it != m_cache->parsed_files.end()) { + ent = &*it; +#ifdef PROPARSER_THREAD_SAFE + if (ent->locker && !ent->locker->done) { + ++ent->locker->waiters; + QThreadPool::globalInstance()->releaseThread(); + ent->locker->cond.wait(locker.mutex()); + QThreadPool::globalInstance()->reserveThread(); + if (!--ent->locker->waiters) { + delete ent->locker; + ent->locker = 0; + } + } +#endif + if ((pro = ent->pro)) + pro->ref(); + } else { + ent = &m_cache->parsed_files[fileName]; +#ifdef PROPARSER_THREAD_SAFE + ent->locker = new ProFileCache::Entry::Locker; + locker.unlock(); +#endif + pro = new ProFile(fileName); + if (!(!contents ? read(pro) : read(pro, *contents))) { + delete pro; + pro = 0; + } else { + pro->ref(); + } + ent->pro = pro; +#ifdef PROPARSER_THREAD_SAFE + locker.relock(); + if (ent->locker->waiters) { + ent->locker->done = true; + ent->locker->cond.wakeAll(); + } else { + delete ent->locker; + ent->locker = 0; + } +#endif + } + } else { + pro = new ProFile(fileName); + if (!(!contents ? read(pro) : read(pro, *contents))) { + delete pro; + pro = 0; + } + } + return pro; +} + +bool ProFileParser::read(ProFile *pro) +{ + QFile file(pro->fileName()); + if (!file.open(QIODevice::ReadOnly)) { + if (m_handler && IoUtils::exists(pro->fileName())) + m_handler->parseError(QString(), 0, fL1S("%1 not readable.").arg(pro->fileName())); + return false; + } + + QString content(QString::fromLocal8Bit(file.readAll())); + file.close(); + return read(pro, content); +} + +void ProFileParser::putTok(ushort *&tokPtr, ushort tok) +{ + *tokPtr++ = tok; +} + +void ProFileParser::putBlockLen(ushort *&tokPtr, uint len) +{ + *tokPtr++ = (ushort)len; + *tokPtr++ = (ushort)(len >> 16); +} + +void ProFileParser::putBlock(ushort *&tokPtr, const ushort *buf, uint len) +{ + memcpy(tokPtr, buf, len * 2); + tokPtr += len; +} + +void ProFileParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len) +{ + uint hash = ProString::hash((const QChar *)buf, len); + ushort *tokPtr = pTokPtr; + *tokPtr++ = (ushort)hash; + *tokPtr++ = (ushort)(hash >> 16); + *tokPtr++ = (ushort)len; + memcpy(tokPtr, buf, len * 2); + pTokPtr = tokPtr + len; +} + +void ProFileParser::finalizeHashStr(ushort *buf, uint len) +{ + buf[-4] = TokHashLiteral; + buf[-1] = len; + uint hash = ProString::hash((const QChar *)buf, len); + buf[-3] = (ushort)hash; + buf[-2] = (ushort)(hash >> 16); +} + +bool ProFileParser::read(ProFile *pro, const QString &in) +{ + m_proFile = pro; + m_lineNo = 1; + + // Final precompiled token stream buffer + QString tokBuff; + // Worst-case size calculations: + // - line marker adds 1 (2-nl) to 1st token of each line + // - empty assignment "A=":2 => + // TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + + // TokValueTerminator(1) == 7 (8) + // - non-empty assignment "A=B C":5 => + // TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + + // TokLiteral(1) + len(1) + "B"(1) + + // TokLiteral(1) + len(1) + "C"(1) + TokValueTerminator(1) == 13 (14) + // - variable expansion: "$$f":3 => + // TokVariable(1) + hash(2) + len(1) + "f"(1) = 5 + // - function expansion: "$$f()":5 => + // TokFuncName(1) + hash(2) + len(1) + "f"(1) + TokFuncTerminator(1) = 6 + // - scope: "X:":2 => + // TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokCondition(1) + + // TokBranch(1) + len(2) + ... + len(2) + ... == 10 + // - test: "X():":4 => + // TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokTestCall(1) + TokFuncTerminator(1) + + // TokBranch(1) + len(2) + ... + len(2) + ... == 11 + // - "for(A,B):":9 => + // TokForLoop(1) + hash(2) + len(1) + "A"(1) + + // len(2) + TokLiteral(1) + len(1) + "B"(1) + TokValueTerminator(1) + + // len(2) + ... + TokTerminator(1) == 14 (15) + tokBuff.reserve((in.size() + 1) * 5); + ushort *tokPtr = (ushort *)tokBuff.constData(); // Current writing position + + // Expression precompiler buffer. + QString xprBuff; + xprBuff.reserve(tokBuff.capacity()); // Excessive, but simple + ushort * const buf = (ushort *)xprBuff.constData(); + + // Parser state + m_blockstack.clear(); + m_blockstack.resize(1); + + QStack xprStack; + xprStack.reserve(10); + + // We rely on QStrings being null-terminated, so don't maintain a global end pointer. + const ushort *cur = (const ushort *)in.unicode(); + m_canElse = false; + freshLine: + m_state = StNew; + m_invert = false; + m_operator = NoOperator; + m_markLine = m_lineNo; + m_inError = false; + Context context = CtxTest; + int parens = 0; // Braces in value context + int argc = 0; + int wordCount = 0; // Number of words in currently accumulated expression + bool putSpace = false; // Only ever true inside quoted string + bool lineMarked = true; // For in-expression markers + ushort needSep = TokNewStr; // Complementary to putSpace: separator outside quotes + ushort quote = 0; + ushort term = 0; + + ushort *ptr = buf; + ptr += 4; + ushort *xprPtr = ptr; + +#define FLUSH_LHS_LITERAL() \ + do { \ + if ((tlen = ptr - xprPtr)) { \ + finalizeHashStr(xprPtr, tlen); \ + if (needSep) { \ + wordCount++; \ + needSep = 0; \ + } \ + } else { \ + ptr -= 4; \ + } \ + } while (0) + +#define FLUSH_RHS_LITERAL() \ + do { \ + if ((tlen = ptr - xprPtr)) { \ + xprPtr[-2] = TokLiteral | needSep; \ + xprPtr[-1] = tlen; \ + if (needSep) { \ + wordCount++; \ + needSep = 0; \ + } \ + } else { \ + ptr -= 2; \ + } \ + } while (0) + +#define FLUSH_LITERAL() \ + do { \ + if (context == CtxTest) \ + FLUSH_LHS_LITERAL(); \ + else \ + FLUSH_RHS_LITERAL(); \ + } while (0) + +#define FLUSH_VALUE_LIST() \ + do { \ + if (wordCount > 1) { \ + xprPtr = tokPtr; \ + if (*xprPtr == TokLine) \ + xprPtr += 2; \ + tokPtr[-1] = ((*xprPtr & TokMask) == TokLiteral) ? wordCount : 0; \ + } else { \ + tokPtr[-1] = 0; \ + } \ + tokPtr = ptr; \ + putTok(tokPtr, TokValueTerminator); \ + } while (0) + + forever { + ushort c; + + // First, skip leading whitespace + for (;; ++cur) { + c = *cur; + if (c == '\n') { + ++cur; + goto flushLine; + } else if (!c) { + goto flushLine; + } else if (c != ' ' && c != '\t' && c != '\r') { + break; + } + } + + // Then strip comments. Yep - no escaping is possible. + const ushort *end; // End of this line + const ushort *cptr; // Start of next line + for (cptr = cur;; ++cptr) { + c = *cptr; + if (c == '#') { + for (end = cptr; (c = *++cptr);) { + if (c == '\n') { + ++cptr; + break; + } + } + if (end == cur) { // Line with only a comment (sans whitespace) + if (m_markLine == m_lineNo) + m_markLine++; + // Qmake bizarreness: such lines do not affect line continuations + goto ignore; + } + break; + } + if (!c) { + end = cptr; + break; + } + if (c == '\n') { + end = cptr++; + break; + } + } + + // Then look for line continuations. Yep - no escaping here as well. + bool lineCont; + forever { + // We don't have to check for underrun here, as we already determined + // that the line is non-empty. + ushort ec = *(end - 1); + if (ec == '\\') { + --end; + lineCont = true; + break; + } + if (ec != ' ' && ec != '\t' && ec != '\r') { + lineCont = false; + break; + } + --end; + } + + // Finally, do the tokenization + ushort tok, rtok; + int tlen; + newWord: + do { + if (cur == end) + goto lineEnd; + c = *cur++; + } while (c == ' ' || c == '\t'); + forever { + if (c == '$') { + if (*cur == '$') { // may be EOF, EOL, WS, '#' or '\\' if past end + cur++; + if (putSpace) { + putSpace = false; + *ptr++ = ' '; + } + FLUSH_LITERAL(); + if (!lineMarked) { + lineMarked = true; + *ptr++ = TokLine; + *ptr++ = (ushort)m_lineNo; + } + term = 0; + tok = TokVariable; + c = *cur; + if (c == '[') { + ptr += 2; + tok = TokProperty; + term = ']'; + c = *++cur; + } else if (c == '{') { + ptr += 4; + term = '}'; + c = *++cur; + } else if (c == '(') { + // FIXME: could/should expand this immediately + ptr += 2; + tok = TokEnvVar; + term = ')'; + c = *++cur; + } else { + ptr += 4; + } + xprPtr = ptr; + rtok = tok; + while ((c & 0xFF00) || c == '.' || c == '_' || + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9')) { + *ptr++ = c; + if (++cur == end) { + c = 0; + goto notfunc; + } + c = *cur; + } + if (tok == TokVariable && c == '(') + tok = TokFuncName; + notfunc: + if (quote) + tok |= TokQuoted; + if (needSep) { + tok |= needSep; + wordCount++; + } + tlen = ptr - xprPtr; + if (rtok == TokVariable) { + xprPtr[-4] = tok; + uint hash = ProString::hash((const QChar *)xprPtr, tlen); + xprPtr[-3] = (ushort)hash; + xprPtr[-2] = (ushort)(hash >> 16); + } else { + xprPtr[-2] = tok; + } + xprPtr[-1] = tlen; + if ((tok & TokMask) == TokFuncName) { + cur++; + funcCall: + { + xprStack.resize(xprStack.size() + 1); + ParseCtx &top = xprStack.top(); + top.parens = parens; + top.quote = quote; + top.terminator = term; + top.context = context; + top.argc = argc; + top.wordCount = wordCount; + } + parens = 0; + quote = 0; + term = 0; + argc = 1; + context = CtxArgs; + nextToken: + wordCount = 0; + nextWord: + ptr += (context == CtxTest) ? 4 : 2; + xprPtr = ptr; + needSep = TokNewStr; + goto newWord; + } + if (term) { + cur++; + checkTerm: + if (c != term) { + parseError(fL1S("Missing %1 terminator [found %2]") + .arg(QChar(term)) + .arg(c ? QString(c) : QString::fromLatin1("end-of-line"))); + pro->setOk(false); + m_inError = true; + if (c) + cur--; + // Just parse on, as if there was a terminator ... + } + } + joinToken: + ptr += (context == CtxTest) ? 4 : 2; + xprPtr = ptr; + needSep = 0; + goto nextChr; + } + } else if (c == '\\' && cur != end) { + static const char symbols[] = "[]{}()$\\'\""; + ushort c2 = *cur; + if (!(c2 & 0xff00) && strchr(symbols, c2)) { + c = c2; + cur++; + } + } else if (quote) { + if (c == quote) { + quote = 0; + if (putSpace) { + putSpace = false; + *ptr++ = ' '; + } + goto nextChr; + } else if (c == ' ' || c == '\t') { + putSpace = true; + goto nextChr; + } else if (c == '!' && ptr == xprPtr && context == CtxTest) { + m_invert ^= true; + goto nextChr; + } + } else if (c == '\'' || c == '"') { + quote = c; + goto nextChr; + } else if (c == ' ' || c == '\t') { + FLUSH_LITERAL(); + goto nextWord; + } else if (context == CtxArgs) { + // Function arg context + if (c == '(') { + ++parens; + } else if (c == ')') { + if (--parens < 0) { + FLUSH_RHS_LITERAL(); + *ptr++ = TokFuncTerminator; + int theargc = argc; + { + ParseCtx &top = xprStack.top(); + parens = top.parens; + quote = top.quote; + term = top.terminator; + context = top.context; + argc = top.argc; + wordCount = top.wordCount; + xprStack.resize(xprStack.size() - 1); + } + if (term == ':') { + finalizeCall(tokPtr, buf, ptr, theargc); + goto nextItem; + } else if (term == '}') { + c = (cur == end) ? 0 : *cur++; + goto checkTerm; + } else { + Q_ASSERT(!term); + goto joinToken; + } + } + } else if (!parens && c == ',') { + FLUSH_RHS_LITERAL(); + *ptr++ = TokArgSeparator; + argc++; + goto nextToken; + } + } else if (context == CtxTest) { + // Test or LHS context + if (c == '(') { + FLUSH_LHS_LITERAL(); + if (wordCount != 1) { + if (wordCount) + parseError(fL1S("Extra characters after test expression.")); + else + parseError(fL1S("Opening parenthesis without prior test name.")); + pro->setOk(false); + ptr = buf; // Put empty function name + } + *ptr++ = TokTestCall; + term = ':'; + goto funcCall; + } else if (c == '!' && ptr == xprPtr) { + m_invert ^= true; + goto nextChr; + } else if (c == ':') { + FLUSH_LHS_LITERAL(); + finalizeCond(tokPtr, buf, ptr, wordCount); + if (m_state == StNew) + parseError(fL1S("And operator without prior condition.")); + else + m_operator = AndOperator; + nextItem: + ptr = buf; + goto nextToken; + } else if (c == '|') { + FLUSH_LHS_LITERAL(); + finalizeCond(tokPtr, buf, ptr, wordCount); + if (m_state != StCond) + parseError(fL1S("Or operator without prior condition.")); + else + m_operator = OrOperator; + goto nextItem; + } else if (c == '{') { + FLUSH_LHS_LITERAL(); + finalizeCond(tokPtr, buf, ptr, wordCount); + flushCond(tokPtr); + ++m_blockstack.top().braceLevel; + goto nextItem; + } else if (c == '}') { + FLUSH_LHS_LITERAL(); + finalizeCond(tokPtr, buf, ptr, wordCount); + flushScopes(tokPtr); + closeScope: + if (!m_blockstack.top().braceLevel) { + parseError(fL1S("Excess closing brace.")); + } else if (!--m_blockstack.top().braceLevel + && m_blockstack.count() != 1) { + leaveScope(tokPtr); + m_state = StNew; + m_canElse = false; + m_markLine = m_lineNo; + } + goto nextItem; + } else if (c == '+') { + tok = TokAppend; + goto do2Op; + } else if (c == '-') { + tok = TokRemove; + goto do2Op; + } else if (c == '*') { + tok = TokAppendUnique; + goto do2Op; + } else if (c == '~') { + tok = TokReplace; + do2Op: + if (*cur == '=') { + cur++; + goto doOp; + } + } else if (c == '=') { + tok = TokAssign; + doOp: + FLUSH_LHS_LITERAL(); + flushCond(tokPtr); + putLineMarker(tokPtr); + if (wordCount != 1) { + parseError(fL1S("Assignment needs exactly one word on the left hand side.")); + pro->setOk(false); + // Put empty variable name. + } else { + putBlock(tokPtr, buf, ptr - buf); + } + putTok(tokPtr, tok); + context = CtxValue; + ptr = ++tokPtr; + goto nextToken; + } + } else { // context == CtxValue + if (c == '{') { + ++parens; + } else if (c == '}') { + if (!parens) { + FLUSH_RHS_LITERAL(); + FLUSH_VALUE_LIST(); + context = CtxTest; + goto closeScope; + } + --parens; + } + } + if (putSpace) { + putSpace = false; + *ptr++ = ' '; + } + *ptr++ = c; + nextChr: + if (cur == end) + goto lineEnd; + c = *cur++; + } + + lineEnd: + if (lineCont) { + if (quote) { + putSpace = true; + } else { + FLUSH_LITERAL(); + needSep = TokNewStr; + ptr += (context == CtxTest) ? 4 : 2; + xprPtr = ptr; + } + } else { + c = '\n'; + cur = cptr; + flushLine: + FLUSH_LITERAL(); + if (quote) { + parseError(fL1S("Missing closing %1 quote").arg(QChar(quote))); + if (!xprStack.isEmpty()) { + context = xprStack.at(0).context; + xprStack.clear(); + } + goto flErr; + } else if (!xprStack.isEmpty()) { + parseError(fL1S("Missing closing parenthesis in function call")); + context = xprStack.at(0).context; + xprStack.clear(); + flErr: + pro->setOk(false); + if (context == CtxValue) { + tokPtr[-1] = 0; // sizehint + putTok(tokPtr, TokValueTerminator); + } else { + bogusTest(tokPtr); + } + } else if (context == CtxValue) { + FLUSH_VALUE_LIST(); + } else { + finalizeCond(tokPtr, buf, ptr, wordCount); + } + if (!c) + break; + ++m_lineNo; + goto freshLine; + } + + if (!lineCont) { + cur = cptr; + ++m_lineNo; + goto freshLine; + } + lineMarked = false; + ignore: + cur = cptr; + ++m_lineNo; + } + + flushScopes(tokPtr); + if (m_blockstack.size() > 1) { + parseError(fL1S("Missing closing brace(s).")); + pro->setOk(false); + } + while (m_blockstack.size()) + leaveScope(tokPtr); + xprBuff.clear(); + *pro->itemsRef() = QString(tokBuff.constData(), tokPtr - (ushort *)tokBuff.constData()); + return true; + +#undef FLUSH_VALUE_LIST +#undef FLUSH_LITERAL +#undef FLUSH_LHS_LITERAL +#undef FLUSH_RHS_LITERAL +} + +void ProFileParser::putLineMarker(ushort *&tokPtr) +{ + if (m_markLine) { + *tokPtr++ = TokLine; + *tokPtr++ = (ushort)m_markLine; + m_markLine = 0; + } +} + +void ProFileParser::enterScope(ushort *&tokPtr, bool special, ScopeState state) +{ + m_blockstack.resize(m_blockstack.size() + 1); + m_blockstack.top().special = special; + m_blockstack.top().start = tokPtr; + tokPtr += 2; + m_state = state; + m_canElse = false; + if (special) + m_markLine = m_lineNo; +} + +void ProFileParser::leaveScope(ushort *&tokPtr) +{ + if (m_blockstack.top().inBranch) { + // Put empty else block + putBlockLen(tokPtr, 0); + } + if (ushort *start = m_blockstack.top().start) { + putTok(tokPtr, TokTerminator); + uint len = tokPtr - start - 2; + start[0] = (ushort)len; + start[1] = (ushort)(len >> 16); + } + m_blockstack.resize(m_blockstack.size() - 1); +} + +// If we are on a fresh line, close all open one-line scopes. +void ProFileParser::flushScopes(ushort *&tokPtr) +{ + if (m_state == StNew) { + while (!m_blockstack.top().braceLevel && m_blockstack.size() > 1) + leaveScope(tokPtr); + if (m_blockstack.top().inBranch) { + m_blockstack.top().inBranch = false; + // Put empty else block + putBlockLen(tokPtr, 0); + } + m_canElse = false; + } +} + +// If there is a pending conditional, enter a new scope, otherwise flush scopes. +void ProFileParser::flushCond(ushort *&tokPtr) +{ + if (m_state == StCond) { + putTok(tokPtr, TokBranch); + m_blockstack.top().inBranch = true; + enterScope(tokPtr, false, StNew); + } else { + flushScopes(tokPtr); + } +} + +void ProFileParser::finalizeTest(ushort *&tokPtr) +{ + flushScopes(tokPtr); + putLineMarker(tokPtr); + if (m_operator != NoOperator) { + putTok(tokPtr, (m_operator == AndOperator) ? TokAnd : TokOr); + m_operator = NoOperator; + } + if (m_invert) { + putTok(tokPtr, TokNot); + m_invert = false; + } + m_state = StCond; + m_canElse = true; +} + +void ProFileParser::bogusTest(ushort *&tokPtr) +{ + flushScopes(tokPtr); + m_operator = NoOperator; + m_invert = false; + m_state = StCond; + m_canElse = true; + m_proFile->setOk(false); +} + +void ProFileParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount) +{ + if (wordCount != 1) { + if (wordCount) { + parseError(fL1S("Extra characters after test expression.")); + bogusTest(tokPtr); + } + return; + } + + // Check for magic tokens + if (*uc == TokHashLiteral) { + uint nlen = uc[3]; + ushort *uce = uc + 4 + nlen; + if (uce == ptr) { + m_tmp.setRawData((QChar *)uc + 4, nlen); + if (!m_tmp.compare(statics.strelse, Qt::CaseInsensitive)) { + if (m_invert || m_operator != NoOperator) { + parseError(fL1S("Unexpected operator in front of else.")); + return; + } + BlockScope &top = m_blockstack.top(); + if (m_canElse && (!top.special || top.braceLevel)) { + // A list of tests (the last one likely with side effects), + // but no assignment, scope, etc. + putTok(tokPtr, TokBranch); + // Put empty then block + putBlockLen(tokPtr, 0); + enterScope(tokPtr, false, StCtrl); + return; + } + forever { + BlockScope &top = m_blockstack.top(); + if (top.inBranch && (!top.special || top.braceLevel)) { + top.inBranch = false; + enterScope(tokPtr, false, StCtrl); + return; + } + if (top.braceLevel || m_blockstack.size() == 1) + break; + leaveScope(tokPtr); + } + parseError(fL1S("Unexpected 'else'.")); + return; + } + } + } + + finalizeTest(tokPtr); + putBlock(tokPtr, uc, ptr - uc); + putTok(tokPtr, TokCondition); +} + +void ProFileParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc) +{ + // Check for magic tokens + if (*uc == TokHashLiteral) { + uint nlen = uc[3]; + ushort *uce = uc + 4 + nlen; + if (*uce == TokTestCall) { + uce++; + m_tmp.setRawData((QChar *)uc + 4, nlen); + const QString *defName; + ushort defType; + if (m_tmp == statics.strfor) { + flushCond(tokPtr); + putLineMarker(tokPtr); + if (m_invert || m_operator == OrOperator) { + // '|' could actually work reasonably, but qmake does nonsense here. + parseError(fL1S("Unexpected operator in front of for().")); + return; + } + if (*uce == (TokLiteral|TokNewStr)) { + nlen = uce[1]; + uc = uce + 2 + nlen; + if (*uc == TokFuncTerminator) { + // for(literal) (only "ever" would be legal if qmake was sane) + putTok(tokPtr, TokForLoop); + putHashStr(tokPtr, (ushort *)0, (uint)0); + putBlockLen(tokPtr, 1 + 3 + nlen + 1); + putTok(tokPtr, TokHashLiteral); + putHashStr(tokPtr, uce + 2, nlen); + didFor: + putTok(tokPtr, TokValueTerminator); + enterScope(tokPtr, true, StCtrl); + return; + } else if (*uc == TokArgSeparator && argc == 2) { + // for(var, something) + uc++; + putTok(tokPtr, TokForLoop); + putHashStr(tokPtr, uce + 2, nlen); + doFor: + nlen = ptr - uc; + putBlockLen(tokPtr, nlen + 1); + putBlock(tokPtr, uc, nlen); + goto didFor; + } + } else if (argc == 1) { + // for(non-literal) (this wouldn't be here if qmake was sane) + putTok(tokPtr, TokForLoop); + putHashStr(tokPtr, (ushort *)0, (uint)0); + uc = uce; + goto doFor; + } + parseError(fL1S("Syntax is for(var, list), for(var, forever) or for(ever).")); + return; + } else if (m_tmp == statics.strdefineReplace) { + defName = &statics.strdefineReplace; + defType = TokReplaceDef; + goto deffunc; + } else if (m_tmp == statics.strdefineTest) { + defName = &statics.strdefineTest; + defType = TokTestDef; + deffunc: + flushScopes(tokPtr); + putLineMarker(tokPtr); + if (m_invert) { + parseError(fL1S("Unexpected operator in front of function definition.")); + return; + } + if (*uce == (TokLiteral|TokNewStr)) { + uint nlen = uce[1]; + if (uce[nlen + 2] == TokFuncTerminator) { + if (m_operator != NoOperator) { + putTok(tokPtr, (m_operator == AndOperator) ? TokAnd : TokOr); + m_operator = NoOperator; + } + putTok(tokPtr, defType); + putHashStr(tokPtr, uce + 2, nlen); + uc = uce + 2 + nlen + 1; + enterScope(tokPtr, true, StCtrl); + return; + } + } + parseError(fL1S("%1(function) requires one literal argument.").arg(*defName)); + return; + } + } + } + + finalizeTest(tokPtr); + putBlock(tokPtr, uc, ptr - uc); +} + +void ProFileParser::parseError(const QString &msg) const +{ + if (!m_inError && m_handler) + m_handler->parseError(m_proFile->fileName(), m_lineNo, msg); +} + +QT_END_NAMESPACE diff --git a/tools/linguist/shared/profileparser.h b/tools/linguist/shared/profileparser.h new file mode 100644 index 0000000..3f4593a --- /dev/null +++ b/tools/linguist/shared/profileparser.h @@ -0,0 +1,186 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#ifndef PROFILEPARSER_H +#define PROFILEPARSER_H + +#include "proparser_global.h" +#include "proitems.h" +#include +#include +#ifdef PROPARSER_THREAD_SAFE +# include +# include +#endif + +// Be fast even for debug builds +#ifdef __GNUC__ +# define ALWAYS_INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) +# define ALWAYS_INLINE __forceinline +#else +# define ALWAYS_INLINE inline +#endif + +QT_BEGIN_NAMESPACE +class PROPARSER_EXPORT ProFileParserHandler +{ +public: + // Some error during parsing + virtual void parseError(const QString &filename, int lineNo, const QString &msg) = 0; +}; + +class ProFileCache; + +class PROPARSER_EXPORT ProFileParser +{ +public: + // Call this from a concurrency-free context + static void initialize(); + + ProFileParser(ProFileCache *cache, ProFileParserHandler *handler); + + // fileName is expected to be absolute and cleanPath()ed. + // If contents is non-null, it will be used instead of the file's actual content + ProFile *parsedProFile(const QString &fileName, bool cache = false, + const QString *contents = 0); + ProFile *parsedProBlock(const QString &name, const QString &contents) + { return parsedProFile(name, false, &contents); } + +private: + struct BlockScope { + BlockScope() : start(0), braceLevel(0), special(false), inBranch(false) {} + BlockScope(const BlockScope &other) { *this = other; } + ushort *start; // Where this block started; store length here + int braceLevel; // Nesting of braces in scope + bool special; // Single-line conditionals inside loops, etc. cannot have else branches + bool inBranch; // The 'else' branch of the previous TokBranch is still open + }; + + enum ScopeState { + StNew, // Fresh scope + StCtrl, // Control statement (for or else) met on current line + StCond // Conditionals met on current line + }; + + enum Context { CtxTest, CtxValue, CtxArgs }; + struct ParseCtx { + int parens; // Nesting of non-functional parentheses + int argc; // Number of arguments in current function call + int wordCount; // Number of words in current expression + Context context; + ushort quote; // Enclosing quote type + ushort terminator; // '}' if replace function call is braced, ':' if test function + }; + + bool read(ProFile *pro); + bool read(ProFile *pro, const QString &content); + + ALWAYS_INLINE void putTok(ushort *&tokPtr, ushort tok); + ALWAYS_INLINE void putBlockLen(ushort *&tokPtr, uint len); + ALWAYS_INLINE void putBlock(ushort *&tokPtr, const ushort *buf, uint len); + void putHashStr(ushort *&pTokPtr, const ushort *buf, uint len); + void finalizeHashStr(ushort *buf, uint len); + void putLineMarker(ushort *&tokPtr); + void finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount); + void finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc); + void finalizeTest(ushort *&tokPtr); + void bogusTest(ushort *&tokPtr); + void enterScope(ushort *&tokPtr, bool special, ScopeState state); + void leaveScope(ushort *&tokPtr); + void flushCond(ushort *&tokPtr); + void flushScopes(ushort *&tokPtr); + + void parseError(const QString &msg) const; + + // Current location + ProFile *m_proFile; + int m_lineNo; + + QStack m_blockstack; + ScopeState m_state; + int m_markLine; // Put marker for this line + bool m_inError; // Current line had a parsing error; suppress followup error messages + bool m_canElse; // Conditionals met on previous line, but no scope was opened + bool m_invert; // Pending conditional is negated + enum { NoOperator, AndOperator, OrOperator } m_operator; // Pending conditional is ORed/ANDed + + QString m_tmp; // Temporary for efficient toQString + + ProFileCache *m_cache; + ProFileParserHandler *m_handler; + + // This doesn't help gcc 3.3 ... + template friend class QTypeInfo; + + friend class ProFileCache; +}; + +class PROPARSER_EXPORT ProFileCache +{ +public: + ProFileCache() {} + ~ProFileCache(); + + void discardFile(const QString &fileName); + void discardFiles(const QString &prefix); + +private: + struct Entry { + ProFile *pro; +#ifdef PROPARSER_THREAD_SAFE + struct Locker { + Locker() : waiters(0), done(false) {} + QWaitCondition cond; + int waiters; + bool done; + }; + Locker *locker; +#endif + }; + + QHash parsed_files; +#ifdef PROPARSER_THREAD_SAFE + QMutex mutex; +#endif + + friend class ProFileParser; +}; + +#if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) +Q_DECLARE_TYPEINFO(ProFileParser::BlockScope, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(ProFileParser::Context, Q_PRIMITIVE_TYPE); +#endif + +QT_END_NAMESPACE + +#endif // PROFILEPARSER_H diff --git a/tools/linguist/shared/proitems.cpp b/tools/linguist/shared/proitems.cpp index 5c88686..0b65126 100644 --- a/tools/linguist/shared/proitems.cpp +++ b/tools/linguist/shared/proitems.cpp @@ -1,358 +1,365 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** This file is part of the Qt Linguist of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage +** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** ** Other Usage +** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #include "proitems.h" -#include "abstractproitemvisitor.h" #include +#include QT_BEGIN_NAMESPACE -// --------------- ProItem ------------ -void ProItem::setComment(const QString &comment) -{ - m_comment = comment; -} - -QString ProItem::comment() const -{ - return m_comment; -} - -// --------------- ProBlock ---------------- - -ProBlock::ProBlock(ProBlock *parent) -{ - m_blockKind = 0; - m_parent = parent; - m_refCount = 1; -} - -ProBlock::~ProBlock() -{ - foreach (ProItem *itm, m_proitems) - if (itm->kind() == BlockKind) - static_cast(itm)->deref(); - else - delete itm; -} - -void ProBlock::appendItem(ProItem *proitem) -{ - m_proitems << proitem; -} - -void ProBlock::setItems(const QList &proitems) -{ - m_proitems = proitems; -} - -QList ProBlock::items() const -{ - return m_proitems; -} - -void ProBlock::setBlockKind(int blockKind) -{ - m_blockKind = blockKind; -} +using namespace ProStringConstants; -int ProBlock::blockKind() const +// from qhash.cpp +uint ProString::hash(const QChar *p, int n) { - return m_blockKind; -} + uint h = 0; -void ProBlock::setParent(ProBlock *parent) -{ - m_parent = parent; + while (n--) { + h = (h << 4) + (*p++).unicode(); + h ^= (h & 0xf0000000) >> 23; + h &= 0x0fffffff; + } + return h; } -ProBlock *ProBlock::parent() const +ProString::ProString() : + m_offset(0), m_length(0), m_file(0), m_hash(0x80000000) { - return m_parent; } -ProItem::ProItemKind ProBlock::kind() const +ProString::ProString(const ProString &other) : + m_string(other.m_string), m_offset(other.m_offset), m_length(other.m_length), m_file(other.m_file), m_hash(other.m_hash) { - return ProItem::BlockKind; } -ProItem::ProItemReturn ProBlock::Accept(AbstractProItemVisitor *visitor) +ProString::ProString(const ProString &other, OmitPreHashing) : + m_string(other.m_string), m_offset(other.m_offset), m_length(other.m_length), m_file(other.m_file), m_hash(0x80000000) { - if (visitor->visitBeginProBlock(this) == ReturnSkip) - return ReturnTrue; - ProItemReturn rt = ReturnTrue; - for (int i = 0; i < m_proitems.count(); ++i) { - rt = m_proitems.at(i)->Accept(visitor); - if (rt != ReturnTrue && rt != ReturnFalse) { - if (rt == ReturnLoop) { - rt = ReturnTrue; - while (visitor->visitProLoopIteration()) - for (int j = i; ++j < m_proitems.count(); ) { - rt = m_proitems.at(j)->Accept(visitor); - if (rt != ReturnTrue && rt != ReturnFalse) { - if (rt == ReturnNext) { - rt = ReturnTrue; - break; - } - if (rt == ReturnBreak) - rt = ReturnTrue; - goto do_break; - } - } - do_break: - visitor->visitProLoopCleanup(); - } - break; - } - } - visitor->visitEndProBlock(this); - return rt; } -// --------------- ProVariable ---------------- -ProVariable::ProVariable(const QString &name, ProBlock *parent) - : ProBlock(parent) +ProString::ProString(const QString &str) : + m_string(str), m_offset(0), m_length(str.length()), m_file(0) { - setBlockKind(ProBlock::VariableKind); - m_variable = name; - m_variableKind = SetOperator; + updatedHash(); } -void ProVariable::setVariableOperator(VariableOperator variableKind) +ProString::ProString(const QString &str, OmitPreHashing) : + m_string(str), m_offset(0), m_length(str.length()), m_file(0), m_hash(0x80000000) { - m_variableKind = variableKind; } -ProVariable::VariableOperator ProVariable::variableOperator() const +ProString::ProString(const char *str) : + m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0) { - return m_variableKind; + updatedHash(); } -void ProVariable::setVariable(const QString &name) +ProString::ProString(const char *str, OmitPreHashing) : + m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0), m_hash(0x80000000) { - m_variable = name; } -QString ProVariable::variable() const +ProString::ProString(const QString &str, int offset, int length) : + m_string(str), m_offset(offset), m_length(length), m_file(0) { - return m_variable; + updatedHash(); } -ProItem::ProItemReturn ProVariable::Accept(AbstractProItemVisitor *visitor) +ProString::ProString(const QString &str, int offset, int length, uint hash) : + m_string(str), m_offset(offset), m_length(length), m_file(0), m_hash(hash) { - visitor->visitBeginProVariable(this); - foreach (ProItem *item, m_proitems) - item->Accept(visitor); // cannot fail - visitor->visitEndProVariable(this); - return ReturnTrue; } -// --------------- ProValue ---------------- -ProValue::ProValue(const QString &value, ProVariable *variable) +ProString::ProString(const QString &str, int offset, int length, ProStringConstants::OmitPreHashing) : + m_string(str), m_offset(offset), m_length(length), m_file(0), m_hash(0x80000000) { - m_variable = variable; - m_value = value; } -void ProValue::setValue(const QString &value) +void ProString::setValue(const QString &str) { - m_value = value; + m_string = str, m_offset = 0, m_length = str.length(); + updatedHash(); } -QString ProValue::value() const +void ProString::setValue(const QString &str, OmitPreHashing) { - return m_value; + m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000; } -void ProValue::setVariable(ProVariable *variable) +uint ProString::updatedHash() const { - m_variable = variable; + return (m_hash = hash(m_string.constData() + m_offset, m_length)); } -ProVariable *ProValue::variable() const +uint qHash(const ProString &str) { - return m_variable; + if (!(str.m_hash & 0x80000000)) + return str.m_hash; + return str.updatedHash(); } -ProItem::ProItemKind ProValue::kind() const +QString ProString::toQString() const { - return ProItem::ValueKind; + return m_string.mid(m_offset, m_length); } -ProItem::ProItemReturn ProValue::Accept(AbstractProItemVisitor *visitor) +QString &ProString::toQString(QString &tmp) const { - visitor->visitProValue(this); - return ReturnTrue; + return tmp.setRawData(m_string.constData() + m_offset, m_length); } -// --------------- ProFunction ---------------- -ProFunction::ProFunction(const QString &text) +bool ProString::operator==(const ProString &other) const { - m_text = text; + if (m_length != other.m_length) + return false; + return !memcmp(m_string.constData() + m_offset, + other.m_string.constData() + other.m_offset, m_length * 2); } -void ProFunction::setText(const QString &text) +bool ProString::operator==(const QString &other) const { - m_text = text; + if (m_length != other.length()) + return false; + return !memcmp(m_string.constData() + m_offset, other.constData(), m_length * 2); } -QString ProFunction::text() const +bool ProString::operator==(const QLatin1String &other) const { - return m_text; -} + const ushort *uc = (ushort *)m_string.constData() + m_offset; + const ushort *e = uc + m_length; + const uchar *c = (uchar *)other.latin1(); -ProItem::ProItemKind ProFunction::kind() const -{ - return ProItem::FunctionKind; -} + if (!c) + return isEmpty(); -ProItem::ProItemReturn ProFunction::Accept(AbstractProItemVisitor *visitor) -{ - return visitor->visitProFunction(this); + while (*c) { + if (uc == e || *uc != *c) + return false; + ++uc; + ++c; + } + return (uc == e); +} + +QChar *ProString::prepareAppend(int extraLen) +{ + if (m_string.isDetached() && m_length + extraLen <= m_string.capacity()) { + m_string.reserve(0); // Prevent the resize() below from reallocating + QChar *ptr = (QChar *)m_string.constData(); + if (m_offset) + memmove(ptr, ptr + m_offset, m_length * 2); + ptr += m_length; + m_offset = 0; + m_length += extraLen; + m_string.resize(m_length); + m_hash = 0x80000000; + return ptr; + } else { + QString neu(m_length + extraLen, Qt::Uninitialized); + QChar *ptr = (QChar *)neu.constData(); + memcpy(ptr, m_string.constData() + m_offset, m_length * 2); + ptr += m_length; + *this = ProString(neu, NoHash); + return ptr; + } } -// --------------- ProCondition ---------------- -ProCondition::ProCondition(const QString &text) +// If pending != 0, prefix with space if appending to non-empty non-pending +ProString &ProString::append(const ProString &other, bool *pending) { - m_text = text; + if (other.m_length) { + if (!m_length) { + *this = other; + } else { + QChar *ptr; + if (pending && !*pending) { + ptr = prepareAppend(1 + other.m_length); + *ptr++ = 32; + } else { + ptr = prepareAppend(other.m_length); + } + memcpy(ptr, other.m_string.constData() + other.m_offset, other.m_length * 2); + if (other.m_file) + m_file = other.m_file; + } + if (pending) + *pending = true; + } + return *this; } -void ProCondition::setText(const QString &text) +ProString &ProString::append(const ProStringList &other, bool *pending, bool skipEmpty1st) { - m_text = text; + if (const int sz = other.size()) { + int startIdx = 0; + if (pending && !*pending && skipEmpty1st && other.at(0).isEmpty()) { + if (sz == 1) + return *this; + startIdx = 1; + } + if (!m_length && sz == startIdx + 1) { + *this = other.at(startIdx); + } else { + int totalLength = sz - startIdx; + for (int i = startIdx; i < sz; ++i) + totalLength += other.at(i).size(); + bool putSpace = false; + if (pending && !*pending && m_length) + putSpace = true; + else + totalLength--; + + QChar *ptr = prepareAppend(totalLength); + for (int i = startIdx; i < sz; ++i) { + if (putSpace) + *ptr++ = 32; + else + putSpace = true; + const ProString &str = other.at(i); + memcpy(ptr, str.m_string.constData() + str.m_offset, str.m_length * 2); + ptr += str.m_length; + } + if (other.last().m_file) + m_file = other.last().m_file; + } + if (pending) + *pending = true; + } + return *this; } -QString ProCondition::text() const +QString operator+(const ProString &one, const ProString &two) { - return m_text; + if (two.m_length) { + if (!one.m_length) { + return two.toQString(); + } else { + QString neu(one.m_length + two.m_length, Qt::Uninitialized); + ushort *ptr = (ushort *)neu.constData(); + memcpy(ptr, one.m_string.constData() + one.m_offset, one.m_length * 2); + memcpy(ptr + one.m_length, two.m_string.constData() + two.m_offset, two.m_length * 2); + return neu; + } + } + return one.toQString(); } -ProItem::ProItemKind ProCondition::kind() const -{ - return ProItem::ConditionKind; -} -ProItem::ProItemReturn ProCondition::Accept(AbstractProItemVisitor *visitor) +ProString ProString::mid(int off, int len) const { - visitor->visitProCondition(this); - return ReturnTrue; + ProString ret(*this, NoHash); + if (off > m_length) + off = m_length; + ret.m_offset += off; + ret.m_length -= off; + if (ret.m_length > len) + ret.m_length = len; + return ret; } -// --------------- ProOperator ---------------- -ProOperator::ProOperator(OperatorKind operatorKind) +ProString ProString::trimmed() const { - m_operatorKind = operatorKind; + ProString ret(*this, NoHash); + int cur = m_offset; + int end = cur + m_length; + const QChar *data = m_string.constData(); + for (; cur < end; cur++) + if (!data[cur].isSpace()) { + // No underrun check - we know there is at least one non-whitespace + while (data[end - 1].isSpace()) + end--; + break; + } + ret.m_offset = cur; + ret.m_length = end - cur; + return ret; } -void ProOperator::setOperatorKind(OperatorKind operatorKind) +QString ProStringList::join(const QString &sep) const { - m_operatorKind = operatorKind; -} + int totalLength = 0; + const int sz = size(); -ProOperator::OperatorKind ProOperator::operatorKind() const -{ - return m_operatorKind; -} + for (int i = 0; i < sz; ++i) + totalLength += at(i).size(); -ProItem::ProItemKind ProOperator::kind() const -{ - return ProItem::OperatorKind; -} + if (sz) + totalLength += sep.size() * (sz - 1); -ProItem::ProItemReturn ProOperator::Accept(AbstractProItemVisitor *visitor) -{ - visitor->visitProOperator(this); - return ReturnTrue; + QString res(totalLength, Qt::Uninitialized); + QChar *ptr = (QChar *)res.constData(); + for (int i = 0; i < sz; ++i) { + if (i) { + memcpy(ptr, sep.constData(), sep.size() * 2); + ptr += sep.size(); + } + memcpy(ptr, at(i).constData(), at(i).size() * 2); + ptr += at(i).size(); + } + return res; +} + +void ProStringList::removeDuplicates() +{ + int n = size(); + int j = 0; + QSet seen; + seen.reserve(n); + for (int i = 0; i < n; ++i) { + const ProString &s = at(i); + if (seen.contains(s)) + continue; + seen.insert(s); + if (j != i) + (*this)[j] = s; + ++j; + } + if (n != j) + erase(begin() + j, end()); } -// --------------- ProFile ---------------- ProFile::ProFile(const QString &fileName) - : ProBlock(0) + : m_refCount(1), + m_fileName(fileName), + m_ok(true) { - m_modified = false; - setBlockKind(ProBlock::ProFileKind); - m_fileName = fileName; - - QFileInfo fi(fileName); - m_displayFileName = fi.fileName(); - m_directoryName = fi.absolutePath(); + if (!fileName.startsWith(QLatin1Char('('))) + m_directoryName = QFileInfo( // qmake sickness: canonicalize only the directory! + fileName.left(fileName.lastIndexOf(QLatin1Char('/')))).canonicalFilePath(); } ProFile::~ProFile() { } -QString ProFile::displayFileName() const -{ - return m_displayFileName; -} - -QString ProFile::fileName() const -{ - return m_fileName; -} - -QString ProFile::directoryName() const -{ - return m_directoryName; -} - -void ProFile::setModified(bool modified) -{ - m_modified = modified; -} - -bool ProFile::isModified() const -{ - return m_modified; -} - -ProItem::ProItemReturn ProFile::Accept(AbstractProItemVisitor *visitor) -{ - ProItemReturn rt; - if ((rt = visitor->visitBeginProFile(this)) != ReturnTrue) - return rt; - ProBlock::Accept(visitor); // cannot fail - return visitor->visitEndProFile(this); -} - QT_END_NAMESPACE diff --git a/tools/linguist/shared/proitems.h b/tools/linguist/shared/proitems.h index f4bf183..4967b27 100644 --- a/tools/linguist/shared/proitems.h +++ b/tools/linguist/shared/proitems.h @@ -1,246 +1,220 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** This file is part of the Qt Linguist of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage +** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** ** Other Usage +** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #ifndef PROITEMS_H #define PROITEMS_H +#include "proparser_global.h" #include -#include +#include QT_BEGIN_NAMESPACE -struct AbstractProItemVisitor; - -class ProItem -{ +#ifdef PROPARSER_THREAD_SAFE +typedef QAtomicInt ProItemRefCount; +#else +class ProItemRefCount { public: - enum ProItemKind { - ValueKind, - FunctionKind, - ConditionKind, - OperatorKind, - BlockKind - }; - - enum ProItemReturn { - ReturnFalse, - ReturnTrue, - ReturnBreak, - ReturnNext, - ReturnLoop, - ReturnSkip, - ReturnReturn - }; - - ProItem() : m_lineNumber(0) {} - virtual ~ProItem() {} - - virtual ProItemKind kind() const = 0; - - void setComment(const QString &comment); - QString comment() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor) = 0; - int lineNumber() const { return m_lineNumber; } - void setLineNumber(int lineNumber) { m_lineNumber = lineNumber; } - + ProItemRefCount(int cnt = 0) : m_cnt(cnt) {} + bool ref() { return ++m_cnt != 0; } + bool deref() { return --m_cnt != 0; } + ProItemRefCount &operator=(int value) { m_cnt = value; return *this; } private: - QString m_comment; - int m_lineNumber; + int m_cnt; }; +#endif -class ProBlock : public ProItem -{ -public: - enum ProBlockKind { - NormalKind = 0x00, - ScopeKind = 0x01, - ScopeContentsKind = 0x02, - VariableKind = 0x04, - ProFileKind = 0x08, - FunctionBodyKind = 0x10, - SingleLine = 0x80 - }; - - ProBlock(ProBlock *parent); - ~ProBlock(); - - void appendItem(ProItem *proitem); - void setItems(const QList &proitems); - QList items() const; - - void setBlockKind(int blockKind); - int blockKind() const; - - void setParent(ProBlock *parent); - ProBlock *parent() const; - - void ref() { ++m_refCount; } - void deref() { if (!--m_refCount) delete this; } - - ProItem::ProItemKind kind() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); -protected: - QList m_proitems; -private: - ProBlock *m_parent; - int m_blockKind; - int m_refCount; -}; - -class ProVariable : public ProBlock -{ -public: - enum VariableOperator { - AddOperator = 0, - RemoveOperator = 1, - ReplaceOperator = 2, - SetOperator = 3, - UniqueAddOperator = 4 - }; - - ProVariable(const QString &name, ProBlock *parent); +namespace ProStringConstants { +enum OmitPreHashing { NoHash }; +} - void setVariableOperator(VariableOperator variableKind); - VariableOperator variableOperator() const; +class ProStringList; +class ProFile; - void setVariable(const QString &name); - QString variable() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); -private: - VariableOperator m_variableKind; - QString m_variable; -}; - -class ProValue : public ProItem -{ +class ProString { public: - ProValue(const QString &value, ProVariable *variable); - - void setValue(const QString &value); - QString value() const; - - void setVariable(ProVariable *variable); - ProVariable *variable() const; + ProString(); + ProString(const ProString &other); + ProString(const ProString &other, ProStringConstants::OmitPreHashing); + explicit ProString(const QString &str); + ProString(const QString &str, ProStringConstants::OmitPreHashing); + explicit ProString(const char *str); + ProString(const char *str, ProStringConstants::OmitPreHashing); + ProString(const QString &str, int offset, int length); + ProString(const QString &str, int offset, int length, uint hash); + ProString(const QString &str, int offset, int length, ProStringConstants::OmitPreHashing); + void setValue(const QString &str); + void setValue(const QString &str, ProStringConstants::OmitPreHashing); + ProString &setSource(const ProString &other) { m_file = other.m_file; return *this; } + ProString &setSource(const ProFile *pro) { m_file = pro; return *this; } + const ProFile *sourceFile() const { return m_file; } + QString toQString() const; + QString &toQString(QString &tmp) const; + ProString &operator+=(const ProString &other); + ProString &append(const ProString &other, bool *pending = 0); + ProString &append(const ProStringList &other, bool *pending = 0, bool skipEmpty1st = false); + bool operator==(const ProString &other) const; + bool operator==(const QString &other) const; + bool operator==(const QLatin1String &other) const; + bool operator!=(const ProString &other) const { return !(*this == other); } + bool operator!=(const QString &other) const { return !(*this == other); } + bool operator!=(const QLatin1String &other) const { return !(*this == other); } + bool isEmpty() const { return !m_length; } + int size() const { return m_length; } + const QChar *constData() const { return m_string.constData() + m_offset; } + ProString mid(int off, int len = -1) const; + ProString left(int len) const { return mid(0, len); } + ProString right(int len) const { return mid(qMax(0, size() - len)); } + ProString trimmed() const; + void clear() { m_string.clear(); m_length = 0; } + + static uint hash(const QChar *p, int n); - ProItem::ProItemKind kind() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); private: - QString m_value; - ProVariable *m_variable; + QString m_string; + int m_offset, m_length; + const ProFile *m_file; + mutable uint m_hash; + QChar *prepareAppend(int extraLen); + uint updatedHash() const; + friend uint qHash(const ProString &str); + friend QString operator+(const ProString &one, const ProString &two); }; +Q_DECLARE_TYPEINFO(ProString, Q_MOVABLE_TYPE); -class ProFunction : public ProItem -{ -public: - explicit ProFunction(const QString &text); - - void setText(const QString &text); - QString text() const; +uint qHash(const ProString &str); +QString operator+(const ProString &one, const ProString &two); +inline QString operator+(const ProString &one, const QString &two) + { return one + ProString(two, ProStringConstants::NoHash); } +inline QString operator+(const QString &one, const ProString &two) + { return ProString(one, ProStringConstants::NoHash) + two; } - ProItem::ProItemKind kind() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); -private: - QString m_text; -}; - -class ProCondition : public ProItem -{ +class ProStringList : public QVector { public: - explicit ProCondition(const QString &text); - - void setText(const QString &text); - QString text() const; - - ProItem::ProItemKind kind() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); -private: - QString m_text; + ProStringList() {} + ProStringList(const ProString &str) { *this << str; } + QString join(const QString &sep) const; + void removeDuplicates(); }; -class ProOperator : public ProItem -{ -public: - enum OperatorKind { - OrOperator = 1, - NotOperator = 2 - }; - - explicit ProOperator(OperatorKind operatorKind); - - void setOperatorKind(OperatorKind operatorKind); - OperatorKind operatorKind() const; - - ProItem::ProItemKind kind() const; - - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); -private: - OperatorKind m_operatorKind; +// These token definitions affect both ProFileEvaluator and ProWriter +enum ProToken { + TokTerminator = 0, // end of stream (possibly not included in length; must be zero) + TokLine, // line marker: + // - line (1) + TokAssign, // variable = + TokAppend, // variable += + TokAppendUnique, // variable *= + TokRemove, // variable -= + TokReplace, // variable ~= + // previous literal/expansion is a variable manipulation + // - value expression + TokValueTerminator + TokValueTerminator, // assignment value terminator + TokLiteral, // literal string (fully dequoted) + // - length (1) + // - string data (length; unterminated) + TokHashLiteral, // literal string with hash (fully dequoted) + // - hash (2) + // - length (1) + // - string data (length; unterminated) + TokVariable, // qmake variable expansion + // - hash (2) + // - name length (1) + // - name (name length; unterminated) + TokProperty, // qmake property expansion + // - name length (1) + // - name (name length; unterminated) + TokEnvVar, // environment variable expansion + // - name length (1) + // - name (name length; unterminated) + TokFuncName, // replace function expansion + // - hash (2) + // - name length (1) + // - name (name length; unterminated) + // - ((nested expansion + TokArgSeparator)* + nested expansion)? + // - TokFuncTerminator + TokArgSeparator, // function argument separator + TokFuncTerminator, // function argument list terminator + TokCondition, // previous literal/expansion is a conditional + TokTestCall, // previous literal/expansion is a test function call + // - ((nested expansion + TokArgSeparator)* + nested expansion)? + // - TokFuncTerminator + TokNot, // '!' operator + TokAnd, // ':' operator + TokOr, // '|' operator + TokBranch, // branch point: + // - then block length (2) + // - then block + TokTerminator (then block length) + // - else block length (2) + // - else block + TokTerminator (else block length) + TokForLoop, // for loop: + // - variable name: hash (2), length (1), chars (length) + // - expression: length (2), bytes + TokValueTerminator (length) + // - body length (2) + // - body + TokTerminator (body length) + TokTestDef, // test function definition: + TokReplaceDef, // replace function definition: + // - function name: hash (2), length (1), chars (length) + // - body length (2) + // - body + TokTerminator (body length) + TokMask = 0xff, + TokQuoted = 0x100, // The expression is quoted => join expanded stringlist + TokNewStr = 0x200 // Next stringlist element }; -class ProFile : public ProBlock +class PROPARSER_EXPORT ProFile { public: explicit ProFile(const QString &fileName); ~ProFile(); - QString displayFileName() const; - QString fileName() const; - QString directoryName() const; + QString fileName() const { return m_fileName; } + QString directoryName() const { return m_directoryName; } + const QString &items() const { return m_proitems; } + QString *itemsRef() { return &m_proitems; } + const ushort *tokPtr() const { return (const ushort *)m_proitems.constData(); } - void setModified(bool modified); - bool isModified() const; + void ref() { m_refCount.ref(); } + void deref() { if (!m_refCount.deref()) delete this; } - virtual ProItemReturn Accept(AbstractProItemVisitor *visitor); + bool isOk() const { return m_ok; } + void setOk(bool ok) { m_ok = ok; } private: + ProItemRefCount m_refCount; + QString m_proitems; QString m_fileName; - QString m_displayFileName; QString m_directoryName; - bool m_modified; + bool m_ok; }; QT_END_NAMESPACE diff --git a/tools/linguist/shared/proparser.pri b/tools/linguist/shared/proparser.pri index 372247e..829c8cd 100644 --- a/tools/linguist/shared/proparser.pri +++ b/tools/linguist/shared/proparser.pri @@ -1,12 +1,17 @@ INCLUDEPATH *= $$PWD +DEFINES += PROEVALUATOR_CUMULATIVE PROEVALUATOR_INIT_PROPS + HEADERS += \ - $$PWD/abstractproitemvisitor.h \ + $$PWD/proparser_global.h \ + $$PWD/ioutils.h \ $$PWD/proitems.h \ - $$PWD/profileevaluator.h \ - $$PWD/proparserutils.h + $$PWD/profileparser.h \ + $$PWD/profileevaluator.h SOURCES += \ + $$PWD/ioutils.cpp \ $$PWD/proitems.cpp \ - $$PWD/profileevaluator.cpp + $$PWD/profileparser.cpp \ + $$PWD/profileevaluator.cpp diff --git a/tools/linguist/shared/proparser_global.h b/tools/linguist/shared/proparser_global.h new file mode 100644 index 0000000..dd3114b --- /dev/null +++ b/tools/linguist/shared/proparser_global.h @@ -0,0 +1,48 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#ifndef PROPARSER_GLOBAL_H +#define PROPARSER_GLOBAL_H + +#include + +#if defined(PROPARSER_AS_LIBRARY) +# if defined(PROPARSER_LIBRARY) +# define PROPARSER_EXPORT Q_DECL_EXPORT +# else +# define PROPARSER_EXPORT Q_DECL_IMPORT +# endif +#else +# define PROPARSER_EXPORT +#endif + +#endif diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h deleted file mode 100644 index d567a73..0000000 --- a/tools/linguist/shared/proparserutils.h +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PROPARSERUTILS_H -#define PROPARSERUTILS_H - -#include -#ifndef QT_BOOTSTRAPPED -#include -#endif - -QT_BEGIN_NAMESPACE - -#ifdef QT_BOOTSTRAPPED -// this is a stripped down version of the one found in QtCore -class QLibraryInfo -{ -public: - enum LibraryLocation - { - PrefixPath, - DocumentationPath, - HeadersPath, - LibrariesPath, - BinariesPath, - PluginsPath, - DataPath, - TranslationsPath, - SettingsPath, - DemosPath, - ExamplesPath - }; - static QString location(LibraryLocation); -}; -#endif - -// Pre- and postcondition macros -#define PRE(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0) -#define POST(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0) - -// This struct is from qmake, but we are not using everything. -struct Option -{ - //simply global convenience - //static QString libtool_ext; - //static QString pkgcfg_ext; - //static QString prf_ext; - //static QString prl_ext; - //static QString ui_ext; - //static QStringList h_ext; - //static QStringList cpp_ext; - //static QString h_moc_ext; - //static QString cpp_moc_ext; - //static QString obj_ext; - //static QString lex_ext; - //static QString yacc_ext; - //static QString h_moc_mod; - //static QString cpp_moc_mod; - //static QString lex_mod; - //static QString yacc_mod; - static QString dir_sep; - static QString dirlist_sep; - static QString qmakespec; - static QChar field_sep; - - enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE }; - static TARG_MODE target_mode; - //static QString pro_ext; - //static QString res_ext; - - static void init() - { -#ifdef Q_OS_WIN - Option::dirlist_sep = QLatin1Char(';'); - Option::dir_sep = QLatin1Char('\\'); -#else - Option::dirlist_sep = QLatin1Char(':'); - Option::dir_sep = QLatin1Char(QLatin1Char('/')); -#endif - Option::qmakespec = QString::fromLatin1(qgetenv("QMAKESPEC").data()); - Option::field_sep = QLatin1Char(' '); - } - - enum StringFixFlags { - FixNone = 0x00, - FixEnvVars = 0x01, - FixPathCanonicalize = 0x02, - FixPathToLocalSeparators = 0x04, - FixPathToTargetSeparators = 0x08 - }; - static QString fixString(QString string, uchar flags); - - inline static QString fixPathToLocalOS(const QString &in, bool fix_env = true, bool canonical = true) - { - uchar flags = FixPathToLocalSeparators; - if (fix_env) - flags |= FixEnvVars; - if (canonical) - flags |= FixPathCanonicalize; - return fixString(in, flags); - } -}; -#if defined(Q_OS_WIN32) -Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE; -#elif defined(Q_OS_MAC) -Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE; -#elif defined(Q_OS_QNX6) -Option::TARG_MODE Option::target_mode = Option::TARG_QNX6_MODE; -#else -Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; -#endif - -QString Option::qmakespec; -QString Option::dirlist_sep; -QString Option::dir_sep; -QChar Option::field_sep; - -static void insertUnique(QHash *map, - const QString &key, const QStringList &value) -{ - QStringList &sl = (*map)[key]; - foreach (const QString &str, value) - if (!sl.contains(str)) - sl.append(str); -} - -static void removeEach(QHash *map, - const QString &key, const QStringList &value) -{ - QStringList &sl = (*map)[key]; - foreach (const QString &str, value) - sl.removeAll(str); -} - -/* - See ProFileEvaluator::Private::visitProValue(...) - -static QStringList replaceInList(const QStringList &varList, const QRegExp ®exp, - const QString &replace, bool global) -{ - QStringList resultList = varList; - - for (QStringList::Iterator varit = resultList.begin(); varit != resultList.end();) { - if (varit->contains(regexp)) { - *varit = varit->replace(regexp, replace); - if (varit->isEmpty()) - varit = resultList.erase(varit); - else - ++varit; - if (!global) - break; - } else { - ++varit; - } - } - return resultList; -} -*/ - -inline QString fixEnvVariables(const QString &x) -{ - return Option::fixString(x, Option::FixEnvVars); -} - -inline QStringList splitPathList(const QString &paths) -{ - return paths.split(Option::dirlist_sep); -} - -static QStringList split_arg_list(QString params) -{ - int quote = 0; - QStringList args; - - const ushort LPAREN = '('; - const ushort RPAREN = ')'; - const ushort SINGLEQUOTE = '\''; - const ushort DOUBLEQUOTE = '"'; - const ushort COMMA = ','; - const ushort SPACE = ' '; - //const ushort TAB = '\t'; - - ushort unicode; - const QChar *params_data = params.data(); - const int params_len = params.length(); - int last = 0; - while (last < params_len && ((params_data+last)->unicode() == SPACE - /*|| (params_data+last)->unicode() == TAB*/)) - ++last; - for (int x = last, parens = 0; x <= params_len; x++) { - unicode = (params_data+x)->unicode(); - if (x == params_len) { - while (x && (params_data+(x-1))->unicode() == SPACE) - --x; - QString mid(params_data+last, x-last); - if (quote) { - if (mid[0] == quote && mid[(int)mid.length()-1] == quote) - mid = mid.mid(1, mid.length()-2); - quote = 0; - } - args << mid; - break; - } - if (unicode == LPAREN) { - --parens; - } else if (unicode == RPAREN) { - ++parens; - } else if (quote && unicode == quote) { - quote = 0; - } else if (!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) { - quote = unicode; - } - if (!parens && !quote && unicode == COMMA) { - QString mid = params.mid(last, x - last).trimmed(); - args << mid; - last = x+1; - while (last < params_len && ((params_data+last)->unicode() == SPACE - /*|| (params_data+last)->unicode() == TAB*/)) - ++last; - } - } - return args; -} - -static QStringList split_value_list(const QString &vals, bool do_semicolon=false) -{ - QString build; - QStringList ret; - QStack quote; - - const ushort LPAREN = '('; - const ushort RPAREN = ')'; - const ushort SINGLEQUOTE = '\''; - const ushort DOUBLEQUOTE = '"'; - const ushort BACKSLASH = '\\'; - const ushort SEMICOLON = ';'; - - ushort unicode; - const QChar *vals_data = vals.data(); - const int vals_len = vals.length(); - for (int x = 0, parens = 0; x < vals_len; x++) { - unicode = vals_data[x].unicode(); - if (x != (int)vals_len-1 && unicode == BACKSLASH && - (vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) { - build += vals_data[x++]; //get that 'escape' - } else if (!quote.isEmpty() && unicode == quote.top()) { - quote.pop(); - } else if (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE) { - quote.push(unicode); - } else if (unicode == RPAREN) { - --parens; - } else if (unicode == LPAREN) { - ++parens; - } - - if (!parens && quote.isEmpty() && ((do_semicolon && unicode == SEMICOLON) || - vals_data[x] == Option::field_sep)) { - ret << build; - build.clear(); - } else { - build += vals_data[x]; - } - } - if (!build.isEmpty()) - ret << build; - return ret; -} - -static QStringList qmake_mkspec_paths() -{ - QStringList ret; - const QString concat = QDir::separator() + QLatin1String("mkspecs"); - QByteArray qmakepath = qgetenv("QMAKEPATH"); - if (!qmakepath.isEmpty()) { - const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath)); - for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) - ret << ((*it) + concat); - } - ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat; - - return ret; -} - -QT_END_NAMESPACE - -#endif // PROPARSERUTILS_H -- cgit v0.12 From 531614ae15a2bc43e782c247a2dee5387566397a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 17:53:27 +0200 Subject: nuke Translator::release(), make saveQM() non-static instead this "factory" served only to obfuscate the code --- tools/linguist/linguist/messagemodel.cpp | 2 +- tools/linguist/lrelease/main.cpp | 2 +- tools/linguist/shared/qm.cpp | 2 +- tools/linguist/shared/translator.cpp | 10 ---------- tools/linguist/shared/translator.h | 3 ++- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index 9eea2a3..5cbc5e8 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -375,7 +375,7 @@ bool DataModel::release(const QString &fileName, bool verbose, bool ignoreUnfini cd.m_verbose = verbose; cd.m_ignoreUnfinished = ignoreUnfinished; cd.m_saveMode = mode; - bool ok = tor.release(&file, cd); + bool ok = saveQM(tor, file, cd); if (!ok) QMessageBox::warning(parent, QObject::tr("Qt Linguist"), cd.error()); return ok; diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index f9e08a0..9adaff5 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -157,7 +157,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, } tor.normalizeTranslations(cd); - bool ok = tor.release(&file, cd); + bool ok = saveQM(tor, file, cd); file.close(); if (!ok) { diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index b8cfeca..06603fe 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -697,7 +697,7 @@ static bool containsStripped(const Translator &translator, const TranslatorMessa return false; } -static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) { Releaser releaser; QLocale::Language l; diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index a29372a..2a15fe7 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -329,16 +329,6 @@ void Translator::languageAndCountry(const QString &languageCode, } } -bool Translator::release(QFile *iod, ConversionData &cd) const -{ - foreach (const FileFormat &format, registeredFileFormats()) { - if (format.extension == QLatin1String("qm")) - return (*format.saver)(*this, *iod, cd); - } - cd.appendError(QLatin1String("No .qm saver available.")); - return false; -} - int Translator::find(const TranslatorMessage &msg) const { for (int i = 0; i < m_messages.count(); ++i) { diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index fb9bd2d..b9bc94c 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -125,7 +125,6 @@ public: bool load(const QString &filename, ConversionData &err, const QString &format /* = "auto" */); bool save(const QString &filename, ConversionData &err, const QString &format /* = "auto" */) const; - bool release(QFile *iod, ConversionData &cd) const; int find(const TranslatorMessage &msg) const; TranslatorMessage find(const QString &context, @@ -235,6 +234,8 @@ private: bool getNumerusInfo(QLocale::Language language, QLocale::Country country, QByteArray *rules, QStringList *forms, const char **gettextRules); +bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd); + /* This is a quick hack. The proper way to handle this would be to extend Translator's interface. -- cgit v0.12 From ad23439b7e112aa8a36f34e7b16224dcab742147 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 17:58:13 +0200 Subject: fix misnomer: MainWindow::closePhraseBooks() => maybeSavePhraseBooks() --- tools/linguist/linguist/mainwindow.cpp | 4 ++-- tools/linguist/linguist/mainwindow.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 05b34bc..ddefa9a 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -1388,7 +1388,7 @@ void MainWindow::setupPhrase() void MainWindow::closeEvent(QCloseEvent *e) { - if (maybeSaveAll() && closePhraseBooks()) + if (maybeSaveAll() && maybeSavePhraseBooks()) e->accept(); else e->ignore(); @@ -2302,7 +2302,7 @@ bool MainWindow::maybeSavePhraseBook(PhraseBook *pb) return true; } -bool MainWindow::closePhraseBooks() +bool MainWindow::maybeSavePhraseBooks() { foreach(PhraseBook *phraseBook, m_phraseBooks) if (!maybeSavePhraseBook(phraseBook)) diff --git a/tools/linguist/linguist/mainwindow.h b/tools/linguist/linguist/mainwindow.h index c589945..7a81ff6 100644 --- a/tools/linguist/linguist/mainwindow.h +++ b/tools/linguist/linguist/mainwindow.h @@ -192,7 +192,7 @@ private: bool isPhraseBookOpen(const QString &name); bool savePhraseBook(QString *name, PhraseBook &pb); bool maybeSavePhraseBook(PhraseBook *phraseBook); - bool closePhraseBooks(); + bool maybeSavePhraseBooks(); QStringList pickTranslationFiles(); void showTranslationSettings(int model); void updateLatestModel(int model); -- cgit v0.12 From a107d3e22e128ec343d82f902de4c6ee0e33435f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 18:19:57 +0200 Subject: optimization: make the Translator::find() api index-based --- tools/linguist/lupdate/merge.cpp | 52 +++++++++++++++++++----------------- tools/linguist/shared/translator.cpp | 16 +++++------ tools/linguist/shared/translator.h | 5 ++-- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index 2d5230b..1c992c3 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -348,11 +348,11 @@ Translator merge(const Translator &tor, const Translator &virginTor, if (m.sourceText().isEmpty() && m.id().isEmpty()) { // context/file comment - TranslatorMessage mv = virginTor.find(m.context()); - if (!mv.isNull()) - m.setComment(mv.comment()); + int mvi = virginTor.find(m.context()); + if (mvi >= 0) + m.setComment(virginTor.constMessage(mvi).comment()); } else { - TranslatorMessage mv; + const TranslatorMessage *mv; int mvi = virginTor.find(m); if (mvi < 0) { if (!(options & HeuristicSimilarText)) { @@ -362,16 +362,17 @@ Translator merge(const Translator &tor, const Translator &virginTor, obsoleted++; m.clearReferences(); } else { - mv = virginTor.find(m.context(), m.comment(), m.allReferences()); - if (mv.isNull()) { + mvi = virginTor.find(m.context(), m.comment(), m.allReferences()); + if (mvi < 0) { // did not find it in the virgin, mark it as obsolete goto makeObsolete; } else { + mv = &virginTor.constMessage(mvi); // Do not just accept it if its on the same line number, // but different source text. // Also check if the texts are more or less similar before // we consider them to represent the same message... - if (getSimilarityScore(m.sourceText(), mv.sourceText()) >= textSimilarityThreshold) { + if (getSimilarityScore(m.sourceText(), mv->sourceText()) >= textSimilarityThreshold) { // It is just slightly modified, assume that it is the same string // Mark it as unfinished. (Since the source text @@ -382,7 +383,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, outdateSource: m.setOldSourceText(m.sourceText()); - m.setSourceText(mv.sourceText()); + m.setSourceText(mv->sourceText()); const QString &oldpluralsource = m.extra(QLatin1String("po-msgid_plural")); if (!oldpluralsource.isEmpty()) { m.setExtra(QLatin1String("po-old_msgid_plural"), oldpluralsource); @@ -397,22 +398,22 @@ Translator merge(const Translator &tor, const Translator &virginTor, } } } else { - mv = virginTor.message(mvi); - if (!mv.id().isEmpty() - && (mv.context() != m.context() - || mv.sourceText() != m.sourceText() - || mv.comment() != m.comment())) { + mv = &virginTor.message(mvi); + if (!mv->id().isEmpty() + && (mv->context() != m.context() + || mv->sourceText() != m.sourceText() + || mv->comment() != m.comment())) { known++; newType = TranslatorMessage::Unfinished; - m.setContext(mv.context()); - m.setComment(mv.comment()); - if (mv.sourceText() != m.sourceText()) + m.setContext(mv->context()); + m.setComment(mv->comment()); + if (mv->sourceText() != m.sourceText()) goto outdateSource; } else { switch (m.type()) { case TranslatorMessage::Finished: default: - if (m.isPlural() == mv.isPlural()) { + if (m.isPlural() == mv->isPlural()) { newType = TranslatorMessage::Finished; } else { newType = TranslatorMessage::Unfinished; @@ -435,11 +436,11 @@ Translator merge(const Translator &tor, const Translator &virginTor, // have the element. // why not use operator=()? Because it overwrites e.g. userData. copyAttribs: - m.setReferences(mv.allReferences()); - m.setPlural(mv.isPlural()); - m.setUtf8(mv.isUtf8()); - m.setExtraComment(mv.extraComment()); - m.setId(mv.id()); + m.setReferences(mv->allReferences()); + m.setPlural(mv->isPlural()); + m.setUtf8(mv->isUtf8()); + m.setExtraComment(mv->extraComment()); + m.setId(mv->id()); } } @@ -459,9 +460,10 @@ Translator merge(const Translator &tor, const Translator &virginTor, if (tor.find(mv) >= 0) continue; if (options & HeuristicSimilarText) { - TranslatorMessage m = tor.find(mv.context(), mv.comment(), mv.allReferences()); - if (!m.isNull()) { - if (getSimilarityScore(m.sourceText(), mv.sourceText()) >= textSimilarityThreshold) + int mi = tor.find(mv.context(), mv.comment(), mv.allReferences()); + if (mi >= 0) { + if (getSimilarityScore(tor.constMessage(mi).sourceText(), mv.sourceText()) + >= textSimilarityThreshold) continue; } } diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 2a15fe7..91a5a26 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -346,7 +346,7 @@ int Translator::find(const TranslatorMessage &msg) const return -1; } -TranslatorMessage Translator::find(const QString &context, +int Translator::find(const QString &context, const QString &comment, const TranslatorMessage::References &refs) const { if (!refs.isEmpty()) { @@ -355,10 +355,10 @@ TranslatorMessage Translator::find(const QString &context, foreach (const TranslatorMessage::Reference &itref, it->allReferences()) foreach (const TranslatorMessage::Reference &ref, refs) if (itref == ref) - return *it; + return it - m_messages.constBegin(); } } - return TranslatorMessage(); + return -1; } bool Translator::contains(const QString &context) const @@ -369,12 +369,12 @@ bool Translator::contains(const QString &context) const return false; } -TranslatorMessage Translator::find(const QString &context) const +int Translator::find(const QString &context) const { - foreach (const TranslatorMessage &msg, m_messages) - if (msg.context() == context && msg.sourceText().isEmpty() && msg.id().isEmpty()) - return msg; - return TranslatorMessage(); + for (TMM::ConstIterator it = m_messages.constBegin(); it != m_messages.constEnd(); ++it) + if (it->context() == context && it->sourceText().isEmpty() && it->id().isEmpty()) + return it - m_messages.constBegin(); + return -1; } void Translator::stripObsoleteMessages() diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index b9bc94c..41f0396 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -127,11 +127,11 @@ public: bool save(const QString &filename, ConversionData &err, const QString &format /* = "auto" */) const; int find(const TranslatorMessage &msg) const; - TranslatorMessage find(const QString &context, + int find(const QString &context, const QString &comment, const TranslatorMessage::References &refs) const; bool contains(const QString &context) const; - TranslatorMessage find(const QString &context) const; + int find(const QString &context) const; void replaceSorted(const TranslatorMessage &msg); void extend(const TranslatorMessage &msg); // Only for single-location messages @@ -178,6 +178,7 @@ public: int messageCount() const { return m_messages.size(); } TranslatorMessage &message(int i) { return m_messages[i]; } const TranslatorMessage &message(int i) const { return m_messages.at(i); } + const TranslatorMessage &constMessage(int i) const { return m_messages.at(i); } void dump() const; // additional file format specific data -- cgit v0.12 From dc587b47af5fec8268ccd33935f6abe442ae8904 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 18:20:58 +0200 Subject: remove Translator::contains() it's redundant with find() now, as the latter is cheap now --- tools/linguist/lupdate/merge.cpp | 2 +- tools/linguist/shared/translator.cpp | 8 -------- tools/linguist/shared/translator.h | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index 1c992c3..8b6624d 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -454,7 +454,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, */ foreach (const TranslatorMessage &mv, virginTor.messages()) { if (mv.sourceText().isEmpty() && mv.id().isEmpty()) { - if (tor.contains(mv.context())) + if (tor.find(mv.context()) >= 0) continue; } else { if (tor.find(mv) >= 0) diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 91a5a26..0c2678d 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -361,14 +361,6 @@ int Translator::find(const QString &context, return -1; } -bool Translator::contains(const QString &context) const -{ - foreach (const TranslatorMessage &msg, m_messages) - if (msg.context() == context && msg.sourceText().isEmpty() && msg.id().isEmpty()) - return true; - return false; -} - int Translator::find(const QString &context) const { for (TMM::ConstIterator it = m_messages.constBegin(); it != m_messages.constEnd(); ++it) diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 41f0396..bb147b8 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -130,7 +130,6 @@ public: int find(const QString &context, const QString &comment, const TranslatorMessage::References &refs) const; - bool contains(const QString &context) const; int find(const QString &context) const; void replaceSorted(const TranslatorMessage &msg); -- cgit v0.12 From 8a5d0e6c3d1cf6b269f755a8d54b25b704ba8356 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 19:43:49 +0200 Subject: remove Translator::translatedMessages() it's inefficient to construct a new list. on top of that, the only user actually checks the message state again. --- tools/linguist/shared/simtexth.cpp | 4 +--- tools/linguist/shared/translator.cpp | 9 --------- tools/linguist/shared/translator.h | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/tools/linguist/shared/simtexth.cpp b/tools/linguist/shared/simtexth.cpp index 31253d6..8933507 100644 --- a/tools/linguist/shared/simtexth.cpp +++ b/tools/linguist/shared/simtexth.cpp @@ -238,9 +238,7 @@ CandidateList similarTextHeuristicCandidates(const Translator *tor, QList scores; CandidateList candidates; - TML all = tor->translatedMessages(); - - foreach (const TranslatorMessage &mtm, all) { + foreach (const TranslatorMessage &mtm, tor->messages()) { if (mtm.type() == TranslatorMessage::Unfinished || mtm.translation().isEmpty()) continue; diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 0c2678d..0cf24f5 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -613,15 +613,6 @@ QList Translator::messages() const return m_messages; } -QList Translator::translatedMessages() const -{ - TMM result; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) - if (it->type() == TranslatorMessage::Finished) - result.append(*it); - return result; -} - QStringList Translator::normalizedTranslations(const TranslatorMessage &msg, int numPlurals) { QStringList translations = msg.translations(); diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index bb147b8..9685e21 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -169,7 +169,6 @@ public: void setSourceLanguageCode(const QString &languageCode) { m_sourceLanguage = languageCode; } static QString guessLanguageCodeFromFileName(const QString &fileName); QList messages() const; - QList translatedMessages() const; static QStringList normalizedTranslations(const TranslatorMessage &m, int numPlurals); void normalizeTranslations(ConversionData &cd); QStringList normalizedTranslations(const TranslatorMessage &m, ConversionData &cd, bool *ok) const; -- cgit v0.12 From 361b7404f569f88e11f45d5d8e2dc61e183f37b6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 20:29:51 +0200 Subject: add hash-based indexing to Translator for fast find() --- tools/linguist/shared/translator.cpp | 97 ++++++++++++++++++++++++++---------- tools/linguist/shared/translator.h | 21 ++++++++ 2 files changed, 92 insertions(+), 26 deletions(-) diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 0cf24f5..6a616d2 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -79,7 +79,8 @@ QString QObject::tr(const char *sourceText, const char *, int n) Translator::Translator() : m_codec(QTextCodec::codecForName("ISO-8859-1")), - m_locationsType(AbsoluteLocations) + m_locationsType(AbsoluteLocations), + m_indexOk(true) { } @@ -101,20 +102,58 @@ QList &Translator::registeredFileFormats() return theFormats; } +void Translator::addIndex(int idx, const TranslatorMessage &msg) const +{ + if (msg.sourceText().isEmpty() && msg.id().isEmpty()) { + m_ctxCmtIdx[msg.context()] = idx; + } else { + m_msgIdx[TMMKey(msg)] = idx; + if (!msg.id().isEmpty()) + m_idMsgIdx[msg.id()] = idx; + } +} + +void Translator::delIndex(int idx) const +{ + const TranslatorMessage &msg = m_messages.at(idx); + if (msg.sourceText().isEmpty() && msg.id().isEmpty()) { + m_ctxCmtIdx.remove(msg.context()); + } else { + m_msgIdx.remove(TMMKey(msg)); + if (!msg.id().isEmpty()) + m_idMsgIdx.remove(msg.id()); + } +} + +void Translator::ensureIndexed() const +{ + if (!m_indexOk) { + m_indexOk = true; + m_ctxCmtIdx.clear(); + m_idMsgIdx.clear(); + m_msgIdx.clear(); + for (int i = 0; i < m_messages.count(); i++) + addIndex(i, m_messages.at(i)); + } +} + void Translator::replaceSorted(const TranslatorMessage &msg) { int index = find(msg); - if (index == -1) + if (index == -1) { appendSorted(msg); - else + } else { + delIndex(index); m_messages[index] = msg; + addIndex(index, msg); + } } void Translator::extend(const TranslatorMessage &msg) { int index = find(msg); if (index == -1) { - m_messages.append(msg); + append(msg); } else { TranslatorMessage &emsg = m_messages[index]; emsg.addReferenceUniq(msg.fileName(), msg.lineNumber()); @@ -132,16 +171,22 @@ void Translator::extend(const TranslatorMessage &msg) } } +void Translator::insert(int idx, const TranslatorMessage &msg) +{ + addIndex(idx, msg); + m_messages.insert(idx, msg); +} + void Translator::append(const TranslatorMessage &msg) { - m_messages.append(msg); + insert(m_messages.count(), msg); } void Translator::appendSorted(const TranslatorMessage &msg) { int msgLine = msg.lineNumber(); if (msgLine < 0) { - m_messages.append(msg); + append(msg); return; } @@ -189,11 +234,11 @@ void Translator::appendSorted(const TranslatorMessage &msg) thisScore = 1; } if (thisScore > bestScore || (thisScore == bestScore && thisSize > bestSize)) - m_messages.insert(thisIdx, msg); + insert(thisIdx, msg); else if (bestScore) - m_messages.insert(bestIdx, msg); + insert(bestIdx, msg); else - m_messages.append(msg); + append(msg); } static QString guessFormat(const QString &filename, const QString &format) @@ -331,19 +376,15 @@ void Translator::languageAndCountry(const QString &languageCode, int Translator::find(const TranslatorMessage &msg) const { - for (int i = 0; i < m_messages.count(); ++i) { - const TranslatorMessage &tmsg = m_messages.at(i); - if (msg.id().isEmpty() || tmsg.id().isEmpty()) { - if (msg.context() == tmsg.context() - && msg.sourceText() == tmsg.sourceText() - && msg.comment() == tmsg.comment()) - return i; - } else { - if (msg.id() == tmsg.id()) - return i; - } - } - return -1; + ensureIndexed(); + if (msg.id().isEmpty()) + return m_msgIdx.value(TMMKey(msg), -1); + int i = m_idMsgIdx.value(msg.id(), -1); + if (i >= 0) + return i; + i = m_msgIdx.value(TMMKey(msg), -1); + // If both have an id, then find only by id. + return i >= 0 && m_messages.at(i).id().isEmpty() ? i : -1; } int Translator::find(const QString &context, @@ -363,10 +404,8 @@ int Translator::find(const QString &context, int Translator::find(const QString &context) const { - for (TMM::ConstIterator it = m_messages.constBegin(); it != m_messages.constEnd(); ++it) - if (it->context() == context && it->sourceText().isEmpty() && it->id().isEmpty()) - return it - m_messages.constBegin(); - return -1; + ensureIndexed(); + return m_ctxCmtIdx.value(context, -1); } void Translator::stripObsoleteMessages() @@ -376,6 +415,7 @@ void Translator::stripObsoleteMessages() if (it->type() != TranslatorMessage::Obsolete) newmm.append(*it); m_messages = newmm; + m_indexOk = false; } void Translator::stripFinishedMessages() @@ -385,6 +425,7 @@ void Translator::stripFinishedMessages() if (it->type() != TranslatorMessage::Finished) newmm.append(*it); m_messages = newmm; + m_indexOk = false; } void Translator::stripEmptyContexts() @@ -394,6 +435,7 @@ void Translator::stripEmptyContexts() if (it->sourceText() != QLatin1String(ContextComment)) newmm.append(*it); m_messages = newmm; + m_indexOk = false; } void Translator::stripNonPluralForms() @@ -403,6 +445,7 @@ void Translator::stripNonPluralForms() if (it->isPlural()) newmm.append(*it); m_messages = newmm; + m_indexOk = false; } void Translator::stripIdenticalSourceTranslations() @@ -415,6 +458,7 @@ void Translator::stripIdenticalSourceTranslations() else if (it->translation() != it->sourceText()) newmm.append(*it); } + m_indexOk = false; m_messages = newmm; } @@ -561,6 +605,7 @@ Translator::Duplicates Translator::resolveDuplicates() } if (!omsg->isTranslated() && msg.isTranslated()) omsg->setTranslations(msg.translations()); + m_indexOk = false; m_messages.removeAt(i); } return dups; diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 9685e21..3b7bd64 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -118,6 +118,17 @@ public: TranslatorSaveMode m_saveMode; }; +class TMMKey { +public: + TMMKey(const TranslatorMessage &msg) + { context = msg.context(); source = msg.sourceText(); comment = msg.comment(); } + bool operator==(const TMMKey &o) const + { return context == o.context && source == o.source && comment == o.comment; } + QString context, source, comment; +}; +Q_DECLARE_TYPEINFO(TMMKey, Q_MOVABLE_TYPE); +inline uint qHash(const TMMKey &key) { return qHash(key.context) ^ qHash(key.source) ^ qHash(key.comment); } + class Translator { public: @@ -210,6 +221,11 @@ public: }; private: + void insert(int idx, const TranslatorMessage &msg); + void addIndex(int idx, const TranslatorMessage &msg) const; + void delIndex(int idx) const; + void ensureIndexed() const; + typedef QList TMM; // int stores the sequence position. TMM m_messages; @@ -228,6 +244,11 @@ private: QString m_language; QString m_sourceLanguage; ExtraData m_extra; + + mutable bool m_indexOk; + mutable QHash m_ctxCmtIdx; + mutable QHash m_idMsgIdx; + mutable QHash m_msgIdx; }; bool getNumerusInfo(QLocale::Language language, QLocale::Country country, -- cgit v0.12 From a6f009462876a37dc5e6b04a0f0837bc7f00694b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 20:32:32 +0200 Subject: optimization: avoid creating unnecessary temporaries erase messages instead of building a new list of non-dropped ones. modify messages instead of replacing them with modified copies. --- tools/linguist/shared/translator.cpp | 64 ++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 6a616d2..bd13bf7 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -410,56 +410,54 @@ int Translator::find(const QString &context) const void Translator::stripObsoleteMessages() { - TMM newmm; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) - if (it->type() != TranslatorMessage::Obsolete) - newmm.append(*it); - m_messages = newmm; + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ) + if (it->type() == TranslatorMessage::Obsolete) + it = m_messages.erase(it); + else + ++it; m_indexOk = false; } void Translator::stripFinishedMessages() { - TMM newmm; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) - if (it->type() != TranslatorMessage::Finished) - newmm.append(*it); - m_messages = newmm; + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ) + if (it->type() == TranslatorMessage::Finished) + it = m_messages.erase(it); + else + ++it; m_indexOk = false; } void Translator::stripEmptyContexts() { - TMM newmm; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) - if (it->sourceText() != QLatin1String(ContextComment)) - newmm.append(*it); - m_messages = newmm; + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end();) + if (it->sourceText() == QLatin1String(ContextComment)) + it = m_messages.erase(it); + else + ++it; m_indexOk = false; } void Translator::stripNonPluralForms() { - TMM newmm; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) - if (it->isPlural()) - newmm.append(*it); - m_messages = newmm; + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ) + if (!it->isPlural()) + it = m_messages.erase(it); + else + ++it; m_indexOk = false; } void Translator::stripIdenticalSourceTranslations() { - TMM newmm; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) { + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ) { // we need to have just one translation, and it be equal to the source - if (it->translations().count() != 1) - newmm.append(*it); - else if (it->translation() != it->sourceText()) - newmm.append(*it); + if (it->translations().count() == 1 && it->translation() == it->sourceText()) + it = m_messages.erase(it); + else + ++it; } m_indexOk = false; - m_messages = newmm; } void Translator::dropTranslations() @@ -637,20 +635,18 @@ void Translator::reportDuplicates(const Duplicates &dupes, // Used by lupdate to be able to search using absolute paths during merging void Translator::makeFileNamesAbsolute(const QDir &originalPath) { - TMM newmm; for (TMM::iterator it = m_messages.begin(); it != m_messages.end(); ++it) { - TranslatorMessage msg = *it; + TranslatorMessage &msg = *it; + TranslatorMessage::References refs = msg.allReferences(); msg.setReferences(TranslatorMessage::References()); - foreach (const TranslatorMessage::Reference &ref, it->allReferences()) { + foreach (const TranslatorMessage::Reference &ref, refs) { QString fileName = ref.fileName(); QFileInfo fi (fileName); if (fi.isRelative()) fileName = originalPath.absoluteFilePath(fileName); msg.addReference(fileName, ref.lineNumber()); } - newmm.append(msg); } - m_messages = newmm; } QList Translator::messages() const @@ -698,9 +694,7 @@ void Translator::normalizeTranslations(ConversionData &cd) tlns.removeLast(); truncated = true; } - TranslatorMessage msg2(msg); - msg2.setTranslations(tlns); - m_messages[i] = msg2; + m_messages[i].setTranslations(tlns); } } if (truncated) -- cgit v0.12 From dedc3463b28fd859bc79f04655e7a13c7c2c2042 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 21:19:21 +0200 Subject: remove dead variables --- tools/linguist/shared/qm.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 06603fe..85af251 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -503,12 +503,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) // for squeezed but non-file data, this is what needs to be deleted const uchar *messageArray = 0; const uchar *offsetArray = 0; - const uchar *contextArray = 0; - const uchar *numerusRulesArray = 0; - uint messageLength = 0; uint offsetLength = 0; - uint contextLength = 0; - uint numerusRulesLength = 0; bool ok = true; const uchar *end = data + len; @@ -527,22 +522,13 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) break; } - if (tag == Contexts) { - contextArray = data; - contextLength = blockLen; - //qDebug() << "CONTEXTS: " << contextLength << QByteArray((const char *)contextArray, contextLength).toHex(); - } else if (tag == Hashes) { + if (tag == Hashes) { offsetArray = data; offsetLength = blockLen; - //qDebug() << "HASHES: " << offsetLength << QByteArray((const char *)offsetArray, offsetLength).toHex(); + //qDebug() << "HASHES: " << blockLen << QByteArray((const char *)data, blockLen).toHex(); } else if (tag == Messages) { messageArray = data; - messageLength = blockLen; - //qDebug() << "MESSAGES: " << messageLength << QByteArray((const char *)messageArray, messageLength).toHex(); - } else if (tag == NumerusRules) { - numerusRulesArray = data; - numerusRulesLength = blockLen; - //qDebug() << "NUMERUSRULES: " << numerusRulesLength << QByteArray((const char *)numerusRulesArray, numerusRulesLength).toHex(); + //qDebug() << "MESSAGES: " << blockLen << QByteArray((const char *)data, blockLen).toHex(); } data += blockLen; -- cgit v0.12 From 8f21f8aa75e4a64cdb89dbfd89663bcf5d58ab34 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 21:29:44 +0200 Subject: need no qlibraryinfo any more we call qmake now --- tools/linguist/lrelease/lrelease.pro | 9 --------- tools/linguist/lrelease/main.cpp | 12 ------------ 2 files changed, 21 deletions(-) diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index 89694be..e9b3a75 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -5,19 +5,10 @@ DESTDIR = ../../../bin DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII SOURCES += main.cpp -INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # qlibraryinfo.cpp includes qconfig.cpp -SOURCES += \ - $$QT_SOURCE_TREE/src/corelib/global/qlibraryinfo.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qsettings.cpp -win32:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qsettings_win.cpp -macx:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qsettings_mac.cpp - include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) include(../../shared/symbian/epocroot.pri) -win32:LIBS += -ladvapi32 # for qsettings_win.cpp - target.path=$$[QT_INSTALL_BINS] INSTALLS += target diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 9adaff5..1fa1474 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -425,16 +425,4 @@ static void initBinaryDir( #endif } -QT_BEGIN_NAMESPACE - -// The name is hard-coded in QLibraryInfo -QString qmake_libraryInfoFile() -{ - if (binDir.isEmpty()) - return QString(); - return QDir(binDir).filePath(QString::fromLatin1("qt.conf")); -} - -QT_END_NAMESPACE - #endif // QT_BOOTSTRAPPED -- cgit v0.12 From 7602be09663d37f01cfd640a7f1be959ce4317b7 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 1 Jun 2011 10:41:14 +1000 Subject: Fix docs on caching for images loaded by image providers Also add docs for 'source' and 'asynchronous' properties for AnimatedImage. Task-number: QTBUG-19504 Change-Id: Iec72dc7630308a94c37d00c6b008b5949c6fccd4 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeanimatedimage.cpp | 26 ++++++++++++++++++++++ src/declarative/qml/qdeclarativeengine.cpp | 3 --- src/declarative/qml/qdeclarativeimageprovider.cpp | 14 +++++++++++- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index b7fcbb5..8787a5e 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -87,6 +87,32 @@ QT_BEGIN_NAMESPACE */ /*! + \qmlproperty url AnimatedImage::source + + This property holds the URL that refers to the source image. + + AnimatedImage can handle any image format supported by Qt, loaded from any + URL scheme supported by Qt. + + \sa QDeclarativeImageProvider +*/ + +/*! + \qmlproperty bool AnimatedImage::asynchronous + + Specifies that images on the local filesystem should be loaded + asynchronously in a separate thread. The default value is + false, causing the user interface thread to block while the + image is loaded. Setting \a asynchronous to true is useful where + maintaining a responsive user interface is more desirable + than having images immediately visible. + + Note that this property is only valid for images read from the + local filesystem. Images loaded via a network resource (e.g. HTTP) + are always loaded asynchonously. +*/ + +/*! \qmlproperty bool AnimatedImage::cache \since Quick 1.1 diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index b81f631..e9feff4 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -771,9 +771,6 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const All required image providers should be added to the engine before any QML sources files are loaded. - Note that images loaded from a QDeclarativeImageProvider are cached - by QPixmapCache, similar to any image loaded by QML. - \sa removeImageProvider() */ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativeImageProvider *provider) diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 559adf4..fa88c00 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -136,7 +136,8 @@ public: Image providers that support QImage loading automatically include support for asychronous loading of images. To enable asynchronous loading for an - \l Image source, set \l Image::asynchronous to \c true. When this is enabled, + image source, set the \c asynchronous property to \c true for the relevant + \l Image, \l BorderImage or \l AnimatedImage object. When this is enabled, the image request to the provider is run in a low priority thread, allowing image loading to be executed in the background, and reducing the performance impact on the user interface. @@ -147,6 +148,17 @@ public: \c true, the value is ignored and the image is loaded synchronously. + + \section2 Image caching + + Images returned by a QDeclarativeImageProvider are automatically cached, + similar to any image loaded by the QML engine. When an image with a + "image://" prefix is loaded from cache, requestImage() and requestPixmap() + will not be called for the relevant image provider. If an image should always + be fetched from the image provider, and should not be cached at all, set the + \c cache property to \c false for the relevant \l Image, \l BorderImage or + \l AnimatedImage object. + \sa QDeclarativeEngine::addImageProvider() */ -- cgit v0.12 From 5b1a0a5564a69331d581bcf4f94da0e11d14a31f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 2 Jun 2011 11:07:21 +1000 Subject: Add private method for flushing the pixmap cache. Change-Id: I7330383b89a3a313dd845274d17d38c714db20ce Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativepixmapcache.cpp | 14 ++++++++++++++ src/declarative/util/qdeclarativepixmapcache_p.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index a29854f..831aa75 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -584,6 +584,7 @@ public: void unreferencePixmap(QDeclarativePixmapData *); void referencePixmap(QDeclarativePixmapData *); + void flushCache(); protected: virtual void timerEvent(QTimerEvent *); @@ -682,6 +683,14 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *) } } +/* + Remove all unreferenced pixmaps from the cache. +*/ +void QDeclarativePixmapStore::flushCache() +{ + shrinkCache(m_unreferencedCost); +} + QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d) : data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0) { @@ -1075,6 +1084,11 @@ bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method) return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method); } +void QDeclarativePixmap::flushCache() +{ + pixmapStore()->flushCache(); +} + QT_END_NAMESPACE #include diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 1cf76dd..48c9f8b 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -103,6 +103,8 @@ public: bool connectDownloadProgress(QObject *, const char *); bool connectDownloadProgress(QObject *, int); + static void flushCache(); + private: Q_DISABLE_COPY(QDeclarativePixmap) QDeclarativePixmapData *d; -- cgit v0.12 From 8b80ff8b127c2ef5a52267bd778f44b2b2c20215 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 2 Jun 2011 11:15:33 +0300 Subject: Fix for winscw QtGui.def Reviewed-by: TRUSTME --- src/s60installs/bwins/QtGuiu.def | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3e848ec..ca4af4a 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -13104,11 +13104,11 @@ EXPORTS ??_EQTextEngine@@QAE@I@Z @ 13103 NONAME ABSENT ; QTextEngine::~QTextEngine(unsigned int) ??4QStyleOptionTitleBar@@QAEAAV0@ABV0@@Z @ 13104 NONAME ABSENT ; class QStyleOptionTitleBar & QStyleOptionTitleBar::operator=(class QStyleOptionTitleBar const &) ??4Value@QCss@@QAEAAU01@ABU01@@Z @ 13105 NONAME ABSENT ; struct QCss::Value & QCss::Value::operator=(struct QCss::Value const &) - ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 13106 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) - ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13107 NONAME ABSENT ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) - ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13108 NONAME ABSENT ; class QBitmap & QBitmap::operator=(class QBitmap const &) - ??0QItemSelection@@QAE@ABV0@@Z @ 13109 NONAME ABSENT ; QItemSelection::QItemSelection(class QItemSelection const &) - ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13110 NONAME ABSENT ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) - ?setInstantInvalidatePropagation@QGraphicsLayout@@SAX_N@Z @ 13111 NONAME ; void QGraphicsLayout::setInstantInvalidatePropagation(bool) - ?instantInvalidatePropagation@QGraphicsLayout@@SA_NXZ @ 13112 NONAME ; bool QGraphicsLayout::instantInvalidatePropagation(void) + ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13106 NONAME ABSENT ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) + ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13107 NONAME ABSENT ; class QBitmap & QBitmap::operator=(class QBitmap const &) + ??0QItemSelection@@QAE@ABV0@@Z @ 13108 NONAME ABSENT ; QItemSelection::QItemSelection(class QItemSelection const &) + ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13109 NONAME ABSENT ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) + ?setInstantInvalidatePropagation@QGraphicsLayout@@SAX_N@Z @ 13110 NONAME ; void QGraphicsLayout::setInstantInvalidatePropagation(bool) + ?instantInvalidatePropagation@QGraphicsLayout@@SA_NXZ @ 13111 NONAME ; bool QGraphicsLayout::instantInvalidatePropagation(void) + ?hasBCM2727@QSymbianGraphicsSystemEx@@SA_NXZ @ 13112 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) -- cgit v0.12 From 29a0fc05c1c0d31adc3787feb4d79bcc0af930f8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 2 Jun 2011 12:48:59 +0200 Subject: "fix" license headers our policy and even more its implementation is mildly braindead ... --- tools/linguist/shared/ioutils.cpp | 37 +++++++++++++++++++----------- tools/linguist/shared/ioutils.h | 37 +++++++++++++++++++----------- tools/linguist/shared/profileevaluator.cpp | 37 +++++++++++++++++++----------- tools/linguist/shared/profileevaluator.h | 37 +++++++++++++++++++----------- tools/linguist/shared/profileparser.cpp | 37 +++++++++++++++++++----------- tools/linguist/shared/profileparser.h | 37 +++++++++++++++++++----------- tools/linguist/shared/proitems.cpp | 37 +++++++++++++++++++----------- tools/linguist/shared/proitems.h | 37 +++++++++++++++++++----------- tools/linguist/shared/proparser_global.h | 37 +++++++++++++++++++----------- 9 files changed, 207 insertions(+), 126 deletions(-) diff --git a/tools/linguist/shared/ioutils.cpp b/tools/linguist/shared/ioutils.cpp index fbee8fc..9658cf6 100644 --- a/tools/linguist/shared/ioutils.cpp +++ b/tools/linguist/shared/ioutils.cpp @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #include "ioutils.h" diff --git a/tools/linguist/shared/ioutils.h b/tools/linguist/shared/ioutils.h index d04ddc7..e013aef 100644 --- a/tools/linguist/shared/ioutils.h +++ b/tools/linguist/shared/ioutils.h @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef IOUTILS_H #define IOUTILS_H diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index f3b4c3d..0539efa 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #include "profileevaluator.h" diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index 003042b..b3086bf 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef PROFILEEVALUATOR_H #define PROFILEEVALUATOR_H diff --git a/tools/linguist/shared/profileparser.cpp b/tools/linguist/shared/profileparser.cpp index a541ab3..5ba33fc 100644 --- a/tools/linguist/shared/profileparser.cpp +++ b/tools/linguist/shared/profileparser.cpp @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #include "profileparser.h" diff --git a/tools/linguist/shared/profileparser.h b/tools/linguist/shared/profileparser.h index 3f4593a..643e339 100644 --- a/tools/linguist/shared/profileparser.h +++ b/tools/linguist/shared/profileparser.h @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef PROFILEPARSER_H #define PROFILEPARSER_H diff --git a/tools/linguist/shared/proitems.cpp b/tools/linguist/shared/proitems.cpp index 0b65126..103a788 100644 --- a/tools/linguist/shared/proitems.cpp +++ b/tools/linguist/shared/proitems.cpp @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #include "proitems.h" diff --git a/tools/linguist/shared/proitems.h b/tools/linguist/shared/proitems.h index 4967b27..a687410 100644 --- a/tools/linguist/shared/proitems.h +++ b/tools/linguist/shared/proitems.h @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef PROITEMS_H #define PROITEMS_H diff --git a/tools/linguist/shared/proparser_global.h b/tools/linguist/shared/proparser_global.h index dd3114b..2b0b6db 100644 --- a/tools/linguist/shared/proparser_global.h +++ b/tools/linguist/shared/proparser_global.h @@ -1,34 +1,43 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** +** This file is part of the Qt Linguist of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Other Usage +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. ** +** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. ** -**************************************************************************/ +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef PROPARSER_GLOBAL_H #define PROPARSER_GLOBAL_H -- cgit v0.12 From 43ce5bab32e0d28366317be99df5e6df70787826 Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 2 Jun 2011 15:29:11 +0200 Subject: Fix problem with cosmetic stroking of cubic beziers The new algorithm would fail if the start and end point were identical. --- src/gui/painting/qcosmeticstroker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 47a1359..cdc0978 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -663,8 +663,8 @@ void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points, qreal dy = points[3].y - points[0].y; qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy)); - if (qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) > len || - qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) > len) { + if (qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) >= len || + qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) >= len) { splitCubic(points); --level; -- cgit v0.12 From de48af046a093834b8178238a2afb2efc8636efd Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 3 Jun 2011 11:19:44 +1000 Subject: Revert some of "Make QMLViewer startup animation stop after a while" This reverts most of commit c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5. Only the startup.qml changes were meant to go in. The other stuff is an experimental feature that was not supposed to be merged in. Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 16 ---------------- src/declarative/graphicsitems/qdeclarativemousearea_p.h | 3 --- .../graphicsitems/qdeclarativemousearea_p_p.h | 17 ----------------- 3 files changed, 36 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 6633256..ea04c19 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -496,9 +496,6 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) d->pressAndHoldTimer.start(PressAndHoldDelay, this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(true)); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } } @@ -576,9 +573,6 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) me.setX(d->lastPos.x()); me.setY(d->lastPos.y()); emit positionChanged(&me); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } @@ -600,9 +594,6 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (s && s->mouseGrabberItem() == this) ungrabMouse(); setKeepMouseGrab(false); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } d->doubleClick = false; } @@ -994,11 +985,4 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag() */ -QDeclarativeListProperty QDeclarativeMouseArea::forwardTo() -{ - Q_D(QDeclarativeMouseArea); - return d->forwardTo; -} - - QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index 0fe8c6a..b0dbc30 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ??? Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1) - Q_PROPERTY(QDeclarativeListProperty forwardTo READ forwardTo); public: QDeclarativeMouseArea(QDeclarativeItem *parent=0); @@ -158,8 +157,6 @@ public: bool preventStealing() const; void setPreventStealing(bool prevent); - QDeclarativeListProperty forwardTo(); - Q_SIGNALS: void hoveredChanged(); void pressedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index 7248c92..67694fb 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -70,8 +70,6 @@ public: : absorb(true), hovered(false), pressed(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0) { - Q_Q(QDeclarativeMouseArea); - forwardTo = QDeclarativeListProperty(q, forwardToList); } ~QDeclarativeMouseAreaPrivate(); @@ -91,18 +89,6 @@ public: lastModifiers = event->modifiers(); } - void forwardEvent(QGraphicsSceneMouseEvent* event) - { - Q_Q(QDeclarativeMouseArea); - for(int i=0; i < forwardToList.count(); i++){ - event->setPos(forwardToList[i]->mapFromScene(event->scenePos())); - forwardToList[i]->scene()->sendEvent(forwardToList[i], event); - if(event->isAccepted()) - break; - } - event->setPos(q->mapFromScene(event->scenePos())); - } - bool isPressAndHoldConnected() { Q_Q(QDeclarativeMouseArea); static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QDeclarativeMouseEvent*)"); @@ -135,9 +121,6 @@ public: Qt::MouseButtons lastButtons; Qt::KeyboardModifiers lastModifiers; QBasicTimer pressAndHoldTimer; - - QDeclarativeListProperty forwardTo; - QList forwardToList; }; QT_END_NAMESPACE -- cgit v0.12 From e86393a43b6f80abcb33747b9d1c1f65bcef0dc8 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 3 Jun 2011 09:00:40 +0300 Subject: QS60Style: Checked state is not shown on highlighted itemview item An itemview item with checkstate and highlight is drawn incorrectly without checked state. Consolidate check state drawing logic to happen into one place to avoid incorrect check states. Task-number: QTBUG-19668 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 63b45d3..219b963 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1445,26 +1445,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, checkMarkOption.rect = selectionRect; // Draw selection mark. if (isSelected && selectItems) { - proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); // @todo: this should happen in the rect retrievel i.e. subElementRect() if (textRect.right() > selectionRect.left()) textRect.setRight(selectionRect.left()); } else if (voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { checkMarkOption.state = checkMarkOption.state & ~State_HasFocus; - switch (vopt->checkState) { - case Qt::Unchecked: - checkMarkOption.state |= State_Off; - break; - case Qt::PartiallyChecked: - checkMarkOption.state |= State_NoChange; - break; - case Qt::Checked: - checkMarkOption.state |= State_On; - break; - } - drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); } + proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); } // draw the text @@ -2114,12 +2102,28 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #ifndef QT_NO_ITEMVIEWS if (const QAbstractItemView *itemView = (qobject_cast(widget))) { if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(option)) { + QStyleOptionViewItemV4 voptAdj = *vopt; const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator; const bool singleSelection = itemView->selectionMode() == QAbstractItemView::SingleSelection || itemView->selectionMode() == QAbstractItemView::NoSelection; // draw either checkbox at the beginning if (checkBoxVisible && singleSelection) { - drawPrimitive(PE_IndicatorCheckBox, option, painter, widget); + if (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) { + switch (vopt->checkState) { + case Qt::Unchecked: + voptAdj.state |= State_Off; + break; + case Qt::PartiallyChecked: + voptAdj.state |= State_NoChange; + break; + case Qt::Checked: + voptAdj.state |= State_On; + break; + default: + break; + } + } + drawPrimitive(PE_IndicatorCheckBox, &voptAdj, painter, widget); // ... or normal "tick" selection at the end. } else if (option->state & State_Selected) { QRect tickRect = option->rect; -- cgit v0.12 From 8339121e0942e3e3b81af551a47be7b4a347608c Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 1 Jun 2011 10:50:56 +0200 Subject: Add the new 'glhypnotizer' demo. Introduce a new demo to demonstrate the usage of OpenGL from a separate thread. Reviewed-by: Samuel --- demos/demos.pro | 4 + demos/glhypnotizer/glhypnotizer.pro | 21 +++ demos/glhypnotizer/hypnotizer.qrc | 6 + demos/glhypnotizer/main.cpp | 315 +++++++++++++++++++++++++++++++++++ demos/glhypnotizer/qt-logo.png | Bin 0 -> 2493 bytes demos/glhypnotizer/spiral.svg | 100 +++++++++++ doc/src/demos/glhypnotizer.qdoc | 38 +++++ doc/src/images/glhypnotizer-demo.png | Bin 0 -> 46888 bytes 8 files changed, 484 insertions(+) create mode 100644 demos/glhypnotizer/glhypnotizer.pro create mode 100644 demos/glhypnotizer/hypnotizer.qrc create mode 100644 demos/glhypnotizer/main.cpp create mode 100644 demos/glhypnotizer/qt-logo.png create mode 100644 demos/glhypnotizer/spiral.svg create mode 100644 doc/src/demos/glhypnotizer.qdoc create mode 100644 doc/src/images/glhypnotizer-demo.png diff --git a/demos/demos.pro b/demos/demos.pro index f1d5b00..ed18446 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -44,6 +44,9 @@ wince*: SUBDIRS = \ contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles2):{ SUBDIRS += demos_boxes } +contains(QT_CONFIG, opengl):contains(QT_CONFIG, svg){ +SUBDIRS += demos_glhypnotizer +} mac* && !qpa: SUBDIRS += demos_macmainwindow wince*|symbian|embedded|x11: SUBDIRS += demos_embedded @@ -103,6 +106,7 @@ demos_browser.subdir = browser demos_boxes.subdir = boxes demos_sub-attaq.subdir = sub-attaq demos_spectrum.subdir = spectrum +demos_glhypnotizer.subdir = glhypnotizer #CONFIG += ordered !ordered { diff --git a/demos/glhypnotizer/glhypnotizer.pro b/demos/glhypnotizer/glhypnotizer.pro new file mode 100644 index 0000000..a7fdf5e --- /dev/null +++ b/demos/glhypnotizer/glhypnotizer.pro @@ -0,0 +1,21 @@ +TEMPLATE = app +CONFIG -= moc +INCLUDEPATH += . + +# Input +SOURCES += main.cpp +QT += opengl svg +RESOURCES = hypnotizer.qrc + +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} + +# install +target.path = $$[QT_INSTALL_DEMOS]/glhypnotizer +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.svg +sources.path = $$[QT_INSTALL_DEMOS]/glhypnotizer +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) diff --git a/demos/glhypnotizer/hypnotizer.qrc b/demos/glhypnotizer/hypnotizer.qrc new file mode 100644 index 0000000..97ba159 --- /dev/null +++ b/demos/glhypnotizer/hypnotizer.qrc @@ -0,0 +1,6 @@ + + + qt-logo.png + spiral.svg + + \ No newline at end of file diff --git a/demos/glhypnotizer/main.cpp b/demos/glhypnotizer/main.cpp new file mode 100644 index 0000000..d6f3dc9 --- /dev/null +++ b/demos/glhypnotizer/main.cpp @@ -0,0 +1,315 @@ +#include +#include +#include + +#define NUM_SWIRLY_ITEMS 10 + +class GLPainter : public QObject +{ + Q_OBJECT +public: + GLPainter(QGLWidget *widget); + void stop(); + void resizeViewport(const QSize &size); + +public slots: + void start(); + +protected: + void timerEvent(QTimerEvent *event); + void paint(); + void initSwirlyItems(); + void updateSwirlyItems(); + void drawSuggestiveMessages(QPainter *p); + +private: + QMutex mutex; + QGLWidget *glWidget; + int viewportWidth; + int viewportHeight; + bool doRendering; + qreal rotationAngle; + bool swirlClockwise; + QSvgRenderer svgRenderer; + QPixmap logo; + QPainter::PixmapFragment swirlyItems[NUM_SWIRLY_ITEMS]; + int swirlyCounter; + int textCounter; + int messageYPos; + qreal scaleFactor; +}; + + +GLPainter::GLPainter(QGLWidget *widget) + : glWidget(widget) + , doRendering(true) + , rotationAngle(rand() % 360) + , swirlClockwise((rand() % 2) == 1) + , svgRenderer(QLatin1String(":/spiral.svg"), this) + , logo(QLatin1String(":/qt-logo.png")) +{ +} + +void GLPainter::start() +{ + glWidget->makeCurrent(); + startTimer(20); +} + +void GLPainter::stop() +{ + QMutexLocker locker(&mutex); + doRendering = false; +} + +void GLPainter::resizeViewport(const QSize &size) +{ + QMutexLocker locker(&mutex); + viewportWidth = size.width(); + viewportHeight = size.height(); + initSwirlyItems(); + textCounter = 0; + messageYPos = -1; +} + +void GLPainter::timerEvent(QTimerEvent *event) +{ + QMutexLocker locker(&mutex); + if (!doRendering) { + killTimer(event->timerId()); + QThread::currentThread()->quit(); + return; + } + updateSwirlyItems(); + paint(); +} + +void GLPainter::paint() +{ + QPainter p(glWidget); + p.fillRect(QRect(0, 0, viewportWidth, viewportHeight), Qt::white); + p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); + p.translate(viewportWidth / 2, viewportHeight / 2); + p.rotate(rotationAngle * (swirlClockwise ? 1 : -1)); + p.scale(svgRenderer.viewBox().width() / 200.0 * 0.65, + svgRenderer.viewBox().height() / 200.0 * 0.65); + p.translate(-viewportWidth / 2, -viewportHeight / 2); + svgRenderer.render(&p); + p.resetTransform(); + p.drawPixmapFragments(swirlyItems, NUM_SWIRLY_ITEMS, logo); + drawSuggestiveMessages(&p); + p.end(); + rotationAngle += 1.2; +} + +void GLPainter::drawSuggestiveMessages(QPainter *p) +{ + const int numSuggestiveMessages = 7; + const char *texts[numSuggestiveMessages] = {" You feel relaxed.. ", + " Let your mind wander.. ", + " Look deep into the swirls.. ", + " Even deeper.. ", + " Qt is good! ", + " Qt is good for you! ", + " You MUST use Qt! "}; + QFont font(p->font()); + font.setPointSizeF(font.pointSizeF() * viewportWidth/200.0); + p->setFont(font); + QFontMetrics fm(font); + int messageNo = textCounter/314; + if (messageNo > 6 || messageNo < 0) { + qFatal("This should not happen: %d - %d", messageNo, textCounter); + } + QLatin1String text(texts[textCounter / 314]); + qreal textWidth = fm.width(text); + int alpha = 255 * qAbs(qSin(textCounter * 0.01)); + if (messageYPos < 0 || (textCounter % 314 == 0)) { + messageYPos = qBound(fm.height(), rand() % viewportHeight, + viewportHeight - fm.height()); + } + p->setPen(QColor(255, 255, 255, alpha)); + p->setBackground(QColor(50, 50, 50, qBound(0, alpha, 50))); + p->setBackgroundMode(Qt::OpaqueMode); + p->drawText((viewportWidth / 2) - (textWidth/ 2), messageYPos, text); + ++textCounter; + if (textCounter >= (314 * numSuggestiveMessages)) + textCounter = 0; +} + +void GLPainter::initSwirlyItems() +{ + swirlyCounter = swirlClockwise ? 0 : 360; + scaleFactor = viewportWidth / 200.0; + QRectF logoRect(0, 0, logo.width(), logo.height()); + + for (int i=0; i 0 && factor <= 360) { + swirlyItems[i].x = viewportWidth / 2.0 + qSin(factor * 0.05) * (viewportWidth / 2.0) * (100.0 / factor); + swirlyItems[i].y = viewportHeight / 2.0 + qCos(factor * 0.05) * (viewportHeight / 2.0) * (100.0 / factor); + swirlyItems[i].rotation += -swirlyCounter * 0.01; + swirlyItems[i].scaleX += swirlClockwise ? -scaleFactor * 1 / 360.0 : scaleFactor * 1 / 360.0; + if (swirlClockwise) { + if (swirlyItems[i].scaleX < 0) + swirlyItems[i].scaleX = scaleFactor; + } else { + if (swirlyItems[i].scaleX > scaleFactor) + swirlyItems[i].scaleX = scaleFactor * 1 / 360.0; + } + swirlyItems[i].scaleY = swirlyItems[i].scaleX; + } else { + swirlyItems[i].scaleX = swirlyItems[i].scaleY = 0; + } + } + if (swirlClockwise) { + if (swirlyCounter > (360 + NUM_SWIRLY_ITEMS * 20)) + swirlyCounter = 0; + } else { + if (swirlyCounter < -NUM_SWIRLY_ITEMS * 20) + swirlyCounter = 360; + } +} + +class GLWidget : public QGLWidget +{ +public: + GLWidget(QWidget *parent, QGLWidget *shareWidget = 0); + ~GLWidget(); + void startRendering(); + void stopRendering(); + +protected: + void resizeEvent(QResizeEvent *event); + void paintEvent(QPaintEvent *event); + QSize sizeHint() const { return QSize(200, 200); } + +private: + GLPainter glPainter; + QThread glThread; +}; + +GLWidget::GLWidget(QWidget *parent, QGLWidget *share) + : QGLWidget(QGLFormat(QGL::SampleBuffers), parent, share) + , glPainter(this) + , glThread(this) +{ + setAttribute(Qt::WA_PaintOutsidePaintEvent); + setAttribute(Qt::WA_DeleteOnClose); +} + +GLWidget::~GLWidget() +{ + stopRendering(); +} + +void GLWidget::startRendering() +{ + glPainter.moveToThread(&glThread); + connect(&glThread, SIGNAL(started()), &glPainter, SLOT(start())); + glThread.start(); +} + +void GLWidget::stopRendering() +{ + glPainter.stop(); + glThread.wait(); +} + +void GLWidget::resizeEvent(QResizeEvent *event) +{ + glPainter.resizeViewport(event->size()); +} + +void GLWidget::paintEvent(QPaintEvent *) +{ + // Handled by GLPainter. +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT +public: + MainWindow(); + +private slots: + void newThread(); + void killThread(); + +private: + QMdiArea mdiArea; + QGLWidget shareWidget; +}; + +MainWindow::MainWindow() + : QMainWindow(0) + , mdiArea(this) + , shareWidget(this) +{ + setWindowTitle("Qt GL Hypnotizer"); + QMenu *menu = menuBar()->addMenu("&Hypnotizers"); + menu->addAction("&New hypnotizer thread", this, SLOT(newThread()), QKeySequence("Ctrl+N")); + menu->addAction("&End current hypnotizer thread", this, SLOT(killThread()), QKeySequence("Ctrl+K")); + menu->addSeparator(); + menu->addAction("E&xit", qApp, SLOT(quit()), QKeySequence("Ctrl+Q")); + + setCentralWidget(&mdiArea); + shareWidget.resize(1, 1); + newThread(); +} + +void MainWindow::newThread() +{ + static int windowCount = 1; + if (mdiArea.subWindowList().count() > 9) + return; + GLWidget *widget = new GLWidget(&mdiArea, &shareWidget); + mdiArea.addSubWindow(widget); + widget->setWindowTitle("Thread #" + QString::number(windowCount++)); + widget->show(); + widget->startRendering(); +} + +void MainWindow::killThread() +{ + delete mdiArea.activeSubWindow(); +} + +int main(int argc, char *argv[]) +{ + // Make Xlib and GLX thread safe under X11 + QApplication::setAttribute(Qt::AA_X11InitThreads); + QApplication application(argc, argv); + + // Using QPainter to draw into QGLWidgets is only supported with GL 2.0 + if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) || + (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) { + QMessageBox::information(0, "Qt GL Hypnotizer", + "This system does not support OpenGL 2.0 or OpenGL ES 2.0, " + "which is required for this example to work."); + return 0; + } + + MainWindow mainWindow; + mainWindow.show(); + return application.exec(); +} + +#include "main.moc" diff --git a/demos/glhypnotizer/qt-logo.png b/demos/glhypnotizer/qt-logo.png new file mode 100644 index 0000000..eaea344 Binary files /dev/null and b/demos/glhypnotizer/qt-logo.png differ diff --git a/demos/glhypnotizer/spiral.svg b/demos/glhypnotizer/spiral.svg new file mode 100644 index 0000000..ff1f047 --- /dev/null +++ b/demos/glhypnotizer/spiral.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/doc/src/demos/glhypnotizer.qdoc b/doc/src/demos/glhypnotizer.qdoc new file mode 100644 index 0000000..97b3c3b --- /dev/null +++ b/doc/src/demos/glhypnotizer.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/glhypnotizer + \title GL Hypnotizer + + This demo shows how to use OpenGL from a seperate thread. + + \image glhypnotizer-demo.png + + New MDI windows can be added by pressing Ctrl-N and each new child + window renders in it's own thread. +*/ diff --git a/doc/src/images/glhypnotizer-demo.png b/doc/src/images/glhypnotizer-demo.png new file mode 100644 index 0000000..5b7a1ae Binary files /dev/null and b/doc/src/images/glhypnotizer-demo.png differ -- cgit v0.12 From b761f2e1b323012661a9aeed3873b1e5facb0f11 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 1 Jun 2011 17:13:51 +1000 Subject: Fixed compile of tst_qscriptextensionplugin on some Windows configurations The debug and release versions of staticplugin are qmake'd with the same destination directory. This causes the generated staticplugin .prl file to always refer to the debug versions of Qt libraries, even if Qt was configured with -release. The .prl mechanism is not useful for this test, so simply disable it to solve the problem. Reviewed-by: ckamm --- tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro index a003338..65c4e8f 100644 --- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro +++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += static plugin +CONFIG -= create_prl # not needed, and complicates debug/release SOURCES = staticplugin.cpp RESOURCES = staticplugin.qrc QT = core script -- cgit v0.12 From 243535036078fec14bc460ccf41708ff14878797 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 1 Jun 2011 11:06:55 +0200 Subject: Refactor glyph pretransform check Move paintEngineSupportsTransformations logic from QPainter to paint engine subclasses. Simplify and consolidate checks for cached drawing (pretransformed) and path drawing (untransformed) in raster paint engine. Fix unnecessary transform when paint engines actually take the path drawing track. Fix scaling and rotation transform in raster engine for Mac. Task-number: QTBUG-19086 Change-Id: I1c0c1800a5173d3db765b9fccfd0e7a3628e3815 Reviewed-on: http://codereview.qt.nokia.com/298 Reviewed-by: Qt Sanity Bot Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 43c0e08ba2e3487840b4063b2099bc17cdd4dce2) --- src/gui/painting/qpaintengine_mac_p.h | 2 + src/gui/painting/qpaintengine_raster.cpp | 67 +++++++++++----------- src/gui/painting/qpaintengine_raster_p.h | 2 + src/gui/painting/qpaintengineex.cpp | 10 ++++ src/gui/painting/qpaintengineex_p.h | 1 + src/gui/painting/qpainter.cpp | 36 +++++------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + src/opengl/qpaintengine_opengl_p.h | 1 + src/openvg/qpaintengine_vg_p.h | 1 + 9 files changed, 65 insertions(+), 56 deletions(-) diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h index 3e71d6c..45a9f20 100644 --- a/src/gui/painting/qpaintengine_mac_p.h +++ b/src/gui/painting/qpaintengine_mac_p.h @@ -121,6 +121,8 @@ public: void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) { QPaintEngine::drawPolygon(points, pointCount, mode); } + bool supportsTransformations(qreal, const QTransform &) const { return true; }; + protected: friend class QMacPrintEngine; friend class QMacPrintEnginePrivate; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 71bbbb1..a1d728c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3062,11 +3062,8 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) ensurePen(); ensureState(); - QRasterPaintEngineState *s = state(); - QFontEngine *fontEngine = textItem->fontEngine(); - const qreal pixelSize = fontEngine->fontDef.pixelSize; - if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) < 64 * 64) { + if (!supportsTransformations(fontEngine)) { drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, fontEngine); } else { @@ -3094,36 +3091,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte #if defined (Q_WS_WIN) || defined(Q_WS_MAC) - bool drawCached = true; - - if (s->matrix.type() >= QTransform::TxProject) - drawCached = false; - - // don't try to cache huge fonts - const qreal pixelSize = ti.fontEngine->fontDef.pixelSize; - if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64) - drawCached = false; - - // ### Remove the TestFontEngine and Box engine crap, in these - // ### cases we should delegate painting to the font engine - // ### directly... - -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - QFontEngine::Type fontEngineType = ti.fontEngine->type(); - // qDebug() << "type" << fontEngineType << s->matrix.type(); - if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) ti.fontEngine)->ttf && s->matrix.type() > QTransform::TxTranslate) - || (s->matrix.type() <= QTransform::TxTranslate - && (fontEngineType == QFontEngine::TestFontEngine - || fontEngineType == QFontEngine::Box))) { - drawCached = false; - } -#else - if (s->matrix.type() > QTransform::TxTranslate) - drawCached = false; -#endif - if (drawCached) { - QRasterPaintEngineState *s = state(); - + if (!supportsTransformations(ti.fontEngine)) { QVarLengthArray positions; QVarLengthArray glyphs; @@ -3444,6 +3412,37 @@ void QRasterPaintEngine::releaseDC(HDC) const #endif +bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) const +{ + const QTransform &m = state()->matrix; +#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) + QFontEngine::Type fontEngineType = ti.fontEngine->type(); + if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) ti.fontEngine)->ttf && m.type() > QTransform::TxTranslate) + || (m.type() <= QTransform::TxTranslate + && (fontEngineType == QFontEngine::TestFontEngine + || fontEngineType == QFontEngine::Box))) { + return true; + } +#endif + return supportsTransformations(fontEngine->fontDef.pixelSize, m); +} + +bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const +{ +#if defined(Q_WS_MAC) + // Mac font engines don't support scaling and rotation + if (m.type() > QTransform::TxTranslate) +#else + if (m.type() >= QTransform::TxProject) +#endif + return true; + + if (pixelSize * pixelSize * qAbs(m.determinant()) >= 64 * 64) + return true; + + return false; +} + /*! \internal */ diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 61cf07b..d65e922 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -246,6 +246,8 @@ public: virtual void drawBufferSpan(const uint *buffer, int bufsize, int x, int y, int length, uint const_alpha); #endif + bool supportsTransformations(const QFontEngine *fontEngine) const; + bool supportsTransformations(qreal pixelSize, const QTransform &m) const; protected: QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *); diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 304e5fc..b1dc780 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1093,4 +1093,14 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) } } +bool QPaintEngineEx::supportsTransformations(qreal pixelSize, const QTransform &m) const +{ + Q_UNUSED(pixelSize); + + if (!m.isAffine()) + return true; + + return false; +} + QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 7d57eee..9cfda74 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -227,6 +227,7 @@ public: IsEmulationEngine = 0x02 // If set, this object is a QEmulationEngine. }; virtual uint flags() const {return 0;} + virtual bool supportsTransformations(qreal pixelSize, const QTransform &m) const; protected: QPaintEngineEx(QPaintEngineExPrivate &data); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 0a1e34e..7ec6d6a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -152,14 +152,6 @@ static inline uint line_emulation(uint emulation) | QPaintEngine_OpaqueBackground); } -static bool qt_paintengine_supports_transformations(QPaintEngine::Type type) -{ - return type == QPaintEngine::OpenGL2 - || type == QPaintEngine::OpenVG - || type == QPaintEngine::OpenGL - || type == QPaintEngine::CoreGraphics; -} - #ifndef QT_NO_DEBUG static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false) { @@ -5815,20 +5807,19 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) int count = qMin(glyphIndexes.size(), glyphPositions.size()); QVarLengthArray fixedPointPositions(count); - bool paintEngineSupportsTransformations = - d->extended != 0 - ? qt_paintengine_supports_transformations(d->extended->type()) - : qt_paintengine_supports_transformations(d->engine->type()); - - // If the matrix is not affine, the paint engine will fall back to - // drawing the glyphs as paths, which in turn means we should not - // preprocess the glyph positions - if (!d->state->matrix.isAffine()) - paintEngineSupportsTransformations = true; + QRawFontPrivate *fontD = QRawFontPrivate::get(font); + bool supportsTransformations; + if (d->extended != 0) { + supportsTransformations = d->extended->supportsTransformations(fontD->fontEngine->fontDef.pixelSize, + d->state->matrix); + } else { + supportsTransformations = d->engine->type() == QPaintEngine::CoreGraphics + || d->state->matrix.isAffine(); + } for (int i=0; istate->transform().map(processedPosition); fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); } @@ -6004,11 +5995,12 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText return; } - bool paintEngineSupportsTransformations = qt_paintengine_supports_transformations(d->extended->type()); - if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { + bool supportsTransformations = d->extended->supportsTransformations(staticText_d->font.pixelSize(), + d->state->matrix); + if (supportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; staticText_d->needsRelayout = true; - } else if (!paintEngineSupportsTransformations && staticText_d->untransformedCoordinates) { + } else if (!supportsTransformations && staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = false; staticText_d->needsRelayout = true; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index f7ec5f5..a97223d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -158,6 +158,7 @@ public: void setRenderTextActive(bool); bool isNativePaintingActive() const; + bool supportsTransformations(qreal, const QTransform &) const { return true; } private: Q_DISABLE_COPY(QGL2PaintEngineEx) }; diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 8f12be4..aaca48a 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -143,6 +143,7 @@ public: Qt::HANDLE handle() const; #endif inline Type type() const { return QPaintEngine::OpenGL; } + bool supportsTransformations(qreal, const QTransform &) const { return true; } private: void drawPolyInternal(const QPolygonF &pa, bool close = true); diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 1e9103b..2aba5a2 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -159,6 +159,7 @@ public: QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; } void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize); + bool supportsTransformations(qreal, const QTransform &) const { return true; } protected: QVGPaintEngine(QVGPaintEnginePrivate &data); -- cgit v0.12 From d2d6f3963d11e969bf0fe0ff35064be5455f80c5 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 3 Jun 2011 11:56:27 +0200 Subject: Fix Windows build --- src/gui/painting/qpaintengine_raster.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a1d728c..7161fe3 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3416,8 +3416,8 @@ bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) { const QTransform &m = state()->matrix; #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - QFontEngine::Type fontEngineType = ti.fontEngine->type(); - if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) ti.fontEngine)->ttf && m.type() > QTransform::TxTranslate) + QFontEngine::Type fontEngineType = fontEngine->type(); + if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) fontEngine)->ttf && m.type() > QTransform::TxTranslate) || (m.type() <= QTransform::TxTranslate && (fontEngineType == QFontEngine::TestFontEngine || fontEngineType == QFontEngine::Box))) { -- cgit v0.12 From 9af060d82a4738f6fb03aa4738d9377cdbb0df54 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 3 Jun 2011 12:05:12 +0100 Subject: Skipping tst_QEventLoop::processEventsExcludeSocket for qws tst_QEventLoop::processEventsExcludeSocket is failing on qws after an upgrade to that test. It looks most likely to be a qws fault, so a defect QTBUG-19699 has been raised and this test skipped for qws in the meantime. Reviewed-by: Laszlo Agocs --- tests/auto/qeventloop/tst_qeventloop.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index 9196a47..7a8c441 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/qeventloop/tst_qeventloop.cpp @@ -633,6 +633,9 @@ public: void tst_QEventLoop::processEventsExcludeSocket() { +#if defined(Q_WS_QWS) + QSKIP("Socket message seems to be leaking through QEventLoop::exec(ExcludeSocketNotifiers) on qws (QTBUG-19699)", SkipAll); +#endif SocketTestThread thread; thread.start(); QVERIFY(thread.wait()); -- cgit v0.12 From 81da1a8f774ec258f45549734e84770655a7c8e8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 3 Jun 2011 13:31:05 +0200 Subject: Add basic static text drawing capability to lance Task-number: QTBUG-17514 Change-Id: Ife7cd8f940424d805f634ca190bcbf6fd83d8682 Reviewed-on: http://codereview.qt.nokia.com/321 Reviewed-by: Qt Sanity Bot Reviewed-by: aavit (cherry picked from commit ce041a6516bfb0d9bd9ee1707605b478e1c9171a) --- tests/arthur/common/paintcommands.cpp | 20 +++++ tests/arthur/common/paintcommands.h | 1 + tests/auto/lancelot/scripts/statictext.qps | 122 +++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 tests/auto/lancelot/scripts/statictext.qps diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index 9273142..7b10da0 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #ifdef QT3_SUPPORT #include @@ -464,6 +465,10 @@ void PaintCommands::staticInit() "^drawText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", "drawText ", "drawText 10 10 \"my text\""); + DECL_PAINTCOMMAND("drawStaticText", command_drawStaticText, + "^drawStaticText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", + "drawStaticText ", + "drawStaticText 10 10 \"my text\""); DECL_PAINTCOMMAND("drawTiledPixmap", command_drawTiledPixmap, "^drawTiledPixmap\\s+([\\w.:\\/]*)" "\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w*)\\s*(-?\\w*)" @@ -1404,6 +1409,21 @@ void PaintCommands::command_drawText(QRegExp re) m_painter->drawText(x, y, txt); } +void PaintCommands::command_drawStaticText(QRegExp re) +{ + if (!m_shouldDrawText) + return; + QStringList caps = re.capturedTexts(); + int x = convertToInt(caps.at(1)); + int y = convertToInt(caps.at(2)); + QString txt = caps.at(3); + + if (m_verboseMode) + printf(" -(lance) drawStaticText(%d, %d, %s)\n", x, y, qPrintable(txt)); + + m_painter->drawStaticText(x, y, QStaticText(txt)); +} + /***************************************************************************************************/ void PaintCommands::command_noop(QRegExp) { diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h index 08c0e25..d0a2b98 100644 --- a/tests/arthur/common/paintcommands.h +++ b/tests/arthur/common/paintcommands.h @@ -209,6 +209,7 @@ private: void command_drawRoundedRect(QRegExp re); void command_drawRoundRect(QRegExp re); void command_drawText(QRegExp re); + void command_drawStaticText(QRegExp re); void command_drawTiledPixmap(QRegExp re); void command_path_addEllipse(QRegExp re); void command_path_addPolygon(QRegExp re); diff --git a/tests/auto/lancelot/scripts/statictext.qps b/tests/auto/lancelot/scripts/statictext.qps new file mode 100644 index 0000000..b62b623 --- /dev/null +++ b/tests/auto/lancelot/scripts/statictext.qps @@ -0,0 +1,122 @@ +drawStaticText -5 5 "Text that is drawn outside the bounds..." + +translate 20 20 +begin_block text_drawing +save + setFont "sansserif" 10 normal + drawStaticText 0 20 "sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 40 "sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 60 "sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 80 "sansserif 10pt, bold italic" + + + translate 0 100 + setPen #7fff0000 + + setFont "sansserif" 10 normal + drawStaticText 0 20 "alpha sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 40 "alpha sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 60 "alpha sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 80 "alpha sansserif 10pt, bold italic" + + + translate 0 100 + setPen black + save + scale 0.9 0.9 + + setFont "sansserif" 10 normal + drawStaticText 0 20 "scaled sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 40 "scaled sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 60 "scaled sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 80 "scaled sansserif 10pt, bold italic" + restore + + translate 0 100 + setPen black + save + translate 200 90 + rotate 185 + + setFont "sansserif" 10 normal + drawStaticText 0 20 "scaled sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 40 "scaled sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 60 "scaled sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 80 "scaled sansserif 10pt, bold italic" + restore + + translate 0 100 + gradient_appendStop 0 red + gradient_appendStop 0.5 #00ff00 + gradient_appendStop 1 blue + gradient_setLinear 0 0 200 0 + setPen brush + + setFont "sansserif" 10 normal + drawStaticText 0 0 "gradient sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 20 "gradient sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 40 "gradient sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 60 "gradient sansserif 10pt, bold italic" +restore +end_block + +translate 250 0 +drawStaticText 25 520 "clipped to rectangle" +save + setPen #3f000000 + setBrush nobrush + drawRect 20 0 100 500 + setClipRect 20 0 100 500 + setPen black + repeat_block text_drawing +restore + +translate 150 0 +drawStaticText 25 520 "clipped to path" +save + path_moveTo clip 20 0 + path_cubicTo clip 0 200 40 400 20 400 + path_lineTo clip 30 500 + path_lineTo clip 30 0 + path_lineTo clip 40 0 + path_lineTo clip 40 500 + path_lineTo clip 120 500 + path_lineTo clip 120 0 + path_lineTo clip 20 0 + setPen #3f000000 + setBrush nobrush + drawPath clip + setClipPath clip + setPen black + repeat_block text_drawing +restore -- cgit v0.12 From 29ebd2ce78eb01a130470b8e5fe776efe130bdd8 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 3 Jun 2011 16:12:23 +0200 Subject: Add missing license header. Reviewed-by: aavit --- demos/glhypnotizer/main.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/demos/glhypnotizer/main.cpp b/demos/glhypnotizer/main.cpp index d6f3dc9..cc1482d 100644 --- a/demos/glhypnotizer/main.cpp +++ b/demos/glhypnotizer/main.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include #include -- cgit v0.12 From 33616d404d4f3eaafad78e4602a4e620a012a660 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 3 Jun 2011 16:08:54 +0200 Subject: Correct QStaticText tests after recent changes Raster engine on Mac now correctly handles transformation, so no need to XFAIL anymore. Also fixes a drawStaticText origin mistake, the y origin should be the top left point rather than the baseline. Change-Id: I6058e7099b336d9d5a6586344a07be3c7d76fb64 Reviewed-on: http://codereview.qt.nokia.com/329 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang (cherry picked from commit ea0e38c0ddb687f7873e0937e1b7130f1588c3d6) --- tests/auto/qstatictext/tst_qstatictext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 0c4857a..a924119 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -361,7 +361,7 @@ bool tst_QStaticText::supportsTransformations() const QPaintEngine::Type type = engine->type(); if (type == QPaintEngine::OpenGL -#if !defined(Q_WS_WIN) && !defined(Q_WS_X11) +#if !defined(Q_WS_WIN) && !defined(Q_WS_X11) && !defined(Q_WS_MAC) || type == QPaintEngine::Raster #endif ) @@ -601,7 +601,7 @@ void tst_QStaticText::setPenPlainText() QStaticText staticText("XXXXX"); staticText.setTextFormat(Qt::PlainText); - p.drawStaticText(0, fm.ascent(), staticText); + p.drawStaticText(0, 0, staticText); } QImage img = image.toImage(); -- cgit v0.12 From 278c2b360aba87db2d1e5a2d3e14de7260d8a16e Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 3 Jun 2011 16:03:00 +0200 Subject: Correct antialias disabling logic for Core Text We should always turn antialias off when QFont::NoAntialias being passed in styleStrategy. That corrects some QStaticText tests. Change-Id: Iaffc5f3bb7f501dcb648cab41a8b6ffcf93f90ae Reviewed-on: http://codereview.qt.nokia.com/328 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang (cherry picked from commit c25495dba7eff32b66119737552905787e97e665) --- src/gui/text/qfontengine_coretext.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 982c271..75b4e1f 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -745,9 +745,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition 8, im.bytesPerLine(), colorspace, cgflags); CGContextSetFontSize(ctx, fontDef.pixelSize); - CGContextSetShouldAntialias(ctx, aa || - (fontDef.pointSize > qt_antialiasing_threshold - && !(fontDef.styleStrategy & QFont::NoAntialias))); + CGContextSetShouldAntialias(ctx, (aa || fontDef.pointSize > qt_antialiasing_threshold) + && !(fontDef.styleStrategy & QFont::NoAntialias)); CGContextSetShouldSmoothFonts(ctx, aa); CGAffineTransform oldTextMatrix = CGContextGetTextMatrix(ctx); CGAffineTransform cgMatrix = CGAffineTransformMake(1, 0, 0, 1, 0, 0); -- cgit v0.12 From cc864a94d296126f4a17b474a7e0fe27cc4ccd80 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 6 Jun 2011 11:40:59 +0300 Subject: Move qts60plugindeployment rule to correct scope Task-number: QTBUG-18614 Reviewed-by: TrustMe --- src/s60installs/s60installs.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index b72e2a4..c82b2c0 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -50,6 +50,7 @@ symbian: { " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ENDIF" \ " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\"" + qtlibraries.pkg_postrules += qts60plugindeployment } else { # No need to deploy plugins for older platform versions when building on Symbian3 or later bearer_plugin.files = $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll @@ -57,8 +58,6 @@ symbian: { DEPLOYMENT += bearer_plugin } - qtlibraries.pkg_postrules += qts60plugindeployment - qtlibraries.path = c:/sys/bin vendorinfo = \ -- cgit v0.12 From 7eb590b5bb00e5cfb8e153938f55013eebe94880 Mon Sep 17 00:00:00 2001 From: Takumi ASAKI Date: Mon, 6 Jun 2011 12:13:58 +0200 Subject: Update Japanese translations. * Fix some inconsistent translations. * Translate some missing messages. * Update Japanese phrasebook. Merge-request: 1249 Reviewed-by: ossi --- tools/linguist/phrasebooks/japanese.qph | 15 ++- translations/assistant_ja.ts | 2 +- translations/designer_ja.ts | 52 ++++---- translations/linguist_ja.ts | 124 ++++++++++--------- translations/qt_help_ja.ts | 18 +-- translations/qt_ja.ts | 209 +++++++++++++++++++++----------- translations/qtconfig_ja.ts | 22 +++- 7 files changed, 274 insertions(+), 168 deletions(-) diff --git a/tools/linguist/phrasebooks/japanese.qph b/tools/linguist/phrasebooks/japanese.qph index 3ecd9e3..b04e525 100644 --- a/tools/linguist/phrasebooks/japanese.qph +++ b/tools/linguist/phrasebooks/japanese.qph @@ -1,4 +1,5 @@ - + + About について @@ -1018,4 +1019,16 @@ Yes はい + + &Next + 次を検索(&N) + + + List View + 一覧表示 + + + &Run + 実行(&R) + diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts index a3169ab..5c990de 100644 --- a/translations/assistant_ja.ts +++ b/translations/assistant_ja.ts @@ -610,7 +610,7 @@ Reason: Next - 進む + 次へ Case Sensitive diff --git a/translations/designer_ja.ts b/translations/designer_ja.ts index ab87644..7fcc66d 100644 --- a/translations/designer_ja.ts +++ b/translations/designer_ja.ts @@ -764,7 +764,7 @@ The skin configuration file '%1' could not be opened. - スキンの設定ファイル '%1' がオープンできませんでした。 + スキンの設定ファイル '%1' を開けませんでした。 Syntax error: %1 @@ -1060,7 +1060,7 @@ Parsing grid layout minimum size values &Open... - オープン(&O)... + 開く(&O)... &Recent Forms @@ -1304,7 +1304,7 @@ UI ファイルの記述が矛盾しています。 Unknown error - 不明なエラー + 未知のエラー An error occurred while running the script for %1: %2 @@ -1451,7 +1451,7 @@ Do you want to update the file location or generate a new form? Could not open file - ファイルをオープンできませんでした + ファイルを開けませんでした Saved image %1. @@ -1471,7 +1471,7 @@ Do you want to update the file location or generate a new form? Could not write file - ファイルに書き込むことができませんでした + ファイルに書き込めませんでした &Close Preview @@ -1491,7 +1491,7 @@ Do you want to update the file location or generate a new form? Save &As... - 名前をつけて保存(&A)... + 名前を付けて保存(&A)... Save A&ll @@ -1525,7 +1525,7 @@ Do you want to update the file location or generate a new form? The file %1 could not be opened. Reason: %2 Would you like to retry or select a different file? - ファイル %1 はオープンできませんでした。 + ファイル %1 を開けませんでした。 原因: %2 リトライしますか、それとも他のファイルを選択しますか? @@ -1533,7 +1533,7 @@ Would you like to retry or select a different file? It was not possible to write the entire file %1 to disk. Reason:%2 Would you like to retry? - ファイル %1 の全体をディスクに書き込むことができませんでした。 + ファイル %1 の全体をディスクに書き込めませんでした。 原因: %2 リトライしますか? @@ -1876,7 +1876,7 @@ Container pages should only be added by specifying them in XML returned by the d The file <b>%1</b> could not be opened. - ファイル <b>%1</b> はオープンできませんでした。 + ファイル <b>%1</b> を開けませんでした。 There are %n forms with unsaved changes. Do you want to review these changes before quitting? @@ -2164,7 +2164,7 @@ Empty class name passed to widget factory method What's This - ヘルプ + ヒント Busy @@ -2190,7 +2190,7 @@ Empty class name passed to widget factory method Italic - イタリック + 斜体 Underline @@ -2778,7 +2778,7 @@ to Could not write %1: %2 - %1 に書き込むことが出来ませんでした: %2 + %1 に書き込めませんでした: %2 Open Resource File @@ -2790,11 +2790,11 @@ to Move Up - 上へ移動 + 上に移動 Move Down - 下へ移動 + 下に移動 Add Prefix @@ -3082,7 +3082,7 @@ Do you want overwrite the template? There was an error opening template %1 for writing. Reason: %2 - %1 というテンプレートを書き込み用にオープンしようとしてエラーになりました。理由: %2 + %1 というテンプレートを書き込み用に開こうととしてエラーになりました。理由: %2 Write Error @@ -3534,7 +3534,7 @@ Do you want overwrite the template? The file %1 could not be opened: %2 - ファイル %1 はオープンできませんでした: %2 + ファイル %1 を開けませんでした: %2 The file %1 could not be written: %2 @@ -3797,19 +3797,19 @@ Do you want overwrite the template? Unable to open the file '%1' for writing: %2 - ファイル '%1' を書き込み用にオープンできませんでした: %2 + ファイル '%1' を書き込み用に開けません: %2 Open profile - プロファイルをオープン + プロファイルを開く Open Profile - Error - プロファイルをオープン - Error + プロファイルを開く - エラー Unable to open the file '%1' for reading: %2 - ファイル '%1' を読み込み用にオープンできませんでした: %2 + ファイル '%1' を読み込み用に開けません: %2 '%1' is not a valid profile: %2 @@ -4558,7 +4558,7 @@ Please select another name. Unable to open the form template file '%1': %2 - フォームのテンプレートファイル '%1' をオープンできません: %2 + フォームのテンプレートファイル '%1' を開けません: %2 Internal error: No template selected. @@ -4761,7 +4761,7 @@ Please select another name. Refresh - リフレッシュ + 更新 Scan for newly installed custom widget plugins. @@ -5256,7 +5256,7 @@ Class: %2 &OK - OK(&O) + &OK &Cancel @@ -5287,7 +5287,7 @@ Class: %2 Italic - イタリック + 斜体 CTRL+I @@ -5730,7 +5730,7 @@ Class: %2 List View - リスト表示 + 一覧表示 Icon View @@ -5792,7 +5792,7 @@ UI ファイルに矛盾が発生しています。 qdesigner_internal::WizardContainerWidgetTaskMenu Next - 進む + 次へ Back diff --git a/translations/linguist_ja.ts b/translations/linguist_ja.ts index 40bb778..9164b75 100644 --- a/translations/linguist_ja.ts +++ b/translations/linguist_ja.ts @@ -84,6 +84,10 @@ DataModel + The translation file '%1' will not be loaded because it is empty. + 翻訳ファイル '%1' が空のためロードできません。 + + <qt>Duplicate messages found in '%1': <qt>'%1' に重複したメッセージが見つかりました: @@ -345,7 +349,7 @@ Return value: 2 on read failures 3 on write failures - + 使い方: lconvert [オプション] <入力ファイル> [<入力ファイル>...] @@ -365,8 +369,8 @@ lconvert は Qt Linguist ツールチェインの一部です。 -i <入力ファイル> --input-file <入力ファイル> 入力ファイルを指定します。<入力ファイル> の指定はダッシュ記号で始まっていてもよいです。 - This option can be used several times to merge inputs. - May be '-' (標準入力) for use in a pipe. + このオプションはマージする入力ファイルを指定する際に複数回使用できます。 + パイプで利用する場合には '-' で標準入力を指定します。 -o <出力ファイル> --output-file <出力ファイル> @@ -382,29 +386,30 @@ lconvert は Qt Linguist ツールチェインの一部です。 出力形式を指定します。-if を参照してください。 --input-codec <コーデック> - Specify encoding for QM and PO input files. Default is 'Latin1' - for QM and 'UTF-8' for PO files. UTF-8 is always tried as well for - QM, corresponding to the possible use of the trUtf8() function. + QM や PO ファイルのエンコーディングを指定します。デフォルトでは + QM ファイルでは 'Latin1' を PO ファイルでは 'UTF-8' を使用します。 + QM ファイルでは通常 trUtf8() 関数が組み合わせて利用されるため、 + UTF-8 の利用も試みます。 --output-codec <コーデック> - Specify encoding for PO output files.デフォルトは 'UTF-8' です。 + PO 出力ファイルのエンコーディングを指定します。デフォルトは 'UTF-8' です。 --drop-tags <正規表現> - Drop named extra tags when writing TS or XLIFF files. - May be specified repeatedly. + TS ファイルや XLIFF ファイルに出力する際に名前付き拡張タグを削除します。 + 複数回指定可能です。 --drop-translations - Drop existing translations and reset the status to 'unfinished'. - 注意: --no-obsolete と同等です。 + 既存の翻訳を削除してステータスを'未完了'にリセットします。 + 注意: --no-obsolete の指定を含みます。 --source-language <language>[_<region>] - Specify/override the language of the source strings. Defaults to - POSIX if not specified and the file does not name it yet. + ソーステキストの言語を指定もしくは上書きします。 + 未指定でファイルにも記述されていない場合、POSIX をデフォルトで使用します。 --target-language <language>[_<region>] - Specify/override the language of the translation. - The target language is guessed from the file name if this option - is not specified and the file contents name no language yet. + 翻訳で使用される言語を指定もしくは上書きします。 + オプションやファイル内で言語が指定されていない場合は、 + ファイル名から言語を推測します。 --no-obsolete 未使用のメッセージを取り除きます。 @@ -416,14 +421,14 @@ lconvert は Qt Linguist ツールチェインの一部です。 出力する TS ファイル内のコンテキストをアルファベット順にソートします。 --locations {absolute|relative|none} - Override how source code references are saved in TS files. - Default is absolute. + TS ファイル内に保存されているソースコードへの参照を上書きします。 + デフォルトは absolute (絶対パス) です。 --no-ui-lines UI ファイルを参照している行番号を取り除きます。 --verbose - be a bit more verbose + より詳しいログを出力します。 長すぎるオプションの指定はダッシュ記号で括る事で1つにできます。 @@ -489,13 +494,14 @@ Options: -version Display the version of lrelease and exit - 使い方: + 使い方: lrelease [オプション] project-file lrelease [オプション] ts-files [-qm qm-file] -lrelease is part of Qt's Linguist tool chain. It can be used as a -stand-alone tool to convert XML-based translations files in the TS -format into the 'compiled' QM format used by QTranslator objects. +lrelease は Qt Linguist ツールチェインの一部です。 +XMLベースの翻訳ファイルであるTSフォーマットを +QTranslatorで利用可能な「コンパイル済み」のQMフォーマットに +変換する事ができるスタンドアロンのツールです。 オプション: -help このヘルプを表示して終了します @@ -506,13 +512,13 @@ format into the 'compiled' QM format used by QTranslator objects. -nounfinished 未完了の翻訳をインクルードしません -removeidentical - If the translated text is the same as - the source text, do not include the message + 翻訳後の文字列がソースと同じ場合、 + メッセージをQMファイルに組み込みません -markuntranslated <プレフィクス> - If a message has no real translation, use the source text - prefixed with the given string instead + メッセージが翻訳されていない場合、ソースの文字列に + <プレフィックス>を追加した文字列を代わりに使用します -silent - 完了した事を通知しません + 実行内容を表示しません -version lrelease のバージョンを表示して終了します @@ -823,62 +829,62 @@ Options: @lst-file Read additional file names (one per line) from lst-file. - 使い方: + 使い方: lupdate [オプション] [プロジェクトファイル]... lupdate [オプション] [source-file|path|@lst-file]... -ts ts-files|@lst-file -lupdate は Qt' Linguist ツールチェインの一部です。Qt UI ファイル、C++ 、Java、 +lupdate は Qt Linguist ツールチェインの一部です。Qt UI ファイル、C++ 、Java、 JavaScript/QtScript のソースコードからメッセージを抽出します。 -Extracted messages are stored in textual translation source files (typically -Qt TS XML). 新しく追加されたり変更されたメッセージは既存の TS ファイル内のメッセージから -マージされます。 +抽出されたメッセージは原文として翻訳ソースファイル(通常は Qt TS XML)に保存されます。 +新しく追加されたり変更されたメッセージは既存の TS ファイル内のメッセージからマージされます。 オプション: -help このヘルプを表示して終了します。 -no-obsolete - すべての未使用の文字列を取り除きます。 + すべての未使用の文字列を取り除きます。 -extensions <ext>[,<ext>]... - 与えられた拡張子のファイルだけ処理します。 - 拡張子のリストはカンマで区切り、空白スペースを含んではいけません。 - デフォルト: '%1' + 与えられた拡張子のファイルだけを処理します。 + 拡張子のリストはカンマで区切り、空白スペースを含んではいけません。 + デフォルト: '%1' -pluralonly - 複数形のメッセージだけインクルードします。 + 複数形のメッセージだけインクルードします。 -silent - 完了した事を通知しません + 完了した事を通知しません -no-sort - TS ファイル内のコンテキストをソートしません。 + TS ファイル内のコンテキストをソートしません。 -no-recursive - ディレクトリ内を再帰的に処理しません。 + ディレクトリ内を再帰的に処理しません。 -recursive - ディレクトリ内を再帰的に処理します。(デフォルト) + ディレクトリ内を再帰的に処理します。(デフォルト) -I <includepath> or -I<includepath> - Additional location to look for include files. - May be specified multiple times. + include ファイルを検索するパスを追加します。 + 複数回の指定が可能です。 -locations {absolute|relative|none} - Specify/override how source code references are saved in TS files. - Default is absolute. + TS ファイルに保存されるソースコードの参照方法を指定/上書きします。 + デフォルトは absolute (絶対パス)です。 -no-ui-lines - UI ファイルを参照する行番号を記録しません。 + UI ファイルを参照する行番号を記録しません。 -disable-heuristic {sametext|similartext|number} - Disable the named merge heuristic. Can be specified multiple times. + 指定された手法のあいまいマージを行いません。複数回の指定が可能です。 -pro <ファイル名> - .pro ファイルの名前を指定します。Useful for files with .pro file syntax but - different file suffix. Projects are recursed into and merged. + .pro ファイルの名前を指定します。.pro ファイルの書式に従いながら、 + 拡張子が異なる場合に有用です。 + プロジェクトは再帰的に検索し、複数指定時はマージされます。 -source-language <language>[_<region>] - Specify the language of the source strings for new files. - Defaults to POSIX if not specified. + 新しくファイルを作成する場合のソース文字列の言語を指定します。 + 指定されない場合のデフォルトは POSIX です。 -target-language <language>[_<region>] - Specify the language of the translations for new files. - Guessed from the file name if not specified. + 新しくファイルを作成する場合の翻訳言語を指定します。 + 指定されない場合はファイル名から推測されます。 -ts <ts-file>... - 出力ファイルを指定します。This will override the TRANSLATIONS - and nullify the CODECFORTR from possibly specified project files. + 出力ファイルを指定します。プロジェクトファイルで指定された + TRANSLATIONS と CODECFORTR は無視されます。 -codecfortr <codec> - Specify the codec assumed for tr() calls. Effective only with -ts. + tr() の呼び出し時に想定されるコーデックを指定します。-ts オプションを指定した場合にのみ有効です。 -version - lupdate のバージョン情報を表示して終了します。 + lupdate のバージョン情報を表示して終了します。 @lst-file - Read additional file names (one per line) from lst-file. + lst-file を使って追加で読み込むファイル名(1行に1ファイル)を指定します。 diff --git a/translations/qt_help_ja.ts b/translations/qt_help_ja.ts index 2a725ca..59036e0 100644 --- a/translations/qt_help_ja.ts +++ b/translations/qt_help_ja.ts @@ -43,7 +43,7 @@ Cannot open collection file: %1 - コレクションファイルをオープンできません: %1 + コレクションファイルを開けません: %1 Cannot create tables in file %1! @@ -67,7 +67,7 @@ Cannot open database '%1' to optimize! - 最適化用にデータベース '%1' をオープンできません! + 最適化用にデータベース '%1' を開けません! Cannot create directory: %1 @@ -83,7 +83,7 @@ Cannot open documentation file %1! - ドキュメントファイル %1 をオープンできません! + ドキュメントファイル %1 を開けません! The namespace %1 was not registered! @@ -99,14 +99,14 @@ Cannot open database '%1' '%2': %3 The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string - データベース '%1' '%2' がオープンできません: %3 + データベース '%1' '%2' を開けません: %3 QHelpEngineCore Cannot open documentation file %1: %2! - ドキュメントファイル %1 をオープンできません: %2! + ドキュメントファイル %1 を開けません: %2! The specified namespace does not exist! @@ -133,7 +133,7 @@ Cannot open data base file %1! - データベースファイル %1 をオープンできません! + データベースファイル %1 を開けません! Cannot register namespace %1! @@ -177,7 +177,7 @@ Cannot open file %1! Skipping it. - ファイル %1 をオープンできません! スキップします。 + ファイル %1 を開けません! スキップします。 The filter %1 is already registered! @@ -209,7 +209,7 @@ File '%1' cannot be opened. - ファイル '%1' をオープンできません。 + ファイル '%1' を開けません。 File '%1' contains an invalid link to file '%2' @@ -256,7 +256,7 @@ The input file %1 could not be opened! - 入力ファイル %1 がオープンできません! + 入力ファイル %1 を開けません! diff --git a/translations/qt_ja.ts b/translations/qt_ja.ts index db8a917..094e34d 100644 --- a/translations/qt_ja.ts +++ b/translations/qt_ja.ts @@ -75,7 +75,7 @@ Accessibility - アクセシビリティ + ユーザー補助 @@ -136,7 +136,7 @@ libgstreamer-plugins-base はインストールされていますか。 Could not open media source. - メディアソースを開くことができません。 + メディアソースを開けませんでした。 Invalid source type. @@ -148,11 +148,11 @@ libgstreamer-plugins-base はインストールされていますか。 Could not open audio device. The device is already in use. - オーディオデバイスを開くことができません。デバイスは既に他のプロセスにより使用されています。 + オーディオデバイスを開けませんでした。デバイスは既に他のプロセスにより使用されています。 Could not decode media source. - メディアソースを開くことができません。見つからないか、未知の形式です。 + メディアソースを開けませんでした。見つからないか、未知の形式です。 @@ -320,6 +320,10 @@ libgstreamer-plugins-base はインストールされていますか。Playback complete 再生が終了しました + + Download error + ダウンロードエラー + Phonon::MMF::AbstractVideoPlayer @@ -439,6 +443,10 @@ libgstreamer-plugins-base はインストールされていますか。Error opening source: media type could not be determined ソースのオープン時にエラーが発生しました: メディアのタイプが不明です + + Failed to set requested IAP + 要求されたIAPのセットに失敗しました + Phonon::MMF::StereoWidening @@ -511,7 +519,7 @@ libgstreamer-plugins-base はインストールされていますか。 Open - オープン + 開く Select a Directory @@ -559,7 +567,7 @@ libgstreamer-plugins-base はインストールされていますか。 &OK - OK(&O) + &OK Look &in: @@ -607,7 +615,7 @@ libgstreamer-plugins-base はインストールされていますか。 Read-only - 読み込み専用 + 読み取り専用 Write-only @@ -643,7 +651,7 @@ libgstreamer-plugins-base はインストールされていますか。 Open - オープン + 開く Save As @@ -651,7 +659,7 @@ libgstreamer-plugins-base はインストールされていますか。 &Open - オープン(&O) + 開く(&O) &Save @@ -1168,7 +1176,7 @@ to QComboBox Open - オープン + 開く False @@ -1216,6 +1224,11 @@ to %1: リソース不足です + %1: permission denied + QSystemSemaphore + %1: 許可されていません + + %1: unknown error %2 QSystemSemaphore %1: 未知のエラー %2 @@ -1290,11 +1303,11 @@ to QDeclarativeAbstractAnimation Cannot animate non-existent property "%1" - 存在しないプロパティ "%1" はアニメーション出来ません + 存在しないプロパティ "%1" はアニメーションできません Cannot animate read-only property "%1" - 読込専用のプロパティ "%1" はアニメーション出来ません + 読込専用のプロパティ "%1" はアニメーションできません Animation is an abstract class @@ -1320,7 +1333,7 @@ to Cannot anchor to an item that isn't a parent or sibling. - 親でも兄弟でもない要素にはアンカー出来ません。 + 親でも兄弟でもない要素にはアンカーできません。 Possible anchor loop detected on vertical anchor. @@ -1336,15 +1349,15 @@ to Cannot anchor to a null item. - 空の要素にはアンカー出来ません。 + 空の要素にはアンカーできません。 Cannot anchor a horizontal edge to a vertical edge. - 横方向のエッジから縦方向のエッジへはアンカー出来ません。 + 横方向のエッジから縦方向のエッジへはアンカーできません。 Cannot anchor item to self. - 自分自身へはアンカー出来ません。 + 自分自身へはアンカーできません。 Cannot specify top, bottom, and vcenter anchors. @@ -1356,7 +1369,7 @@ to Cannot anchor a vertical edge to a horizontal edge. - 縦方向のエッジから横方向のエッジへはアンカー出来ません。 + 縦方向のエッジから横方向のエッジへはアンカーできません。 @@ -1367,6 +1380,13 @@ to + QDeclarativeApplication + + Application is an abstract class + Application は抽象クラスです + + + QDeclarativeBehavior Cannot change the animation assigned to a Behavior. @@ -1494,12 +1514,20 @@ to 仕様が空であるコンポーネントは作成できません + "%1.%2" is not available in %3 %4.%5. + %3 %4.%5 で "%1.%2" は利用できません。 + + + "%1.%2" is not available due to component versioning. + コンポーネントのバージョンの問題により "%1.%2" は利用できません。 + + Incorrectly specified signal assignment 仕様と異なるシグナルが割り当てられています Cannot assign a value to a signal (expecting a script to be run) - 値をシグナルに割り当てることはできません(ただし、スクリプトは除きます) + 値はシグナルに割り当てできません(ただし、スクリプトは除きます) Empty signal assignment @@ -1551,7 +1579,7 @@ to Cannot assign a value directly to a grouped property - グループ化されたプロパティに直接値を割り当てることはできません + グループ化されたプロパティに直接値を割り当てできません Invalid property use @@ -1563,15 +1591,15 @@ to Single property assignment expected - プロパティに複数の値は割り当てられません + プロパティに複数の値は割り当てできません Unexpected object assignment - オブジェクトを割り当てることはできません + オブジェクトを割り当てできません Cannot assign object to list - オブジェクトをリストに割り当てることはできません + オブジェクトをリストに割り当てできません Can only assign one binding to lists @@ -1579,19 +1607,23 @@ to Cannot assign primitives to lists - プリミティブをリストに割り当てることはできません + プリミティブをリストに割り当てできません Cannot assign multiple values to a script property - 複数の値をスクリプトプロパティに割り当てることはできません + 複数の値をスクリプトプロパティに割り当てできません Invalid property assignment: script expected 無効なプロパティの値: スクリプトを指定してください + Cannot assign multiple values to a singular property + 複数の値を単数プロパティに割り当てできません + + Cannot assign object to property - オブジェクトをプロパティに割り当てることはできません + オブジェクトをプロパティに割り当てできません "%1" cannot operate on "%2" @@ -1647,7 +1679,7 @@ to Cannot override FINAL property - FINAL プロパティを上書きすることはできません + FINAL プロパティは上書きできません Invalid property type @@ -1675,19 +1707,27 @@ to No property alias location - プロパティのエイリアスのパスがありません + プロパティのエイリアスへのパスがありません Invalid alias location 無効なエイリアスのパス + Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property> + 無効なエイリアスの参照です。エイリアスの参照先は <ID>, <ID>.<プロパティ> もしくは <ID>.<値プロパティ>.<プロパティ> のいずれかでなくてはいけません + + + Alias property exceeds alias bounds + エイリアスプロパティがエイリアスの境界を越えています + + Invalid alias reference. An alias reference must be specified as <id> or <id>.<property> - 無効なエイリアスの参照です。エイリアスの参照先は <ID> もしくは <ID>.<プロパティ> でなくてはいけません + 無効なエイリアスの参照です。エイリアスの参照先は <ID> もしくは <ID>.<プロパティ> でなくてはいけません Invalid alias reference. Unable to find id "%1" - 無効なエイリアスの参照です。 ID "%1" が見つかりません + 無効なエイリアスの参照です。ID "%1" が見つかりません @@ -1696,6 +1736,10 @@ to Invalid empty URL 空の URL は無効です + + createObject: value is not an object + createObject: 値がオブジェクトではありません + QDeclarativeCompositeTypeManager @@ -1776,6 +1820,10 @@ to QDeclarativeImportDatabase + cannot load module "%1": File name case mismatch for "%2" + モジュール "%1" がロードできません: ファイル名の大文字小文字が "%2" に合っていません + + module "%1" definition "%2" not readable "%1" モジュールの定義 "%2" が読めません @@ -1831,19 +1879,34 @@ to is not a type は型ではありません + + File name case mismatch for "%2" + ファイル名の大文字小文字が "%2" に合っていません + QDeclarativeKeyNavigationAttached KeyNavigation is only available via attached properties - KeyNavigation はアタッチド・プロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます + KeyNavigation はアタッチされたプロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます QDeclarativeKeysAttached Keys is only available via attached properties - Keys はアタッチド・プロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます + Keys はアタッチされたプロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます + + + + QDeclarativeLayoutMirroringAttached + + LayoutDirection attached property only works with Items + アタッチされたプロパティ LayoutDirection はアイテムでのみ利用できます + + + LayoutMirroring is only available via attached properties + LayoutMirroring はアタッチされたプロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます @@ -2146,7 +2209,7 @@ to Cannot assign object type %1 with no default method - 型 %1 のオブジェクトをデフォルトメソッドなしに割り当てることはできません + デフォルトメソッドの無い型 %1 のオブジェクトは割り当てできません Cannot connect mismatched signal/slot %1 %vs. %2 @@ -2220,7 +2283,7 @@ to QDialog What's This? - ヒント? + ヒント Done @@ -2267,7 +2330,7 @@ to Open - オープン + 開く &Cancel @@ -2323,7 +2386,7 @@ to &OK - OK(&O) + &OK @@ -2397,7 +2460,7 @@ to &OK - OK(&O) + &OK @@ -2420,7 +2483,7 @@ to Cannot open for output - コピー先のファイルをオープンできません + コピー先のファイルを開けません Failure to write block @@ -2451,7 +2514,7 @@ to &Open - オープン(&O) + 開く(&O) &Save @@ -2459,7 +2522,7 @@ to Open - オープン + 開く %1 already exists. @@ -2477,7 +2540,7 @@ Please verify the correct file name was given. My Computer - マイ コンピュータ + マイコンピュータ %1 @@ -2692,7 +2755,7 @@ Do you want to delete it anyway? My Computer - マイ コンピュータ + マイコンピュータ Computer @@ -2732,7 +2795,7 @@ Do you want to delete it anyway? Italic - イタリック + 斜体 Oblique @@ -3207,7 +3270,7 @@ Do you want to delete it anyway? QIBaseDriver Error opening database - データベースのオープンでエラーが発生しました + データベースのオープン時にエラーが発生しました Could not start transaction @@ -3234,7 +3297,7 @@ Do you want to delete it anyway? Unable to open BLOB - バイナリラージオブジェクトをオープンできません + バイナリラージオブジェクトを開けません Unable to read BLOB @@ -3390,11 +3453,11 @@ Do you want to delete it anyway? Cannot load library %1: %2 - ライブラリ '%1' を読み込むことができません: %2 + ライブラリ '%1' を読み込めません: %2 Cannot unload library %1: %2 - ライブラリ %1 を解放することができません: %2 + ライブラリ %1 を解放できません: %2 Cannot resolve symbol "%1" in %2: %3 @@ -3502,7 +3565,7 @@ Do you want to delete it anyway? QMYSQLDriver Unable to open database ' - データベースをオープンできません ' + データベースを開けません ' Unable to connect @@ -3659,7 +3722,7 @@ Do you want to delete it anyway? Open - オープン + 開く Execute @@ -3833,7 +3896,7 @@ Do you want to delete it anyway? QNetworkAccessCacheBackend Error opening %1 - オープンのエラー %1 + オープン時のエラー %1 @@ -3870,7 +3933,7 @@ Do you want to delete it anyway? Error opening %1: %2 - %1 をオープンする時にエラーが発生しました: %2 + %1 のオープン時にエラーが発生しました: %2 Write error writing to %1: %2 @@ -3878,7 +3941,7 @@ Do you want to delete it anyway? Cannot open %1: Path is a directory - %1 をオープンできません。指定されたパスはディレクトリです + %1 を開けません。指定されたパスはディレクトリです Read error reading from %1: %2 @@ -3893,7 +3956,7 @@ Do you want to delete it anyway? Cannot open %1: is a directory - %1 をオープンできません。指定されたパスはディレクトリです + %1 を開けません。指定されたパスはディレクトリです Logging in to %1 failed: authentication required @@ -4623,7 +4686,7 @@ Please choose a different file name. QPrintPreviewDialog Page Setup - ページの設定 + ページ設定 %1% @@ -4691,7 +4754,7 @@ Please choose a different file name. Page setup - ページの設定 + ページ設定 Close @@ -4847,11 +4910,11 @@ Please choose a different file name. QProcess Could not open input redirection for reading - 標準入力リダイレクトを読み込みのためにオープンすることができません + 標準入力リダイレクトを読み込みのために開けませんでした Could not open output redirection for writing - 標準出力リダイレクトを書き込みのためにオープンすることができません + 標準出力リダイレクトを書き込みのために開けませんでした Resource error (fork failure): %1 @@ -4893,7 +4956,7 @@ Please choose a different file name. QPushButton Open - オープン + 開く @@ -4954,7 +5017,7 @@ Please choose a different file name. QSQLite2Driver Error opening database - データベースのオープンでエラーが発生しました + データベースのオープン時にエラーが発生しました Unable to begin transaction @@ -4984,11 +5047,11 @@ Please choose a different file name. QSQLiteDriver Error opening database - データベースのオープンでエラーが発生しました + データベースのオープン時にエラーが発生しました Error closing database - データベースのクローズでエラーが発生しました + データベースのクローズ時にエラーが発生しました Unable to begin transaction @@ -5495,11 +5558,11 @@ Please choose a different file name. Pause - Pause + 一時停止 Print - Print + 印刷 SysReq @@ -6113,11 +6176,11 @@ Please choose a different file name. Insert - Insert + 挿入 Delete - Delete + 削除 Escape @@ -6129,7 +6192,7 @@ Please choose a different file name. Select - Select + 選択 Yes @@ -6430,7 +6493,7 @@ Please choose a different file name. Select - セレクト + 選択 Done @@ -6554,6 +6617,10 @@ Please choose a different file name. SSL ハンドシェーク時にエラーが発生しました: %1 + The peer certificate is blacklisted + 通信相手の証明書がブラックリストに載っています + + No error エラーはありません @@ -6760,7 +6827,7 @@ Please choose a different file name. Open - オープン + 開く @@ -6906,7 +6973,7 @@ Please choose a different file name. Choose File title for file button used in HTML forms - ファイルを選ぶ + ファイルを選択 No file selected @@ -7061,7 +7128,7 @@ Please choose a different file name. Italic Italic context menu item - イタリック + 斜体 Underline @@ -7141,7 +7208,7 @@ Please choose a different file name. Slider Media controller element - スライダ + スライダー Slider Thumb @@ -7586,7 +7653,7 @@ Please choose a different file name. QWhatsThisAction What's This? - ヒント? + ヒント diff --git a/translations/qtconfig_ja.ts b/translations/qtconfig_ja.ts index cf3ec13..8440389 100644 --- a/translations/qtconfig_ja.ts +++ b/translations/qtconfig_ja.ts @@ -4,6 +4,26 @@ MainWindow + <p><b><font size+=2>Appearance</font></b></p><hr><p>Use this tab to customize the appearance of your Qt applications.</p><p>You can select the default GUI Style from the drop down list and customize the colors.</p><p>Any GUI Style plugins in your plugin path will automatically be added to the list of built-in Qt styles. (See the Library Paths tab for information on adding new plugin paths.)</p><p>When you choose 3-D Effects and Window Background colors, the Qt Configuration program will automatically generate a palette for you. To customize colors further, press the Tune Palette button to open the advanced palette editor.<p>The Preview Window shows what the selected Style and colors look like. + + + + <p><b><font size+=2>Fonts</font></b></p><hr><p>Use this tab to select the default font for your Qt applications. The selected font is shown (initially as 'Sample Text') in the line edit below the Family, Style and Point Size drop down lists.</p><p>Qt has a powerful font substitution feature that allows you to specify a list of substitute fonts. Substitute fonts are used when a font cannot be loaded, or if the specified font doesn't have a particular character.<p>For example, if you select the font Lucida, which doesn't have Korean characters, but need to show some Korean text using the Mincho font family you can do so by adding Mincho to the list. Once Mincho is added, any Korean characters that are not found in the Lucida font will be taken from the Mincho font. Because the font substitutions are lists, you can also select multiple families, such as Song Ti (for use with Chinese text). + + + + <p><b><font size+=2>Interface</font></b></p><hr><p>Use this tab to customize the feel of your Qt applications.</p><p>If the Resolve Symlinks checkbox is checked Qt will follow symlinks when handling URLs. For example, in the file dialog, if this setting is turned on and /usr/tmp is a symlink to /var/tmp, entering the /usr/tmp directory will cause the file dialog to change to /var/tmp. With this setting turned off, symlinks are not resolved or followed.</p><p>The Global Strut setting is useful for people who require a minimum size for all widgets (e.g. when using a touch panel or for users who are visually impaired). Leaving the Global Strut width and height at 0 will disable the Global Strut feature</p><p>XIM (Extended Input Methods) are used for entering characters in languages that have large character sets, for example, Chinese and Japanese. + + + + <p><b><font size+=2>Printer</font></b></p><hr><p>Use this tab to configure the way Qt generates output for the printer.You can specify if Qt should try to embed fonts into its generated output.If you enable font embedding, the resulting postscript will be more portable and will more accurately reflect the visual output on the screen; however the resulting postscript file size will be bigger.<p>When using font embedding you can select additional directories where Qt should search for embeddable font files. By default, the X server font path is used. + + + + <p><b><font size+=2>Phonon</font></b></p><hr><p>Use this tab to configure the Phonon GStreamer multimedia backend. <p>It is reccommended to leave all settings on "Auto" to let Phonon determine your settings automatically. + + + Desktop Settings (Default) デスクトップの設定(デフォルト) @@ -364,7 +384,7 @@ Browse... - ブラウズ... + 参照... Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. -- cgit v0.12 From 53d1557f1ef4969bd5c8d68b82a0151ae03f004a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 6 Jun 2011 12:21:37 +0200 Subject: Have -small-screen enabled in certain examples on Symbian always. --- demos/deform/main.cpp | 4 ++++ demos/pathstroke/main.cpp | 4 ++++ examples/draganddrop/fridgemagnets/main.cpp | 5 +++++ examples/script/context2d/main.cpp | 5 +++++ examples/widgets/wiggly/main.cpp | 4 ++++ 5 files changed, 22 insertions(+) diff --git a/demos/deform/main.cpp b/demos/deform/main.cpp index 70e4bec..21ce7fb 100644 --- a/demos/deform/main.cpp +++ b/demos/deform/main.cpp @@ -50,7 +50,11 @@ int main(int argc, char **argv) QApplication app(argc, argv); +#ifdef Q_OS_SYMBIAN + bool smallScreen = true; +#else bool smallScreen = QApplication::arguments().contains("-small-screen"); +#endif PathDeformWidget deformWidget(0, smallScreen); diff --git a/demos/pathstroke/main.cpp b/demos/pathstroke/main.cpp index 2e9153f..6d688c3 100644 --- a/demos/pathstroke/main.cpp +++ b/demos/pathstroke/main.cpp @@ -48,7 +48,11 @@ int main(int argc, char **argv) QApplication app(argc, argv); +#ifdef Q_OS_SYMBIAN + bool smallScreen = true; +#else bool smallScreen = QApplication::arguments().contains("-small-screen"); +#endif PathStrokeWidget pathStrokeWidget(smallScreen); QStyle *arthurStyle = new ArthurStyle(); diff --git a/examples/draganddrop/fridgemagnets/main.cpp b/examples/draganddrop/fridgemagnets/main.cpp index 1166abb..e87ef5b 100644 --- a/examples/draganddrop/fridgemagnets/main.cpp +++ b/examples/draganddrop/fridgemagnets/main.cpp @@ -51,7 +51,12 @@ int main(int argc, char *argv[]) #endif DragWidget window; +#ifdef Q_OS_SYMBIAN + bool smallScreen = true; +#else bool smallScreen = QApplication::arguments().contains("-small-screen"); +#endif + if (smallScreen) window.showFullScreen(); else diff --git a/examples/script/context2d/main.cpp b/examples/script/context2d/main.cpp index 3d56910..20df178 100644 --- a/examples/script/context2d/main.cpp +++ b/examples/script/context2d/main.cpp @@ -48,7 +48,12 @@ int main(int argc, char **argv) QApplication app(argc, argv); Window win; +#ifdef Q_OS_SYMBIAN + bool smallScreen = true; +#else bool smallScreen = QApplication::arguments().contains("-small-screen"); +#endif + if (!smallScreen) { win.show(); } else { diff --git a/examples/widgets/wiggly/main.cpp b/examples/widgets/wiggly/main.cpp index 91cd1b8..7ba6d36 100644 --- a/examples/widgets/wiggly/main.cpp +++ b/examples/widgets/wiggly/main.cpp @@ -45,7 +45,11 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); +#ifdef Q_OS_SYMBIAN + bool smallScreen = true; +#else bool smallScreen = QApplication::arguments().contains("-small-screen"); +#endif Dialog dialog(0, smallScreen); -- cgit v0.12 From aad99f4fae89796f7013901344260eb50e4126bb Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 6 Jun 2011 13:16:22 +0200 Subject: Build fix for Mac OS 10.5 The build breaks because QString defines a template function that interferes with a system header. The easy fix is to just make sure we include the system headers before any Qt headers. This fix turned out to already be in for Qt5, but that change contained other stuff as well, and were not suited for cherry-picking. Rev-By: msorvig --- src/corelib/tools/qlocale.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 5c4085a..a72ad02 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -48,6 +48,11 @@ static QSystemLocale *QSystemLocale_globalSystemLocale(); QT_END_NAMESPACE #endif +#if !defined(QWS) && defined(Q_OS_MAC) +# include "private/qcore_mac_p.h" +# include +#endif + #include "qplatformdefs.h" #include "qdatastream.h" @@ -65,10 +70,6 @@ QT_END_NAMESPACE # include "qt_windows.h" # include #endif -#if !defined(QWS) && defined(Q_OS_MAC) -# include "private/qcore_mac_p.h" -# include -#endif #include "private/qnumeric_p.h" #include "private/qsystemlibrary_p.h" -- cgit v0.12 From 2a37227261044d1c737a436c4533295cea1433f5 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:01 +0200 Subject: QSessionManager: fix build on QWS Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/kernel/qsessionmanager_qws.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qsessionmanager_qws.cpp b/src/gui/kernel/qsessionmanager_qws.cpp index efe688e..e437635 100644 --- a/src/gui/kernel/qsessionmanager_qws.cpp +++ b/src/gui/kernel/qsessionmanager_qws.cpp @@ -43,6 +43,9 @@ #ifndef QT_NO_SESSIONMANAGER +#include +#include + QT_BEGIN_NAMESPACE class QSessionManagerPrivate : public QObjectPrivate -- cgit v0.12 From 480eeaf650fa05a961d7fd59c1762102cb0edb61 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:02 +0200 Subject: don't delete the lock if it was not created by this surface and don't forget about it otherwise Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/painting/qwindowsurface_qws.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index c52f864..98de8d1 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -806,6 +806,10 @@ QWSMemorySurface::QWSMemorySurface(QWidget *w) QWSMemorySurface::~QWSMemorySurface() { +#ifndef QT_NO_QWS_MULTIPROCESS + if (memlock != QWSDisplay::Data::getClientLock()) + delete memlock; +#endif } @@ -852,9 +856,9 @@ void QWSMemorySurface::setLock(int lockId) { if (memlock && memlock->id() == lockId) return; - delete memlock; + if (memlock != QWSDisplay::Data::getClientLock()) + delete memlock; memlock = (lockId == -1 ? 0 : new QWSLock(lockId)); - return; } #endif // QT_NO_QWS_MULTIPROCESS -- cgit v0.12 From 2410a5b869e3ccee98cd0606ad64690a3c0e1003 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:03 +0200 Subject: fix potential memory leaking the `memsize` member was never set with anything but 0; so, the memory newer was freed neither in destructor, neither in releaseSurface(). for the first one it was non-critical because of the memory was freed indirectly - by hiding widget before closing (which is why the issue wasn't catched-up until now) Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/painting/qwindowsurface_qws.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 98de8d1..9d4f985 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -950,22 +950,23 @@ void QWSLocalMemSurface::setGeometry(const QRect &rect) } uchar *deleteLater = 0; - // In case of a Hide event we need to delete the memory after sending the - // event to the server in order to let the server animate the event. - if (size.isEmpty()) { - deleteLater = mem; - mem = 0; - } if (img.size() != size) { - delete[] mem; if (size.isEmpty()) { + if (memsize) { + // In case of a Hide event we need to delete the memory after sending the + // event to the server in order to let the server animate the event. + deleteLater = mem; + memsize = 0; + } mem = 0; img = QImage(); } else { const QImage::Format format = preferredImageFormat(win); const int bpl = nextMulOf4(bytesPerPixel(format) * size.width()); - const int memsize = bpl * size.height(); + if (memsize) + delete[] mem; + memsize = bpl * size.height(); mem = new uchar[memsize]; img = QImage(mem, size.width(), size.height(), bpl, format); setImageMetrics(img, win); @@ -973,6 +974,7 @@ void QWSLocalMemSurface::setGeometry(const QRect &rect) } QWSWindowSurface::setGeometry(rect); + delete[] deleteLater; } @@ -1001,6 +1003,11 @@ QByteArray QWSLocalMemSurface::permanentState() const void QWSLocalMemSurface::setPermanentState(const QByteArray &data) { + if (memsize) { + delete[] mem; + memsize = 0; + } + int width; int height; QImage::Format format; @@ -1027,6 +1034,10 @@ void QWSLocalMemSurface::setPermanentState(const QByteArray &data) void QWSLocalMemSurface::releaseSurface() { + if (memsize) { + delete[] mem; + memsize = 0; + } mem = 0; img = QImage(); } -- cgit v0.12 From 597e690c92243b47ac2191c8de8b12cd689bf2a6 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:04 +0200 Subject: don't reallocate memory if the old buffer has sufficient capacity Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/painting/qwindowsurface_qws.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 9d4f985..5bd56d3 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -964,10 +964,12 @@ void QWSLocalMemSurface::setGeometry(const QRect &rect) } else { const QImage::Format format = preferredImageFormat(win); const int bpl = nextMulOf4(bytesPerPixel(format) * size.width()); - if (memsize) + const int imagesize = bpl * size.height(); + if (memsize < imagesize) { delete[] mem; - memsize = bpl * size.height(); - mem = new uchar[memsize]; + memsize = imagesize; + mem = new uchar[memsize]; + } img = QImage(mem, size.width(), size.height(), bpl, format); setImageMetrics(img, win); } @@ -1132,8 +1134,6 @@ void QWSSharedMemSurface::setGeometry(const QRect &rect) mem.detach(); img = QImage(); } else { - mem.detach(); - QWidget *win = window(); const QImage::Format format = preferredImageFormat(win); const int bpl = nextMulOf4(bytesPerPixel(format) * size.width()); @@ -1142,9 +1142,12 @@ void QWSSharedMemSurface::setGeometry(const QRect &rect) #else const int imagesize = bpl * size.height(); #endif - if (!mem.create(imagesize)) { - perror("QWSSharedMemSurface::setGeometry allocating shared memory"); - qFatal("Error creating shared memory of size %d", imagesize); + if (mem.size() < imagesize) { + mem.detach(); + if (!mem.create(imagesize)) { + perror("QWSSharedMemSurface::setGeometry allocating shared memory"); + qFatal("Error creating shared memory of size %d", imagesize); + } } #ifdef QT_QWS_CLIENTBLIT *((uint *)mem.address()) = 0; -- cgit v0.12 From 336167a1ab637bfa8b2a14eac80dc36ceda1a7e8 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:06 +0200 Subject: nano optimization allocate uninitialized QByteArray as it will be initialized few lines later Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/painting/qwindowsurface_qws.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 5bd56d3..88d7d27 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -982,9 +982,7 @@ void QWSLocalMemSurface::setGeometry(const QRect &rect) QByteArray QWSLocalMemSurface::permanentState() const { - QByteArray array; - array.resize(sizeof(uchar*) + 3 * sizeof(int) + - sizeof(SurfaceFlags)); + QByteArray array(sizeof(uchar*) + 3 * sizeof(int) + sizeof(SurfaceFlags), Qt::Uninitialized); char *ptr = array.data(); @@ -1165,8 +1163,7 @@ void QWSSharedMemSurface::setGeometry(const QRect &rect) QByteArray QWSSharedMemSurface::permanentState() const { - QByteArray array; - array.resize(6 * sizeof(int)); + QByteArray array(6 * sizeof(int), Qt::Uninitialized); int *ptr = reinterpret_cast(array.data()); @@ -1240,8 +1237,8 @@ bool QWSOnScreenSurface::isValid() const QByteArray QWSOnScreenSurface::permanentState() const { - QByteArray array; - array.resize(sizeof(int)); + QByteArray array(sizeof(int), Qt::Uninitialized); + int *ptr = reinterpret_cast(array.data()); ptr[0] = QApplication::desktop()->screenNumber(window()); return array; @@ -1281,8 +1278,7 @@ QWSYellowSurface::~QWSYellowSurface() QByteArray QWSYellowSurface::permanentState() const { - QByteArray array; - array.resize(2 * sizeof(int)); + QByteArray array(2 * sizeof(int), Qt::Uninitialized); int *ptr = reinterpret_cast(array.data()); ptr[0] = surfaceSize.width(); -- cgit v0.12 From 38c3c3d155daee30185d8d7af863827810e8ed90 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:07 +0200 Subject: remove an unused headers these headers weren't used anymore since QLock, QWSLock and QWSSharedMemory classes had been introduced Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/kernel/qapplication_qws.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 14f7790..0bd4ac3 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -112,19 +112,6 @@ #include -#ifndef QT_NO_QWS_MULTIPROCESS -#ifdef QT_NO_QSHM -#include -#include -#ifndef Q_OS_DARWIN -# include -#endif -#include -#else -#include "private/qwssharedmemory_p.h" -#endif -#endif - QT_BEGIN_NAMESPACE #ifndef QT_NO_DIRECTPAINTER -- cgit v0.12 From f9053a429993a5081d7a3e67934f58345ee3e25b Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:08 +0200 Subject: avoid the QT_NO_ASCII warning Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/kernel/qapplication_qws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 0bd4ac3..e11571c 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -217,7 +217,7 @@ QString qws_dataDir() qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData()); #endif - result.append("/"); + result.append(QLatin1Char('/')); return result; } -- cgit v0.12 From afafb37b7ef6130ab0545c9d12c7995e85dfb9b0 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:09 +0200 Subject: minor code simplification `ascii` wasn't used Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/embedded/qwindowsystem_qws.cpp | 26 ++++++++++++-------------- src/gui/kernel/qapplication_qws.cpp | 9 ++------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index 0e4e27c..36802a8 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -2494,7 +2494,7 @@ QWSWindow *QWSServer::windowAt(const QPoint& pos) } #ifndef QT_NO_QWS_KEYBOARD -static int keyUnicode(int keycode) +static inline int keyUnicode(int keycode) { int code = 0xffff; @@ -2550,18 +2550,16 @@ void QWSServer::sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers mod void QWSServerPrivate::sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat) { + QWSWindow *win = keyboardGrabber ? keyboardGrabber : qwsServerPrivate->focusw; - QWSKeyEvent event; - QWSWindow *win = keyboardGrabber ? keyboardGrabber : - qwsServerPrivate->focusw; - - event.simpleData.window = win ? win->winId() : 0; - - event.simpleData.unicode = #ifndef QT_NO_QWS_KEYBOARD - unicode < 0 ? keyUnicode(keycode) : + if (unicode < 0) + unicode = keyUnicode(keycode); #endif - unicode; + + QWSKeyEvent event; + event.simpleData.window = win ? win->winId() : 0; + event.simpleData.unicode = unicode; event.simpleData.keycode = keycode; event.simpleData.modifiers = modifiers; event.simpleData.is_press = isPress; @@ -4127,11 +4125,11 @@ void QWSServer::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers #endif // If we press a key and it's going to be blocked, wake up the screen - if ( block && isPress ) - qwsServerPrivate->_q_screenSaverWake(); - - if ( block ) + if (block) { + if (isPress) + qwsServerPrivate->_q_screenSaverWake(); return; + } if (keyFilters) { for (int i = 0; i < keyFilters->size(); ++i) { diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index e11571c..1197c77 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -3552,13 +3552,8 @@ bool QETWidget::translateKeyEvent(const QWSKeyEvent *event, bool grab) /* grab i QEvent::KeyPress : QEvent::KeyRelease; bool autor = event->simpleData.is_auto_repeat; QString text; - char ascii = 0; - if (event->simpleData.unicode) { - QChar ch(event->simpleData.unicode); - if (ch.unicode() != 0xffff) - text += ch; - ascii = ch.toLatin1(); - } + if (event->simpleData.unicode && event->simpleData.unicode != 0xffff) + text += QChar(event->simpleData.unicode); code = event->simpleData.keycode; #if defined QT3_SUPPORT && !defined(QT_NO_SHORTCUT) -- cgit v0.12 From eb1932b45e91108c67de7164d07415c1df87e33b Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:10 +0200 Subject: minor code simplification there is no need in non-const object as we don't change it anyways Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/painting/qwindowsurface_qws.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 88d7d27..7e8cf9b 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -1079,17 +1079,15 @@ bool QWSSharedMemSurface::setMemory(int memId) void QWSSharedMemSurface::setDirectRegion(const QRegion &r, int id) { QWSMemorySurface::setDirectRegion(r, id); - if(mem.address()) + if (mem.address()) *(uint *)mem.address() = id; } const QRegion QWSSharedMemSurface::directRegion() const { - QWSSharedMemory *cmem = const_cast(&mem); - if (cmem->address() && ((int*)cmem->address())[0] == directRegionId()) + if (mem.address() && *(uint *)mem.address() == uint(directRegionId()) return QWSMemorySurface::directRegion(); - else - return QRegion(); + return QRegion(); } #endif -- cgit v0.12 From 37d46d6a3295e24308f2b81317f13e75cb68caf5 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:11 +0200 Subject: minor typo fix Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/embedded/qkbd_qws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index 77ae47b..5edc4d9 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -225,7 +225,7 @@ bool QWSKbPrivate::loadKeymap(const QString &file) ds >> qmap_magic >> qmap_version >> qmap_keymap_size >> qmap_keycompose_size; if (ds.status() != QDataStream::Ok || qmap_magic != QWSKeyboard::FileMagic || qmap_version != 1 || qmap_keymap_size == 0) { - qWarning("'%s' is ot a valid.qmap keymap file.", qPrintable(file)); + qWarning("'%s' is not a valid .qmap keymap file.", qPrintable(file)); return false; } -- cgit v0.12 From 601b6d5ccbd3980eebb4e6f41ac721f01ee5ef04 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 13:52:12 +0200 Subject: allow the user to averride QT_QWS_TEMP_DIR in qplatformdefs.h Merge-request: 2627 Reviewed-by: Harald Fernengel --- src/gui/embedded/qkbdum_qws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/embedded/qkbdum_qws.cpp b/src/gui/embedded/qkbdum_qws.cpp index 4fbe03e..97561b5 100644 --- a/src/gui/embedded/qkbdum_qws.cpp +++ b/src/gui/embedded/qkbdum_qws.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qkbdum_qws.h" -#include "qvfbhdr.h" #if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_UM) @@ -55,6 +54,7 @@ #include #include #include "qplatformdefs.h" +#include "qvfbhdr.h" QT_BEGIN_NAMESPACE -- cgit v0.12 From 40191387a77552b2ba6df547b87de040e126220a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 6 Jun 2011 13:53:36 +0200 Subject: Close context menus during orientation change. Make non-native QMenus, i.e. context menus, work like in Avkon. Reviewed-by: Miikka Heikkinen Reviewed-by: Sami Merila Task-number: QTBUG-19656 --- src/gui/kernel/qapplication_s60.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6d1b96f..d3b0e99 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2243,6 +2243,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent #if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) case EEventDisplayChanged: #endif + { if (callSymbianEventFilters(symbianEvent)) return 1; if (S60) @@ -2254,6 +2255,12 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent QResizeEvent e(qt_desktopWidget->size(), oldSize); QApplication::sendEvent(qt_desktopWidget, &e); } + // Close non-native QMenus (that should act like context menus, i.e. close + // automatically when the orientation changes). + QMenu *activeMenu = qobject_cast(QApplication::activePopupWidget()); + if (activeMenu) + activeMenu->close(); + } return 0; // Propagate to CONE case EEventWindowVisibilityChanged: if (controlInMap) { -- cgit v0.12 From 46c8a0e19715f40a5b5facbaaaa2fa52cf1d354e Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 6 Jun 2011 15:37:26 +0300 Subject: Horizontal lines appearing under entered characters Here, input context uses text formatting from S60 side, unless native side is indicating that it won't make any changes to the text (i.e. no special formatting). In that case, the input context fetches pre-edit text format from Qt side (dashed underline). Unfortunately, it is only applied to a single character at most and therefore, really easily gets mixed up with "underlined text", which in most cases is the S60 uncommitted predictive text. Task-number: QT-5046 Reviewed-by: Miikka Heikkinen --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index daa448b..10e7e44 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -826,13 +826,6 @@ void QCoeFepInputContext::applyFormat(QList *attri } } - if (attributes->size() == oldSize) { - // S60 didn't provide any format, so let's give our own instead. - attributes->append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, - 0, - m_preeditString.size(), - standardFormat(PreeditFormat))); - } } void QCoeFepInputContext::queueInputCapabilitiesChanged() -- cgit v0.12 From 5786c9c3d320fbd5854b883155ade2e834d0e32b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 1 Jun 2011 17:13:51 +1000 Subject: Fixed compile of tst_qscriptextensionplugin on some Windows configurations The debug and release versions of staticplugin are qmake'd with the same destination directory. This causes the generated staticplugin .prl file to always refer to the debug versions of Qt libraries, even if Qt was configured with -release. The .prl mechanism is not useful for this test, so simply disable it to solve the problem. Reviewed-by: ckamm (cherry picked from commit b761f2e1b323012661a9aeed3873b1e5facb0f11) --- tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro index a003338..65c4e8f 100644 --- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro +++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += static plugin +CONFIG -= create_prl # not needed, and complicates debug/release SOURCES = staticplugin.cpp RESOURCES = staticplugin.qrc QT = core script -- cgit v0.12 From 9d0c57b225d3a9a771edf4f4b4c557430560761d Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 14:51:41 +0200 Subject: refactoring of the QWSSharedMemory class drop old/unused API and obsolete code; improve attach() for comon case; cache the shm size at the first call; fix the includes; better debug strings; minor code clean-ups Merge-request: 1247 Reviewed-by: Harald Fernengel --- src/gui/embedded/qwssharedmemory.cpp | 120 ++++++++++++----------------------- src/gui/embedded/qwssharedmemory_p.h | 34 +++------- 2 files changed, 47 insertions(+), 107 deletions(-) diff --git a/src/gui/embedded/qwssharedmemory.cpp b/src/gui/embedded/qwssharedmemory.cpp index 66bedee..a677626 100644 --- a/src/gui/embedded/qwssharedmemory.cpp +++ b/src/gui/embedded/qwssharedmemory.cpp @@ -43,51 +43,51 @@ #if !defined(QT_NO_QWS_MULTIPROCESS) +#include +#include #include +//#define QT_SHM_DEBUG + QT_BEGIN_NAMESPACE QWSSharedMemory::QWSSharedMemory() - : shmBase(0), shmSize(0), character(0), shmId(-1), key(-1) + : shmId(-1), shmBase(0), shmSize(0) { } - QWSSharedMemory::~QWSSharedMemory() { detach(); } -/* - man page says: - On Linux, it is possible to attach a shared memory segment even if it - is already marked to be deleted. However, POSIX.1-2001 does not spec- - ify this behaviour and many other implementations do not support it. -*/ - bool QWSSharedMemory::create(int size) { if (shmId != -1) detach(); - shmId = shmget(IPC_PRIVATE, size, IPC_CREAT|0600); + shmId = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); if (shmId == -1) { #ifdef QT_SHM_DEBUG - perror("QWSSharedMemory::create allocating shared memory"); + perror("QWSSharedMemory::create():"); qWarning("Error allocating shared memory of size %d", size); #endif return false; } - shmBase = shmat(shmId,0,0); + shmBase = shmat(shmId, 0, 0); + // On Linux, it is possible to attach a shared memory segment even if it + // is already marked to be deleted. However, POSIX.1-2001 does not specify + // this behaviour and many other implementations do not support it. shmctl(shmId, IPC_RMID, 0); - if (shmBase == (void*)-1) { + if (shmBase == (void*)-1 || !shmBase) { #ifdef QT_SHM_DEBUG - perror("QWSSharedMemory::create attaching to shared memory"); + perror("QWSSharedMemory::create():"); qWarning("Error attaching to shared memory id %d", shmId); #endif - shmBase = 0; + detach(); return false; } + return true; } @@ -95,91 +95,49 @@ bool QWSSharedMemory::attach(int id) { if (shmId == id) return id != -1; - if (shmId != -1) - detach(); - shmBase = shmat(id,0,0); - if (shmBase == (void*)-1) { + detach(); + + if (id == -1) + return false; + + shmId = id; + shmBase = shmat(shmId, 0, 0); + if (shmBase == (void*)-1 || !shmBase) { #ifdef QT_SHM_DEBUG - perror("QWSSharedMemory::attach attaching to shared memory"); - qWarning("Error attaching to shared memory 0x%x of size %d", - id, size()); + perror("QWSSharedMemory::attach():"); + qWarning("Error attaching to shared memory id %d", shmId); #endif - shmBase = 0; + detach(); return false; } - shmId = id; + return true; } - -void QWSSharedMemory::detach () +void QWSSharedMemory::detach() { - if (!shmBase) - return; - shmdt (shmBase); + if (shmBase && shmBase != (void*)-1) + shmdt(shmBase); shmBase = 0; shmSize = 0; shmId = -1; } -void QWSSharedMemory::setPermissions (mode_t mode) +int QWSSharedMemory::size() const { - struct shmid_ds shm; - shmctl (shmId, IPC_STAT, &shm); - shm.shm_perm.mode = mode; - shmctl (shmId, IPC_SET, &shm); -} - -int QWSSharedMemory::size () const -{ - struct shmid_ds shm; - shmctl (shmId, IPC_STAT, &shm); - return shm.shm_segsz; -} + if (shmId == -1) + return 0; + if (!shmSize) { + struct shmid_ds shm; + shmctl(shmId, IPC_STAT, &shm); + const_cast(this)->shmSize = shm.shm_segsz; + } -// old API - - - -QWSSharedMemory::QWSSharedMemory (int size, const QString &filename, char c) -{ - shmSize = size; - shmFile = filename; - shmBase = 0; - shmId = -1; - character = c; - key = ftok (shmFile.toLatin1().constData(), c); -} - - - -bool QWSSharedMemory::create () -{ - shmId = shmget (key, shmSize, IPC_CREAT | 0666); - return (shmId != -1); -} - -void QWSSharedMemory::destroy () -{ - if (shmId != -1) - shmctl(shmId, IPC_RMID, 0); -} - -bool QWSSharedMemory::attach () -{ - if (shmId == -1) - shmId = shmget (key, shmSize, 0); - - shmBase = shmat (shmId, 0, 0); - if ((long)shmBase == -1) - shmBase = 0; - - return (long)shmBase != 0; + return shmSize; } - QT_END_NAMESPACE #endif // QT_NO_QWS_MULTIPROCESS diff --git a/src/gui/embedded/qwssharedmemory_p.h b/src/gui/embedded/qwssharedmemory_p.h index 31e69c4..f3ce241 100644 --- a/src/gui/embedded/qwssharedmemory_p.h +++ b/src/gui/embedded/qwssharedmemory_p.h @@ -53,49 +53,31 @@ // We mean it. // -#include "qplatformdefs.h" -#include "QtCore/qstring.h" +#include QT_BEGIN_NAMESPACE #if !defined(QT_NO_QWS_MULTIPROCESS) -class QWSSharedMemory { +class QWSSharedMemory +{ public: - QWSSharedMemory(); ~QWSSharedMemory(); - void setPermissions(mode_t mode); - int size() const; - void *address() { return shmBase; } - - int id() const { return shmId; } - - void detach(); - bool create(int size); bool attach(int id); + void detach(); - //bool create(int size, const QString &filename, char c = 'Q'); - //bool attach(const QString &filename, char c = 'Q'); -// old API - - QWSSharedMemory(int, const QString &, char c = 'Q'); - void * base() { return address(); } - - bool create(); - void destroy(); + int id() const { return shmId; } - bool attach(); + void *address() const { return shmBase; } + int size() const; private: + int shmId; void *shmBase; int shmSize; - QString shmFile; - char character; - int shmId; - key_t key; }; #endif // QT_NO_QWS_MULTIPROCESS -- cgit v0.12 From 1c2a9b1294dd7dd0762f4f57c29284d8491125ff Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 14:56:43 +0200 Subject: fix potential keyfile leaking according to close(2) manpages, it could return with EINTR; use EINTR-safe version of close() from qcore_unix_p.h Merge-request: 1248 Reviewed-by: Harald Fernengel --- src/corelib/kernel/qsharedmemory_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 2bbda49..286a1b8 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -162,7 +162,7 @@ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName) return 0; return -1; } else { - close(fd); + qt_safe_close(fd); } return 1; } -- cgit v0.12 From 11bacd30967435a54eb74e9e2e36a97b12629a8c Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 14:56:44 +0200 Subject: minor improvements for QSharedMemory remove unused includes; generate error string if error occurred only; make some error strings equal on different platforms; avoid code duplication; minor code simlifications and clean-ups Merge-request: 1248 Reviewed-by: Harald Fernengel --- src/corelib/kernel/qsharedmemory.cpp | 22 +++++-------- src/corelib/kernel/qsharedmemory_p.h | 4 +-- src/corelib/kernel/qsharedmemory_symbian.cpp | 47 +++++++++++++------------- src/corelib/kernel/qsharedmemory_unix.cpp | 39 +++++++++++----------- src/corelib/kernel/qsharedmemory_win.cpp | 49 +++++++++++++++------------- 5 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index acb6044..9ab9fa4 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -247,7 +247,7 @@ void QSharedMemory::setNativeKey(const QString &key) if (isAttached()) detach(); d->cleanHandle(); - d->key = QString(); + d->key.clear(); d->nativeKey = key; } @@ -285,7 +285,7 @@ bool QSharedMemoryPrivate::initKey() return false; } #endif - errorString = QString(); + errorString.clear(); error = QSharedMemory::NoError; return true; } @@ -342,28 +342,24 @@ bool QSharedMemory::create(int size, AccessMode mode) if (!d->initKey()) return false; + if (size <= 0) { + d->error = QSharedMemory::InvalidSize; + d->errorString = QSharedMemory::tr("%1: create size is less then 0").arg(QLatin1String("QSharedMemory::create")); + return false; + } + #ifndef QT_NO_SYSTEMSEMAPHORE #ifndef Q_OS_WIN // Take ownership and force set initialValue because the semaphore // might have already existed from a previous crash. d->systemSemaphore.setKey(d->key, 1, QSystemSemaphore::Create); #endif -#endif - QString function = QLatin1String("QSharedMemory::create"); -#ifndef QT_NO_SYSTEMSEMAPHORE QSharedMemoryLocker lock(this); - if (!d->key.isNull() && !d->tryLocker(&lock, function)) + if (!d->key.isNull() && !d->tryLocker(&lock, QLatin1String("QSharedMemory::create"))) return false; #endif - if (size <= 0) { - d->error = QSharedMemory::InvalidSize; - d->errorString = - QSharedMemory::tr("%1: create size is less then 0").arg(function); - return false; - } - if (!d->create(size)) return false; diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index d5fafef..182876b 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -74,8 +74,6 @@ namespace QSharedMemoryPrivate #elif defined(Q_OS_SYMBIAN) #include #include -#else -#include #endif QT_BEGIN_NAMESPACE @@ -151,7 +149,7 @@ public: #endif #ifndef QT_NO_SYSTEMSEMAPHORE - bool tryLocker(QSharedMemoryLocker *locker, const QString function) { + inline bool tryLocker(QSharedMemoryLocker *locker, const QString &function) { if (!locker->lock()) { errorString = QSharedMemory::tr("%1: unable to lock").arg(function); error = QSharedMemory::LockError; diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp index fdd513a..3430aaa 100644 --- a/src/corelib/kernel/qsharedmemory_symbian.cpp +++ b/src/corelib/kernel/qsharedmemory_symbian.cpp @@ -41,19 +41,21 @@ #include "qsharedmemory.h" #include "qsharedmemory_p.h" -#include "qsystemsemaphore.h" + #include "qcore_symbian_p.h" #include -QT_BEGIN_NAMESPACE - #ifndef QT_NO_SHAREDMEMORY #define QSHAREDMEMORY_DEBUG -QSharedMemoryPrivate::QSharedMemoryPrivate() : QObjectPrivate(), - memory(0), size(0), error(QSharedMemory::NoError), - systemSemaphore(QString()), lockedByMe(false) +QT_BEGIN_NAMESPACE + +QSharedMemoryPrivate::QSharedMemoryPrivate() + : QObjectPrivate(), memory(0), size(0), error(QSharedMemory::NoError), +#ifndef QT_NO_SYSTEMSEMAPHORE + systemSemaphore(QString()), lockedByMe(false) +#endif { } @@ -61,6 +63,7 @@ void QSharedMemoryPrivate::setErrorString(const QString &function, TInt errorCod { if (errorCode == KErrNone) return; + switch (errorCode) { case KErrAlreadyExists: error = QSharedMemory::AlreadyExists; @@ -88,11 +91,19 @@ void QSharedMemoryPrivate::setErrorString(const QString &function, TInt errorCod #if defined QSHAREDMEMORY_DEBUG qDebug() << errorString << "key" << key; #endif + break; } } key_t QSharedMemoryPrivate::handle() { + // don't allow making handles on empty keys + if (nativeKey.isEmpty()) { + error = QSharedMemory::KeyError; + errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::handle")); + return 0; + } + // Not really cost effective to check here if shared memory is attachable, as it requires // exactly the same call as attaching, so always assume handle is valid and return failure // from attach. @@ -107,21 +118,17 @@ bool QSharedMemoryPrivate::cleanHandle() bool QSharedMemoryPrivate::create(int size) { - QString function = QLatin1String("QSharedMemory::create"); - if (nativeKey.isEmpty()) { - error = QSharedMemory::KeyError; - errorString = QSharedMemory::tr("%1: key error").arg(function); + if (!handle()) return false; - } TPtrC ptr(qt_QString2TPtrC(nativeKey)); TInt err = chunk.CreateGlobal(ptr, size, size); - setErrorString(function, err); - - if (err != KErrNone) + if (err != KErrNone) { + setErrorString(QLatin1String("QSharedMemory::create"), err); return false; + } // Zero out the created chunk Mem::FillZ(chunk.Base(), chunk.Size()); @@ -133,12 +140,8 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode /* mode */) { // Grab a pointer to the memory block if (!chunk.Handle()) { - QString function = QLatin1String("QSharedMemory::handle"); - if (nativeKey.isEmpty()) { - error = QSharedMemory::KeyError; - errorString = QSharedMemory::tr("%1: unable to make key").arg(function); + if (!handle()) return false; - } TPtrC ptr(qt_QString2TPtrC(nativeKey)); @@ -147,7 +150,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode /* mode */) err = chunk.OpenGlobal(ptr, false); if (err != KErrNone) { - setErrorString(function, err); + setErrorString(QLatin1String("QSharedMemory::attach"), err); return false; } } @@ -168,6 +171,6 @@ bool QSharedMemoryPrivate::detach() return true; } -#endif //QT_NO_SHAREDMEMORY - QT_END_NAMESPACE + +#endif //QT_NO_SHAREDMEMORY diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 286a1b8..ae199c4 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -43,25 +43,26 @@ #include "qsharedmemory.h" #include "qsharedmemory_p.h" -#include "qsystemsemaphore.h" -#include -#include -#include +#include +#include #ifndef QT_NO_SHAREDMEMORY #include #include #include -#include #include #include #include -#endif //QT_NO_SHAREDMEMORY +#endif // QT_NO_SHAREDMEMORY +#include #include "private/qcore_unix_p.h" #ifndef QT_NO_SHAREDMEMORY + +//#define QSHAREDMEMORY_DEBUG + QT_BEGIN_NAMESPACE QSharedMemoryPrivate::QSharedMemoryPrivate() @@ -78,6 +79,7 @@ void QSharedMemoryPrivate::setErrorString(const QString &function) // EINVAL is handled in functions so they can give better error strings switch (errno) { case EACCES: + case EPERM: errorString = QSharedMemory::tr("%1: permission denied").arg(function); error = QSharedMemory::PermissionDenied; break; @@ -98,9 +100,10 @@ void QSharedMemoryPrivate::setErrorString(const QString &function) default: errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errno); error = QSharedMemory::UnknownError; -#if defined QSHAREDMEMORY_DEBUG +#ifdef QSHAREDMEMORY_DEBUG qDebug() << errorString << "key" << key << "errno" << errno << EINVAL; #endif + break; } } @@ -117,21 +120,21 @@ key_t QSharedMemoryPrivate::handle() // don't allow making handles on empty keys if (nativeKey.isEmpty()) { - errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::handle:")); + errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::handle")); error = QSharedMemory::KeyError; return 0; } // ftok requires that an actual file exists somewhere if (!QFile::exists(nativeKey)) { - errorString = QSharedMemory::tr("%1: UNIX key file doesn't exist").arg(QLatin1String("QSharedMemory::handle:")); + errorString = QSharedMemory::tr("%1: UNIX key file doesn't exist").arg(QLatin1String("QSharedMemory::handle")); error = QSharedMemory::NotFound; return 0; } unix_key = ftok(QFile::encodeName(nativeKey).constData(), 'Q'); if (-1 == unix_key) { - errorString = QSharedMemory::tr("%1: ftok failed").arg(QLatin1String("QSharedMemory::handle:")); + errorString = QSharedMemory::tr("%1: ftok failed").arg(QLatin1String("QSharedMemory::handle")); error = QSharedMemory::KeyError; unix_key = 0; } @@ -149,14 +152,14 @@ key_t QSharedMemoryPrivate::handle() -1 error 0 already existed 1 created - */ +*/ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName) { if (QFile::exists(fileName)) return 0; int fd = qt_safe_open(QFile::encodeName(fileName).constData(), - O_EXCL | O_CREAT | O_RDWR, 0640); + O_EXCL | O_CREAT | O_RDWR, 0640); if (-1 == fd) { if (errno == EEXIST) return 0; @@ -179,16 +182,13 @@ bool QSharedMemoryPrivate::cleanHandle() bool QSharedMemoryPrivate::create(int size) { // build file if needed - bool createdFile = false; int built = createUnixKeyFile(nativeKey); if (built == -1) { - errorString = QSharedMemory::tr("%1: unable to make key").arg(QLatin1String("QSharedMemory::handle:")); + errorString = QSharedMemory::tr("%1: unable to make key").arg(QLatin1String("QSharedMemory::create")); error = QSharedMemory::KeyError; return false; } - if (built == 1) { - createdFile = true; - } + bool createdFile = built == 1; // get handle if (!handle()) { @@ -202,7 +202,7 @@ bool QSharedMemoryPrivate::create(int size) QString function = QLatin1String("QSharedMemory::create"); switch (errno) { case EINVAL: - errorString = QSharedMemory::tr("%1: system-imposed size restrictions").arg(QLatin1String("QSharedMemory::handle")); + errorString = QSharedMemory::tr("%1: system-imposed size restrictions").arg(function); error = QSharedMemory::InvalidSize; break; default: @@ -280,7 +280,7 @@ bool QSharedMemoryPrivate::detach() if (shmid_ds.shm_nattch == 0) { // mark for removal if (-1 == shmctl(id, IPC_RMID, &shmid_ds)) { - setErrorString(QLatin1String("QSharedMemory::remove")); + setErrorString(QLatin1String("QSharedMemory::detach")); switch (errno) { case EINVAL: return true; @@ -296,7 +296,6 @@ bool QSharedMemoryPrivate::detach() return true; } - QT_END_NAMESPACE #endif // QT_NO_SHAREDMEMORY diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index 3cc14fe..d4da30d 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -41,24 +41,30 @@ #include "qsharedmemory.h" #include "qsharedmemory_p.h" -#include "qsystemsemaphore.h" -#include -QT_BEGIN_NAMESPACE +#include #ifndef QT_NO_SHAREDMEMORY -QSharedMemoryPrivate::QSharedMemoryPrivate() : QObjectPrivate(), - memory(0), size(0), error(QSharedMemory::NoError), - systemSemaphore(QString()), lockedByMe(false), hand(0) +//#define QSHAREDMEMORY_DEBUG + +QT_BEGIN_NAMESPACE + +QSharedMemoryPrivate::QSharedMemoryPrivate() + : QObjectPrivate(), memory(0), size(0), error(QSharedMemory::NoError), +#ifndef QT_NO_SYSTEMSEMAPHORE + systemSemaphore(QString()), lockedByMe(false), +#endif + hand(0) { } void QSharedMemoryPrivate::setErrorString(const QString &function) { - BOOL windowsError = GetLastError(); + DWORD windowsError = GetLastError(); if (windowsError == 0) return; + switch (windowsError) { case ERROR_ALREADY_EXISTS: error = QSharedMemory::AlreadyExists; @@ -89,19 +95,20 @@ void QSharedMemoryPrivate::setErrorString(const QString &function) default: errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(windowsError); error = QSharedMemory::UnknownError; -#if defined QSHAREDMEMORY_DEBUG +#ifdef QSHAREDMEMORY_DEBUG qDebug() << errorString << "key" << key; #endif + break; } } HANDLE QSharedMemoryPrivate::handle() { if (!hand) { - QString function = QLatin1String("QSharedMemory::handle"); + // don't allow making handles on empty keys if (nativeKey.isEmpty()) { error = QSharedMemory::KeyError; - errorString = QSharedMemory::tr("%1: unable to make key").arg(function); + errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::handle")); return false; } #ifndef Q_OS_WINCE @@ -111,11 +118,10 @@ HANDLE QSharedMemoryPrivate::handle() // attach as it seems. hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)nativeKey.utf16()); #endif - if (!hand) { - setErrorString(function); - return false; - } + if (!hand) + setErrorString(QLatin1String("QSharedMemory::handle")); } + return hand; } @@ -132,20 +138,20 @@ bool QSharedMemoryPrivate::cleanHandle() bool QSharedMemoryPrivate::create(int size) { - QString function = QLatin1String("QSharedMemory::create"); if (nativeKey.isEmpty()) { error = QSharedMemory::KeyError; - errorString = QSharedMemory::tr("%1: key error").arg(function); + errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::create")); return false; } // Create the file mapping. hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size, (wchar_t*)nativeKey.utf16()); - setErrorString(function); // hand is valid when it already exists unlike unix so explicitly check - if (error == QSharedMemory::AlreadyExists || !hand) + if (error == QSharedMemory::AlreadyExists || !hand) { + setErrorString(QLatin1String("QSharedMemory::create")); return false; + } return true; } @@ -167,7 +173,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) // Windows doesn't set an error code on this one, // it should only be a kernel memory error. error = QSharedMemory::UnknownError; - errorString = QSharedMemory::tr("%1: size query failed").arg(QLatin1String("QSharedMemory::attach: ")); + errorString = QSharedMemory::tr("%1: size query failed").arg(QLatin1String("QSharedMemory::attach")); return false; } size = info.RegionSize; @@ -189,7 +195,6 @@ bool QSharedMemoryPrivate::detach() return cleanHandle(); } -#endif //QT_NO_SHAREDMEMORY - - QT_END_NAMESPACE + +#endif // QT_NO_SHAREDMEMORY -- cgit v0.12 From 8eaf39f705295f3072e9243f55063e92af40489c Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 14:56:45 +0200 Subject: simplify QSharedMemoryPrivate::cleanHandle() by making it return nothing as it's result should be ignored anyways (initKey() and detach() could return false because of it - which is wrong) Merge-request: 1248 Reviewed-by: Harald Fernengel --- src/corelib/kernel/qsharedmemory.cpp | 4 ++-- src/corelib/kernel/qsharedmemory_p.h | 2 +- src/corelib/kernel/qsharedmemory_symbian.cpp | 3 +-- src/corelib/kernel/qsharedmemory_unix.cpp | 3 +-- src/corelib/kernel/qsharedmemory_win.cpp | 12 +++++------- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 9ab9fa4..2882279 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -253,8 +253,8 @@ void QSharedMemory::setNativeKey(const QString &key) bool QSharedMemoryPrivate::initKey() { - if (!cleanHandle()) - return false; + cleanHandle(); + #ifndef QT_NO_SYSTEMSEMAPHORE systemSemaphore.setKey(QString(), 1); systemSemaphore.setKey(key, 1); diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index 182876b..8099e6b 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -137,7 +137,7 @@ public: key_t handle(); #endif bool initKey(); - bool cleanHandle(); + void cleanHandle(); bool create(int size); bool attach(QSharedMemory::AccessMode mode); bool detach(); diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp index 3430aaa..cd1567a 100644 --- a/src/corelib/kernel/qsharedmemory_symbian.cpp +++ b/src/corelib/kernel/qsharedmemory_symbian.cpp @@ -110,10 +110,9 @@ key_t QSharedMemoryPrivate::handle() return 1; } -bool QSharedMemoryPrivate::cleanHandle() +void QSharedMemoryPrivate::cleanHandle() { chunk.Close(); - return true; } bool QSharedMemoryPrivate::create(int size) diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index ae199c4..e991ce9 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -173,10 +173,9 @@ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName) #ifndef QT_NO_SHAREDMEMORY -bool QSharedMemoryPrivate::cleanHandle() +void QSharedMemoryPrivate::cleanHandle() { unix_key = 0; - return true; } bool QSharedMemoryPrivate::create(int size) diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index d4da30d..3b8876f 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -125,15 +125,11 @@ HANDLE QSharedMemoryPrivate::handle() return hand; } -bool QSharedMemoryPrivate::cleanHandle() +void QSharedMemoryPrivate::cleanHandle() { - if (hand != 0 && !CloseHandle(hand)) { - hand = 0; + if (hand != 0 && !CloseHandle(hand)) setErrorString(QLatin1String("QSharedMemory::cleanHandle")); - return false; - } hand = 0; - return true; } bool QSharedMemoryPrivate::create(int size) @@ -192,7 +188,9 @@ bool QSharedMemoryPrivate::detach() size = 0; // close handle - return cleanHandle(); + cleanHandle(); + + return true; } QT_END_NAMESPACE -- cgit v0.12 From 7b60b6621e8a3fce144b8fe5edb07bcf9cc331d7 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jun 2011 14:56:46 +0200 Subject: code clean-up for QSystemSemaphore Merge-request: 1248 Reviewed-by: Harald Fernengel --- src/corelib/kernel/qsystemsemaphore_p.h | 8 ++-- src/corelib/kernel/qsystemsemaphore_symbian.cpp | 49 ++++++++++++----------- src/corelib/kernel/qsystemsemaphore_unix.cpp | 52 ++++++++++++------------- src/corelib/kernel/qsystemsemaphore_win.cpp | 17 ++++---- 4 files changed, 65 insertions(+), 61 deletions(-) diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index d4e86e8..3e5f737 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -59,7 +59,7 @@ #include "qsharedmemory_p.h" #ifndef Q_OS_WINCE -# include +# include #endif #ifdef Q_OS_SYMBIAN @@ -70,11 +70,10 @@ QT_BEGIN_NAMESPACE class QSystemSemaphorePrivate { - public: QSystemSemaphorePrivate(); - QString makeKeyFileName() + inline QString makeKeyFileName() const { return QSharedMemoryPrivate::makePlatformSafeKey(key, QLatin1String("qipc_systemsem_")); } @@ -101,10 +100,10 @@ public: #elif defined(Q_OS_SYMBIAN) RSemaphore semaphore; #else + key_t unix_key; int semaphore; bool createdFile; bool createdSemaphore; - key_t unix_key; #endif QString errorString; QSystemSemaphore::SystemSemaphoreError error; @@ -115,4 +114,3 @@ QT_END_NAMESPACE #endif // QT_NO_SYSTEMSEMAPHORE #endif // QSYSTEMSEMAPHORE_P_H - diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp index 96c19af..bb60df7 100644 --- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp +++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp @@ -46,29 +46,32 @@ #include "qcore_symbian_p.h" #include -QT_BEGIN_NAMESPACE #ifndef QT_NO_SYSTEMSEMAPHORE +//#define QSYSTEMSEMAPHORE_DEBUG + +QT_BEGIN_NAMESPACE + QSystemSemaphorePrivate::QSystemSemaphorePrivate() : - error(QSystemSemaphore::NoError) + error(QSystemSemaphore::NoError) { } void QSystemSemaphorePrivate::setErrorString(const QString &function, int err) { - if (err == KErrNone){ + if (err == KErrNone) return; - } + switch(err){ case KErrAlreadyExists: errorString = QCoreApplication::tr("%1: already exists", "QSystemSemaphore").arg(function); error = QSystemSemaphore::AlreadyExists; - break; + break; case KErrNotFound: errorString = QCoreApplication::tr("%1: does not exist", "QSystemSemaphore").arg(function); error = QSystemSemaphore::NotFound; - break; + break; case KErrNoMemory: case KErrInUse: errorString = QCoreApplication::tr("%1: out of resources", "QSystemSemaphore").arg(function); @@ -77,22 +80,21 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function, int err) case KErrPermissionDenied: errorString = QCoreApplication::tr("%1: permission denied", "QSystemSemaphore").arg(function); error = QSystemSemaphore::PermissionDenied; - break; -default: - errorString = QCoreApplication::tr("%1: unknown error %2", "QSystemSemaphore").arg(function).arg(err); - error = QSystemSemaphore::UnknownError; - } - -#if defined QSYSTEMSEMAPHORE_DEBUG + break; + default: + errorString = QCoreApplication::tr("%1: unknown error %2", "QSystemSemaphore").arg(function).arg(err); + error = QSystemSemaphore::UnknownError; +#ifdef QSYSTEMSEMAPHORE_DEBUG qDebug() << errorString << "key" << key; #endif + break; + } } int QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) { - if (semaphore.Handle()) { + if (semaphore.Handle()) return semaphore.Handle(); - } // don't allow making handles on empty keys if (key.isEmpty()) @@ -106,12 +108,13 @@ int QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) while (err != KErrNoMemory && err != KErrNone && tryCount-- >= 0) { err = semaphore.CreateGlobal(name, initialValue, EOwnerProcess); if (err != KErrNoMemory && err != KErrNone) - err = semaphore.OpenGlobal(name,EOwnerProcess); + err = semaphore.OpenGlobal(name, EOwnerProcess); } - if (err){ - setErrorString(QLatin1String("QSystemSemaphore::handle"),err); + if (err) { + setErrorString(QLatin1String("QSystemSemaphore::handle"), err); return 0; } + return semaphore.Handle(); } @@ -125,14 +128,14 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) if (0 == handle()) return false; - if (count > 0) { + if (count > 0) semaphore.Signal(count); - } else { + else semaphore.Wait(); - } + return true; } -#endif //QT_NO_SYSTEMSEMAPHORE - QT_END_NAMESPACE + +#endif // QT_NO_SYSTEMSEMAPHORE diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp index 5e533e7..704afaf 100644 --- a/src/corelib/kernel/qsystemsemaphore_unix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp @@ -42,9 +42,9 @@ #include "qsystemsemaphore.h" #include "qsystemsemaphore_p.h" +#include #include #include -#include #ifndef QT_NO_SYSTEMSEMAPHORE @@ -62,11 +62,13 @@ #define EIDRM EINVAL #endif +//#define QSYSTEMSEMAPHORE_DEBUG + QT_BEGIN_NAMESPACE QSystemSemaphorePrivate::QSystemSemaphorePrivate() : - semaphore(-1), createdFile(false), - createdSemaphore(false), unix_key(-1), error(QSystemSemaphore::NoError) + unix_key(-1), semaphore(-1), createdFile(false), + createdSemaphore(false), error(QSystemSemaphore::NoError) { } @@ -95,33 +97,33 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function) default: errorString = QCoreApplication::translate("QSystemSemaphore", "%1: unknown error %2").arg(function).arg(errno); error = QSystemSemaphore::UnknownError; -#if defined QSYSTEMSEMAPHORE_DEBUG +#ifdef QSYSTEMSEMAPHORE_DEBUG qDebug() << errorString << "key" << key << "errno" << errno << EINVAL; #endif + break; } } /*! \internal - Setup unix_key - */ + Initialise the semaphore +*/ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode) { - if (key.isEmpty()){ - errorString = QCoreApplication::tr("%1: key is empty", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:")); + if (-1 != unix_key) + return unix_key; + + if (key.isEmpty()) { + errorString = QCoreApplication::tr("%1: key is empty", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle")); error = QSystemSemaphore::KeyError; return -1; } // ftok requires that an actual file exists somewhere - if (-1 != unix_key) - return unix_key; - - // Create the file needed for ftok int built = QSharedMemoryPrivate::createUnixKeyFile(fileName); if (-1 == built) { - errorString = QCoreApplication::tr("%1: unable to make key", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:")); + errorString = QCoreApplication::tr("%1: unable to make key", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle")); error = QSystemSemaphore::KeyError; return -1; } @@ -130,7 +132,7 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode) // Get the unix key for the created file unix_key = ftok(QFile::encodeName(fileName).constData(), 'Q'); if (-1 == unix_key) { - errorString = QCoreApplication::tr("%1: ftok failed", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:")); + errorString = QCoreApplication::tr("%1: ftok failed", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle")); error = QSystemSemaphore::KeyError; return -1; } @@ -145,17 +147,16 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode) cleanHandle(); return -1; } + if (mode == QSystemSemaphore::Create) { + createdSemaphore = true; + createdFile = true; + } } else { createdSemaphore = true; // Force cleanup of file, it is possible that it can be left over from a crash createdFile = true; } - if (mode == QSystemSemaphore::Create) { - createdSemaphore = true; - createdFile = true; - } - // Created semaphore so initialize its value. if (createdSemaphore && initialValue >= 0) { qt_semun init_op; @@ -173,8 +174,8 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode) /*! \internal - Cleanup the unix_key - */ + Clean up the semaphore +*/ void QSystemSemaphorePrivate::cleanHandle() { unix_key = -1; @@ -189,8 +190,8 @@ void QSystemSemaphorePrivate::cleanHandle() if (-1 != semaphore) { if (-1 == semctl(semaphore, 0, IPC_RMID, 0)) { setErrorString(QLatin1String("QSystemSemaphore::cleanHandle")); -#if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphore::cleanHandle semctl failed."); +#ifdef QSYSTEMSEMAPHORE_DEBUG + qDebug("QSystemSemaphore::cleanHandle semctl failed."); #endif } semaphore = -1; @@ -201,7 +202,7 @@ void QSystemSemaphorePrivate::cleanHandle() /*! \internal - */ +*/ bool QSystemSemaphorePrivate::modifySemaphore(int count) { if (-1 == handle()) @@ -223,7 +224,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return modifySemaphore(count); } setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); -#if defined QSYSTEMSEMAPHORE_DEBUG +#ifdef QSYSTEMSEMAPHORE_DEBUG qDebug() << QLatin1String("QSystemSemaphore::modify failed") << count << semctl(semaphore, 0, GETVAL) << errno << EIDRM << EINVAL; #endif return false; @@ -232,7 +233,6 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return true; } - QT_END_NAMESPACE #endif // QT_NO_SYSTEMSEMAPHORE diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 30cab7e..0e9d645 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -44,18 +44,20 @@ #include "qcoreapplication.h" #include -QT_BEGIN_NAMESPACE - #ifndef QT_NO_SYSTEMSEMAPHORE +//#define QSYSTEMSEMAPHORE_DEBUG + +QT_BEGIN_NAMESPACE + QSystemSemaphorePrivate::QSystemSemaphorePrivate() : - semaphore(0), error(QSystemSemaphore::NoError) + semaphore(0), error(QSystemSemaphore::NoError) { } void QSystemSemaphorePrivate::setErrorString(const QString &function) { - BOOL windowsError = GetLastError(); + DWORD windowsError = GetLastError(); if (windowsError == 0) return; @@ -72,9 +74,10 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function) default: errorString = QCoreApplication::translate("QSystemSemaphore", "%1: unknown error %2").arg(function).arg(windowsError); error = QSystemSemaphore::UnknownError; -#if defined QSYSTEMSEMAPHORE_DEBUG +#ifdef QSYSTEMSEMAPHORE_DEBUG qDebug() << errorString << "key" << key; #endif + break; } } @@ -110,7 +113,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return false; if (count > 0) { - if (0 == ReleaseSemaphore(semaphore, count, 0)) { + if (0 == ReleaseSemaphore(semaphore, count, 0)) { setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG qDebug() << QLatin1String("QSystemSemaphore::modifySemaphore ReleaseSemaphore failed"); @@ -130,6 +133,6 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return true; } -#endif //QT_NO_SYSTEMSEMAPHORE +#endif // QT_NO_SYSTEMSEMAPHORE QT_END_NAMESPACE -- cgit v0.12 From 97c59df43d821e8e1784749e72f8ee7f90d46da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Mon, 6 Jun 2011 15:03:09 +0200 Subject: Changing cursor position in all boundaries Merge-request: 1242 Reviewed-by: Harald Fernengel --- src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 2 +- tests/auto/qaccessibility/tst_qaccessibility.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 34f5be9..ea5880c 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1435,9 +1435,9 @@ QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType, if (offset >= characterCount()) return QString(); + cursor.setPosition(offset); switch (boundaryType) { case CharBoundary: - cursor.setPosition(offset); *startOffset = cursor.position(); cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); *endOffset = cursor.position(); diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 92e3a8b..28d903a 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2645,6 +2645,8 @@ void tst_QAccessibility::textEditTest() { { QTextEdit edit; + int startOffset; + int endOffset; QString text = "hello world\nhow are you today?\n"; edit.setText(text); edit.show(); @@ -2654,6 +2656,12 @@ void tst_QAccessibility::textEditTest() QCOMPARE(iface->childCount(), 6); QCOMPARE(iface->text(QAccessible::Value, 4), QString("hello world")); QCOMPARE(iface->text(QAccessible::Value, 5), QString("how are you today?")); + QCOMPARE(iface->textInterface()->textAtOffset(8, QAccessible2::WordBoundary, &startOffset, &endOffset), QString("world")); + QCOMPARE(startOffset, 6); + QCOMPARE(endOffset, 11); + QCOMPARE(iface->textInterface()->textAtOffset(14, QAccessible2::LineBoundary, &startOffset, &endOffset), QString("how are you today?")); + QCOMPARE(startOffset, 12); + QCOMPARE(endOffset, 30); QCOMPARE(iface->text(QAccessible::Value, 6), QString()); QCOMPARE(iface->textInterface()->characterCount(), 31); QFontMetrics fm(edit.font()); -- cgit v0.12 From f1a6766432f66220275aa7902e4c2414a3069cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Mon, 6 Jun 2011 15:06:42 +0200 Subject: Implemented QAccessibleTextEdit::attributes() Handling font properties and colors Created test: tst_QAccessibility::textAttributes Merge-request: 2626 Reviewed-by: Harald Fernengel --- .../accessible/widgets/qaccessiblewidgets.cpp | 111 ++++++++++++++++++++- tests/auto/qaccessibility/tst_qaccessibility.cpp | 55 ++++++++++ 2 files changed, 161 insertions(+), 5 deletions(-) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index ea5880c..d7cb5a0 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1316,11 +1316,112 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset) QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset) { - // TODO - wait for a definition of attributes - Q_UNUSED(offset); - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - return QString(); + /* The list of attributes can be found at: + http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes + */ + + if (offset >= characterCount()) { + *startOffset = -1; + *endOffset = -1; + return QString(); + } + + QMap attrs; + + QTextCursor cursor = textEdit()->textCursor(); + + //cursor.charFormat returns the format of the previous character + cursor.setPosition(offset + 1); + QTextCharFormat charFormat = cursor.charFormat(); + + cursor.setPosition(offset); + QTextBlockFormat blockFormat = cursor.blockFormat(); + + QTextCharFormat charFormatComp; + QTextBlockFormat blockFormatComp; + + *startOffset = offset; + cursor.setPosition(*startOffset); + while (*startOffset > 0) { + charFormatComp = cursor.charFormat(); + cursor.setPosition(*startOffset - 1); + blockFormatComp = cursor.blockFormat(); + if ((charFormat == charFormatComp) && (blockFormat == blockFormatComp)) + (*startOffset)--; + else + break; + } + + int limit = characterCount() + 1; + *endOffset = offset + 1; + cursor.setPosition(*endOffset); + while (*endOffset < limit) { + blockFormatComp = cursor.blockFormat(); + cursor.setPosition(*endOffset + 1); + charFormatComp = cursor.charFormat(); + if ((charFormat == charFormatComp) && (cursor.blockFormat() == blockFormatComp)) + (*endOffset)++; + else + break; + } + + QString family = charFormat.fontFamily(); + if (!family.isEmpty()) { + family = family.replace('\\',"\\\\"); + family = family.replace(':',"\\:"); + family = family.replace(',',"\\,"); + family = family.replace('=',"\\="); + family = family.replace(';',"\\;"); + family = family.replace('\"',"\\\""); + attrs["font-family"] = '"'+family+'"'; + } + + int fontSize = int(charFormat.fontPointSize()); + if (fontSize) + attrs["font-size"] = QString::number(fontSize).append("pt"); + + //Different weight values are not handled + attrs["font-weight"] = (charFormat.fontWeight() > QFont::Normal) ? "bold" : "normal"; + + QFont::Style style = charFormat.font().style(); + attrs["font-style"] = (style == QFont::StyleItalic) ? "italic" : ((style == QFont::StyleOblique) ? "oblique": "normal"); + + attrs["text-underline-style"] = charFormat.font().underline() ? "solid" : "none"; + + QTextCharFormat::VerticalAlignment alignment = charFormat.verticalAlignment(); + attrs["text-position"] = (alignment == QTextCharFormat::AlignSubScript) ? "sub" : ((alignment == QTextCharFormat::AlignSuperScript) ? "super" : "baseline" ); + + QBrush background = charFormat.background(); + if (background.style() == Qt::SolidPattern) { + attrs["background-color"] = QString("rgb(%1,%2,%3)").arg(background.color().red()).arg(background.color().green()).arg(background.color().blue()); + } + + QBrush foreground = charFormat.foreground(); + if (foreground.style() == Qt::SolidPattern) { + attrs["color"] = QString("rgb(%1,%2,%3)").arg(foreground.color().red()).arg(foreground.color().green()).arg(foreground.color().blue()); + } + + switch (blockFormat.alignment() & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter | Qt::AlignJustify)) { + case Qt::AlignLeft: + attrs["text-align"] = "left"; + break; + case Qt::AlignRight: + attrs["text-align"] = "right"; + break; + case Qt::AlignHCenter: + attrs["text-align"] = "center"; + break; + case Qt::AlignJustify: + attrs["text-align"] = "left"; + break; + } + + QString result; + foreach(const QString &attributeName, attrs.keys()) { + result.append(attributeName).append(':').append(attrs[attributeName]).append(';'); + } + + return result; } int QAccessibleTextEdit::cursorPosition() diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 28d903a..109afbc 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -238,6 +238,7 @@ private slots: void navigateControllers(); void navigateLabels(); void text(); + void textAttributes(); void setText(); void hideShowTest(); @@ -1563,6 +1564,60 @@ void tst_QAccessibility::text() #endif // !QT3_SUPPORT } +void tst_QAccessibility::textAttributes() +{ + QTextEdit textEdit; + int startOffset; + int endOffset; + QString attributes; + QString text("" + "Hello, this is an example text." + "Multiple fonts are used." + "Multiple text sizes are used." + "Let's give some color to Qt." + ""); + + textEdit.setText(text); + QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&textEdit); + + QAccessibleTextInterface *textInterface=interface->textInterface(); + + QVERIFY(textInterface); + QCOMPARE(textInterface->characterCount(), 112); + + attributes = textInterface->attributes(10, &startOffset, &endOffset); + QCOMPARE(startOffset, 7); + QCOMPARE(endOffset, 11); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;"))); + + attributes = textInterface->attributes(18, &startOffset, &endOffset); + QCOMPARE(startOffset, 18); + QCOMPARE(endOffset, 25); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;"))); + QVERIFY(attributes.contains(QLatin1String(";font-style:italic;"))); + + attributes = textInterface->attributes(34, &startOffset, &endOffset); + QCOMPARE(startOffset, 31); + QCOMPARE(endOffset, 55); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-family:\"monospace\";"))); + + attributes = textInterface->attributes(65, &startOffset, &endOffset); + QCOMPARE(startOffset, 64); + QCOMPARE(endOffset, 74); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-size:8pt;"))); + + attributes = textInterface->attributes(110, &startOffset, &endOffset); + QCOMPARE(startOffset, 109); + QCOMPARE(endOffset, 111); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";background-color:rgb(20,240,30);"))); + QVERIFY(attributes.contains(QLatin1String(";color:rgb(240,241,242);"))); +} + void tst_QAccessibility::setText() { #if !defined(QT3_SUPPORT) -- cgit v0.12 From e15e937629f990a1a692332b6ca5cedb2f3130b8 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 6 Jun 2011 15:10:34 +0200 Subject: Ammend last commit Squelch coding style warnings --- src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index d7cb5a0..c62624b 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1417,7 +1417,7 @@ QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOf } QString result; - foreach(const QString &attributeName, attrs.keys()) { + foreach (const QString &attributeName, attrs.keys()) { result.append(attributeName).append(':').append(attrs[attributeName]).append(';'); } -- cgit v0.12 From 86d88c5b719fd3d50336d9d8e7127b8045ee82ae Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 10 May 2011 15:08:29 +0200 Subject: Add function QGlyphRun::setRawData() To provide an optimized way of constructing QGlyphRun objects with no copying or allocation, we add function setRawData() (naming inspired by QByteArray::setRawData()). Data retrieved from QRawFont can be passed directly into this. The logic is now that the data pointers in QGlyphRunPrivate should always point to the current valid data and is what will be used in comparisons and drawing calls. The vectors are optimizations to avoid unnecessary copying if the user wants to use the QVector based API (which makes it easier to manage the memory.) This reflected in the functions that return QVectors, which will return the stored vector if and only if it is identical to the current pointer. Otherwise we will have to copy the memory. The internal addition operators in QGlyphRun have been removed since they really provide no real optimization and have an unclear definition if the two glyph runs are based on different fonts. Reviewed-by: Jiang Jiang --- src/gui/painting/qpainter.cpp | 15 +++-- src/gui/painting/qpainter_p.h | 2 +- src/gui/text/qglyphrun.cpp | 108 ++++++++++++++++++++------------- src/gui/text/qglyphrun.h | 4 ++ src/gui/text/qglyphrun_p.h | 19 ++++++ src/gui/text/qtextlayout.cpp | 16 ++++- tests/auto/qglyphrun/tst_qglyphrun.cpp | 79 ++++++++++++++++++++++++ 7 files changed, 190 insertions(+), 53 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d2b35c8..1bd9303 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5801,10 +5801,12 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) if (!font.isValid()) return; - QVector glyphIndexes = glyphRun.glyphIndexes(); - QVector glyphPositions = glyphRun.positions(); + QGlyphRunPrivate *glyphRun_d = QGlyphRunPrivate::get(glyphRun); - int count = qMin(glyphIndexes.size(), glyphPositions.size()); + const quint32 *glyphIndexes = glyphRun_d->glyphIndexData; + const QPointF *glyphPositions = glyphRun_d->glyphPositionData; + + int count = qMin(glyphRun_d->glyphIndexDataSize, glyphRun_d->glyphPositionDataSize); QVarLengthArray fixedPointPositions(count); QRawFontPrivate *fontD = QRawFontPrivate::get(font); @@ -5818,17 +5820,18 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) } for (int i=0; istate->transform().map(processedPosition); fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); } - d->drawGlyphs(glyphIndexes.data(), fixedPointPositions.data(), count, font, glyphRun.overline(), + d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, font, glyphRun.overline(), glyphRun.underline(), glyphRun.strikeOut()); } -void QPainterPrivate::drawGlyphs(quint32 *glyphArray, QFixedPoint *positions, int glyphCount, +void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions, + int glyphCount, const QRawFont &font, bool overline, bool underline, bool strikeOut) { diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 35cdf86..79d4b4b 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -232,7 +232,7 @@ public: void drawOpaqueBackground(const QPainterPath &path, DrawOperation operation); #if !defined(QT_NO_RAWFONT) - void drawGlyphs(quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount, + void drawGlyphs(const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount, const QRawFont &font, bool overline = false, bool underline = false, bool strikeOut = false); #endif diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 05e3b6b..2865d91 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -132,13 +132,27 @@ QGlyphRun &QGlyphRun::operator=(const QGlyphRun &other) */ bool QGlyphRun::operator==(const QGlyphRun &other) const { - return ((d == other.d) - || (d->glyphIndexes == other.d->glyphIndexes - && d->glyphPositions == other.d->glyphPositions - && d->overline == other.d->overline - && d->underline == other.d->underline - && d->strikeOut == other.d->strikeOut - && d->rawFont == other.d->rawFont)); + if (d == other.d) + return true; + + if ((d->glyphIndexDataSize != other.d->glyphIndexDataSize) + || (d->glyphPositionDataSize != other.d->glyphPositionDataSize)) { + return false; + } + + for (int i=0; iglyphIndexDataSize, d->glyphPositionDataSize); ++i) { + if (i < d->glyphIndexDataSize && d->glyphIndexData[i] != other.d->glyphIndexData[i]) + return false; + + if (i < d->glyphPositionDataSize && d->glyphPositionData[i] != other.d->glyphPositionData[i]) + return false; + } + + + return (d->overline == other.d->overline + && d->underline == other.d->underline + && d->strikeOut == other.d->strikeOut + && d->rawFont == other.d->rawFont); } /*! @@ -151,36 +165,6 @@ bool QGlyphRun::operator!=(const QGlyphRun &other) const } /*! - \internal - - Adds together the lists of glyph indexes and positions in \a other and this QGlyphRun - object and returns the result. The font in the returned QGlyphRun will be the same as in - this QGlyphRun object. -*/ -QGlyphRun QGlyphRun::operator+(const QGlyphRun &other) const -{ - QGlyphRun ret(*this); - ret += other; - return ret; -} - -/*! - \internal - - Appends the glyph indexes and positions in \a other to this QGlyphRun object and returns - a reference to the current object. -*/ -QGlyphRun &QGlyphRun::operator+=(const QGlyphRun &other) -{ - detach(); - - d->glyphIndexes += other.d->glyphIndexes; - d->glyphPositions += other.d->glyphPositions; - - return *this; -} - -/*! Returns the font selected for this QGlyphRun object. \sa setRawFont() @@ -208,7 +192,13 @@ void QGlyphRun::setRawFont(const QRawFont &rawFont) */ QVector QGlyphRun::glyphIndexes() const { - return d->glyphIndexes; + if (d->glyphIndexes.constData() == d->glyphIndexData) { + return d->glyphIndexes; + } else { + QVector indexes(d->glyphIndexDataSize); + qMemCopy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32)); + return indexes; + } } /*! @@ -218,7 +208,9 @@ QVector QGlyphRun::glyphIndexes() const void QGlyphRun::setGlyphIndexes(const QVector &glyphIndexes) { detach(); - d->glyphIndexes = glyphIndexes; + d->glyphIndexes = glyphIndexes; // Keep a reference to the QVector to avoid copying + d->glyphIndexData = glyphIndexes.constData(); + d->glyphIndexDataSize = glyphIndexes.size(); } /*! @@ -226,7 +218,14 @@ void QGlyphRun::setGlyphIndexes(const QVector &glyphIndexes) */ QVector QGlyphRun::positions() const { - return d->glyphPositions; + if (d->glyphPositions.constData() == d->glyphPositionData) { + return d->glyphPositions; + } else { + QVector glyphPositions(d->glyphPositionDataSize); + qMemCopy(glyphPositions.data(), d->glyphPositionData, + d->glyphPositionDataSize * sizeof(QPointF)); + return glyphPositions; + } } /*! @@ -236,7 +235,9 @@ QVector QGlyphRun::positions() const void QGlyphRun::setPositions(const QVector &positions) { detach(); - d->glyphPositions = positions; + d->glyphPositions = positions; // Keep a reference to the vector to avoid copying + d->glyphPositionData = positions.constData(); + d->glyphPositionDataSize = positions.size(); } /*! @@ -245,12 +246,33 @@ void QGlyphRun::setPositions(const QVector &positions) void QGlyphRun::clear() { detach(); - d->glyphPositions = QVector(); - d->glyphIndexes = QVector(); d->rawFont = QRawFont(); d->strikeOut = false; d->overline = false; d->underline = false; + + setPositions(QVector()); + setGlyphIndexes(QVector()); +} + +/*! + Sets the glyph indexes and positions of this QGlyphRun to use the first \a size + elements in the arrays \a glyphIndexArray and \a glyphPositionArray. The data is + \e not copied. The caller must guarantee that the arrays are not deleted as long + as this QGlyphRun and any copies of it exists. + + \sa setGlyphIndexes(), setPositions() +*/ +void QGlyphRun::setRawData(const quint32 *glyphIndexArray, const QPointF *glyphPositionArray, + int size) +{ + detach(); + d->glyphIndexes.clear(); + d->glyphPositions.clear(); + + d->glyphIndexData = glyphIndexArray; + d->glyphPositionData = glyphPositionArray; + d->glyphIndexDataSize = d->glyphPositionDataSize = size; } /*! diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index e43f1ef..cf407a8 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -66,6 +66,10 @@ public: QRawFont rawFont() const; void setRawFont(const QRawFont &rawFont); + void setRawData(const quint32 *glyphIndexArray, + const QPointF *glyphPositionArray, + int size); + QVector glyphIndexes() const; void setGlyphIndexes(const QVector &glyphIndexes); diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index 533679d..1cb63b2 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -71,6 +71,10 @@ public: : overline(false) , underline(false) , strikeOut(false) + , glyphIndexData(glyphIndexes.constData()) + , glyphIndexDataSize(0) + , glyphPositionData(glyphPositions.constData()) + , glyphPositionDataSize(0) { } @@ -82,6 +86,10 @@ public: , overline(other.overline) , underline(other.underline) , strikeOut(other.strikeOut) + , glyphIndexData(other.glyphIndexData) + , glyphIndexDataSize(other.glyphIndexDataSize) + , glyphPositionData(other.glyphPositionData) + , glyphPositionDataSize(other.glyphPositionDataSize) { } @@ -89,6 +97,17 @@ public: QVector glyphPositions; QRawFont rawFont; + const quint32 *glyphIndexData; + int glyphIndexDataSize; + + const QPointF *glyphPositionData; + int glyphPositionDataSize; + + static QGlyphRunPrivate *get(const QGlyphRun &glyphRun) + { + return glyphRun.d.data(); + } + uint overline : 1; uint underline : 1; uint strikeOut : 1; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 7bc87ee..203886b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2233,10 +2233,20 @@ QList QTextLine::glyphs(int from, int length) const glyphIndexes.setRawFont(font); QPair key(fontEngine, int(flags)); - if (!glyphsHash.contains(key)) + if (!glyphsHash.contains(key)) { glyphsHash.insert(key, glyphIndexes); - else - glyphsHash[key] += glyphIndexes; + } else { + QGlyphRun &glyphRun = glyphsHash[key]; + + QVector indexes = glyphRun.glyphIndexes(); + QVector positions = glyphRun.positions(); + + indexes += glyphIndexes.glyphIndexes(); + positions += glyphIndexes.positions(); + + glyphRun.setGlyphIndexes(indexes); + glyphRun.setPositions(positions); + } } } diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp index 3ea84e3..a18a2ac 100644 --- a/tests/auto/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp @@ -72,6 +72,8 @@ private slots: void drawUnderlinedText(); void drawRightToLeft(); void detach(); + void setRawData(); + void setRawDataAndGetAsVector(); private: int m_testFontId; @@ -284,6 +286,83 @@ void tst_QGlyphRun::drawExistingGlyphs() QCOMPARE(textLayoutDraw, drawGlyphs); } +void tst_QGlyphRun::setRawData() +{ + QGlyphRun glyphRun; + glyphRun.setRawFont(QRawFont::fromFont(m_testFont)); + glyphRun.setGlyphIndexes(QVector() << 2 << 2 << 2); + glyphRun.setPositions(QVector() << QPointF(2, 3) << QPointF(20, 3) << QPointF(10, 20)); + + QPixmap baseline(100, 50); + baseline.fill(Qt::white); + { + QPainter p(&baseline); + p.drawGlyphRun(QPointF(3, 2), glyphRun); + } + + QGlyphRun baselineCopied = glyphRun; + + quint32 glyphIndexArray[3] = { 2, 2, 2 }; + QPointF glyphPositionArray[3] = { QPointF(2, 3), QPointF(20, 3), QPointF(10, 20) }; + + glyphRun.setRawData(glyphIndexArray, glyphPositionArray, 3); + + QPixmap rawDataGlyphs(100, 50); + rawDataGlyphs.fill(Qt::white); + { + QPainter p(&rawDataGlyphs); + p.drawGlyphRun(QPointF(3, 2), glyphRun); + } + + quint32 otherGlyphIndexArray[1] = { 2 }; + QPointF otherGlyphPositionArray[1] = { QPointF(2, 3) }; + + glyphRun.setRawData(otherGlyphIndexArray, otherGlyphPositionArray, 1); + + QPixmap baselineCopiedPixmap(100, 50); + baselineCopiedPixmap.fill(Qt::white); + { + QPainter p(&baselineCopiedPixmap); + p.drawGlyphRun(QPointF(3, 2), baselineCopied); + } + +#if defined(DEBUG_SAVE_IMAGE) + baseline.save("setRawData_baseline.png"); + rawDataGlyphs.save("setRawData_rawDataGlyphs.png"); + baselineCopiedPixmap.save("setRawData_baselineCopiedPixmap.png"); +#endif + + QCOMPARE(rawDataGlyphs, baseline); + QCOMPARE(baselineCopiedPixmap, baseline); +} + +void tst_QGlyphRun::setRawDataAndGetAsVector() +{ + QVector glyphIndexArray; + glyphIndexArray << 3 << 2 << 1 << 4; + + QVector glyphPositionArray; + glyphPositionArray << QPointF(1, 2) << QPointF(3, 4) << QPointF(5, 6) << QPointF(7, 8); + + QGlyphRun glyphRun; + glyphRun.setRawData(glyphIndexArray.constData(), glyphPositionArray.constData(), 4); + + QVector glyphIndexes = glyphRun.glyphIndexes(); + QVector glyphPositions = glyphRun.positions(); + + QCOMPARE(glyphIndexes.size(), 4); + QCOMPARE(glyphPositions.size(), 4); + + QCOMPARE(glyphIndexes, glyphIndexArray); + QCOMPARE(glyphPositions, glyphPositionArray); + + QGlyphRun otherGlyphRun; + otherGlyphRun.setGlyphIndexes(glyphIndexArray); + otherGlyphRun.setPositions(glyphPositionArray); + + QCOMPARE(glyphRun, otherGlyphRun); +} + void tst_QGlyphRun::drawNonExistentGlyphs() { QVector glyphIndexes; -- cgit v0.12 From 4875ecd930e47048a49eb17e4dadfa5d75e01a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Tue, 7 Jun 2011 09:10:00 +0300 Subject: Fix for QTBUG-18947. Changed the macosx deployment target to 10.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed by: Eckhart Köppen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index e62c778..c05ac33 100755 --- a/configure +++ b/configure @@ -4885,7 +4885,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; done fi if [ "$BUILD_ON_MAC" = "yes" ]; then - echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >> "$mkfile" + echo "export MACOSX_DEPLOYMENT_TARGET = 10.5" >> "$mkfile" echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile" echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile" EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)" -- cgit v0.12 From 34b888b2c6455cdcd4f931f6a5a038636cf951eb Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 7 Jun 2011 11:08:59 +0300 Subject: KERN-EXEC 3 panic in QCoeFepInputContext::translateInputWidget() There is no check if graphics view pointer is null in the SLOT function translateInputWidget(). Task-number: QTBUG-19734 Reviewed-by: Miikka Heikkinen --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 67330e2..f057e0a 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -868,6 +868,8 @@ void QCoeFepInputContext::ensureInputCapabilitiesChanged() void QCoeFepInputContext::translateInputWidget() { QGraphicsView *gv = qobject_cast(S60->splitViewLastWidget); + if (!gv) + return; QRect splitViewRect = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); QRectF cursor = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); -- cgit v0.12 From f5a63feb8953799de7e787f333575ee37fae8a3f Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 1 Jun 2011 17:13:51 +1000 Subject: Fixed compile of tst_qscriptextensionplugin on some Windows configurations The debug and release versions of staticplugin are qmake'd with the same destination directory. This causes the generated staticplugin .prl file to always refer to the debug versions of Qt libraries, even if Qt was configured with -release. The .prl mechanism is not useful for this test, so simply disable it to solve the problem. Reviewed-by: ckamm --- tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro index a003338..65c4e8f 100644 --- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro +++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += static plugin +CONFIG -= create_prl # not needed, and complicates debug/release SOURCES = staticplugin.cpp RESOURCES = staticplugin.qrc QT = core script -- cgit v0.12 From 071088a8bd1bac104adfcb648cd81e6c020e4e69 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 7 Jun 2011 15:32:58 +0300 Subject: Reset input context in Symbian when another window is opened. When symbol menu is opened, input context needs to be reset or preedit string duplication may occur after symbol menu is closed. Task-number: QTBUG-19528 Reviewed-by: Sami Merila --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index f057e0a..b513365 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -360,6 +360,11 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE } } + if (event->type() == QSymbianEvent::ResourceChangeEvent + && event->resourceChangeType() == KEikMessageFadeAllWindows) { + reset(); + } + return false; } -- cgit v0.12 From a2f52802bd7183ecb2ac2ba967393f0781fa7126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Wed, 8 Jun 2011 10:14:56 +0300 Subject: Fixed qmlshadersplugin on windows VC2008 toolchain. This fix is originally submitted by George Tavares. APIENTRY is a Win32 macro defined as stdcall__ * Reviewed-by: Kim Gronholm --- src/imports/shaders/glfunctions.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/imports/shaders/glfunctions.h b/src/imports/shaders/glfunctions.h index 03b88d1..8529519 100755 --- a/src/imports/shaders/glfunctions.h +++ b/src/imports/shaders/glfunctions.h @@ -45,26 +45,26 @@ #ifndef QT_OPENGL_ES #ifndef Q_WS_MAC -# ifndef QGLF_APIENTRYP -# ifdef QGLF_APIENTRY -# define QGLF_APIENTRYP QGLF_APIENTRY * +# ifndef APIENTRYP +# ifdef APIENTRY +# define APIENTRYP APIENTRY * # else -# define QGLF_APIENTRY -# define QGLF_APIENTRYP * +# define APIENTRY +# define APIENTRYP * # endif # endif #else -# define QGLF_APIENTRY -# define QGLF_APIENTRYP * +# define APIENTRY +# define APIENTRYP * #endif #define GL_TEXTURE0 0x84C0 #define GL_CLAMP_TO_EDGE 0x812F #define GL_BGRA 0x80E1 -typedef void (QGLF_APIENTRYP type_glActiveTexture)(GLenum texture); -typedef void (QGLF_APIENTRYP type_glGenerateMipmap)(GLenum target); -typedef void (QGLF_APIENTRYP type_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +typedef void (APIENTRYP type_glActiveTexture)(GLenum texture); +typedef void (APIENTRYP type_glGenerateMipmap)(GLenum target); +typedef void (APIENTRYP type_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); #define glActiveTexture ((type_glActiveTexture)QGLContext::currentContext()->getProcAddress(QLatin1String("glActiveTexture"))) #define glGenerateMipmap ((type_glGenerateMipmap)QGLContext::currentContext()->getProcAddress(QLatin1String("glGenerateMipmap"))) -- cgit v0.12 From 7b0762c17f9899e68c0f67480a81b25c6f0c7dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Wed, 8 Jun 2011 10:16:38 +0300 Subject: Fixed qmlshadersplugin manual test shaders on SGX family GPU:s. SGX GPU requires precision definitions for all variables. Additionally some unnecessary semicolons were removed. Reviewed-by: Kim Gronholm --- .../qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml | 2 +- .../qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml | 4 ++-- .../qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml | 2 +- .../qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml index 3b94389..ec372ca 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestHorizontalWrap.qml @@ -70,7 +70,7 @@ Rectangle { uniform lowp sampler2D source; varying highp vec2 qt_TexCoord0; void main() { - vec2 tex = qt_TexCoord0 * 4.0; + highp vec2 tex = qt_TexCoord0 * 4.0; gl_FragColor = texture2D(source, tex); } " diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml index a7530dc..4edb065 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVertexShader.qml @@ -67,7 +67,7 @@ Rectangle { { qt_TexCoord0 = qt_MultiTexCoord0; gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; - }; + } " property string dummyVertexShader: " @@ -79,7 +79,7 @@ Rectangle { { qt_TexCoord0 = qt_MultiTexCoord0; gl_Position = qt_Vertex * vec4(0.0, 0.0, 0.0, 0.0001); - }; + } " vertexShader: defaultVertexShader diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml index 726b237..b7d6db4 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestVerticalWrap.qml @@ -69,7 +69,7 @@ Rectangle { uniform lowp sampler2D source; varying highp vec2 qt_TexCoord0; void main() { - vec2 tex = qt_TexCoord0 * 4.0; + highp vec2 tex = qt_TexCoord0 * 4.0; gl_FragColor = texture2D(source, tex); } " diff --git a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml index 514e150..e09673c 100644 --- a/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml +++ b/tests/manual/declarative/qmlshadersplugin/qml/qmlshadersplugintest/TestWrapRepeat.qml @@ -69,7 +69,7 @@ Rectangle { uniform lowp sampler2D source; varying highp vec2 qt_TexCoord0; void main() { - vec2 tex = qt_TexCoord0 * 4.0; + highp vec2 tex = qt_TexCoord0 * 4.0; gl_FragColor = texture2D(source, tex); } " -- cgit v0.12 From 5047ba619f6b251426c38db68a9efa6ef4ad5ac7 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 8 Jun 2011 10:02:20 +0200 Subject: Compile on Mac OS X --- src/corelib/kernel/qsharedmemory_p.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index 8099e6b..21b8612 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -70,10 +70,12 @@ namespace QSharedMemoryPrivate #include "private/qobject_p.h" #ifdef Q_OS_WIN -#include +# include #elif defined(Q_OS_SYMBIAN) -#include -#include +# include +# include +#else +# include #endif QT_BEGIN_NAMESPACE -- cgit v0.12 From 00898f5df8cf885f0080cd8e13ba435a36758df3 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 8 Jun 2011 09:58:37 +0200 Subject: Revert 36e01e69 The way we handle glyph cache in QFontEngineFT has changed, the memory leak fix should not be applied to 4.8. Reviewed-by: Eskil --- src/gui/text/qfontengine_ft.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index f514942..776615c 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1751,7 +1751,6 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe } else { glyphSet = &defaultGlyphSet; } - bool needsDelete = false; Glyph * g = glyphSet->getGlyph(glyph); if (!g || g->format != format) { face = lockFace(); @@ -1759,7 +1758,6 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe FT_Matrix_Multiply(&glyphSet->transformationMatrix, &m); freetype->matrix = m; g = loadGlyph(glyphSet, glyph, subPixelPosition, format); - needsDelete = true; } if (g) { @@ -1768,8 +1766,6 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe overall.width = g->width; overall.height = g->height; overall.xoff = g->advance; - if (needsDelete) - delete g; } else { int left = FLOOR(face->glyph->metrics.horiBearingX); int right = CEIL(face->glyph->metrics.horiBearingX + face->glyph->metrics.width); -- cgit v0.12 From 74a1135341783449970d579b273d00c837ac14b0 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 8 Jun 2011 10:11:10 +0200 Subject: Reorder member varibles in QGlyphRunPrivate to eliminate warning Reviewed-by: Eskil --- src/gui/text/qglyphrun_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index 1cb63b2..a7745e6 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -97,6 +97,10 @@ public: QVector glyphPositions; QRawFont rawFont; + uint overline : 1; + uint underline : 1; + uint strikeOut : 1; + const quint32 *glyphIndexData; int glyphIndexDataSize; @@ -107,10 +111,6 @@ public: { return glyphRun.d.data(); } - - uint overline : 1; - uint underline : 1; - uint strikeOut : 1; }; QT_END_NAMESPACE -- cgit v0.12 From 5ce3fbb67b79c3732fd47b296ef9421398ca520c Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Sat, 4 Jun 2011 15:53:49 +0200 Subject: Fix warning in qtextengine compilation enableHarfbuzz() should only be defined on Mac. Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index ad4f6d3..e8e6c98 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -856,7 +856,7 @@ void QTextEngine::shapeLine(const QScriptLine &line) } } -#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) +#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) && defined(Q_WS_MAC) static bool enableHarfBuzz() { static enum { Yes, No, Unknown } status = Unknown; -- cgit v0.12 From 5a598afa3f1928e9ad18257e2fa48fe3d5739917 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Sat, 4 Jun 2011 17:47:13 +0200 Subject: Fix compile when configure with no fontconfig support Task-number: QTBUG-19716 Reviewed-by: Eskil --- src/gui/text/qrawfont_ft.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index e8c10a5..db60459 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -46,7 +46,7 @@ #include "qrawfont_p.h" #include "qfontengine_ft_p.h" -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) # include "qfontengine_x11_p.h" #endif @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE class QFontEngineFTRawFont -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) : public QFontEngineX11FT #else : public QFontEngineFT @@ -63,7 +63,7 @@ class QFontEngineFTRawFont { public: QFontEngineFTRawFont(const QFontDef &fontDef) -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) : QFontEngineX11FT(fontDef) #else : QFontEngineFT(fontDef) -- cgit v0.12 From 437aa330b9ce7934200592fef0227997fbbe17b5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Jun 2011 10:25:24 +0200 Subject: Fix compilation of qtconfig without X11 Patch-by: Christian Kamm --- tools/qtconfig/mainwindow.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index d5a0bde..a677a04 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -75,7 +75,9 @@ #include #endif +#ifdef Q_WS_X11 #include +#endif QT_BEGIN_NAMESPACE @@ -263,10 +265,15 @@ MainWindow::MainWindow() connect(ui->buttonMainColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); connect(ui->buttonWindowColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); +#ifdef Q_WS_X11 if (X11->desktopEnvironment == DE_KDE) ui->colorConfig->hide(); else ui->kdeNoteLabel->hide(); +#else + ui->colorConfig->hide(); + ui->kdeNoteLabel->hide(); +#endif QFontDatabase db; QStringList families = db.families(); @@ -384,7 +391,7 @@ MainWindow::MainWindow() ui->inputStyleCombo->setCurrentIndex(ui->inputStyleCombo->findText(settingsInputStyle)); #else ui->inputStyleCombo->hide(); - ui->inputStyleComboLabel->hide(); + ui->inputStyleLabel->hide(); #endif #if defined(Q_WS_X11) && !defined(QT_NO_XIM) @@ -407,7 +414,7 @@ MainWindow::MainWindow() ui->inputMethodCombo->setCurrentIndex(inputMethodComboIndex); #else ui->inputMethodCombo->hide(); - ui->inputMethodComboLabel->hide(); + ui->inputMethodLabel->hide(); #endif ui->fontEmbeddingCheckBox->setChecked(settings.value(QLatin1String("embedFonts"), true) -- cgit v0.12 From ab00a395bb00ccd130a01d49bf18c2bc597a1fe6 Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Wed, 8 Jun 2011 11:44:41 +0300 Subject: Update internal state before emitting configurationChanged() signals. PMO Bug 257336. --- src/plugins/bearer/icd/qicdengine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index c793e52..79be2ce 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -929,6 +929,7 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) configLocker.unlock(); locker.unlock(); + emit iapStateChanged(iapid, icd_connection_state); emit configurationChanged(ptr); locker.relock(); -- cgit v0.12 From c038e3505309bb954123493cb5f96c73e114f3d0 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 8 Jun 2011 11:01:26 +0200 Subject: QDeclarativeDebug: Fix QJSDebugService if launched with ',block' If the debugger is launched in blocking mode the service will be enabled from the start. Reviewed-by: Thorbjorn Lindeijer --- src/declarative/debugger/qjsdebuggeragent.cpp | 13 ++++++++++++- src/declarative/debugger/qjsdebuggeragent_p.h | 2 ++ src/declarative/debugger/qjsdebugservice.cpp | 10 ++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/declarative/debugger/qjsdebuggeragent.cpp b/src/declarative/debugger/qjsdebuggeragent.cpp index 9b76592..dff637b 100644 --- a/src/declarative/debugger/qjsdebuggeragent.cpp +++ b/src/declarative/debugger/qjsdebuggeragent.cpp @@ -56,7 +56,7 @@ class QJSDebuggerAgentPrivate { public: QJSDebuggerAgentPrivate(QJSDebuggerAgent *q) - : q(q), state(NoState) + : q(q), state(NoState), isInitialized(false) {} void continueExec(); @@ -79,6 +79,7 @@ public: QHash fileNameToBreakpoints; QStringList watchExpressions; QSet knownObjectIds; + bool isInitialized; }; namespace { @@ -252,6 +253,14 @@ QJSDebuggerAgent::~QJSDebuggerAgent() delete d; } +/*! + Indicates whether the agent got the list of breakpoints. + */ +bool QJSDebuggerAgent::isInitialized() const +{ + return d->isInitialized; +} + void QJSDebuggerAgent::setBreakpoints(const JSAgentBreakpoints &breakpoints) { d->breakpoints = breakpoints; @@ -259,6 +268,8 @@ void QJSDebuggerAgent::setBreakpoints(const JSAgentBreakpoints &breakpoints) d->fileNameToBreakpoints.clear(); foreach (const JSAgentBreakpointData &bp, breakpoints) d->fileNameToBreakpoints.insertMulti(fileName(QString::fromUtf8(bp.fileUrl)), bp); + + d->isInitialized = true; } void QJSDebuggerAgent::setWatchExpressions(const QStringList &watchExpressions) diff --git a/src/declarative/debugger/qjsdebuggeragent_p.h b/src/declarative/debugger/qjsdebuggeragent_p.h index 5aa3c9c..309588e 100644 --- a/src/declarative/debugger/qjsdebuggeragent_p.h +++ b/src/declarative/debugger/qjsdebuggeragent_p.h @@ -145,6 +145,8 @@ public: QJSDebuggerAgent(QDeclarativeEngine *engine, QObject *parent = 0); ~QJSDebuggerAgent(); + bool isInitialized() const; + void setBreakpoints(const JSAgentBreakpoints &); void setWatchExpressions(const QStringList &); diff --git a/src/declarative/debugger/qjsdebugservice.cpp b/src/declarative/debugger/qjsdebugservice.cpp index 4ce2c90..ad84f65 100644 --- a/src/declarative/debugger/qjsdebugservice.cpp +++ b/src/declarative/debugger/qjsdebugservice.cpp @@ -71,6 +71,16 @@ void QJSDebugService::addEngine(QDeclarativeEngine *engine) Q_ASSERT(!m_engines.contains(engine)); m_engines.append(engine); + + if (status() == Enabled && !m_engines.isEmpty() && !m_agent) { + m_agent = new QJSDebuggerAgent(engine, engine); + connect(m_agent, SIGNAL(stopped(bool,QString)), + this, SLOT(executionStopped(bool,QString))); + + while (!m_agent->isInitialized()) { + waitForMessage(); + } + } } void QJSDebugService::removeEngine(QDeclarativeEngine *engine) -- cgit v0.12 From 32079bb0b348ef5f7126e69be9bcfb249c1a6412 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 5 Jun 2011 04:16:13 -0700 Subject: Avoid bogus accessibility focus events from menus. Do not send accessibility focus events when menus are involved. There are focus events to preserve the old focus when showing a new popup window. Reviewed-by: Jan-Arve --- src/gui/kernel/qwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 434a788..8ca9d8d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6427,6 +6427,10 @@ void QWidget::setFocus(Qt::FocusReason reason) if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows # endif +# ifdef Q_OS_UNIX + // menus update the focus manually and this would create bogus events + if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) +# endif QAccessible::updateAccessibility(f, 0, QAccessible::Focus); #endif #ifndef QT_NO_GRAPHICSVIEW -- cgit v0.12 From df6713b8f55fc007796f404a3615bf348d1d0782 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 20 May 2011 14:16:33 +0200 Subject: Add tilde (both ~ and ~) expansion to QFileDialog on UNIX. Task-number: QTBUG-3265 Reviewed-by: Thiago --- src/gui/dialogs/qfiledialog.cpp | 77 ++++++++++++++++++++++++++++-- tests/auto/qfiledialog/tst_qfiledialog.cpp | 38 +++++++++++++++ 2 files changed, 111 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 897a916..8da60e6 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -66,6 +66,9 @@ #if defined(Q_OS_WINCE) extern bool qt_priv_ptr_valid; #endif +#if defined(Q_OS_UNIX) +#include +#endif #endif QT_BEGIN_NAMESPACE @@ -858,23 +861,78 @@ void QFileDialog::selectFile(const QString &filename) d->lineEdit()->setText(file); } +#ifdef Q_OS_UNIX +Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0) +{ + if (expanded != 0) + *expanded = false; + if (!path.startsWith(QLatin1Char('~'))) + return path; + QString ret = path; + QStringList tokens = ret.split(QDir::separator()); + if (tokens.first() == QLatin1String("~")) { + ret.replace(0, 1, QDir::homeDirPath()); + } else { + QString userName = tokens.first(); + userName.remove(0, 1); +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) + passwd pw; + passwd *tmpPw; + char buf[200]; + const int bufSize = sizeof(buf); + int err = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize, &tmpPw); + if (err || !tmpPw) + return ret; + const QString homePath = QString::fromLocal8Bit(pw.pw_dir); +#else + passwd *pw = getpwnam(userName.toLocal8Bit().constData()); + if (!pw) + return ret; + const QString homePath = QString::fromLocal8Bit(pw->pw_dir); +#endif + ret.replace(0, tokens.first().length(), homePath); + } + if (expanded != 0) + *expanded = true; + return ret; +} +#endif + /** Returns the text in the line edit which can be one or more file names */ QStringList QFileDialogPrivate::typedFiles() const { + Q_Q(const QFileDialog); QStringList files; QString editText = lineEdit()->text(); - if (!editText.contains(QLatin1Char('"'))) + if (!editText.contains(QLatin1Char('"'))) { +#ifdef Q_OS_UNIX + const QString prefix = q->directory().absolutePath() + QDir::separator(); + if (QFile::exists(prefix + editText)) + files << editText; + else + files << qt_tildeExpansion(editText); +#else files << editText; - else { +#endif + } else { // " is used to separate files like so: "file1" "file2" "file3" ... // ### need escape character for filenames with quotes (") QStringList tokens = editText.split(QLatin1Char('\"')); for (int i=0; idirectory().absolutePath() + QDir::separator(); + if (QFile::exists(prefix + token)) + files << token; + else + files << qt_tildeExpansion(token); +#else files << toInternal(tokens.at(i)); +#endif } } return addDefaultSuffixToFiles(files); @@ -3338,6 +3396,17 @@ QStringList QFSCompleter::splitPath(const QString &path) const pathCopy = pathCopy.mid(2); else doubleSlash.clear(); +#elif defined(Q_OS_UNIX) + bool expanded; + pathCopy = qt_tildeExpansion(pathCopy, &expanded); + if (expanded) { + QFileSystemModel *dirModel; + if (proxyModel) + dirModel = qobject_cast(proxyModel->sourceModel()); + else + dirModel = sourceModel; + dirModel->fetchMore(dirModel->index(pathCopy)); + } #endif QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']')); @@ -3354,14 +3423,14 @@ QStringList QFSCompleter::splitPath(const QString &path) const parts.append(QString()); #else QStringList parts = pathCopy.split(re); - if (path[0] == sep[0]) // read the "/" at the beginning as the split removed it + if (pathCopy[0] == sep[0]) // read the "/" at the beginning as the split removed it parts[0] = sep[0]; #endif #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(QLatin1Char(':')); #else - bool startsFromRoot = path[0] == sep[0]; + bool startsFromRoot = pathCopy[0] == sep[0]; #endif if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) { const QFileSystemModel *dirModel; diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 42e82a9..24ac9f7 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -78,6 +78,10 @@ # define STRINGIFY(x) #x # define TOSTRING(x) STRINGIFY(x) # define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" +#elif defined(Q_OS_UNIX) +#ifdef QT_BUILD_INTERNAL +extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0); +#endif #endif class QNonNativeFileDialog : public QFileDialog @@ -144,6 +148,10 @@ private slots: void clearLineEdit(); void enableChooseButton(); void hooks(); +#ifdef Q_OS_UNIX + void tildeExpansion_data(); + void tildeExpansion(); +#endif private: QByteArray userSettings; @@ -1323,5 +1331,35 @@ void tst_QFiledialog::hooks() QCOMPARE(QFileDialog::getSaveFileName(), QString("saveName")); } +#ifdef Q_OS_UNIX +void tst_QFiledialog::tildeExpansion_data() +{ + QTest::addColumn("tildePath"); + QTest::addColumn("expandedPath"); + + QTest::newRow("empty path") << QString() << QString(); + QTest::newRow("~") << QString::fromLatin1("~") << QDir::homePath(); + QTest::newRow("~/some/sub/dir/") << QString::fromLatin1("~/some/sub/dir") << QDir::homePath() + + QString::fromLatin1("/some/sub/dir"); + QString userHome = QString(qgetenv("USER")); + userHome.prepend('~'); + QTest::newRow("current user (~ syntax)") << userHome << QDir::homePath(); + QString invalid = QString::fromLatin1("~thisIsNotAValidUserName"); + QTest::newRow("invalid user name") << invalid << invalid; +} + + +void tst_QFiledialog::tildeExpansion() +{ +#ifndef QT_BUILD_INTERNAL + QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)", SkipAll); +#endif + QFETCH(QString, tildePath); + QFETCH(QString, expandedPath); + + QCOMPARE(qt_tildeExpansion(tildePath), expandedPath); +} +#endif + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" -- cgit v0.12 From e2773c35eb06f5a17c8ef40a949c6af48c4175fd Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 8 Jun 2011 21:32:45 +0200 Subject: Fix autotest on Windows --- src/corelib/kernel/qsharedmemory_win.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index 3b8876f..567214e 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -142,14 +142,10 @@ bool QSharedMemoryPrivate::create(int size) // Create the file mapping. hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size, (wchar_t*)nativeKey.utf16()); + setErrorString(QLatin1String("QSharedMemory::create")); // hand is valid when it already exists unlike unix so explicitly check - if (error == QSharedMemory::AlreadyExists || !hand) { - setErrorString(QLatin1String("QSharedMemory::create")); - return false; - } - - return true; + return !(error == QSharedMemory::AlreadyExists || !hand); } bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) -- cgit v0.12 From 13d438ef43a3cb2a90acfaa5304cba34b31fb627 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 9 Jun 2011 10:42:09 +0200 Subject: Fix some issues introduced in df6713b8f55fc007796f40. Remove homeDirPath(), which is part of Qt3Support. Add a #else to the #ifdef QT_BUILD_INTERNAL so that the autotest compiles also with non-developer builds. Reviewed-by: TrustMe --- src/gui/dialogs/qfiledialog.cpp | 2 +- tests/auto/qfiledialog/tst_qfiledialog.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 8da60e6..d7716f7 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -871,7 +871,7 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded QString ret = path; QStringList tokens = ret.split(QDir::separator()); if (tokens.first() == QLatin1String("~")) { - ret.replace(0, 1, QDir::homeDirPath()); + ret.replace(0, 1, QDir::homePath()); } else { QString userName = tokens.first(); userName.remove(0, 1); diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 24ac9f7..955860d 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1353,11 +1353,12 @@ void tst_QFiledialog::tildeExpansion() { #ifndef QT_BUILD_INTERNAL QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)", SkipAll); -#endif +#else QFETCH(QString, tildePath); QFETCH(QString, expandedPath); QCOMPARE(qt_tildeExpansion(tildePath), expandedPath); +#endif } #endif -- cgit v0.12 From e3b5de8651586cf5484fd8ab217cddf17f0fe01e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 8 Jun 2011 20:51:07 +0200 Subject: QDeclarativeDebug: Don't hang if started with ',block' argument Fixes regression introduced in a59261454071 Reviewed-by: Christiaan Janssen --- src/declarative/debugger/qpacketprotocol.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 77c5f44..9caaa79 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -199,6 +199,7 @@ public Q_SLOTS: inProgressSize = -1; inProgress.clear(); + waitingForPacket = false; emit readyRead(); } else return; -- cgit v0.12 From 731d843b52b0a0bc387c50c2af37a71f87804f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Fri, 3 Jun 2011 20:44:37 +0200 Subject: Check validator when changing text using accessibility functions. Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 9 ++++++++- tests/auto/qaccessibility/tst_qaccessibility.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index aa64630..ac40aef 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -703,7 +703,14 @@ void QAccessibleLineEdit::setText(Text t, int control, const QString &text) QAccessibleWidgetEx::setText(t, control, text); return; } - lineEdit()->setText(text); + + QString newText = text; + if (lineEdit()->validator()) { + int pos = 0; + if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable) + return; + } + lineEdit()->setText(newText); } /*! \reimp */ diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 7ff1a08..235449b 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3190,6 +3190,12 @@ void tst_QAccessibility::lineEditTest() QTestAccessibility::clearEvents(); le2->setFocus(Qt::TabFocusReason); QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le2, 0, QAccessible::Focus))); + + le->setText(QLatin1String("500")); + le->setValidator(new QIntValidator()); + iface->setText(QAccessible::Value, 0, QLatin1String("This text is not a number")); + QCOMPARE(le->text(), QLatin1String("500")); + delete iface; delete le; delete le2; -- cgit v0.12 From 636b7088eb3740800f54a7c1634d3e041e688270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Sat, 4 Jun 2011 18:06:47 +0200 Subject: Do not expose text when echo mode is not Normal. Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index ac40aef..3b9ccfa 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -808,6 +808,10 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset) { if (startOffset > endOffset) return QString(); + + if (lineEdit()->echoMode() != QLineEdit::Normal) + return QString(); + return lineEdit()->text().mid(startOffset, endOffset - startOffset); } -- cgit v0.12 From 683d391480cf81b4cd1db7d36fa366fc2c7db5e1 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 5 May 2011 18:50:35 +0200 Subject: Remove stray semicolon. Reviewed-by: TrustMe --- src/plugins/accessible/widgets/simplewidgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 3b9ccfa..a544a31 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -176,7 +176,7 @@ QString QAccessibleButton::text(Text t, int child) const break; } if (str.isEmpty()) - str = QAccessibleWidgetEx::text(t, child);; + str = QAccessibleWidgetEx::text(t, child); return qt_accStripAmp(str); } -- cgit v0.12 From b99344a7ec3e863da2d84f2ca5fd7e478cb18066 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 5 May 2011 18:51:59 +0200 Subject: QAccessibleToolButton::text should return accessibleName if set. This was most likely a copy and paste error. Reviewed-by: Denis Dzyubenko --- src/plugins/accessible/widgets/simplewidgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index a544a31..554e7f3 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -396,7 +396,7 @@ QString QAccessibleToolButton::text(Text t, int child) const QString str; switch (t) { case Name: - str = toolButton()->text(); + str = toolButton()->accessibleName(); if (str.isEmpty()) str = toolButton()->text(); break; -- cgit v0.12 From b606ccbc19cac720bc50a44b2f1195d53f6691e2 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 18 May 2011 21:46:26 +0200 Subject: Remove more inconsistencies with invisible. Visible status should not influence child count and other properties. Reviewed-by: Jan-Arve --- src/plugins/accessible/widgets/rangecontrols.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp index 1f5407a..736ed88 100644 --- a/src/plugins/accessible/widgets/rangecontrols.cpp +++ b/src/plugins/accessible/widgets/rangecontrols.cpp @@ -83,8 +83,6 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const /*! \reimp */ int QAccessibleAbstractSpinBox::childCount() const { - if (!abstractSpinBox()->isVisible()) - return 0; return ValueDown; } @@ -344,8 +342,6 @@ QDoubleSpinBox *QAccessibleDoubleSpinBox::doubleSpinBox() const /*! \reimp */ int QAccessibleDoubleSpinBox::childCount() const { - if (!doubleSpinBox()->isVisible()) - return 0; return ValueDown; } @@ -410,8 +406,6 @@ QVariant QAccessibleDoubleSpinBox::invokeMethodEx(QAccessible::Method, int, cons /*! \reimp */ QString QAccessibleDoubleSpinBox::text(Text textType, int child) const { - if (!doubleSpinBox()->isVisible()) - return QString(); switch (textType) { case Name: if (child == ValueUp) @@ -540,16 +534,12 @@ QRect QAccessibleScrollBar::rect(int child) const /*! \reimp */ int QAccessibleScrollBar::childCount() const { - if (!scrollBar()->isVisible()) - return 0; return LineDown; } /*! \reimp */ QString QAccessibleScrollBar::text(Text t, int child) const { - if (!scrollBar()->isVisible()) - return QString(); switch (t) { case Value: if (!child || child == Position) @@ -698,16 +688,12 @@ QRect QAccessibleSlider::rect(int child) const /*! \reimp */ int QAccessibleSlider::childCount() const { - if (!slider()->isVisible()) - return 0; return PageRight; } /*! \reimp */ QString QAccessibleSlider::text(Text t, int child) const { - if (!slider()->isVisible()) - return QString(); switch (t) { case Value: if (!child || child == 2) @@ -932,15 +918,11 @@ QRect QAccessibleDial::rect(int child) const int QAccessibleDial::childCount() const { - if (!dial()->isVisible()) - return 0; return SliderHandle; } QString QAccessibleDial::text(Text textType, int child) const { - if (!dial()->isVisible()) - return QString(); if (textType == Value && child >= Self && child <= SliderHandle) return QString::number(dial()->value()); if (textType == Name) { -- cgit v0.12 From da9b2156015a946122eacc64437d214d1e184f35 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 18 May 2011 18:20:38 +0200 Subject: When asking for relations, don't crash on children that don't return an interface. Reviewed-by: Jan-Arve --- src/gui/accessible/qaccessiblewidget.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 2b2cec0..52aab32 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -704,13 +704,16 @@ int QAccessibleWidget::navigate(RelationFlag relation, int entry, int sibCount = pIface->childCount(); QAccessibleInterface *candidate = 0; for (int i = 0; i < sibCount && entry; ++i) { - pIface->navigate(Child, i+1, &candidate); - Q_ASSERT(candidate); - if (candidate->relationTo(0, this, 0) & Label) + const int childId = pIface->navigate(Child, i+1, &candidate); + Q_ASSERT(childId >= 0); + if (childId > 0) + candidate = pIface; + if (candidate->relationTo(childId, this, 0) & Label) --entry; if (!entry) break; - delete candidate; + if (candidate != pIface) + delete candidate; candidate = 0; } if (!candidate) { -- cgit v0.12 From 267e7ca0e586eb63c62deac94f8412db962d621d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jun 2011 17:20:19 +0200 Subject: fix build on windows 7 remove pointless epocroot.pri inclusion --- tools/linguist/lrelease/lrelease.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index e9b3a75..28a741d 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -8,7 +8,6 @@ SOURCES += main.cpp include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) -include(../../shared/symbian/epocroot.pri) target.path=$$[QT_INSTALL_BINS] INSTALLS += target -- cgit v0.12 From 8680ced782c5e225b2e15c50c05493a23410b119 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Fri, 10 Jun 2011 18:08:44 +0200 Subject: Fix building the OpenVG graphicssystem on Linux with static libs Without this, building OpenVG would fail because Q_OPENVG_EXPORT wasn't defined at all, causing it to be treated as a variable name Merge-request: 1256 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1454cb3..32b3e6b 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1423,6 +1423,7 @@ class QDataStream; # define Q_DECLARATIVE_EXPORT # define Q_OPENGL_EXPORT # define Q_MULTIMEDIA_EXPORT +# define Q_OPENVG_EXPORT # define Q_XML_EXPORT # define Q_XMLPATTERNS_EXPORT # define Q_SCRIPT_EXPORT -- cgit v0.12