From 5dec90ff13cd96ca4f341cf5e8360037edf5eeb3 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 13 Oct 2011 15:45:47 +0100 Subject: symbian - search drives for translation files Qt may be installed on a different drive from the application, particularly the case when Qt is included in ROM (Z:) and the application is on C: With this change, if QTranslator::load() specifies an absolute directory in the filesystem (e.g. "/resource/qt/translations") without a drive letter, then the symbian search paths are used. Note that this example path is the one returned by QLibraryInfo so applications using the example code from http://doc.qt.nokia.com/latest/internationalization.html#produce-translations will work as expected. Task-number: QT-5246 Reviewed-by: mread --- src/corelib/kernel/qtranslator.cpp | 40 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 3672846..8c08760 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -50,6 +50,7 @@ #include "qcoreapplication.h" #include "qcoreapplication_p.h" #include "qdatastream.h" +#include "qdir.h" #include "qfile.h" #include "qmap.h" #include "qalgorithms.h" @@ -61,6 +62,10 @@ #include "private/qcore_unix_p.h" #endif +#ifdef Q_OS_SYMBIAN +#include "private/qcore_symbian_p.h" +#endif + // most of the headers below are already included in qplatformdefs.h // also this lacks Large File support but that's probably irrelevant #if defined(QT_USE_MMAP) @@ -402,11 +407,24 @@ bool QTranslator::load(const QString & filename, const QString & directory, QString prefix; if (QFileInfo(filename).isRelative()) { +#ifdef Q_OS_SYMBIAN + if (directory.isEmpty()) + prefix = QCoreApplication::applicationDirPath(); + else + prefix = QFileInfo(directory).absoluteFilePath(); //TFindFile doesn't like dirty paths + if (prefix.length() > 2 && prefix.at(1) == QLatin1Char(':') && prefix.at(0).isLetter()) + prefix[0] = QLatin1Char('Y'); +#else prefix = directory; - if (prefix.length() && !prefix.endsWith(QLatin1Char('/'))) - prefix += QLatin1Char('/'); +#endif + if (prefix.length() && !prefix.endsWith(QLatin1Char('/'))) + prefix += QLatin1Char('/'); } +#ifdef Q_OS_SYMBIAN + QString nativePrefix = QDir::toNativeSeparators(prefix); +#endif + QString fname = filename; QString realname; QString delims; @@ -415,6 +433,24 @@ bool QTranslator::load(const QString & filename, const QString & directory, for (;;) { QFileInfo fi; +#ifdef Q_OS_SYMBIAN + //search for translations on other drives, e.g. Qt may be in Z, while app is in C + //note this uses symbian search rules, i.e. y:->a:, followed by z: + TFindFile finder(qt_s60GetRFs()); + QString fname2 = fname + (suffix.isNull() ? QString::fromLatin1(".qm") : suffix); + TInt err = finder.FindByDir( + qt_QString2TPtrC(fname2), + qt_QString2TPtrC(nativePrefix)); + if (err != KErrNone) + err = finder.FindByDir(qt_QString2TPtrC(fname), qt_QString2TPtrC(nativePrefix)); + if (err == KErrNone) { + fi.setFile(qt_TDesC2QString(finder.File())); + realname = fi.canonicalFilePath(); + if (fi.isReadable() && fi.isFile()) + break; + } +#endif + realname = prefix + fname + (suffix.isNull() ? QString::fromLatin1(".qm") : suffix); fi.setFile(realname); if (fi.isReadable() && fi.isFile()) -- cgit v0.12 From 2543ed5b1b18864797b3a11c9bd13887c7567e86 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Fri, 14 Oct 2011 13:00:15 +0300 Subject: Add new signals to indicate GPU resource usage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QML elements that use GPU resources directly needs to know when Qt releases GPU resources and when they are available again. Task-number: QT-5310 Reviewed-by: Samuel Rødal --- src/gui/kernel/qapplication.cpp | 28 ++++++++++++++++++++++++++++ src/gui/kernel/qapplication.h | 4 ++++ src/gui/kernel/qapplication_p.h | 3 +++ src/gui/kernel/qapplication_s60.cpp | 24 ++++++++++++++++++++++++ src/s60installs/eabi/QtGuiu.def | 7 +++++++ 5 files changed, 66 insertions(+) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 34ce9a8..34decef 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3389,7 +3389,35 @@ QString QApplication::sessionKey() const } #endif +/*! + \since 4.7.4 + \fn void QApplication::aboutToReleaseGpuResources() + + This signal is emitted when application is about to release all + GPU resources accociated to contexts owned by application. + + The signal is particularly useful if your application has allocated + GPU resources directly apart from Qt and needs to do some last-second + cleanup. + + \warning This signal is only emitted on Symbian. + + \sa aboutToUseGpuResources() +*/ +/*! + \since 4.7.4 + \fn void QApplication::aboutToUseGpuResources() + + This signal is emitted when application is about to use GPU resources. + + The signal is particularly useful if your application needs to know + when GPU resources are be available. + + \warning This signal is only emitted on Symbian. + + \sa aboutToFreeGpuResources() +*/ /*! \since 4.2 diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index cbf0117..32ff91b 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -298,6 +298,10 @@ Q_SIGNALS: void commitDataRequest(QSessionManager &sessionManager); void saveStateRequest(QSessionManager &sessionManager); #endif +#ifdef Q_OS_SYMBIAN + void aboutToReleaseGpuResources(); + void aboutToUseGpuResources(); +#endif public: QString styleSheet() const; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 99822e2..abdee49 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -523,6 +523,9 @@ public: int symbianResourceChange(const QSymbianEvent *symbianEvent); void _q_aboutToQuit(); + + void emitAboutToReleaseGpuResources(); + void emitAboutToUseGpuResources(); #endif #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) void sendSyntheticEnterLeave(QWidget *widget); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a53d273..5c657a4 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -207,6 +207,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) { QWidgetBackingStoreTracker &backingStore = topData->backingStore; if (visible) { + QApplicationPrivate *d = QApplicationPrivate::instance(); + d->emitAboutToUseGpuResources(); + if (backingStore.data()) { backingStore.registerWidget(widget); } else { @@ -216,6 +219,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) widget->repaint(); } } else { + QApplicationPrivate *d = QApplicationPrivate::instance(); + d->emitAboutToReleaseGpuResources(); + // In certain special scenarios we may get an ENotVisible event // without a previous EPartiallyVisible. The backingstore must // still be destroyed, hence the registerWidget() call below. @@ -2704,6 +2710,24 @@ void QApplicationPrivate::_q_aboutToQuit() #endif } +void QApplicationPrivate::emitAboutToReleaseGpuResources() +{ +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES + Q_Q(QApplication); + QPointer guard(q); + emit q->aboutToReleaseGpuResources(); +#endif +} + +void QApplicationPrivate::emitAboutToUseGpuResources() +{ +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES + Q_Q(QApplication); + QPointer guard(q); + emit q->aboutToUseGpuResources(); +#endif +} + QS60ThreadLocalData::QS60ThreadLocalData() { CCoeEnv *env = CCoeEnv::Static(); diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 6028a6d..723fcf6 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12198,4 +12198,11 @@ EXPORTS _ZNK11QPixmapData15toVolatileImageEv @ 12197 NONAME _ZNK14QVolatileImage13constImageRefEv @ 12198 NONAME _Z43qt_s60_setPartialScreenAutomaticTranslationb @ 12199 NONAME + _ZN11QTextEngine16getClusterLengthEPtPK17HB_CharAttributesiiiPi @ 12200 NONAME + _ZN11QTextEngine18positionInLigatureEPK11QScriptItemi6QFixedS3_ib @ 12201 NONAME + _ZN12QApplication22aboutToUseGpuResourcesEv @ 12202 NONAME + _ZN12QApplication26aboutToReleaseGpuResourcesEv @ 12203 NONAME + _ZN14QWidgetPrivate16_q_cleanupWinIdsEv @ 12204 NONAME + _ZN19QApplicationPrivate26emitAboutToUseGpuResourcesEv @ 12205 NONAME + _ZN19QApplicationPrivate30emitAboutToReleaseGpuResourcesEv @ 12206 NONAME -- cgit v0.12