summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-09-21 08:06:18 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-09-21 08:06:18 (GMT)
commita4d1be727573a7a87c523a2ef28074c77d16f165 (patch)
treed4f8f218c41771ca17c7ab324390485af868fa8e /tools/linguist
parentcd2fd21578a80bc5ac121c0419ee00b1799d0a60 (diff)
parent660ec910ef60513b511e2292255e53701dbb239b (diff)
downloadQt-a4d1be727573a7a87c523a2ef28074c77d16f165.zip
Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.gz
Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/corelib/kernel/qobject.h src/declarative/graphicsitems/qdeclarativeflickable.cpp src/declarative/graphicsitems/qdeclarativeflickable_p_p.h src/declarative/util/qdeclarativelistmodel.cpp
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/linguist/mainwindow.cpp6
-rw-r--r--tools/linguist/linguist/sourcecodeview.cpp2
-rw-r--r--tools/linguist/lupdate/cpp.cpp19
-rw-r--r--tools/linguist/shared/translator.h4
4 files changed, 24 insertions, 7 deletions
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index efdf9ef..8520cf7 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -1522,7 +1522,7 @@ void MainWindow::selectedMessageChanged(const QModelIndex &sortedIndex, const QM
}
m_phraseView->setSourceText(-1, QString());
}
- if (m) {
+ if (m && !m->fileName().isEmpty()) {
if (hasFormPreview(m->fileName())) {
m_sourceAndFormView->setCurrentWidget(m_formPreviewView);
m_formPreviewView->setSourceContext(model, m);
@@ -1577,7 +1577,7 @@ void MainWindow::updateTranslation(const QStringList &translations)
return;
m->setTranslations(translations);
- if (hasFormPreview(m->fileName()))
+ if (!m->fileName().isEmpty() && hasFormPreview(m->fileName()))
m_formPreviewView->setSourceContext(m_currentIndex.model(), m);
updateDanger(m_currentIndex, true);
@@ -1996,7 +1996,7 @@ void MainWindow::updateLatestModel(int model)
if (m_currentIndex.isValid()) {
if (MessageItem *item = m_dataModel->messageItem(m_currentIndex)) {
- if (hasFormPreview(item->fileName()))
+ if (!item->fileName().isEmpty() && hasFormPreview(item->fileName()))
m_formPreviewView->setSourceContext(model, item);
if (enableRw && !item->isObsolete())
m_phraseView->setSourceText(model, item->text());
diff --git a/tools/linguist/linguist/sourcecodeview.cpp b/tools/linguist/linguist/sourcecodeview.cpp
index b8dd9c0..d2eef56 100644
--- a/tools/linguist/linguist/sourcecodeview.cpp
+++ b/tools/linguist/linguist/sourcecodeview.cpp
@@ -64,7 +64,7 @@ void SourceCodeView::setSourceContext(const QString &fileName, const int lineNum
m_fileToLoad.clear();
setToolTip(fileName);
- if (fileName.isNull()) {
+ if (fileName.isEmpty()) {
clear();
m_currentFileName.clear();
appendHtml(tr("<i>Source code not available</i>"));
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index 970d44b..6ea7299 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -489,6 +489,7 @@ STRING(class);
STRING(findMessage);
STRING(friend);
STRING(namespace);
+STRING(operator);
STRING(qtTrId);
STRING(return);
STRING(struct);
@@ -753,6 +754,20 @@ uint CppParser::getToken()
if (yyWord == strnamespace)
return Tok_namespace;
break;
+ case 'o':
+ if (yyWord == stroperator) {
+ // Operator overload declaration/definition.
+ // We need to prevent those characters from confusing the followup
+ // parsing. Actually using them does not add value, so just eat them.
+ while (isspace(yyCh))
+ yyCh = getChar();
+ while (yyCh == '+' || yyCh == '-' || yyCh == '*' || yyCh == '/' || yyCh == '%'
+ || yyCh == '=' || yyCh == '<' || yyCh == '>' || yyCh == '!'
+ || yyCh == '&' || yyCh == '|' || yyCh == '~' || yyCh == '^'
+ || yyCh == '[' || yyCh == ']')
+ yyCh = getChar();
+ }
+ break;
case 'q':
if (yyWord == strqtTrId)
return Tok_trid;
@@ -1678,6 +1693,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
functionContextUnresolved.clear(); // Pointless
prospectiveContext.clear();
pendingContext.clear();
+
+ yyTok = getToken();
}
break;
case Tok_namespace:
@@ -1689,7 +1706,6 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
HashString ns = HashString(text);
yyTok = getToken();
if (yyTok == Tok_LeftBrace) {
- yyTok = getToken();
namespaceDepths.push(namespaces.count());
enterNamespace(&namespaces, ns);
@@ -1697,6 +1713,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
functionContextUnresolved.clear();
prospectiveContext.clear();
pendingContext.clear();
+ yyTok = getToken();
} else if (yyTok == Tok_Equals) {
// e.g. namespace Is = OuterSpace::InnerSpace;
QList<HashString> fullName;
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index cfb2178..02cfb07 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -123,8 +123,8 @@ class Translator
public:
Translator();
- bool load(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/);
- bool save(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/) const;
+ bool load(const QString &filename, ConversionData &err, const QString &format /* = "auto" */);
+ bool save(const QString &filename, ConversionData &err, const QString &format /* = "auto" */) const;
bool release(QFile *iod, ConversionData &cd) const;
int find(const TranslatorMessage &msg) const;