summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-08-30 12:58:04 (GMT)
committerMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-08-30 12:58:04 (GMT)
commitbe69c316c56379d2b955491ffc54754018079dec (patch)
treec7305db1cbfcc2886928e099450fc56dbc9e9db7 /tools
parent308cc906b80a1cfffde6604f158705101670b824 (diff)
parentb4a7eadb28a49ace84994dcff665b1cabae69652 (diff)
downloadQt-be69c316c56379d2b955491ffc54754018079dec.zip
Qt-be69c316c56379d2b955491ffc54754018079dec.tar.gz
Qt-be69c316c56379d2b955491ffc54754018079dec.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1.git into doc-4.7
Conflicts: doc/src/getting-started/examples.qdoc doc/src/index.qdoc
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/lib/fulltextsearch/qsort_p.h8
-rw-r--r--tools/assistant/lib/qhelpcollectionhandler_p.h3
-rw-r--r--tools/assistant/lib/qhelpengine.h2
-rw-r--r--tools/assistant/lib/qhelpenginecore.cpp2
-rw-r--r--tools/assistant/lib/qhelpenginecore.h2
-rw-r--r--tools/assistant/lib/qhelpsearchengine.h3
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp4
-rw-r--r--tools/assistant/tools/assistant/bookmarkfiltermodel.cpp2
-rw-r--r--tools/assistant/tools/assistant/bookmarkitem.h2
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanagerwidget.h5
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp2
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.h2
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.h2
-rw-r--r--tools/assistant/tools/assistant/installdialog.h2
-rw-r--r--tools/assistant/tools/assistant/main.cpp2
-rw-r--r--tools/assistant/tools/assistant/mainwindow.h2
-rw-r--r--tools/assistant/tools/assistant/searchwidget.h2
-rw-r--r--tools/assistant/tools/qhelpconverter/inputpage.h2
-rw-r--r--tools/configure/configure.pro2
-rw-r--r--tools/configure/configureapp.cpp25
-rw-r--r--tools/configure/environment.cpp7
-rw-r--r--tools/configure/tools.cpp10
-rw-r--r--tools/linguist/linguist/mainwindow.cpp3
-rw-r--r--tools/linguist/lupdate/qscript.cpp234
-rw-r--r--tools/linguist/lupdate/qscript.g249
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp10
-rw-r--r--tools/qdoc3/htmlgenerator.cpp177
-rw-r--r--tools/qdoc3/htmlgenerator.h1
-rw-r--r--tools/qdoc3/node.cpp23
-rw-r--r--tools/qdoc3/test/qt-defines.qdocconf46
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf21
-rw-r--r--tools/qdoc3/tree.cpp6
-rw-r--r--tools/qml/qmlruntime.cpp14
-rw-r--r--tools/qml/qmlruntime.h1
-rw-r--r--tools/qtconfig/main.cpp14
-rw-r--r--tools/qvfb/main.cpp13
-rw-r--r--tools/qvfb/qvfb.cpp54
-rw-r--r--tools/qvfb/qvfbratedlg.cpp10
-rw-r--r--tools/runonphone/ossignalconverter.h2
-rw-r--r--tools/runonphone/runonphone.pro3
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertymanager.cpp20
41 files changed, 774 insertions, 220 deletions
diff --git a/tools/assistant/lib/fulltextsearch/qsort_p.h b/tools/assistant/lib/fulltextsearch/qsort_p.h
index e6f024b..5c75c58 100644
--- a/tools/assistant/lib/fulltextsearch/qsort_p.h
+++ b/tools/assistant/lib/fulltextsearch/qsort_p.h
@@ -64,15 +64,15 @@ private:
class QHELP_EXPORT QCLuceneSort
{
public:
- QCLuceneSort();
- QCLuceneSort(const QStringList &fieldNames);
- QCLuceneSort(const QString &field, bool reverse = false);
+ QCLuceneSort();
+ explicit QCLuceneSort(const QStringList &fieldNames);
+ explicit QCLuceneSort(const QString &field, bool reverse = false);
virtual ~QCLuceneSort();
QString toString() const;
void setSort(const QStringList &fieldNames);
- void setSort(const QString &field, bool reverse = false);
+ void setSort(const QString &field, bool reverse = false);
protected:
friend class QCLuceneHits;
diff --git a/tools/assistant/lib/qhelpcollectionhandler_p.h b/tools/assistant/lib/qhelpcollectionhandler_p.h
index 8efe507..8901b06 100644
--- a/tools/assistant/lib/qhelpcollectionhandler_p.h
+++ b/tools/assistant/lib/qhelpcollectionhandler_p.h
@@ -76,7 +76,8 @@ public:
};
typedef QList<DocInfo> DocInfoList;
- QHelpCollectionHandler(const QString &collectionFile, QObject *parent = 0);
+ explicit QHelpCollectionHandler(const QString &collectionFile,
+ QObject *parent = 0);
~QHelpCollectionHandler();
QString collectionFile() const;
diff --git a/tools/assistant/lib/qhelpengine.h b/tools/assistant/lib/qhelpengine.h
index 2bdb983..3577f4b 100644
--- a/tools/assistant/lib/qhelpengine.h
+++ b/tools/assistant/lib/qhelpengine.h
@@ -62,7 +62,7 @@ class QHELP_EXPORT QHelpEngine : public QHelpEngineCore
Q_OBJECT
public:
- QHelpEngine(const QString &collectionFile, QObject *parent = 0);
+ explicit QHelpEngine(const QString &collectionFile, QObject *parent = 0);
~QHelpEngine();
QHelpContentModel *contentModel() const;
diff --git a/tools/assistant/lib/qhelpenginecore.cpp b/tools/assistant/lib/qhelpenginecore.cpp
index 71306af..d72dfe4 100644
--- a/tools/assistant/lib/qhelpenginecore.cpp
+++ b/tools/assistant/lib/qhelpenginecore.cpp
@@ -706,7 +706,7 @@ QVariant QHelpEngineCore::metaData(const QString &documentationFileName,
}
/*!
- Returns a description of the last error that occured.
+ Returns a description of the last error that occurred.
*/
QString QHelpEngineCore::error() const
{
diff --git a/tools/assistant/lib/qhelpenginecore.h b/tools/assistant/lib/qhelpenginecore.h
index 118c310..db25c0b 100644
--- a/tools/assistant/lib/qhelpenginecore.h
+++ b/tools/assistant/lib/qhelpenginecore.h
@@ -65,7 +65,7 @@ class QHELP_EXPORT QHelpEngineCore : public QObject
Q_PROPERTY(QString currentFilter READ currentFilter WRITE setCurrentFilter)
public:
- QHelpEngineCore(const QString &collectionFile, QObject *parent = 0);
+ explicit QHelpEngineCore(const QString &collectionFile, QObject *parent = 0);
virtual ~QHelpEngineCore();
bool setupData();
diff --git a/tools/assistant/lib/qhelpsearchengine.h b/tools/assistant/lib/qhelpsearchengine.h
index 545360c..0b07920 100644
--- a/tools/assistant/lib/qhelpsearchengine.h
+++ b/tools/assistant/lib/qhelpsearchengine.h
@@ -80,7 +80,8 @@ class QHELP_EXPORT QHelpSearchEngine : public QObject
Q_OBJECT
public:
- QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *parent = 0);
+ explicit QHelpSearchEngine(QHelpEngineCore *helpEngine,
+ QObject *parent = 0);
~QHelpSearchEngine();
QHelpSearchQueryWidget* queryWidget();
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
index c2274c4..75cc2b9 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
@@ -173,7 +173,7 @@ void QHelpSearchIndexReaderClucene::run()
QCLuceneDocument document;
const QStringList namespaceList = engine.registeredDocumentations();
- foreach (QSharedPointer<QCLuceneHits> hits, cluceneHitsList) {
+ foreach (const QSharedPointer<QCLuceneHits> &hits, cluceneHitsList) {
for (qint32 i = 0; i < hits->length(); i++) {
document = hits->document(i);
const QString path = document.get(PathField);
@@ -415,7 +415,7 @@ bool QHelpSearchIndexReaderClucene::addAttributesQuery(
void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engine,
QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList)
{
- foreach (const QHelpSearchQuery query, queryList) {
+ foreach (const QHelpSearchQuery &query, queryList) {
if (query.fieldName != QHelpSearchQuery::DEFAULT)
continue;
diff --git a/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp b/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp
index 5874493..7a7c2e3 100644
--- a/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp
+++ b/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp
@@ -319,4 +319,4 @@ BookmarkTreeModel::filterAcceptsRow(int row, const QModelIndex &parent) const
&& model->data(model->index(row, 0, parent), UserRoleFolder).toBool())
return true;
return false;
-} \ No newline at end of file
+}
diff --git a/tools/assistant/tools/assistant/bookmarkitem.h b/tools/assistant/tools/assistant/bookmarkitem.h
index 924a762..7c5b8d0 100644
--- a/tools/assistant/tools/assistant/bookmarkitem.h
+++ b/tools/assistant/tools/assistant/bookmarkitem.h
@@ -58,7 +58,7 @@ typedef QVector<QVariant> DataVector;
class BookmarkItem
{
public:
- BookmarkItem(const DataVector &data, BookmarkItem *parent = 0);
+ explicit BookmarkItem(const DataVector &data, BookmarkItem *parent = 0);
~BookmarkItem();
BookmarkItem *parent() const;
diff --git a/tools/assistant/tools/assistant/bookmarkmanagerwidget.h b/tools/assistant/tools/assistant/bookmarkmanagerwidget.h
index 94384a6..56433cb 100644
--- a/tools/assistant/tools/assistant/bookmarkmanagerwidget.h
+++ b/tools/assistant/tools/assistant/bookmarkmanagerwidget.h
@@ -57,7 +57,8 @@ class BookmarkManagerWidget : public QWidget
{
Q_OBJECT
public:
- BookmarkManagerWidget(BookmarkModel *bookmarkModel, QWidget *parent = 0);
+ explicit BookmarkManagerWidget(BookmarkModel *bookmarkModel,
+ QWidget *parent = 0);
~BookmarkManagerWidget();
protected:
@@ -99,4 +100,4 @@ private:
QT_END_NAMESPACE
-#endif // BOOKMARKMANAGERWIDGET_H \ No newline at end of file
+#endif // BOOKMARKMANAGERWIDGET_H
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 131fb85..f42dfdf 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -1011,7 +1011,7 @@ CentralWidget::highlightSearchTerms()
case QHelpSearchQuery::DEFAULT:
case QHelpSearchQuery::ATLEAST:
foreach (QString term, query.wordList)
- terms.append(term.remove(QLatin1String("\"")));
+ terms.append(term.remove(QLatin1Char('"')));
}
}
}
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h
index acb734b..58aacd7 100644
--- a/tools/assistant/tools/assistant/helpviewer_qtb.h
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.h
@@ -61,7 +61,7 @@ class HelpViewer : public QTextBrowser, public AbstractHelpViewer
Q_OBJECT
public:
- HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
+ explicit HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
~HelpViewer();
QFont viewerFont() const;
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h
index 1897e3e..d4a27a2 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.h
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.h
@@ -58,7 +58,7 @@ class HelpViewer : public QWebView, public AbstractHelpViewer
Q_OBJECT
public:
- HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
+ explicit HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
~HelpViewer();
QFont viewerFont() const;
diff --git a/tools/assistant/tools/assistant/installdialog.h b/tools/assistant/tools/assistant/installdialog.h
index 2f19519..afafc63 100644
--- a/tools/assistant/tools/assistant/installdialog.h
+++ b/tools/assistant/tools/assistant/installdialog.h
@@ -61,7 +61,7 @@ class InstallDialog : public QDialog
Q_OBJECT
public:
- InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent = 0,
+ explicit InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent = 0,
const QString &host = QString(), int port = -1);
~InstallDialog();
diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp
index 51ea9f9..02507ae 100644
--- a/tools/assistant/tools/assistant/main.cpp
+++ b/tools/assistant/tools/assistant/main.cpp
@@ -355,7 +355,7 @@ int main(int argc, char *argv[])
QHelpEngineCore cachedCollection(cachedCollectionFile);
if (!cachedCollection.setupData()) {
cmd.showMessage(QCoreApplication::translate("Assistant",
- "Error reading collection file '%1': %2").
+ "Error reading collection file '%1': %2.").
arg(cachedCollectionFile).
arg(cachedCollection.error()), true);
return EXIT_FAILURE;
diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h
index 8e4276d..8219140 100644
--- a/tools/assistant/tools/assistant/mainwindow.h
+++ b/tools/assistant/tools/assistant/mainwindow.h
@@ -66,7 +66,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow(CmdLineParser *cmdLine, QWidget *parent = 0);
+ explicit MainWindow(CmdLineParser *cmdLine, QWidget *parent = 0);
~MainWindow();
static void activateCurrentBrowser();
diff --git a/tools/assistant/tools/assistant/searchwidget.h b/tools/assistant/tools/assistant/searchwidget.h
index 465e8f6..750497b 100644
--- a/tools/assistant/tools/assistant/searchwidget.h
+++ b/tools/assistant/tools/assistant/searchwidget.h
@@ -58,7 +58,7 @@ class SearchWidget : public QWidget
Q_OBJECT
public:
- SearchWidget(QHelpSearchEngine *engine, QWidget *parent = 0);
+ explicit SearchWidget(QHelpSearchEngine *engine, QWidget *parent = 0);
~SearchWidget();
void zoomIn();
diff --git a/tools/assistant/tools/qhelpconverter/inputpage.h b/tools/assistant/tools/qhelpconverter/inputpage.h
index e9276c6..28a7075 100644
--- a/tools/assistant/tools/qhelpconverter/inputpage.h
+++ b/tools/assistant/tools/qhelpconverter/inputpage.h
@@ -54,7 +54,7 @@ class InputPage : public QWizardPage
Q_OBJECT
public:
- InputPage(AdpReader *reader, QWidget *parent = 0);
+ explicit InputPage(AdpReader *reader, QWidget *parent = 0);
private slots:
void getFileName();
diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro
index 73f3317..a3473af 100644
--- a/tools/configure/configure.pro
+++ b/tools/configure/configure.pro
@@ -28,7 +28,7 @@ INCLUDEPATH += \
$$QT_SOURCE_TREE/src/corelib/global \
$$QT_BUILD_TREE/include \
$$QT_BUILD_TREE/include/QtCore \
- $$QT_BUILD_TREE/tools/shared
+ $$QT_SOURCE_TREE/tools/shared
HEADERS = configureapp.h environment.h tools.h\
$$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 0c716d1..e1d7275 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -341,7 +341,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "ACCESSIBILITY" ] = "yes";
dictionary[ "OPENGL" ] = "yes";
dictionary[ "OPENVG" ] = "no";
- dictionary[ "IPV6" ] = "yes"; // Always, dynamicly loaded
+ dictionary[ "IPV6" ] = "yes"; // Always, dynamically loaded
dictionary[ "OPENSSL" ] = "auto";
dictionary[ "DBUS" ] = "auto";
dictionary[ "S60" ] = "yes";
@@ -2149,7 +2149,7 @@ bool Configure::checkAvailability(const QString &part)
available = (paths.size() == 0);
if (!available) {
- if (epocRoot.isNull() || epocRoot == "")
+ if (epocRoot.isEmpty())
epocRoot = "<empty string>";
cout << endl
<< "The QtMultimedia audio backend will not be built because required" << endl
@@ -2667,8 +2667,13 @@ void Configure::generateOutputVars()
qtConfig += "audio-backend";
}
- if (dictionary["WEBKIT"] == "yes")
- qtConfig += "webkit";
+ if (dictionary["WEBKIT"] == "yes") {
+ // This include takes care of adding "webkit" to QT_CONFIG.
+ QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri";
+ QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri";
+ QFile::remove(dst);
+ QFile::copy(src, dst);
+ }
if (dictionary["DECLARATIVE"] == "yes") {
if (dictionary[ "SCRIPT" ] == "no") {
@@ -2695,7 +2700,7 @@ void Configure::generateOutputVars()
QString set_config = dictionary["QCONFIG"];
if (possible_configs.contains(set_config)) {
- foreach(QString cfg, possible_configs) {
+ foreach (const QString &cfg, possible_configs) {
qtConfig += (cfg + "-config");
if (cfg == set_config)
break;
@@ -2821,7 +2826,7 @@ void Configure::generateCachefile()
QStringList buildParts;
buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations";
- foreach(QString item, disabledBuildParts) {
+ foreach (const QString &item, disabledBuildParts) {
buildParts.removeAll(item);
}
cacheStream << "QT_BUILD_PARTS = " << buildParts.join(" ") << endl;
@@ -3134,7 +3139,7 @@ void Configure::generateConfigfiles()
QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
QStringList allKbdDrivers;
allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
- foreach(QString kbd, allKbdDrivers) {
+ foreach (const QString &kbd, allKbdDrivers) {
if (!kbdDrivers.contains(kbd))
tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
}
@@ -3142,7 +3147,7 @@ void Configure::generateConfigfiles()
QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
QStringList allMouseDrivers;
allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
- foreach(QString mouse, allMouseDrivers) {
+ foreach (const QString &mouse, allMouseDrivers) {
if (!mouseDrivers.contains(mouse))
tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
}
@@ -3150,7 +3155,7 @@ void Configure::generateConfigfiles()
QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
QStringList allGfxDrivers;
allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
- foreach(QString gfx, allGfxDrivers) {
+ foreach (const QString &gfx, allGfxDrivers) {
if (!gfxDrivers.contains(gfx))
tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
}
@@ -3158,7 +3163,7 @@ void Configure::generateConfigfiles()
tmpStream<<"#define Q_WS_QWS"<<endl;
QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
- foreach(QString depth, depths)
+ foreach (const QString &depth, depths)
tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
}
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index 943a8a2..03fd0cc 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -281,8 +281,7 @@ static QByteArray qt_create_environment(const QStringList &environment)
pos += tmpSize;
}
// add the user environment
- for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) {
- QString tmp = *it;
+ foreach (const QString &tmp, environment) {
uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
envlist.resize(envlist.size() + tmpSize);
memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
@@ -386,7 +385,7 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv
switch(GetLastError()) {
case E2BIG:
cerr << "execute: Argument list exceeds 1024 bytes" << endl;
- foreach(QString arg, arguments)
+ foreach (const QString &arg, arguments)
cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl;
break;
case ENOENT:
@@ -400,7 +399,7 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv
break;
default:
cerr << "execute: Unknown error" << endl;
- foreach(QString arg, arguments)
+ foreach (const QString &arg, arguments)
cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl;
break;
}
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp
index c4625af..c91f048 100644
--- a/tools/configure/tools.cpp
+++ b/tools/configure/tools.cpp
@@ -91,8 +91,8 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
QStringList components = buffer.split( '=' );
if ( components.size() >= 2 ) {
QStringList::Iterator it = components.begin();
- QString key = (*it++).trimmed().replace( "\"", QString() ).toUpper();
- QString value = (*it++).trimmed().replace( "\"", QString() );
+ QString key = (*it++).trimmed().remove('"').toUpper();
+ QString value = (*it++).trimmed().remove('"');
licenseInfo[ key ] = value;
}
}
@@ -111,7 +111,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
// Verify license info...
QString licenseKey = licenseInfo["LICENSEKEYEXT"];
QByteArray clicenseKey = licenseKey.toLatin1();
- //We check the licence
+ //We check the license
static const char * const SEP = "-";
char *licenseParts[NUMBER_OF_PARTS];
int partNumber = 0;
@@ -218,7 +218,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
// Generic, no-suffix license
- dictionary["LICENSE_EXTENSION"] = QString();
+ dictionary["LICENSE_EXTENSION"].clear();
} else if (dictionary["LICENSE_EXTENSION"].isEmpty()) {
cout << "License file does not contain proper license key." << endl;
dictionary["DONE"] = "error";
@@ -239,7 +239,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
fromLicenseFile += "-US";
if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
- (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) {
+ (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), false)) {
cout << "Failed to copy license file (" << fromLicenseFile << ")";
dictionary["DONE"] = "error";
return;
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index 163ef54..7d11823 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -142,10 +142,13 @@ static Ending ending(QString str, QLocale::Language lang)
case 0x2048: // question exclamation mark
case 0x2049: // exclamation question mark
case 0x2762: // heavy exclamation mark ornament
+ case 0xff01: // full width exclamation mark
+ case 0xff1f: // full width question mark
return End_Interrobang;
case 0x003b: // greek 'compatibility' questionmark
return lang == QLocale::Greek ? End_Interrobang : End_None;
case 0x003a: // colon
+ case 0xff1a: // full width colon
return End_Colon;
case 0x2026: // horizontal ellipsis
return End_Ellipsis;
diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp
index 188ac36..7ca0987 100644
--- a/tools/linguist/lupdate/qscript.cpp
+++ b/tools/linguist/lupdate/qscript.cpp
@@ -770,13 +770,16 @@ const int QScriptGrammar::action_check [] = {
static void recordMessage(
Translator *tor, const QString &context, const QString &text, const QString &comment,
- const QString &extracomment, bool plural, const QString &fileName, int lineNo)
+ const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
+ bool plural, const QString &fileName, int lineNo)
{
TranslatorMessage msg(
context, text, comment, QString(),
fileName, lineNo, QStringList(),
TranslatorMessage::Unfinished, plural);
msg.setExtraComment(extracomment.simplified());
+ msg.setId(msgid);
+ msg.setExtras(extra);
tor->extend(msg);
}
@@ -784,15 +787,23 @@ static void recordMessage(
namespace QScript
{
+class CommentProcessor
+{
+public:
+ virtual ~CommentProcessor() {}
+ virtual void processComment(const QChar *chars, int length) = 0;
+};
+
class Lexer
{
public:
- Lexer();
+ Lexer(CommentProcessor *);
~Lexer();
- void setCode(const QString &c, int lineno);
+ void setCode(const QString &c, const QString &fileName, int lineno);
int lex();
+ QString fileName() const { return yyfilename; }
int currentLineNo() const { return yylineno; }
int currentColumnNo() const { return yycolumn; }
@@ -872,6 +883,7 @@ public:
{ err = NoError; }
private:
+ QString yyfilename;
int yylineno;
bool done;
char *buffer8;
@@ -925,6 +937,8 @@ private:
void syncProhibitAutomaticSemicolon();
+ void processComment(const QChar *, int);
+
const QChar *code;
uint length;
int yycolumn;
@@ -951,6 +965,8 @@ private:
ParenthesesState parenthesesState;
int parenthesesCount;
bool prohibitAutomaticSemicolon;
+
+ CommentProcessor *commentProcessor;
};
} // namespace QScript
@@ -1027,7 +1043,7 @@ double integerFromString(const char *buf, int size, int radix)
} // namespace QScript
-QScript::Lexer::Lexer()
+QScript::Lexer::Lexer(QScript::CommentProcessor *proc)
:
yylineno(0),
size8(128), size16(128), restrKeyword(false),
@@ -1038,7 +1054,8 @@ QScript::Lexer::Lexer()
err(NoError),
check_reserved(true),
parenthesesState(IgnoreParentheses),
- prohibitAutomaticSemicolon(false)
+ prohibitAutomaticSemicolon(false),
+ commentProcessor(proc)
{
// allocate space for read buffers
buffer8 = new char[size8];
@@ -1053,9 +1070,10 @@ QScript::Lexer::~Lexer()
delete [] buffer16;
}
-void QScript::Lexer::setCode(const QString &c, int lineno)
+void QScript::Lexer::setCode(const QString &c, const QString &fileName, int lineno)
{
errmsg = QString();
+ yyfilename = fileName;
yylineno = lineno;
yycolumn = 1;
restrKeyword = false;
@@ -1404,10 +1422,12 @@ int QScript::Lexer::lex()
} else if (current == '/' && next1 == '/') {
recordStartPos();
shift(1);
+ Q_ASSERT(pos16 == 0);
state = InSingleLineComment;
} else if (current == '/' && next1 == '*') {
recordStartPos();
shift(1);
+ Q_ASSERT(pos16 == 0);
state = InMultiLineComment;
} else if (current == 0) {
syncProhibitAutomaticSemicolon();
@@ -1547,9 +1567,12 @@ int QScript::Lexer::lex()
break;
case InSingleLineComment:
if (isLineTerminator()) {
+ record16(current); // include newline
+ processComment(buffer16, pos16);
shiftWindowsLineBreak();
yylineno++;
yycolumn = 0;
+ pos16 = 0;
terminator = true;
bol = true;
if (restrKeyword) {
@@ -1559,6 +1582,8 @@ int QScript::Lexer::lex()
state = Start;
} else if (current == 0) {
setDone(Eof);
+ } else {
+ record16(current);
}
break;
case InMultiLineComment:
@@ -1570,8 +1595,12 @@ int QScript::Lexer::lex()
shiftWindowsLineBreak();
yylineno++;
} else if (current == '*' && next1 == '/') {
+ processComment(buffer16, pos16);
+ pos16 = 0;
state = Start;
shift(1);
+ } else {
+ record16(current);
}
break;
case InIdentifier:
@@ -2033,10 +2062,15 @@ void QScript::Lexer::syncProhibitAutomaticSemicolon()
}
}
+void QScript::Lexer::processComment(const QChar *chars, int length)
+{
+ commentProcessor->processComment(chars, length);
+}
+
class Translator;
-class QScriptParser: protected QScriptGrammar
+class QScriptParser: protected QScriptGrammar, public QScript::CommentProcessor
{
public:
QVariant val;
@@ -2052,10 +2086,12 @@ public:
QScriptParser();
~QScriptParser();
- bool parse(QScript::Lexer *lexer,
- const QString &fileName,
- Translator *translator);
+ void setLexer(QScript::Lexer *);
+
+ bool parse(Translator *translator);
+ QString fileName() const
+ { return lexer->fileName(); }
inline QString errorMessage() const
{ return error_message; }
inline int errorLineNumber() const
@@ -2072,6 +2108,10 @@ protected:
inline Location &loc(int index)
{ return location_stack [tos + index - 2]; }
+ std::ostream &yyMsg(int line = 0);
+
+ virtual void processComment(const QChar *, int);
+
protected:
int tos;
int stack_size;
@@ -2081,6 +2121,13 @@ protected:
QString error_message;
int error_lineno;
int error_column;
+
+private:
+ QScript::Lexer *lexer;
+ QString extracomment;
+ QString msgid;
+ QString sourcetext;
+ TranslatorMessage::ExtraData extra;
};
inline void QScriptParser::reallocateStack()
@@ -2107,7 +2154,8 @@ QScriptParser::QScriptParser():
stack_size(0),
sym_stack(0),
state_stack(0),
- location_stack(0)
+ location_stack(0),
+ lexer(0)
{
}
@@ -2129,10 +2177,14 @@ static inline QScriptParser::Location location(QScript::Lexer *lexer)
return loc;
}
-bool QScriptParser::parse(QScript::Lexer *lexer,
- const QString &fileName,
- Translator *translator)
+void QScriptParser::setLexer(QScript::Lexer *lex)
+{
+ lexer = lex;
+}
+
+bool QScriptParser::parse(Translator *translator)
{
+ Q_ASSERT(lexer != 0);
const int INITIAL_STATE = 0;
int yytoken = -1;
@@ -2214,44 +2266,70 @@ case 8: {
case 66: {
QString name = sym(1).toString();
if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) {
+ if (!sourcetext.isEmpty())
+ yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
QVariantList args = sym(2).toList();
if (args.size() < 2) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "() requires at least two arguments.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least two arguments.\n";
} else {
if ((args.at(0).type() != QVariant::String)
|| (args.at(1).type() != QVariant::String)) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "(): both arguments must be literal strings.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "(): both arguments must be literal strings.\n";
} else {
QString context = args.at(0).toString();
QString text = args.at(1).toString();
QString comment = args.value(2).toString();
- QString extracomment;
bool plural = (args.size() > 4);
recordMessage(translator, context, text, comment, extracomment,
- plural, fileName, identLineNo);
+ msgid, extra, plural, fileName(), identLineNo);
}
}
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
} else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) {
+ if (!sourcetext.isEmpty())
+ yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
QVariantList args = sym(2).toList();
if (args.size() < 1) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "() requires at least one argument.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
} else {
if (args.at(0).type() != QVariant::String) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "(): text to translate must be a literal string.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "(): text to translate must be a literal string.\n";
} else {
- QString context = QFileInfo(fileName).baseName();
+ QString context = QFileInfo(fileName()).baseName();
QString text = args.at(0).toString();
QString comment = args.value(1).toString();
- QString extracomment;
bool plural = (args.size() > 2);
recordMessage(translator, context, text, comment, extracomment,
- plural, fileName, identLineNo);
+ msgid, extra, plural, fileName(), identLineNo);
}
}
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
+ } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
+ if (!msgid.isEmpty())
+ yyMsg(identLineNo) << "//= cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ QVariantList args = sym(2).toList();
+ if (args.size() < 1) {
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ } else {
+ if (args.at(0).type() != QVariant::String) {
+ yyMsg(identLineNo) << qPrintable(name) << "(): identifier must be a literal string.\n";
+ } else {
+ msgid = args.at(0).toString();
+ bool plural = (args.size() > 1);
+ recordMessage(translator, QString(), sourcetext, QString(), extracomment,
+ msgid, extra, plural, fileName(), identLineNo);
+ }
+ }
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
}
} break;
@@ -2278,6 +2356,44 @@ case 94: {
sym(1) = QVariant();
} break;
+ case 171:
+
+ case 172:
+
+ case 173:
+
+ case 174:
+
+ case 175:
+
+ case 176:
+
+ case 177:
+
+ case 178:
+
+ case 179:
+
+ case 180:
+
+ case 181:
+
+ case 182:
+
+ case 183:
+
+ case 184:
+
+ case 185:
+ if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
+ yyMsg() << "Discarding unconsumed meta data\n";
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
+ }
+ break;
+
} // switch
state_stack [tos] = nt_action (act, lhs [r] - TERMINAL_COUNT);
@@ -2356,6 +2472,63 @@ case 94: {
return false;
}
+std::ostream &QScriptParser::yyMsg(int line)
+{
+ return std::cerr << qPrintable(fileName()) << ':' << (line ? line : lexer->startLineNo()) << ": ";
+}
+
+void QScriptParser::processComment(const QChar *chars, int length)
+{
+ if (!length)
+ return;
+ // Try to match the logic of the C++ parser.
+ if (*chars == QLatin1Char(':') && chars[1].isSpace()) {
+ extracomment += QString(chars+2, length-2);
+ } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) {
+ msgid = QString(chars+2, length-2).simplified();
+ } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) {
+ QString text = QString(chars+2, length-2).trimmed();
+ int k = text.indexOf(QLatin1Char(' '));
+ if (k > -1)
+ extra.insert(text.left(k), text.mid(k + 1).trimmed());
+ } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) {
+ sourcetext.reserve(sourcetext.length() + length-2);
+ ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length();
+ int p = 2, c;
+ forever {
+ if (p >= length)
+ break;
+ c = chars[p++].unicode();
+ if (isspace(c))
+ continue;
+ if (c != '"') {
+ yyMsg() << "Unexpected character in meta string\n";
+ break;
+ }
+ forever {
+ if (p >= length) {
+ whoops:
+ yyMsg() << "Unterminated meta string\n";
+ break;
+ }
+ c = chars[p++].unicode();
+ if (c == '"')
+ break;
+ if (c == '\\') {
+ if (p >= length)
+ goto whoops;
+ c = chars[p++].unicode();
+ if (c == '\n')
+ goto whoops;
+ *ptr++ = '\\';
+ }
+ *ptr++ = c;
+ }
+ }
+ sourcetext.resize(ptr - (ushort *)sourcetext.data());
+ }
+}
+
bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd)
{
@@ -2375,10 +2548,11 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData
ts.setAutoDetectUnicode(true);
QString code = ts.readAll();
- QScript::Lexer lexer;
- lexer.setCode(code, /*lineNumber=*/1);
QScriptParser parser;
- if (!parser.parse(&lexer, filename, &translator)) {
+ QScript::Lexer lexer(&parser);
+ lexer.setCode(code, filename, /*lineNumber=*/1);
+ parser.setLexer(&lexer);
+ if (!parser.parse(&translator)) {
std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": "
<< qPrintable(parser.errorMessage()) << std::endl;
return false;
diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g
index 857c58a..e4c2d22 100644
--- a/tools/linguist/lupdate/qscript.g
+++ b/tools/linguist/lupdate/qscript.g
@@ -101,13 +101,16 @@ QT_BEGIN_NAMESPACE
static void recordMessage(
Translator *tor, const QString &context, const QString &text, const QString &comment,
- const QString &extracomment, bool plural, const QString &fileName, int lineNo)
+ const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
+ bool plural, const QString &fileName, int lineNo)
{
TranslatorMessage msg(
context, text, comment, QString(),
fileName, lineNo, QStringList(),
TranslatorMessage::Unfinished, plural);
msg.setExtraComment(extracomment.simplified());
+ msg.setId(msgid);
+ msg.setExtras(extra);
tor->extend(msg);
}
@@ -115,15 +118,23 @@ static void recordMessage(
namespace QScript
{
+class CommentProcessor
+{
+public:
+ virtual ~CommentProcessor() {}
+ virtual void processComment(const QChar *chars, int length) = 0;
+};
+
class Lexer
{
public:
- Lexer();
+ Lexer(CommentProcessor *);
~Lexer();
- void setCode(const QString &c, int lineno);
+ void setCode(const QString &c, const QString &fileName, int lineno);
int lex();
+ QString fileName() const { return yyfilename; }
int currentLineNo() const { return yylineno; }
int currentColumnNo() const { return yycolumn; }
@@ -203,6 +214,7 @@ public:
{ err = NoError; }
private:
+ QString yyfilename;
int yylineno;
bool done;
char *buffer8;
@@ -256,6 +268,8 @@ private:
void syncProhibitAutomaticSemicolon();
+ void processComment(const QChar *, int);
+
const QChar *code;
uint length;
int yycolumn;
@@ -282,6 +296,8 @@ private:
ParenthesesState parenthesesState;
int parenthesesCount;
bool prohibitAutomaticSemicolon;
+
+ CommentProcessor *commentProcessor;
};
} // namespace QScript
@@ -358,7 +374,7 @@ double integerFromString(const char *buf, int size, int radix)
} // namespace QScript
-QScript::Lexer::Lexer()
+QScript::Lexer::Lexer(QScript::CommentProcessor *proc)
:
yylineno(0),
size8(128), size16(128), restrKeyword(false),
@@ -369,7 +385,8 @@ QScript::Lexer::Lexer()
err(NoError),
check_reserved(true),
parenthesesState(IgnoreParentheses),
- prohibitAutomaticSemicolon(false)
+ prohibitAutomaticSemicolon(false),
+ commentProcessor(proc)
{
// allocate space for read buffers
buffer8 = new char[size8];
@@ -384,9 +401,10 @@ QScript::Lexer::~Lexer()
delete [] buffer16;
}
-void QScript::Lexer::setCode(const QString &c, int lineno)
+void QScript::Lexer::setCode(const QString &c, const QString &fileName, int lineno)
{
errmsg = QString();
+ yyfilename = fileName;
yylineno = lineno;
yycolumn = 1;
restrKeyword = false;
@@ -735,10 +753,12 @@ int QScript::Lexer::lex()
} else if (current == '/' && next1 == '/') {
recordStartPos();
shift(1);
+ Q_ASSERT(pos16 == 0);
state = InSingleLineComment;
} else if (current == '/' && next1 == '*') {
recordStartPos();
shift(1);
+ Q_ASSERT(pos16 == 0);
state = InMultiLineComment;
} else if (current == 0) {
syncProhibitAutomaticSemicolon();
@@ -878,9 +898,12 @@ int QScript::Lexer::lex()
break;
case InSingleLineComment:
if (isLineTerminator()) {
+ record16(current); // include newline
+ processComment(buffer16, pos16);
shiftWindowsLineBreak();
yylineno++;
yycolumn = 0;
+ pos16 = 0;
terminator = true;
bol = true;
if (restrKeyword) {
@@ -890,6 +913,8 @@ int QScript::Lexer::lex()
state = Start;
} else if (current == 0) {
setDone(Eof);
+ } else {
+ record16(current);
}
break;
case InMultiLineComment:
@@ -901,8 +926,12 @@ int QScript::Lexer::lex()
shiftWindowsLineBreak();
yylineno++;
} else if (current == '*' && next1 == '/') {
+ processComment(buffer16, pos16);
+ pos16 = 0;
state = Start;
shift(1);
+ } else {
+ record16(current);
}
break;
case InIdentifier:
@@ -1364,10 +1393,15 @@ void QScript::Lexer::syncProhibitAutomaticSemicolon()
}
}
+void QScript::Lexer::processComment(const QChar *chars, int length)
+{
+ commentProcessor->processComment(chars, length);
+}
+
class Translator;
-class QScriptParser: protected $table
+class QScriptParser: protected $table, public QScript::CommentProcessor
{
public:
QVariant val;
@@ -1383,10 +1417,12 @@ public:
QScriptParser();
~QScriptParser();
- bool parse(QScript::Lexer *lexer,
- const QString &fileName,
- Translator *translator);
+ void setLexer(QScript::Lexer *);
+ bool parse(Translator *translator);
+
+ QString fileName() const
+ { return lexer->fileName(); }
inline QString errorMessage() const
{ return error_message; }
inline int errorLineNumber() const
@@ -1403,6 +1439,10 @@ protected:
inline Location &loc(int index)
{ return location_stack [tos + index - 2]; }
+ std::ostream &yyMsg(int line = 0);
+
+ virtual void processComment(const QChar *, int);
+
protected:
int tos;
int stack_size;
@@ -1412,6 +1452,13 @@ protected:
QString error_message;
int error_lineno;
int error_column;
+
+private:
+ QScript::Lexer *lexer;
+ QString extracomment;
+ QString msgid;
+ QString sourcetext;
+ TranslatorMessage::ExtraData extra;
};
inline void QScriptParser::reallocateStack()
@@ -1438,7 +1485,8 @@ QScriptParser::QScriptParser():
stack_size(0),
sym_stack(0),
state_stack(0),
- location_stack(0)
+ location_stack(0),
+ lexer(0)
{
}
@@ -1460,10 +1508,14 @@ static inline QScriptParser::Location location(QScript::Lexer *lexer)
return loc;
}
-bool QScriptParser::parse(QScript::Lexer *lexer,
- const QString &fileName,
- Translator *translator)
+void QScriptParser::setLexer(QScript::Lexer *lex)
{
+ lexer = lex;
+}
+
+bool QScriptParser::parse(Translator *translator)
+{
+ Q_ASSERT(lexer != 0);
const int INITIAL_STATE = 0;
int yytoken = -1;
@@ -1630,44 +1682,70 @@ CallExpression: MemberExpression Arguments ;
case $rule_number: {
QString name = sym(1).toString();
if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) {
+ if (!sourcetext.isEmpty())
+ yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
QVariantList args = sym(2).toList();
if (args.size() < 2) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "() requires at least two arguments.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least two arguments.\n";
} else {
if ((args.at(0).type() != QVariant::String)
|| (args.at(1).type() != QVariant::String)) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "(): both arguments must be literal strings.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "(): both arguments must be literal strings.\n";
} else {
QString context = args.at(0).toString();
QString text = args.at(1).toString();
QString comment = args.value(2).toString();
- QString extracomment;
bool plural = (args.size() > 4);
recordMessage(translator, context, text, comment, extracomment,
- plural, fileName, identLineNo);
+ msgid, extra, plural, fileName(), identLineNo);
}
}
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
} else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) {
+ if (!sourcetext.isEmpty())
+ yyMsg(identLineNo) << "//% cannot be used with " << qPrintable(name) << "(). Ignoring\n";
QVariantList args = sym(2).toList();
if (args.size() < 1) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "() requires at least one argument.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
} else {
if (args.at(0).type() != QVariant::String) {
- std::cerr << qPrintable(fileName) << ':' << identLineNo << ": "
- << qPrintable(name) << "(): text to translate must be a literal string.\n";
+ yyMsg(identLineNo) << qPrintable(name) << "(): text to translate must be a literal string.\n";
} else {
- QString context = QFileInfo(fileName).baseName();
+ QString context = QFileInfo(fileName()).baseName();
QString text = args.at(0).toString();
QString comment = args.value(1).toString();
- QString extracomment;
bool plural = (args.size() > 2);
recordMessage(translator, context, text, comment, extracomment,
- plural, fileName, identLineNo);
+ msgid, extra, plural, fileName(), identLineNo);
+ }
+ }
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
+ } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
+ if (!msgid.isEmpty())
+ yyMsg(identLineNo) << "//= cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ QVariantList args = sym(2).toList();
+ if (args.size() < 1) {
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ } else {
+ if (args.at(0).type() != QVariant::String) {
+ yyMsg(identLineNo) << qPrintable(name) << "(): identifier must be a literal string.\n";
+ } else {
+ msgid = args.at(0).toString();
+ bool plural = (args.size() > 1);
+ recordMessage(translator, QString(), sourcetext, QString(), extracomment,
+ msgid, extra, plural, fileName(), identLineNo);
}
}
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
}
} break;
./
@@ -1813,20 +1891,73 @@ ExpressionNotInOpt: ;
ExpressionNotInOpt: ExpressionNotIn ;
Statement: Block ;
+/.
+ case $rule_number:
+./
Statement: VariableStatement ;
+/.
+ case $rule_number:
+./
Statement: EmptyStatement ;
+/.
+ case $rule_number:
+./
Statement: ExpressionStatement ;
+/.
+ case $rule_number:
+./
Statement: IfStatement ;
+/.
+ case $rule_number:
+./
Statement: IterationStatement ;
+/.
+ case $rule_number:
+./
Statement: ContinueStatement ;
+/.
+ case $rule_number:
+./
Statement: BreakStatement ;
+/.
+ case $rule_number:
+./
Statement: ReturnStatement ;
+/.
+ case $rule_number:
+./
Statement: WithStatement ;
+/.
+ case $rule_number:
+./
Statement: LabelledStatement ;
+/.
+ case $rule_number:
+./
Statement: SwitchStatement ;
+/.
+ case $rule_number:
+./
Statement: ThrowStatement ;
+/.
+ case $rule_number:
+./
Statement: TryStatement ;
+/.
+ case $rule_number:
+./
Statement: DebuggerStatement ;
+/.
+ case $rule_number:
+ if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
+ yyMsg() << "Discarding unconsumed meta data\n";
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
+ }
+ break;
+./
Block: T_LBRACE StatementListOpt T_RBRACE ;
StatementList: Statement ;
@@ -1988,6 +2119,63 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
return false;
}
+std::ostream &QScriptParser::yyMsg(int line)
+{
+ return std::cerr << qPrintable(fileName()) << ':' << (line ? line : lexer->startLineNo()) << ": ";
+}
+
+void QScriptParser::processComment(const QChar *chars, int length)
+{
+ if (!length)
+ return;
+ // Try to match the logic of the C++ parser.
+ if (*chars == QLatin1Char(':') && chars[1].isSpace()) {
+ extracomment += QString(chars+2, length-2);
+ } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) {
+ msgid = QString(chars+2, length-2).simplified();
+ } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) {
+ QString text = QString(chars+2, length-2).trimmed();
+ int k = text.indexOf(QLatin1Char(' '));
+ if (k > -1)
+ extra.insert(text.left(k), text.mid(k + 1).trimmed());
+ } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) {
+ sourcetext.reserve(sourcetext.length() + length-2);
+ ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length();
+ int p = 2, c;
+ forever {
+ if (p >= length)
+ break;
+ c = chars[p++].unicode();
+ if (isspace(c))
+ continue;
+ if (c != '"') {
+ yyMsg() << "Unexpected character in meta string\n";
+ break;
+ }
+ forever {
+ if (p >= length) {
+ whoops:
+ yyMsg() << "Unterminated meta string\n";
+ break;
+ }
+ c = chars[p++].unicode();
+ if (c == '"')
+ break;
+ if (c == '\\') {
+ if (p >= length)
+ goto whoops;
+ c = chars[p++].unicode();
+ if (c == '\n')
+ goto whoops;
+ *ptr++ = '\\';
+ }
+ *ptr++ = c;
+ }
+ }
+ sourcetext.resize(ptr - (ushort *)sourcetext.data());
+ }
+}
+
bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd)
{
@@ -2007,10 +2195,11 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData
ts.setAutoDetectUnicode(true);
QString code = ts.readAll();
- QScript::Lexer lexer;
- lexer.setCode(code, /*lineNumber=*/1);
QScriptParser parser;
- if (!parser.parse(&lexer, filename, &translator)) {
+ QScript::Lexer lexer(&parser);
+ lexer.setCode(code, filename, /*lineNumber=*/1);
+ parser.setLexer(&lexer);
+ if (!parser.parse(&translator)) {
std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": "
<< qPrintable(parser.errorMessage()) << std::endl;
return false;
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index 7892025..a83a321 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -544,6 +544,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
funcIndex.clear();
legaleseTexts.clear();
serviceClasses.clear();
+ qmlClasses.clear();
findAllClasses(tree->root());
findAllFunctions(tree->root());
findAllLegaleseTexts(tree->root());
@@ -751,6 +752,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
else if (atom->string() == "classes") {
generateCompactList(relative, marker, nonCompatClasses, true);
}
+ else if (atom->string() == "qmlclasses") {
+ generateCompactList(relative, marker, qmlClasses, true);
+ }
else if (atom->string().contains("classesbymodule")) {
QString arg = atom->string().trimmed();
QString moduleName = atom->string().mid(atom->string().indexOf(
@@ -3675,6 +3679,12 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node)
if (!serviceName.isEmpty())
serviceClasses.insert(serviceName, *c);
}
+ else if ((*c)->type() == Node::Fake &&
+ (*c)->subType() == Node::QmlClass &&
+ !(*c)->doc().isEmpty()) {
+ QString qmlClassName = (*c)->name();
+ qmlClasses.insert(qmlClassName,*c);
+ }
else if ((*c)->isInnerNode()) {
findAllClasses(static_cast<InnerNode *>(*c));
}
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 4603a40..bc71b6e 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -376,6 +376,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
funcIndex.clear();
legaleseTexts.clear();
serviceClasses.clear();
+ qmlClasses.clear();
findAllClasses(tree->root());
findAllFunctions(tree->root());
findAllLegaleseTexts(tree->root());
@@ -611,6 +612,9 @@ int HtmlGenerator::generateAtom(const Atom *atom,
else if (atom->string() == "classes") {
generateCompactList(relative, marker, nonCompatClasses, true);
}
+ else if (atom->string() == "qmlclasses") {
+ generateCompactList(relative, marker, qmlClasses, true);
+ }
else if (atom->string().contains("classesbymodule")) {
QString arg = atom->string().trimmed();
QString moduleName = atom->string().mid(atom->string().indexOf(
@@ -1806,18 +1810,19 @@ void HtmlGenerator::generateHeader(const QString& title,
// Adding jquery and functions - providing online tools and search features
out() << " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n";
out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n";
- // Adding style and js for small windows
- out() << " <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n";
- out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />";
- out() << " <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n";
- out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n";
+
// Adding syntax highlighter // future release
- // Setting some additional style sheet related details depending on configuration (e.g. online/offline)
+ // Setting some additional style sheet related details depending on configuration (e.g. Online/Creator)
switch (application) {
case Online:
+ // Adding style and js for small windows
+ out() << " <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n";
+ out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />";
+ out() << " <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n";
+ out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n";
// Browser spec styles
out() << " <!--[if IE]>\n";
out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n";
@@ -3172,7 +3177,14 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
par1 = QStringRef();
const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self);
- addLink(linkForNode(n,relative), arg, &html);
+ if (n && n->subType() == Node::QmlBasicType) {
+ if (relative && relative->subType() == Node::QmlClass)
+ addLink(linkForNode(n,relative), arg, &html);
+ else
+ html += arg.toString();
+ }
+ else
+ addLink(linkForNode(n,relative), arg, &html);
handled = true;
}
else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
@@ -3534,7 +3546,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
return QString();
if (node->access() == Node::Private)
return QString();
-
+
fn = fileName(node);
/* if (!node->url().isEmpty())
return fn;*/
@@ -3707,6 +3719,12 @@ void HtmlGenerator::findAllClasses(const InnerNode *node)
if (!serviceName.isEmpty())
serviceClasses.insert(serviceName, *c);
}
+ else if ((*c)->type() == Node::Fake &&
+ (*c)->subType() == Node::QmlClass &&
+ !(*c)->doc().isEmpty()) {
+ QString qmlClassName = (*c)->name();
+ qmlClasses.insert(qmlClassName,*c);
+ }
else if ((*c)->isInnerNode()) {
findAllClasses(static_cast<InnerNode *>(*c));
}
@@ -4412,57 +4430,103 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
return true;
if (node->access() == Node::Private)
return false;
- if (!node->isInnerNode())
- return false;
+ QString guid = QUuid::createUuid().toString();
+ QString url = PageGenerator::fileName(node);
QString title;
QString rawTitle;
QString fullTitle;
- const InnerNode* inner = static_cast<const InnerNode*>(node);
-
- writer.writeStartElement("page");
+ QStringList pageWords;
QXmlStreamAttributes attributes;
- QString t;
- t.setNum(id++);
- switch (node->type()) {
- case Node::Fake:
- {
- const FakeNode* fake = static_cast<const FakeNode*>(node);
- title = fake->fullTitle();
+
+ writer.writeStartElement("page");
+
+ if (node->isInnerNode()) {
+ const InnerNode* inner = static_cast<const InnerNode*>(node);
+ if (!inner->pageKeywords().isEmpty())
+ pageWords << inner->pageKeywords();
+
+ switch (node->type()) {
+ case Node::Fake:
+ {
+ const FakeNode* fake = static_cast<const FakeNode*>(node);
+ title = fake->fullTitle();
+ pageWords << title;
+ break;
+ }
+ case Node::Class:
+ {
+ title = node->name() + " Class Reference";
+ pageWords << node->name() << "class" << "reference";
+ break;
+ }
+ case Node::Namespace:
+ {
+ rawTitle = marker->plainName(inner);
+ fullTitle = marker->plainFullName(inner);
+ title = rawTitle + " Namespace Reference";
+ pageWords << rawTitle << "namespace" << "reference";
+ break;
+ }
+ default:
+ title = node->name();
+ pageWords << title;
break;
}
- case Node::Class:
- {
- title = node->name() + " Class Reference";
+ }
+ else {
+ switch (node->type()) {
+ case Node::Enum:
+ {
+ title = node->name() + " Enum Reference";
+ pageWords << node->name() << "enum" << "type";
+ url += "#" + node->name() + "-enum";
+ break;
+ }
+ case Node::Function:
+ {
+ title = node->name() + " Function Reference";
+ pageWords << node->name() << "function";
+ url += "#" + node->name();
+ break;
+ }
+ case Node::Property:
+ {
+ title = node->name() + " Property Reference";
+ pageWords << node->name() << "property";
+ url += "#" + node->name() + "-prop";
+ break;
+ }
+ case Node::Typedef:
+ {
+ title = node->name() + " Type Reference";
+ pageWords << node->name() << "typedef" << "type";
+ url += "#" + node->name();
+ break;
+ }
+ default:
+ title = node->name();
+ pageWords << title;
break;
}
- case Node::Namespace:
- {
- rawTitle = marker->plainName(inner);
- fullTitle = marker->plainFullName(inner);
- title = rawTitle + " Namespace Reference";
- break;
+
+ Node* parent = node->parent();
+ if (parent && ((parent->type() == Node::Class) ||
+ (parent->type() == Node::Namespace))) {
+ pageWords << parent->name();
}
- default:
- title = node->name();
- break;
}
- writer.writeAttribute("id",t);
+
+ writer.writeAttribute("id",guid);
writer.writeStartElement("pageWords");
- writer.writeCharacters(title);
- if (!inner->pageKeywords().isEmpty()) {
- const QStringList& w = inner->pageKeywords();
- for (int i = 0; i < w.size(); ++i) {
- writer.writeCharacters(" ");
- writer.writeCharacters(w.at(i).toLocal8Bit().constData());
- }
- }
+ writer.writeCharacters(pageWords.join(" "));
+
writer.writeEndElement();
writer.writeStartElement("pageTitle");
writer.writeCharacters(title);
writer.writeEndElement();
writer.writeStartElement("pageUrl");
- writer.writeCharacters(PageGenerator::fileName(node));
+ writer.writeCharacters(url);
writer.writeEndElement();
writer.writeStartElement("pageType");
switch (node->pageType()) {
@@ -4480,6 +4544,35 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
}
writer.writeEndElement();
writer.writeEndElement();
+
+ if (node->type() == Node::Fake && node->doc().hasTableOfContents()) {
+ QList<Atom*> toc = node->doc().tableOfContents();
+ if (!toc.isEmpty()) {
+ for (int i = 0; i < toc.size(); ++i) {
+ Text headingText = Text::sectionHeading(toc.at(i));
+ QString s = headingText.toString();
+ writer.writeStartElement("page");
+ guid = QUuid::createUuid().toString();
+ QString internalUrl = url + "#" + Doc::canonicalTitle(s);
+ writer.writeAttribute("id",guid);
+ writer.writeStartElement("pageWords");
+ writer.writeCharacters(pageWords.join(" "));
+ writer.writeCharacters(" ");
+ writer.writeCharacters(s);
+ writer.writeEndElement();
+ writer.writeStartElement("pageTitle");
+ writer.writeCharacters(s);
+ writer.writeEndElement();
+ writer.writeStartElement("pageUrl");
+ writer.writeCharacters(internalUrl);
+ writer.writeEndElement();
+ writer.writeStartElement("pageType");
+ writer.writeCharacters("Article");
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ }
+ }
return true;
}
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index eab10c6..d885ada 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -330,6 +330,7 @@ class HtmlGenerator : public PageGenerator
NodeMap obsoleteClasses;
NodeMap namespaceIndex;
NodeMap serviceClasses;
+ NodeMap qmlClasses;
QMap<QString, NodeMap > funcIndex;
QMap<Text, const Node *> legaleseTexts;
NewSinceMaps newSinceMaps;
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 259641e..41f90d5 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -652,8 +652,14 @@ NodeList InnerNode::overloads(const QString &funcName) const
InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
: Node(type, parent, name)
{
- if (type == Class)
+ switch (type) {
+ case Class:
+ case Namespace:
setPageType(ApiPage);
+ break;
+ default:
+ break;
+ }
}
/*!
@@ -845,6 +851,19 @@ bool LeafNode::isInnerNode() const
LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name)
: Node(type, parent, name)
{
+ switch (type) {
+ case Enum:
+ case Function:
+ case Typedef:
+ case Variable:
+ case QmlProperty:
+ case QmlSignal:
+ case QmlMethod:
+ setPageType(ApiPage);
+ break;
+ default:
+ break;
+ }
}
/*!
@@ -1600,7 +1619,7 @@ QmlPropertyNode::QmlPropertyNode(QmlPropGroupNode *parent,
des(Trool_Default),
att(attached)
{
- // nothing.
+ setPageType(ApiPage);
}
/*!
diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf
index 9e41d93..344bbb0 100644
--- a/tools/qdoc3/test/qt-defines.qdocconf
+++ b/tools/qdoc3/test/qt-defines.qdocconf
@@ -20,29 +20,29 @@ codeindent = 1
# See also qhp.Qt.extraFiles
extraimages.HTML = qt-logo \
trolltech-logo \
- bg_l.png \
- bg_l_blank.png \
- bg_ll_blank.png \
- bg_ul_blank.png \
- header_bg.png \
- bg_r.png \
- box_bg.png \
- breadcrumb.png \
- bullet_gt.png \
- bullet_dn.png \
- bullet_sq.png \
- bullet_up.png \
- arrow_down.png \
- feedbackground.png \
- horBar.png \
- page.png \
- page_bg.png \
- sprites-combined.png \
- spinner.gif \
- stylesheet-coffee-plastique.png \
- taskmenuextension-example.png \
- coloreditorfactoryimage.png \
- dynamiclayouts-example.png \
+ bg_l.png \
+ bg_l_blank.png \
+ bg_ll_blank.png \
+ bg_ul_blank.png \
+ header_bg.png \
+ bg_r.png \
+ box_bg.png \
+ breadcrumb.png \
+ bullet_gt.png \
+ bullet_dn.png \
+ bullet_sq.png \
+ bullet_up.png \
+ arrow_down.png \
+ feedbackground.png \
+ horBar.png \
+ page.png \
+ page_bg.png \
+ sprites-combined.png \
+ spinner.gif \
+ stylesheet-coffee-plastique.png \
+ taskmenuextension-example.png \
+ coloreditorfactoryimage.png \
+ dynamiclayouts-example.png
# This stuff is used by the new doc format.
scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts
diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf
index 71b13ff..8d4d27f 100644
--- a/tools/qdoc3/test/qt-html-templates.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates.qdocconf
@@ -39,15 +39,17 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" <li><a href=\"modules.html\">Modules</a></li> \n" \
" <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \
" <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \
- " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \
+ " <li><a href=\"licensing.html\">Licenses and Credits</a></li> \n" \
" </ul> \n" \
" </li> \n" \
" <li><a href=\"#\">Qt Topics</a> \n" \
" <ul id=\"topmenuTopic\"> \n" \
- " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \
+ " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \
" <li><a href=\"qtquick.html\">Device UI's &amp; Qt Quick</a></li> \n" \
- " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \
+ " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \
+ " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \
" <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
+ " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \
" <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \
" </ul> \n" \
" </li> \n" \
@@ -86,7 +88,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \
" <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \
" <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \
+ " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global Declarations</a></li>\n" \
" <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \
" </ul> \n" \
" </div>\n" \
@@ -96,10 +98,13 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" Qt Topics</h2>\n" \
" <div id=\"list002\" class=\"list\">\n" \
" <ul id=\"ul002\" >\n" \
- " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UI's &amp; Qt Quick</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \
+ " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \
+ " <li><a href=\"qtquick.html\">Device UI's &amp; Qt Quick</a></li> \n" \
+ " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \
+ " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \
+ " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
+ " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \
+ " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \
" </ul> \n" \
" </div>\n" \
" </div>\n" \
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp
index 56e3484..540ffa9 100644
--- a/tools/qdoc3/tree.cpp
+++ b/tools/qdoc3/tree.cpp
@@ -1963,8 +1963,8 @@ QString Tree::fullDocumentLocation(const Node *node) const
if ((node->subType() == Node::QmlClass) ||
(node->subType() == Node::QmlBasicType)) {
QString fb = node->fileBase();
- if (fb.startsWith(QLatin1String("QML:")))
- return node->fileBase() + ".html";
+ if (fb.startsWith(QLatin1String("qml-")))
+ return fb + ".html";
else
return "qml-" + node->fileBase() + ".html";
} else
@@ -1981,7 +1981,7 @@ QString Tree::fullDocumentLocation(const Node *node) const
else if ((parentNode = node->parent())) {
if (parentNode->subType() == Node::QmlPropertyGroup) {
parentNode = parentNode->parent();
- parentName = "qml-" + parentNode->fileBase() + ".html";
+ parentName = fullDocumentLocation(parentNode);
}
else
parentName = fullDocumentLocation(node->parent());
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index b9fd570..321b7fd 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -85,6 +85,7 @@
#include <QMenu>
#include <QAction>
#include <QFileDialog>
+#include <QInputDialog>
#include <QTimer>
#include <QGraphicsObject>
#include <QNetworkProxyFactory>
@@ -715,6 +716,9 @@ void QDeclarativeViewer::createMenu()
openAction->setShortcuts(QKeySequence::Open);
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
+ QAction *openUrlAction = new QAction(tr("Open &URL..."), this);
+ connect(openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl()));
+
QAction *reloadAction = new QAction(tr("&Reload"), this);
reloadAction->setShortcuts(QKeySequence::Refresh);
connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
@@ -789,6 +793,7 @@ void QDeclarativeViewer::createMenu()
#if defined(Q_WS_MAEMO_5)
menu->addAction(openAction);
+ menu->addAction(openUrlAction);
menu->addAction(reloadAction);
menu->addAction(snapshotAction);
@@ -809,6 +814,7 @@ void QDeclarativeViewer::createMenu()
QMenu *fileMenu = menu->addMenu(tr("&File"));
fileMenu->addAction(openAction);
+ fileMenu->addAction(openUrlAction);
fileMenu->addAction(reloadAction);
fileMenu->addSeparator();
fileMenu->addAction(closeAction);
@@ -1021,6 +1027,14 @@ void QDeclarativeViewer::openFile()
}
}
+void QDeclarativeViewer::openUrl()
+{
+ QString cur = canvas->source().toLocalFile();
+ QString url= QInputDialog::getText(this, tr("Open QML file"), tr("URL of main QML file:"), QLineEdit::Normal, cur);
+ if (!url.isEmpty())
+ open(url);
+}
+
void QDeclarativeViewer::statusChanged()
{
if (canvas->status() == QDeclarativeView::Error && tester)
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index 6fa7d81..d1ec26d 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -113,6 +113,7 @@ public slots:
void sceneResized(QSize size);
bool open(const QString&);
void openFile();
+ void openUrl();
void reload();
void takeSnapShot();
void toggleRecording();
diff --git a/tools/qtconfig/main.cpp b/tools/qtconfig/main.cpp
index 24d044f..928cf01 100644
--- a/tools/qtconfig/main.cpp
+++ b/tools/qtconfig/main.cpp
@@ -42,6 +42,9 @@
#include "ui_previewwidgetbase.h"
#include "mainwindow.h"
#include <QApplication>
+#include <QLibraryInfo>
+#include <QLocale>
+#include <QTranslator>
QT_USE_NAMESPACE
@@ -50,6 +53,17 @@ int main(int argc, char **argv)
Q_INIT_RESOURCE(qtconfig);
QApplication app(argc, argv);
+
+ QTranslator translator;
+ QTranslator qtTranslator;
+ QString sysLocale = QLocale::system().name();
+ QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ if (translator.load(QLatin1String("qtconfig_") + sysLocale, resourceDir)
+ && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+ app.installTranslator(&translator);
+ app.installTranslator(&qtTranslator);
+ }
+
MainWindow mw;
mw.show();
return app.exec();
diff --git a/tools/qvfb/main.cpp b/tools/qvfb/main.cpp
index d96b255..28aa7d4 100644
--- a/tools/qvfb/main.cpp
+++ b/tools/qvfb/main.cpp
@@ -43,6 +43,9 @@
#include <QApplication>
#include <QRegExp>
+#include <QLibraryInfo>
+#include <QLocale>
+#include <QTranslator>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
@@ -73,6 +76,16 @@ int runQVfb( int argc, char *argv[] )
QApplication app( argc, argv );
+ QTranslator translator;
+ QTranslator qtTranslator;
+ QString sysLocale = QLocale::system().name();
+ QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ if (translator.load(QLatin1String("qvfb_") + sysLocale, resourceDir)
+ && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+ app.installTranslator(&translator);
+ app.installTranslator(&qtTranslator);
+ }
+
int width = 0;
int height = 0;
int depth = -32; // default, but overridable by skin
diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp
index bc9e529..b4ccebc 100644
--- a/tools/qvfb/qvfb.cpp
+++ b/tools/qvfb/qvfb.cpp
@@ -398,47 +398,47 @@ void QVFb::createMenu(T *menu)
QMenu* QVFb::createFileMenu()
{
- QMenu *file = new QMenu( "File", this );
- file->addAction( "Configure...", this, SLOT(configure()), 0 );
+ QMenu *file = new QMenu( tr("&File"), this );
+ file->addAction( tr("&Configure..."), this, SLOT(configure()), QKeySequence::Preferences );
file->addSeparator();
- file->addAction( "&Save image...", this, SLOT(saveImage()), 0 );
- file->addAction( "&Animation...", this, SLOT(toggleAnimation()), 0 );
+ file->addAction( tr("&Save image..."), this, SLOT(saveImage()), QKeySequence::Save );
+ file->addAction( tr("&Animation..."), this, SLOT(toggleAnimation()), 0 );
file->addSeparator();
- file->addAction( "&Quit", qApp, SLOT(quit()) );
+ file->addAction( tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit );
return file;
}
QMenu* QVFb::createViewMenu()
{
- viewMenu = new QMenu( "View", this );
- cursorAction = viewMenu->addAction( "Show &Cursor", this,
+ viewMenu = new QMenu( tr("&View"), this );
+ cursorAction = viewMenu->addAction( tr("Show &Cursor"), this,
SLOT(toggleCursor()) );
cursorAction->setCheckable(true);
if ( view )
enableCursor(true);
- viewMenu->addAction( "&Refresh Rate...", this, SLOT(changeRate()) );
+ viewMenu->addAction( tr("&Refresh Rate..."), this, SLOT(changeRate()) );
viewMenu->addSeparator();
- viewMenu->addAction( "No rotation", this, SLOT(setRot0()) );
- viewMenu->addAction( "90\260 rotation", this, SLOT(setRot90()) );
- viewMenu->addAction( "180\260 rotation", this, SLOT(setRot180()) );
- viewMenu->addAction( "270\260 rotation", this, SLOT(setRot270()) );
+ viewMenu->addAction( tr("&No rotation"), this, SLOT(setRot0()) );
+ viewMenu->addAction( tr("&90\260 rotation"), this, SLOT(setRot90()) );
+ viewMenu->addAction( tr("1&80\260 rotation"), this, SLOT(setRot180()) );
+ viewMenu->addAction( tr("2&70\260 rotation"), this, SLOT(setRot270()) );
viewMenu->addSeparator();
- viewMenu->addAction( "Zoom scale &0.5", this, SLOT(setZoomHalf()) );
- viewMenu->addAction( "Zoom scale 0.75", this, SLOT(setZoom075()) );
- viewMenu->addAction( "Zoom scale &1", this, SLOT(setZoom1()) );
- viewMenu->addAction( "Zoom scale &2", this, SLOT(setZoom2()) );
- viewMenu->addAction( "Zoom scale &3", this, SLOT(setZoom3()) );
- viewMenu->addAction( "Zoom scale &4", this, SLOT(setZoom4()) );
+ viewMenu->addAction( tr("Zoom scale &0.5"), this, SLOT(setZoomHalf()) );
+ viewMenu->addAction( tr("Zoom scale 0.7&5"), this, SLOT(setZoom075()) );
+ viewMenu->addAction( tr("Zoom scale &1"), this, SLOT(setZoom1()) );
+ viewMenu->addAction( tr("Zoom scale &2"), this, SLOT(setZoom2()) );
+ viewMenu->addAction( tr("Zoom scale &3"), this, SLOT(setZoom3()) );
+ viewMenu->addAction( tr("Zoom scale &4"), this, SLOT(setZoom4()) );
viewMenu->addSeparator();
- viewMenu->addAction( "Zoom scale...", this, SLOT(setZoom()) );
+ viewMenu->addAction( tr("Zoom &scale..."), this, SLOT(setZoom()) );
return viewMenu;
}
QMenu* QVFb::createHelpMenu()
{
- QMenu *help = new QMenu( "Help", this );
- help->addAction("About...", this, SLOT(about()));
+ QMenu *help = new QMenu( tr("&Help"), this );
+ help->addAction(tr("&About..."), this, SLOT(about()));
return help;
}
@@ -525,17 +525,17 @@ void QVFb::setZoom4()
void QVFb::saveImage()
{
QImage img = view->image();
- QString filename = QFileDialog::getSaveFileName(this, "Save Main Screen image", "snapshot.png", "Portable Network Graphics (*.png)");
+ QString filename = QFileDialog::getSaveFileName(this, tr("Save Main Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)"));
if (!filename.isEmpty()){
if(!img.save(filename,"PNG"))
- QMessageBox::critical(this, "Save Main Screen Image", "Save failed. Check that you have permission to write to the target directory.");
+ QMessageBox::critical(this, tr("Save Main Screen Image"), tr("Save failed. Check that you have permission to write to the target directory."));
}
if (secondaryView) {
QImage img = view->image();
- QString filename = QFileDialog::getSaveFileName(this, "Save Second Screen image", "snapshot.png", "Portable Network Graphics (*.png)");
+ QString filename = QFileDialog::getSaveFileName(this, tr("Save Second Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)"));
if (!filename.isEmpty()) {
if(!img.save(filename,"PNG"))
- QMessageBox::critical(this, "Save Second Screen Image", "Save failed. Check that you have permission to write to the target directory.");
+ QMessageBox::critical(this, tr("Save Second Screen Image"), tr("Save failed. Check that you have permission to write to the target directory."));
}
}
}
@@ -577,7 +577,7 @@ void QVFb::setRate(int i)
void QVFb::about()
{
- QMessageBox::about(this, "About QVFB",
+ QMessageBox::about(this, tr("About QVFB"), tr(
"<h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2>"
"<p>This application runs under Qt for X11, emulating a simple framebuffer, "
"which the Qt for Embedded Linux server and clients can attach to just as if "
@@ -586,7 +586,7 @@ void QVFb::about()
"Linux applications under X11 without having to switch to a virtual console. "
"This means you can comfortably use your other development tools such "
"as GUI profilers and debuggers."
- );
+ ));
}
void QVFb::findSkins(const QString &currentSkin)
diff --git a/tools/qvfb/qvfbratedlg.cpp b/tools/qvfb/qvfbratedlg.cpp
index e491bdf..a0cbb2f 100644
--- a/tools/qvfb/qvfbratedlg.cpp
+++ b/tools/qvfb/qvfbratedlg.cpp
@@ -55,7 +55,7 @@ QVFbRateDialog::QVFbRateDialog(int rate, QWidget *parent)
QVBoxLayout *tl = new QVBoxLayout(this);
tl->setMargin(5);
- QLabel *label = new QLabel("Target frame rate:", this);
+ QLabel *label = new QLabel(tr("Target frame rate:"), this);
tl->addWidget(label);
QHBoxLayout *hl = new QHBoxLayout();
@@ -67,15 +67,15 @@ QVFbRateDialog::QVFbRateDialog(int rate, QWidget *parent)
rateSlider->setValue(rate);
hl->addWidget(rateSlider);
connect(rateSlider, SIGNAL(valueChanged(int)), this, SLOT(rateChanged(int)));
- rateLabel = new QLabel(QString("%1fps").arg(rate), this);
+ rateLabel = new QLabel(tr("%1fps").arg(rate), this);
hl->addWidget(rateLabel);
hl = new QHBoxLayout();
tl->addItem(hl);
- QPushButton *pb = new QPushButton("OK", this);
+ QPushButton *pb = new QPushButton(tr("OK"), this);
connect(pb, SIGNAL(clicked()), this, SLOT(ok()));
hl->addWidget(pb);
- pb = new QPushButton("Cancel", this);
+ pb = new QPushButton(tr("Cancel"), this);
connect(pb, SIGNAL(clicked()), this, SLOT(cancel()));
hl->addWidget(pb);
}
@@ -84,7 +84,7 @@ void QVFbRateDialog::rateChanged(int r)
{
if (rateSlider->value() != r)
rateSlider->setValue(r);
- rateLabel->setText(QString("%1fps").arg(r));
+ rateLabel->setText(tr("%1fps").arg(r));
emit updateRate(r);
}
diff --git a/tools/runonphone/ossignalconverter.h b/tools/runonphone/ossignalconverter.h
index f53f3c1..398d0f6 100644
--- a/tools/runonphone/ossignalconverter.h
+++ b/tools/runonphone/ossignalconverter.h
@@ -43,6 +43,8 @@
#define OSSIGNALCONVERTER_H
#include <QObject>
+class OsSignalConverterPrivate;
+
class OsSignalConverter : public QObject
{
friend class OsSignalConverterPrivate;
diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro
index 15dff51..7ff361c 100644
--- a/tools/runonphone/runonphone.pro
+++ b/tools/runonphone/runonphone.pro
@@ -31,4 +31,5 @@ else {
SOURCES += serenum_stub.cpp
}
-
+target.path=$$[QT_INSTALL_BINS]
+INSTALLS += target
diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
index d9ff10a..a0bef0a 100644
--- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
@@ -2399,15 +2399,23 @@ QString QtLocalePropertyManager::valueText(const QtProperty *property) const
if (it == d_ptr->m_values.constEnd())
return QString();
- QLocale loc = it.value();
+ const QLocale loc = it.value();
int langIdx = 0;
int countryIdx = 0;
- metaEnumProvider()->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx);
- QString str = tr("%1, %2")
- .arg(metaEnumProvider()->languageEnumNames().at(langIdx))
- .arg(metaEnumProvider()->countryEnumNames(loc.language()).at(countryIdx));
- return str;
+ const QtMetaEnumProvider *me = metaEnumProvider();
+ me->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx);
+ if (langIdx < 0) {
+ qWarning("QtLocalePropertyManager::valueText: Unknown language %d", loc.language());
+ return tr("<Invalid>");
+ }
+ const QString languageName = me->languageEnumNames().at(langIdx);
+ if (countryIdx < 0) {
+ qWarning("QtLocalePropertyManager::valueText: Unknown country %d for %s", loc.country(), qPrintable(languageName));
+ return languageName;
+ }
+ const QString countryName = me->countryEnumNames(loc.language()).at(countryIdx);
+ return tr("%1, %2").arg(languageName, countryName);
}
/*!