diff options
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/linguist/mainwindow.cpp | 6 | ||||
-rw-r--r-- | tools/linguist/linguist/sourcecodeview.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 19 | ||||
-rw-r--r-- | tools/linguist/shared/translator.h | 4 |
4 files changed, 24 insertions, 7 deletions
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 265df05..18baa24 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; |