summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/activeqt/dumpcpp/main.cpp6
-rw-r--r--tools/assistant/compat/helpdialog.ui6
-rw-r--r--tools/assistant/lib/qhelpprojectdata.cpp22
-rw-r--r--tools/assistant/lib/qhelpsearchengine.cpp29
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp22
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene_p.h7
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp4
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp54
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.h8
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp29
-rw-r--r--tools/assistant/tools/assistant/doc/assistant.qdocconf2
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp37
-rw-r--r--tools/assistant/tools/assistant/mainwindow.h5
-rw-r--r--tools/configure/configure.pro2
-rw-r--r--tools/configure/configureapp.cpp53
-rw-r--r--tools/configure/environment.cpp218
-rw-r--r--tools/configure/main.cpp6
-rw-r--r--tools/configure/tools.cpp4
-rw-r--r--tools/designer/data/generate_shared.xsl4
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp6
-rw-r--r--tools/designer/src/components/signalsloteditor/connectdialog.ui8
-rw-r--r--tools/designer/src/components/signalsloteditor/signalslot_utils.cpp4
-rw-r--r--tools/designer/src/designer/mainwindow.cpp2
-rw-r--r--tools/designer/src/designer/qdesigner_workbench.cpp13
-rw-r--r--tools/designer/src/lib/sdk/abstractformwindow.cpp14
-rw-r--r--tools/designer/src/lib/sdk/script.cpp6
-rw-r--r--tools/designer/src/lib/shared/pluginmanager.cpp2
-rw-r--r--tools/designer/src/lib/uilib/abstractformbuilder.cpp14
-rw-r--r--tools/designer/src/lib/uilib/formbuilder.cpp4
-rw-r--r--tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp2
-rw-r--r--tools/designer/src/uitools/quiloader.cpp8
-rw-r--r--tools/linguist/lconvert/main.cpp8
-rw-r--r--tools/linguist/linguist/batchtranslation.ui4
-rw-r--r--tools/linguist/linguist/images/minus.pngbin0 -> 296 bytes
-rw-r--r--tools/linguist/linguist/images/plus.pngbin0 -> 383 bytes
-rw-r--r--tools/linguist/linguist/linguist.qrc2
-rw-r--r--tools/linguist/linguist/mainwindow.cpp37
-rw-r--r--tools/linguist/linguist/mainwindow.h6
-rw-r--r--tools/linguist/linguist/mainwindow.ui33
-rw-r--r--tools/linguist/linguist/messageeditor.cpp122
-rw-r--r--tools/linguist/linguist/messageeditor.h12
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.cpp248
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.h50
-rw-r--r--tools/linguist/lrelease/lrelease.112
-rw-r--r--tools/linguist/lrelease/main.cpp31
-rw-r--r--tools/linguist/lupdate/cpp.cpp120
-rw-r--r--tools/linguist/lupdate/lupdate.114
-rw-r--r--tools/linguist/lupdate/main.cpp14
-rw-r--r--tools/linguist/phrasebooks/french.qph227
-rw-r--r--tools/linguist/phrasebooks/russian.qph52
-rw-r--r--tools/linguist/shared/po.cpp10
-rw-r--r--tools/linguist/shared/profileevaluator.cpp235
-rw-r--r--tools/linguist/shared/profileevaluator.h10
-rw-r--r--tools/linguist/shared/proparser.pri2
-rw-r--r--tools/linguist/shared/proreader.cpp131
-rw-r--r--tools/linguist/shared/proreader.h57
-rw-r--r--tools/linguist/shared/qm.cpp64
-rw-r--r--tools/linguist/shared/qph.cpp7
-rw-r--r--tools/linguist/shared/translator.h8
-rw-r--r--tools/linguist/shared/ts.cpp6
-rw-r--r--tools/linguist/shared/ts.dtd8
-rw-r--r--tools/linguist/shared/xliff.cpp7
-rw-r--r--tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp11
-rw-r--r--tools/qdoc3/codemarker.cpp64
-rw-r--r--tools/qdoc3/codemarker.h8
-rw-r--r--tools/qdoc3/cppcodemarker.cpp77
-rw-r--r--tools/qdoc3/cppcodeparser.cpp4
-rw-r--r--tools/qdoc3/doc.cpp3
-rw-r--r--tools/qdoc3/generator.cpp241
-rw-r--r--tools/qdoc3/generator.h12
-rw-r--r--tools/qdoc3/htmlgenerator.cpp99
-rw-r--r--tools/qdoc3/htmlgenerator.h4
-rw-r--r--tools/qdoc3/javadocgenerator.cpp3
-rw-r--r--tools/qdoc3/javadocgenerator.h2
-rw-r--r--tools/qdoc3/main.cpp2
-rw-r--r--tools/qdoc3/node.cpp12
-rw-r--r--tools/qdoc3/node.h4
-rw-r--r--tools/qdoc3/qdoc3.pro1
-rw-r--r--tools/qdoc3/separator.cpp36
-rw-r--r--tools/qdoc3/separator.h1
-rw-r--r--tools/qdoc3/test/qt-cpp-ignore.qdocconf3
-rw-r--r--tools/qdoc3/test/qt-inc.qdocconf3
-rw-r--r--tools/qtconfig/paletteeditoradvanced.cpp2
-rw-r--r--tools/qtconfig/translations/translations.pro1
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.cpp42
-rw-r--r--tools/qtestlib/wince/cetest/deployment.cpp34
-rw-r--r--tools/qtestlib/wince/cetest/main.cpp1
-rw-r--r--tools/qtestlib/wince/cetest/remoteconnection.cpp32
-rw-r--r--tools/qtestlib/wince/cetest/remoteconnection.h2
-rw-r--r--tools/qtestlib/wince/remotelib/commands.cpp10
-rw-r--r--tools/qtestlib/wince/remotelib/commands.h2
-rw-r--r--tools/qvfb/translations/translations.pro1
-rw-r--r--tools/xmlpatterns/main.cpp2
93 files changed, 2066 insertions, 791 deletions
diff --git a/tools/activeqt/dumpcpp/main.cpp b/tools/activeqt/dumpcpp/main.cpp
index 0a4aa06..de3ec57 100644
--- a/tools/activeqt/dumpcpp/main.cpp
+++ b/tools/activeqt/dumpcpp/main.cpp
@@ -969,7 +969,7 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O
QString libName;
BSTR nameString;
typelib->GetDocumentation(-1, &nameString, 0, 0, 0);
- libName = QString::fromUtf16((const ushort *)nameString);
+ libName = QString::fromWCharArray(nameString);
SysFreeString(nameString);
if (!nameSpace.isEmpty())
libName = QString(nameSpace);
@@ -1086,7 +1086,7 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O
BSTR bstr;
if (S_OK != typeinfo->GetDocumentation(-1, &bstr, 0, 0, 0))
break;
- className = QString::fromUtf16((const ushort *)bstr).toLatin1();
+ className = QString::fromWCharArray(bstr).toLatin1();
SysFreeString(bstr);
switch (typekind) {
case TKIND_RECORD:
@@ -1227,7 +1227,7 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O
BSTR bstr;
if (S_OK != typeinfo->GetDocumentation(-1, &bstr, 0, 0, 0))
break;
- className = QString::fromUtf16((const ushort *)bstr).toLatin1();
+ className = QString::fromWCharArray(bstr).toLatin1();
SysFreeString(bstr);
declOut << "// stub for vtable-only interface" << endl;
diff --git a/tools/assistant/compat/helpdialog.ui b/tools/assistant/compat/helpdialog.ui
index 54acc30..6c95418 100644
--- a/tools/assistant/compat/helpdialog.ui
+++ b/tools/assistant/compat/helpdialog.ui
@@ -269,7 +269,7 @@
<item row="1" column="0" >
<widget class="QLineEdit" name="termsEdit" >
<property name="toolTip" >
- <string>Enter searchword(s).</string>
+ <string>Enter searchword(s)</string>
</property>
<property name="whatsThis" >
<string>&lt;b>Enter search word(s).&lt;/b>&lt;p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.&lt;/p></string>
@@ -307,7 +307,7 @@
<item>
<widget class="QPushButton" name="helpButton" >
<property name="toolTip" >
- <string>Display the help page.</string>
+ <string>Display the help page</string>
</property>
<property name="whatsThis" >
<string>Display the help page for the full text search.</string>
@@ -336,7 +336,7 @@
<item>
<widget class="QPushButton" name="searchButton" >
<property name="toolTip" >
- <string>Start searching.</string>
+ <string>Start searching</string>
</property>
<property name="whatsThis" >
<string>Pressing this button starts the search.</string>
diff --git a/tools/assistant/lib/qhelpprojectdata.cpp b/tools/assistant/lib/qhelpprojectdata.cpp
index 8947a36..55b4ea7 100644
--- a/tools/assistant/lib/qhelpprojectdata.cpp
+++ b/tools/assistant/lib/qhelpprojectdata.cpp
@@ -41,6 +41,7 @@
#include "qhelpprojectdata_p.h"
+#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QStack>
#include <QtCore/QMap>
@@ -73,6 +74,7 @@ private:
void readKeywords();
void readFiles();
void raiseUnknownTokenError();
+ void addMatchingFiles(const QString &pattern);
};
void QHelpProjectDataPrivate::raiseUnknownTokenError()
@@ -161,7 +163,7 @@ void QHelpProjectDataPrivate::readFilterSection()
readNext();
if (isStartElement()) {
if (name() == QLatin1String("filterAttribute"))
- filterSectionList.last().addFilterAttribute(readElementText());
+ filterSectionList.last().addFilterAttribute(readElementText());
else if (name() == QLatin1String("toc"))
readTOC();
else if (name() == QLatin1String("keywords"))
@@ -244,7 +246,7 @@ void QHelpProjectDataPrivate::readFiles()
readNext();
if (isStartElement()) {
if (name() == QLatin1String("file"))
- filterSectionList.last().addFile(readElementText());
+ addMatchingFiles(readElementText());
else
raiseUnknownTokenError();
} else if (isEndElement()) {
@@ -258,7 +260,21 @@ void QHelpProjectDataPrivate::readFiles()
}
}
-
+// Expand file pattern and add matches into list. If the pattern does not match
+// any files, insert the pattern itself so the QHelpGenerator will emit a
+// meaningful warning later.
+void QHelpProjectDataPrivate::addMatchingFiles(const QString &pattern)
+{
+ QFileInfo fileInfo(rootPath + '/' + pattern);
+ const QStringList &matches =
+ fileInfo.dir().entryList(QStringList(fileInfo.fileName()));
+ for (QStringList::ConstIterator it = matches.constBegin();
+ it != matches.constEnd();
+ ++it)
+ filterSectionList.last().addFile(QFileInfo(pattern).dir().path() + '/' + *it);
+ if (matches.empty())
+ filterSectionList.last().addFile(pattern);
+}
/*!
\internal
diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp
index 9faafe0..2a41d04 100644
--- a/tools/assistant/lib/qhelpsearchengine.cpp
+++ b/tools/assistant/lib/qhelpsearchengine.cpp
@@ -84,18 +84,17 @@ private:
, resultWidget(0)
, helpEngine(helpEngine)
{
- hitList.clear();
indexReader = 0;
indexWriter = 0;
}
~QHelpSearchEnginePrivate()
{
- hitList.clear();
delete indexReader;
delete indexWriter;
}
+
int hitsCount() const
{
int count = 0;
@@ -107,12 +106,9 @@ private:
QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const
{
- QList<QHelpSearchEngine::SearchHit> returnValue;
- if (indexReader) {
- for (int i = start; i < end && i < hitsCount(); ++i)
- returnValue.append(indexReader->hit(i));
- }
- return returnValue;
+ return indexReader ?
+ indexReader->hits(start, end) :
+ QList<QHelpSearchEngine::SearchHit>();
}
void updateIndex(bool reindex = false)
@@ -131,11 +127,9 @@ private:
connect(indexWriter, SIGNAL(indexingFinished()), this, SLOT(optimizeIndex()));
}
- if (indexWriter) {
- indexWriter->cancelIndexing();
- indexWriter->updateIndex(helpEngine->collectionFile(),
- indexFilesFolder(), reindex);
- }
+ indexWriter->cancelIndexing();
+ indexWriter->updateIndex(helpEngine->collectionFile(),
+ indexFilesFolder(), reindex);
}
void cancelIndexing()
@@ -159,11 +153,9 @@ private:
connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int)));
}
- if (indexReader) {
- m_queryList = queryList;
- indexReader->cancelSearching();
- indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList);
- }
+ m_queryList = queryList;
+ indexReader->cancelSearching();
+ indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList);
}
void cancelSearching()
@@ -204,7 +196,6 @@ private:
QHelpSearchIndexWriter *indexWriter;
QPointer<QHelpEngineCore> helpEngine;
- QList<QHelpSearchEngine::SearchHit> hitList;
QList<QHelpSearchQuery> m_queryList;
};
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
index 227e558..89d6040 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
@@ -70,7 +70,6 @@ QHelpSearchIndexReader::~QHelpSearchIndexReader()
{
mutex.lock();
this->m_cancel = true;
- waitCondition.wakeOne();
mutex.unlock();
wait();
@@ -86,8 +85,8 @@ void QHelpSearchIndexReader::cancelSearching()
void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder,
const QList<QHelpSearchQuery> &queryList)
{
- QMutexLocker lock(&mutex);
-
+ wait();
+
this->hitList.clear();
this->m_cancel = false;
this->m_query = queryList;
@@ -99,12 +98,18 @@ void QHelpSearchIndexReader::search(const QString &collectionFile, const QString
int QHelpSearchIndexReader::hitsCount() const
{
+ QMutexLocker lock(&mutex);
return hitList.count();
}
-QHelpSearchEngine::SearchHit QHelpSearchIndexReader::hit(int index) const
+QList<QHelpSearchEngine::SearchHit> QHelpSearchIndexReader::hits(int start,
+ int end) const
{
- return hitList.at(index);
+ QList<QHelpSearchEngine::SearchHit> hits;
+ QMutexLocker lock(&mutex);
+ for (int i = start; i < end && i < hitList.count(); ++i)
+ hits.append(hitList.at(i));
+ return hits;
}
void QHelpSearchIndexReader::run()
@@ -135,7 +140,7 @@ void QHelpSearchIndexReader::run()
if(QCLuceneIndexReader::indexExists(indexPath)) {
mutex.lock();
if (m_cancel) {
- mutex.unlock();
+ mutex.unlock();
return;
}
mutex.unlock();
@@ -213,7 +218,9 @@ void QHelpSearchIndexReader::run()
#if !defined(QT_NO_EXCEPTIONS)
} catch(...) {
+ mutex.lock();
hitList.clear();
+ mutex.unlock();
emit searchingFinished(0);
}
#endif
@@ -416,8 +423,9 @@ void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine,
boostedList.append(it.value());
} while (it != hitMap.constBegin());
boostedList += hitList.mid(count, hitList.count());
-
+ mutex.lock();
hitList = boostedList;
+ mutex.unlock();
}
}
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
index 47af43f..8876d80 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
@@ -85,9 +85,8 @@ public:
void search(const QString &collectionFile,
const QString &indexFilesFolder,
const QList<QHelpSearchQuery> &queryList);
-
int hitsCount() const;
- QHelpSearchEngine::SearchHit hit(int index) const;
+ QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const;
signals:
void searchingStarted();
@@ -105,10 +104,8 @@ private:
const QList<QHelpSearchQuery> &queryList);
private:
- QMutex mutex;
+ mutable QMutex mutex;
QList<QHelpSearchEngine::SearchHit> hitList;
- QWaitCondition waitCondition;
-
bool m_cancel;
QString m_collectionFile;
QList<QHelpSearchQuery> m_query;
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
index b6e726b..c50f48d 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
@@ -639,7 +639,7 @@ void QHelpSearchIndexWriter::run()
QFileInfo fInfo(indexPath);
if (fInfo.exists() && !fInfo.isWritable()) {
- qWarning("Full Text Search, could not create index (missing permissions).");
+ qWarning("Full Text Search, could not create index (missing permissions for '%s').", qPrintable(indexPath));
return;
}
@@ -720,7 +720,7 @@ void QHelpSearchIndexWriter::run()
}
#if !defined(QT_NO_EXCEPTIONS)
} catch (...) {
- qWarning("Full Text Search, could not create index writer.");
+ qWarning("Full Text Search, could not create index writer in '%s'.", qPrintable(indexPath));
return;
}
#endif
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 3bca573..250262e 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -347,7 +347,7 @@ void BookmarkWidget::filterChanged()
filterBookmarkModel->setFilterRegExp(regExp);
- QModelIndex index = treeView->indexAt(QPoint(1, 1));
+ const QModelIndex &index = treeView->indexAt(QPoint(1, 1));
if (index.isValid())
treeView->setCurrentIndex(index);
@@ -445,9 +445,10 @@ void BookmarkWidget::setup(bool showButtons)
treeView = new TreeView(this);
vlayout->addWidget(treeView);
- QString system = QLatin1String("win");
#ifdef Q_OS_MAC
- system = QLatin1String("mac");
+# define SYSTEM "mac"
+#else
+# define SYSTEM "win"
#endif
if (showButtons) {
@@ -458,8 +459,8 @@ void BookmarkWidget::setup(bool showButtons)
addButton = new QToolButton(this);
addButton->setText(tr("Add"));
- addButton->setIcon(QIcon(QString::fromUtf8(
- ":/trolltech/assistant/images/%1/addtab.png").arg(system)));
+ addButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/"
+ SYSTEM "/addtab.png")));
addButton->setAutoRaise(true);
addButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
hlayout->addWidget(addButton);
@@ -467,8 +468,8 @@ void BookmarkWidget::setup(bool showButtons)
removeButton = new QToolButton(this);
removeButton->setText(tr("Remove"));
- removeButton->setIcon(QIcon(QString::fromUtf8(
- ":/trolltech/assistant/images/%1/closetab.png").arg(system)));
+ removeButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/"
+ SYSTEM "/closetab.png")));
removeButton->setAutoRaise(true);
removeButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
hlayout->addWidget(removeButton);
@@ -626,6 +627,10 @@ BookmarkManager::BookmarkManager(QHelpEngineCore *_helpEngine)
connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this,
SLOT(itemChanged(QStandardItem*)));
+ connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this,
+ SIGNAL(bookmarksChanged()));
+ connect(treeModel, SIGNAL(rowsRemoved(QModelIndex, int, int)),
+ this, SIGNAL(bookmarksChanged()));
}
BookmarkManager::~BookmarkManager()
@@ -736,6 +741,41 @@ void BookmarkManager::addNewBookmark(const QModelIndex &index,
else
treeModel->appendRow(item);
listModel->appendRow(item->clone());
+ emit bookmarksChanged();
+}
+
+void BookmarkManager::fillBookmarkMenu(QMenu *menu)
+{
+ if (!menu || !treeModel)
+ return;
+
+ map.clear();
+ fillBookmarkMenu(menu, treeModel->invisibleRootItem());
+}
+
+void BookmarkManager::fillBookmarkMenu(QMenu *menu, QStandardItem *root)
+{
+ for (int i = 0; i < root->rowCount(); ++i) {
+ QStandardItem *item = root->child(i);
+ if (item && item->data(Qt::UserRole + 10)
+ .toString() == QLatin1String("Folder")) {
+ QMenu* newMenu = menu->addMenu(folderIcon, item->text());
+ if (item->rowCount() > 0)
+ fillBookmarkMenu(newMenu, item);
+ } else {
+ map.insert(menu->addAction(item->text()), item->index());
+ }
+ }
+}
+
+QUrl BookmarkManager::urlForAction(QAction* action) const
+{
+ if (map.contains(action)) {
+ const QModelIndex &index = map.value(action);
+ if (QStandardItem* item = treeModel->itemFromIndex(index))
+ return QUrl(item->data(Qt::UserRole + 10).toString());
+ }
+ return QUrl();
}
void BookmarkManager::itemChanged(QStandardItem *item)
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.h b/tools/assistant/tools/assistant/bookmarkmanager.h
index bf7af41..33db5b6 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.h
+++ b/tools/assistant/tools/assistant/bookmarkmanager.h
@@ -183,6 +183,12 @@ public:
const QString &url);
void setupBookmarkModels();
+ void fillBookmarkMenu(QMenu *menu);
+ QUrl urlForAction(QAction* action) const;
+
+signals:
+ void bookmarksChanged();
+
private slots:
void itemChanged(QStandardItem *item);
@@ -191,6 +197,7 @@ private:
void removeBookmarkFolderItems(QStandardItem *item);
void readBookmarksRecursive(const QStandardItem *item, QDataStream &stream,
const qint32 depth) const;
+ void fillBookmarkMenu(QMenu *menu, QStandardItem *root);
private:
QString oldText;
@@ -200,6 +207,7 @@ private:
BookmarkModel *listModel;
QStandardItem *renameItem;
QHelpEngineCore *helpEngine;
+ QMap<QAction*, QModelIndex> map;
};
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 385f0bb..a384544 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -286,6 +286,10 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
CentralWidget::~CentralWidget()
{
+#ifndef QT_NO_PRINTER
+ delete printer;
+#endif
+
QHelpEngineCore engine(collectionFile, 0);
if (!engine.setupData())
return;
@@ -357,10 +361,10 @@ void CentralWidget::findNext()
void CentralWidget::nextPage()
{
- if(tabWidget->currentIndex() < tabWidget->count() -1)
- tabWidget->setCurrentIndex(tabWidget->currentIndex() +1);
- else
- tabWidget->setCurrentIndex(0);
+ int index = tabWidget->currentIndex() + 1;
+ if (index >= tabWidget->count())
+ index = 0;
+ tabWidget->setCurrentIndex(index);
}
void CentralWidget::resetZoom()
@@ -376,10 +380,9 @@ void CentralWidget::resetZoom()
void CentralWidget::previousPage()
{
int index = tabWidget->currentIndex() -1;
- if(index >= 0)
- tabWidget->setCurrentIndex(index);
- else
- tabWidget->setCurrentIndex(tabWidget->count() -1);
+ if (index < 0)
+ index = tabWidget->count() -1;
+ tabWidget->setCurrentIndex(index);
}
void CentralWidget::findPrevious()
@@ -400,7 +403,8 @@ void CentralWidget::closeTab()
void CentralWidget::setSource(const QUrl &url)
{
HelpViewer *viewer = currentHelpViewer();
- HelpViewer *lastViewer = qobject_cast<HelpViewer*>(tabWidget->widget(lastTabPage));
+ HelpViewer *lastViewer =
+ qobject_cast<HelpViewer*>(tabWidget->widget(lastTabPage));
if (!viewer && !lastViewer) {
viewer = new HelpViewer(helpEngine, this);
@@ -427,8 +431,11 @@ void CentralWidget::setLastShownPages()
QString::SkipEmptyParts);
const int pageCount = lastShownPageList.count();
- if (pageCount == 0 && usesDefaultCollection) {
- setSource(QUrl(QLatin1String("help")));
+ if (pageCount == 0) {
+ if (usesDefaultCollection)
+ setSource(QUrl(QLatin1String("help")));
+ else
+ setSource(QUrl(QLatin1String("about:blank")));
return;
}
diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf
index aca97ed..9566e90 100644
--- a/tools/assistant/tools/assistant/doc/assistant.qdocconf
+++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf
@@ -12,5 +12,5 @@ HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
"<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\">Trademarks</td>\n" \
- "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.2</div></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.3</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index 8860601..617ac4d 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -137,7 +137,14 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
if (initHelpDB()) {
setupFilterToolbar();
setupAddressToolbar();
+
m_bookmarkManager->setupBookmarkModels();
+ m_bookmarkMenu->addSeparator();
+ m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu);
+ connect(m_bookmarkMenu, SIGNAL(triggered(QAction*)), this,
+ SLOT(showBookmark(QAction*)));
+ connect(m_bookmarkManager, SIGNAL(bookmarksChanged()), this,
+ SLOT(updateBookmarkMenu()));
setWindowTitle(m_helpEngine->customValue(QLatin1String("WindowTitle"),
defWindowTitle).toString());
@@ -370,6 +377,29 @@ void MainWindow::checkInitState()
}
}
+void MainWindow::updateBookmarkMenu()
+{
+ if (m_bookmarkManager) {
+ m_bookmarkMenu->removeAction(m_bookmarkMenuAction);
+
+ m_bookmarkMenu->clear();
+
+ m_bookmarkMenu->addAction(m_bookmarkMenuAction);
+ m_bookmarkMenu->addSeparator();
+
+ m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu);
+ }
+}
+
+void MainWindow::showBookmark(QAction *action)
+{
+ if (m_bookmarkManager) {
+ const QUrl &url = m_bookmarkManager->urlForAction(action);
+ if (url.isValid())
+ m_centralWidget->setSource(url);
+ }
+}
+
void MainWindow::insertLastPages()
{
if (m_cmdLine->url().isValid())
@@ -495,9 +525,10 @@ void MainWindow::setupActions()
tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Left"))
<< QKeySequence(Qt::CTRL + Qt::Key_PageUp));
- menu = menuBar()->addMenu(tr("&Bookmarks"));
- tmp = menu->addAction(tr("Add Bookmark..."), this, SLOT(addBookmark()));
- tmp->setShortcut(tr("CTRL+D"));
+ m_bookmarkMenu = menuBar()->addMenu(tr("&Bookmarks"));
+ m_bookmarkMenuAction = m_bookmarkMenu->addAction(tr("Add Bookmark..."),
+ this, SLOT(addBookmark()));
+ m_bookmarkMenuAction->setShortcut(tr("CTRL+D"));
menu = menuBar()->addMenu(tr("&Help"));
m_aboutAction = menu->addAction(tr("About..."), this, SLOT(showAboutDialog()));
diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h
index 9ab3185..f7df724 100644
--- a/tools/assistant/tools/assistant/mainwindow.h
+++ b/tools/assistant/tools/assistant/mainwindow.h
@@ -119,6 +119,9 @@ private slots:
void qtDocumentationInstalled(bool newDocsInstalled);
void checkInitState();
+ void updateBookmarkMenu();
+ void showBookmark(QAction *action);
+
private:
bool initHelpDB();
void setupActions();
@@ -157,6 +160,8 @@ private:
QMenu *m_viewMenu;
QMenu *m_toolBarMenu;
+ QMenu *m_bookmarkMenu;
+ QAction *m_bookmarkMenuAction;
CmdLineParser *m_cmdLine;
diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro
index 1ce9a1b..fdeab29 100644
--- a/tools/configure/configure.pro
+++ b/tools/configure/configure.pro
@@ -3,7 +3,7 @@ DESTDIR = ../..
CONFIG += console flat
CONFIG -= moc qt
-DEFINES = QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_BUILD_QMAKE QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE
+DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_BUILD_QMAKE QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE
win32 : LIBS += -lole32 -ladvapi32
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index e8fb282..80cfc64 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -116,16 +116,9 @@ Configure::Configure( int& argc, char** argv )
// Get the path to the executable
- QFileInfo sourcePathInfo;
- QT_WA({
- unsigned short module_name[256];
- GetModuleFileNameW(0, reinterpret_cast<wchar_t *>(module_name), sizeof(module_name));
- sourcePathInfo = QString::fromUtf16(module_name);
- }, {
- char module_name[256];
- GetModuleFileNameA(0, module_name, sizeof(module_name));
- sourcePathInfo = QString::fromLocal8Bit(module_name);
- });
+ wchar_t module_name[MAX_PATH];
+ GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t));
+ QFileInfo sourcePathInfo = QString::fromWCharArray(module_name);
sourcePath = sourcePathInfo.absolutePath();
sourceDir = sourcePathInfo.dir();
buildPath = QDir::currentPath();
@@ -604,10 +597,13 @@ void Configure::parseCmdLine()
// cetest ---------------------------------------------------
else if (configCmdLine.at(i) == "-no-cetest") {
dictionary[ "CETEST" ] = "no";
+ dictionary[ "CETEST_REQUESTED" ] = "no";
} else if (configCmdLine.at(i) == "-cetest") {
// although specified to use it, we stay at "auto" state
// this is because checkAvailability() adds variables
- // we need for crosscompilation
+ // we need for crosscompilation; but remember if we asked
+ // for it.
+ dictionary[ "CETEST_REQUESTED" ] = "yes";
}
// Qt/CE - signing tool -------------------------------------
else if( configCmdLine.at(i) == "-signature") {
@@ -891,6 +887,11 @@ void Configure::parseCmdLine()
if(i==argCount)
break;
qmakeDefines += "QT_NAMESPACE="+configCmdLine.at(i);
+ } else if( configCmdLine.at(i) == "-qtlibinfix" ) {
+ ++i;
+ if(i==argCount)
+ break;
+ dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
} else if( configCmdLine.at(i) == "-D" ) {
++i;
if (i==argCount)
@@ -1134,6 +1135,10 @@ void Configure::parseCmdLine()
useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
+ // Allow tests for private classes to be compiled against internal builds
+ if (dictionary["BUILDDEV"] == "yes")
+ qtConfig += "private_tests";
+
#if !defined(EVAL)
for( QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis ) {
@@ -1418,8 +1423,8 @@ bool Configure::displayHelp()
"[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
"[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
"[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
- "[-qtnamespace <namespace>] [-no-phonon] [-phonon]\n"
- "[-no-phonon-backend] [-phonon-backend]\n"
+ "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
+ "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
"[-no-webkit] [-webkit]\n"
"[-no-scripttools] [-scripttools]\n"
"[-graphicssystem raster|opengl]\n\n", 0, 7);
@@ -1510,7 +1515,8 @@ bool Configure::displayHelp()
desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
#if !defined(EVAL)
- desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}\n");
+ desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}");
+ desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>\n");
desc( "-D <define>", "Add an explicit define to the preprocessor.");
desc( "-I <includepath>", "Add an explicit include path.");
desc( "-L <librarypath>", "Add an explicit library path.");
@@ -1519,7 +1525,7 @@ bool Configure::displayHelp()
desc( "-graphicssystem <sys>", "Specify which graphicssystem should be used.\n"
"Available values for <sys>:");
desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' ');
- desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL accelleration, experimental!", ' ');
+ desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' ');
desc( "-help, -h, -?", "Display this information.\n");
@@ -1818,6 +1824,11 @@ bool Configure::checkAvailability(const QString &part)
dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
}
+ else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
+ cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
+ cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
+ dictionary[ "DONE" ] = "error";
+ }
}
else if (part == "INCREDIBUILD_XGE")
available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
@@ -1990,7 +2001,6 @@ bool Configure::verifyConfiguration()
no-gif gif
dll staticlib
- internal
nocrosscompiler
GNUmake
largefile
@@ -2498,7 +2508,10 @@ void Configure::generateCachefile()
configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
if(!dictionary["QMAKE_RPATHDIR"].isEmpty())
- configStream<<"QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"];
+ configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
+
+ if (!dictionary["QT_LIBINFIX"].isEmpty())
+ configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
configStream.flush();
configFile.close();
@@ -2716,7 +2729,7 @@ void Configure::generateConfigfiles()
tmpFile.flush();
// Replace old qconfig.h with new one
- ::SetFileAttributesA(outName.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL);
+ ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
QFile::remove(outName);
tmpFile.copy(outName);
tmpFile.close();
@@ -2752,7 +2765,7 @@ void Configure::generateConfigfiles()
}
outName = defSpec + "/qmake.conf";
- ::SetFileAttributesA(outName.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL );
+ ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
QFile qmakeConfFile(outName);
if (qmakeConfFile.open(QFile::Append | QFile::WriteOnly | QFile::Text)) {
QTextStream qmakeConfStream;
@@ -2820,7 +2833,7 @@ void Configure::generateConfigfiles()
tmpFile2.flush();
// Replace old qconfig.cpp with new one
- ::SetFileAttributesA(outName.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL );
+ ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
QFile::remove( outName );
tmpFile2.copy(outName);
tmpFile2.close();
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index 6dc8940..b4c61f8 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -146,26 +146,14 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
QString rSubkeyPath = keyPath(rSubkey);
HKEY handle = 0;
- LONG res;
- QT_WA( {
- res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(),
- 0, KEY_READ, &handle);
- } , {
- res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(),
- 0, KEY_READ, &handle);
- } );
-
+ LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
if (res != ERROR_SUCCESS)
return QString();
// get the size and type of the value
DWORD dataType;
DWORD dataSize;
- QT_WA( {
- res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
- }, {
- res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
- } );
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
if (res != ERROR_SUCCESS) {
RegCloseKey(handle);
return QString();
@@ -173,13 +161,8 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
// get the value
QByteArray data(dataSize, 0);
- QT_WA( {
- res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- }, {
- res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- } );
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
+ reinterpret_cast<unsigned char*>(data.data()), &dataSize);
if (res != ERROR_SUCCESS) {
RegCloseKey(handle);
return QString();
@@ -189,11 +172,7 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
switch (dataType) {
case REG_EXPAND_SZ:
case REG_SZ: {
- QT_WA( {
- result = QString::fromUtf16(((const ushort*)data.constData()));
- }, {
- result = QString::fromLatin1(data.constData());
- } );
+ result = QString::fromWCharArray(((const wchar_t *)data.constData()));
break;
}
@@ -201,29 +180,20 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
QStringList l;
int i = 0;
for (;;) {
- QString s;
- QT_WA( {
- s = QString::fromUtf16((const ushort*)data.constData() + i);
- }, {
- s = QString::fromLatin1(data.constData() + i);
- } );
+ QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
i += s.length() + 1;
if (s.isEmpty())
break;
l.append(s);
}
- result = l.join(", ");
+ result = l.join(", ");
break;
}
case REG_NONE:
case REG_BINARY: {
- QT_WA( {
- result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2);
- }, {
- result = QString::fromLatin1(data.constData(), data.size());
- } );
+ result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
break;
}
@@ -232,7 +202,7 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
Q_ASSERT(data.size() == sizeof(int));
int i;
memcpy((char*)&i, data.constData(), sizeof(int));
- result = QString::number(i);
+ result = QString::number(i);
break;
}
@@ -350,29 +320,14 @@ bool Environment::detectExecutable(const QString &executable)
PROCESS_INFORMATION procInfo;
memset(&procInfo, 0, sizeof(procInfo));
- bool couldExecute;
- QT_WA({
- // Unicode version
- STARTUPINFOW startInfo;
- memset(&startInfo, 0, sizeof(startInfo));
- startInfo.cb = sizeof(startInfo);
-
- couldExecute = CreateProcessW(0, (WCHAR*)executable.utf16(),
- 0, 0, false,
- CREATE_NO_WINDOW | CREATE_SUSPENDED,
- 0, 0, &startInfo, &procInfo);
-
- }, {
- // Ansi version
- STARTUPINFOA startInfo;
- memset(&startInfo, 0, sizeof(startInfo));
- startInfo.cb = sizeof(startInfo);
+ STARTUPINFO startInfo;
+ memset(&startInfo, 0, sizeof(startInfo));
+ startInfo.cb = sizeof(startInfo);
- couldExecute = CreateProcessA(0, executable.toLocal8Bit().data(),
+ bool couldExecute = CreateProcess(0, (wchar_t*)executable.utf16(),
0, 0, false,
CREATE_NO_WINDOW | CREATE_SUSPENDED,
0, 0, &startInfo, &procInfo);
- })
if (couldExecute) {
CloseHandle(procInfo.hThread);
@@ -421,61 +376,38 @@ static QString qt_create_commandline(const QString &program, const QStringList &
}
/*!
- Creates a QByteArray of the \a environment in either UNICODE or
- ansi representation.
+ Creates a QByteArray of the \a environment.
*/
static QByteArray qt_create_environment(const QStringList &environment)
{
QByteArray envlist;
- if (!environment.isEmpty()) {
- int pos = 0;
- // add PATH if necessary (for DLL loading)
- QByteArray path = qgetenv("PATH");
- QT_WA({
- if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty()
- && !path.isNull()) {
- QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path));
- uint tmpSize = sizeof(TCHAR) * (tmp.length()+1);
- envlist.resize(envlist.size() + tmpSize );
- memcpy(envlist.data()+pos, tmp.utf16(), tmpSize);
- pos += tmpSize;
- }
- // add the user environment
- for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) {
- QString tmp = *it;
- uint tmpSize = sizeof(TCHAR) * (tmp.length()+1);
- envlist.resize(envlist.size() + tmpSize);
- memcpy(envlist.data()+pos, tmp.utf16(), tmpSize);
- pos += tmpSize;
- }
- // add the 2 terminating 0 (actually 4, just to be on the safe side)
- envlist.resize( envlist.size()+4 );
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- }, {
- if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) {
- QByteArray tmp = QString("PATH=%1").arg(QString::fromLocal8Bit(path)).toLocal8Bit();
- uint tmpSize = tmp.length() + 1;
- envlist.resize(envlist.size() + tmpSize);
- memcpy(envlist.data()+pos, tmp.data(), tmpSize);
- pos += tmpSize;
- }
- // add the user environment
- for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++) {
- QByteArray tmp = (*it).toLocal8Bit();
- uint tmpSize = tmp.length() + 1;
- envlist.resize(envlist.size() + tmpSize);
- memcpy(envlist.data()+pos, tmp.data(), tmpSize);
- pos += tmpSize;
- }
- // add the terminating 0 (actually 2, just to be on the safe side)
- envlist.resize(envlist.size()+2);
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- })
+ if (environment.isEmpty())
+ return envlist;
+
+ int pos = 0;
+ // add PATH if necessary (for DLL loading)
+ QByteArray path = qgetenv("PATH");
+ if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) {
+ QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path));
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize(envlist.size() + tmpSize);
+ memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
+ pos += tmpSize;
}
+ // add the user environment
+ for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) {
+ QString tmp = *it;
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize(envlist.size() + tmpSize);
+ memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
+ pos += tmpSize;
+ }
+ // add the 2 terminating 0 (actually 4, just to be on the safe side)
+ envlist.resize(envlist.size() + 4);
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
return envlist;
}
@@ -501,46 +433,24 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv
qDebug() << " " << additionalEnv;
qDebug() << " " << removeEnv;
#endif
-// GetEnvironmentStrings is defined to GetEnvironmentStringsW when
-// UNICODE is defined. We cannot use that, since we need to
-// destinguish between unicode and ansi versions of the functions.
-#if defined(UNICODE) && defined(GetEnvironmentStrings)
-#undef GetEnvironmentStrings
-#endif
-
// Create the full environment from the current environment and
// the additionalEnv strings, then remove all variables defined
// in removeEnv
QMap<QString, QString> fullEnvMap;
- QT_WA({
- LPWSTR envStrings = GetEnvironmentStringsW();
- if (envStrings) {
- int strLen = 0;
- for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) {
- strLen = wcslen(envString);
- QString str = QString((const QChar*)envString, strLen);
- if (!str.startsWith("=")) { // These are added by the system
- int sepIndex = str.indexOf('=');
- fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
- }
- }
- }
- FreeEnvironmentStringsW(envStrings);
- }, {
- LPSTR envStrings = GetEnvironmentStrings();
- if (envStrings) {
- int strLen = 0;
- for (LPSTR envString = envStrings; *(envString); envString += strLen + 1) {
- strLen = strlen(envString);
- QString str = QLatin1String(envString);
- if (!str.startsWith("=")) { // These are added by the system
- int sepIndex = str.indexOf('=');
- fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
- }
+ LPWSTR envStrings = GetEnvironmentStrings();
+ if (envStrings) {
+ int strLen = 0;
+ for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) {
+ strLen = wcslen(envString);
+ QString str = QString((const QChar*)envString, strLen);
+ if (!str.startsWith("=")) { // These are added by the system
+ int sepIndex = str.indexOf('=');
+ fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
}
}
- FreeEnvironmentStringsA(envStrings);
- })
+ }
+ FreeEnvironmentStrings(envStrings);
+
// Add additionalEnv variables
for (int i = 0; i < additionalEnv.count(); ++i) {
const QString &str = additionalEnv.at(i);
@@ -569,28 +479,14 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv
PROCESS_INFORMATION procInfo;
memset(&procInfo, 0, sizeof(procInfo));
- bool couldExecute;
- QT_WA({
- // Unicode version
- STARTUPINFOW startInfo;
- memset(&startInfo, 0, sizeof(startInfo));
- startInfo.cb = sizeof(startInfo);
+ STARTUPINFO startInfo;
+ memset(&startInfo, 0, sizeof(startInfo));
+ startInfo.cb = sizeof(startInfo);
- couldExecute = CreateProcessW(0, (WCHAR*)args.utf16(),
+ bool couldExecute = CreateProcess(0, (wchar_t*)args.utf16(),
0, 0, true, CREATE_UNICODE_ENVIRONMENT,
envlist.isEmpty() ? 0 : envlist.data(),
0, &startInfo, &procInfo);
- }, {
- // Ansi version
- STARTUPINFOA startInfo;
- memset(&startInfo, 0, sizeof(startInfo));
- startInfo.cb = sizeof(startInfo);
-
- couldExecute = CreateProcessA(0, args.toLocal8Bit().data(),
- 0, 0, true, 0,
- envlist.isEmpty() ? 0 : envlist.data(),
- 0, &startInfo, &procInfo);
- })
if (couldExecute) {
WaitForSingleObject(procInfo.hProcess, INFINITE);
@@ -654,7 +550,7 @@ bool Environment::cpdir(const QString &srcDir, const QString &destDir)
#endif
QFile::remove(destFile);
intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
- SetFileAttributesA(destFile.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL);
+ SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
}
if(!intermediate) {
qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp
index 4f379d7..0e13c7a 100644
--- a/tools/configure/main.cpp
+++ b/tools/configure/main.cpp
@@ -92,15 +92,15 @@ int runConfigure( int argc, char** argv )
app.generateHeaders();
if( !app.isDone() )
app.buildQmake();
- if( !app.isOk() )
- return 2;
#endif
if( !app.isDone() )
app.generateMakefiles();
- if( app.isOk() )
+ if( !app.isDone() && app.isOk() )
app.buildHostTools();
if( !app.isDone() )
app.showSummary();
+ if( !app.isOk() )
+ return 2;
return 0;
}
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp
index f60f72c..708a537 100644
--- a/tools/configure/tools.cpp
+++ b/tools/configure/tools.cpp
@@ -201,8 +201,8 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
if (licenseFeatures == '5') //Floating
dictionary["METERED LICENSE"] = "true";
- if (!CopyFileA(QDir::toNativeSeparators(fromLicenseFile).toLocal8Bit(),
- QDir::toNativeSeparators(toLicenseFile).toLocal8Bit(), FALSE)) {
+ if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
+ (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) {
cout << "Failed to copy license file (" << fromLicenseFile << ")";
dictionary["DONE"] = "error";
return;
diff --git a/tools/designer/data/generate_shared.xsl b/tools/designer/data/generate_shared.xsl
index f7859cd..ec95fe2 100644
--- a/tools/designer/data/generate_shared.xsl
+++ b/tools/designer/data/generate_shared.xsl
@@ -6,8 +6,8 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Hack to make names camel case
- All names in ui files are lowercase, while the element names are
- capital case. To make the ui files conforming to the xsd file + keep
+ All names in UI files are lowercase, while the element names are
+ capital case. To make the UI files conforming to the XSD file + keep
the DOM interface we rename them here -->
<xsl:template name="camel-case">
<xsl:param name="text"/>
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
index de4b57b..ac03909 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -631,13 +631,13 @@ static bool readUiAttributes(QIODevice *dev, QString *errorMessage,
*language = attributes.value(languageAttribute).toString();
return true;
} else {
- *errorMessage = QCoreApplication::translate("Designer", "Invalid ui file: The root element <ui> is missing.");
+ *errorMessage = QCoreApplication::translate("Designer", "Invalid UI file: The root element <ui> is missing.");
return false;
}
}
}
- *errorMessage = QCoreApplication::translate("Designer", "An error has occurred while reading the ui file at line %1, column %2: %3")
+ *errorMessage = QCoreApplication::translate("Designer", "An error has occurred while reading the UI file at line %1, column %2: %3")
.arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString());
return false;
}
@@ -756,7 +756,7 @@ void QDesignerResource::setSaveRelative(bool relative)
QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
{
// Load extra info extension. This is used by Jambi for preventing
- // C++ ui files from being loaded
+ // C++ UI files from being loaded
if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core())) {
if (!extra->loadUiExtraInfo(ui)) {
const QString errorMessage = QApplication::translate("Designer", "This file cannot be read because the extra info extension failed to load.");
diff --git a/tools/designer/src/components/signalsloteditor/connectdialog.ui b/tools/designer/src/components/signalsloteditor/connectdialog.ui
index bd062eb..568516a 100644
--- a/tools/designer/src/components/signalsloteditor/connectdialog.ui
+++ b/tools/designer/src/components/signalsloteditor/connectdialog.ui
@@ -13,7 +13,7 @@
<string>Configure Connection</string>
</property>
<layout class="QGridLayout" >
- <item row="0" column="0" colspan="2" >
+ <item row="0" column="0" >
<widget class="QGroupBox" name="signalGroupBox" >
<property name="title" >
<string>GroupBox</string>
@@ -53,7 +53,7 @@
</layout>
</widget>
</item>
- <item row="0" column="2" >
+ <item row="0" column="1" >
<widget class="QGroupBox" name="slotGroupBox" >
<property name="title" >
<string>GroupBox</string>
@@ -93,14 +93,14 @@
</layout>
</widget>
</item>
- <item row="1" column="0" >
+ <item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="showAllCheckBox" >
<property name="text" >
<string>Show signals and slots inherited from QWidget</string>
</property>
</widget>
</item>
- <item row="2" column="1" colspan="2" >
+ <item row="2" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
diff --git a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp
index 37269c5..c268d5f 100644
--- a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp
@@ -275,7 +275,7 @@ namespace qdesigner_internal {
const QDesignerMemberSheet *memberSheet
= qobject_cast<QDesignerMemberSheet*>(core->extensionManager()->extension(object,
Q_TYPEID(QDesignerMemberSheetExtension)));
- return memberSheet->isQt3Signal(i);
+ return (memberSheet && memberSheet->isQt3Signal(i));
}
}
@@ -294,7 +294,7 @@ namespace qdesigner_internal {
const QDesignerMemberSheet *memberSheet
= qobject_cast<QDesignerMemberSheet*>(core->extensionManager()->extension(object,
Q_TYPEID(QDesignerMemberSheetExtension)));
- return memberSheet->isQt3Slot(i);
+ return (memberSheet && memberSheet->isQt3Slot(i));
}
}
return false;
diff --git a/tools/designer/src/designer/mainwindow.cpp b/tools/designer/src/designer/mainwindow.cpp
index b72a790..a3ca234 100644
--- a/tools/designer/src/designer/mainwindow.cpp
+++ b/tools/designer/src/designer/mainwindow.cpp
@@ -155,7 +155,7 @@ DockedMdiArea::DockedMdiArea(const QString &extension, QWidget *parent) :
QStringList DockedMdiArea::uiFiles(const QMimeData *d) const
{
- // Extract dropped ui files from Mime data.
+ // Extract dropped UI files from Mime data.
QStringList rc;
if (!d->hasFormat(QLatin1String(uriListMimeFormatC)))
return rc;
diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp
index 923687a2..2ac9e1f 100644
--- a/tools/designer/src/designer/qdesigner_workbench.cpp
+++ b/tools/designer/src/designer/qdesigner_workbench.cpp
@@ -410,6 +410,12 @@ void QDesignerWorkbench::switchToDockedMode()
switchToNeutralMode();
+#ifndef Q_WS_MAC
+ QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow();
+ widgetBoxWrapper->action()->setVisible(true);
+ widgetBoxWrapper->setWindowTitle(tr("Widget Box"));
+#endif
+
m_mode = DockedMode;
const QDesignerSettings settings(m_core);
m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows);
@@ -462,8 +468,6 @@ void QDesignerWorkbench::switchToTopLevelMode()
// make sure that the widgetbox is visible if it is different from neutral.
QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow();
Q_ASSERT(widgetBoxWrapper);
- if (!widgetBoxWrapper->action()->isChecked())
- widgetBoxWrapper->action()->trigger();
switchToNeutralMode();
const QPoint desktopOffset = desktopGeometry().topLeft();
@@ -502,9 +506,6 @@ void QDesignerWorkbench::switchToTopLevelMode()
found_visible_window |= tw->isVisible();
}
- if (!widgetBoxWrapper->action()->isChecked())
- widgetBoxWrapper->action()->trigger();
-
if (!m_toolWindows.isEmpty() && !found_visible_window)
m_toolWindows.first()->show();
@@ -960,7 +961,7 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
removeFormWindow(formWindow);
formWindowManager->removeFormWindow(editor);
m_core->metaDataBase()->remove(editor);
- *errorMessage = tr("The file <b>%1</b> is not a valid Designer ui file.").arg(file.fileName());
+ *errorMessage = tr("The file <b>%1</b> is not a valid Designer UI file.").arg(file.fileName());
return 0;
}
*uic3Converted = editor->fileName().isEmpty();
diff --git a/tools/designer/src/lib/sdk/abstractformwindow.cpp b/tools/designer/src/lib/sdk/abstractformwindow.cpp
index 89c1015..313b324 100644
--- a/tools/designer/src/lib/sdk/abstractformwindow.cpp
+++ b/tools/designer/src/lib/sdk/abstractformwindow.cpp
@@ -247,7 +247,7 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje
/*!
\fn virtual QString QDesignerFormWindowInterface::fileName() const
- Returns the file name of the .ui file that describes the form
+ Returns the file name of the UI file that describes the form
currently being shown.
\sa setFileName()
@@ -399,11 +399,11 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje
\fn virtual QStringList QDesignerFormWindowInterface::includeHints() const
Returns a list of the header files that will be included in the
- form window's associated \c .ui file.
+ form window's associated UI file.
Header files may be local, i.e. relative to the project's
- directory,\c "mywidget.h", or global, i.e. part of Qt or the
- compilers standard libraries:\c <QtGui/QWidget>.
+ directory, \c "mywidget.h", or global, i.e. part of Qt or the
+ compilers standard libraries: \c <QtGui/QWidget>.
\sa setIncludeHints()
*/
@@ -412,11 +412,11 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje
\fn virtual void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints)
Sets the header files that will be included in the form window's
- associated \c .ui file to the specified \a includeHints.
+ associated UI file to the specified \a includeHints.
Header files may be local, i.e. relative to the project's
- directory,\c "mywidget.h", or global, i.e. part of Qt or the
- compilers standard libraries:\c <QtGui/QWidget>.
+ directory, \c "mywidget.h", or global, i.e. part of Qt or the
+ compilers standard libraries: \c <QtGui/QWidget>.
\sa includeHints()
*/
diff --git a/tools/designer/src/lib/sdk/script.cpp b/tools/designer/src/lib/sdk/script.cpp
index 90b4c73..2eda3d1 100644
--- a/tools/designer/src/lib/sdk/script.cpp
+++ b/tools/designer/src/lib/sdk/script.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\since 4.3
On saving the form, the extension is queried for a script snippet
- to be associated with the widget while saving the \c .ui file.
+ to be associated with the widget while saving the UI file.
This script is then run after creating the widget by \l uic or
QUiLoader.
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
for which an editor is provided by the QDesignerTaskMenuExtension.
While saving the form, the state is serialized as a QVariantMap of
- \QD-supported properties, which is stored in the \c .ui file. This is
+ \QD-supported properties, which is stored in the UI file. This is
handled by data() and setData().
For item view contents, there might be for example a key that determines
@@ -97,7 +97,7 @@ QDesignerScriptExtension::~QDesignerScriptExtension()
\fn virtual QVariantMap QDesignerScriptExtension::data() const
Returns a map of variants describing the internal state to be
- stored in the \c .ui file.
+ stored in the UI file.
*/
/*!
diff --git a/tools/designer/src/lib/shared/pluginmanager.cpp b/tools/designer/src/lib/shared/pluginmanager.cpp
index a70c16a..b8c1c40 100644
--- a/tools/designer/src/lib/shared/pluginmanager.cpp
+++ b/tools/designer/src/lib/shared/pluginmanager.cpp
@@ -16,8 +16,6 @@
** Alternatively, 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
-What usually causes this mess is specifying a Z-order (raise/lower) widget or changing the tab order and then deleting the widget. Designer did not delete the widget from those settings, causing uic to report this when applying them. I believe we fixed that 4.5.
-
** 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.
diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
index 65ea375..05e05c1 100644
--- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -135,7 +135,7 @@ public:
QAbstractFormBuilder provides a standard interface and a default
implementation for constructing forms from user interface
files. It is not intended to be instantiated directly. Use the
- QFormBuilder class to create user interfaces from \c{.ui} files at
+ QFormBuilder class to create user interfaces from UI files at
run-time. For example:
\snippet doc/src/snippets/code/tools_designer_src_lib_uilib_abstractformbuilder.cpp 0
@@ -145,10 +145,10 @@ public:
functions:
\list
- \o load() handles reading of \c{.ui} format files from arbitrary
+ \o load() handles reading of UI format files from arbitrary
QIODevices, and construction of widgets from the XML data
that they contain.
- \o save() handles saving of widget details in \c{.ui} format to
+ \o save() handles saving of widget details in UI format to
arbitrary QIODevices.
\o workingDirectory() and setWorkingDirectory() control the
directory in which forms are held. The form builder looks for
@@ -208,13 +208,13 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
}
}
if (reader.hasError()) {
- uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the ui file at line %1, column %2: %3")
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the UI file at line %1, column %2: %3")
.arg(reader.lineNumber()).arg(reader.columnNumber())
.arg(reader.errorString()));
return 0;
}
if (!initialized) {
- uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid ui file: The root element <ui> is missing."));
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid UI file: The root element <ui> is missing."));
return 0;
}
@@ -657,7 +657,7 @@ void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int
spac = p->elementNumber();
#ifdef Q_OS_MAC
- // here we recognize ui file < 4.3 (no we don't store margin property)
+ // here we recognize UI file < 4.3 (no we don't store margin property)
if (mar != INT_MIN) {
const int defaultMargin = parent->inherits("QLayoutWidget") ? 0 : 9;
if (mar == defaultMargin)
@@ -1202,7 +1202,7 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
\fn void QAbstractFormBuilder::save(QIODevice *device, QWidget *widget)
Saves an XML representation of the given \a widget to the
- specified \a device in the standard \c{.ui} file format.
+ specified \a device in the standard UI file format.
\sa load()*/
void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp
index 043991e..f737311 100644
--- a/tools/designer/src/lib/uilib/formbuilder.cpp
+++ b/tools/designer/src/lib/uilib/formbuilder.cpp
@@ -57,12 +57,12 @@ namespace QFormInternal {
\class QFormBuilder
\brief The QFormBuilder class is used to dynamically construct
- user interfaces from .ui files at run-time.
+ user interfaces from UI files at run-time.
\inmodule QtDesigner
The QFormBuilder class provides a mechanism for dynamically
- creating user interfaces at run-time, based on \c{.ui} files
+ creating user interfaces at run-time, based on UI files
created with \QD. For example:
\snippet doc/src/snippets/code/tools_designer_src_lib_uilib_formbuilder.cpp 0
diff --git a/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp b/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
index 1158e35..1cbf1c1 100644
--- a/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
+++ b/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
@@ -162,7 +162,7 @@ void QAxWidgetTaskMenu::setActiveXControl()
tr("The control requires a design-time license"));
clsid = QUuid();
} else {
- key = QString::fromUtf16((ushort *)bKey);
+ key = QString::fromWCharArray(bKey);
}
cf2->Release();
diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp
index 5387c2d..1c7d1cc 100644
--- a/tools/designer/src/uitools/quiloader.cpp
+++ b/tools/designer/src/uitools/quiloader.cpp
@@ -574,20 +574,20 @@ void QUiLoaderPrivate::setupWidgetMap() const
\brief The QUiLoader class enables standalone applications to
dynamically create user interfaces at run-time using the
- information stored in .ui files or specified in plugin paths.
+ information stored in UI files or specified in plugin paths.
In addition, you can customize or create your own user interface by
deriving your own loader class.
If you have a custom component or an application that embeds \QD, you can
also use the QFormBuilder class provided by the QtDesigner module to create
- user interfaces from \c{.ui} files.
+ user interfaces from UI files.
The QUiLoader class provides a collection of functions allowing you to
- create widgets based on the information stored in \c .ui files (created
+ create widgets based on the information stored in UI files (created
with \QD) or available in the specified plugin paths. The specified plugin
paths can be retrieved using the pluginPaths() function. Similarly, the
- contents of a \c{.ui} file can be retrieved using the load() function. For
+ contents of a UI file can be retrieved using the load() function. For
example:
\snippet doc/src/snippets/quiloader/mywidget.cpp 0
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 534bc11..4bed02f 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -81,10 +81,10 @@ static int usage(const QStringList &args)
" --output-format <outformat>\n"
" Specify output format. See -if.\n\n"
" --input-codec <codec>\n"
- " Specify encoding for .qm input files. Default is 'Latin1'.\n"
+ " Specify encoding for QM input files. Default is 'Latin1'.\n"
" UTF-8 is always tried as well, corresponding to the trUtf8() function.\n\n"
" --drop-tags <regexp>\n"
- " Drop named extra tags when writing 'ts' or 'xlf' files.\n"
+ " Drop named extra tags when writing TS or XLIFF files.\n"
" May be specified repeatedly.\n\n"
" --drop-translations\n"
" Drop existing translations and reset the status to 'unfinished'.\n"
@@ -101,10 +101,10 @@ static int usage(const QStringList &args)
" --no-finished\n"
" Drop finished messages.\n\n"
" --locations {absolute|relative|none}\n"
- " Override how source code references are saved in ts files.\n"
+ " Override how source code references are saved in TS files.\n"
" Default is absolute.\n\n"
" --no-ui-lines\n"
- " Drop line numbers from references to .ui files.\n\n"
+ " Drop line numbers from references to UI files.\n\n"
" --verbose\n"
" be a bit more verbose\n\n"
"Long options can be specified with only one leading dash, too.\n\n"
diff --git a/tools/linguist/linguist/batchtranslation.ui b/tools/linguist/linguist/batchtranslation.ui
index 88b55e2..0f7fe4b 100644
--- a/tools/linguist/linguist/batchtranslation.ui
+++ b/tools/linguist/linguist/batchtranslation.ui
@@ -104,7 +104,7 @@
<item>
<widget class="QCheckBox" name="ckTranslateFinished">
<property name="toolTip">
- <string>Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked.</string>
+ <string>Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked</string>
</property>
<property name="text">
<string>Translate also finished entries</string>
@@ -189,7 +189,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
- <string>The batch translator will search through the selected phrase books in the order given above.</string>
+ <string>The batch translator will search through the selected phrase books in the order given above</string>
</property>
<property name="wordWrap">
<bool>true</bool>
diff --git a/tools/linguist/linguist/images/minus.png b/tools/linguist/linguist/images/minus.png
new file mode 100644
index 0000000..745b445
--- /dev/null
+++ b/tools/linguist/linguist/images/minus.png
Binary files differ
diff --git a/tools/linguist/linguist/images/plus.png b/tools/linguist/linguist/images/plus.png
new file mode 100644
index 0000000..ef43788
--- /dev/null
+++ b/tools/linguist/linguist/images/plus.png
Binary files differ
diff --git a/tools/linguist/linguist/linguist.qrc b/tools/linguist/linguist/linguist.qrc
index 42cf6e3..a43f0ce 100644
--- a/tools/linguist/linguist/linguist.qrc
+++ b/tools/linguist/linguist/linguist.qrc
@@ -32,6 +32,8 @@
<file>images/up.png</file>
<file>images/down.png</file>
<file>images/editdelete.png</file>
+ <file>images/minus.png</file>
+ <file>images/plus.png</file>
<file>images/win/accelerator.png</file>
<file>images/win/book.png</file>
<file>images/win/doneandnext.png</file>
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index 18edc05..bb79b19 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -82,6 +82,7 @@
#include <QMenuBar>
#include <QMessageBox>
#include <QPrintDialog>
+#include <QPrinter>
#include <QProcess>
#include <QRegExp>
#include <QSettings>
@@ -257,6 +258,7 @@ bool FocusWatcher::eventFilter(QObject *, QEvent *event)
MainWindow::MainWindow()
: QMainWindow(0, Qt::Window),
m_assistantProcess(0),
+ m_printer(0),
m_findMatchCase(Qt::CaseInsensitive),
m_findIgnoreAccelerators(true),
m_findWhere(DataModel::NoLocation),
@@ -480,6 +482,10 @@ MainWindow::MainWindow()
readConfig();
m_statistics = 0;
+ connect(m_ui.actionLenghtVariants, SIGNAL(toggled(bool)),
+ m_messageEditor, SLOT(setLenghtVariants(bool)));
+ m_messageEditor->setLenghtVariants(m_ui.actionLenghtVariants->isChecked());
+
m_focusWatcher = new FocusWatcher(m_messageEditor, this);
m_contextView->installEventFilter(m_focusWatcher);
m_messageView->installEventFilter(m_focusWatcher);
@@ -499,6 +505,7 @@ MainWindow::~MainWindow()
qDeleteAll(m_phraseBooks);
delete m_dataModel;
delete m_statistics;
+ delete m_printer;
}
void MainWindow::modelCountChanged()
@@ -866,15 +873,22 @@ void MainWindow::releaseAll()
releaseInternal(i);
}
+QPrinter *MainWindow::printer()
+{
+ if (!m_printer)
+ m_printer = new QPrinter;
+ return m_printer;
+}
+
void MainWindow::print()
{
int pageNum = 0;
- QPrintDialog dlg(&m_printer, this);
+ QPrintDialog dlg(printer(), this);
if (dlg.exec()) {
QApplication::setOverrideCursor(Qt::WaitCursor);
- m_printer.setDocName(m_dataModel->condensedSrcFileNames(true));
+ printer()->setDocName(m_dataModel->condensedSrcFileNames(true));
statusBar()->showMessage(tr("Printing..."));
- PrintOut pout(&m_printer);
+ PrintOut pout(printer());
for (int i = 0; i < m_dataModel->contextCount(); ++i) {
MultiContextItem *mc = m_dataModel->multiContextItem(i);
@@ -1225,11 +1239,11 @@ void MainWindow::printPhraseBook(QAction *action)
int pageNum = 0;
- QPrintDialog dlg(&m_printer, this);
+ QPrintDialog dlg(printer(), this);
if (dlg.exec()) {
- m_printer.setDocName(phraseBook->fileName());
+ printer()->setDocName(phraseBook->fileName());
statusBar()->showMessage(tr("Printing..."));
- PrintOut pout(&m_printer);
+ PrintOut pout(printer());
pout.setRule(PrintOut::ThinRule);
foreach (const Phrase *p, phraseBook->phrases()) {
pout.setGuide(p->source());
@@ -2358,6 +2372,13 @@ void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose)
}
QStringList translations = m->translations();
+ // Truncated variants are permitted to be "denormalized"
+ for (int i = 0; i < translations.count(); ++i) {
+ int sep = translations.at(i).indexOf(QChar(Translator::BinaryVariantSeparator));
+ if (sep >= 0)
+ translations[i].truncate(sep);
+ }
+
if (m_ui.actionAccelerators->isChecked()) {
bool sk = !QKeySequence::mnemonic(source).isEmpty();
bool tk = true;
@@ -2500,6 +2521,8 @@ void MainWindow::readConfig()
config.value(settingPath("Validators/PhraseMatch"), true).toBool());
m_ui.actionPlaceMarkerMatches->setChecked(
config.value(settingPath("Validators/PlaceMarkers"), true).toBool());
+ m_ui.actionLenghtVariants->setChecked(
+ config.value(settingPath("Options/LengthVariants"), false).toBool());
recentFiles().readConfig();
@@ -2524,6 +2547,8 @@ void MainWindow::writeConfig()
m_ui.actionPhraseMatches->isChecked());
config.setValue(settingPath("Validators/PlaceMarkers"),
m_ui.actionPlaceMarkerMatches->isChecked());
+ config.setValue(settingPath("Options/LengthVariants"),
+ m_ui.actionLenghtVariants->isChecked());
config.setValue(settingPath("MainWindowState"),
saveState());
recentFiles().writeConfig();
diff --git a/tools/linguist/linguist/mainwindow.h b/tools/linguist/linguist/mainwindow.h
index 167dfe4..3dedcb5 100644
--- a/tools/linguist/linguist/mainwindow.h
+++ b/tools/linguist/linguist/mainwindow.h
@@ -51,7 +51,6 @@
#include <QtCore/QLocale>
#include <QtGui/QMainWindow>
-#include <QtGui/QPrinter>
QT_BEGIN_NAMESPACE
@@ -60,6 +59,7 @@ class QAction;
class QDialog;
class QLabel;
class QMenu;
+class QPrinter;
class QProcess;
class QIcon;
class QSortFilterProxyModel;
@@ -200,6 +200,8 @@ private:
void releaseInternal(int model);
void saveInternal(int model);
+ QPrinter *printer();
+
// FIXME: move to DataModel
void updateDanger(const MultiDataIndex &index, bool verbose);
@@ -226,7 +228,7 @@ private:
QList<QHash<QString, QList<Phrase *> > > m_phraseDict;
QList<PhraseBook *> m_phraseBooks;
QMap<QAction *, PhraseBook *> m_phraseBookMenu[3];
- QPrinter m_printer;
+ QPrinter *m_printer;
FindDialog *m_findDialog;
QString m_findText;
diff --git a/tools/linguist/linguist/mainwindow.ui b/tools/linguist/linguist/mainwindow.ui
index 6d42db0..613241b 100644
--- a/tools/linguist/linguist/mainwindow.ui
+++ b/tools/linguist/linguist/mainwindow.ui
@@ -60,7 +60,7 @@
<x>0</x>
<y>0</y>
<width>673</width>
- <height>30</height>
+ <height>28</height>
</rect>
</property>
<widget class="QMenu" name="menuPhrases">
@@ -116,6 +116,7 @@
<addaction name="actionResetSorting"/>
<addaction name="actionDisplayGuesses"/>
<addaction name="actionStatistics"/>
+ <addaction name="actionLenghtVariants"/>
<addaction name="separator"/>
<addaction name="menuToolbars"/>
<addaction name="menuViewViews"/>
@@ -401,7 +402,7 @@
<string>&amp;Prev Unfinished</string>
</property>
<property name="toolTip">
- <string>Previous unfinished item.</string>
+ <string>Previous unfinished item</string>
</property>
<property name="whatsThis">
<string>Move to the previous unfinished item.</string>
@@ -418,7 +419,7 @@
<string>&amp;Next Unfinished</string>
</property>
<property name="toolTip">
- <string>Next unfinished item.</string>
+ <string>Next unfinished item</string>
</property>
<property name="whatsThis">
<string>Move to the next unfinished item.</string>
@@ -435,7 +436,7 @@
<string>P&amp;rev</string>
</property>
<property name="toolTip">
- <string>Move to previous item.</string>
+ <string>Move to previous item</string>
</property>
<property name="whatsThis">
<string>Move to the previous item.</string>
@@ -452,7 +453,7 @@
<string>Ne&amp;xt</string>
</property>
<property name="toolTip">
- <string>Next item.</string>
+ <string>Next item</string>
</property>
<property name="whatsThis">
<string>Move to the next item.</string>
@@ -472,7 +473,7 @@
<string>&amp;Done and Next</string>
</property>
<property name="toolTip">
- <string>Mark item as done and move to the next unfinished item.</string>
+ <string>Mark item as done and move to the next unfinished item</string>
</property>
<property name="whatsThis">
<string>Mark this item as done and move to the next unfinished item.</string>
@@ -492,7 +493,7 @@
<string>Copy from source text</string>
</property>
<property name="toolTip">
- <string>Copies the source text into the translation field.</string>
+ <string>Copies the source text into the translation field</string>
</property>
<property name="whatsThis">
<string>Copies the source text into the translation field.</string>
@@ -512,7 +513,7 @@
<string>&amp;Accelerators</string>
</property>
<property name="toolTip">
- <string>Toggle the validity check of accelerators.</string>
+ <string>Toggle the validity check of accelerators</string>
</property>
<property name="whatsThis">
<string>Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window.</string>
@@ -529,7 +530,7 @@
<string>&amp;Ending Punctuation</string>
</property>
<property name="toolTip">
- <string>Toggle the validity check of ending punctuation.</string>
+ <string>Toggle the validity check of ending punctuation</string>
</property>
<property name="whatsThis">
<string>Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window.</string>
@@ -546,7 +547,7 @@
<string>&amp;Phrase matches</string>
</property>
<property name="toolTip">
- <string>Toggle checking that phrase suggestions are used.</string>
+ <string>Toggle checking that phrase suggestions are used</string>
</property>
<property name="whatsThis">
<string>Toggle checking that phrase suggestions are used. If the check fails, a message is shown in the warnings window.</string>
@@ -563,7 +564,7 @@
<string>Place &amp;Marker Matches</string>
</property>
<property name="toolTip">
- <string>Toggle the validity check of place markers.</string>
+ <string>Toggle the validity check of place markers</string>
</property>
<property name="whatsThis">
<string>Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window.</string>
@@ -746,7 +747,7 @@
<string>Release As...</string>
</property>
<property name="whatsThis">
- <string>Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the .ts file.</string>
+ <string>Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the TS file.</string>
</property>
</action>
<action name="actionFile">
@@ -877,6 +878,14 @@
<string>Ctrl+W</string>
</property>
</action>
+ <action name="actionLenghtVariants">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Lenght Variants</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp
index be70d2b..9e598a8 100644
--- a/tools/linguist/linguist/messageeditor.cpp
+++ b/tools/linguist/linguist/messageeditor.cpp
@@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE
// functionality is provided within Qt (see task 196275).
static const char * language_strings[] =
{
+ QT_TRANSLATE_NOOP("MessageEditor", "Russian"),
QT_TRANSLATE_NOOP("MessageEditor", "German"),
QT_TRANSLATE_NOOP("MessageEditor", "Japanese"),
QT_TRANSLATE_NOOP("MessageEditor", "French"),
@@ -87,6 +88,7 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent)
m_dataModel(dataModel),
m_currentModel(-1),
m_currentNumerus(-1),
+ m_lengthVariants(false),
m_undoAvail(false),
m_redoAvail(false),
m_cutAvail(false),
@@ -120,6 +122,9 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent)
connect(m_dataModel, SIGNAL(languageChanged(int)),
SLOT(setTargetLanguage(int)));
+ m_tabOrderTimer.setSingleShot(true);
+ connect(&m_tabOrderTimer, SIGNAL(timeout()), SLOT(reallyFixTabOrder()));
+
clipboardChanged();
setWhatsThis(tr("This whole panel allows you to view and edit "
@@ -223,6 +228,7 @@ void MessageEditor::messageModelAppended()
SLOT(emitTranslatorCommentChanged(QTextEdit *)));
connect(ed.transCommentText, SIGNAL(textChanged(QTextEdit *)), SLOT(resetHoverSelection()));
connect(ed.transCommentText, SIGNAL(cursorPositionChanged()), SLOT(resetHoverSelection()));
+ fixTabOrder();
QBoxLayout *box = new QVBoxLayout(ed.container);
box->setMargin(5);
box->addWidget(ed.transCommentText);
@@ -268,18 +274,16 @@ void MessageEditor::messageModelDeleted(int model)
void MessageEditor::addPluralForm(int model, const QString &label, bool writable)
{
- FormWidget *transEditor = new FormWidget(label, true);
- QFont font;
- font.setPointSize(static_cast<int>(m_editors[model].fontSize));
- transEditor->getEditor()->setFont(font);
+ FormMultiWidget *transEditor = new FormMultiWidget(label);
+ connect(transEditor, SIGNAL(editorCreated(QTextEdit *)), SLOT(editorCreated(QTextEdit *)));
transEditor->setEditingEnabled(writable);
transEditor->setHideWhenEmpty(!writable);
if (!m_editors[model].transTexts.isEmpty())
transEditor->setVisible(false);
+ transEditor->setMultiEnabled(m_lengthVariants);
static_cast<QBoxLayout *>(m_editors[model].container->layout())->insertWidget(
m_editors[model].transTexts.count(), transEditor);
- transEditor->getEditor()->installEventFilter(this);
connect(transEditor, SIGNAL(selectionChanged(QTextEdit *)),
SLOT(selectionChanged(QTextEdit *)));
connect(transEditor, SIGNAL(textChanged(QTextEdit *)),
@@ -290,6 +294,44 @@ void MessageEditor::addPluralForm(int model, const QString &label, bool writable
m_editors[model].transTexts << transEditor;
}
+void MessageEditor::editorCreated(QTextEdit *te)
+{
+ FormMultiWidget *snd = static_cast<FormMultiWidget *>(sender());
+ for (int model = 0; ; ++model) {
+ MessageEditorData med = m_editors.at(model);
+ if (med.transTexts.contains(snd)) {
+ QFont font;
+ font.setPointSize(static_cast<int>(med.fontSize));
+ te->setFont(font);
+
+ te->installEventFilter(this);
+
+ fixTabOrder();
+ return;
+ }
+ }
+}
+
+void MessageEditor::fixTabOrder()
+{
+ m_tabOrderTimer.start(0);
+}
+
+void MessageEditor::reallyFixTabOrder()
+{
+ QWidget *prev = this;
+ foreach (const MessageEditorData &med, m_editors) {
+ foreach (FormMultiWidget *fmw, med.transTexts)
+ foreach (QTextEdit *te, fmw->getEditors()) {
+ setTabOrder(prev, te);
+ prev = te;
+ }
+ QTextEdit *te = med.transCommentText->getEditor();
+ setTabOrder(prev, te);
+ prev = te;
+ }
+}
+
/*! internal
Returns all translations for an item.
The number of translations is dependent on if we have a plural form or not.
@@ -345,11 +387,12 @@ void MessageEditor::activeModelAndNumerus(int *model, int *numerus) const
{
for (int j = 0; j < m_editors.count(); ++j) {
for (int i = 0; i < m_editors[j].transTexts.count(); ++i)
- if (m_focusWidget == m_editors[j].transTexts[i]->getEditor()) {
- *model = j;
- *numerus = i;
- return;
- }
+ foreach (QTextEdit *te, m_editors[j].transTexts[i]->getEditors())
+ if (m_focusWidget == te) {
+ *model = j;
+ *numerus = i;
+ return;
+ }
if (m_focusWidget == m_editors[j].transCommentText->getEditor()) {
*model = j;
*numerus = -1;
@@ -364,7 +407,10 @@ QTextEdit *MessageEditor::activeTranslation() const
{
if (m_currentNumerus < 0)
return 0;
- return m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditor();
+ foreach (QTextEdit *te, m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditors())
+ if (te->hasFocus())
+ return te;
+ return 0; // This cannot happen
}
QTextEdit *MessageEditor::activeOr1stTranslation() const
@@ -372,11 +418,11 @@ QTextEdit *MessageEditor::activeOr1stTranslation() const
if (m_currentNumerus < 0) {
for (int i = 0; i < m_editors.size(); ++i)
if (m_editors[i].container->isVisible()
- && !m_editors[i].transTexts[0]->getEditor()->isReadOnly())
- return m_editors[i].transTexts[0]->getEditor();
+ && !m_editors[i].transTexts.first()->getEditors().first()->isReadOnly())
+ return m_editors[i].transTexts.first()->getEditors().first();
return 0;
}
- return m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditor();
+ return activeTranslation();
}
QTextEdit *MessageEditor::activeTransComment() const
@@ -404,25 +450,14 @@ void MessageEditor::setTargetLanguage(int model)
{
const QStringList &numerusForms = m_dataModel->model(model)->numerusForms();
const QString &langLocalized = m_dataModel->model(model)->localizedLanguage();
- bool added = false;
for (int i = 0; i < numerusForms.count(); ++i) {
const QString &label = tr("%1 translation (%2)").arg(langLocalized, numerusForms[i]);
if (!i)
m_editors[model].firstForm = label;
- if (i >= m_editors[model].transTexts.count()) {
+ if (i >= m_editors[model].transTexts.count())
addPluralForm(model, label, m_dataModel->isModelWritable(model));
- QWidget *prev;
- if (i > 0)
- prev = m_editors[model].transTexts[i - 1]->getEditor();
- else if (model)
- prev = m_editors[model - 1].transCommentText->getEditor();
- else
- prev = this;
- setTabOrder(prev, m_editors[model].transTexts[i]->getEditor());
- added = true;
- } else {
+ else
m_editors[model].transTexts[i]->setLabel(label);
- }
m_editors[model].transTexts[i]->setVisible(!i || m_editors[model].pluralEditMode);
m_editors[model].transTexts[i]->setWhatsThis(
tr("This is where you can enter or modify"
@@ -432,16 +467,15 @@ void MessageEditor::setTargetLanguage(int model)
delete m_editors[model].transTexts.takeLast();
m_editors[model].invariantForm = tr("%1 translation").arg(langLocalized);
m_editors[model].transCommentText->setLabel(tr("%1 translator comments").arg(langLocalized));
- if (added)
- setTabOrder(m_editors[model].transTexts.last()->getEditor(), m_editors[model].transCommentText->getEditor());
}
MessageEditorData *MessageEditor::modelForWidget(const QObject *o)
{
for (int j = 0; j < m_editors.count(); ++j) {
for (int i = 0; i < m_editors[j].transTexts.count(); ++i)
- if (m_editors[j].transTexts[i]->getEditor() == o)
- return &m_editors[j];
+ foreach (QTextEdit *te, m_editors[j].transTexts[i]->getEditors())
+ if (te == o)
+ return &m_editors[j];
if (m_editors[j].transCommentText->getEditor() == o)
return &m_editors[j];
}
@@ -453,7 +487,8 @@ static bool applyFont(MessageEditorData *med)
QFont font;
font.setPointSize(static_cast<int>(med->fontSize));
for (int i = 0; i < med->transTexts.count(); ++i)
- med->transTexts[i]->getEditor()->setFont(font);
+ foreach (QTextEdit *te, med->transTexts[i]->getEditors())
+ te->setFont(font);
med->transCommentText->getEditor()->setFont(font);
return true;
}
@@ -556,7 +591,7 @@ void MessageEditor::showNothing()
m_commentText->clearTranslation();
for (int j = 0; j < m_editors.count(); ++j) {
setEditingEnabled(j, false);
- foreach (FormWidget *widget, m_editors[j].transTexts)
+ foreach (FormMultiWidget *widget, m_editors[j].transTexts)
widget->clearTranslation();
m_editors[j].transCommentText->clearTranslation();
}
@@ -643,7 +678,7 @@ void MessageEditor::setTranslation(int model, const QString &translation, int nu
MessageEditorData &ed = m_editors[model];
if (numerus >= ed.transTexts.count())
numerus = 0;
- FormWidget *transForm = ed.transTexts[numerus];
+ FormMultiWidget *transForm = ed.transTexts[numerus];
transForm->setTranslation(translation, false);
updateBeginFromSource();
@@ -658,8 +693,8 @@ void MessageEditor::setTranslation(int latestModel, const QString &translation)
latestModel = m_currentModel;
numerus = m_currentNumerus;
}
- FormWidget *transForm = m_editors[latestModel].transTexts[numerus];
- transForm->getEditor()->setFocus();
+ FormMultiWidget *transForm = m_editors[latestModel].transTexts[numerus];
+ transForm->getEditors().first()->setFocus();
transForm->setTranslation(translation, true);
updateBeginFromSource();
@@ -668,13 +703,21 @@ void MessageEditor::setTranslation(int latestModel, const QString &translation)
void MessageEditor::setEditingEnabled(int model, bool enabled)
{
MessageEditorData &ed = m_editors[model];
- foreach (FormWidget *widget, ed.transTexts)
+ foreach (FormMultiWidget *widget, ed.transTexts)
widget->setEditingEnabled(enabled);
ed.transCommentText->setEditingEnabled(enabled);
updateCanPaste();
}
+void MessageEditor::setLenghtVariants(bool on)
+{
+ m_lengthVariants = on;
+ foreach (const MessageEditorData &ed, m_editors)
+ foreach (FormMultiWidget *widget, ed.transTexts)
+ widget->setMultiEnabled(on);
+}
+
void MessageEditor::undo()
{
activeEditor()->document()->undo();
@@ -813,12 +856,13 @@ void MessageEditor::setEditorFocus(int model)
resetSelection();
m_currentNumerus = -1;
m_currentModel = -1;
+ m_focusWidget = 0;
emit activeModelChanged(activeModel());
updateBeginFromSource();
updateUndoRedo();
updateCanPaste();
} else {
- m_editors[model].transTexts[0]->getEditor()->setFocus();
+ m_editors[model].transTexts.first()->getEditors().first()->setFocus();
}
}
}
@@ -829,7 +873,7 @@ bool MessageEditor::focusNextUnfinished(int start)
if (m_dataModel->isModelWritable(j))
if (MessageItem *item = m_dataModel->messageItem(m_currentIndex, j))
if (item->type() == TranslatorMessage::Unfinished) {
- m_editors[j].transTexts[0]->getEditor()->setFocus();
+ m_editors[j].transTexts.first()->getEditors().first()->setFocus();
return true;
}
return false;
diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h
index 95bcd86..4106036 100644
--- a/tools/linguist/linguist/messageeditor.h
+++ b/tools/linguist/linguist/messageeditor.h
@@ -45,6 +45,7 @@
#include "messagemodel.h"
#include <QtCore/QLocale>
+#include <QtCore/QTimer>
#include <QtGui/QFrame>
#include <QtGui/QScrollArea>
@@ -58,11 +59,12 @@ class QTextEdit;
class MessageEditor;
class FormatTextEdit;
class FormWidget;
+class FormMultiWidget;
struct MessageEditorData {
QWidget *container;
FormWidget *transCommentText;
- QList<FormWidget*> transTexts;
+ QList<FormMultiWidget *> transTexts;
QString invariantForm;
QString firstForm;
float fontSize;
@@ -108,8 +110,10 @@ public slots:
void beginFromSource();
void setEditorFocus();
void setTranslation(int latestModel, const QString &translation);
+ void setLenghtVariants(bool on);
private slots:
+ void editorCreated(QTextEdit *);
void selectionChanged(QTextEdit *);
void resetHoverSelection();
void emitTranslationChanged(QTextEdit *);
@@ -120,6 +124,7 @@ private slots:
void messageModelDeleted(int model);
void allModelsDeleted();
void setTargetLanguage(int model);
+ void reallyFixTabOrder();
private:
void setupEditorPage();
@@ -141,6 +146,7 @@ private:
void updateUndoRedo();
void updateCanCutCopy();
void addPluralForm(int model, const QString &label, bool writable);
+ void fixTabOrder();
QPalette paletteForModel(int model) const;
MultiDataModel *m_dataModel;
@@ -149,6 +155,8 @@ private:
int m_currentModel;
int m_currentNumerus;
+ bool m_lengthVariants;
+
bool m_undoAvail;
bool m_redoAvail;
bool m_cutAvail;
@@ -163,6 +171,8 @@ private:
FormWidget *m_pluralSource;
FormWidget *m_commentText;
QList<MessageEditorData> m_editors;
+
+ QTimer m_tabOrderTimer;
};
QT_END_NAMESPACE
diff --git a/tools/linguist/linguist/messageeditorwidgets.cpp b/tools/linguist/linguist/messageeditorwidgets.cpp
index 2ac426d..f8e2dc2 100644
--- a/tools/linguist/linguist/messageeditorwidgets.cpp
+++ b/tools/linguist/linguist/messageeditorwidgets.cpp
@@ -42,6 +42,8 @@
#include "messageeditorwidgets.h"
#include "messagehighlighter.h"
+#include <translator.h>
+
#include <QAbstractTextDocumentLayout>
#include <QAction>
#include <QApplication>
@@ -49,10 +51,12 @@
#include <QDebug>
#include <QLayout>
#include <QMenu>
+#include <QMessageBox>
#include <QPainter>
#include <QScrollArea>
#include <QTextBlock>
#include <QTextDocumentFragment>
+#include <QToolButton>
#include <QVBoxLayout>
QT_BEGIN_NAMESPACE
@@ -182,14 +186,14 @@ FormWidget::FormWidget(const QString &label, bool isEditable, QWidget *parent)
connect(m_editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
}
-void FormWidget::slotSelectionChanged()
+void FormWidget::slotTextChanged()
{
- emit selectionChanged(m_editor);
+ emit textChanged(m_editor);
}
-void FormWidget::slotTextChanged()
+void FormWidget::slotSelectionChanged()
{
- emit textChanged(m_editor);
+ emit selectionChanged(m_editor);
}
void FormWidget::setTranslation(const QString &text, bool userAction)
@@ -207,4 +211,240 @@ void FormWidget::setEditingEnabled(bool enable)
}
+class ButtonWrapper : public QWidget
+{
+ // no Q_OBJECT: no need to, and don't want the useless moc file
+
+public:
+ ButtonWrapper(QWidget *wrapee, QWidget *relator) : m_wrapee(wrapee)
+ {
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
+ QBoxLayout *box = new QVBoxLayout;
+ box->setMargin(0);
+ setLayout(box);
+ box->addWidget(wrapee, 0, Qt::AlignBottom);
+ if (relator)
+ relator->installEventFilter(this);
+ }
+
+protected:
+ virtual bool eventFilter(QObject *object, QEvent *event)
+ {
+ if (event->type() == QEvent::Resize) {
+ QWidget *relator = static_cast<QWidget *>(object);
+ setFixedHeight((relator->height() + layout()->spacing() + m_wrapee->height()) / 2);
+ }
+ return false;
+ }
+
+private:
+ QWidget *m_wrapee;
+};
+
+FormMultiWidget::FormMultiWidget(const QString &label, QWidget *parent)
+ : QWidget(parent),
+ m_hideWhenEmpty(false),
+ m_multiEnabled(false),
+ m_plusIcon(QIcon(QLatin1String(":/images/plus.png"))), // make static
+ m_minusIcon(QIcon(QLatin1String(":/images/minus.png")))
+{
+ m_label = new QLabel(this);
+ m_label->setText(label);
+
+ m_plusButtons.append(
+ new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), 0));
+}
+
+QAbstractButton *FormMultiWidget::makeButton(const QIcon &icon, const char *slot)
+{
+ QAbstractButton *btn = new QToolButton(this);
+ btn->setIcon(icon);
+ btn->setFixedSize(icon.availableSizes().first() /* + something */);
+ btn->setFocusPolicy(Qt::NoFocus);
+ connect(btn, SIGNAL(clicked()), slot);
+ return btn;
+}
+
+void FormMultiWidget::addEditor(int idx)
+{
+ FormatTextEdit *editor = new FormatTextEdit(this);
+ m_editors.insert(idx, editor);
+
+ m_minusButtons.insert(idx, makeButton(m_minusIcon, SLOT(minusButtonClicked())));
+ m_plusButtons.insert(idx + 1,
+ new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), editor));
+
+ connect(editor, SIGNAL(textChanged()), SLOT(slotTextChanged()));
+ connect(editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
+ connect(editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
+ editor->installEventFilter(this);
+
+ emit editorCreated(editor);
+}
+
+bool FormMultiWidget::eventFilter(QObject *watched, QEvent *event)
+{
+ int i = 0;
+ while (m_editors.at(i) != watched)
+ if (++i >= m_editors.count()) // Happens when deleting an editor
+ return false;
+ if (event->type() == QEvent::FocusOut) {
+ m_minusButtons.at(i)->setToolTip(QString());
+ m_plusButtons.at(i)->setToolTip(QString());
+ m_plusButtons.at(i + 1)->setToolTip(QString());
+ } else if (event->type() == QEvent::FocusIn) {
+ m_minusButtons.at(i)->setToolTip(/*: translate, but don't change */ tr("Alt+Delete"));
+ m_plusButtons.at(i)->setToolTip(/*: translate, but don't change */ tr("Shift+Alt+Insert"));
+ m_plusButtons.at(i + 1)->setToolTip(/*: translate, but don't change */ tr("Alt+Insert"));
+ } else if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ if (ke->modifiers() & Qt::AltModifier) {
+ if (ke->key() == Qt::Key_Delete) {
+ deleteEditor(i);
+ return true;
+ } else if (ke->key() == Qt::Key_Insert) {
+ if (!(ke->modifiers() & Qt::ShiftModifier))
+ ++i;
+ insertEditor(i);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void FormMultiWidget::updateLayout()
+{
+ delete layout();
+
+ QGridLayout *layout = new QGridLayout;
+ layout->setMargin(0);
+ setLayout(layout);
+
+ bool variants = m_multiEnabled && m_label->isEnabled();
+
+ layout->addWidget(m_label, 0, 0, 1, variants ? 3 : 1);
+
+ for (int i = 0; i < m_plusButtons.count(); ++i) {
+ if (variants)
+ layout->addWidget(m_plusButtons.at(i), 1 + i * 2, 0, 2, 1, Qt::AlignTop);
+ m_plusButtons.at(i)->setVisible(variants);
+ }
+ for (int j = 0; j < m_minusButtons.count(); ++j) {
+ if (variants)
+ layout->addWidget(m_minusButtons.at(j), 2 + j * 2, 2, 2, 1, Qt::AlignVCenter);
+ m_minusButtons.at(j)->setVisible(variants);
+ }
+ for (int k = 0; k < m_editors.count(); ++k)
+ layout->addWidget(m_editors.at(k), 2 + k * 2, variants ? 1 : 0, 2, 1, Qt::AlignVCenter);
+
+ updateGeometry();
+}
+
+void FormMultiWidget::slotTextChanged()
+{
+ emit textChanged(static_cast<QTextEdit *>(sender()));
+}
+
+void FormMultiWidget::slotSelectionChanged()
+{
+ emit selectionChanged(static_cast<QTextEdit *>(sender()));
+}
+
+void FormMultiWidget::setTranslation(const QString &text, bool userAction)
+{
+ QStringList texts = text.split(QChar(Translator::BinaryVariantSeparator), QString::KeepEmptyParts);
+
+ while (m_editors.count() > texts.count()) {
+ delete m_minusButtons.takeLast();
+ delete m_plusButtons.takeLast();
+ delete m_editors.takeLast();
+ }
+ while (m_editors.count() < texts.count())
+ addEditor(m_editors.count());
+ updateLayout();
+
+ for (int i = 0; i < texts.count(); ++i)
+ // XXX this will emit n textChanged signals
+ m_editors.at(i)->setPlainText(texts.at(i), userAction);
+
+ if (m_hideWhenEmpty)
+ setHidden(text.isEmpty());
+}
+
+QString FormMultiWidget::getTranslation() const
+{
+ QString ret;
+ for (int i = 0; i < m_editors.count(); ++i) {
+ if (i)
+ ret += QChar(Translator::BinaryVariantSeparator);
+ ret += m_editors.at(i)->toPlainText();
+ }
+ return ret;
+}
+
+void FormMultiWidget::setEditingEnabled(bool enable)
+{
+ // Use read-only state so that the text can still be copied
+ for (int i = 0; i < m_editors.count(); ++i)
+ m_editors.at(i)->setReadOnly(!enable);
+ m_label->setEnabled(enable);
+ if (m_multiEnabled)
+ updateLayout();
+}
+
+void FormMultiWidget::setMultiEnabled(bool enable)
+{
+ m_multiEnabled = enable;
+ if (m_label->isEnabled())
+ updateLayout();
+}
+
+void FormMultiWidget::minusButtonClicked()
+{
+ int i = 0;
+ while (m_minusButtons.at(i) != sender())
+ ++i;
+ deleteEditor(i);
+}
+
+void FormMultiWidget::plusButtonClicked()
+{
+ QWidget *btn = static_cast<QAbstractButton *>(sender())->parentWidget();
+ int i = 0;
+ while (m_plusButtons.at(i) != btn)
+ ++i;
+ insertEditor(i);
+}
+
+void FormMultiWidget::deleteEditor(int idx)
+{
+ if (m_editors.count() == 1) {
+ // Don't just clear(), so the undo history is not lost
+ QTextCursor c = m_editors.first()->textCursor();
+ c.select(QTextCursor::Document);
+ c.removeSelectedText();
+ } else {
+ if (!m_editors.at(idx)->toPlainText().isEmpty()) {
+ if (QMessageBox::question(topLevelWidget(), tr("Confirmation - Qt Linguist"),
+ tr("Delete non-empty length variant?"),
+ QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)
+ != QMessageBox::Yes)
+ return;
+ }
+ delete m_editors.takeAt(idx);
+ delete m_minusButtons.takeAt(idx);
+ delete m_plusButtons.takeAt(idx + 1);
+ updateLayout();
+ emit textChanged(m_editors.at((m_editors.count() == idx) ? idx - 1 : idx));
+ }
+}
+
+void FormMultiWidget::insertEditor(int idx)
+{
+ addEditor(idx);
+ updateLayout();
+ emit textChanged(m_editors.at(idx));
+}
+
QT_END_NAMESPACE
diff --git a/tools/linguist/linguist/messageeditorwidgets.h b/tools/linguist/linguist/messageeditorwidgets.h
index bf3dcb0..c0b445c 100644
--- a/tools/linguist/linguist/messageeditorwidgets.h
+++ b/tools/linguist/linguist/messageeditorwidgets.h
@@ -42,6 +42,7 @@
#ifndef MESSAGEEDITORWIDGETS_H
#define MESSAGEEDITORWIDGETS_H
+#include <QIcon>
#include <QImage>
#include <QLabel>
#include <QMap>
@@ -51,6 +52,7 @@
QT_BEGIN_NAMESPACE
+class QAbstractButton;
class QAction;
class QContextMenuEvent;
class QKeyEvent;
@@ -129,6 +131,54 @@ private:
bool m_hideWhenEmpty;
};
+/*
+ Displays text fields & associated label
+*/
+class FormMultiWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ FormMultiWidget(const QString &label, QWidget *parent = 0);
+ void setLabel(const QString &label) { m_label->setText(label); }
+ void setTranslation(const QString &text, bool userAction = false);
+ void clearTranslation() { setTranslation(QString(), false); }
+ QString getTranslation() const;
+ void setEditingEnabled(bool enable);
+ void setMultiEnabled(bool enable);
+ void setHideWhenEmpty(bool optional) { m_hideWhenEmpty = optional; }
+ const QList<FormatTextEdit *> &getEditors() const { return m_editors; }
+
+signals:
+ void editorCreated(QTextEdit *);
+ void textChanged(QTextEdit *);
+ void selectionChanged(QTextEdit *);
+ void cursorPositionChanged();
+
+protected:
+ bool eventFilter(QObject *watched, QEvent *event);
+
+private slots:
+ void slotTextChanged();
+ void slotSelectionChanged();
+ void minusButtonClicked();
+ void plusButtonClicked();
+
+private:
+ void addEditor(int idx);
+ void updateLayout();
+ QAbstractButton *makeButton(const QIcon &icon, const char *slot);
+ void insertEditor(int idx);
+ void deleteEditor(int idx);
+
+ QLabel *m_label;
+ QList<FormatTextEdit *> m_editors;
+ QList<QWidget *> m_plusButtons;
+ QList<QAbstractButton *> m_minusButtons;
+ bool m_hideWhenEmpty;
+ bool m_multiEnabled;
+ QIcon m_plusIcon, m_minusIcon;
+};
+
QT_END_NAMESPACE
#endif // MESSAGEEDITORWIDGETS_H
diff --git a/tools/linguist/lrelease/lrelease.1 b/tools/linguist/lrelease/lrelease.1
index 9e77504..8dd14b2 100644
--- a/tools/linguist/lrelease/lrelease.1
+++ b/tools/linguist/lrelease/lrelease.1
@@ -51,10 +51,10 @@ This page documents the
tool for the Qt GUI toolkit.
.B Lrelease
reads a qmake/tmake project file (.pro file) and converts the
-translation files (.ts files) specified in it into Qt message files
-(.qm files) used by the application to translate.
+translation files (TS files) specified in it into Qt message files
+(QM files) used by the application to translate.
.PP
-The .qm file format is a compact binary format that provides
+The QM file format is a compact binary format that provides
extremely fast lookups for translations and that is used by Qt.
.SH OPTIONS
.TP
@@ -62,7 +62,7 @@ extremely fast lookups for translations and that is used by Qt.
Display the usage and exit.
.TP
.I "-compress"
-Compress the .qm files.
+Compress the QM files.
.TP
.I "-nounfinished"
Do not include unfinished translations.
@@ -72,7 +72,7 @@ If the translated text is the same as
the source text, do not include the message.
.TP
.I "-silent"
-Don't explain what is being done.
+Do not explain what is being done.
.TP
.I "-version"
Display the version of
@@ -105,7 +105,7 @@ generated from gnomovision_dk.ts, gnomovision_fi.ts,
gnomovision_no.ts and gnomovision_se.ts, respectively.
.PP
.B Lrelease
-can also be invoked with a list of .ts files to convert:
+can also be invoked with a list of TS files to convert:
.PP
.in +4
.nf
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index 86b7866..d3b9937 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "translator.h"
-#include "profileevaluator.h"
+#include "proreader.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
@@ -66,19 +66,21 @@ static void printUsage()
" lrelease [options] project-file\n"
" lrelease [options] ts-files [-qm qm-file]\n\n"
"lrelease is part of Qt's Linguist tool chain. It can be used as a\n"
- "stand-alone tool to convert XML based translations files in the .ts\n"
- "format into the 'compiled' .qm format used by QTranslator objects.\n\n"
+ "stand-alone tool to convert XML-based translations files in the TS\n"
+ "format into the 'compiled' QM format used by QTranslator objects.\n\n"
"Options:\n"
" -help Display this information and exit\n"
+ " -idbased\n"
+ " Use IDs instead of source strings for message keying\n"
" -compress\n"
- " Compress the .qm files\n"
+ " Compress the QM files\n"
" -nounfinished\n"
" Do not include unfinished translations\n"
" -removeidentical\n"
" If the translated text is the same as\n"
" the source text, do not include the message\n"
" -silent\n"
- " Don't explain what is being done\n"
+ " Do not explain what is being done\n"
" -version\n"
" Display the version of lrelease and exit\n"
));
@@ -99,7 +101,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo
static bool releaseTranslator(Translator &tor, const QString &qmFileName,
bool verbose, bool ignoreUnfinished,
- bool removeIdentical, TranslatorSaveMode mode)
+ bool removeIdentical, bool idBased, TranslatorSaveMode mode)
{
Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, verbose);
@@ -121,6 +123,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
ConversionData cd;
cd.m_verbose = verbose;
cd.m_ignoreUnfinished = ignoreUnfinished;
+ cd.m_idBased = idBased;
cd.m_saveMode = mode;
bool ok = tor.release(&file, cd);
file.close();
@@ -136,7 +139,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
}
static bool releaseTsFile(const QString& tsFileName, bool verbose,
- bool ignoreUnfinished, bool removeIdentical, TranslatorSaveMode mode)
+ bool ignoreUnfinished, bool removeIdentical, bool idBased, TranslatorSaveMode mode)
{
Translator tor;
if (!loadTsFile(tor, tsFileName, verbose))
@@ -151,7 +154,7 @@ static bool releaseTsFile(const QString& tsFileName, bool verbose,
}
qmFileName += QLatin1String(".qm");
- return releaseTranslator(tor, qmFileName, verbose, ignoreUnfinished, removeIdentical, mode);
+ return releaseTranslator(tor, qmFileName, verbose, ignoreUnfinished, removeIdentical, idBased, mode);
}
int main(int argc, char **argv)
@@ -164,6 +167,7 @@ int main(int argc, char **argv)
bool verbose = true; // the default is true starting with Qt 4.2
bool ignoreUnfinished = false;
+ bool idBased = false;
// the default mode is SaveEverything starting with Qt 4.2
TranslatorSaveMode mode = SaveEverything;
bool removeIdentical = false;
@@ -175,6 +179,9 @@ int main(int argc, char **argv)
if (args[i] == QLatin1String("-compress")) {
mode = SaveStripped;
continue;
+ } else if (args[i] == QLatin1String("-idbased")) {
+ idBased = true;
+ continue;
} else if (args[i] == QLatin1String("-nocompress")) {
mode = SaveEverything;
continue;
@@ -232,18 +239,18 @@ int main(int argc, char **argv)
qPrintable(args[i]));
} else {
foreach (const QString &trans, translations)
- if (!releaseTsFile(trans, verbose, ignoreUnfinished, removeIdentical, mode))
+ if (!releaseTsFile(trans, verbose, ignoreUnfinished, removeIdentical, idBased, mode))
return 1;
}
} else {
qWarning("error: lrelease encountered project file functionality that is currently not supported.\n"
- "You might want to consider using .ts files as input instead of a project file.\n"
+ "You might want to consider using TS files as input instead of a project file.\n"
"Try the following syntax:\n"
" lrelease [options] ts-files [-qm qm-file]\n");
}
} else {
if (outputFile.isEmpty()) {
- if (!releaseTsFile(args[i], verbose, ignoreUnfinished, removeIdentical, mode))
+ if (!releaseTsFile(args[i], verbose, ignoreUnfinished, removeIdentical, idBased, mode))
return 1;
} else {
if (!loadTsFile(tor, args[i], verbose))
@@ -254,7 +261,7 @@ int main(int argc, char **argv)
if (!outputFile.isEmpty())
return releaseTranslator(tor, outputFile, verbose, ignoreUnfinished,
- removeIdentical, mode) ? 0 : 1;
+ removeIdentical, idBased, mode) ? 0 : 1;
return 0;
}
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index eb743c2..58e094b 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -58,10 +58,6 @@ QT_BEGIN_NAMESPACE
static const char MagicComment[] = "TRANSLATOR ";
-static const int yyIdentMaxLen = 128;
-static const int yyCommentMaxLen = 65536;
-static const int yyStringMaxLen = 65536;
-
#define STRINGIFY_INTERNAL(x) #x
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
#define STRING(s) static QString str##s(QLatin1String(STRINGIFY(s)))
@@ -180,7 +176,8 @@ private:
QString transcode(const QString &str, bool utf8);
void recordMessage(
int line, const QString &context, const QString &text, const QString &comment,
- const QString &extracomment, bool utf8, bool plural);
+ const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
+ bool utf8, bool plural);
void processInclude(const QString &file, ConversionData &cd,
QSet<QString> &inclusions);
@@ -202,7 +199,7 @@ private:
enum {
Tok_Eof, Tok_class, Tok_friend, Tok_namespace, Tok_using, Tok_return,
- Tok_tr = 10, Tok_trUtf8, Tok_translate, Tok_translateUtf8,
+ Tok_tr = 10, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid,
Tok_Q_OBJECT = 20, Tok_Q_DECLARE_TR_FUNCTIONS,
Tok_Ident, Tok_Comment, Tok_String, Tok_Arrow, Tok_Colon, Tok_ColonColon,
Tok_Equals,
@@ -556,6 +553,8 @@ uint CppParser::getToken()
return Tok_Q_DECLARE_TR_FUNCTIONS;
if (yyIdent == QLatin1String("QT_TR_NOOP"))
return Tok_tr;
+ if (yyIdent == QLatin1String("QT_TRID_NOOP"))
+ return Tok_trid;
if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP"))
return Tok_translate;
if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP3"))
@@ -591,6 +590,10 @@ uint CppParser::getToken()
if (yyIdent == QLatin1String("namespace"))
return Tok_namespace;
break;
+ case 'q':
+ if (yyIdent == QLatin1String("qtTrId"))
+ return Tok_trid;
+ break;
case 'r':
if (yyIdent == QLatin1String("return"))
return Tok_return;
@@ -667,14 +670,9 @@ uint CppParser::getToken()
yyCh = getChar();
if (yyCh == EOF || yyCh == '\n')
break;
- if (yyString.size() < yyStringMaxLen) {
- yyString.append(QLatin1Char('\\'));
- yyString.append(yyCh);
- }
- } else {
- if (yyString.size() < yyStringMaxLen)
- yyString.append(yyCh);
+ yyString.append(QLatin1Char('\\'));
}
+ yyString.append(yyCh);
yyCh = getChar();
}
@@ -1299,13 +1297,16 @@ QString CppParser::transcode(const QString &str, bool utf8)
void CppParser::recordMessage(
int line, const QString &context, const QString &text, const QString &comment,
- const QString &extracomment, bool utf8, bool plural)
+ const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
+ bool utf8, bool plural)
{
TranslatorMessage msg(
transcode(context, utf8), transcode(text, utf8), transcode(comment, utf8), QString(),
yyFileName, line, QStringList(),
TranslatorMessage::Unfinished, plural);
msg.setExtraComment(transcode(extracomment.simplified(), utf8));
+ msg.setId(msgid);
+ msg.setExtras(extra);
if ((utf8 || yyForceUtf8) && !yyCodecIsUtf8 && msg.needs8Bit())
msg.setUtf8(true);
results->tor->append(msg);
@@ -1332,6 +1333,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
QString text;
QString comment;
QString extracomment;
+ QString msgid;
+ QString sourcetext;
+ TranslatorMessage::ExtraData extra;
QString prefix;
#ifdef DIAGNOSE_RETRANSLATABILITY
QString functionName;
@@ -1517,6 +1521,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
case Tok_trUtf8:
if (!results->tor)
goto case_default;
+ if (!sourcetext.isEmpty())
+ qWarning("%s:%d: //%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n",
+ qPrintable(yyFileName), yyLineNo);
utf8 = (yyTok == Tok_trUtf8);
line = yyLineNo;
yyTok = getToken();
@@ -1604,14 +1611,19 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
prefix.clear();
}
- recordMessage(line, context, text, comment, extracomment, utf8, plural);
+ recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural);
}
extracomment.clear();
+ msgid.clear();
+ extra.clear();
break;
case Tok_translateUtf8:
case Tok_translate:
if (!results->tor)
goto case_default;
+ if (!sourcetext.isEmpty())
+ qWarning("%s:%d: //%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n",
+ qPrintable(yyFileName), yyLineNo);
utf8 = (yyTok == Tok_translateUtf8);
line = yyLineNo;
yyTok = getToken();
@@ -1655,9 +1667,32 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
break;
}
}
- recordMessage(line, context, text, comment, extracomment, utf8, plural);
+ recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural);
}
extracomment.clear();
+ msgid.clear();
+ extra.clear();
+ break;
+ case Tok_trid:
+ if (!results->tor)
+ goto case_default;
+ if (!sourcetext.isEmpty()) {
+ if (!msgid.isEmpty())
+ qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n",
+ qPrintable(yyFileName), yyLineNo);
+ //utf8 = false; // Maybe use //%% or something like that
+ line = yyLineNo;
+ yyTok = getToken();
+ if (match(Tok_LeftParen) && matchString(&msgid) && !msgid.isEmpty()) {
+ bool plural = match(Tok_Comma);
+ recordMessage(line, QString(), sourcetext, QString(), extracomment,
+ msgid, extra, false, plural);
+ }
+ sourcetext.clear();
+ }
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
break;
case Tok_Q_DECLARE_TR_FUNCTIONS:
case Tok_Q_OBJECT:
@@ -1679,6 +1714,49 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
if (yyComment.startsWith(QLatin1Char(':'))) {
yyComment.remove(0, 1);
extracomment.append(yyComment);
+ } else if (yyComment.startsWith(QLatin1Char('='))) {
+ yyComment.remove(0, 1);
+ msgid = yyComment.simplified();
+ } else if (yyComment.startsWith(QLatin1Char('~'))) {
+ yyComment.remove(0, 1);
+ yyComment = yyComment.trimmed();
+ int k = yyComment.indexOf(QLatin1Char(' '));
+ if (k > -1)
+ extra.insert(yyComment.left(k), yyComment.mid(k + 1).trimmed());
+ } else if (yyComment.startsWith(QLatin1Char('%'))) {
+ int p = 1, c;
+ forever {
+ if (p >= yyComment.length())
+ break;
+ c = yyComment.unicode()[p++].unicode();
+ if (isspace(c))
+ continue;
+ if (c != '"') {
+ qWarning("%s:%d: Unexpected character in meta string\n",
+ qPrintable(yyFileName), yyLineNo);
+ break;
+ }
+ forever {
+ if (p >= yyComment.length()) {
+ whoops:
+ qWarning("%s:%d: Unterminated meta string\n",
+ qPrintable(yyFileName), yyLineNo);
+ break;
+ }
+ c = yyComment.unicode()[p++].unicode();
+ if (c == '"')
+ break;
+ if (c == '\\') {
+ if (p >= yyComment.length())
+ goto whoops;
+ c = yyComment.unicode()[p++].unicode();
+ if (c == '\n')
+ goto whoops;
+ sourcetext.append(QLatin1Char('\\'));
+ }
+ sourcetext.append(c);
+ }
+ }
} else {
comment = yyComment.simplified();
if (comment.startsWith(QLatin1String(MagicComment))) {
@@ -1689,7 +1767,11 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
} else {
context = comment.left(k);
comment.remove(0, k + 1);
- recordMessage(yyLineNo, context, QString(), comment, extracomment, false, false);
+ recordMessage(yyLineNo, context, QString(), comment, extracomment,
+ QString(), TranslatorMessage::ExtraData(), false, false);
+ extracomment.clear();
+ results->tor->setExtras(extra);
+ extra.clear();
}
}
}
@@ -1739,6 +1821,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
prospectiveContext.clear();
prefix.clear();
extracomment.clear();
+ msgid.clear();
+ extra.clear();
yyTokColonSeen = false;
yyTok = getToken();
break;
@@ -1799,7 +1883,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat
? translator.codecName() : cd.m_codecForSource;
QTextCodec *codec = QTextCodec::codecForName(codecName);
- foreach (const QString filename, filenames) {
+ foreach (const QString &filename, filenames) {
if (CppFiles::getResults(filename) || CppFiles::isBlacklisted(filename))
continue;
diff --git a/tools/linguist/lupdate/lupdate.1 b/tools/linguist/lupdate/lupdate.1
index 68958b9..b37e7b3 100644
--- a/tools/linguist/lupdate/lupdate.1
+++ b/tools/linguist/lupdate/lupdate.1
@@ -52,12 +52,12 @@ tool for the Qt GUI toolkit.
.B Lupdate
reads a qmake/tmake project file (.pro file), finds the translatable
strings in the specified source, header and interface files, and
-updates the translation files (.ts files) specified in it. The
+updates the translation files (TS files) specified in it. The
translation files are given to the translator who uses
.B Qt Linguist
to read the files and insert the translations.
.PP
-The .ts file format is a simple human-readable XML format that can be
+The TS file format is a simple human-readable XML format that can be
used with version control systems if required.
.PP
.SH OPTIONS
@@ -74,7 +74,7 @@ Default: 'ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx'.
Display the usage and exit.
.TP
.I "-locations {absolute|relative|none}"
-Specify/override how source code references are saved in ts files.
+Specify/override how source code references are saved in TS files.
Default is absolute.
.TP
.I "-no-obsolete"
@@ -84,7 +84,7 @@ Drop all obsolete strings.
Do not recursively scan the following directories.
.TP
.I "-no-sort"
-Do not sort contexts in .ts files.
+Do not sort contexts in TS files.
.TP
.I "-pluralonly"
Only include plural form messages.
@@ -97,7 +97,7 @@ file syntax but different file suffix
Recursively scan the following directories.
.TP
.I "-silent"
-Don't explain what is being done.
+Do not explain what is being done.
.TP
.I "-source-language <language>[_<region>]"
Specify/override the language of the source strings. Defaults to
@@ -139,8 +139,8 @@ translations will be reused as far as possible, and translated
strings that have vanished from the source files are marked obsolete.
.PP
.B lupdate
-can also be invoked with a list of C++ source files, .ui files
-and .ts files:
+can also be invoked with a list of C++ source files, UI files
+and TS files:
.PP
.in +4
.nf
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index 18c8932..ba5f45e 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -43,6 +43,7 @@
#include <translator.h>
#include <profileevaluator.h>
+#include <proreader.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
@@ -103,7 +104,7 @@ static void printUsage()
" -silent\n"
" Do not explain what is being done.\n"
" -no-sort\n"
- " Do not sort contexts in .ts files.\n"
+ " Do not sort contexts in TS files.\n"
" -no-recursive\n"
" Do not recursively scan the following directories.\n"
" -recursive\n"
@@ -112,10 +113,10 @@ static void printUsage()
" Additional location to look for include files.\n"
" May be specified multiple times.\n"
" -locations {absolute|relative|none}\n"
- " Specify/override how source code references are saved in ts files.\n"
+ " Specify/override how source code references are saved in TS files.\n"
" Default is absolute.\n"
" -no-ui-lines\n"
- " Do not record line numbers in references to .ui files.\n"
+ " Do not record line numbers in references to UI files.\n"
" -disable-heuristic {sametext|similartext|number}\n"
" Disable the named merge heuristic. Can be specified multiple times.\n"
" -pro <filename>\n"
@@ -182,9 +183,10 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil
if (options & Verbose)
printOut(QObject::tr("Updating '%1'...\n").arg(fn));
+ UpdateOptions theseOptions = options;
if (tor.locationsType() == Translator::NoLocations) // Could be set from file
- options |= NoLocations;
- Translator out = merge(tor, fetchedTor, options, err);
+ theseOptions |= NoLocations;
+ Translator out = merge(tor, fetchedTor, theseOptions, err);
if (!codecForTr.isEmpty())
out.setCodecName(codecForTr);
@@ -487,7 +489,7 @@ int main(int argc, char **argv)
cd.m_includePath += visitor.values(QLatin1String("INCLUDEPATH"));
- evaluateProFile(visitor, &variables);
+ evaluateProFile(visitor, &variables, pfi.absolutePath());
sourceFiles = variables.value("SOURCES");
diff --git a/tools/linguist/phrasebooks/french.qph b/tools/linguist/phrasebooks/french.qph
index f244013..d38da5a 100644
--- a/tools/linguist/phrasebooks/french.qph
+++ b/tools/linguist/phrasebooks/french.qph
@@ -1,4 +1,5 @@
-<!DOCTYPE QPH><QPH language="fr">
+<!DOCTYPE QPH>
+<QPH language="fr">
<phrase>
<source>About</source>
<target>A propos</target>
@@ -1101,4 +1102,228 @@
<source>Yes</source>
<target>Oui</target>
</phrase>
+<phrase>
+ <source>Split</source>
+ <target>Scinder</target>
+</phrase>
+<phrase>
+ <source>&amp;Edit</source>
+ <target>&amp;Édition</target>
+</phrase>
+<phrase>
+ <source>&amp;Redo</source>
+ <target>Re&amp;faire</target>
+</phrase>
+<phrase>
+ <source>debugger</source>
+ <target>débogueur</target>
+</phrase>
+<phrase>
+ <source>Start Debugger</source>
+ <target>Lancer le débogueur</target>
+</phrase>
+<phrase>
+ <source>Executable:</source>
+ <target>Exécutable:</target>
+</phrase>
+<phrase>
+ <source>Filter:</source>
+ <target>Filtre:</target>
+</phrase>
+<phrase>
+ <source>Clear</source>
+ <target>Effacer</target>
+</phrase>
+<phrase>
+ <source>Host and port:</source>
+ <target>Hôte et port:</target>
+</phrase>
+<phrase>
+ <source>Architecture:</source>
+ <target>Architecture:</target>
+</phrase>
+<phrase>
+ <source>Server start script:</source>
+ <target>Script de démarrage du serveur:</target>
+</phrase>
+<phrase>
+ <source>&amp;Undo</source>
+ <target>Annu&amp;ler</target>
+</phrase>
+<phrase>
+ <source>Add Bookmark</source>
+ <target>Ajouter un signet</target>
+</phrase>
+<phrase>
+ <source>Bookmark:</source>
+ <target>Signet:</target>
+</phrase>
+<phrase>
+ <source>Add in Folder:</source>
+ <target>Ajouter dans le dossier:</target>
+</phrase>
+<phrase>
+ <source>+</source>
+ <target>+</target>
+</phrase>
+<phrase>
+ <source>New Folder</source>
+ <target>Nouveau dossier</target>
+</phrase>
+<phrase>
+ <source>Bookmarks</source>
+ <target>Signets</target>
+</phrase>
+<phrase>
+ <source>Rename Folder</source>
+ <target>Renommer le dossier</target>
+</phrase>
+<phrase>
+ <source>Bookmark</source>
+ <target>Signet</target>
+</phrase>
+<phrase>
+ <source>Remove</source>
+ <target>Retirer</target>
+</phrase>
+<phrase>
+ <source>Delete Folder</source>
+ <target>Supprimer le dossier</target>
+</phrase>
+<phrase>
+ <source>Add</source>
+ <target>Ajouter</target>
+</phrase>
+<phrase>
+ <source>Move Up</source>
+ <target>Vers le Haut</target>
+</phrase>
+<phrase>
+ <source>Move Down</source>
+ <target>Vers le Bas</target>
+</phrase>
+<phrase>
+ <source>Show Bookmark</source>
+ <target>Afficher le signet</target>
+</phrase>
+<phrase>
+ <source>Show Bookmark in New Tab</source>
+ <target>Afficher le signet dans un nouvel onglet</target>
+</phrase>
+<phrase>
+ <source>Delete Bookmark</source>
+ <target>Supprimer le signet</target>
+</phrase>
+<phrase>
+ <source>Rename Bookmark</source>
+ <target>Renommer le signet</target>
+</phrase>
+<phrase>
+ <source>Previous Bookmark</source>
+ <target>Signet précédent</target>
+</phrase>
+<phrase>
+ <source>Next Bookmark</source>
+ <target>Signet suivant</target>
+</phrase>
+<phrase>
+ <source>Condition:</source>
+ <target>Condition:</target>
+</phrase>
+<phrase>
+ <source>Working Directory:</source>
+ <target>Répertoire de travail:</target>
+</phrase>
+<phrase>
+ <source>Environment</source>
+ <target>Environnement</target>
+</phrase>
+<phrase>
+ <source>Arguments</source>
+ <target>Arguments</target>
+</phrase>
+<phrase>
+ <source>Build directory:</source>
+ <target>Répertoire de compilation:</target>
+</phrase>
+<phrase>
+ <source>Path:</source>
+ <target>Chemin:</target>
+</phrase>
+<phrase>
+ <source>General</source>
+ <target>Général</target>
+</phrase>
+<phrase>
+ <source>Username:</source>
+ <target>Nom d&apos;utilisateur:</target>
+</phrase>
+<phrase>
+ <source>User interface</source>
+ <target>Interface utilisateur</target>
+</phrase>
+<phrase>
+ <source>Open Link</source>
+ <target>Ouvrir le lien</target>
+</phrase>
+<phrase>
+ <source> [read only]</source>
+ <target> [lecture seule]</target>
+</phrase>
+<phrase>
+ <source> [directory]</source>
+ <target> [répertoire]</target>
+</phrase>
+<phrase>
+ <source>Close All</source>
+ <target>Fermer tout</target>
+</phrase>
+<phrase>
+ <source>Failed!</source>
+ <target>Échec!</target>
+</phrase>
+<phrase>
+ <source>Proceed</source>
+ <target>Continuer</target>
+</phrase>
+<phrase>
+ <source>Make writable</source>
+ <target>Rendre inscriptible</target>
+</phrase>
+<phrase>
+ <source>Qt Creator</source>
+ <target>Qt Creator</target>
+</phrase>
+<phrase>
+ <source>&amp;File</source>
+ <target>&amp;Fichier</target>
+</phrase>
+<phrase>
+ <source>Activate %1</source>
+ <target>Activer %1</target>
+</phrase>
+<phrase>
+ <source>New Project</source>
+ <target>Nouveau projet</target>
+</phrase>
+<phrase>
+ <source>Close %1</source>
+ <target>Fermer %1</target>
+</phrase>
+<phrase>
+ <source>*</source>
+ <target>*</target>
+</phrase>
+<phrase>
+ <source>&amp;Change</source>
+ <target>&amp;Modifier</target>
+</phrase>
+<phrase>
+ <source>Close Other Editors</source>
+ <target>Fermer les autres éditeurs</target>
+</phrase>
+<phrase>
+ <source>Close All Except %1</source>
+ <target>Fermer tout sauf %1</target>
+</phrase>
</QPH>
diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph
index 629c60b..69af041 100644
--- a/tools/linguist/phrasebooks/russian.qph
+++ b/tools/linguist/phrasebooks/russian.qph
@@ -10,7 +10,7 @@
</phrase>
<phrase>
<source>accessibility</source>
- <target>удобство</target>
+ <target>специальные возможности</target>
</phrase>
<phrase>
<source>action handle</source>
@@ -345,8 +345,8 @@
<target>активная зона</target>
</phrase>
<phrase>
- <source>icon</source>
- <target>пиктограмма</target>
+ <source>Icon</source>
+ <target>Значок</target>
</phrase>
<phrase>
<source>inactive</source>
@@ -402,7 +402,7 @@
</phrase>
<phrase>
<source>list view</source>
- <target>древовидный список</target>
+ <target>список</target>
</phrase>
<phrase>
<source>manual link</source>
@@ -901,10 +901,6 @@
<target>панель инструментов</target>
</phrase>
<phrase>
- <source>tooltip</source>
- <target>всплывающая подсказка</target>
-</phrase>
-<phrase>
<source>tree view control</source>
<target>древовидный список</target>
</phrase>
@@ -1054,10 +1050,46 @@
</phrase>
<phrase>
<source>Case Sensitive</source>
- <target>Регистрозависимо</target>
+ <target>Учитывать регистр</target>
</phrase>
<phrase>
<source>Whole words</source>
- <target>Слова полностью</target>
+ <target>Слова целиком</target>
+</phrase>
+<phrase>
+ <source>Find Next</source>
+ <target>Найти следующее</target>
+</phrase>
+<phrase>
+ <source>Find Previous</source>
+ <target>Найти предыдущее</target>
+</phrase>
+<phrase>
+ <source>Case Sensitive</source>
+ <target>Учитывать регистр символов</target>
+</phrase>
+<phrase>
+ <source>Whole words only</source>
+ <target>Только слова целиком</target>
+</phrase>
+<phrase>
+ <source>Subwindow</source>
+ <target>Дочернее окно</target>
+</phrase>
+<phrase>
+ <source>Next</source>
+ <target>Далее</target>
+</phrase>
+<phrase>
+ <source>tree view</source>
+ <target>древовидный список</target>
+</phrase>
+<phrase>
+ <source>ToolTip</source>
+ <target>Подсказка</target>
+</phrase>
+<phrase>
+ <source>Checkable</source>
+ <target>Переключаемое</target>
</phrase>
</QPH>
diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp
index cb943be..e22aa7d 100644
--- a/tools/linguist/shared/po.cpp
+++ b/tools/linguist/shared/po.cpp
@@ -395,7 +395,10 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
const QString prefix = QLatin1String(isObsolete ? "#~ " : "");
while (true) {
int idx = line.indexOf(QLatin1Char(' '), prefix.length());
- item.msgStr.append(slurpEscapedString(lines, l, idx, prefix, cd));
+ QString str = slurpEscapedString(lines, l, idx, prefix, cd);
+ str.replace(QChar(Translator::TextVariantSeparator),
+ QChar(Translator::BinaryVariantSeparator));
+ item.msgStr.append(str);
if (l + 1 >= lines.size() || !isTranslationLine(lines.at(l + 1)))
break;
++l;
@@ -635,8 +638,11 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd)
out << poEscapedString(prefix, QLatin1String("msgid_plural"), noWrap, plural);
QStringList translations = translator.normalizedTranslations(msg, cd, &ok);
for (int i = 0; i != translations.size(); ++i) {
+ QString str = translations.at(i);
+ str.replace(QChar(Translator::BinaryVariantSeparator),
+ QChar(Translator::TextVariantSeparator));
out << poEscapedString(prefix, QString::fromLatin1("msgstr[%1]").arg(i), noWrap,
- translations.at(i));
+ str);
}
}
first = false;
diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp
index ef59543..0ce27af 100644
--- a/tools/linguist/shared/profileevaluator.cpp
+++ b/tools/linguist/shared/profileevaluator.cpp
@@ -68,8 +68,10 @@
#ifdef Q_OS_WIN32
#define QT_POPEN _popen
+#define QT_PCLOSE _pclose
#else
#define QT_POPEN popen
+#define QT_PCLOSE pclose
#endif
QT_BEGIN_NAMESPACE
@@ -188,9 +190,6 @@ public:
QString propertyValue(const QString &val) const;
bool isActiveConfig(const QString &config, bool regex = false);
- QStringList expandPattern(const QString &pattern);
- void expandPatternHelper(const QString &relName, const QString &absName,
- QStringList &sources_out);
QStringList expandVariableReferences(const QString &value);
QStringList evaluateExpandFunction(const QString &function, const QString &arguments);
QString format(const char *format) const;
@@ -761,29 +760,6 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
m_prevLineNo = m_lineNo;
m_prevProFile = currentProFile();
- // The following two blocks fix bug 180128 by making all "interesting"
- // file name absolute in each .pro file, not just the top most one
- if (varName == QLatin1String("SOURCES")
- || varName == QLatin1String("HEADERS")
- || varName == QLatin1String("INTERFACES")
- || varName == QLatin1String("FORMS")
- || varName == QLatin1String("FORMS3")
- || varName == QLatin1String("RESOURCES")) {
- // matches only existent files, expand certain(?) patterns
- QStringList vv;
- for (int i = v.count(); --i >= 0; )
- vv << expandPattern(v[i]);
- v = vv;
- }
-
- if (varName == QLatin1String("TRANSLATIONS")) {
- // also matches non-existent files, but does not expand pattern
- QString dir = QFileInfo(currentFileName()).absolutePath();
- dir += QLatin1Char('/');
- for (int i = v.count(); --i >= 0; )
- v[i] = QFileInfo(dir, v[i]).absoluteFilePath();
- }
-
switch (m_variableOperator) {
case ProVariable::SetOperator: // =
if (!m_cumulative) {
@@ -1513,6 +1489,8 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
output += QLatin1String(buff);
}
ret += split_value_list(output);
+ if (proc)
+ QT_PCLOSE(proc);
}
}
break;
@@ -1949,9 +1927,9 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName,
ret = QLatin1String("Windows");
} else if (type == QLatin1String("name")) {
DWORD name_length = 1024;
- TCHAR name[1024];
+ wchar_t name[1024];
if (GetComputerName(name, &name_length))
- ret = QString::fromUtf16((ushort*)name, name_length);
+ ret = QString::fromWCharArray(name);
} else if (type == QLatin1String("version") || type == QLatin1String("version_string")) {
QSysInfo::WinVersion ver = QSysInfo::WindowsVersion;
if (type == QLatin1String("version"))
@@ -2067,7 +2045,7 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName, bool *resu
ProFile *pro = q->parsedProFile(fileName);
if (pro) {
m_profileStack.push(pro);
- ok = (currentProFile() ? pro->Accept(this) : false);
+ ok = pro->Accept(this);
m_profileStack.pop();
q->releaseParsedProFile(pro);
@@ -2077,16 +2055,6 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName, bool *resu
if (result)
*result = false;
}
-/* if (ok && readFeatures) {
- QStringList configs = values("CONFIG");
- QSet<QString> processed;
- foreach (const QString &fn, configs) {
- if (!processed.contains(fn)) {
- processed.insert(fn);
- evaluateFeatureFile(fn, 0);
- }
- }
- } */
return ok;
}
@@ -2115,82 +2083,6 @@ bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName, boo
return ok;
}
-void ProFileEvaluator::Private::expandPatternHelper(const QString &relName, const QString &absName,
- QStringList &sources_out)
-{
- const QStringList vpaths = values(QLatin1String("VPATH"))
- + values(QLatin1String("QMAKE_ABSOLUTE_SOURCE_PATH"))
- + values(QLatin1String("DEPENDPATH"))
- + values(QLatin1String("VPATH_SOURCES"));
-
- QFileInfo fi(absName);
- bool found = fi.exists();
- // Search in all vpaths
- if (!found) {
- foreach (const QString &vpath, vpaths) {
- fi.setFile(vpath + QDir::separator() + relName);
- if (fi.exists()) {
- found = true;
- break;
- }
- }
- }
-
- if (found) {
- sources_out += fi.absoluteFilePath(); // Not resolving symlinks
- } else {
- QString val = relName;
- QString dir;
- QString wildcard = val;
- QString real_dir;
- if (wildcard.lastIndexOf(QLatin1Char('/')) != -1) {
- dir = wildcard.left(wildcard.lastIndexOf(QLatin1Char('/')) + 1);
- real_dir = dir;
- wildcard = wildcard.right(wildcard.length() - dir.length());
- }
-
- if (real_dir.isEmpty() || QFileInfo(real_dir).exists()) {
- QStringList files = QDir(real_dir).entryList(QStringList(wildcard));
- if (files.isEmpty()) {
- q->logMessage(format("Failure to find %1").arg(val));
- } else {
- QString a;
- for (int i = files.count() - 1; i >= 0; --i) {
- if (files[i] == QLatin1String(".") || files[i] == QLatin1String(".."))
- continue;
- a = dir + files[i];
- sources_out += a;
- }
- }
- } else {
- q->logMessage(format("Cannot match %1/%2, as %3 does not exist.")
- .arg(real_dir).arg(wildcard).arg(real_dir));
- }
- }
-}
-
-
-/*
- * Lookup of files are done in this order:
- * 1. look in pwd
- * 2. look in vpaths
- * 3. expand wild card files relative from the profiles folder
- **/
-
-// FIXME: This code supports something that I'd consider a flaw in .pro file syntax
-// which is not even documented. So arguably this can be ditched completely...
-QStringList ProFileEvaluator::Private::expandPattern(const QString& pattern)
-{
- if (!currentProFile())
- return QStringList();
-
- QStringList sources_out;
- const QString absName = QDir::cleanPath(QDir::current().absoluteFilePath(pattern));
-
- expandPatternHelper(pattern, absName, sources_out);
- return sources_out;
-}
-
QString ProFileEvaluator::Private::format(const char *fmt) const
{
ProFile *pro = currentProFile();
@@ -2241,6 +2133,59 @@ QStringList ProFileEvaluator::values(const QString &variableName, const ProFile
return fixEnvVariables(d->values(variableName, pro));
}
+QStringList ProFileEvaluator::absolutePathValues(
+ const QString &variable, const QString &baseDirectory) const
+{
+ QStringList result;
+ foreach (const QString &el, values(variable)) {
+ const QFileInfo info = QFileInfo(baseDirectory, el);
+ if (info.isDir())
+ result << QDir::cleanPath(info.absoluteFilePath());
+ }
+ return result;
+}
+
+QStringList ProFileEvaluator::absoluteFileValues(
+ const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,
+ const ProFile *pro) const
+{
+ QStringList result;
+ foreach (const QString &el, pro ? values(variable, pro) : values(variable)) {
+ QFileInfo info(el);
+ if (info.isAbsolute()) {
+ if (info.exists()) {
+ result << QDir::cleanPath(el);
+ goto next;
+ }
+ } else {
+ foreach (const QString &dir, searchDirs) {
+ QFileInfo info(dir, el);
+ if (info.isFile()) {
+ result << QDir::cleanPath(info.filePath());
+ goto next;
+ }
+ }
+ if (baseDirectory.isEmpty())
+ goto next;
+ info = QFileInfo(baseDirectory, el);
+ }
+ {
+ QFileInfo baseInfo(info.absolutePath());
+ if (baseInfo.exists()) {
+ QString wildcard = info.fileName();
+ if (wildcard.contains(QLatin1Char('*')) || wildcard.contains(QLatin1Char('?'))) {
+ QDir theDir(QDir::cleanPath(baseInfo.filePath()));
+ foreach (const QString &fn, theDir.entryList(QStringList(wildcard)))
+ if (fn != QLatin1String(".") && fn != QLatin1String(".."))
+ result << theDir.absoluteFilePath(fn);
+ }
+ }
+ }
+ next: ;
+ }
+ return result;
+}
+
ProFileEvaluator::TemplateType ProFileEvaluator::templateType()
{
QStringList templ = values(QLatin1String("TEMPLATE"));
@@ -2327,64 +2272,4 @@ void ProFileEvaluator::setOutputDir(const QString &dir)
d->m_outputDir = dir;
}
-void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap)
-{
- QStringList sourceFiles;
- QString codecForTr;
- QString codecForSource;
- QStringList tsFileNames;
-
- // app/lib template
- sourceFiles += visitor.values(QLatin1String("SOURCES"));
- sourceFiles += visitor.values(QLatin1String("HEADERS"));
- tsFileNames = visitor.values(QLatin1String("TRANSLATIONS"));
-
- QStringList trcodec = visitor.values(QLatin1String("CODEC"))
- + visitor.values(QLatin1String("DEFAULTCODEC"))
- + visitor.values(QLatin1String("CODECFORTR"));
- if (!trcodec.isEmpty())
- codecForTr = trcodec.last();
-
- QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC"));
- if (!srccodec.isEmpty())
- codecForSource = srccodec.last();
-
- QStringList forms = visitor.values(QLatin1String("INTERFACES"))
- + visitor.values(QLatin1String("FORMS"))
- + visitor.values(QLatin1String("FORMS3"));
- sourceFiles << forms;
-
- sourceFiles.sort();
- sourceFiles.removeDuplicates();
- tsFileNames.sort();
- tsFileNames.removeDuplicates();
-
- varMap->insert("SOURCES", sourceFiles);
- varMap->insert("CODECFORTR", QStringList() << codecForTr);
- varMap->insert("CODECFORSRC", QStringList() << codecForSource);
- varMap->insert("TRANSLATIONS", tsFileNames);
-}
-
-bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap)
-{
- QFileInfo fi(fileName);
- if (!fi.exists())
- return false;
-
- ProFile pro(fi.absoluteFilePath());
-
- ProFileEvaluator visitor;
- visitor.setVerbose(verbose);
-
- if (!visitor.queryProFile(&pro))
- return false;
-
- if (!visitor.accept(&pro))
- return false;
-
- evaluateProFile(visitor, varMap);
-
- return true;
-}
-
QT_END_NAMESPACE
diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h
index 69f47f5..688022b 100644
--- a/tools/linguist/shared/profileevaluator.h
+++ b/tools/linguist/shared/profileevaluator.h
@@ -52,12 +52,6 @@
QT_BEGIN_NAMESPACE
-class ProFile;
-class ProFileEvaluator;
-
-void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap);
-bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap);
-
class ProFileEvaluator
{
public:
@@ -85,6 +79,10 @@ public:
void addProperties(const QHash<QString, QString> &properties);
QStringList values(const QString &variableName) const;
QStringList values(const QString &variableName, const ProFile *pro) const;
+ QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const;
+ QStringList absoluteFileValues(
+ const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,
+ const ProFile *pro) const;
QString propertyValue(const QString &val) const;
// for our descendents
diff --git a/tools/linguist/shared/proparser.pri b/tools/linguist/shared/proparser.pri
index 372247e..99d32e7 100644
--- a/tools/linguist/shared/proparser.pri
+++ b/tools/linguist/shared/proparser.pri
@@ -2,11 +2,13 @@
INCLUDEPATH *= $$PWD
HEADERS += \
+ $$PWD/proreader.h \
$$PWD/abstractproitemvisitor.h \
$$PWD/proitems.h \
$$PWD/profileevaluator.h \
$$PWD/proparserutils.h
SOURCES += \
+ $$PWD/proreader.cpp \
$$PWD/proitems.cpp \
$$PWD/profileevaluator.cpp
diff --git a/tools/linguist/shared/proreader.cpp b/tools/linguist/shared/proreader.cpp
new file mode 100644
index 0000000..3400f20
--- /dev/null
+++ b/tools/linguist/shared/proreader.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Linguist of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "profileevaluator.h"
+
+#include <QtCore/QDir>
+#include <QtCore/QFileInfo>
+
+QT_BEGIN_NAMESPACE
+
+static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths,
+ const QString &projectDir, const ProFileEvaluator &visitor)
+{
+ QStringList vPaths =
+ visitor.absolutePathValues(QLatin1String(vvar), projectDir);
+ vPaths += baseVPaths;
+ vPaths.removeDuplicates();
+ return visitor.absoluteFileValues(QLatin1String(var), projectDir, vPaths, 0);
+}
+
+void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap,
+ const QString &projectDir)
+{
+ QStringList baseVPaths;
+ baseVPaths += visitor.absolutePathValues(QLatin1String("VPATH"), projectDir);
+ baseVPaths << projectDir; // QMAKE_ABSOLUTE_SOURCE_PATH
+ baseVPaths += visitor.absolutePathValues(QLatin1String("DEPENDPATH"), projectDir);
+ baseVPaths.removeDuplicates();
+
+ QStringList sourceFiles;
+ QString codecForTr;
+ QString codecForSource;
+ QStringList tsFileNames;
+
+ // app/lib template
+ sourceFiles += getSources("SOURCES", "VPATH_SOURCES", baseVPaths, projectDir, visitor);
+
+ sourceFiles += getSources("FORMS", "VPATH_FORMS", baseVPaths, projectDir, visitor);
+ sourceFiles += getSources("FORMS3", "VPATH_FORMS3", baseVPaths, projectDir, visitor);
+
+ QStringList vPathsInc = baseVPaths;
+ vPathsInc += visitor.absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir);
+ vPathsInc.removeDuplicates();
+ sourceFiles += visitor.absoluteFileValues(QLatin1String("HEADERS"), projectDir, vPathsInc, 0);
+
+ QDir proDir(projectDir);
+ foreach (const QString &tsFile, visitor.values(QLatin1String("TRANSLATIONS")))
+ tsFileNames << QFileInfo(proDir, tsFile).filePath();
+
+ QStringList trcodec = visitor.values(QLatin1String("CODEC"))
+ + visitor.values(QLatin1String("DEFAULTCODEC"))
+ + visitor.values(QLatin1String("CODECFORTR"));
+ if (!trcodec.isEmpty())
+ codecForTr = trcodec.last();
+
+ QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC"));
+ if (!srccodec.isEmpty())
+ codecForSource = srccodec.last();
+
+ sourceFiles.sort();
+ sourceFiles.removeDuplicates();
+ tsFileNames.sort();
+ tsFileNames.removeDuplicates();
+
+ varMap->insert("SOURCES", sourceFiles);
+ varMap->insert("CODECFORTR", QStringList() << codecForTr);
+ varMap->insert("CODECFORSRC", QStringList() << codecForSource);
+ varMap->insert("TRANSLATIONS", tsFileNames);
+}
+
+bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap)
+{
+ QFileInfo fi(fileName);
+ if (!fi.exists())
+ return false;
+
+ ProFile pro(fi.absoluteFilePath());
+
+ ProFileEvaluator visitor;
+ visitor.setVerbose(verbose);
+
+ if (!visitor.queryProFile(&pro))
+ return false;
+
+ if (!visitor.accept(&pro))
+ return false;
+
+ evaluateProFile(visitor, varMap, fi.absolutePath());
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/tools/linguist/shared/proreader.h b/tools/linguist/shared/proreader.h
new file mode 100644
index 0000000..f663e23
--- /dev/null
+++ b/tools/linguist/shared/proreader.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Linguist of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PROREADER_H
+#define PROREADER_H
+
+#include <QtCore/QHash>
+
+QT_BEGIN_NAMESPACE
+
+class ProFileEvaluator;
+
+void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap,
+ const QString &projectDir);
+bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap);
+
+QT_END_NAMESPACE
+
+#endif // PROREADER_H
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index 323bd29..9523fde 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -173,6 +173,7 @@ public:
bool save(QIODevice *iod);
void insert(const TranslatorMessage &msg, bool forceComment);
+ void insertIdBased(const TranslatorMessage &message);
void squeeze(TranslatorSaveMode mode);
@@ -238,17 +239,13 @@ Prefix Releaser::commonPrefix(const ByteTranslatorMessage &m1, const ByteTransla
void Releaser::writeMessage(const ByteTranslatorMessage &msg, QDataStream &stream,
TranslatorSaveMode mode, Prefix prefix) const
{
- for (int i = 0; i < msg.translations().count(); ++i) {
- QString str = msg.translations().at(i);
- str.replace(QChar(Translator::DefaultVariantSeparator),
- QChar(Translator::InternalVariantSeparator));
- stream << quint8(Tag_Translation) << str;
- }
+ for (int i = 0; i < msg.translations().count(); ++i)
+ stream << quint8(Tag_Translation) << msg.translations().at(i);
if (mode == SaveEverything)
prefix = HashContextSourceTextComment;
- // lrelease produces "wrong" .qm files for QByteArrays that are .isNull().
+ // lrelease produces "wrong" QM files for QByteArrays that are .isNull().
switch (prefix) {
default:
case HashContextSourceTextComment:
@@ -440,6 +437,16 @@ void Releaser::insert(const TranslatorMessage &message, bool forceComment)
insertInternal(message, forceComment, false);
}
+void Releaser::insertIdBased(const TranslatorMessage &message)
+{
+ QStringList tlns = message.translations();
+ for (int i = 0; i < tlns.size(); ++i)
+ if (tlns.at(i).isEmpty())
+ tlns[i] = message.sourceText();
+ ByteTranslatorMessage bmsg("", originalBytes(message.id(), false), "", tlns);
+ m_messages.insert(bmsg, 0);
+}
+
void Releaser::setNumerusRules(const QByteArray &rules)
{
m_numerusRules = rules;
@@ -592,8 +599,6 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
str[i] = QChar((str.at(i).unicode() >> 8) +
((str.at(i).unicode() << 8) & 0xff00));
}
- str.replace(QChar(Translator::InternalVariantSeparator),
- QChar(Translator::DefaultVariantSeparator));
translations << str;
m += len;
break;
@@ -695,11 +700,17 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData
int finished = 0;
int unfinished = 0;
int untranslated = 0;
+ int missingIds = 0;
+ int droppedData = 0;
for (int i = 0; i != translator.messageCount(); ++i) {
const TranslatorMessage &msg = translator.message(i);
TranslatorMessage::Type typ = msg.type();
if (typ != TranslatorMessage::Obsolete) {
+ if (cd.m_idBased && msg.id().isEmpty()) {
+ ++missingIds;
+ continue;
+ }
if (typ == TranslatorMessage::Unfinished) {
if (msg.translation().isEmpty()) {
++untranslated;
@@ -712,19 +723,34 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData
} else {
++finished;
}
- // Drop the comment in (context, sourceText, comment),
- // unless the context is empty,
- // unless (context, sourceText, "") already exists or
- // unless we already dropped the comment of (context,
- // sourceText, comment0).
- bool forceComment =
- msg.comment().isEmpty()
- || msg.context().isEmpty()
- || translator.contains(msg.context(), msg.sourceText(), QString());
- releaser.insert(msg, forceComment);
+ if (cd.m_idBased) {
+ if (!msg.context().isEmpty() || !msg.comment().isEmpty())
+ ++droppedData;
+ releaser.insertIdBased(msg);
+ } else {
+ // Drop the comment in (context, sourceText, comment),
+ // unless the context is empty,
+ // unless (context, sourceText, "") already exists or
+ // unless we already dropped the comment of (context,
+ // sourceText, comment0).
+ bool forceComment =
+ msg.comment().isEmpty()
+ || msg.context().isEmpty()
+ || translator.contains(msg.context(), msg.sourceText(), QString());
+ releaser.insert(msg, forceComment);
+ }
}
}
+ if (missingIds)
+ cd.appendError(QCoreApplication::translate("LRelease",
+ "Dropped %n message(s) which had no ID.", 0,
+ QCoreApplication::CodecForTr, missingIds));
+ if (droppedData)
+ cd.appendError(QCoreApplication::translate("LRelease",
+ "Excess context/disambiguation dropped from %n message(s).", 0,
+ QCoreApplication::CodecForTr, droppedData));
+
releaser.squeeze(cd.m_saveMode);
bool saved = releaser.save(&dev);
if (saved && cd.isVerbose()) {
diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp
index 40f0386..4a29e0f 100644
--- a/tools/linguist/shared/qph.cpp
+++ b/tools/linguist/shared/qph.cpp
@@ -99,6 +99,8 @@ bool QPHReader::read(Translator &translator)
else if (m_currentField == DefinitionField)
m_currentDefinition += text();
} else if (isEndElement() && name() == QLatin1String("phrase")) {
+ m_currentTarget.replace(QChar(Translator::TextVariantSeparator),
+ QChar(Translator::BinaryVariantSeparator));
TranslatorMessage msg;
msg.setSourceText(m_currentSource);
msg.setTranslation(m_currentTarget);
@@ -159,7 +161,10 @@ static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData
foreach (const TranslatorMessage &msg, translator.messages()) {
t << "<phrase>\n";
t << " <source>" << protect(msg.sourceText()) << "</source>\n";
- t << " <target>" << protect(msg.translations().join(QLatin1String("@")))
+ QString str = msg.translations().join(QLatin1String("@"));
+ str.replace(QChar(Translator::BinaryVariantSeparator),
+ QChar(Translator::TextVariantSeparator));
+ t << " <target>" << protect(str)
<< "</target>\n";
if (!msg.context().isEmpty() || !msg.comment().isEmpty())
t << " <definition>" << msg.context() << msg.comment()
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index 2651af0..fb17fd1 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -65,6 +65,7 @@ public:
m_ignoreUnfinished(false),
m_sortContexts(false),
m_noUiLines(false),
+ m_idBased(false),
m_saveMode(SaveEverything)
{}
@@ -97,6 +98,7 @@ public:
bool m_ignoreUnfinished;
bool m_sortContexts;
bool m_noUiLines;
+ bool m_idBased;
TranslatorSaveMode m_saveMode;
};
@@ -190,9 +192,9 @@ public:
static void registerFileFormat(const FileFormat &format);
static QList<FileFormat> &registeredFileFormats();
- enum VariantSeparators {
- DefaultVariantSeparator = 0x2762, // some weird character nobody ever heard of :-D
- InternalVariantSeparator = 0x9c // unicode "STRING TERMINATOR"
+ enum {
+ TextVariantSeparator = 0x2762, // some weird character nobody ever heard of :-D
+ BinaryVariantSeparator = 0x9c // unicode "STRING TERMINATOR"
};
private:
diff --git a/tools/linguist/shared/ts.cpp b/tools/linguist/shared/ts.cpp
index 6c95dbd..3efce15 100644
--- a/tools/linguist/shared/ts.cpp
+++ b/tools/linguist/shared/ts.cpp
@@ -197,7 +197,7 @@ QString TSReader::readTransContents()
// ignore these, just whitespace
} else if (elementStarts(strlengthvariant)) {
if (!result.isEmpty())
- result += QChar(Translator::DefaultVariantSeparator);
+ result += QChar(Translator::BinaryVariantSeparator);
result += readContents();
} else {
handleError();
@@ -514,7 +514,7 @@ static void writeExtras(QTextStream &t, const char *indent,
static void writeVariants(QTextStream &t, const char *indent, const QString &input)
{
int offset;
- if ((offset = input.indexOf(QChar(Translator::DefaultVariantSeparator))) >= 0) {
+ if ((offset = input.indexOf(QChar(Translator::BinaryVariantSeparator))) >= 0) {
t << " variants=\"yes\">";
int start = 0;
forever {
@@ -524,7 +524,7 @@ static void writeVariants(QTextStream &t, const char *indent, const QString &inp
if (offset == input.length())
break;
start = offset + 1;
- offset = input.indexOf(QChar(Translator::DefaultVariantSeparator), start);
+ offset = input.indexOf(QChar(Translator::BinaryVariantSeparator), start);
if (offset < 0)
offset = input.length();
}
diff --git a/tools/linguist/shared/ts.dtd b/tools/linguist/shared/ts.dtd
index ab77f64..4d2cdeb 100644
--- a/tools/linguist/shared/ts.dtd
+++ b/tools/linguist/shared/ts.dtd
@@ -34,7 +34,7 @@
version CDATA #IMPLIED
sourcelanguage CDATA #IMPLIED
language CDATA #IMPLIED>
-<!-- The encoding to use in the .qm file by default. Default is ISO-8859-1. -->
+<!-- The encoding to use in the QM file by default. Default is ISO-8859-1. -->
<!ELEMENT defaultcodec (#PCDATA) >
<!ELEMENT context (name?, comment?, (context|message)+) >
<!ATTLIST context
@@ -54,7 +54,7 @@
<!ELEMENT message (location*, source?, oldsource?, comment?, oldcomment?, extracomment?, translatorcomment?, translation?, userdata?, extra-**) >
<!--
! If utf8 is true, the defaultcodec is overridden and the message is encoded
- ! in UTF-8 in the .qm file.
+ ! in UTF-8 in the QM file.
-->
<!ATTLIST message
id CDATA #IMPLIED
@@ -70,7 +70,7 @@
! is omitted, the "current" one is used. For the 1st location in a message,
! "current" is the filename used for the 1st location of the previous message.
! For subsequent locations, it is the filename used for the previous location.
- ! A single .ts file has either all absolute or all relative locations.
+ ! A single TS file has either all absolute or all relative locations.
-->
<!ATTLIST location
filename CDATA #IMPLIED
@@ -106,7 +106,7 @@
<!--
! The translation variants have a priority between 1 ("highest") and 9 ("lowest")
! Typically longer translations get a higher priority.
- ! If omitted, the order of appearance of the variants in the .ts files is used.
+ ! If omitted, the order of appearance of the variants in the TS files is used.
-->
<!ATTLIST lengthvariant
priority (1|2|3|4|5|6|7|8|9) #IMPLIED>
diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp
index 61e4b9f..1313172 100644
--- a/tools/linguist/shared/xliff.cpp
+++ b/tools/linguist/shared/xliff.cpp
@@ -303,6 +303,8 @@ static void writeTransUnits(QTextStream &ts, const TranslatorMessage &msg, const
QString translation;
if (transit != transend) {
translation = *transit;
+ translation.replace(QChar(Translator::BinaryVariantSeparator),
+ QChar(Translator::TextVariantSeparator));
++transit;
puttrans = true;
}
@@ -598,8 +600,11 @@ bool XLIFFHandler::endElement(const QString &namespaceURI, const QString& localN
m_sources.append(accum);
}
} else if (localName == QLatin1String("target")) {
- if (popContext(XC_restype_translation))
+ if (popContext(XC_restype_translation)) {
+ accum.replace(QChar(Translator::TextVariantSeparator),
+ QChar(Translator::BinaryVariantSeparator));
m_translations.append(accum);
+ }
} else if (localName == QLatin1String("context-group")) {
if (popContext(XC_context_group)) {
m_refs.append(TranslatorMessage::Reference(
diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
index 5d1ac32..b8b9338 100644
--- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -613,18 +613,15 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
// getter:
if (property.access != QDBusIntrospection::Property::Write) {
- hs << " inline " << type << " " << getter << "() const" << endl;
- if (type != "QVariant")
- hs << " { return qvariant_cast< " << type << " >(internalPropGet(\""
- << property.name << "\")); }" << endl;
- else
- hs << " { return internalPropGet(\"" << property.name << "\"); }" << endl;
+ hs << " inline " << type << " " << getter << "() const" << endl
+ << " { return qvariant_cast< " << type << " >(property(\""
+ << property.name << "\")); }" << endl;
}
// setter:
if (property.access != QDBusIntrospection::Property::Read) {
hs << " inline void " << setter << "(" << constRefArg(type) << "value)" << endl
- << " { internalPropSet(\"" << property.name
+ << " { setProperty(\"" << property.name
<< "\", qVariantFromValue(value)); }" << endl;
}
diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp
index 728f9fa..e95153d 100644
--- a/tools/qdoc3/codemarker.cpp
+++ b/tools/qdoc3/codemarker.cpp
@@ -331,7 +331,10 @@ QString CodeMarker::sortName(const Node *node)
return QLatin1Char('B') + nodeName;
}
-void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle style, Status status)
+void CodeMarker::insert(FastSection &fastSection,
+ Node *node,
+ SynopsisStyle style,
+ Status status)
{
bool inheritedMember = (!node->relates() &&
(node->parent() != (const InnerNode *)fastSection.innerNode));
@@ -339,12 +342,14 @@ void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle styl
if (node->access() == Node::Private) {
irrelevant = true;
- } else if (node->type() == Node::Function) {
+ }
+ else if (node->type() == Node::Function) {
FunctionNode *func = (FunctionNode *) node;
irrelevant = (inheritedMember
&& (func->metaness() == FunctionNode::Ctor ||
func->metaness() == FunctionNode::Dtor));
- } else if (node->type() == Node::Class || node->type() == Node::Enum
+ }
+ else if (node->type() == Node::Class || node->type() == Node::Enum
|| node->type() == Node::Typedef) {
irrelevant = (inheritedMember && style != SeparateList);
if (!irrelevant && style == Detailed && node->type() == Node::Typedef) {
@@ -357,9 +362,11 @@ void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle styl
if (!irrelevant) {
if (status == Compat) {
irrelevant = (node->status() != Node::Compat);
- } else if (status == Obsolete) {
+ }
+ else if (status == Obsolete) {
irrelevant = (node->status() != Node::Obsolete);
- } else {
+ }
+ else {
irrelevant = (node->status() == Node::Compat ||
node->status() == Node::Obsolete);
}
@@ -370,7 +377,8 @@ void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle styl
QString key = sortName(node);
if (!fastSection.memberMap.contains(key))
fastSection.memberMap.insert(key, node);
- } else {
+ }
+ else {
if (node->parent()->type() == Node::Class) {
if (fastSection.inherited.isEmpty()
|| fastSection.inherited.last().first != node->parent()) {
@@ -383,16 +391,42 @@ void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle styl
}
}
-void CodeMarker::append(QList<Section>& sectionList,
- const FastSection& fastSection)
+/*!
+ Returns true if \a node represents a reimplemented member function.
+ If it is, then it is inserted in the reimplemented member map in the
+ section \a fs. And, the test is only performed if \a status is \e OK.
+ Otherwise, false is returned.
+ */
+bool CodeMarker::insertReimpFunc(FastSection& fs, Node* node, Status status)
+{
+ if (node->access() == Node::Private)
+ return false;
+
+ const FunctionNode* fn = static_cast<const FunctionNode*>(node);
+ if ((fn->reimplementedFrom() != 0) && (status == Okay)) {
+ bool inherited = (!fn->relates() && (fn->parent() != (const InnerNode*)fs.innerNode));
+ if (!inherited) {
+ QString key = sortName(fn);
+ if (!fs.reimpMemberMap.contains(key)) {
+ fs.reimpMemberMap.insert(key,node);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+/*!
+ If \a fs is not empty, convert it to a Section and append
+ the new Section to \a sectionList.
+ */
+void CodeMarker::append(QList<Section>& sectionList, const FastSection& fs)
{
- if (!fastSection.memberMap.isEmpty() ||
- !fastSection.inherited.isEmpty()) {
- Section section(fastSection.name,
- fastSection.singularMember,
- fastSection.pluralMember);
- section.members = fastSection.memberMap.values();
- section.inherited = fastSection.inherited;
+ if (!fs.isEmpty()) {
+ Section section(fs.name,fs.singularMember,fs.pluralMember);
+ section.members = fs.memberMap.values();
+ section.reimpMembers = fs.reimpMemberMap.values();
+ section.inherited = fs.inherited;
sectionList.append(section);
}
}
diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h
index 483dc4d..67b1064 100644
--- a/tools/qdoc3/codemarker.h
+++ b/tools/qdoc3/codemarker.h
@@ -61,6 +61,7 @@ struct Section
QString singularMember;
QString pluralMember;
NodeList members;
+ NodeList reimpMembers;
QList<QPair<ClassNode *, int> > inherited;
Section() { }
@@ -79,6 +80,7 @@ struct FastSection
QString singularMember;
QString pluralMember;
QMap<QString, Node *> memberMap;
+ QMap<QString, Node *> reimpMemberMap;
QList<QPair<ClassNode *, int> > inherited;
FastSection(const InnerNode *innerNode0,
@@ -89,6 +91,11 @@ struct FastSection
name(name0),
singularMember(singularMember0),
pluralMember(pluralMember0) { }
+ bool isEmpty() const {
+ return (memberMap.isEmpty() && inherited.isEmpty() &&
+ reimpMemberMap.isEmpty());
+ }
+
};
class CodeMarker
@@ -150,6 +157,7 @@ class CodeMarker
Node *node,
SynopsisStyle style,
Status status);
+ bool insertReimpFunc(FastSection& fs, Node* node, Status status);
void append(QList<Section>& sectionList, const FastSection& fastSection);
private:
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index 6760c65..f807609 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -43,6 +43,7 @@
cppcodemarker.cpp
*/
+#include <qdebug.h>
#include "atom.h"
#include "cppcodemarker.h"
#include "node.h"
@@ -411,6 +412,21 @@ QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */)
return "^\\}$";
}
+#if 0
+ FastSection privateReimpFuncs(classe,
+ "Private Reimplemented Functions",
+ "private reimplemented function",
+ "private reimplemented functions");
+ FastSection protectedReimpFuncs(classe,
+ "Protected Reimplemented Functions",
+ "protected reimplemented function",
+ "protected reimplemented functions");
+ FastSection publicReimpFuncs(classe,
+ "Public Reimplemented Functions",
+ "public reimplemented function",
+ "public reimplemented functions");
+#endif
+
QList<Section> CppCodeMarker::sections(const InnerNode *inner,
SynopsisStyle style,
Status status)
@@ -421,29 +437,55 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
const ClassNode *classe = static_cast<const ClassNode *>(inner);
if (style == Summary) {
- FastSection privateFunctions(classe, "Private Functions", "private function",
+ FastSection privateFunctions(classe,
+ "Private Functions",
+ "private function",
"private functions");
FastSection privateSlots(classe, "Private Slots", "private slot", "private slots");
FastSection privateTypes(classe, "Private Types", "private type", "private types");
- FastSection protectedFunctions(classe, "Protected Functions", "protected function",
+ FastSection protectedFunctions(classe,
+ "Protected Functions",
+ "protected function",
"protected functions");
- FastSection protectedSlots(classe, "Protected Slots", "protected slot", "protected slots");
- FastSection protectedTypes(classe, "Protected Types", "protected type", "protected types");
- FastSection protectedVariables(classe, "Protected Variables", "protected type", "protected variables");
- FastSection publicFunctions(classe, "Public Functions", "public function",
- "public functions");
+ FastSection protectedSlots(classe,
+ "Protected Slots",
+ "protected slot",
+ "protected slots");
+ FastSection protectedTypes(classe,
+ "Protected Types",
+ "protected type",
+ "protected types");
+ FastSection protectedVariables(classe,
+ "Protected Variables",
+ "protected type",
+ "protected variables");
+ FastSection publicFunctions(classe,
+ "Public Functions",
+ "public function",
+ "public functions");
FastSection publicSignals(classe, "Signals", "signal", "signals");
FastSection publicSlots(classe, "Public Slots", "public slot", "public slots");
FastSection publicTypes(classe, "Public Types", "public type", "public types");
- FastSection publicVariables(classe, "Public Variables", "public type", "public variables");
+ FastSection publicVariables(classe,
+ "Public Variables",
+ "public type",
+ "public variables");
FastSection properties(classe, "Properties", "property", "properties");
- FastSection relatedNonMembers(classe, "Related Non-Members", "related non-member",
+ FastSection relatedNonMembers(classe,
+ "Related Non-Members",
+ "related non-member",
"related non-members");
- FastSection staticPrivateMembers(classe, "Static Private Members", "static private member",
+ FastSection staticPrivateMembers(classe,
+ "Static Private Members",
+ "static private member",
"static private members");
- FastSection staticProtectedMembers(classe, "Static Protected Members",
- "static protected member", "static protected members");
- FastSection staticPublicMembers(classe, "Static Public Members", "static public member",
+ FastSection staticProtectedMembers(classe,
+ "Static Protected Members",
+ "static protected member",
+ "static protected members");
+ FastSection staticPublicMembers(classe,
+ "Static Public Members",
+ "static public member",
"static public members");
FastSection macros(inner, "Macros", "macro", "macros");
@@ -505,7 +547,8 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
insert(publicVariables, *c, style, status);
}
else if ((*c)->type() == Node::Function) {
- insert(publicFunctions, *c, style, status);
+ if (!insertReimpFunc(publicFunctions,*c,status))
+ insert(publicFunctions, *c, style, status);
}
else {
insert(publicTypes, *c, style, status);
@@ -525,7 +568,8 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
insert(protectedVariables, *c, style, status);
}
else if ((*c)->type() == Node::Function) {
- insert(protectedFunctions, *c, style, status);
+ if (!insertReimpFunc(protectedFunctions,*c,status))
+ insert(protectedFunctions, *c, style, status);
}
else {
insert(protectedTypes, *c, style, status);
@@ -541,7 +585,8 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
insert(staticPrivateMembers, *c, style, status);
}
else if ((*c)->type() == Node::Function) {
- insert(privateFunctions, *c, style, status);
+ if (!insertReimpFunc(privateFunctions,*c,status))
+ insert(privateFunctions, *c, style, status);
}
else {
insert(privateTypes, *c, style, status);
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index a7d6ae7..cb6caa9 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -739,8 +739,12 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
// Note: Setting the access to Private hides the documentation,
// but setting the status to Internal makes the node available
// in the XML output when the WebXMLGenerator is used.
+#if 0
+ // Reimplemented functions now reported in separate sections.
func->setAccess(Node::Private);
func->setStatus(Node::Internal);
+#endif
+ func->setReimp(true);
}
else {
doc.location().warning(tr("Ignored '\\%1' in %2")
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 222b9a1..d5aca0e 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -1677,10 +1677,13 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd)
leavePara();
if (currentSectioningUnit == Doc::Book) {
+#if 0
+ // mws didn't think this was necessary.
if (unit > Doc::Section1)
location().warning(tr("Unexpected '\\%1' without '\\%2'")
.arg(cmdName(cmd))
.arg(cmdName(CMD_SECTION1)));
+#endif
currentSectioningUnit = (Doc::SectioningUnit) (unit - 1);
priv->constructExtra();
priv->extra->sectioningUnit = currentSectioningUnit;
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 3652071..e97b7f2 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -44,7 +44,7 @@
*/
#include <qdir.h>
-
+#include <qdebug.h>
#include "codemarker.h"
#include "config.h"
#include "doc.h"
@@ -68,10 +68,12 @@ QStringList Generator::imageDirs;
QString Generator::outDir;
QString Generator::project;
-static Text stockLink(const QString &target)
+static void singularPlural(Text& text, const NodeList& nodes)
{
- return Text() << Atom(Atom::Link, target) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << target << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ if (nodes.count() == 1)
+ text << " is";
+ else
+ text << " are";
}
Generator::Generator()
@@ -241,7 +243,7 @@ void Generator::generateFakeNode(const FakeNode * /* fake */,
{
}
-void Generator::generateText(const Text& text,
+bool Generator::generateText(const Text& text,
const Node *relative,
CodeMarker *marker)
{
@@ -254,31 +256,35 @@ void Generator::generateText(const Text& text,
true,
numAtoms);
endText(relative, marker);
+ return true;
}
+ return false;
}
#ifdef QDOC_QML
-void Generator::generateQmlText(const Text& text,
+bool Generator::generateQmlText(const Text& text,
const Node *relative,
CodeMarker *marker)
{
- if (text.firstAtom() != 0) {
- startText(relative, marker);
- const Atom *atom = text.firstAtom();
- while (atom) {
- if (atom->type() != Atom::QmlText)
- atom = atom->next();
- else {
- atom = atom->next();
- while (atom && (atom->type() != Atom::EndQmlText)) {
- int n = 1 + generateAtom(atom, relative, marker);
- while (n-- > 0)
- atom = atom->next();
- }
+ const Atom* atom = text.firstAtom();
+ if (atom == 0)
+ return false;
+
+ startText(relative, marker);
+ while (atom) {
+ if (atom->type() != Atom::QmlText)
+ atom = atom->next();
+ else {
+ atom = atom->next();
+ while (atom && (atom->type() != Atom::EndQmlText)) {
+ int n = 1 + generateAtom(atom, relative, marker);
+ while (n-- > 0)
+ atom = atom->next();
}
}
- endText(relative, marker);
}
+ endText(relative, marker);
+ return true;
}
#endif
@@ -302,12 +308,20 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
if (node->doc().isEmpty()) {
- if (!quiet) // ### might be unnecessary
+ if (!quiet && !node->isReimp()) // ### might be unnecessary
node->location().warning(tr("No documentation for '%1'")
.arg(marker->plainFullName(node)));
}
else {
- generateText(node->doc().body(), node, marker);
+ if (node->type() == Node::Function) {
+ const FunctionNode *func = static_cast<const FunctionNode *>(node);
+ if (func->reimplementedFrom() != 0)
+ generateReimplementedFrom(func, marker);
+ }
+
+ if (!generateText(node->doc().body(), node, marker))
+ if (node->isReimp())
+ return;
if (node->type() == Node::Enum) {
const EnumNode *enume = (const EnumNode *) node;
@@ -345,7 +359,6 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
else if (node->type() == Node::Function) {
const FunctionNode *func = static_cast<const FunctionNode *>(node);
-
QSet<QString> definedParams;
QList<Parameter>::ConstIterator p = func->parameters().begin();
while (p != func->parameters().end()) {
@@ -390,7 +403,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
}
}
- if (needWarning)
+ if (needWarning && !func->isReimp())
node->doc().location().warning(
tr("Undocumented parameter '%1' in %2").arg(*a).arg(marker->plainFullName(node)));
}
@@ -404,9 +417,11 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (!body.contains("return", Qt::CaseInsensitive))
node->doc().location().warning(tr("Undocumented return value"));
}
-
+#if 0
+ // Now we put this at the top, before the other text.
if (func->reimplementedFrom() != 0)
generateReimplementedFrom(func, marker);
+#endif
}
}
@@ -762,64 +777,138 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
{
Text text;
Text theStockLink;
- Node::ThreadSafeness parent = node->parent()->inheritedThreadSafeness();
+ Node::ThreadSafeness threadSafeness = node->threadSafeness();
+
+ Text rlink;
+ rlink << Atom(Atom::Link,"reentrant")
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "reentrant"
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
- switch (node->threadSafeness()) {
+ Text tlink;
+ tlink << Atom(Atom::Link,"thread-safe")
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "thread-safe"
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+
+ switch (threadSafeness) {
case Node::UnspecifiedSafeness:
break;
case Node::NonReentrant:
- text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "Warning:"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " This "
- << typeString(node) << " is not " << stockLink("reentrant") << "." << Atom::ParaRight;
+ text << Atom::ParaLeft
+ << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
+ << "Warning:"
+ << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
+ << " This "
+ << typeString(node)
+ << " is not "
+ << rlink
+ << "."
+ << Atom::ParaRight;
break;
case Node::Reentrant:
case Node::ThreadSafe:
- text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD);
- if (parent == Node::ThreadSafe) {
- text << "Warning:";
- } else {
- text << "Note:";
- }
- text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " ";
-
- if (node->threadSafeness() == Node::ThreadSafe)
- theStockLink = stockLink("thread-safe");
- else
- theStockLink = stockLink("reentrant");
+ text << Atom::ParaLeft
+ << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
+ << "Note:"
+ << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
+ << " ";
if (node->isInnerNode()) {
- const InnerNode *innerNode = static_cast<const InnerNode *>(node);
- text << "All the functions in this " << typeString(node) << " are "
- << theStockLink;
-
- NodeList except;
+ const InnerNode* innerNode = static_cast<const InnerNode*>(node);
+ text << "All functions in this "
+ << typeString(node)
+ << " are ";
+ if (threadSafeness == Node::ThreadSafe)
+ text << tlink;
+ else
+ text << rlink;
+
+ bool exceptions = false;
+ NodeList reentrant;
+ NodeList threadsafe;
+ NodeList nonreentrant;
NodeList::ConstIterator c = innerNode->childNodes().begin();
while (c != innerNode->childNodes().end()) {
- if ((*c)->threadSafeness() != Node::UnspecifiedSafeness)
- except.append(*c);
+ switch ((*c)->threadSafeness()) {
+ case Node::Reentrant:
+ reentrant.append(*c);
+ if (threadSafeness == Node::ThreadSafe)
+ exceptions = true;
+ break;
+ case Node::ThreadSafe:
+ threadsafe.append(*c);
+ if (threadSafeness == Node::Reentrant)
+ exceptions = true;
+ break;
+ case Node::NonReentrant:
+ nonreentrant.append(*c);
+ exceptions = true;
+ break;
+ default:
+ break;
+ }
++c;
}
- if (except.isEmpty()) {
+ if (!exceptions)
text << ".";
+ else if (threadSafeness == Node::Reentrant) {
+ if (nonreentrant.isEmpty()) {
+ if (!threadsafe.isEmpty()) {
+ text << ", but ";
+ appendFullNames(text,threadsafe,innerNode,marker);
+ singularPlural(text,threadsafe);
+ text << " also " << tlink << ".";
+ }
+ else
+ text << ".";
+ }
+ else {
+ text << ", except for ";
+ appendFullNames(text,nonreentrant,innerNode,marker);
+ text << ", which";
+ singularPlural(text,nonreentrant);
+ text << " nonreentrant.";
+ if (!threadsafe.isEmpty()) {
+ text << " ";
+ appendFullNames(text,threadsafe,innerNode,marker);
+ singularPlural(text,threadsafe);
+ text << " " << tlink << ".";
+ }
+ }
}
- else {
- text << ", except ";
-
- NodeList::ConstIterator e = except.begin();
- int index = 0;
- while (e != except.end()) {
- appendFullName(text, *e, innerNode, marker);
- text << separator(index++, except.count());
- ++e;
+ else { // thread-safe
+ if (!nonreentrant.isEmpty() || !reentrant.isEmpty()) {
+ text << ", except for ";
+ if (!reentrant.isEmpty()) {
+ appendFullNames(text,reentrant,innerNode,marker);
+ text << ", which";
+ singularPlural(text,reentrant);
+ text << " only " << rlink;
+ if (!nonreentrant.isEmpty())
+ text << ", and ";
+ }
+ if (!nonreentrant.isEmpty()) {
+ appendFullNames(text,nonreentrant,innerNode,marker);
+ text << ", which";
+ singularPlural(text,nonreentrant);
+ text << " nonreentrant.";
+ }
+ text << ".";
}
}
}
else {
- text << "This " << typeString(node) << " is " << theStockLink << ".";
+ text << "This " << typeString(node) << " is ";
+ if (threadSafeness == Node::ThreadSafe)
+ text << tlink;
+ else
+ text << rlink;
+ text << ".";
}
text << Atom::ParaRight;
}
- generateText(text, node, marker);
+ generateText(text,node,marker);
}
void Generator::generateSince(const Node *node, CodeMarker *marker)
@@ -859,7 +948,8 @@ void Generator::generateReimplementedFrom(const FunctionNode *func,
if (from->access() != Node::Private && from->parent()->access() != Node::Private) {
Text text;
text << Atom::ParaLeft << "Reimplemented from ";
- appendFullName(text, from->parent(), func, marker, from);
+ QString fullName = from->parent()->name() + "::" + from->name() + "()";
+ appendFullName(text, from->parent(), fullName, from);
text << "." << Atom::ParaRight;
generateText(text, func, marker);
}
@@ -939,6 +1029,33 @@ void Generator::appendFullName(Text& text,
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
+void Generator::appendFullName(Text& text,
+ const Node *apparentNode,
+ const QString& fullName,
+ const Node *actualNode)
+{
+ if (actualNode == 0)
+ actualNode = apparentNode;
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(actualNode))
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << Atom(Atom::String, fullName)
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+}
+
+void Generator::appendFullNames(Text& text,
+ const NodeList& nodes,
+ const Node* relative,
+ CodeMarker* marker)
+{
+ NodeList::ConstIterator n = nodes.begin();
+ int index = 0;
+ while (n != nodes.end()) {
+ appendFullName(text,*n,relative,marker);
+ text << comma(index++,nodes.count());
+ ++n;
+ }
+}
+
void Generator::appendSortedNames(Text& text,
const ClassNode *classe,
const QList<RelatedClass> &classes,
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index d0909a6..cdc4c29 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -93,11 +93,11 @@ class Generator
virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
- virtual void generateText(const Text& text,
+ virtual bool generateText(const Text& text,
const Node *relative,
CodeMarker *marker);
#ifdef QDOC_QML
- virtual void generateQmlText(const Text& text,
+ virtual bool generateQmlText(const Text& text,
const Node *relative,
CodeMarker *marker);
#endif
@@ -150,6 +150,14 @@ class Generator
const Node *relative,
CodeMarker *marker,
const Node *actualNode = 0);
+ void appendFullName(Text& text,
+ const Node *apparentNode,
+ const QString& fullName,
+ const Node *actualNode);
+ void appendFullNames(Text& text,
+ const NodeList& nodes,
+ const Node* relative,
+ CodeMarker* marker);
void appendSortedNames(Text& text,
const ClassNode *classe,
const QList<RelatedClass> &classes,
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 2a49f81..c007b9b 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1076,16 +1076,34 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay);
s = sections.begin();
while (s != sections.end()) {
- if (s->members.isEmpty()) {
+ if (s->members.isEmpty() && s->reimpMembers.isEmpty()) {
if (!s->inherited.isEmpty())
needOtherSection = true;
- } else {
- out() << "<hr />\n";
- out() << "<a name=\""
- << registerRef((*s).name.toLower())
- << "\"></a>\n";
- out() << "<h2>" << protect((*s).name) << "</h2>\n";
- generateSectionList(*s, inner, marker, CodeMarker::Summary);
+ }
+ else {
+ if (!s->members.isEmpty()) {
+ out() << "<hr />\n";
+ out() << "<a name=\""
+ << registerRef((*s).name.toLower())
+ << "\"></a>\n";
+ out() << "<h2>" << protect((*s).name) << "</h2>\n";
+ generateSection(s->members, inner, marker, CodeMarker::Summary);
+ }
+ if (!s->reimpMembers.isEmpty()) {
+ QString name = QString("Reimplemented ") + (*s).name;
+ out() << "<hr />\n";
+ out() << "<a name=\""
+ << registerRef(name.toLower())
+ << "\"></a>\n";
+ out() << "<h2>" << protect(name) << "</h2>\n";
+ generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary);
+ }
+
+ if (!s->inherited.isEmpty()) {
+ out() << "<ul>\n";
+ generateSectionInheritedList(*s, inner, marker, true);
+ out() << "</ul>\n";
+ }
}
++s;
}
@@ -2211,6 +2229,71 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m
}
#ifdef QDOC_NAME_ALIGNMENT
+void HtmlGenerator::generateSection(const NodeList& nl,
+ const Node *relative,
+ CodeMarker *marker,
+ CodeMarker::SynopsisStyle style)
+{
+ bool name_alignment = true;
+ if (!nl.isEmpty()) {
+ bool twoColumn = false;
+ if (style == CodeMarker::SeparateList) {
+ name_alignment = false;
+ twoColumn = (nl.count() >= 16);
+ }
+ else if (nl.first()->type() == Node::Property) {
+ twoColumn = (nl.count() >= 5);
+ name_alignment = false;
+ }
+ if (name_alignment) {
+ out() << "<table class=\"alignedsummary\" border=\"0\" cellpadding=\"0\" "
+ << "cellspacing=\"0\" width=\"100%\">\n";
+ }
+ else {
+ if (twoColumn)
+ out() << "<p><table class=\"propsummary\" width=\"100%\" "
+ << "border=\"0\" cellpadding=\"0\""
+ << " cellspacing=\"0\">\n"
+ << "<tr><td width=\"45%\" valign=\"top\">";
+ out() << "<ul>\n";
+ }
+
+ int i = 0;
+ NodeList::ConstIterator m = nl.begin();
+ while (m != nl.end()) {
+ if ((*m)->access() == Node::Private) {
+ ++m;
+ continue;
+ }
+
+ if (name_alignment) {
+ out() << "<tr><td class=\"memItemLeft\" "
+ << "align=\"right\" valign=\"top\">";
+ }
+ else {
+ if (twoColumn && i == (int) (nl.count() + 1) / 2)
+ out() << "</ul></td><td valign=\"top\"><ul>\n";
+ out() << "<li><div class=\"fn\">";
+ }
+
+ generateSynopsis(*m, relative, marker, style, name_alignment);
+ if (name_alignment)
+ out() << "</td></tr>\n";
+ else
+ out() << "</div></li>\n";
+ i++;
+ ++m;
+ }
+ if (name_alignment)
+ out() << "</table>\n";
+ else {
+ out() << "</ul>\n";
+ if (twoColumn)
+ out() << "</td></tr>\n</table></p>\n";
+ }
+ }
+}
+
void HtmlGenerator::generateSectionList(const Section& section,
const Node *relative,
CodeMarker *marker,
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index a1c2a34..dc5e5cf 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -146,6 +146,10 @@ class HtmlGenerator : public PageGenerator
CodeMarker *marker,
CodeMarker::SynopsisStyle style);
#ifdef QDOC_NAME_ALIGNMENT
+ void generateSection(const NodeList& nl,
+ const Node *relative,
+ CodeMarker *marker,
+ CodeMarker::SynopsisStyle style);
void generateSynopsis(const Node *node,
const Node *relative,
CodeMarker *marker,
diff --git a/tools/qdoc3/javadocgenerator.cpp b/tools/qdoc3/javadocgenerator.cpp
index b32425c..294877b 100644
--- a/tools/qdoc3/javadocgenerator.cpp
+++ b/tools/qdoc3/javadocgenerator.cpp
@@ -272,9 +272,10 @@ void JavadocGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker
HtmlGenerator::generateFakeNode(fake, marker);
}
-void JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker)
+bool JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker)
{
HtmlGenerator::generateText(text, relative, marker);
+ return true;
}
void JavadocGenerator::generateBody(const Node *node, CodeMarker *marker)
diff --git a/tools/qdoc3/javadocgenerator.h b/tools/qdoc3/javadocgenerator.h
index ba9b15d..5431c38 100644
--- a/tools/qdoc3/javadocgenerator.h
+++ b/tools/qdoc3/javadocgenerator.h
@@ -68,7 +68,7 @@ protected:
void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
void generateFakeNode( const FakeNode *fake, CodeMarker *marker );
- void generateText( const Text& text, const Node *relative, CodeMarker *marker );
+ bool generateText( const Text& text, const Node *relative, CodeMarker *marker );
void generateBody( const Node *node, CodeMarker *marker );
void generateAlsoList( const Node *node, CodeMarker *marker );
diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp
index 5a98275..6425765 100644
--- a/tools/qdoc3/main.cpp
+++ b/tools/qdoc3/main.cpp
@@ -128,7 +128,7 @@ static void printHelp()
" -D<name> "
"Define <name> as a macro while parsing sources\n"
" -slow "
- "Turn on features that slow down qdoc"
+ "Turn on features that slow down qdoc\n"
" -showinternal "
"Include stuff marked internal") );
}
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 0f9468a..b2e53ab 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -868,6 +868,18 @@ void FunctionNode::setOverload(bool overlode)
}
/*!
+ Sets the function node's reimplementation flag to \a r.
+ When \a r is true, it is supposed to mean that this function
+ is a reimplementation of a virtual function in a base class,
+ but it really just means the \e reimp command was seen in the
+ qdoc comment.
+ */
+void FunctionNode::setReimp(bool r)
+{
+ reimp = r;
+}
+
+/*!
*/
void FunctionNode::addParameter(const Parameter& parameter)
{
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 0a671b37d..a35bc17 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -123,6 +123,7 @@ class Node
void setTemplateStuff(const QString &templateStuff) { tpl = templateStuff; }
virtual bool isInnerNode() const = 0;
+ virtual bool isReimp() const { return false; }
Type type() const { return typ; }
InnerNode *parent() const { return par; }
InnerNode *relates() const { return rel; }
@@ -444,6 +445,7 @@ class FunctionNode : public LeafNode
void setConst(bool conste) { con = conste; }
void setStatic(bool statique) { sta = statique; }
void setOverload(bool overlode);
+ void setReimp(bool r);
void addParameter(const Parameter& parameter);
inline void setParameters(const QList<Parameter>& parameters);
void borrowParameterNames(const FunctionNode *source);
@@ -458,6 +460,7 @@ class FunctionNode : public LeafNode
bool isConst() const { return con; }
bool isStatic() const { return sta; }
bool isOverload() const { return ove; }
+ bool isReimp() const { return reimp; }
int overloadNumber() const;
int numOverloads() const;
const QList<Parameter>& parameters() const { return params; }
@@ -483,6 +486,7 @@ class FunctionNode : public LeafNode
bool con : 1;
bool sta : 1;
bool ove : 1;
+ bool reimp: 1;
QList<Parameter> params;
const FunctionNode *rf;
const PropertyNode *ap;
diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
index ed27669..6c1cfd2 100644
--- a/tools/qdoc3/qdoc3.pro
+++ b/tools/qdoc3/qdoc3.pro
@@ -6,6 +6,7 @@ DEFINES += QT_NO_CAST_TO_ASCII
QT = core xml
CONFIG += console
+CONFIG -= debug_and_release_target
build_all:!build_pass {
CONFIG -= build_all
CONFIG += release
diff --git a/tools/qdoc3/separator.cpp b/tools/qdoc3/separator.cpp
index 8f27f90..60674be 100644
--- a/tools/qdoc3/separator.cpp
+++ b/tools/qdoc3/separator.cpp
@@ -48,22 +48,30 @@
QT_BEGIN_NAMESPACE
-QString separator( int index, int count )
+QString separator(int index, int count)
{
- if ( index == count - 1 )
- return tr( ".", "terminator" );
+ if (index == count - 1)
+ return tr(".", "terminator");
+ if (count == 2)
+ return tr(" and ", "separator when N = 2");
+ if (index == 0)
+ return tr(", ", "first separator when N > 2");
+ if (index < count - 2)
+ return tr(", ", "general separator when N > 2");
+ return tr(", and ", "last separator when N > 2");
+}
- if ( count == 2 ) {
- return tr( " and ", "separator when N = 2" );
- } else {
- if ( index == 0 ) {
- return tr( ", ", "first separator when N > 2" );
- } else if ( index < count - 2 ) {
- return tr( ", ", "general separator when N > 2" );
- } else {
- return tr( ", and ", "last separator when N > 2" );
- }
- }
+QString comma(int index, int count)
+{
+ if (index == count - 1)
+ return QString("");
+ if (count == 2)
+ return tr(" and ", "separator when N = 2");
+ if (index == 0)
+ return tr(", ", "first separator when N > 2");
+ if (index < count - 2)
+ return tr(", ", "general separator when N > 2");
+ return tr(", and ", "last separator when N > 2");
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/separator.h b/tools/qdoc3/separator.h
index 70ba624..2336d94 100644
--- a/tools/qdoc3/separator.h
+++ b/tools/qdoc3/separator.h
@@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE
QString separator( int index, int count );
+QString comma( int index, int count );
QT_END_NAMESPACE
diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf
index 9a18abe..709e336 100644
--- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf
+++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf
@@ -68,7 +68,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
QT_END_NAMESPACE \
QT_END_INCLUDE_NAMESPACE \
PHONON_EXPORT \
- Q_GADGET
+ Q_GADGET \
+ QWEBKIT_EXPORT
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \
diff --git a/tools/qdoc3/test/qt-inc.qdocconf b/tools/qdoc3/test/qt-inc.qdocconf
index 01b07b3..542c7ca 100644
--- a/tools/qdoc3/test/qt-inc.qdocconf
+++ b/tools/qdoc3/test/qt-inc.qdocconf
@@ -100,7 +100,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
Q_TYPENAME \
Q_XML_EXPORT \
QDBUS_EXPORT \
- Q_GADGET
+ Q_GADGET \
+ QWEBKIT_EXPORT
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \
diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp
index 45f6a45..36cbd89 100644
--- a/tools/qtconfig/paletteeditoradvanced.cpp
+++ b/tools/qtconfig/paletteeditoradvanced.cpp
@@ -55,7 +55,7 @@ PaletteEditorAdvanced::PaletteEditorAdvanced( QWidget * parent,
const char * name, bool modal, Qt::WindowFlags f )
: PaletteEditorAdvancedBase( parent, name, modal, f ), selectedPalette(0)
{
- // work around buggy ui file
+ // work around buggy UI file
comboEffect->setEnabled(false);
buttonEffect->setEnabled(false);
onToggleBuildEffects(true);
diff --git a/tools/qtconfig/translations/translations.pro b/tools/qtconfig/translations/translations.pro
index fbbdb2bba2..1f9f572 100644
--- a/tools/qtconfig/translations/translations.pro
+++ b/tools/qtconfig/translations/translations.pro
@@ -8,6 +8,7 @@ HEADERS += ../colorbutton.h ../previewframe.h ../previewwidget.h ../mainw
FORMS = ../mainwindowbase.ui ../paletteeditoradvancedbase.ui ../previewwidgetbase.ui
TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qtconfig_pl.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/qtconfig_ru.ts \
$$[QT_INSTALL_TRANSLATIONS]/qtconfig_untranslated.ts \
$$[QT_INSTALL_TRANSLATIONS]/qtconfig_zh_CN.ts \
$$[QT_INSTALL_TRANSLATIONS]/qtconfig_zh_TW.ts
diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
index f047b79..1080477 100644
--- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp
+++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
@@ -113,6 +113,8 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS
CeCloseHandle(deviceHandle);
return true;
}
+ } else {
+ qWarning("Could not open %s: %s", qPrintable(localSource), qPrintable(file.errorString()));
}
return false;
}
@@ -120,7 +122,7 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS
deleteFile(deviceDest);
HANDLE deviceHandle = CeCreateFile(deviceDest.utf16(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (deviceHandle == INVALID_HANDLE_VALUE) {
- debugOutput(QString::fromLatin1(" Could not create target file"), 2);
+ qWarning("Could not create %s: %s", qPrintable(deviceDest), strwinerror(CeGetLastError()).constData());
return false;
}
@@ -144,7 +146,7 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS
if (toWrite == 0)
break;
if (!CeWriteFile(deviceHandle, data.data() , toWrite, &written, NULL)) {
- debugOutput(QString::fromLatin1(" Could not write File"), 2);
+ qWarning("Could not write to %s: %s", qPrintable(deviceDest), strwinerror(CeGetLastError()).constData());
return false;
}
currentPos += written;
@@ -270,8 +272,8 @@ bool ActiveSyncConnection::copyDirectoryFromDevice(const QString &deviceSource,
}
do {
- QString srcFile = deviceSource + "\\" + QString::fromUtf16(data.cFileName);
- QString destFile = localDest + "\\" + QString::fromUtf16(data.cFileName);
+ QString srcFile = deviceSource + "\\" + QString::fromWCharArray(data.cFileName);
+ QString destFile = localDest + "\\" + QString::fromWCharArray(data.cFileName);
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
if (recursive && !copyDirectoryFromDevice(srcFile, destFile, recursive)) {
wprintf(L"Copy of subdirectory(%s) failed\n", srcFile.utf16());
@@ -306,8 +308,8 @@ bool ActiveSyncConnection::copyDirectory(const QString &srcDirectory, const QStr
}
do {
- QString srcFile = srcDirectory + "\\" + QString::fromUtf16(data.cFileName);
- QString destFile = destDirectory + "\\" + QString::fromUtf16(data.cFileName);
+ QString srcFile = srcDirectory + "\\" + QString::fromWCharArray(data.cFileName);
+ QString destFile = destDirectory + "\\" + QString::fromWCharArray(data.cFileName);
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
if (recursive && !copyDirectory(srcFile, destFile, recursive)) {
wprintf(L"Copy of subdirectory(%s) failed\n", srcFile.utf16());
@@ -341,7 +343,7 @@ bool ActiveSyncConnection::deleteDirectory(const QString &directory, bool recurs
return false;
do {
- QString FileName = directory + "\\" + QString::fromUtf16(FindFileData.cFileName);
+ QString FileName = directory + "\\" + QString::fromWCharArray(FindFileData.cFileName);
if((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
if (recursive)
if (!deleteDirectory(FileName, recursive, failIfContentExists))
@@ -380,12 +382,17 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo
BYTE* output;
IRAPIStream *stream;
int returned = 0;
+ DWORD error = 0;
HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
if (S_OK != res) {
- if (S_OK != CeGetLastError())
- debugOutput(QString::fromLatin1("Error: Could not invoke method on QtRemote"),1);
- else
- debugOutput(QString::fromLatin1("Error: QtRemote return unexpectedly with error Code %1").arg(res), 1);
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
} else {
DWORD written;
int strSize = program.length();
@@ -414,9 +421,18 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo
if (S_OK != stream->Read(&returned, sizeof(returned), &written)) {
qWarning(" Could not access return value of process");
}
- result = true;
- }
+ if (S_OK != stream->Read(&error, sizeof(error), &written)) {
+ qWarning(" Could not access error code");
+ }
+ if (error) {
+ qWarning("Error on target: %s", strwinerror(error).constData());
+ result = false;
+ }
+ else {
+ result = true;
+ }
+ }
if (returnValue)
*returnValue = returned;
diff --git a/tools/qtestlib/wince/cetest/deployment.cpp b/tools/qtestlib/wince/cetest/deployment.cpp
index fec2735..68f0197 100644
--- a/tools/qtestlib/wince/cetest/deployment.cpp
+++ b/tools/qtestlib/wince/cetest/deployment.cpp
@@ -125,13 +125,37 @@ void DeploymentHandler::initQtDeploy(QMakeProject *project, DeploymentList &depl
if (!project->values("QMAKE_QT_DLL").isEmpty() && !project->values("QMAKE_LIBDIR").isEmpty()) {
QStringList libs = project->values("LIBS");
QStringList qtLibs;
+ QStringList libPaths;
foreach (QString item, libs) {
- if (item.startsWith("-lQt")) {
- qtLibs += project->values("QMAKE_LIBDIR").at(0) + QDir::separator() + item.mid(2) + QLatin1String("4.dll");
+
+ if (item.startsWith("-L")) {
+ // -L -> a directory containing DLLs
+ libPaths << item.mid(2);
+ continue;
+ }
+
+ QStringList libCandidates;
+
+ if (item.startsWith("-l")) {
+ // -l -> a library located within one of the standard library paths
+ QString lib = item.mid(2);
+
+ // Check if it's a Qt library first, then check in all paths given with -L.
+ // Note Qt libraries get a `4' appended to them, others don't.
+ libCandidates << project->values("QMAKE_LIBDIR").at(0) + QDir::separator() + lib + QLatin1String("4.dll");
+ foreach (QString const& libPath, libPaths) {
+ libCandidates << libPath + QDir::separator() + lib + QLatin1String(".dll");
+ }
} else {
- QFileInfo info(item);
- if (info.exists() && info.isAbsolute() && info.fileName().startsWith(QLatin1String("Qt")))
- qtLibs += info.dir().absoluteFilePath(info.fileName().replace(QLatin1String(".lib"), QLatin1String(".dll")));
+ libCandidates << item.replace(".lib",".dll");
+ }
+
+ foreach (QString const& file, libCandidates) {
+ QFileInfo info(file);
+ if (info.exists()) {
+ qtLibs += info.dir().absoluteFilePath(info.fileName());
+ break;
+ }
}
}
for (QStringList::ConstIterator it = qtLibs.constBegin(); it != qtLibs.constEnd(); ++it) {
diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp
index ba3ef8d..782f6d9 100644
--- a/tools/qtestlib/wince/cetest/main.cpp
+++ b/tools/qtestlib/wince/cetest/main.cpp
@@ -320,6 +320,7 @@ int main(int argc, char **argv)
cout << endl << "Remote Launch:" << qPrintable(TestConfiguration::remoteExecutable) << " " << qPrintable(launchArguments.join(" ")) << endl;
if (!connection.execute(TestConfiguration::remoteExecutable, launchArguments.join(" "), timeout)) {
cout << "Error: Could not execute target file" << endl;
+ return -1;
}
diff --git a/tools/qtestlib/wince/cetest/remoteconnection.cpp b/tools/qtestlib/wince/cetest/remoteconnection.cpp
index 547b211..3d0c3f3 100644
--- a/tools/qtestlib/wince/cetest/remoteconnection.cpp
+++ b/tools/qtestlib/wince/cetest/remoteconnection.cpp
@@ -41,6 +41,38 @@
#include "remoteconnection.h"
+QByteArray strwinerror(DWORD errorcode)
+{
+ QByteArray out(512, 0);
+
+ DWORD ok = FormatMessageA(
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ 0,
+ errorcode,
+ 0,
+ out.data(),
+ out.size(),
+ 0
+ );
+
+ if (!ok) {
+ qsnprintf(out.data(), out.size(),
+ "(error %d; additionally, error %d while looking up error string)",
+ (int)errorcode, (int)GetLastError());
+ }
+ else {
+ out.resize(qstrlen(out.constData()));
+ if (out.endsWith("\r\n"))
+ out.chop(2);
+
+ /* Append error number to error message for good measure */
+ out.append(" (0x");
+ out.append(QByteArray::number(uint(errorcode), 16).rightJustified(8, '0'));
+ out.append(")");
+ }
+ return out;
+}
+
AbstractRemoteConnection::AbstractRemoteConnection()
{
}
diff --git a/tools/qtestlib/wince/cetest/remoteconnection.h b/tools/qtestlib/wince/cetest/remoteconnection.h
index 9c3e63d..f517009 100644
--- a/tools/qtestlib/wince/cetest/remoteconnection.h
+++ b/tools/qtestlib/wince/cetest/remoteconnection.h
@@ -79,4 +79,6 @@ public:
virtual bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL) = 0;
};
+QByteArray strwinerror(DWORD);
+
#endif
diff --git a/tools/qtestlib/wince/remotelib/commands.cpp b/tools/qtestlib/wince/remotelib/commands.cpp
index 3aed2d6..f2176dd 100644
--- a/tools/qtestlib/wince/remotelib/commands.cpp
+++ b/tools/qtestlib/wince/remotelib/commands.cpp
@@ -56,6 +56,7 @@ int qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
wchar_t* arguments = 0;
int timeout = -1;
int returnValue = -2;
+ DWORD error = 0;
if (S_OK != stream->Read(&appLength, sizeof(appLength), &bytesRead))
CLEAN_FAIL(-2);
@@ -74,11 +75,13 @@ int qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
if (S_OK != stream->Read(&timeout, sizeof(timeout), &bytesRead))
CLEAN_FAIL(-2);
- bool result = qRemoteExecute(appName, arguments, &returnValue, timeout);
+ bool result = qRemoteExecute(appName, arguments, &returnValue, &error, timeout);
if (timeout != 0) {
if (S_OK != stream->Write(&returnValue, sizeof(returnValue), &bytesRead))
CLEAN_FAIL(-4);
+ if (S_OK != stream->Write(&error, sizeof(error), &bytesRead))
+ CLEAN_FAIL(-5);
}
delete appName;
delete arguments;
@@ -90,13 +93,16 @@ int qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
}
-bool qRemoteExecute(const wchar_t* program, const wchar_t* arguments, int *returnValue, int timeout)
+bool qRemoteExecute(const wchar_t* program, const wchar_t* arguments, int *returnValue, DWORD* error, int timeout)
{
+ *error = 0;
+
if (!program)
return false;
PROCESS_INFORMATION pid;
if (!CreateProcess(program, arguments, NULL, NULL, false, 0, NULL, NULL, NULL, &pid)) {
+ *error = GetLastError();
wprintf(L"Could not launch: %s\n", program);
return false;
}
diff --git a/tools/qtestlib/wince/remotelib/commands.h b/tools/qtestlib/wince/remotelib/commands.h
index 9f0b2e3..5275f2c 100644
--- a/tools/qtestlib/wince/remotelib/commands.h
+++ b/tools/qtestlib/wince/remotelib/commands.h
@@ -45,7 +45,7 @@
extern "C" {
int __declspec(dllexport) qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream*);
- bool __declspec(dllexport) qRemoteExecute(const wchar_t* program, const wchar_t* arguments = NULL, int *returnValue = NULL , int timeout = -1);
+ bool __declspec(dllexport) qRemoteExecute(const wchar_t* program, const wchar_t* arguments = NULL, int *returnValue = NULL , DWORD* error = NULL, int timeout = -1);
}
#endif
diff --git a/tools/qvfb/translations/translations.pro b/tools/qvfb/translations/translations.pro
index 736a72c..f667bb8 100644
--- a/tools/qvfb/translations/translations.pro
+++ b/tools/qvfb/translations/translations.pro
@@ -27,6 +27,7 @@ SOURCES = ../qvfb.cpp \
../../shared/deviceskin/deviceskin.cpp
TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qvfb_pl.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/qvfb_ru.ts \
$$[QT_INSTALL_TRANSLATIONS]/qvfb_untranslated.ts \
$$[QT_INSTALL_TRANSLATIONS]/qvfb_zh_CN.ts \
$$[QT_INSTALL_TRANSLATIONS]/qvfb_zh_TW.ts
diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp
index a5c2c41..2405d5d 100644
--- a/tools/xmlpatterns/main.cpp
+++ b/tools/xmlpatterns/main.cpp
@@ -194,7 +194,7 @@ protected:
/* If we don't open stdout in "binary" mode on Windows, it will translate
* 0xA into 0xD 0xA. See Trolltech task 173619, for an example. */
_setmode(_fileno(stdout), _O_BINARY);
- m_stdout = QT_WA_INLINE(_wfdopen(_fileno(stdout), L"wb"),_fdopen(_fileno(stdout), "wb"));
+ m_stdout = _wfdopen(_fileno(stdout), L"wb");
out->open(m_stdout, QIODevice::WriteOnly);
#else
out->open(stdout, QIODevice::WriteOnly);