summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lupdate/testdata/recursivescan
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/recursivescan')
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result27
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result115
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp22
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/project.ui44
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++8
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp8
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx8
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp143
8 files changed, 375 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result
new file mode 100644
index 0000000..e132342
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>FindDialog</name>
+ <message>
+ <location filename="sub/finddialog.cpp" line="57"/>
+ <source>Enter the text you want to find.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="107"/>
+ <source>Search reached end of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="109"/>
+ <source>Search reached start of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="111"/>
+ <source>Text not found</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result
new file mode 100644
index 0000000..6646014
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>FindDialog</name>
+ <message>
+ <location filename="project.ui" line="27"/>
+ <source>Qt Assistant - Finn text</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="project.ui" line="30"/>
+ <source>Finn tekst</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="57"/>
+ <source>Enter the text you want to find.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="107"/>
+ <source>Search reached end of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="109"/>
+ <source>Search reached start of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/finddialog.cpp" line="111"/>
+ <source>Text not found</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="12"/>
+ <source>
+newline at the start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="13"/>
+ <source>newline at the end
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="14"/>
+ <source>newline and space at the end
+ </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="15"/>
+ <source>space and newline at the end
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="16"/>
+ <source> Tab at the start and newline at the end
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="17"/>
+ <source>
+ newline and tab at the start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="18"/>
+ <source> space and tab at the start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="19"/>
+ <source> space_first</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="20"/>
+ <source>space_last </source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>text/c++</name>
+ <message>
+ <location filename="sub/filetypes/main.c++" line="6"/>
+ <source>test</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>text/cpp</name>
+ <message>
+ <location filename="sub/filetypes/main.cpp" line="6"/>
+ <source>test</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>text/cxx</name>
+ <message>
+ <location filename="sub/filetypes/main.cxx" line="6"/>
+ <source>test</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp
new file mode 100644
index 0000000..905cccd
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp
@@ -0,0 +1,22 @@
+#include <QApplication>
+#include <QDebug>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QTranslator translator;
+ translator.load("whitespace");
+ app.installTranslator(&translator);
+
+ QObject::tr("\nnewline at the start");
+ QObject::tr("newline at the end\n");
+ QObject::tr("newline and space at the end\n ");
+ QObject::tr("space and newline at the end \n");
+ QObject::tr("\tTab at the start and newline at the end\n");
+ QObject::tr("\n\tnewline and tab at the start");
+ QObject::tr(" \tspace and tab at the start");
+ QObject::tr(" space_first");
+ QObject::tr("space_last ");
+ return app.exec();
+}
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui
new file mode 100644
index 0000000..e03a66e
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui
@@ -0,0 +1,44 @@
+<ui version="4.0" >
+ <author></author>
+ <comment>*********************************************************************
+**
+** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved.
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $LICENSE$
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+*********************************************************************</comment>
+ <exportmacro></exportmacro>
+ <class>FindDialog</class>
+ <widget class="QWidget" name="FindDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>172</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Qt Assistant - Finn text</string>
+ </property>
+ <property name="height" >
+ <string>Finn tekst</string>
+ </property>
+ </widget>
+ <tabstops>
+ <tabstop>comboFind</tabstop>
+ <tabstop>checkWords</tabstop>
+ <tabstop>checkCase</tabstop>
+ <tabstop>radioForward</tabstop>
+ <tabstop>radioBackward</tabstop>
+ <tabstop>findButton</tabstop>
+ <tabstop>closeButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++
new file mode 100644
index 0000000..4da3ded
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++
@@ -0,0 +1,8 @@
+#include <QApplication>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QApplication::translate("text/c++", "test");
+ return app.exec();
+}
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp
new file mode 100644
index 0000000..9b3207d
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp
@@ -0,0 +1,8 @@
+#include <QApplication>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QApplication::translate("text/cpp", "test");
+ return app.exec();
+}
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx
new file mode 100644
index 0000000..b741ff0
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx
@@ -0,0 +1,8 @@
+#include <QApplication>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QApplication::translate("text/cxx", "test");
+ return app.exec();
+}
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp
new file mode 100644
index 0000000..8e92a2a
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved.
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $LICENSE$
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include "finddialog.h"
+#include "mainwindow.h"
+#include "tabbedbrowser.h"
+#include "helpwindow.h"
+
+#include <QTextBrowser>
+#include <QTextCursor>
+#include <QStatusBar>
+#include <QLineEdit>
+#include <QDateTime>
+#include <QGridLayout>
+
+CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent)
+ : QStandardItemModel(rows, columns, parent)
+{}
+QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value,
+ int hits, Qt::MatchFlags flags) const
+{
+ if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap))
+ flags |= Qt::MatchCaseSensitive;
+
+ return QStandardItemModel::match(start, role, value, hits, flags);
+}
+
+FindDialog::FindDialog(MainWindow *parent)
+ : QDialog(parent)
+{
+ contentsWidget = new QWidget(this);
+ ui.setupUi(contentsWidget);
+ ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind));
+
+ QVBoxLayout *l = new QVBoxLayout(this);
+ l->setMargin(0);
+ l->setSpacing(0);
+ l->addWidget(contentsWidget);
+
+ lastBrowser = 0;
+ onceFound = false;
+ findExpr.clear();
+
+ sb = new QStatusBar(this);
+ l->addWidget(sb);
+
+ sb->showMessage(tr("Enter the text you want to find."));
+
+ connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
+ connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+void FindDialog::findButtonClicked()
+{
+ doFind(ui.radioForward->isChecked());
+}
+
+void FindDialog::doFind(bool forward)
+{
+ QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser());
+ sb->clearMessage();
+
+ if (ui.comboFind->currentText() != findExpr || lastBrowser != browser)
+ onceFound = false;
+ findExpr = ui.comboFind->currentText();
+
+ QTextDocument::FindFlags flags = 0;
+
+ if (ui.checkCase->isChecked())
+ flags |= QTextDocument::FindCaseSensitively;
+
+ if (ui.checkWords->isChecked())
+ flags |= QTextDocument::FindWholeWords;
+
+ QTextCursor c = browser->textCursor();
+ if (!c.hasSelection()) {
+ if (forward)
+ c.movePosition(QTextCursor::Start);
+ else
+ c.movePosition(QTextCursor::End);
+
+ browser->setTextCursor(c);
+ }
+
+ QTextDocument::FindFlags options;
+ if (forward == false)
+ flags |= QTextDocument::FindBackward;
+
+ QTextCursor found = browser->document()->find(findExpr, c, flags);
+ if (found.isNull()) {
+ if (onceFound) {
+ if (forward)
+ statusMessage(tr("Search reached end of the document"));
+ else
+ statusMessage(tr("Search reached start of the document"));
+ } else {
+ statusMessage(tr( "Text not found" ));
+ }
+ } else {
+ browser->setTextCursor(found);
+ }
+ onceFound |= !found.isNull();
+ lastBrowser = browser;
+}
+
+bool FindDialog::hasFindExpression() const
+{
+ return !findExpr.isEmpty();
+}
+
+void FindDialog::statusMessage(const QString &message)
+{
+ if (isVisible())
+ sb->showMessage(message);
+ else
+ static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000);
+}
+
+MainWindow *FindDialog::mainWindow() const
+{
+ return static_cast<MainWindow*>(parentWidget());
+}
+
+void FindDialog::reset()
+{
+ ui.comboFind->setFocus();
+ ui.comboFind->lineEdit()->setSelection(
+ 0, ui.comboFind->lineEdit()->text().length());
+}