This add a bool as return value on QCoreApplication::installTranslator
and QCoreApplication::removeTranslator. It returns true on success.
Before it was very clumsy to detected this. It was needed to react
on the signal and mark a success - just to provide an error message
on failure.
This is 99.99% source compatible - only if someone grabs a function
pointer to this - it will break the code - but it seems to be very
theoretic.
Change-Id: I947fcee1352f530e559bb177a90c10d84eed1aec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
generated by \l{Qt Designer} provide a \c retranslateUi() function that can be
called.
generated by \l{Qt Designer} provide a \c retranslateUi() function that can be
called.
+ The function returns true on success and false on failure.
+
\sa removeTranslator() translate() QTranslator::load() {Dynamic Translation}
*/
\sa removeTranslator() translate() QTranslator::load() {Dynamic Translation}
*/
-void QCoreApplication::installTranslator(QTranslator *translationFile)
+bool QCoreApplication::installTranslator(QTranslator *translationFile)
if (!QCoreApplicationPrivate::checkInstance("installTranslator"))
if (!QCoreApplicationPrivate::checkInstance("installTranslator"))
QCoreApplicationPrivate *d = self->d_func();
d->translators.prepend(translationFile);
#ifndef QT_NO_TRANSLATION_BUILDER
if (translationFile->isEmpty())
QCoreApplicationPrivate *d = self->d_func();
d->translators.prepend(translationFile);
#ifndef QT_NO_TRANSLATION_BUILDER
if (translationFile->isEmpty())
#endif
QEvent ev(QEvent::LanguageChange);
QCoreApplication::sendEvent(self, &ev);
#endif
QEvent ev(QEvent::LanguageChange);
QCoreApplication::sendEvent(self, &ev);
translation files used by this application. (It does not delete the
translation file from the file system.)
translation files used by this application. (It does not delete the
translation file from the file system.)
+ The function returns true on success and false on failure.
+
\sa installTranslator() translate(), QObject::tr()
*/
\sa installTranslator() translate(), QObject::tr()
*/
-void QCoreApplication::removeTranslator(QTranslator *translationFile)
+bool QCoreApplication::removeTranslator(QTranslator *translationFile)
if (!QCoreApplicationPrivate::checkInstance("removeTranslator"))
if (!QCoreApplicationPrivate::checkInstance("removeTranslator"))
QCoreApplicationPrivate *d = self->d_func();
if (d->translators.removeAll(translationFile) && !self->closingDown()) {
QEvent ev(QEvent::LanguageChange);
QCoreApplication::sendEvent(self, &ev);
QCoreApplicationPrivate *d = self->d_func();
if (d->translators.removeAll(translationFile) && !self->closingDown()) {
QEvent ev(QEvent::LanguageChange);
QCoreApplication::sendEvent(self, &ev);
}
static void replacePercentN(QString *result, int n)
}
static void replacePercentN(QString *result, int n)
#endif // QT_NO_LIBRARY
#ifndef QT_NO_TRANSLATION
#endif // QT_NO_LIBRARY
#ifndef QT_NO_TRANSLATION
- static void installTranslator(QTranslator * messageFile);
- static void removeTranslator(QTranslator * messageFile);
+ static bool installTranslator(QTranslator * messageFile);
+ static bool removeTranslator(QTranslator * messageFile);
#endif
enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = Latin1
#if QT_DEPRECATED_SINCE(5, 0)
#endif
enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = Latin1
#if QT_DEPRECATED_SINCE(5, 0)