summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlinfo.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-13 02:36:05 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-13 02:36:05 (GMT)
commit5e31c0cae45bae6f66decfb37825ed5d445e49e4 (patch)
tree3feade068e8543f56a0eec9054fdba0dfb83740c /src/declarative/qml/qmlinfo.cpp
parentd71db342a34690438878684f054dca820f77b1b9 (diff)
downloadQt-5e31c0cae45bae6f66decfb37825ed5d445e49e4.zip
Qt-5e31c0cae45bae6f66decfb37825ed5d445e49e4.tar.gz
Qt-5e31c0cae45bae6f66decfb37825ed5d445e49e4.tar.bz2
More i18n
Diffstat (limited to 'src/declarative/qml/qmlinfo.cpp')
-rw-r--r--src/declarative/qml/qmlinfo.cpp53
1 files changed, 17 insertions, 36 deletions
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index e3c0225..75de985 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -42,18 +42,19 @@
#include "qmlinfo.h"
#include <private/qmldeclarativedata_p.h>
#include <QtDeclarative/qmlcontext.h>
+#include <QtGui/qapplication.h>
QT_BEGIN_NAMESPACE
/*!
- \class QmlInfo
- \brief The QmlInfo class prints warnings messages that include the file and line number for QML types.
+ \fn void qmlInfo(const QString& message, QObject *object)
+
+ \brief Prints warnings messages that include the file and line number for QML types.
When QML types display warning messages, it improves tracibility
if they include the QML file and line number on which the
particular instance was instantiated.
- QmlInfo statements work just like regular Qt qDebug() statements.
To include the file and line number, an object must be passed. If
the file and line number is not available for that instance
(either it was not instantiated by the QML engine or location
@@ -62,7 +63,7 @@ QT_BEGIN_NAMESPACE
For example,
\code
- qmlInfo(this) << "component property is a write-once property";
+ qmlInfo(object, tr("component property is a write-once property"));
\endcode
prints
@@ -72,46 +73,26 @@ QT_BEGIN_NAMESPACE
\endcode
*/
-/*!
- Construct a QmlInfo, using \a object for file and line number
- information.
-*/
-QmlInfo::QmlInfo(QObject *object)
-: QDebug(QtWarningMsg)
+void qmlInfo(const QString& msg, QObject* object)
{
- *this << "QML";
- if (object)
- *this << object->metaObject()->className();
+ QString pos = QLatin1String("QML ") + QLatin1String(object->metaObject()->className());
QmlDeclarativeData *ddata = QmlDeclarativeData::get(object);
+ pos += QLatin1String("(");
if (ddata) {
- QString location = QLatin1String("(");
if (ddata->outerContext) {
- location += ddata->outerContext->baseUrl().toString();
+ pos += ddata->outerContext->baseUrl().toString();
} else {
- location += "unknown";
+ pos += qApp->translate("QmlInfo","unknown");
}
- location += QLatin1String(":");
- location += QString::number(ddata->lineNumber);
- location += QLatin1String(":");
- location += QString::number(ddata->columnNumber);
- location += QLatin1String(")");
- *this << qPrintable(location);
+ pos += QLatin1String(":");
+ pos += QString::number(ddata->lineNumber);
+ pos += QLatin1String(":");
+ pos += QString::number(ddata->columnNumber);
} else {
- *this << "(unknown location):";
+ pos += qApp->translate("QmlInfo","unknown location");
}
+ pos += QLatin1String(")");
+ qWarning((pos + msg).toLocal8Bit()); // XXX allow other processing?
}
-/*!
- The destructor does nothing special.
-*/
-QmlInfo::~QmlInfo()
-{
-}
-
-/*!
- \relates QmlInfo
- \fn QmlInfo qmlInfo(QObject *me)
- Constructs an instance of QmlInfo from \a me and returns it.
-*/
-
QT_END_NAMESPACE