From bbb083a6f195eb885cca01a00b34a7c44258a79e Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 4 Aug 2011 13:39:35 +0100 Subject: DEF file freeze Reviewed-by: Miikka Heikkinen --- src/s60installs/bwins/QtCoreu.def | 2 ++ src/s60installs/bwins/QtGuiu.def | 53 +++++++++++++++++++++++++++++++++++++++ src/s60installs/bwins/QtSqlu.def | 1 + src/s60installs/bwins/QtTestu.def | 1 + src/s60installs/eabi/QtCoreu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 41 ++++++++++++++++++++++++++++++ src/s60installs/eabi/QtSqlu.def | 1 + src/s60installs/eabi/QtTestu.def | 1 + 8 files changed, 102 insertions(+) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index ff29c0a..35f4e6c 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4882,4 +4882,6 @@ EXPORTS ?resultsReadyAt@QFutureWatcherBase@@IAEXHH@Z @ 4881 NONAME ; void QFutureWatcherBase::resultsReadyAt(int, int) ?started@QFutureWatcherBase@@IAEXXZ @ 4882 NONAME ; void QFutureWatcherBase::started(void) ?resetInternalData@QAbstractItemModel@@IAEXXZ @ 4883 NONAME ; void QAbstractItemModel::resetInternalData(void) + ?toLower@QLocale@@QBE?AVQString@@ABV2@@Z @ 4884 NONAME ; class QString QLocale::toLower(class QString const &) const + ?toUpper@QLocale@@QBE?AVQString@@ABV2@@Z @ 4885 NONAME ; class QString QLocale::toUpper(class QString const &) const diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index b763848..e05f0b8 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -14045,4 +14045,57 @@ EXPORTS ?setStyleName@QFont@@QAEXABVQString@@@Z @ 14044 NONAME ; void QFont::setStyleName(class QString const &) ?styleName@QFont@@QBE?AVQString@@XZ @ 14045 NONAME ; class QString QFont::styleName(void) const ?styleName@QFontInfo@@QBE?AVQString@@XZ @ 14046 NONAME ; class QString QFontInfo::styleName(void) const + ?initialize@QTreeViewPrivate@@QAEXXZ @ 14047 NONAME ; void QTreeViewPrivate::initialize(void) + ?expand@QTreeViewPrivate@@QAEXH_N@Z @ 14048 NONAME ; void QTreeViewPrivate::expand(int, bool) + ?removeViewItems@QTreeViewPrivate@@QAEXHH@Z @ 14049 NONAME ; void QTreeViewPrivate::removeViewItems(int, int) + ?drawAnimatedOperation@QTreeViewPrivate@@QBEXPAVQPainter@@@Z @ 14050 NONAME ; void QTreeViewPrivate::drawAnimatedOperation(class QPainter *) const + ?firstVisibleItem@QTreeViewPrivate@@QBEHPAH@Z @ 14051 NONAME ; int QTreeViewPrivate::firstVisibleItem(int *) const + ?hasFamily@QFontDatabase@@QBE_NABVQString@@@Z @ 14052 NONAME ; bool QFontDatabase::hasFamily(class QString const &) const + ?insertViewItems@QTreeViewPrivate@@QAEXHHABUQTreeViewItem@@@Z @ 14053 NONAME ; void QTreeViewPrivate::insertViewItems(int, int, struct QTreeViewItem const &) + ??0QTreeViewPrivate@@QAE@XZ @ 14054 NONAME ; QTreeViewPrivate::QTreeViewPrivate(void) + ??_EQTreeViewPrivate@@UAE@I@Z @ 14055 NONAME ; QTreeViewPrivate::~QTreeViewPrivate(unsigned int) + ?q_func@QTreeViewPrivate@@ABEPBVQTreeView@@XZ @ 14056 NONAME ; class QTreeView const * QTreeViewPrivate::q_func(void) const + ?viewIndex@QTreeViewPrivate@@QBEHABVQModelIndex@@@Z @ 14057 NONAME ; int QTreeViewPrivate::viewIndex(class QModelIndex const &) const + ?q_func@QTreeViewPrivate@@AAEPAVQTreeView@@XZ @ 14058 NONAME ; class QTreeView * QTreeViewPrivate::q_func(void) + ?updateScrollBars@QTreeViewPrivate@@QAEXXZ @ 14059 NONAME ; void QTreeViewPrivate::updateScrollBars(void) + ?indentationForItem@QTreeViewPrivate@@QBEHH@Z @ 14060 NONAME ; int QTreeViewPrivate::indentationForItem(int) const + ?above@QTreeViewPrivate@@QBEHH@Z @ 14061 NONAME ; int QTreeViewPrivate::above(int) const + ?_q_columnsRemoved@QTreeViewPrivate@@UAEXABVQModelIndex@@HH@Z @ 14062 NONAME ; void QTreeViewPrivate::_q_columnsRemoved(class QModelIndex const &, int, int) + ?columnRanges@QTreeViewPrivate@@QBE?AV?$QList@U?$QPair@HH@@@@ABVQModelIndex@@0@Z @ 14063 NONAME ; class QList > QTreeViewPrivate::columnRanges(class QModelIndex const &, class QModelIndex const &) const + ?_q_modelDestroyed@QTreeViewPrivate@@UAEXXZ @ 14064 NONAME ; void QTreeViewPrivate::_q_modelDestroyed(void) + ?coordinateForItem@QTreeViewPrivate@@QBEHH@Z @ 14065 NONAME ; int QTreeViewPrivate::coordinateForItem(int) const + ?accessibleTable2Index@QTreeViewPrivate@@QBEHABVQModelIndex@@@Z @ 14066 NONAME ; int QTreeViewPrivate::accessibleTable2Index(class QModelIndex const &) const + ?select@QTreeViewPrivate@@QAEXABVQModelIndex@@0V?$QFlags@W4SelectionFlag@QItemSelectionModel@@@@@Z @ 14067 NONAME ; void QTreeViewPrivate::select(class QModelIndex const &, class QModelIndex const &, class QFlags) + ?drawPixmapFragments@QPaintEngineEx@@UAEXPBVQRectF@@0HABVQPixmap@@V?$QFlags@W4PixmapFragmentHint@QPainter@@@@@Z @ 14068 NONAME ; void QPaintEngineEx::drawPixmapFragments(class QRectF const *, class QRectF const *, int, class QPixmap const &, class QFlags) + ?draggablePaintPairs@QTreeViewPrivate@@UBE?AV?$QList@U?$QPair@VQRect@@VQModelIndex@@@@@@ABV?$QList@VQModelIndex@@@@PAVQRect@@@Z @ 14069 NONAME ; class QList > QTreeViewPrivate::draggablePaintPairs(class QList const &, class QRect *) const + ?beginAnimatedOperation@QTreeViewPrivate@@QAEXXZ @ 14070 NONAME ; void QTreeViewPrivate::beginAnimatedOperation(void) + ?columnAt@QTreeViewPrivate@@QBEHH@Z @ 14071 NONAME ; int QTreeViewPrivate::columnAt(int) const + ?pageUp@QTreeViewPrivate@@QBEHH@Z @ 14072 NONAME ; int QTreeViewPrivate::pageUp(int) const + ?isItemHiddenOrDisabled@QTreeViewPrivate@@QBE_NH@Z @ 14073 NONAME ; bool QTreeViewPrivate::isItemHiddenOrDisabled(int) const + ?expandOrCollapseItemAtPos@QTreeViewPrivate@@QAE_NABVQPoint@@@Z @ 14074 NONAME ; bool QTreeViewPrivate::expandOrCollapseItemAtPos(class QPoint const &) + ?paintAlternatingRowColors@QTreeViewPrivate@@QBEXPAVQPainter@@PAVQStyleOptionViewItemV4@@HH@Z @ 14075 NONAME ; void QTreeViewPrivate::paintAlternatingRowColors(class QPainter *, class QStyleOptionViewItemV4 *, int, int) const + ?drawPixmapFragments@QPainter@@QAEXPBVQRectF@@0HABVQPixmap@@V?$QFlags@W4PixmapFragmentHint@QPainter@@@@@Z @ 14076 NONAME ; void QPainter::drawPixmapFragments(class QRectF const *, class QRectF const *, int, class QPixmap const &, class QFlags) + ?itemDecorationRect@QTreeViewPrivate@@QBE?AVQRect@@ABVQModelIndex@@@Z @ 14077 NONAME ; class QRect QTreeViewPrivate::itemDecorationRect(class QModelIndex const &) const + ??1QTreeViewPrivate@@UAE@XZ @ 14078 NONAME ; QTreeViewPrivate::~QTreeViewPrivate(void) + ?storeExpanded@QTreeViewPrivate@@QAE_NABVQPersistentModelIndex@@@Z @ 14079 NONAME ; bool QTreeViewPrivate::storeExpanded(class QPersistentModelIndex const &) + ?hasVisibleChildren@QTreeViewPrivate@@QBE_NABVQModelIndex@@@Z @ 14080 NONAME ; bool QTreeViewPrivate::hasVisibleChildren(class QModelIndex const &) const + ?itemAtCoordinate@QTreeViewPrivate@@QBEHH@Z @ 14081 NONAME ; int QTreeViewPrivate::itemAtCoordinate(int) const + ?renderTreeToPixmapForAnimation@QTreeViewPrivate@@QBE?AVQPixmap@@ABVQRect@@@Z @ 14082 NONAME ; class QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(class QRect const &) const + ?prepareAnimatedOperation@QTreeViewPrivate@@QAEXHW4Direction@QAbstractAnimation@@@Z @ 14083 NONAME ; void QTreeViewPrivate::prepareAnimatedOperation(int, enum QAbstractAnimation::Direction) + ?_q_endAnimatedOperation@QTreeViewPrivate@@QAEXXZ @ 14084 NONAME ; void QTreeViewPrivate::_q_endAnimatedOperation(void) + ?startAndEndColumns@QTreeViewPrivate@@QBE?AU?$QPair@HH@@ABVQRect@@@Z @ 14085 NONAME ; struct QPair QTreeViewPrivate::startAndEndColumns(class QRect const &) const + ?invalidateHeightCache@QTreeViewPrivate@@QBEXH@Z @ 14086 NONAME ; void QTreeViewPrivate::invalidateHeightCache(int) const + ?isIndexExpanded@QTreeViewPrivate@@QBE_NABVQModelIndex@@@Z @ 14087 NONAME ; bool QTreeViewPrivate::isIndexExpanded(class QModelIndex const &) const + ?layout@QTreeViewPrivate@@QAEXH_N0@Z @ 14088 NONAME ; void QTreeViewPrivate::layout(int, bool, bool) + ?cancelPasswordEchoTimer@QLineControl@@AAEXXZ @ 14089 NONAME ; void QLineControl::cancelPasswordEchoTimer(void) + ?collapse@QTreeViewPrivate@@QAEXH_N@Z @ 14090 NONAME ; void QTreeViewPrivate::collapse(int, bool) + ?modelIndex@QTreeViewPrivate@@QBE?AVQModelIndex@@HH@Z @ 14091 NONAME ; class QModelIndex QTreeViewPrivate::modelIndex(int, int) const + ?itemHeight@QTreeViewPrivate@@QBEHH@Z @ 14092 NONAME ; int QTreeViewPrivate::itemHeight(int) const + ?isRowHidden@QTreeViewPrivate@@QBE_NABVQModelIndex@@@Z @ 14093 NONAME ; bool QTreeViewPrivate::isRowHidden(class QModelIndex const &) const + ?_q_sortIndicatorChanged@QTreeViewPrivate@@QAEXHW4SortOrder@Qt@@@Z @ 14094 NONAME ; void QTreeViewPrivate::_q_sortIndicatorChanged(int, enum Qt::SortOrder) + ?pageDown@QTreeViewPrivate@@QBEHH@Z @ 14095 NONAME ; int QTreeViewPrivate::pageDown(int) const + ?_q_modelAboutToBeReset@QTreeViewPrivate@@QAEXXZ @ 14096 NONAME ; void QTreeViewPrivate::_q_modelAboutToBeReset(void) + ?itemDecorationAt@QTreeViewPrivate@@QBEHABVQPoint@@@Z @ 14097 NONAME ; int QTreeViewPrivate::itemDecorationAt(class QPoint const &) const + ?below@QTreeViewPrivate@@QBEHH@Z @ 14098 NONAME ; int QTreeViewPrivate::below(int) const + ?_q_columnsAboutToBeRemoved@QTreeViewPrivate@@UAEXABVQModelIndex@@HH@Z @ 14099 NONAME ; void QTreeViewPrivate::_q_columnsAboutToBeRemoved(class QModelIndex const &, int, int) diff --git a/src/s60installs/bwins/QtSqlu.def b/src/s60installs/bwins/QtSqlu.def index 586850a..3e726e8 100644 --- a/src/s60installs/bwins/QtSqlu.def +++ b/src/s60installs/bwins/QtSqlu.def @@ -470,4 +470,5 @@ EXPORTS ?qt_static_metacall@QSqlRelationalTableModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 469 NONAME ; void QSqlRelationalTableModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?staticMetaObjectExtraData@QSqlRelationalTableModel@@0UQMetaObjectExtraData@@B @ 470 NONAME ; struct QMetaObjectExtraData const QSqlRelationalTableModel::staticMetaObjectExtraData ?qt_static_metacall@QSqlDriverPlugin@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 471 NONAME ; void QSqlDriverPlugin::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?setJoinMode@QSqlRelationalTableModel@@QAEXW4JoinMode@1@@Z @ 472 NONAME ; void QSqlRelationalTableModel::setJoinMode(enum QSqlRelationalTableModel::JoinMode) diff --git a/src/s60installs/bwins/QtTestu.def b/src/s60installs/bwins/QtTestu.def index 486984a..5365850 100644 --- a/src/s60installs/bwins/QtTestu.def +++ b/src/s60installs/bwins/QtTestu.def @@ -170,4 +170,5 @@ EXPORTS ?qt_static_metacall@QTestEventLoop@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 169 NONAME ; void QTestEventLoop::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?startLogging@QTestLog@@SAXI@Z @ 170 NONAME ; void QTestLog::startLogging(unsigned int) ?staticMetaObjectExtraData@QTestEventLoop@@0UQMetaObjectExtraData@@B @ 171 NONAME ; struct QMetaObjectExtraData const QTestEventLoop::staticMetaObjectExtraData + ?printAvailableTags@QTest@@3_NA @ 172 NONAME ; bool QTest::printAvailableTags diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index f0bf9fc..3abcf98 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -4163,4 +4163,6 @@ EXPORTS _ZNK5QUuid11toByteArrayEv @ 4162 NONAME _ZNK5QUuid9toRfc4122Ev @ 4163 NONAME _ZN18QAbstractItemModel17resetInternalDataEv @ 4164 NONAME + _ZNK7QLocale7toLowerERK7QString @ 4165 NONAME + _ZNK7QLocale7toUpperERK7QString @ 4166 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 01b3772..38c67b9 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12758,4 +12758,45 @@ EXPORTS _ZN5QFont12setStyleNameERK7QString @ 12757 NONAME _ZNK5QFont9styleNameEv @ 12758 NONAME _ZNK9QFontInfo9styleNameEv @ 12759 NONAME + _ZN14QPaintEngineEx19drawPixmapFragmentsEPK6QRectFS2_iRK7QPixmap6QFlagsIN8QPainter18PixmapFragmentHintEE @ 12760 NONAME + _ZN16QTreeViewPrivate10initializeEv @ 12761 NONAME + _ZN16QTreeViewPrivate15insertViewItemsEiiRK13QTreeViewItem @ 12762 NONAME + _ZN16QTreeViewPrivate15removeViewItemsEii @ 12763 NONAME + _ZN16QTreeViewPrivate16updateScrollBarsEv @ 12764 NONAME + _ZN16QTreeViewPrivate17_q_columnsRemovedERK11QModelIndexii @ 12765 NONAME + _ZN16QTreeViewPrivate17_q_modelDestroyedEv @ 12766 NONAME + _ZN16QTreeViewPrivate22_q_modelAboutToBeResetEv @ 12767 NONAME + _ZN16QTreeViewPrivate22beginAnimatedOperationEv @ 12768 NONAME + _ZN16QTreeViewPrivate23_q_endAnimatedOperationEv @ 12769 NONAME + _ZN16QTreeViewPrivate23_q_sortIndicatorChangedEiN2Qt9SortOrderE @ 12770 NONAME + _ZN16QTreeViewPrivate24prepareAnimatedOperationEiN18QAbstractAnimation9DirectionE @ 12771 NONAME + _ZN16QTreeViewPrivate25expandOrCollapseItemAtPosERK6QPoint @ 12772 NONAME + _ZN16QTreeViewPrivate26_q_columnsAboutToBeRemovedERK11QModelIndexii @ 12773 NONAME + _ZN16QTreeViewPrivate6expandEib @ 12774 NONAME + _ZN16QTreeViewPrivate6layoutEibb @ 12775 NONAME + _ZN16QTreeViewPrivate6selectERK11QModelIndexS2_6QFlagsIN19QItemSelectionModel13SelectionFlagEE @ 12776 NONAME + _ZN16QTreeViewPrivate8collapseEib @ 12777 NONAME + _ZN8QPainter19drawPixmapFragmentsEPK6QRectFS2_iRK7QPixmap6QFlagsINS_18PixmapFragmentHintEE @ 12778 NONAME + _ZNK13QFontDatabase9hasFamilyERK7QString @ 12779 NONAME + _ZNK16QTreeViewPrivate10itemHeightEi @ 12780 NONAME + _ZNK16QTreeViewPrivate10modelIndexEii @ 12781 NONAME + _ZNK16QTreeViewPrivate12columnRangesERK11QModelIndexS2_ @ 12782 NONAME + _ZNK16QTreeViewPrivate16firstVisibleItemEPi @ 12783 NONAME + _ZNK16QTreeViewPrivate16itemAtCoordinateEi @ 12784 NONAME + _ZNK16QTreeViewPrivate16itemDecorationAtERK6QPoint @ 12785 NONAME + _ZNK16QTreeViewPrivate17coordinateForItemEi @ 12786 NONAME + _ZNK16QTreeViewPrivate18hasVisibleChildrenERK11QModelIndex @ 12787 NONAME + _ZNK16QTreeViewPrivate18indentationForItemEi @ 12788 NONAME + _ZNK16QTreeViewPrivate18itemDecorationRectERK11QModelIndex @ 12789 NONAME + _ZNK16QTreeViewPrivate18startAndEndColumnsERK5QRect @ 12790 NONAME + _ZNK16QTreeViewPrivate19draggablePaintPairsERK5QListI11QModelIndexEP5QRect @ 12791 NONAME + _ZNK16QTreeViewPrivate21drawAnimatedOperationEP8QPainter @ 12792 NONAME + _ZNK16QTreeViewPrivate25paintAlternatingRowColorsEP8QPainterP22QStyleOptionViewItemV4ii @ 12793 NONAME + _ZNK16QTreeViewPrivate30renderTreeToPixmapForAnimationERK5QRect @ 12794 NONAME + _ZNK16QTreeViewPrivate6pageUpEi @ 12795 NONAME + _ZNK16QTreeViewPrivate8columnAtEi @ 12796 NONAME + _ZNK16QTreeViewPrivate8pageDownEi @ 12797 NONAME + _ZNK16QTreeViewPrivate9viewIndexERK11QModelIndex @ 12798 NONAME + _ZTI16QTreeViewPrivate @ 12799 NONAME + _ZTV16QTreeViewPrivate @ 12800 NONAME diff --git a/src/s60installs/eabi/QtSqlu.def b/src/s60installs/eabi/QtSqlu.def index 21782b8..4867d10 100644 --- a/src/s60installs/eabi/QtSqlu.def +++ b/src/s60installs/eabi/QtSqlu.def @@ -477,4 +477,5 @@ EXPORTS _ZN16QSqlDriverPlugin25staticMetaObjectExtraDataE @ 476 NONAME DATA 8 _ZN24QSqlRelationalTableModel18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 477 NONAME _ZN24QSqlRelationalTableModel25staticMetaObjectExtraDataE @ 478 NONAME DATA 8 + _ZN24QSqlRelationalTableModel11setJoinModeENS_8JoinModeE @ 479 NONAME diff --git a/src/s60installs/eabi/QtTestu.def b/src/s60installs/eabi/QtTestu.def index ce98aa6..454292c 100644 --- a/src/s60installs/eabi/QtTestu.def +++ b/src/s60installs/eabi/QtTestu.def @@ -166,4 +166,5 @@ EXPORTS _ZN8QTestLog12startLoggingEj @ 165 NONAME _ZN14QTestEventLoop18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 166 NONAME _ZN14QTestEventLoop25staticMetaObjectExtraDataE @ 167 NONAME DATA 8 + _ZN5QTest18printAvailableTagsE @ 168 NONAME DATA 1 -- cgit v0.12 From b997613ebea79f28631bef3e6dd6dde8ebd65e06 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 5 Aug 2011 12:56:15 +0300 Subject: Fix bad merge on a couple of xml examples Reviewed-by: mread --- examples/xml/dombookmarks/dombookmarks.pro | 4 +--- examples/xml/streambookmarks/streambookmarks.pro | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/xml/dombookmarks/dombookmarks.pro b/examples/xml/dombookmarks/dombookmarks.pro index 374d9e3..1cee772 100644 --- a/examples/xml/dombookmarks/dombookmarks.pro +++ b/examples/xml/dombookmarks/dombookmarks.pro @@ -11,11 +11,9 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS dombookmarks.pro *.xbel sources.path = $$[QT_INSTALL_EXAMPLES]/xml/dombookmarks INSTALLS += target sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - symbian: { include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - addFiles.sources = frank.xbel jennifer.xbel + addFiles.files = frank.xbel jennifer.xbel addFiles.path = files DEPLOYMENT += addFiles } diff --git a/examples/xml/streambookmarks/streambookmarks.pro b/examples/xml/streambookmarks/streambookmarks.pro index 0f2d55d..822a1ca 100644 --- a/examples/xml/streambookmarks/streambookmarks.pro +++ b/examples/xml/streambookmarks/streambookmarks.pro @@ -15,7 +15,7 @@ INSTALLS += target sources symbian: { include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - addFiles.sources = frank.xbel jennifer.xbel + addFiles.files = frank.xbel jennifer.xbel addFiles.path = /data/qt/streambookmarks DEPLOYMENT += addFiles } -- cgit v0.12 From 99cd47972d4d231f787daf0f647397df7194af68 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 5 Aug 2011 13:35:39 +0100 Subject: Fixed Symbian memory leak in utcToLocal(QDate &, QTime &) RTz::GetTimeZoneIdL() returns a CTzId object which the client has to own. But in utcToLocal(QDate &, QTime &) it was being used anonymously and forgotten. Task-number: QTBUG-20765 Reviewed-by: Shane Kearns --- src/corelib/tools/qdatetime.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index a6fee43..d915989 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4040,8 +4040,11 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) RTz tz; User::LeaveIfError(tz.Connect()); CleanupClosePushL(tz); - res.tm_isdst = tz.IsDaylightSavingOnL(*tz.GetTimeZoneIdL(),utcTTime); + CTzId *tzId = tz.GetTimeZoneIdL(); + CleanupStack::PushL(tzId); + res.tm_isdst = tz.IsDaylightSavingOnL(*tzId,utcTTime); User::LeaveIfError(tz.ConvertToLocalTime(utcTTime)); + CleanupStack::PopAndDestroy(tzId); CleanupStack::PopAndDestroy(&tz)); if (KErrNone == err) { TDateTime localDateTime = utcTTime.DateTime(); -- cgit v0.12 From fcf9f68cb9b4264fe03b4cffd9fd169f73ce32b5 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 5 Aug 2011 14:45:59 +0100 Subject: Reimplement MR1271 over coda patch This restores the option to upload files to arbritrary locations. Reviewed-By: mread --- tools/runonphone/main.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index 868a2a8..af349eb 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -65,7 +65,7 @@ void printUsage(QTextStream& outstream, QString exeName) << "-t, --timeout terminate test if timeout occurs" << endl << "-v, --verbose show debugging output" << endl << "-q, --quiet hide progress messages" << endl - << "-u, --upload upload executable file to phone" << endl + << "-u, --upload upload file to phone" << endl << "-d, --download copy file from phone to PC after running test" << endl << "--nocrashlog Don't capture call stack if test crashes" << endl << "--crashlogpath Path to save crash logs (default=working dir)" << endl @@ -91,6 +91,7 @@ int main(int argc, char *argv[]) QTextStream outstream(stdout); QTextStream errstream(stderr); QString uploadLocalFile; + QString uploadRemoteFile; QString downloadRemoteFile; QString downloadLocalFile; int loglevel=1; @@ -127,10 +128,8 @@ int main(int argc, char *argv[]) errstream << "Executable file (" << uploadLocalFile << ") doesn't exist" << endl; return 1; } - if (!(QFileInfo(uploadLocalFile).suffix() == "exe")) { - errstream << "File (" << uploadLocalFile << ") must be an executable" << endl; - return 1; - } + CHECK_PARAMETER_EXISTS + uploadRemoteFile = it.next(); } else if (arg == "--download" || arg == "-d") { CHECK_PARAMETER_EXISTS @@ -174,7 +173,8 @@ int main(int argc, char *argv[]) } } - if (exeFile.isEmpty() && sisFile.isEmpty() && uploadLocalFile.isEmpty() && + if (exeFile.isEmpty() && sisFile.isEmpty() && + (uploadLocalFile.isEmpty() || uploadRemoteFile.isEmpty()) && (downloadLocalFile.isEmpty() || downloadRemoteFile.isEmpty())) { printUsage(outstream, args[0]); return 1; @@ -230,8 +230,7 @@ int main(int argc, char *argv[]) } else if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) { codaHandler.setActionType(ActionCopy); - QString dstName = QString("c:\\sys\\bin\\") + uploadInfo.fileName(); - codaHandler.setCopyFileName(uploadLocalFile, dstName); + codaHandler.setCopyFileName(uploadLocalFile, uploadRemoteFile); } if (!exeFile.isEmpty()) { codaHandler.setActionType(ActionRun); @@ -254,19 +253,20 @@ int main(int argc, char *argv[]) } else { launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly)); + QStringList srcNames, dstNames; if (!sisFile.isEmpty()) { launcher->addStartupActions(trk::Launcher::ActionCopyInstall); - QStringList srcName(sisFile); - QStringList dstName("c:\\data\\testtemp.sis"); - launcher->setCopyFileNames(srcName, dstName); - launcher->setInstallFileNames(dstName); + srcNames.append(sisFile); + QLatin1String dstName("c:\\data\\testtemp.sis"); + dstNames.append(dstName); + launcher->setInstallFileNames(QStringList(dstName)); } - else if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) { + if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) { launcher->addStartupActions(trk::Launcher::ActionCopy); - QStringList srcName(uploadLocalFile); - QStringList dstName(QString("c:\\sys\\bin\\") + uploadInfo.fileName()); - launcher->setCopyFileNames(srcName, dstName); + srcNames.append(uploadLocalFile); + dstNames.append(uploadRemoteFile); } + launcher->setCopyFileNames(srcNames, dstNames); if (!exeFile.isEmpty()) { launcher->addStartupActions(trk::Launcher::ActionRun); launcher->setFileName(QString("c:\\sys\\bin\\") + info.fileName()); -- cgit v0.12 From 274c91dd5374f21140f2fe8ed411a0d2f99ad50f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 10 Aug 2011 13:29:51 +0300 Subject: Fix warning about missing qs60keycapture_p.h header in gui The qs60keycapture_p.h header was added twice to HEADERS, once properly and once without path. The latter caused a warning about nonexistent header, so removed that. Reviewed-by: TrustMe --- src/gui/s60framework/s60framework.pri | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index e30d2c0..4e94c21 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -2,8 +2,7 @@ SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ s60framework/qs60maindocument.cpp \ s60framework/qs60keycapture.cpp -HEADERS += qs60keycapture_p.h \ - s60framework/qs60mainapplication_p.h \ +HEADERS += s60framework/qs60mainapplication_p.h \ s60framework/qs60mainapplication.h \ s60framework/qs60mainappui.h \ s60framework/qs60maindocument.h \ -- cgit v0.12 From d69788728ccd843e3d4a372680185fdf5e711c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:35:55 +0200 Subject: Encapsulate pointer manipulations to createFileTemplate function , where we actually control how we use the pointers. Reduce some code duplication in #ifdefs. --- src/corelib/io/qtemporaryfile.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index d457601..9228f94 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -96,18 +96,22 @@ QT_BEGIN_NAMESPACE \internal Generates a unique file path and returns a native handle to the open file. - \a path is used as a template when generating unique paths, - \a placeholderStart and \a placeholderEnd delimit the sub-string that will - be randomized. + \a path is used as a template when generating unique paths, \a pos + identifies the position of the first character that will be replaced in the + template and \a length the number of characters that may be substituted. Returns an open handle to the newly created file if successful, an invalid handle otherwise. In both cases, the string in \a path will be changed and contain the generated path name. */ -static int createFileFromTemplate(char *const path, - char *const placeholderStart, char *const placeholderEnd) +static int createFileFromTemplate(QByteArray &path, size_t pos, size_t length) { - Q_ASSERT(placeholderEnd > placeholderStart); + Q_ASSERT(length != 0); + Q_ASSERT(pos < size_t(path.length())); + Q_ASSERT(length < size_t(path.length()) - pos); + + char *const placeholderStart = path.data() + pos; + char *const placeholderEnd = placeholderStart + length; // Initialize placeholder with random chars + PID. { @@ -134,14 +138,16 @@ static int createFileFromTemplate(char *const path, // Atomically create file and obtain handle #ifndef Q_OS_WIN { - int fd = QT_OPEN(path, QT_OPEN_CREAT | O_EXCL | QT_OPEN_RDWR | QT_OPEN_LARGEFILE, 0600); + int fd = QT_OPEN(path.constData(), + QT_OPEN_CREAT | O_EXCL | QT_OPEN_RDWR | QT_OPEN_LARGEFILE, + 0600); if (fd != -1) return fd; if (errno != EEXIST) return -1; } #else - if (!QFileInfo(QString::fromLocal8Bit(path)).exists()) + if (!QFileInfo(QString::fromLocal8Bit(path.constData(), path.length())).exists()) return 1; #endif @@ -295,10 +301,9 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) else filename.insert(phPos + phLength, suffix.toLocal8Bit()); - char *path = filename.data(); + int fd = createFileFromTemplate(filename, phPos, phLength); #ifndef Q_OS_WIN - int fd = createFileFromTemplate(path, path + phPos, path + phPos + phLength); if (fd != -1) { // First open the fd as an external file descriptor to // initialize the engine properly. @@ -308,7 +313,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) d->closeFileHandle = true; // Restore the file names (open() resets them). - d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(path, filename.length())); //note that filename is NOT a native path + d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(filename.constData(), filename.length())); //note that filename is NOT a native path filePathIsTemplate = false; return true; } @@ -318,13 +323,11 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, qt_error_string(errno)); return false; #else - if (createFileFromTemplate(path, path + phPos, path + phPos + phLength) == -1) { + if (fd == -1) return false; - } QString template_ = d->fileEntry.filePath(); - d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(path, filename.length())); - + d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(filename.constData(), filename.length())); if (QFSFileEngine::open(openMode)) { filePathIsTemplate = false; return true; -- cgit v0.12 From 63bb67d3107b03f399cddf4c9cca9c7eb347b62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:39:53 +0200 Subject: Make Symbian follow Windows code in temporary path generation On the one hand, we stop using OpenC here. On the other, we no longer use an atomic create and obtain file handle API -- just as we don't on Windows yet. This is a stepping stone to removing back and forth conversions of path names when generating unique names and also towards the use of native APIs for creating and obtaining a file handle atomically. Reviewed-by: Gareth Stockwell Reviewed-by: Shane Kearns --- src/corelib/io/qtemporaryfile.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 9228f94..497faad 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -49,12 +49,9 @@ #include "private/qabstractfileengine_p.h" #include "private/qfsfileengine_p.h" -#if !defined(Q_OS_WINCE) -# include -#endif - -#if defined(Q_OS_UNIX) -# include "private/qcore_unix_p.h" // overrides QT_OPEN +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) +#include "private/qcore_unix_p.h" // overrides QT_OPEN +#include #endif #if defined(QT_BUILD_CORE_LIB) @@ -136,7 +133,7 @@ static int createFileFromTemplate(QByteArray &path, size_t pos, size_t length) for (;;) { // Atomically create file and obtain handle -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) { int fd = QT_OPEN(path.constData(), QT_OPEN_CREAT | O_EXCL | QT_OPEN_RDWR | QT_OPEN_LARGEFILE, @@ -303,7 +300,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) int fd = createFileFromTemplate(filename, phPos, phLength); -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) if (fd != -1) { // First open the fd as an external file descriptor to // initialize the engine properly. -- cgit v0.12 From d71d3b1ce31ffc585258330d825ff8ea535254ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:57:19 +0200 Subject: Use QStringBuilder when copying template for modification This avoids modifying the original string in the case where a placeholder marker is not found. By marking the variable const we further avoid checks on the reference count and detaches, also allowing us to safely reuse it later in the function. The new approach also fixes an issue where suffix wasn't empty, but the toLocal8Bit conversion would be. This resulted in a buffer overflow inside createFileFromTemplate. Reviewed-by: Shane Kearns --- src/corelib/io/qtemporaryfile.cpp | 62 +++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 497faad..b079d3e 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -45,6 +45,7 @@ #include "qplatformdefs.h" #include "qabstractfileengine.h" +#include "qstringbuilder.h" #include "private/qfile_p.h" #include "private/qabstractfileengine_p.h" #include "private/qfsfileengine_p.h" @@ -60,6 +61,38 @@ QT_BEGIN_NAMESPACE +struct Placeholder +{ + Placeholder(int size) + : size_(size) + { + } + + int size() const + { + return size_; + } + +private: + int size_; +}; + +template <> +struct QConcatenable +{ + typedef Placeholder type; + typedef QByteArray ConvertTo; + enum { ExactSize = true }; + static int size(const Placeholder &p) { return p.size(); } + + template + static inline void appendTo(const Placeholder &p, CharT *&out) + { + // Uninitialized + out += p.size(); + } +}; + /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. @@ -258,7 +291,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (!filePathIsTemplate) return QFSFileEngine::open(openMode); - QString qfilename = d->fileEntry.filePath(); + const QString qfilename = d->fileEntry.filePath(); // Find placeholder string. uint phPos = qfilename.length(); @@ -281,22 +314,22 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) phLength = 0; } - QStringRef prefix, suffix; + QByteArray filename; + if (phLength < 6) { - qfilename += QLatin1Char('.'); - prefix = QStringRef(&qfilename); + filename = qfilename.toLocal8Bit(); + + phPos = filename.length() + 1; // Account for added dot in prefix phLength = 6; + filename = filename % '.' % Placeholder(phLength); } else { - prefix = qfilename.leftRef(phPos); - suffix = qfilename.midRef(phPos + phLength); - } + QByteArray prefix, suffix; + prefix = qfilename.leftRef(phPos).toLocal8Bit(); + suffix = qfilename.midRef(phPos + phLength).toLocal8Bit(); - QByteArray filename = prefix.toLocal8Bit(); - phPos = filename.length(); - if (suffix.isEmpty()) - filename.resize(phPos + phLength); - else - filename.insert(phPos + phLength, suffix.toLocal8Bit()); + phPos = prefix.length(); + filename = prefix % Placeholder(phLength) % suffix; + } int fd = createFileFromTemplate(filename, phPos, phLength); @@ -323,14 +356,13 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (fd == -1) return false; - QString template_ = d->fileEntry.filePath(); d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(filename.constData(), filename.length())); if (QFSFileEngine::open(openMode)) { filePathIsTemplate = false; return true; } - d->fileEntry = QFileSystemEntry(template_, QFileSystemEntry::FromInternalPath()); + d->fileEntry = QFileSystemEntry(qfilename, QFileSystemEntry::FromInternalPath()); return false; #endif } -- cgit v0.12 From 9a76587363a2f37312326286e08cce502f7fe27e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:58:08 +0200 Subject: Minimize encoding conversions when generating unique file name With minor adjustments, createFileFromTemplate is made to work directly on (UTF-16) QString data, which is already in the native encoding for Windows and Symbian. This is possible because the function only fills out the placeholder sub-string, without touching adjacent characters. This eliminates unnecessary conversions on those platforms. Reviewed-by: Gareth Stockwell Reviewed-by: Shane Kearns --- src/corelib/io/qtemporaryfile.cpp | 69 ++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index b079d3e..e4c53aa 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -61,6 +61,33 @@ QT_BEGIN_NAMESPACE +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) +typedef ushort Char; + +static inline Char Latin1Char(char ch) +{ + return ushort(uchar(ch)); +} + +template <> +struct QConcatenable +{ + typedef Char type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static int size(const Char &) { return 1; } + + static inline void appendTo(const Char &u16, QChar *&out) + { + *out++ = QChar(u16); + } +}; + +#else // POSIX +typedef char Char; +typedef char Latin1Char; +#endif + struct Placeholder { Placeholder(int size) @@ -134,23 +161,24 @@ struct QConcatenable handle otherwise. In both cases, the string in \a path will be changed and contain the generated path name. */ -static int createFileFromTemplate(QByteArray &path, size_t pos, size_t length) +static int createFileFromTemplate(QFileSystemEntry::NativePath &path, + size_t pos, size_t length) { Q_ASSERT(length != 0); Q_ASSERT(pos < size_t(path.length())); Q_ASSERT(length < size_t(path.length()) - pos); - char *const placeholderStart = path.data() + pos; - char *const placeholderEnd = placeholderStart + length; + Char *const placeholderStart = (Char *)path.data() + pos; + Char *const placeholderEnd = placeholderStart + length; // Initialize placeholder with random chars + PID. { - char *rIter = placeholderEnd; + Char *rIter = placeholderEnd; #if defined(QT_BUILD_CORE_LIB) quint64 pid = quint64(QCoreApplication::applicationPid()); do { - *--rIter = (pid % 10) + '0'; + *--rIter = Latin1Char((pid % 10) + '0'); pid /= 10; } while (rIter != placeholderStart && pid != 0); #endif @@ -158,9 +186,9 @@ static int createFileFromTemplate(QByteArray &path, size_t pos, size_t length) while (rIter != placeholderStart) { char ch = char((qrand() & 0xffff) % (26 + 26)); if (ch < 26) - *--rIter = ch + 'A'; + *--rIter = Latin1Char(ch + 'A'); else - *--rIter = ch - 26 + 'a'; + *--rIter = Latin1Char(ch - 26 + 'a'); } } @@ -177,18 +205,18 @@ static int createFileFromTemplate(QByteArray &path, size_t pos, size_t length) return -1; } #else - if (!QFileInfo(QString::fromLocal8Bit(path.constData(), path.length())).exists()) + if (!QFileInfo(path).exists()) return 1; #endif /* tricky little algorwwithm for backward compatibility */ - for (char *iter = placeholderStart;;) { + for (Char *iter = placeholderStart;;) { // Character progression: [0-9] => 'a' ... 'z' => 'A' .. 'Z' // String progression: "ZZaiC" => "aabiC" - switch (*iter) { + switch (char(*iter)) { case 'Z': // Rollover, advance next character - *iter = 'a'; + *iter = Latin1Char('a'); if (++iter == placeholderEnd) return -1; @@ -196,12 +224,12 @@ static int createFileFromTemplate(QByteArray &path, size_t pos, size_t length) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - *iter = 'a'; + *iter = Latin1Char('a'); break; case 'z': // increment 'z' to 'A' - *iter = 'A'; + *iter = Latin1Char('A'); break; default: @@ -314,8 +342,9 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) phLength = 0; } - QByteArray filename; + QFileSystemEntry::NativePath filename; +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) if (phLength < 6) { filename = qfilename.toLocal8Bit(); @@ -330,6 +359,16 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) phPos = prefix.length(); filename = prefix % Placeholder(phLength) % suffix; } +#else + if (phLength < 6) { + phPos = qfilename.length() + 1; // Account for added dot in prefix + phLength = 6; + filename = qfilename % Latin1Char('.') % Placeholder(phLength); + } else + filename = qfilename; + + // No native separators, not a "native path" +#endif int fd = createFileFromTemplate(filename, phPos, phLength); @@ -356,7 +395,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (fd == -1) return false; - d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(filename.constData(), filename.length())); + d->fileEntry = QFileSystemEntry(filename, QFileSystemEntry::FromInternalPath()); if (QFSFileEngine::open(openMode)) { filePathIsTemplate = false; return true; -- cgit v0.12 From ff9b69838ec146aeb43d4af8a03043f9c5f0454d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:45:08 +0200 Subject: Atomic implementation of create file and obtain handle for Win/Symbian Besides generating a unique name, createFileFromTemplate now also acquires a file handle on all platforms. The file engine's native handle is passed by reference and modified in place. This fixes a long standing security issue on Windows. On Windows and Symbian platforms we directly use the "native" file path when processing the template and generating the unique name. Since the native encoding is known, conversions at this point are safe. Errors other than "file exists" are propagated to Q(Temporary)File, and result in a failure in open(). The changes also unify error handling and should give consistent behaviour across all platforms. Worthy of note, there's a change in behaviour on Windows and Symbian: fileNames returned by QTemporaryFile on Windows and Symbian are always absolute after open has been called. This has to do with how QFileSystemEntry::nativeFilePath works on these platforms. (Test was updated to reflect change in behaviour.) Reviewed-by: Gareth Stockwell Reviewed-by: Shane Kearns --- src/corelib/io/qtemporaryfile.cpp | 151 +++++++++++++++-------- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 31 +++-- 2 files changed, 122 insertions(+), 60 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index e4c53aa..cd6ab40 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -49,6 +49,11 @@ #include "private/qfile_p.h" #include "private/qabstractfileengine_p.h" #include "private/qfsfileengine_p.h" +#include "private/qsystemerror_p.h" + +#if defined(Q_OS_SYMBIAN) +#include "private/qcore_symbian_p.h" +#endif #if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) #include "private/qcore_unix_p.h" // overrides QT_OPEN @@ -83,9 +88,20 @@ struct QConcatenable } }; +# ifdef Q_OS_WIN +typedef HANDLE NativeFileHandle; +# else // Q_OS_SYMBIAN +# ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +typedef RFile64 NativeFileHandle; +# else +typedef RFile NativeFileHandle; +# endif +# endif + #else // POSIX typedef char Char; typedef char Latin1Char; +typedef int NativeFileHandle; #endif struct Placeholder @@ -161,8 +177,9 @@ struct QConcatenable handle otherwise. In both cases, the string in \a path will be changed and contain the generated path name. */ -static int createFileFromTemplate(QFileSystemEntry::NativePath &path, - size_t pos, size_t length) +static bool createFileFromTemplate(NativeFileHandle &file, + QFileSystemEntry::NativePath &path, size_t pos, size_t length, + QSystemError &error) { Q_ASSERT(length != 0); Q_ASSERT(pos < size_t(path.length())); @@ -192,21 +209,50 @@ static int createFileFromTemplate(QFileSystemEntry::NativePath &path, } } +#ifdef Q_OS_SYMBIAN + RFs& fs = qt_s60GetRFs(); +#endif + for (;;) { // Atomically create file and obtain handle -#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) - { - int fd = QT_OPEN(path.constData(), - QT_OPEN_CREAT | O_EXCL | QT_OPEN_RDWR | QT_OPEN_LARGEFILE, - 0600); - if (fd != -1) - return fd; - if (errno != EEXIST) - return -1; +#if defined(Q_OS_WIN) + file = CreateFile((const wchar_t *)path.constData(), + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_NEW, + FILE_ATTRIBUTE_NORMAL, NULL); + + if (file != INVALID_HANDLE_VALUE) + return true; + + DWORD err = GetLastError(); + if (err != ERROR_FILE_EXISTS) { + error = QSystemError(err, QSystemError::NativeError); + return false; + } +#elif defined(Q_OS_SYMBIAN) + TInt err = file.Create(fs, qt_QString2TPtrC(path), + EFileRead | EFileWrite | EFileShareReadersOrWriters); + + if (err == KErrNone) + return true; + + if (err != KErrAlreadyExists) { + error = QSystemError(err, QSystemError::NativeError); + return false; + } +#else // POSIX + file = QT_OPEN(path.constData(), + QT_OPEN_CREAT | O_EXCL | QT_OPEN_RDWR | QT_OPEN_LARGEFILE, + 0600); + + if (file != -1) + return true; + + int err = errno; + if (err != EEXIST) { + error = QSystemError(err, QSystemError::NativeError); + return false; } -#else - if (!QFileInfo(path).exists()) - return 1; #endif /* tricky little algorwwithm for backward compatibility */ @@ -217,8 +263,11 @@ static int createFileFromTemplate(QFileSystemEntry::NativePath &path, case 'Z': // Rollover, advance next character *iter = Latin1Char('a'); - if (++iter == placeholderEnd) - return -1; + if (++iter == placeholderEnd) { + // Out of alternatives. Return file exists error, previously set. + error = QSystemError(err, QSystemError::NativeError); + return false; + } continue; @@ -319,7 +368,14 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (!filePathIsTemplate) return QFSFileEngine::open(openMode); - const QString qfilename = d->fileEntry.filePath(); + const QString qfilename = +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) + // Since the native encoding is out of our control, we need to process + // the path as UTF-16 before doing any conversions + d->fileEntry.filePath(); +#else + d->fileEntry.nativeFilePath(); +#endif // Find placeholder string. uint phPos = qfilename.length(); @@ -333,8 +389,14 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) continue; } - if (qfilename[phPos] == QLatin1Char('/') - || phLength >= 6) { + if (phLength >= 6 + || qfilename[phPos] == +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) + QLatin1Char('/') +#else + QLatin1Char('\\') +#endif + ) { ++phPos; break; } @@ -366,44 +428,35 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) filename = qfilename % Latin1Char('.') % Placeholder(phLength); } else filename = qfilename; - - // No native separators, not a "native path" #endif - int fd = createFileFromTemplate(filename, phPos, phLength); + QSystemError error; +#if defined(Q_OS_WIN) + NativeFileHandle &file = d->fileHandle; +#elif defined(Q_OS_SYMBIAN) + NativeFileHandle &file = d->symbianFile; +#else // POSIX + NativeFileHandle &file = d->fd; +#endif -#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) - if (fd != -1) { - // First open the fd as an external file descriptor to - // initialize the engine properly. - if (QFSFileEngine::open(openMode, fd)) { + if (!createFileFromTemplate(file, filename, phPos, phLength, error)) { + setError(QFile::OpenError, error.toString()); + return false; + } - // Allow the engine to close the handle even if it's "external". - d->closeFileHandle = true; + d->fileEntry = QFileSystemEntry(filename, QFileSystemEntry::FromNativePath()); - // Restore the file names (open() resets them). - d->fileEntry = QFileSystemEntry(QString::fromLocal8Bit(filename.constData(), filename.length())); //note that filename is NOT a native path - filePathIsTemplate = false; - return true; - } +#if !defined(Q_OS_WIN) + d->closeFileHandle = true; +#endif - QT_CLOSE(fd); - } - setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, qt_error_string(errno)); - return false; -#else - if (fd == -1) - return false; + filePathIsTemplate = false; - d->fileEntry = QFileSystemEntry(filename, QFileSystemEntry::FromInternalPath()); - if (QFSFileEngine::open(openMode)) { - filePathIsTemplate = false; - return true; - } + d->openMode = openMode; + d->lastFlushFailed = false; + d->tried_stat = 0; - d->fileEntry = QFileSystemEntry(qfilename, QFileSystemEntry::FromInternalPath()); - return false; -#endif + return true; } bool QTemporaryFileEngine::remove() diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 2edb93a..05fee95 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -201,11 +201,12 @@ void tst_QTemporaryFile::fileTemplate() QCOMPARE(file.open(), true); + QString fileName = QFileInfo(file).fileName(); if (prefix.length()) - QCOMPARE(file.fileName().left(prefix.length()), prefix); + QCOMPARE(fileName.left(prefix.length()), prefix); if (suffix.length()) - QCOMPARE(file.fileName().right(suffix.length()), suffix); + QCOMPARE(fileName.right(suffix.length()), suffix); } @@ -701,20 +702,28 @@ void tst_QTemporaryFile::QTBUG_4796() << file5.fileName() << file6.fileName(); - QVERIFY(file1.fileName().startsWith(fileTemplate1 + QLatin1Char('.'))); - QVERIFY(file2.fileName().startsWith(fileTemplate2 + QLatin1Char('.'))); - QVERIFY(file5.fileName().startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.'))); - QVERIFY(file6.fileName().startsWith("test-XXXXXX/" + prefix)); + QDir currentDir; + QString fileName1 = currentDir.relativeFilePath(file1.fileName()); + QString fileName2 = currentDir.relativeFilePath(file2.fileName()); + QString fileName3 = currentDir.relativeFilePath(file3.fileName()); + QString fileName4 = currentDir.relativeFilePath(file4.fileName()); + QString fileName5 = currentDir.relativeFilePath(file5.fileName()); + QString fileName6 = currentDir.relativeFilePath(file6.fileName()); + + QVERIFY(fileName1.startsWith(fileTemplate1 + QLatin1Char('.'))); + QVERIFY(fileName2.startsWith(fileTemplate2 + QLatin1Char('.'))); + QVERIFY(fileName5.startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.'))); + QVERIFY(fileName6.startsWith("test-XXXXXX/" + prefix)); if (!prefix.isEmpty()) { - QVERIFY(file3.fileName().startsWith(prefix)); - QVERIFY(file4.fileName().startsWith(prefix)); + QVERIFY(fileName3.startsWith(prefix)); + QVERIFY(fileName4.startsWith(prefix)); } if (!suffix.isEmpty()) { - QVERIFY(file3.fileName().endsWith(suffix)); - QVERIFY(file4.fileName().endsWith(suffix)); - QVERIFY(file6.fileName().endsWith(suffix)); + QVERIFY(fileName3.endsWith(suffix)); + QVERIFY(fileName4.endsWith(suffix)); + QVERIFY(fileName6.endsWith(suffix)); } } } -- cgit v0.12 From d95da2fc82cdd7e5157460157b0895c209852897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 16 Aug 2011 16:02:47 +0200 Subject: Add output on test failure Reviewed-by: Shane Kearns --- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 43 ++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 05fee95..2db5c60 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -412,11 +412,11 @@ void tst_QTemporaryFile::rename() { QTemporaryFile file(dir.filePath("temporary-file.XXXXXX")); - QVERIFY(file.open()); + QVERIFY2(file.open(), qPrintable(file.errorString())); tempname = file.fileName(); QVERIFY(dir.exists(tempname)); - QVERIFY(file.rename("temporary-file.txt")); + QVERIFY2(file.rename("temporary-file.txt"), qPrintable(file.errorString())); QVERIFY(!dir.exists(tempname)); QVERIFY(dir.exists("temporary-file.txt")); QCOMPARE(file.fileName(), QString("temporary-file.txt")); @@ -679,12 +679,21 @@ void tst_QTemporaryFile::QTBUG_4796() QTemporaryFile file5("test-XXXXXX/" + fileTemplate1); QTemporaryFile file6("test-XXXXXX/" + fileTemplate3); - QCOMPARE(file1.open(), openResult); - QCOMPARE(file2.open(), openResult); - QCOMPARE(file3.open(), openResult); - QCOMPARE(file4.open(), openResult); - QCOMPARE(file5.open(), openResult); - QCOMPARE(file6.open(), openResult); + if (openResult) { + QVERIFY2(file1.open(), qPrintable(file1.errorString())); + QVERIFY2(file2.open(), qPrintable(file2.errorString())); + QVERIFY2(file3.open(), qPrintable(file3.errorString())); + QVERIFY2(file4.open(), qPrintable(file4.errorString())); + QVERIFY2(file5.open(), qPrintable(file5.errorString())); + QVERIFY2(file6.open(), qPrintable(file6.errorString())); + } else { + QVERIFY(!file1.open()); + QVERIFY(!file2.open()); + QVERIFY(!file3.open()); + QVERIFY(!file4.open()); + QVERIFY(!file5.open()); + QVERIFY(!file6.open()); + } QCOMPARE(file1.exists(), openResult); QCOMPARE(file2.exists(), openResult); @@ -710,20 +719,20 @@ void tst_QTemporaryFile::QTBUG_4796() QString fileName5 = currentDir.relativeFilePath(file5.fileName()); QString fileName6 = currentDir.relativeFilePath(file6.fileName()); - QVERIFY(fileName1.startsWith(fileTemplate1 + QLatin1Char('.'))); - QVERIFY(fileName2.startsWith(fileTemplate2 + QLatin1Char('.'))); - QVERIFY(fileName5.startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.'))); - QVERIFY(fileName6.startsWith("test-XXXXXX/" + prefix)); + QVERIFY2(fileName1.startsWith(fileTemplate1 + QLatin1Char('.')), qPrintable(file1.fileName())); + QVERIFY2(fileName2.startsWith(fileTemplate2 + QLatin1Char('.')), qPrintable(file2.fileName())); + QVERIFY2(fileName5.startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.')), qPrintable(file5.fileName())); + QVERIFY2(fileName6.startsWith("test-XXXXXX/" + prefix), qPrintable(file6.fileName())); if (!prefix.isEmpty()) { - QVERIFY(fileName3.startsWith(prefix)); - QVERIFY(fileName4.startsWith(prefix)); + QVERIFY2(fileName3.startsWith(prefix), qPrintable(file3.fileName())); + QVERIFY2(fileName4.startsWith(prefix), qPrintable(file4.fileName())); } if (!suffix.isEmpty()) { - QVERIFY(fileName3.endsWith(suffix)); - QVERIFY(fileName4.endsWith(suffix)); - QVERIFY(fileName6.endsWith(suffix)); + QVERIFY2(fileName3.endsWith(suffix), qPrintable(file3.fileName())); + QVERIFY2(fileName4.endsWith(suffix), qPrintable(file4.fileName())); + QVERIFY2(fileName6.endsWith(suffix), qPrintable(file6.fileName())); } } } -- cgit v0.12 From a153d50eea2dea0925695a90af2c12f1887a9020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:47:01 +0200 Subject: Cleanup #includes These are already required and included by qfsfileengine_p.h. --- src/corelib/io/qtemporaryfile.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index cd6ab40..9f7cde2 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -44,10 +44,8 @@ #ifndef QT_NO_TEMPORARYFILE #include "qplatformdefs.h" -#include "qabstractfileengine.h" #include "qstringbuilder.h" #include "private/qfile_p.h" -#include "private/qabstractfileengine_p.h" #include "private/qfsfileengine_p.h" #include "private/qsystemerror_p.h" -- cgit v0.12 From 0de701d01cb221464eed773fd3751aff73fe4d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 5 Aug 2011 10:49:44 +0200 Subject: Use "native paths" on POSIX platforms as well And don't rely solely on "local8Bit" conversions. QFile defines an API for overriding how encoding conversions are done for filenames. In generating unique names, QTemporaryFile ignored that API and hardcoded the use of local 8-bit, implicitly assuming that that was appropriate. With this change, we switch that assumption to one where user supplied encoding function keeps the byte value of 'X' and '/', also assuming that encoded 'X' takes up a single-byte (i.e., the byte sequence for "XXXXXX" remains unchanged). There was also, and there still is an assumption in name generation that byte values for ASCII alpha-numeric characters are valid in the "native" encoding. In practice this change is compatible with UTF-8, Latin-1 and other ISO/IEC 8859 encodings. At any rate, it's very likely that only UTF-8 is relevant here. Reviewed-by: Denis Dzyubenko --- src/corelib/io/qtemporaryfile.cpp | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 9f7cde2..ac5deac 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -366,14 +366,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (!filePathIsTemplate) return QFSFileEngine::open(openMode); - const QString qfilename = -#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) - // Since the native encoding is out of our control, we need to process - // the path as UTF-16 before doing any conversions - d->fileEntry.filePath(); -#else - d->fileEntry.nativeFilePath(); -#endif + const QFileSystemEntry::NativePath qfilename = d->fileEntry.nativeFilePath(); // Find placeholder string. uint phPos = qfilename.length(); @@ -382,7 +375,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) while (phPos != 0) { --phPos; - if (qfilename[phPos] == QLatin1Char('X')) { + if (qfilename[phPos] == Latin1Char('X')) { ++phLength; continue; } @@ -390,7 +383,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (phLength >= 6 || qfilename[phPos] == #if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) - QLatin1Char('/') + '/' #else QLatin1Char('\\') #endif @@ -404,29 +397,12 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) QFileSystemEntry::NativePath filename; -#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) - if (phLength < 6) { - filename = qfilename.toLocal8Bit(); - - phPos = filename.length() + 1; // Account for added dot in prefix - phLength = 6; - filename = filename % '.' % Placeholder(phLength); - } else { - QByteArray prefix, suffix; - prefix = qfilename.leftRef(phPos).toLocal8Bit(); - suffix = qfilename.midRef(phPos + phLength).toLocal8Bit(); - - phPos = prefix.length(); - filename = prefix % Placeholder(phLength) % suffix; - } -#else if (phLength < 6) { phPos = qfilename.length() + 1; // Account for added dot in prefix phLength = 6; filename = qfilename % Latin1Char('.') % Placeholder(phLength); } else filename = qfilename; -#endif QSystemError error; #if defined(Q_OS_WIN) -- cgit v0.12 From 401722ef9e6fe79bd41f9d5f79668f5c4997c8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 16 Aug 2011 17:53:41 +0200 Subject: Fix QTemporaryFile regressions and new found issues With this change, the file template is always processed in original QString format. Trying to generate native paths before adding a missing placeholder mask could change the meaning of templates, such as "." and "..", which are now tested to mean "..XXXXXX" and "...XXXXXX", respectively. After ensuring the template includes a placeholder mask, the path is converted to a native *absolute* file path and the mask is sought for again. On Windows, native paths were already absolute. On Symbian, we'd need at least a clean path, as "." and ",," are not natively understood. There is a requirement that the placeholder mask /XXXXXX+/ makes it through this conversion unaltered, which relaxes prior requirements on *nix platforms. On Windows and Symbian the conversion is under Qt's control and not user-configurable. Reviewed-by: Shane Kearns --- src/corelib/io/qtemporaryfile.cpp | 84 ++++++++++-------------- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 2 + 2 files changed, 36 insertions(+), 50 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index ac5deac..375d07f 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -44,10 +44,10 @@ #ifndef QT_NO_TEMPORARYFILE #include "qplatformdefs.h" -#include "qstringbuilder.h" #include "private/qfile_p.h" #include "private/qfsfileengine_p.h" #include "private/qsystemerror_p.h" +#include "private/qfilesystemengine_p.h" #if defined(Q_OS_SYMBIAN) #include "private/qcore_symbian_p.h" @@ -102,38 +102,6 @@ typedef char Latin1Char; typedef int NativeFileHandle; #endif -struct Placeholder -{ - Placeholder(int size) - : size_(size) - { - } - - int size() const - { - return size_; - } - -private: - int size_; -}; - -template <> -struct QConcatenable -{ - typedef Placeholder type; - typedef QByteArray ConvertTo; - enum { ExactSize = true }; - static int size(const Placeholder &p) { return p.size(); } - - template - static inline void appendTo(const Placeholder &p, CharT *&out) - { - // Uninitialized - out += p.size(); - } -}; - /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. @@ -366,43 +334,59 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (!filePathIsTemplate) return QFSFileEngine::open(openMode); - const QFileSystemEntry::NativePath qfilename = d->fileEntry.nativeFilePath(); + QString qfilename = d->fileEntry.filePath(); - // Find placeholder string. + // Ensure there is a placeholder mask uint phPos = qfilename.length(); uint phLength = 0; while (phPos != 0) { --phPos; - if (qfilename[phPos] == Latin1Char('X')) { + if (qfilename[phPos] == QLatin1Char('X')) { ++phLength; continue; } if (phLength >= 6 - || qfilename[phPos] == -#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) - '/' -#else - QLatin1Char('\\') -#endif - ) { + || qfilename[phPos] == QLatin1Char('/')) { ++phPos; break; } + // start over phLength = 0; } - QFileSystemEntry::NativePath filename; + if (phLength < 6) + qfilename.append(QLatin1String(".XXXXXX")); + + // "Nativify" :-) + QFileSystemEntry::NativePath filename = QFileSystemEngine::absoluteName( + QFileSystemEntry(qfilename, QFileSystemEntry::FromInternalPath())) + .nativeFilePath(); + + // Find mask in native path + phPos = filename.length(); + phLength = 0; + while (phPos != 0) { + --phPos; + + if (filename[phPos] == Latin1Char('X')) { + ++phLength; + continue; + } + + if (phLength >= 6) { + ++phPos; + break; + } + + // start over + phLength = 0; + } - if (phLength < 6) { - phPos = qfilename.length() + 1; // Account for added dot in prefix - phLength = 6; - filename = qfilename % Latin1Char('.') % Placeholder(phLength); - } else - filename = qfilename; + Q_ASSERT(phLength >= 6); QSystemError error; #if defined(Q_OS_WIN) diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 2db5c60..18b9337 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -632,6 +632,8 @@ void tst_QTemporaryFile::QTBUG_4796_data() QString unicode = QString::fromUtf8("\xc3\xa5\xc3\xa6\xc3\xb8"); QTest::newRow("") << QString() << QString() << true; + QTest::newRow(".") << QString(".") << QString() << true; + QTest::newRow("..") << QString("..") << QString() << true; QTest::newRow("blaXXXXXX") << QString("bla") << QString() << true; QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true; QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false; -- cgit v0.12 From 98f0e52547f6f840e386740dc6c2d99452965266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 17 Aug 2011 14:38:27 +0200 Subject: Cleanup code: removing empty stubs Reviewed-by: Shane Kearns --- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 29 ------------------------ 1 file changed, 29 deletions(-) diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 18b9337..11b2bb3 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -69,13 +69,7 @@ class tst_QTemporaryFile : public QObject { Q_OBJECT -public: - tst_QTemporaryFile(); - virtual ~tst_QTemporaryFile(); public slots: - void init(); - void cleanup(); - void initTestCase(); void cleanupTestCase(); @@ -103,8 +97,6 @@ private slots: void QTBUG_4796_data(); void QTBUG_4796(); - -public: }; void tst_QTemporaryFile::initTestCase() @@ -139,27 +131,6 @@ void tst_QTemporaryFile::getSetCheck() QCOMPARE(true, obj1.autoRemove()); } -tst_QTemporaryFile::tst_QTemporaryFile() -{ -} - -tst_QTemporaryFile::~tst_QTemporaryFile() -{ - -} - -void tst_QTemporaryFile::init() -{ -// TODO: Add initialization code here. -// This will be executed immediately before each test is run. -} - -void tst_QTemporaryFile::cleanup() -{ -// TODO: Add cleanup code here. -// This will be executed immediately after each test is run. -} - void tst_QTemporaryFile::fileTemplate_data() { QTest::addColumn("constructorTemplate"); -- cgit v0.12 From 4e2b245df03b79df272318092a63a4a3708ba3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 17 Aug 2011 14:43:18 +0200 Subject: Merged fileTemplate test with QTBUG_4796 The latter was more thorough, but didn't test setting the file template after construction, while the former included some prefix/suffix combinations that weren't specifically tested in the latter. Reviewed-by: Shane Kearns --- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 116 ++++++++++------------- 1 file changed, 48 insertions(+), 68 deletions(-) diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 11b2bb3..c9d4ba4 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -94,20 +94,17 @@ private slots: void resetTemplateAfterError(); void setTemplateAfterOpen(); void autoRemoveAfterFailedRename(); - - void QTBUG_4796_data(); - void QTBUG_4796(); }; void tst_QTemporaryFile::initTestCase() { - // For QTBUG_4796 + // For fileTemplate tests QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); } void tst_QTemporaryFile::cleanupTestCase() { - // From QTBUG_4796 + // From fileTemplate tests QVERIFY(QDir().rmdir("test-XXXXXX")); } @@ -131,56 +128,6 @@ void tst_QTemporaryFile::getSetCheck() QCOMPARE(true, obj1.autoRemove()); } -void tst_QTemporaryFile::fileTemplate_data() -{ - QTest::addColumn("constructorTemplate"); - QTest::addColumn("prefix"); - QTest::addColumn("suffix"); - QTest::addColumn("fileTemplate"); - - QTest::newRow("constructor default") << "" << "." << "" << ""; - QTest::newRow("constructor with xxx sufix") << "qt_XXXXXXxxx" << "qt_" << "xxx" << ""; - QTest::newRow("constructor with xXx sufix") << "qt_XXXXXXxXx" << "qt_" << "xXx" << ""; - QTest::newRow("constructor with no sufix") << "qt_XXXXXX" << "qt_" << "" << ""; - QTest::newRow("constructor with >6 X's and xxx suffix") << "qt_XXXXXXXXXXxxx" << "qt_" << "xxx" << ""; - QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "qt_" << "" << ""; - - QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_" << "_XXXX" << ""; - QTest::newRow("constructor with XXXXX suffix") << "qt_XXXXXX_XXXXX" << "qt_" << "_XXXXX" << ""; - QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_XXXX." << "" << ""; - QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_XXXXX." << "" << ""; - QTest::newRow("constructor with XXXX prefix and suffix") << "qt_XXXX_XXXXXX_XXXX" << "qt_XXXX_" << "_XXXX" << ""; - QTest::newRow("constructor with XXXXX prefix and suffix") << "qt_XXXXX_XXXXXX_XXXXX" << "qt_XXXXX_" << "_XXXXX" << ""; - - QTest::newRow("set template, no suffix") << "" << "foo" << "" << "foo"; - QTest::newRow("set template, with lowercase XXXXXX") << "" << "qt_" << "xxxxxx" << "qt_XXXXXXxxxxxx"; - QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx"; - QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx"; - QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX"; -} - -void tst_QTemporaryFile::fileTemplate() -{ - QFETCH(QString, constructorTemplate); - QFETCH(QString, prefix); - QFETCH(QString, suffix); - QFETCH(QString, fileTemplate); - - QTemporaryFile file(constructorTemplate); - if (!fileTemplate.isEmpty()) - file.setFileTemplate(fileTemplate); - - QCOMPARE(file.open(), true); - - QString fileName = QFileInfo(file).fileName(); - if (prefix.length()) - QCOMPARE(fileName.left(prefix.length()), prefix); - - if (suffix.length()) - QCOMPARE(fileName.right(suffix.length()), suffix); -} - - /* This tests whether the temporary file really gets placed in QDir::tempPath */ @@ -594,7 +541,7 @@ void tst_QTemporaryFile::autoRemoveAfterFailedRename() cleaner.reset(); } -void tst_QTemporaryFile::QTBUG_4796_data() +void tst_QTemporaryFile::fileTemplate_data() { QTest::addColumn("prefix"); QTest::addColumn("suffix"); @@ -603,17 +550,33 @@ void tst_QTemporaryFile::QTBUG_4796_data() QString unicode = QString::fromUtf8("\xc3\xa5\xc3\xa6\xc3\xb8"); QTest::newRow("") << QString() << QString() << true; + QTest::newRow(".") << QString(".") << QString() << true; QTest::newRow("..") << QString("..") << QString() << true; + + QTest::newRow("foo") << QString("foo") << QString() << true; + QTest::newRow("qt_ ... xxxxxx") << QString("qt_") << QString("xxxxxx") << true; + QTest::newRow("qt_ ... xxx") << QString("qt_") << QString("xxx") << true; + QTest::newRow("qt_ ... xXx") << QString("qt_") << QString("xXx") << true; + QTest::newRow("qt_ ...") << QString("qt_") << QString() << true; + QTest::newRow("qt_ ... _XXXX") << QString("qt_") << QString("_XXXX") << true; + QTest::newRow("qt_ ... _XXXXX") << QString("qt_") << QString("_XXXXX") << true; + QTest::newRow("qt_XXXX_ ...") << QString("qt_XXXX_") << QString() << true; + QTest::newRow("qt_XXXXX_ ...") << QString("qt_XXXXX_") << QString() << true; + QTest::newRow("qt_XXXX_ ... _XXXX") << QString("qt_XXXX_") << QString("_XXXX") << true; + QTest::newRow("qt_XXXXX_ ... _XXXXX") << QString("qt_XXXXX_") << QString("_XXXXX") << true; + QTest::newRow("blaXXXXXX") << QString("bla") << QString() << true; QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true; + QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false; + QTest::newRow("XXXXXX") << QString() << unicode << true; QTest::newRow("XXXXXX") << unicode << QString() << true; QTest::newRow("XXXXXX") << unicode << unicode << true; } -void tst_QTemporaryFile::QTBUG_4796() +void tst_QTemporaryFile::fileTemplate() { QVERIFY(QDir("test-XXXXXX").exists()); @@ -639,18 +602,40 @@ void tst_QTemporaryFile::QTBUG_4796() QFETCH(QString, suffix); QFETCH(bool, openResult); + enum IterationType { + UseConstructor, + UseSetFileTemplate, + Done + }; + + for (IterationType setFileTemplate = UseConstructor; setFileTemplate != Done; + setFileTemplate = IterationType(int(setFileTemplate) + 1)) { + Q_FOREACH(QString const &tempName, cleaner.tempNames) + QVERIFY( !QFile::exists(tempName) ); + + cleaner.reset(); + QString fileTemplate1 = prefix + QString("XX") + suffix; QString fileTemplate2 = prefix + QString("XXXX") + suffix; QString fileTemplate3 = prefix + QString("XXXXXX") + suffix; QString fileTemplate4 = prefix + QString("XXXXXXXX") + suffix; - QTemporaryFile file1(fileTemplate1); - QTemporaryFile file2(fileTemplate2); - QTemporaryFile file3(fileTemplate3); - QTemporaryFile file4(fileTemplate4); - QTemporaryFile file5("test-XXXXXX/" + fileTemplate1); - QTemporaryFile file6("test-XXXXXX/" + fileTemplate3); + QTemporaryFile file1(setFileTemplate ? QString() : fileTemplate1); + QTemporaryFile file2(setFileTemplate ? QString() : fileTemplate2); + QTemporaryFile file3(setFileTemplate ? QString() : fileTemplate3); + QTemporaryFile file4(setFileTemplate ? QString() : fileTemplate4); + QTemporaryFile file5(setFileTemplate ? QString() : "test-XXXXXX/" + fileTemplate1); + QTemporaryFile file6(setFileTemplate ? QString() : "test-XXXXXX/" + fileTemplate3); + + if (setFileTemplate) { + file1.setFileTemplate(fileTemplate1); + file2.setFileTemplate(fileTemplate2); + file3.setFileTemplate(fileTemplate3); + file4.setFileTemplate(fileTemplate4); + file5.setFileTemplate("test-XXXXXX/" + fileTemplate1); + file6.setFileTemplate("test-XXXXXX/" + fileTemplate3); + } if (openResult) { QVERIFY2(file1.open(), qPrintable(file1.errorString())); @@ -709,11 +694,6 @@ void tst_QTemporaryFile::QTBUG_4796() } } } - - Q_FOREACH(QString const &tempName, cleaner.tempNames) - QVERIFY( !QFile::exists(tempName) ); - - cleaner.reset(); } QTEST_MAIN(tst_QTemporaryFile) -- cgit v0.12 From 9e656ce0f7bda4bca4ae55a7aefe1617bc2805ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 18 Aug 2011 11:08:26 +0200 Subject: Leftovers from 401722ef9e6fe79bd41f9d5f79668f5c4997c8e6 This no longer necessary template specialization went unnoticed inside the Windows/Symbian #ifdef. It breaks compilation on those platforms, now that qstringbuilder.h is not included and QConcatenable is unknown to the compiler. --- src/corelib/io/qtemporaryfile.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 375d07f..ea5f8a5 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -72,20 +72,6 @@ static inline Char Latin1Char(char ch) return ushort(uchar(ch)); } -template <> -struct QConcatenable -{ - typedef Char type; - typedef QString ConvertTo; - enum { ExactSize = true }; - static int size(const Char &) { return 1; } - - static inline void appendTo(const Char &u16, QChar *&out) - { - *out++ = QChar(u16); - } -}; - # ifdef Q_OS_WIN typedef HANDLE NativeFileHandle; # else // Q_OS_SYMBIAN -- cgit v0.12 From 59f33898919391d3aa4baa6849556965ae7d08ce Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 9 Aug 2011 14:10:05 +0300 Subject: Default graphics memory quota for Symbian applications The graphics memory quota, which is a new feature in S60 5.4, now gets default value of 24MB. User can override the default value using RSS_RULES: RSS_RULES += "graphics_memory=<# of kB>;" Task-number: QT-4963 Reviewed-by: Sami Merila --- doc/src/development/qmake-manual.qdoc | 17 +++++++++++++++++ doc/src/snippets/code/doc_src_qmake-manual.pro | 4 ++++ mkspecs/features/symbian/default_post.prf | 12 ++++++++++++ 3 files changed, 33 insertions(+) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 184a881..329bac5 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -3116,6 +3116,23 @@ platform application shell. In addition it will make the application to be launched in background. + From S60 version 5.4 onwards, you can specify \c graphics_memory value using \c RSS_RULES + to specify the graphics memory quota for the application. The value is in kilobytes and + defaults to 24576 (i.e. 24MB) for applications that link against QtGui. The default for all + other applications is zero. + + The graphics memory quota tells the operating system how much graphics memory the + application is likely to need so that it can free up enough graphics memory prior to + application launch. If the value is too small, it can cause random slowdowns later when + the memory is freed on on-demand basis. On the other hand, too large values can delay + the application launch unnecessarily. + + For example: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 159 + + This example sets the graphics memory quota to 12MB. + For detailed list of possible \c APP_REGISTRATION_INFO statements, please refer to the Symbian platform help. diff --git a/doc/src/snippets/code/doc_src_qmake-manual.pro b/doc/src/snippets/code/doc_src_qmake-manual.pro index ee35b77..042ca0e 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.pro +++ b/doc/src/snippets/code/doc_src_qmake-manual.pro @@ -1023,3 +1023,7 @@ packagesExist(sqlite3 QtNetwork QtDeclarative) { // Use the fancy UI, as we have extra packages available #endif #! [158] + +#! [159] +RSS_RULES += "graphics_memory=12288;" +#! [159] diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index 470372e..c8fd33b 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -19,7 +19,19 @@ contains(TEMPLATE, ".*app") { default_bin_deployment.path += /sys/bin load(application_icon.prf) + + # Specify default graphics memory quota for applications unless explicitly set by developer. + !contains(S60_VERSION, 5.0):!contains(S60_VERSION, 5.1):!contains(S60_VERSION, 5.2):!contains(S60_VERSION, 5.3) { + !contains(RSS_RULES, .*graphics_memory.*) { + contains(QT, gui) { + RSS_RULES += "graphics_memory=24576;" + } else { + RSS_RULES += "graphics_memory=0;" + } + } + } } + contains(TEMPLATE, lib): { contains(CONFIG, staticlib)|contains(CONFIG, static): { # Static libs should not have LIBRARY statements in S60 -- cgit v0.12 From 9496a87a8ad6c78952750c1529da637fc622a23c Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 22 Aug 2011 12:00:06 +1000 Subject: Correct documentation of TextInput.PasswordEchoOnEdit. The documentation incorrectly stated only the last character was unmasked. Use the same wording from the QLineEdit documentation instead. Task-number: QTBUG-20003 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 5245236..9bc7fb9 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -874,7 +874,8 @@ void QDeclarativeTextInputPrivate::updateInputMethodHints() \o TextInput.Normal - Displays the text as it is. (Default) \o TextInput.Password - Displays asterixes instead of characters. \o TextInput.NoEcho - Displays nothing. - \o TextInput.PasswordEchoOnEdit - Displays all but the current character as asterixes. + \o TextInput.PasswordEchoOnEdit - Displays characters as they are entered + while editing, otherwise displays asterisks. \endlist */ QDeclarativeTextInput::EchoMode QDeclarativeTextInput::echoMode() const -- cgit v0.12 From 7b693627ee2a17718cb6d8bee5e3deb5a97b307f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 22 Aug 2011 11:30:26 +0200 Subject: Off-by-one error in assert condition... While this was safe, it was also over-zealous, disallowing the path from ending with the placeholder... Incidentally, the default. Laughed-at-by: w00t_ --- src/corelib/io/qtemporaryfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index ea5f8a5..e80a8b6 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -135,7 +135,7 @@ static bool createFileFromTemplate(NativeFileHandle &file, { Q_ASSERT(length != 0); Q_ASSERT(pos < size_t(path.length())); - Q_ASSERT(length < size_t(path.length()) - pos); + Q_ASSERT(length <= size_t(path.length()) - pos); Char *const placeholderStart = (Char *)path.data() + pos; Char *const placeholderEnd = placeholderStart + length; -- cgit v0.12 From 2c198b3ace2fb09ed0eaa45aec6ce2c96a45aafb Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 22 Aug 2011 11:31:22 +1000 Subject: Fix left alignment of native RTL pre-edit text. If there is no committed text in a TextInput or TextEdit determine if the pre-edit text is right to left before falling back to the global keyboard settings. Change-Id: I7e5568e936341602b8faf7be120f9a770c115f48 Task-number: QMLNG-72 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 11 ++++++++++- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 7 ++++++- .../data/horizontalAlignment_RightToLeft.qml | 1 + .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 12 ++++++++++++ .../data/horizontalAlignment_RightToLeft.qml | 1 + .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 13 +++++++++++++ 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 42c520c..cc5279a 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -547,7 +547,15 @@ bool QDeclarativeTextEditPrivate::determineHorizontalAlignment() { Q_Q(QDeclarativeTextEdit); if (hAlignImplicit && q->isComponentComplete()) { - bool alignToRight = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : rightToLeftText; + bool alignToRight; + if (text.isEmpty()) { + const QString preeditText = control->textCursor().block().layout()->preeditAreaText(); + alignToRight = preeditText.isEmpty() + ? QApplication::keyboardInputDirection() == Qt::RightToLeft + : preeditText.isRightToLeft(); + } else { + alignToRight = rightToLeftText; + } return setHAlign(alignToRight ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft); } return false; @@ -1582,6 +1590,7 @@ void QDeclarativeTextEdit::q_textChanged() void QDeclarativeTextEdit::moveCursorDelegate() { Q_D(QDeclarativeTextEdit); + d->determineHorizontalAlignment(); updateMicroFocus(); emit cursorRectangleChanged(); if(!d->cursor) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index f68f1c6..c5c9f5e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -407,7 +407,11 @@ bool QDeclarativeTextInputPrivate::determineHorizontalAlignment() if (hAlignImplicit) { // if no explicit alignment has been set, follow the natural layout direction of the text QString text = control->text(); - bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft(); + if (text.isEmpty()) + text = control->preeditAreaText(); + bool isRightToLeft = text.isEmpty() + ? QApplication::keyboardInputDirection() == Qt::RightToLeft + : text.isRightToLeft(); return setHAlign(isRightToLeft ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft); } return false; @@ -1909,6 +1913,7 @@ void QDeclarativeTextInput::cursorPosChanged() void QDeclarativeTextInput::updateCursorRectangle() { Q_D(QDeclarativeTextInput); + d->determineHorizontalAlignment(); d->updateHorizontalScroll(); updateRect();//TODO: Only update rect between pos's updateMicroFocus(); diff --git a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml index 43ea8d8..6e739bf 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml @@ -18,6 +18,7 @@ Rectangle { objectName: "text" anchors.fill: parent text: top.text + focus: true } } } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 5d6f2a2..5c7f36f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -454,6 +454,8 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QVERIFY(textEdit != 0); canvas->show(); + const QString rtlText = textEdit->text(); + // implicit alignment should follow the reading direction of text QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); @@ -530,6 +532,16 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); + + textEdit->setText(QString()); + { QInputMethodEvent ev(rtlText, QList()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + { QInputMethodEvent ev("Hello world!", QList()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + #ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml index b11535e..7f27bbe 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml @@ -18,6 +18,7 @@ Rectangle { objectName: "text" anchors.fill: parent text: top.text + focus: true } } } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 280f952..7f3b8a2 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1198,6 +1198,8 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QVERIFY(textInput != 0); canvas->show(); + const QString rtlText = textInput->text(); + QDeclarativeTextInputPrivate *textInputPrivate = QDeclarativeTextInputPrivate::get(textInput); QVERIFY(textInputPrivate != 0); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); @@ -1262,6 +1264,17 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); + + // If there is no commited text, the preedit text should determine the alignment. + textInput->setText(QString()); + { QInputMethodEvent ev(rtlText, QList()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + { QInputMethodEvent ev("Hello world!", QList()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); + #ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection -- cgit v0.12 From 0b19ee5ecabfc516256f0a6db0f2e7bc37e703a0 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 23 Aug 2011 14:55:46 +0300 Subject: In landscape mode QComboboBox popup can not be showed completely ComboBox popups have regressed in 4.7.4 lately. Combobox popup is shown as smallish square rectangle in landscape orientation. As a fix, let the width of the popup match the height of the screen (native dialogs most of the time have width matching the height of the screen). Task-number: QTBUG-20932 Reviewed-by: Miikka Heikkinen --- src/gui/widgets/qcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index f4a627b..8a69bdf 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2473,7 +2473,7 @@ void QComboBox::showPopup() } else { TRect staConTopRect = TRect(); AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); - listRect.setWidth(listRect.height()); + listRect.setWidth(screen.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); if (staConTopRect.IsEmpty()) { -- cgit v0.12 From 1ee6ff9fab218a8fa02a3cad1614730eb716bf45 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 23 Aug 2011 20:13:43 +0200 Subject: Doc: Fixing typo --- .../declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 7f3b8a2..bb895bf 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1268,7 +1268,7 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QTest::qWaitForWindowShown(canvas); QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); - // If there is no commited text, the preedit text should determine the alignment. + // If there is no committed text, the preedit text should determine the alignment. textInput->setText(QString()); { QInputMethodEvent ev(rtlText, QList()); QApplication::sendEvent(canvas, &ev); } QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); -- cgit v0.12 From 33eb83565466d3dc31ea90dcf18dc3c7b16fd5b6 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 24 Aug 2011 11:26:29 +1000 Subject: Make it easier to select words at the start of a line. QTextControl's word selection will only include a word if the cursor position is past the mid point of the word. This can make it difficult to select words near the edges of the screen on touch devices. For the TextEdit word selection mode select a word ignore the relative position within a word. Change-Id: I2bc61376f663836fedd7e157448f0b565a64d485 Task-number: QT-5206 Reviewed-by: Martin Jones --- src/gui/text/qtextcontrol.cpp | 34 +++++++++------ .../data/mouseselection_false_words.qml | 5 ++- .../data/mouseselection_true_words.qml | 5 ++- .../tst_qdeclarativetextedit.cpp | 49 ++++++++++++---------- 4 files changed, 56 insertions(+), 37 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 9081ab7..f3d42f8 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -679,20 +679,30 @@ void QTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qrea if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX)) return; - // keep the already selected word even when moving to the left - // (#39164) - if (suggestedNewPosition < selectedWordOnDoubleClick.position()) - cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); - else - cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); + if (wordSelectionEnabled) { + if (suggestedNewPosition < selectedWordOnDoubleClick.position()) { + cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); + setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); + } else { + cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); + setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + } + } else { + // keep the already selected word even when moving to the left + // (#39164) + if (suggestedNewPosition < selectedWordOnDoubleClick.position()) + cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); + else + cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); - const qreal differenceToStart = mouseXPosition - wordStartX; - const qreal differenceToEnd = wordEndX - mouseXPosition; + const qreal differenceToStart = mouseXPosition - wordStartX; + const qreal differenceToEnd = wordEndX - mouseXPosition; - if (differenceToStart < differenceToEnd) - setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); - else - setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + if (differenceToStart < differenceToEnd) + setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); + else + setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + } if (interactionFlags & Qt::TextSelectableByMouse) { #ifndef QT_NO_CLIPBOARD diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml index 22a9871..f8d2e4e 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml @@ -1,7 +1,8 @@ -import QtQuick 1.0 +import QtQuick 1.1 TextEdit { focus: true - text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + text: "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" selectByMouse: false + mouseSelectionMode: TextEdit.SelectWords } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml index d61da46..f58fd45 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml @@ -1,7 +1,8 @@ -import QtQuick 1.0 +import QtQuick 1.1 TextEdit { focus: true - text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + text: "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" selectByMouse: true + mouseSelectionMode: TextEdit.SelectWords } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 5c7f36f..fde0588 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1327,20 +1327,32 @@ void tst_qdeclarativetextedit::moveCursorSelectionSequence() void tst_qdeclarativetextedit::mouseSelection_data() { QTest::addColumn("qmlfile"); - QTest::addColumn("expectSelection"); + QTest::addColumn("from"); + QTest::addColumn("to"); + QTest::addColumn("selectedText"); // import installed - QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << true; - QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << false; - QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << false; - QTest::newRow("on word selection") << SRCDIR "/data/mouseselection_true_words.qml" << true; - QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << false; + QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << 4 << 9 << "45678"; + QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << 4 << 9 << QString(); + QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << 4 << 9 << QString(); + QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << 4 << 9 << QString(); + QTest::newRow("on word selection (4,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 4 << 9 << "0123456789"; + QTest::newRow("on word selection (2,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (2,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (9,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (9,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (13,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (20,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (12,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (30,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } void tst_qdeclarativetextedit::mouseSelection() { QFETCH(QString, qmlfile); - QFETCH(bool, expectSelection); + QFETCH(int, from); + QFETCH(int, to); + QFETCH(QString, selectedText); QDeclarativeView *canvas = createView(qmlfile); @@ -1354,25 +1366,20 @@ void tst_qdeclarativetextedit::mouseSelection() QVERIFY(textEditObject != 0); // press-and-drag-and-release from x1 to x2 - int x1 = 10; - int x2 = 70; - int y = textEditObject->height()/2; - QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y))); + QPoint p1 = canvas->mapFromScene(textEditObject->positionToRectangle(from).center()); + QPoint p2 = canvas->mapFromScene(textEditObject->positionToRectangle(to).center()); + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, p1); //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work - QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p2), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QApplication::sendEvent(canvas->viewport(), &mv); - QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); - QString str = textEditObject->selectedText(); - if (expectSelection) - QVERIFY(str.length() > 3); // don't reallly care *what* was selected (and it's too sensitive to platform) - else - QVERIFY(str.isEmpty()); + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, p2); + QCOMPARE(textEditObject->selectedText(), selectedText); // Clicking and shift to clicking between the same points should select the same text. textEditObject->setCursorPosition(0); - QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y))); - QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y))); - QCOMPARE(textEditObject->selectedText(), str); + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, p1); + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, p2); + QCOMPARE(textEditObject->selectedText(), selectedText); delete canvas; } -- cgit v0.12 From ec7a1dce2ed0766e7681598c17a80468794a249e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 15 Aug 2011 09:31:15 +0200 Subject: Use CoreText for font rendering on uikit. --- src/gui/painting/qpaintengine_raster.cpp | 4 +- src/gui/text/qfontengine_coretext.mm | 12 +- src/gui/text/qfontengine_coretext_p.h | 6 + src/gui/text/text.pri | 9 +- .../examples/flickrdemo/flickrdemo-Info.plist | 8 ++ .../flickrdemo.xcodeproj/project.pbxproj | 14 +- .../uikit/examples/qmltest/qmltest-Info.plist | 8 ++ .../qmltest/qmltest.xcodeproj/project.pbxproj | 16 +-- src/plugins/platforms/uikit/platform.pro | 12 +- .../platforms/uikit/qcoretextfontdatabase.cpp | 156 +++++++++++++++++++++ .../platforms/uikit/qcoretextfontdatabase.h | 58 ++++++++ src/plugins/platforms/uikit/quikitintegration.mm | 14 +- src/plugins/platforms/uikit/quikitscreen.mm | 5 +- 13 files changed, 280 insertions(+), 42 deletions(-) create mode 100644 src/plugins/platforms/uikit/qcoretextfontdatabase.cpp create mode 100644 src/plugins/platforms/uikit/qcoretextfontdatabase.h diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 76d7316..9826689 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3098,7 +3098,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ensurePen(); ensureState(); -#if defined (Q_WS_WIN) || defined(Q_WS_MAC) +#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA)) if (!supportsTransformations(ti.fontEngine)) { QVarLengthArray positions; @@ -3438,7 +3438,7 @@ bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const { -#if defined(Q_WS_MAC) +#if defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA)) // Mac font engines don't support scaling and rotation if (m.type() > QTransform::TxTranslate) #else diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 64d4a24..153451e 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -135,7 +135,7 @@ void QCoreTextFontEngineMulti::init(bool kerning) attributeDict = CFDictionaryCreateMutable(0, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CFDictionaryAddValue(attributeDict, NSFontAttributeName, ctfont); + CFDictionaryAddValue(attributeDict, kCTFontAttributeName, ctfont); if (!kerning) { float zero = 0.0; QCFType noKern = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero); @@ -257,7 +257,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay //NSLog(@"Dictionary %@", runAttribs); if (!runAttribs) runAttribs = attributeDict; - CTFontRef runFont = static_cast(CFDictionaryGetValue(runAttribs, NSFontAttributeName)); + CTFontRef runFont = static_cast(CFDictionaryGetValue(runAttribs, kCTFontAttributeName)); uint fontIndex = fontIndexForFont(runFont); const QFontEngine *engine = engineAt(fontIndex); fontIndex <<= 24; @@ -547,7 +547,6 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph) ret.xoff = ret.xoff.round(); ret.yoff = ret.yoff.round(); } - return ret; } @@ -723,7 +722,12 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition QImage im(qRound(br.width) + 2, qRound(br.height) + 2, QImage::Format_RGB32); im.fill(0); - CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); + CGColorSpaceRef colorspace = +#ifdef Q_WS_MAC + CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); +#else + CGColorSpaceCreateDeviceRGB(); +#endif uint cgflags = kCGImageAlphaNoneSkipFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version cgflags |= kCGBitmapByteOrder32Host; diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h index efe8295..0a2ae1f 100644 --- a/src/gui/text/qfontengine_coretext_p.h +++ b/src/gui/text/qfontengine_coretext_p.h @@ -44,6 +44,12 @@ #include +#ifdef QT_NO_CORESERVICES +#include +#include +#include +#endif + #if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) class QRawFontPrivate; diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index b6cdc52..1cfacf7 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -106,14 +106,17 @@ unix:x11 { !embedded:!qpa:!x11:mac { HEADERS += \ text/qfontengine_mac_p.h - OBJECTIVE_HEADERS += \ - text/qfontengine_coretext_p.h SOURCES += \ text/qfont_mac.cpp \ text/qrawfont_mac.cpp OBJECTIVE_SOURCES += \ - text/qfontengine_coretext.mm \ text/qfontengine_mac.mm +} +!embedded:!x11:mac { + OBJECTIVE_HEADERS += \ + text/qfontengine_coretext_p.h + OBJECTIVE_SOURCES += \ + text/qfontengine_coretext.mm contains(QT_CONFIG, harfbuzz) { DEFINES += QT_ENABLE_HARFBUZZ_FOR_MAC } diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist index 5bc1ac9..3c45823 100644 --- a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist +++ b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist @@ -6,6 +6,8 @@ English CFBundleDisplayName ${PRODUCT_NAME} + CFBundleDocumentTypes + CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile @@ -20,6 +22,8 @@ APPL CFBundleSignature ???? + CFBundleURLTypes + CFBundleVersion 1.0 LSRequiresIPhoneOS @@ -37,5 +41,9 @@ UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown + UTExportedTypeDeclarations + + UTImportedTypeDeclarations + diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj index b564ef9..68237ae 100755 --- a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj @@ -17,13 +17,14 @@ D307DEB213EBCF5500399BD4 /* libQtOpenGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DEA913EBCF5500399BD4 /* libQtOpenGL.a */; }; D307DEB313EBCF5500399BD4 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DEAA13EBCF5500399BD4 /* libQtScript.a */; }; D307DEB413EBCF5500399BD4 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DEAB13EBCF5500399BD4 /* libQtSql.a */; }; - D307DEB513EBCF5500399BD4 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DEAC13EBCF5500399BD4 /* libQtXml.a */; }; D307DEB613EBCF5500399BD4 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DEAD13EBCF5500399BD4 /* libQtXmlPatterns.a */; }; D307DEB813EBCF6400399BD4 /* libquikit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DEB713EBCF6400399BD4 /* libquikit.a */; }; D333CCF213B88A4D0070E08E /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */; }; D333CCF313B88A4D0070E08E /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */; }; D333CCF413B88A4D0070E08E /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */; }; D333CCF513B88A4D0070E08E /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */; }; + D36D346513F3CD7E00EC5A41 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D36D346413F3CD7E00EC5A41 /* CoreText.framework */; }; + D36D346613F3CD8800EC5A41 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D36D346413F3CD7E00EC5A41 /* CoreText.framework */; }; D3A51610134B03DE00E30E2F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A5160F134B03DE00E30E2F /* OpenGLES.framework */; }; D3A51612134B03E900E30E2F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A51611134B03E900E30E2F /* QuartzCore.framework */; }; D3A51615134B041500E30E2F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A51611134B03E900E30E2F /* QuartzCore.framework */; }; @@ -46,7 +47,6 @@ D3D8175B132A184300CDE422 /* libQtNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81755132A184300CDE422 /* libQtNetwork.a */; }; D3D8175C132A184300CDE422 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81756132A184300CDE422 /* libQtScript.a */; }; D3D8175D132A184300CDE422 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81757132A184300CDE422 /* libQtSql.a */; }; - D3D81760132A185A00CDE422 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D8175E132A185A00CDE422 /* libQtXml.a */; }; D3D81761132A185A00CDE422 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D8175F132A185A00CDE422 /* libQtXmlPatterns.a */; }; D3D81763132A186B00CDE422 /* libquikit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81762132A186B00CDE422 /* libquikit.a */; }; /* End PBXBuildFile section */ @@ -65,12 +65,12 @@ D307DEA913EBCF5500399BD4 /* libQtOpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtOpenGL.a"; sourceTree = ""; }; D307DEAA13EBCF5500399BD4 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript.a"; sourceTree = ""; }; D307DEAB13EBCF5500399BD4 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql.a"; sourceTree = ""; }; - D307DEAC13EBCF5500399BD4 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtXml.a"; sourceTree = ""; }; D307DEAD13EBCF5500399BD4 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtXmlPatterns.a"; sourceTree = ""; }; D307DEB713EBCF6400399BD4 /* libquikit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit.a; path = "../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms/libquikit.a"; sourceTree = ""; }; D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_qmlapplicationviewer.cpp; path = ../share/qmlapplicationviewer/moc_qmlapplicationviewer.cpp; sourceTree = ""; }; D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = qmlapplicationviewer.cpp; path = ../share/qmlapplicationviewer/qmlapplicationviewer.cpp; sourceTree = ""; }; D333CCF113B88A4D0070E08E /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = ../share/qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = ""; }; + D36D346413F3CD7E00EC5A41 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; D3A5160F134B03DE00E30E2F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; D3A51611134B03E900E30E2F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; D3A51617134B042A00E30E2F /* libQtOpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtOpenGL.a"; sourceTree = ""; }; @@ -85,7 +85,6 @@ D3D81755132A184300CDE422 /* libQtNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork.a"; sourceTree = SOURCE_ROOT; }; D3D81756132A184300CDE422 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript.a"; sourceTree = SOURCE_ROOT; }; D3D81757132A184300CDE422 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql.a"; sourceTree = SOURCE_ROOT; }; - D3D8175E132A185A00CDE422 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXml.a"; sourceTree = SOURCE_ROOT; }; D3D8175F132A185A00CDE422 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXmlPatterns.a"; sourceTree = SOURCE_ROOT; }; D3D81762132A186B00CDE422 /* libquikit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit.a"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -95,6 +94,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D36D346613F3CD8800EC5A41 /* CoreText.framework in Frameworks */, D3A51612134B03E900E30E2F /* QuartzCore.framework in Frameworks */, D3A51610134B03DE00E30E2F /* OpenGLES.framework in Frameworks */, 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, @@ -108,7 +108,6 @@ D307DEB213EBCF5500399BD4 /* libQtOpenGL.a in Frameworks */, D307DEB313EBCF5500399BD4 /* libQtScript.a in Frameworks */, D307DEB413EBCF5500399BD4 /* libQtSql.a in Frameworks */, - D307DEB513EBCF5500399BD4 /* libQtXml.a in Frameworks */, D307DEB613EBCF5500399BD4 /* libQtXmlPatterns.a in Frameworks */, D307DEB813EBCF6400399BD4 /* libquikit.a in Frameworks */, ); @@ -118,6 +117,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D36D346513F3CD7E00EC5A41 /* CoreText.framework in Frameworks */, D3A51618134B042A00E30E2F /* libQtOpenGL.a in Frameworks */, D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, @@ -131,7 +131,6 @@ D3D8175B132A184300CDE422 /* libQtNetwork.a in Frameworks */, D3D8175C132A184300CDE422 /* libQtScript.a in Frameworks */, D3D8175D132A184300CDE422 /* libQtSql.a in Frameworks */, - D3D81760132A185A00CDE422 /* libQtXml.a in Frameworks */, D3D81761132A185A00CDE422 /* libQtXmlPatterns.a in Frameworks */, D3D81763132A186B00CDE422 /* libquikit.a in Frameworks */, ); @@ -190,6 +189,7 @@ 288765A40DF7441C002DB57D /* CoreGraphics.framework */, D3A51611134B03E900E30E2F /* QuartzCore.framework */, D3A5160F134B03DE00E30E2F /* OpenGLES.framework */, + D36D346413F3CD7E00EC5A41 /* CoreText.framework */, D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */, ); name = Frameworks; @@ -216,7 +216,6 @@ D3A51617134B042A00E30E2F /* libQtOpenGL.a */, D3D81756132A184300CDE422 /* libQtScript.a */, D3D81757132A184300CDE422 /* libQtSql.a */, - D3D8175E132A185A00CDE422 /* libQtXml.a */, D3D8175F132A185A00CDE422 /* libQtXmlPatterns.a */, ); name = Device; @@ -233,7 +232,6 @@ D307DEA913EBCF5500399BD4 /* libQtOpenGL.a */, D307DEAA13EBCF5500399BD4 /* libQtScript.a */, D307DEAB13EBCF5500399BD4 /* libQtSql.a */, - D307DEAC13EBCF5500399BD4 /* libQtXml.a */, D307DEAD13EBCF5500399BD4 /* libQtXmlPatterns.a */, ); name = Simulator; diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist b/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist index 1566585..531d93d 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist @@ -6,6 +6,8 @@ English CFBundleDisplayName ${PRODUCT_NAME} + CFBundleDocumentTypes + CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile @@ -20,9 +22,15 @@ APPL CFBundleSignature ???? + CFBundleURLTypes + CFBundleVersion 1.0 LSRequiresIPhoneOS + UTExportedTypeDeclarations + + UTImportedTypeDeclarations + diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj index afebcba..1dd9b35 100755 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -18,12 +18,13 @@ D307DED313EBD05900399BD4 /* libQtOpenGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DECA13EBD05900399BD4 /* libQtOpenGL.a */; }; D307DED413EBD05900399BD4 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DECB13EBD05900399BD4 /* libQtScript.a */; }; D307DED513EBD05900399BD4 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DECC13EBD05900399BD4 /* libQtSql.a */; }; - D307DED613EBD05900399BD4 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DECD13EBD05900399BD4 /* libQtXml.a */; }; D307DED713EBD05900399BD4 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D307DECE13EBD05900399BD4 /* libQtXmlPatterns.a */; }; D333CCF913B88A690070E08E /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF613B88A690070E08E /* moc_qmlapplicationviewer.cpp */; }; D333CCFA13B88A690070E08E /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF613B88A690070E08E /* moc_qmlapplicationviewer.cpp */; }; D333CCFB13B88A690070E08E /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF713B88A690070E08E /* qmlapplicationviewer.cpp */; }; D333CCFC13B88A690070E08E /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF713B88A690070E08E /* qmlapplicationviewer.cpp */; }; + D34F290413F29AF400E4F9AC /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D34F290313F29AF400E4F9AC /* CoreText.framework */; }; + D34F290713F29B0A00E4F9AC /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D34F290613F29B0300E4F9AC /* CoreText.framework */; }; D35784261345D9940046D202 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D35784251345D9940046D202 /* OpenGLES.framework */; }; D35784281345D9E00046D202 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D35784271345D9E00046D202 /* QuartzCore.framework */; }; D3578436134A09990046D202 /* libQtOpenGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3578435134A09990046D202 /* libQtOpenGL.a */; }; @@ -46,7 +47,6 @@ D3D817B5132A2CFD00CDE422 /* libQtNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */; }; D3D817B6132A2CFD00CDE422 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AE132A2CFD00CDE422 /* libQtScript.a */; }; D3D817B7132A2CFD00CDE422 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AF132A2CFD00CDE422 /* libQtSql.a */; }; - D3D817B8132A2CFD00CDE422 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817B0132A2CFD00CDE422 /* libQtXml.a */; }; D3D817B9132A2CFD00CDE422 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */; }; D3D817BB132A2D0E00CDE422 /* libquikit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817BA132A2D0E00CDE422 /* libquikit.a */; }; /* End PBXBuildFile section */ @@ -66,11 +66,12 @@ D307DECA13EBD05900399BD4 /* libQtOpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtOpenGL.a"; sourceTree = ""; }; D307DECB13EBD05900399BD4 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript.a"; sourceTree = ""; }; D307DECC13EBD05900399BD4 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql.a"; sourceTree = ""; }; - D307DECD13EBD05900399BD4 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtXml.a"; sourceTree = ""; }; D307DECE13EBD05900399BD4 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtXmlPatterns.a"; sourceTree = ""; }; D333CCF613B88A690070E08E /* moc_qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_qmlapplicationviewer.cpp; path = ../share/qmlapplicationviewer/moc_qmlapplicationviewer.cpp; sourceTree = ""; }; D333CCF713B88A690070E08E /* qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = qmlapplicationviewer.cpp; path = ../share/qmlapplicationviewer/qmlapplicationviewer.cpp; sourceTree = ""; }; D333CCF813B88A690070E08E /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = ../share/qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = ""; }; + D34F290313F29AF400E4F9AC /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; + D34F290613F29B0300E4F9AC /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; D35784251345D9940046D202 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; D35784271345D9E00046D202 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; D3578435134A09990046D202 /* libQtOpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtOpenGL.a"; sourceTree = ""; }; @@ -85,7 +86,6 @@ D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork.a"; sourceTree = SOURCE_ROOT; }; D3D817AE132A2CFD00CDE422 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript.a"; sourceTree = SOURCE_ROOT; }; D3D817AF132A2CFD00CDE422 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql.a"; sourceTree = SOURCE_ROOT; }; - D3D817B0132A2CFD00CDE422 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXml.a"; sourceTree = SOURCE_ROOT; }; D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXmlPatterns.a"; sourceTree = SOURCE_ROOT; }; D3D817BA132A2D0E00CDE422 /* libquikit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit.a"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -95,6 +95,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D34F290413F29AF400E4F9AC /* CoreText.framework in Frameworks */, D35784281345D9E00046D202 /* QuartzCore.framework in Frameworks */, 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, @@ -108,7 +109,6 @@ D307DED313EBD05900399BD4 /* libQtOpenGL.a in Frameworks */, D307DED413EBD05900399BD4 /* libQtScript.a in Frameworks */, D307DED513EBD05900399BD4 /* libQtSql.a in Frameworks */, - D307DED613EBD05900399BD4 /* libQtXml.a in Frameworks */, D307DED713EBD05900399BD4 /* libQtXmlPatterns.a in Frameworks */, D307DEC513EBD04100399BD4 /* libquikit.a in Frameworks */, ); @@ -118,6 +118,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D34F290713F29B0A00E4F9AC /* CoreText.framework in Frameworks */, D357843A134A0AB10046D202 /* QuartzCore.framework in Frameworks */, D3578439134A0AAE0046D202 /* OpenGLES.framework in Frameworks */, D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, @@ -130,7 +131,6 @@ D3D817B5132A2CFD00CDE422 /* libQtNetwork.a in Frameworks */, D3D817B6132A2CFD00CDE422 /* libQtScript.a in Frameworks */, D3D817B7132A2CFD00CDE422 /* libQtSql.a in Frameworks */, - D3D817B8132A2CFD00CDE422 /* libQtXml.a in Frameworks */, D3D817B9132A2CFD00CDE422 /* libQtXmlPatterns.a in Frameworks */, D3D817BB132A2D0E00CDE422 /* libquikit.a in Frameworks */, D3578436134A09990046D202 /* libQtOpenGL.a in Frameworks */, @@ -152,6 +152,7 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + D34F290313F29AF400E4F9AC /* CoreText.framework */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */, @@ -190,6 +191,7 @@ 288765A40DF7441C002DB57D /* CoreGraphics.framework */, D35784251345D9940046D202 /* OpenGLES.framework */, D35784271345D9E00046D202 /* QuartzCore.framework */, + D34F290613F29B0300E4F9AC /* CoreText.framework */, D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */, ); name = Frameworks; @@ -216,7 +218,6 @@ D3578435134A09990046D202 /* libQtOpenGL.a */, D3D817AE132A2CFD00CDE422 /* libQtScript.a */, D3D817AF132A2CFD00CDE422 /* libQtSql.a */, - D3D817B0132A2CFD00CDE422 /* libQtXml.a */, D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */, ); name = Device; @@ -233,7 +234,6 @@ D307DECA13EBD05900399BD4 /* libQtOpenGL.a */, D307DECB13EBD05900399BD4 /* libQtScript.a */, D307DECC13EBD05900399BD4 /* libQtSql.a */, - D307DECD13EBD05900399BD4 /* libQtXml.a */, D307DECE13EBD05900399BD4 /* libQtXmlPatterns.a */, ); name = Simulator; diff --git a/src/plugins/platforms/uikit/platform.pro b/src/plugins/platforms/uikit/platform.pro index 726da06..b5ff62f 100644 --- a/src/plugins/platforms/uikit/platform.pro +++ b/src/plugins/platforms/uikit/platform.pro @@ -17,11 +17,19 @@ OBJECTIVE_HEADERS = quikitintegration.h \ quikiteventloop.h \ quikitwindowsurface.h -HEADERS = quikitsoftwareinputhandler.h +HEADERS = quikitsoftwareinputhandler.h \ + qcoretextfontdatabase.h + +SOURCES += \ + qcoretextfontdatabase.cpp + +#needed for qcoretextfontengine even if it's not used +INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src #add libz for freetype. LIBS += -lz -include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target + + diff --git a/src/plugins/platforms/uikit/qcoretextfontdatabase.cpp b/src/plugins/platforms/uikit/qcoretextfontdatabase.cpp new file mode 100644 index 0000000..76ad936 --- /dev/null +++ b/src/plugins/platforms/uikit/qcoretextfontdatabase.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** 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$ +** 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 "qcoretextfontdatabase.h" + +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +void QCoreTextFontDatabase::populateFontDatabase() +{ + QCFType collection = CTFontCollectionCreateFromAvailableFonts(0); + if(!collection) + return; + QCFType fonts = CTFontCollectionCreateMatchingFontDescriptors(collection); + if(!fonts) + return; + QSupportedWritingSystems supportedWritingSystems; + for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) + supportedWritingSystems.setSupported((QFontDatabase::WritingSystem)i, true); + QString foundry_name = "CoreText"; + const int numFonts = CFArrayGetCount(fonts); + for(int i = 0; i < numFonts; ++i) { + CTFontDescriptorRef font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fonts, i); + + QCFString family_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); +// QCFString style_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); + + QFont::Weight fontWeight = QFont::Normal; + QFont::Style fontStyle = QFont::StyleNormal; + if(QCFType styles = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute)) { + if(CFNumberRef weight = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontWeightTrait)) { + Q_ASSERT(CFNumberIsFloatType(weight)); + double d; + if(CFNumberGetValue(weight, kCFNumberDoubleType, &d)) { + if (d > 0.0) + fontWeight = QFont::Bold; + } + } + if(CFNumberRef italic = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontSlantTrait)) { + Q_ASSERT(CFNumberIsFloatType(italic)); + double d; + if(CFNumberGetValue(italic, kCFNumberDoubleType, &d)) { + if (d > 0.0) + fontStyle = QFont::StyleItalic; + } + } + } + + int pixelSize = 0; + if(QCFType size = (CFNumberRef)CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) { + if(CFNumberIsFloatType(size)) { + double d; + CFNumberGetValue(size, kCFNumberDoubleType, &d); + pixelSize = d; + } else { + CFNumberGetValue(size, kCFNumberIntType, &pixelSize); + } + } + registerFont(QString(family_name), + foundry_name, + fontWeight, + fontStyle, + QFont::Unstretched, + true, + true, + pixelSize, + supportedWritingSystems, + 0); + } +} + +QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle) +{ + Q_UNUSED(script) + Q_UNUSED(handle) + CTFontSymbolicTraits symbolicTraits = 0; + if (fontDef.weight >= QFont::Bold) + symbolicTraits |= kCTFontBoldTrait; + switch (fontDef.style) { + case QFont::StyleNormal: + break; + case QFont::StyleItalic: + case QFont::StyleOblique: + symbolicTraits |= kCTFontItalicTrait; + break; + } + + CGAffineTransform transform = CGAffineTransformIdentity; + if (fontDef.stretch != 100) { + transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1); + } + + QCFType baseFont = CTFontCreateWithName(QCFString(fontDef.family), fontDef.pixelSize, &transform); + QCFType 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) + if (ctFont == 0) { + ctFont = baseFont; + } + + if (ctFont) + return new QCoreTextFontEngine(ctFont, fontDef); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/qcoretextfontdatabase.h b/src/plugins/platforms/uikit/qcoretextfontdatabase.h new file mode 100644 index 0000000..f4fcb20 --- /dev/null +++ b/src/plugins/platforms/uikit/qcoretextfontdatabase.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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$ +** 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 QCORETEXTFONTDATABASE_H +#define QCORETEXTFONTDATABASE_H + +#include + +QT_BEGIN_NAMESPACE + +class QCoreTextFontDatabase : public QPlatformFontDatabase +{ +public: + void populateFontDatabase(); + QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); +}; + +QT_END_NAMESPACE + +#endif // QCORETEXTFONTDATABASE_H diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index ca020c9..02da97c 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -44,7 +44,7 @@ #include "quikitwindowsurface.h" #include "quikitscreen.h" #include "quikiteventloop.h" -#include "qgenericunixfontdatabase.h" +#include "qcoretextfontdatabase.h" #include @@ -56,16 +56,6 @@ QT_BEGIN_NAMESPACE -class QUIKitFontDatabase : public QGenericUnixFontDatabase -{ -public: - virtual QString fontDir() const - { - return QString( [[[[NSBundle mainBundle] bundlePath] - stringByAppendingPathComponent:@"fonts"] UTF8String] ); - } -}; - static QUIKitIntegration *m_instance = 0; QUIKitIntegration * QUIKitIntegration::instance() @@ -74,7 +64,7 @@ QUIKitIntegration * QUIKitIntegration::instance() } QUIKitIntegration::QUIKitIntegration() - :mFontDb(new QUIKitFontDatabase() ) + :mFontDb(new QCoreTextFontDatabase) { if (!m_instance) m_instance = this; diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm index 3c1e360..6d24193 100644 --- a/src/plugins/platforms/uikit/quikitscreen.mm +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -63,7 +63,6 @@ QUIKitScreen::QUIKitScreen(int screenIndex) const qreal inch = 25.4; qreal dpi = 160.; int dragDistance = 12; - int defaultFontPixelSize = 14; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { dpi = 132.; dragDistance = 10; @@ -71,8 +70,8 @@ QUIKitScreen::QUIKitScreen(int screenIndex) m_physicalSize = QSize(qRound(bounds.size.width * inch / dpi), qRound(bounds.size.height * inch / dpi)); qApp->setStartDragDistance(dragDistance); - QFont font(QLatin1String("Bitstream Vera Sans")); - font.setPixelSize(defaultFontPixelSize); + QFont font; // system font is helvetica, so that is fine already + font.setPixelSize([UIFont systemFontSize]); qApp->setFont(font); [pool release]; -- cgit v0.12 From 2b6b6acec2f659f50416c7d6f369a266de19373b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 24 Aug 2011 09:26:07 +0200 Subject: uikit: fix examples to no longer ship the custom fonts --- .../uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj | 6 ------ .../uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj index 68237ae..dedc462 100755 --- a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj @@ -37,8 +37,6 @@ D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; - D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; - D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; D3D815F31329339300CDE422 /* flickr in Resources */ = {isa = PBXBuildFile; fileRef = D3D815D31329339300CDE422 /* flickr */; }; D3D815F4132933AB00CDE422 /* flickr in Resources */ = {isa = PBXBuildFile; fileRef = D3D815D31329339300CDE422 /* flickr */; }; D3D81758132A184300CDE422 /* libQtCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81752132A184300CDE422 /* libQtCore.a */; }; @@ -77,7 +75,6 @@ D3CAA7C713264AAD008BB877 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; D3CAA7F613264F52008BB877 /* flickrdemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flickrdemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; - D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; D3D815D31329339300CDE422 /* flickr */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flickr; path = ../../../../../../demos/declarative/flickr; sourceTree = SOURCE_ROOT; }; D3D81752132A184300CDE422 /* libQtCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore.a"; sourceTree = SOURCE_ROOT; }; D3D81753132A184300CDE422 /* libQtDeclarative.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative.a"; sourceTree = SOURCE_ROOT; }; @@ -173,7 +170,6 @@ isa = PBXGroup; children = ( D3D815D31329339300CDE422 /* flickr */, - D3CAA836132652E5008BB877 /* fonts */, 8D1107310486CEB800E47090 /* flickrdemo-Info.plist */, ); name = Resources; @@ -304,7 +300,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D3CAA88A132652E5008BB877 /* fonts in Resources */, D3D815F31329339300CDE422 /* flickr in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -313,7 +308,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D3CAA88B132652E5008BB877 /* fonts in Resources */, D3D815F4132933AB00CDE422 /* flickr in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj index 1dd9b35..021eed2 100755 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -37,8 +37,6 @@ D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; - D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; - D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; D3CAA89113265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; D3CAA89213265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AA132A2CFD00CDE422 /* libQtCore.a */; }; @@ -78,7 +76,6 @@ D3CAA7C713264AAD008BB877 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; D3CAA7F613264F52008BB877 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; - D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; D3CAA88E13265310008BB877 /* qml */ = {isa = PBXFileReference; lastKnownFileType = folder; path = qml; sourceTree = SOURCE_ROOT; }; D3D817AA132A2CFD00CDE422 /* libQtCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore.a"; sourceTree = SOURCE_ROOT; }; D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative.a"; sourceTree = SOURCE_ROOT; }; @@ -175,7 +172,6 @@ isa = PBXGroup; children = ( D3CAA88E13265310008BB877 /* qml */, - D3CAA836132652E5008BB877 /* fonts */, 8D1107310486CEB800E47090 /* qmltest-Info.plist */, ); name = Resources; @@ -306,7 +302,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D3CAA88A132652E5008BB877 /* fonts in Resources */, D3CAA89113265310008BB877 /* qml in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -315,7 +310,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D3CAA88B132652E5008BB877 /* fonts in Resources */, D3CAA89213265310008BB877 /* qml in Resources */, ); runOnlyForDeploymentPostprocessing = 0; -- cgit v0.12 From 1a8a36eb6b6df9e2550b5eaa4606f2d411fd4294 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 24 Aug 2011 09:13:45 +0200 Subject: Fix justification of RTL text Since the trailing space is included in the QScriptLine, it may affect the positions of preceding script items when the text is RTL. The best solution for this would be to disregard the trailing space in the layout process, or somehow make it have an advance of 0 so it doesn't affect the layout. However, to minimize the impact of the change, and to be consistent with previous work arounds such as bf992df6434fc37715f728ca09601c5567dd83c9, we simply include the trailing (visually leading) space in the justification pass for now. Task-number: QTBUG-20920 Reviewed-by: Lars --- src/gui/text/qtextengine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 9f148ee..aa4a20d 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2087,7 +2087,8 @@ void QTextEngine::justify(const QScriptLine &line) } } - QFixed need = line.width - line.textWidth; + QFixed leading = leadingSpaceWidth(line); + QFixed need = line.width - line.textWidth - leading; if (need < 0) { // line overflows already! const_cast(line).justified = true; -- cgit v0.12 From 00561c990b6a55de616267637fd3e772d4f10efe Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 24 Aug 2011 09:41:29 +0200 Subject: Revert "Include trailing space width in RTL text line width" This reverts commit 2fa986aa670bee0fafb30241f40bb3556594e32b. The fix was wrong. Use the IncludeTrailingSpaces flag if you want to include the trailing spaces in the text width. Reviewed-by: Jiang Jiang --- src/gui/text/qtextlayout.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 515915a..4fd6ddf 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1928,12 +1928,8 @@ found: if (line.textWidth > 0 && item < eng->layoutData->items.size()) eng->maxWidth += lbh.spaceData.textWidth; - // In the latter case, text are drawn with trailing spaces at the beginning - // of a line, so the naturalTextWidth should contain the space width - if ((eng->option.flags() & QTextOption::IncludeTrailingSpaces) || - (line.width == QFIXED_MAX && eng->isRightToLeft())) { + if (eng->option.flags() & QTextOption::IncludeTrailingSpaces) line.textWidth += lbh.spaceData.textWidth; - } if (lbh.spaceData.length) { line.length += lbh.spaceData.length; line.hasTrailingSpaces = true; -- cgit v0.12 From f9a2b1618ef67f6be0f986b24e75d138d20ee6c7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 22 Aug 2011 12:12:59 +0200 Subject: Fix QGLGlyphCache for Open GL ES (1). When resizing the font texture the code was using glGetTexImage which is not available on Open GL ES. We need to cache the font texture data, and draw the glyphs on it in addition, so we can copy the data when resizing the texture size. --- src/opengl/qpaintengine_opengl.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 71ed690..0f33cab 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4536,11 +4536,14 @@ struct QGLGlyphCoord { }; struct QGLFontTexture { + QGLFontTexture() : data(0) { } + ~QGLFontTexture() { free(data); } int x_offset; // glyph offset within the int y_offset; GLuint texture; int width; int height; + uchar *data; }; typedef QHash QGLGlyphHash; @@ -4563,7 +4566,7 @@ public: QGLGlyphCoord *lookup(QFontEngine *, glyph_t); void cacheGlyphs(QGLContext *, QFontEngine *, glyph_t *glyphs, int numGlyphs); void cleanCache(); - void allocTexture(int width, int height, GLuint texture); + void allocTexture(QGLFontTexture *); public slots: void cleanupContext(const QGLContext *); @@ -4681,19 +4684,18 @@ void QGLGlyphCache::cleanCache() qt_context_cache.clear(); } -void QGLGlyphCache::allocTexture(int width, int height, GLuint texture) +void QGLGlyphCache::allocTexture(QGLFontTexture *font_tex) { - uchar *tex_data = (uchar *) malloc(width*height*2); - memset(tex_data, 0, width*height*2); - glBindTexture(GL_TEXTURE_2D, texture); + font_tex->data = (uchar *) malloc(font_tex->width*font_tex->height*2); + memset(font_tex->data, 0, font_tex->width*font_tex->height*2); + glBindTexture(GL_TEXTURE_2D, font_tex->texture); #ifndef QT_OPENGL_ES glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8_ALPHA8, - width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex_data); + font_tex->width, font_tex->height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, font_tex->data); #else glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, - width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex_data); + font_tex->width, font_tex->height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, font_tex->data); #endif - free(tex_data); } #if 0 @@ -4777,13 +4779,13 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine, Q_ASSERT(max_tex_size > 0); if (tex_width > max_tex_size) tex_width = max_tex_size; - allocTexture(tex_width, tex_height, font_texture); font_tex = new QGLFontTexture; font_tex->texture = font_texture; font_tex->x_offset = x_margin; font_tex->y_offset = y_margin; font_tex->width = tex_width; font_tex->height = tex_height; + allocTexture(font_tex); // qDebug() << "new font tex - width:" << tex_width << "height:"<< tex_height // << hex << "tex id:" << font_tex->texture << "key:" << font_key << "num cached:" << qt_font_textures.size(); qt_font_textures.insert(font_key, font_tex); @@ -4806,21 +4808,19 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine, font_tex->y_offset += strip_height; if (font_tex->y_offset >= font_tex->height) { // get hold of the old font texture - uchar *old_tex_data = (uchar *) malloc(font_tex->width*font_tex->height*2); + uchar *old_tex_data = font_tex->data; int old_tex_height = font_tex->height; -#ifndef QT_OPENGL_ES - glGetTexImage(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, old_tex_data); -#endif // realloc a larger texture glDeleteTextures(1, &font_tex->texture); glGenTextures(1, &font_tex->texture); font_tex->height = qt_next_power_of_two(font_tex->height + strip_height); - allocTexture(font_tex->width, font_tex->height, font_tex->texture); + allocTexture(font_tex); // write back the old texture data glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, font_tex->width, old_tex_height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, old_tex_data); + memcpy(font_tex->data, old_tex_data, font_tex->width*old_tex_height*2); free(old_tex_data); // update the texture coords and the y offset for the existing glyphs in @@ -4868,8 +4868,10 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine, } #endif glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8); + int cacheLineStart = (font_tex->x_offset + font_tex->y_offset*font_tex->width)*2; for (int y=0; ydata+cacheLineStart, tex_data+lineStart, glyph_width*2); + cacheLineStart += font_tex->width*2; } glTexSubImage2D(GL_TEXTURE_2D, 0, font_tex->x_offset, font_tex->y_offset, glyph_width, glyph_im.height(), @@ -4950,7 +4955,7 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); bool antialias = !(textItem->fontEngine()->fontDef.styleStrategy & QFont::NoAntialias) - && (d->matrix.type() > QTransform::TxTranslate); + && (d->matrix.type() > QTransform::TxTranslate); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST); -- cgit v0.12 From 4eb50fbbf414103fb2f9dfb8260f4db5d61190c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Wed, 24 Aug 2011 15:29:17 +0300 Subject: Fix for qml1shaderplugin GPU resource handling on Symbian qml1shaderplugin now automatically recovers from situations when GL context is destroyed and related FBOs and shaderprograms become invalid. Additionally the shaderprograms are created lazily so that no GPU memory is used if items are not visible. Task-number: QTBUG-20724 QTBUG-20736 Reviewed-by: Jani Hautakangas --- src/imports/shaders/shadereffectitem.cpp | 110 ++++++++++++++++++++++------- src/imports/shaders/shadereffectitem.h | 4 +- src/imports/shaders/shadereffectsource.cpp | 43 ++++++----- src/imports/shaders/shadereffectsource.h | 3 +- 4 files changed, 116 insertions(+), 44 deletions(-) mode change 100644 => 100755 src/imports/shaders/shadereffectitem.cpp diff --git a/src/imports/shaders/shadereffectitem.cpp b/src/imports/shaders/shadereffectitem.cpp old mode 100644 new mode 100755 index 056581c..04c81f5 --- a/src/imports/shaders/shadereffectitem.cpp +++ b/src/imports/shaders/shadereffectitem.cpp @@ -199,8 +199,13 @@ Rectangle { */ +#ifdef Q_OS_SYMBIAN +#define OBSERVE_GL_CONTEXT_LOSS 1 +#endif + ShaderEffectItem::ShaderEffectItem(QDeclarativeItem *parent) : QDeclarativeItem(parent) + , m_program(0) , m_meshResolution(1, 1) , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) , m_blending(true) @@ -214,15 +219,21 @@ ShaderEffectItem::ShaderEffectItem(QDeclarativeItem *parent) , m_hasShaderPrograms(false) , m_mirrored(false) , m_defaultVertexShader(true) + , m_contextObserver(0) { setFlag(QGraphicsItem::ItemHasNoContents, false); connect(this, SIGNAL(visibleChanged()), this, SLOT(handleVisibilityChange())); m_active = isVisible(); + +#ifndef OBSERVE_GL_CONTEXT_LOSS + m_program = new QGLShaderProgram(this); +#endif } ShaderEffectItem::~ShaderEffectItem() { reset(); + delete m_contextObserver; } @@ -422,10 +433,38 @@ void ShaderEffectItem::renderEffect(QPainter *painter, const QMatrix4x4 &matrix) if (!painter || !painter->device()) return; - if (!m_program.isLinked() || m_program_dirty) +#ifdef OBSERVE_GL_CONTEXT_LOSS + QGLContext *context = const_cast (QGLContext::currentContext()); + if (!m_program || !m_contextObserver || !m_contextObserver->isValid()) { + // Context has changed, re-create QGLShaderProgram + if (context) { + delete m_program; + m_program = 0; + + delete m_contextObserver; + m_contextObserver = 0; + + m_program = new QGLShaderProgram(this); + m_contextObserver = new QGLFramebufferObject(QSize(2,2)); + + if (!m_contextObserver || !m_program) { + delete m_program; + m_program = 0; + delete m_contextObserver; + m_contextObserver = 0; + qWarning() << "ShaderEffectItem::renderEffect - Creating QGLShaderProgram or QGLFrameBufferObject failed!"; + } + } + } +#endif + + if (!m_program) + return; + + if (!m_program->isLinked() || m_program_dirty) updateShaderProgram(); - m_program.bind(); + m_program->bind(); QMatrix4x4 combinedMatrix; combinedMatrix.scale(2.0 / painter->device()->width(), -2.0 / painter->device()->height(), 1.0); @@ -434,7 +473,7 @@ void ShaderEffectItem::renderEffect(QPainter *painter, const QMatrix4x4 &matrix) updateEffectState(combinedMatrix); for (int i = 0; i < m_attributeNames.size(); ++i) { - m_program.enableAttributeArray(m_geometry.attributes()[i].position); + m_program->enableAttributeArray(m_geometry.attributes()[i].position); } bindGeometry(); @@ -472,11 +511,14 @@ void ShaderEffectItem::renderEffect(QPainter *painter, const QMatrix4x4 &matrix) glDisable(GL_DEPTH_TEST); for (int i = 0; i < m_attributeNames.size(); ++i) - m_program.disableAttributeArray(m_geometry.attributes()[i].position); + m_program->disableAttributeArray(m_geometry.attributes()[i].position); } void ShaderEffectItem::updateEffectState(const QMatrix4x4 &matrix) { + if (!m_program) + return; + for (int i = m_sources.size() - 1; i >= 0; --i) { const ShaderEffectItem::SourceData &source = m_sources.at(i); if (!source.source) @@ -487,10 +529,10 @@ void ShaderEffectItem::updateEffectState(const QMatrix4x4 &matrix) } if (m_respectsOpacity) - m_program.setUniformValue("qt_Opacity", static_cast (effectiveOpacity())); + m_program->setUniformValue("qt_Opacity", static_cast (effectiveOpacity())); if (m_respectsMatrix){ - m_program.setUniformValue("qt_ModelViewProjectionMatrix", matrix); + m_program->setUniformValue("qt_ModelViewProjectionMatrix", matrix); } QSet::const_iterator it; @@ -500,37 +542,37 @@ void ShaderEffectItem::updateEffectState(const QMatrix4x4 &matrix) switch (v.type()) { case QVariant::Color: - m_program.setUniformValue(name.constData(), qvariant_cast(v)); + m_program->setUniformValue(name.constData(), qvariant_cast(v)); break; case QVariant::Double: - m_program.setUniformValue(name.constData(), (float) qvariant_cast(v)); + m_program->setUniformValue(name.constData(), (float) qvariant_cast(v)); break; case QVariant::Transform: - m_program.setUniformValue(name.constData(), qvariant_cast(v)); + m_program->setUniformValue(name.constData(), qvariant_cast(v)); break; case QVariant::Int: - m_program.setUniformValue(name.constData(), v.toInt()); + m_program->setUniformValue(name.constData(), GLint(v.toInt())); break; case QVariant::Bool: - m_program.setUniformValue(name.constData(), GLint(v.toBool())); + m_program->setUniformValue(name.constData(), GLint(v.toBool())); break; case QVariant::Size: case QVariant::SizeF: - m_program.setUniformValue(name.constData(), v.toSizeF()); + m_program->setUniformValue(name.constData(), v.toSizeF()); break; case QVariant::Point: case QVariant::PointF: - m_program.setUniformValue(name.constData(), v.toPointF()); + 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()); + 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)); + m_program->setUniformValue(name.constData(), qvariant_cast(v)); break; default: break; @@ -558,6 +600,9 @@ static inline int size_of_type(GLenum type) void ShaderEffectItem::bindGeometry() { + if (!m_program) + return; + char const *const *attrNames = m_attributeNames.constData(); int offset = 0; for (int j = 0; j < m_attributeNames.size(); ++j) { @@ -574,7 +619,7 @@ void ShaderEffectItem::bindGeometry() 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()); + 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); } @@ -657,6 +702,16 @@ void ShaderEffectItem::setActive(bool enable) } } + // QGLShaderProgram is deleted when not active (to minimize GPU memory usage). +#ifdef OBSERVE_GL_CONTEXT_LOSS + if (!m_active && m_program) { + delete m_program; + m_program = 0; + delete m_contextObserver; + m_contextObserver = 0; + } +#endif + emit activeChanged(); markDirty(); } @@ -776,7 +831,9 @@ void ShaderEffectItem::reset() { disconnectPropertySignals(); - m_program.removeAllShaders(); + if (m_program) + m_program->removeAllShaders(); + m_attributeNames.clear(); m_uniformNames.clear(); for (int i = 0; i < m_sources.size(); ++i) { @@ -821,6 +878,9 @@ void ShaderEffectItem::updateProperties() void ShaderEffectItem::updateShaderProgram() { + if (!m_program) + return; + QString vertexCode = m_vertex_code; QString fragmentCode = m_fragment_code; @@ -830,16 +890,16 @@ void ShaderEffectItem::updateShaderProgram() if (fragmentCode.isEmpty()) fragmentCode = QString::fromLatin1(qt_default_fragment_code); - m_program.addShaderFromSourceCode(QGLShader::Vertex, vertexCode); - m_program.addShaderFromSourceCode(QGLShader::Fragment, fragmentCode); + 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); + m_program->bindAttributeLocation(m_attributeNames.at(i), m_geometry.attributes()[i].position); } - if (!m_program.link()) { + if (!m_program->link()) { qWarning("ShaderEffectItem: Shader compilation failed:"); - qWarning() << m_program.log(); + qWarning() << m_program->log(); } if (!m_attributeNames.contains(qt_postion_attribute_name)) @@ -849,10 +909,10 @@ void ShaderEffectItem::updateShaderProgram() if (!m_respectsMatrix) qWarning("ShaderEffectItem: Missing reference to \'qt_ModelViewProjectionMatrix\'."); - if (m_program.isLinked()) { - m_program.bind(); + 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->setUniformValue(m_sources.at(i).name.constData(), (GLint) i); } m_program_dirty = false; diff --git a/src/imports/shaders/shadereffectitem.h b/src/imports/shaders/shadereffectitem.h index aebe897..6c225a2 100644 --- a/src/imports/shaders/shadereffectitem.h +++ b/src/imports/shaders/shadereffectitem.h @@ -115,7 +115,7 @@ private: private: QString m_fragment_code; QString m_vertex_code; - QGLShaderProgram m_program; + QGLShaderProgram* m_program; QVector m_attributeNames; QSet m_uniformNames; QSize m_meshResolution; @@ -143,6 +143,8 @@ private: bool m_hasShaderPrograms : 1; bool m_mirrored : 1; bool m_defaultVertexShader : 1; + + QGLFramebufferObject* m_contextObserver; }; QT_END_HEADER diff --git a/src/imports/shaders/shadereffectsource.cpp b/src/imports/shaders/shadereffectsource.cpp index 6210c41..21d814a 100644 --- a/src/imports/shaders/shadereffectsource.cpp +++ b/src/imports/shaders/shadereffectsource.cpp @@ -170,15 +170,11 @@ void ShaderEffectSource::setSourceRect(const QRectF &rect) 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; - } + m_dirtyTexture = true; + markSourceItemDirty(); } /*! @@ -207,11 +203,8 @@ void ShaderEffectSource::setTextureSize(const QSize &size) emit textureSizeChanged(); emit repaintRequired(); - if (m_sourceItem) { - ShaderEffect* effect = qobject_cast (m_sourceItem->graphicsEffect()); - if (effect) - effect->m_changed = true; - } + m_dirtyTexture = true; + markSourceItemDirty(); } /*! @@ -294,8 +287,10 @@ void ShaderEffectSource::setWrapMode(WrapMode mode) return; m_wrapMode = mode; - updateBackbuffer(); emit wrapModeChanged(); + + m_dirtyTexture = true; + markSourceItemDirty(); } /*! @@ -314,7 +309,7 @@ void ShaderEffectSource::grab() emit repaintRequired(); } -void ShaderEffectSource::bind() const +void ShaderEffectSource::bind() { GLint filtering = smooth() ? GL_LINEAR : GL_NEAREST; GLuint hwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatHorizontally) ? GL_REPEAT : GL_CLAMP_TO_EDGE; @@ -323,9 +318,13 @@ void ShaderEffectSource::bind() const #if !defined(QT_OPENGL_ES_2) glEnable(GL_TEXTURE_2D); #endif - if (m_fbo) { + + if (m_fbo && m_fbo->isValid()) { glBindTexture(GL_TEXTURE_2D, m_fbo->texture()); } else { + m_dirtyTexture = true; + emit repaintRequired(); + markSourceItemDirty(); glBindTexture(GL_TEXTURE_2D, 0); } @@ -354,7 +353,7 @@ void ShaderEffectSource::derefFromEffectItem() void ShaderEffectSource::updateBackbuffer() { - if (!m_sourceItem) + if (!m_sourceItem || !QGLContext::currentContext()) return; // Multisampling is not (for now) supported. @@ -370,7 +369,7 @@ void ShaderEffectSource::updateBackbuffer() if (!m_fbo) { m_fbo = new ShaderEffectBuffer(size, format); } else { - if (m_fbo->size() != size || m_fbo->format().internalTextureFormat() != GLenum(m_format)) { + if (!m_fbo->isValid() || m_fbo->size() != size || m_fbo->format().internalTextureFormat() != GLenum(m_format)) { delete m_fbo; m_fbo = 0; m_fbo = new ShaderEffectBuffer(size, format); @@ -397,6 +396,16 @@ void ShaderEffectSource::markSourceSizeDirty() emit repaintRequired(); } +void ShaderEffectSource::markSourceItemDirty() +{ + m_dirtyTexture = true; + if (m_sourceItem) { + ShaderEffect* effect = qobject_cast (m_sourceItem->graphicsEffect()); + if (effect) + effect->m_changed = true; + } +} + void ShaderEffectSource::updateSizeAndTexture() { if (m_sourceItem) { @@ -407,7 +416,7 @@ void ShaderEffectSource::updateSizeAndTexture() size.setWidth(1); if (size.height() < 1) size.setHeight(1); - if (m_fbo && m_fbo->size() != size) { + if (m_fbo && (m_fbo->size() != size || !m_fbo->isValid())) { delete m_fbo; m_fbo = 0; delete m_multisampledFbo; diff --git a/src/imports/shaders/shadereffectsource.h b/src/imports/shaders/shadereffectsource.h index 0f03a6a..af8a815 100644 --- a/src/imports/shaders/shadereffectsource.h +++ b/src/imports/shaders/shadereffectsource.h @@ -99,7 +99,7 @@ public: void setWrapMode(WrapMode mode); bool isActive() const { return m_refs; } - void bind() const; + void bind(); void refFromEffectItem(); void derefFromEffectItem(); void updateBackbuffer(); @@ -124,6 +124,7 @@ Q_SIGNALS: public Q_SLOTS: void markSceneGraphDirty(); void markSourceSizeDirty(); + void markSourceItemDirty(); private: void updateSizeAndTexture(); -- cgit v0.12 From c691fc126a61a6153628a176d4375dd7ac76c0e1 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 25 Aug 2011 11:11:28 +0300 Subject: QS60Style omits drawing theme background in some Symbian SDKs Latest internal RnD releases have upgraded Symbian version to 5.4. As QS60Style was not aware of this, all the textures that didn't define any version information (i.e. available in all versions) were not drawn at all. Task-number: QT-5176 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style_s60.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 67181af..f1cf2f6 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -91,6 +91,7 @@ enum TSupportRelease { ES60_5_1 = 0x0008, ES60_5_2 = 0x0010, ES60_5_3 = 0x0020, + ES60_5_4 = 0x0040, ES60_3_X = ES60_3_1 | ES60_3_2, // Releases before Symbian Foundation ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0, @@ -98,8 +99,10 @@ enum TSupportRelease { ES60_Pre52 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1, // Releases before S60 5.3 ES60_Pre53 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2, + // Releases before S60 5.4 + ES60_Pre54 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3, // Add all new releases here - ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3 + ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3 | ES60_5_4 }; typedef struct { @@ -1264,7 +1267,8 @@ bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease) (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) || (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) || (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2) || - (currentRelease == QSysInfo::SV_S60_5_3 && supportedRelease & ES60_5_3) ); + (currentRelease == QSysInfo::SV_S60_5_3 && supportedRelease & ES60_5_3) || + (currentRelease == QSysInfo::SV_S60_5_4 && supportedRelease & ES60_5_4) ); } TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part) -- cgit v0.12 From c1491c356f3cca92a359468ce37f38bc1873eec4 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 25 Aug 2011 18:13:44 +1000 Subject: Fix memory leak in ListModel custom parser ModelNodes created by the parser for ListElement definitions were not deleted. Task-number: QTBUG-21084 Reviewed-by: Michael Brasser --- src/declarative/util/qdeclarativelistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 28c2df6..9604117 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -784,6 +784,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & QDeclarativeListModel *rv = static_cast(obj); ModelNode *root = new ModelNode(rv->m_nested); + rv->m_nested->m_ownsRoot = true; rv->m_nested->_root = root; QStack nodes; nodes << root; -- cgit v0.12 From 338346ceae99ec0d8f7227af12333d63393992be Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 25 Aug 2011 14:21:30 +0300 Subject: Crash when creating scroll bar skin graphics on S60 (debug only) When fetching bitmap graphics from native without fallback information, do not define fallback-mif file, since native side uses ASSERT_DEBUG to crash the client if file info exists, but bitmap ID is not defined. This started crashing when root theme removed default scrollbar graphics from its content for Belle release. Task-number: QTBUG-15993 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style_s60.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index f1cf2f6..2051362 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -711,7 +711,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( colorIndex, icon, iconMask, - AknIconUtils::AvkonIconFileName(), + (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC), fallbackGraphicID, fallbackGraphicsMaskID, defaultColor); @@ -949,7 +949,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( skinId, icon, iconMask, - AknIconUtils::AvkonIconFileName(), + (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC), fallbackGraphicID , fallbackGraphicsMaskID); @@ -1043,7 +1043,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( KAknsIIDDefault, //animation is not themed, lets force fallback graphics animationFrame, frameMask, - AknIconUtils::AvkonIconFileName(), + (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC), fallbackGraphicID , fallbackGraphicsMaskID); } -- cgit v0.12 From e9b3c429337a3ddc144aa1f39d40cd8dd151a566 Mon Sep 17 00:00:00 2001 From: peterpa Date: Thu, 25 Aug 2011 15:04:48 +0200 Subject: QWindowsStyle: fix bug in eventFilter on KeyPressed event with alt pressed: incorrect work with list Merge-request: 2664 Reviewed-by: Frederik Gladhorn --- src/gui/styles/qwindowsstyle.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index c099273..9732c7e 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -177,11 +177,14 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) // Alt has been pressed - find all widgets that care QList l = widget->findChildren(); - for (int pos=0 ; pos < l.size() ; ++pos) { + for (int pos=0 ; pos < l.size() ;) { QWidget *w = l.at(pos); if (w->isWindow() || !w->isVisible() || - w->style()->styleHint(SH_UnderlineShortcut, 0, w)) + w->style()->styleHint(SH_UnderlineShortcut, 0, w)) { l.removeAt(pos); + continue; + } + pos++; } // Update states before repainting d->seenAlt.append(widget); -- cgit v0.12 From 520dc46f9fad5f6adba9b71cebd007c04123dd30 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 25 Aug 2011 13:03:42 +0200 Subject: uikit: update README --- src/plugins/platforms/uikit/README | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README index 795e72a..a8031e6 100644 --- a/src/plugins/platforms/uikit/README +++ b/src/plugins/platforms/uikit/README @@ -7,8 +7,8 @@ There have no tests been run whatsoever. * Open GL ES 1/2 based backend * Single touch -* Text/font drawing using font shipped with application -* Text input (Opening/closing software input panel. +* Text/font drawing using system fonts (CoreText) +* Text input (Opening/closing software input panel Application has to perform necessary layout changes itself.) * Initial showing/hiding of status bar (as defined in the Info.plist) * Interface orientations as defined in the Info.plist of the application @@ -21,7 +21,16 @@ Building/Deploying the application has to be done in Xcode. You need to generate necessary moc_ files in advance and add these to the Xcode project. More details on the Xcode setup see below. -1) Build Qt +1) Known Issues + +* Console message + "QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!" + seems to appear sometimes for some people for unknown reasons and + unknown effect +* JavaScript XmlHttpRequest doesn't work reliably even though networking + in general seems to + +2) Build Qt The example Xcode project in the examples subdirectory requires that you do shadow builds of Qt in qt-lighthouse-ios-simulator and qt-lighthouse-ios-device directories @@ -43,7 +52,7 @@ Device: ------- configure -qpa -xplatform qpa/macx-iphonedevice-g++ -arch armv7 -no-neon -developer-build -release -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon-backend -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations -2) XCode setup: +3) XCode setup: - there are examples in the examples subdirectory of the platform plugin - to create something fresh do something like: - Xcode: Create a "View-based Appplication" @@ -64,5 +73,5 @@ configure -qpa -xplatform qpa/macx-iphonedevice-g++ -arch armv7 -no-neon -develo and call Phonon::Factory::setBackend(qt_plugin_instance_phonon_av()); Link to libphonon and to plugins/phonon/phonon_av -3) Done: Build and Run. +4) Done: Build and Run. -- cgit v0.12 From 41da349eb2bf25dba633578068b9bf2a7e7a6e24 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 25 Aug 2011 12:33:08 +0200 Subject: uikit: get rid of the "min 30fps" for event handling. This is actually not needed if done correctly. --- src/plugins/platforms/uikit/quikiteventloop.mm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 7df7ec8..152a34a 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -67,7 +67,6 @@ - (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration; -- (void)processEvents; - (void)processEventsAndSchedule; @end @@ -160,17 +159,11 @@ return self; } -- (void)processEvents -{ - QPlatformEventLoopIntegration::processEvents(); -} - - (void)processEventsAndSchedule { QPlatformEventLoopIntegration::processEvents(); - qint64 nextTime = qMin((qint64)33, mIntegration->nextTimerEvent()); // at least 30fps NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - NSDate *nextDate = [[NSDate date] dateByAddingTimeInterval:((double)nextTime/1000)]; + NSDate *nextDate = [[NSDate date] dateByAddingTimeInterval:((double)mIntegration->nextTimerEvent()/1000.)]; [mIntegration->mTimer setFireDate:nextDate]; [pool release]; } @@ -211,7 +204,7 @@ void QUIKitEventLoop::quitEventLoop() void QUIKitEventLoop::qtNeedsToProcessEvents() { - [mHelper performSelectorOnMainThread:@selector(processEvents) withObject:nil waitUntilDone:NO]; + [mHelper performSelectorOnMainThread:@selector(processEventsAndSchedule) withObject:nil waitUntilDone:NO]; } static UIReturnKeyType keyTypeForObject(QObject *obj) -- cgit v0.12 From 1dd59e4cf52b189d6ddf9fe7ff46a30e64e5a2ac Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 26 Aug 2011 10:33:20 +0200 Subject: Check if bridge plugin vector is still valid. Q_GLOBAL_STATIC may be destroyed and we still send ObjectDestroyed notifications. This only shows now that we actually send the Destroyed notifications. --- src/gui/accessible/qaccessible_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/accessible/qaccessible_unix.cpp b/src/gui/accessible/qaccessible_unix.cpp index 19fbe78..1c1eb2a 100644 --- a/src/gui/accessible/qaccessible_unix.cpp +++ b/src/gui/accessible/qaccessible_unix.cpp @@ -96,7 +96,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) } initialize(); - if (bridges()->isEmpty()) + if (!bridges() || bridges()->isEmpty()) return; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o); -- cgit v0.12 From a4eae8a44ca38739755ba8994251e2b120878ec8 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 26 Aug 2011 12:07:31 +0100 Subject: Fixed use of deleted object in XmlPatterns EvaluationCache This problem was shown up by the Ilta-Sanomat QML app on Symbian. Changes to the EvaluationCache class in 23267553627ac3c4cbcd918283bee8e665deeff9 meant that it was now trying to access the declaration object after it had been deleted. This change takes the data needed from the declaration object (1 bool) and stores that instead Task-number: QTTH-1492 Reviewed-by: Honglei Zhang --- src/xmlpatterns/expr/qevaluationcache.cpp | 5 ++--- src/xmlpatterns/expr/qevaluationcache_p.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/xmlpatterns/expr/qevaluationcache.cpp b/src/xmlpatterns/expr/qevaluationcache.cpp index 67109eb..3b6fc92 100644 --- a/src/xmlpatterns/expr/qevaluationcache.cpp +++ b/src/xmlpatterns/expr/qevaluationcache.cpp @@ -49,10 +49,9 @@ template EvaluationCache::EvaluationCache(const Expression::Ptr &op, const VariableDeclaration *varDecl, const VariableSlotID aSlot) : SingleContainer(op) - , m_declaration(varDecl) + , m_declarationUsedByMany(varDecl->usedByMany()) , m_varSlot(aSlot) { - Q_ASSERT(m_declaration); Q_ASSERT(m_varSlot > -1); } @@ -199,7 +198,7 @@ Expression::Ptr EvaluationCache::compress(const StaticContext::Ptr if(m_operand->is(IDRangeVariableReference)) return m_operand; - if(m_declaration->usedByMany()) + if (m_declarationUsedByMany) { /* If it's only an atomic value an EvaluationCache is overkill. However, * it's still needed for functions like fn:current-time() that must adhere to diff --git a/src/xmlpatterns/expr/qevaluationcache_p.h b/src/xmlpatterns/expr/qevaluationcache_p.h index 6080157..77d9c11 100644 --- a/src/xmlpatterns/expr/qevaluationcache_p.h +++ b/src/xmlpatterns/expr/qevaluationcache_p.h @@ -124,7 +124,7 @@ namespace QPatternist private: static DynamicContext::Ptr topFocusContext(const DynamicContext::Ptr &context); - const VariableDeclaration *m_declaration; + bool m_declarationUsedByMany; /** * This variable must not be called m_slot. If it so, a compiler bug on * HP-UX-aCC-64 is triggered in the constructor initializor. See the -- cgit v0.12 From dcee6e1371d899eb79717b8e3f3eec08b765db82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 11 Aug 2011 15:49:37 +0200 Subject: Fix QDir::operator==(const QDir &) const We can't rely on absolute paths when comparing directories for equality as these don't take into account symbolic links and may also bypass ../ and ./ simplification. Instead, canonical paths must be computed and can then be compared according to the case sensitivity rules for the platform or file engine, as is done in QFileInfo. Task-number: QTBUG-20495 Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 6 +++--- src/corelib/io/qfileinfo.cpp | 1 + tests/auto/qdir/tst_qdir.cpp | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index f9196e0..6e25d91 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1633,9 +1633,9 @@ bool QDir::operator==(const QDir &dir) const if (d->filters == other->filters && d->sort == other->sort && d->nameFilters == other->nameFilters) { - d->resolveAbsoluteEntry(); - other->resolveAbsoluteEntry(); - return d->absoluteDirEntry.filePath().compare(other->absoluteDirEntry.filePath(), sensitive) == 0; + + // Fallback to expensive canonical path computation + return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0; } return false; } diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index ca42c87..6e25206 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -406,6 +406,7 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const if (fileinfo.size() != size()) //if the size isn't the same... return false; + // Fallback to expensive canonical path computation return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0; } diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 0a42a97..419eaae 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -444,9 +444,15 @@ void tst_QDir::QDir_default() void tst_QDir::compare() { // operator== + + // Not using QCOMPARE to test result of QDir::operator== + QDir dir; dir.makeAbsolute(); QVERIFY(dir == QDir::currentPath()); + + QVERIFY(QDir() == QDir(QDir::currentPath())); + QVERIFY(QDir("../") == QDir(QDir::currentPath() + "/..")); } static QStringList filterLinks(const QStringList &list) -- cgit v0.12 From 664abe11efdbf582a5433abccf0d8c6fdbe2b040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 11 Aug 2011 16:17:40 +0200 Subject: Compare non-canonical paths before falling back on expensive computation Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 4 ++++ src/corelib/io/qfileinfo.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 6e25d91..c0c62e1 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1634,6 +1634,10 @@ bool QDir::operator==(const QDir &dir) const && d->sort == other->sort && d->nameFilters == other->nameFilters) { + // Assume directories are the same if path is the same + if (d->dirEntry.filePath() == other->dirEntry.filePath()) + return true; + // Fallback to expensive canonical path computation return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0; } diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 6e25206..ff328da 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -391,6 +391,11 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const return true; if (d->isDefaultConstructed || fileinfo.d_ptr->isDefaultConstructed) return false; + + // Assume files are the same if path is the same + if (d->fileEntry.filePath() == fileinfo.d_ptr->fileEntry.filePath()) + return true; + Qt::CaseSensitivity sensitive; if (d->fileEngine == 0 || fileinfo.d_ptr->fileEngine == 0) { if (d->fileEngine != fileinfo.d_ptr->fileEngine) // one is native, the other is a custom file-engine -- cgit v0.12 From 07afddbf4bc029f776810381c7317fffa100eb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Aug 2011 10:39:52 +0200 Subject: Don't second-guess the "engine"; call cleanPath on absolutePaths This ensures there is a single definition of what constitutes an absolute path in Qt. Task-number: QTBUG-19995 Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index c0c62e1..cbe635f 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -197,16 +197,10 @@ inline void QDirPrivate::resolveAbsoluteEntry() const return; QString absoluteName; - if (fileEngine.isNull()) { - if (!dirEntry.isRelative()) { - absoluteDirEntry = dirEntry; - return; - } - + if (fileEngine.isNull()) absoluteName = QFileSystemEngine::absoluteName(dirEntry).filePath(); - } else { + else absoluteName = fileEngine->fileName(QAbstractFileEngine::AbsoluteName); - } absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName), QFileSystemEntry::FromInternalPath()); } -- cgit v0.12 From 13899108ed57548d3c4f40e595481f8ee76e4fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Aug 2011 11:03:55 +0200 Subject: We prefer capitalized drive letters, make it so sooner Reviewed-by: Prasanth Ullattil --- src/corelib/io/qfilesystemengine_win.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index f704fc3..993c946 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1052,11 +1052,12 @@ QString QFileSystemEngine::tempPath() } if (ret.isEmpty()) { #if !defined(Q_OS_WINCE) - ret = QLatin1String("c:/tmp"); + ret = QLatin1String("C:/tmp"); #else ret = QLatin1String("/Temp"); #endif - } + } else if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) + ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. return ret; } -- cgit v0.12 From d4aa1777389f41da60a862a8c371d13839938d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Aug 2011 11:01:48 +0200 Subject: ret is an "internal" path, no need to re-process it Where "internal" means that it uses Qt's separator '/', regardless of the native one. --- src/corelib/io/qfilesystemengine_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 993c946..764ee6d 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -536,7 +536,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) // Force uppercase drive letters. ret[0] = ret.at(0).toUpper(); } - return QFileSystemEntry(ret); + return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath()); } //static -- cgit v0.12 From 91096126440aafba22aeb9307cb72135b3156a4c Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 26 Aug 2011 13:30:53 +0100 Subject: Porting the QTBUG-21084 fix to 4.7.4 This fixes a memory leak. It's SR1 tagged for 4.7.4. Task-number: QTBUG-21084 Reviewed-by: Honglei Zhang --- src/declarative/util/qdeclarativelistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index d0c8cc8..92aa6d0 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -784,6 +784,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & QDeclarativeListModel *rv = static_cast(obj); ModelNode *root = new ModelNode(rv->m_nested); + rv->m_nested->m_ownsRoot = true; rv->m_nested->_root = root; QStack nodes; nodes << root; -- cgit v0.12 From 2e32fca2c0f5252864d348df929d9858486763b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Aug 2011 17:09:01 +0200 Subject: In 4.7 QFileInfo::absolute(File)Path returned clean paths Let's play nice and keep that "feature". Task-number: QTBUG-19995 --- src/corelib/io/qfileinfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index ff328da..e317d1e 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -76,7 +76,9 @@ QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const break; case QAbstractFileEngine::AbsoluteName: case QAbstractFileEngine::AbsolutePathName: { - QFileSystemEntry entry = QFileSystemEngine::absoluteName(fileEntry); + QFileSystemEntry entry = QFileSystemEntry( + QDir::cleanPath(QFileSystemEngine::absoluteName(fileEntry).filePath()), + QFileSystemEntry::FromInternalPath()); if (cache_enabled) { // be smart and store both fileNames[QAbstractFileEngine::AbsoluteName] = entry.filePath(); fileNames[QAbstractFileEngine::AbsolutePathName] = entry.path(); -- cgit v0.12 From c0278760008efa18a068c6b5b2634b6cdb473dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Aug 2011 17:33:47 +0200 Subject: Revert "In 4.7 QFileInfo::absolute(File)Path returned clean paths" This reverts commit 2e32fca2c0f5252864d348df929d9858486763b1. The fix there is incorrect as it breaks QFileInfo autotests. --- src/corelib/io/qfileinfo.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index e317d1e..ff328da 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -76,9 +76,7 @@ QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const break; case QAbstractFileEngine::AbsoluteName: case QAbstractFileEngine::AbsolutePathName: { - QFileSystemEntry entry = QFileSystemEntry( - QDir::cleanPath(QFileSystemEngine::absoluteName(fileEntry).filePath()), - QFileSystemEntry::FromInternalPath()); + QFileSystemEntry entry = QFileSystemEngine::absoluteName(fileEntry); if (cache_enabled) { // be smart and store both fileNames[QAbstractFileEngine::AbsoluteName] = entry.filePath(); fileNames[QAbstractFileEngine::AbsolutePathName] = entry.path(); -- cgit v0.12 From 7b45a4cbf7593c8d7a837d826d9827fee243c46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Aug 2011 17:58:27 +0200 Subject: Revert "Don't second-guess the "engine"; call cleanPath on absolutePaths" This reverts commit 07afddbf4bc029f776810381c7317fffa100eb60. This breaks QDir autotests on windows. --- src/corelib/io/qdir.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index cbe635f..c0c62e1 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -197,10 +197,16 @@ inline void QDirPrivate::resolveAbsoluteEntry() const return; QString absoluteName; - if (fileEngine.isNull()) + if (fileEngine.isNull()) { + if (!dirEntry.isRelative()) { + absoluteDirEntry = dirEntry; + return; + } + absoluteName = QFileSystemEngine::absoluteName(dirEntry).filePath(); - else + } else { absoluteName = fileEngine->fileName(QAbstractFileEngine::AbsoluteName); + } absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName), QFileSystemEntry::FromInternalPath()); } -- cgit v0.12