summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-27 15:17:12 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-27 15:17:12 (GMT)
commit8c755acd7549a1de53acb9d93e9a44e333be2b5b (patch)
tree7a1e1f5af9b7796ec0719bf0b5e3baf81b393bab /tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete
parentd0cdddb61c46a5d27fe0e4fae176964c2009e971 (diff)
parentebf69d862ad816bf9b00e27adc2b6f0d74331338 (diff)
downloadQt-8c755acd7549a1de53acb9d93e9a44e333be2b5b.zip
Qt-8c755acd7549a1de53acb9d93e9a44e333be2b5b.tar.gz
Qt-8c755acd7549a1de53acb9d93e9a44e333be2b5b.tar.bz2
Merge branch '4.5' into 4.6
Conflicts: tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp tests/auto/qcombobox/tst_qcombobox.cpp tests/auto/xmlpatternsview/view/FunctionSignaturesView.cpp tests/auto/xmlpatternsview/view/MainWindow.cpp tests/auto/xmlpatternsview/view/TestCaseView.cpp tests/auto/xmlpatternsview/view/TestResultView.cpp tests/auto/xmlpatternsview/view/TreeSortFilter.cpp tests/auto/xmlpatternsview/view/UserTestCase.cpp tests/auto/xmlpatternsview/view/XDTItemItem.cpp tests/auto/xmlpatternsview/view/main.cpp tests/auto/xmlpatternsxqts/lib/ASTItem.h tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.h tests/auto/xmlpatternsxqts/lib/ExpressionNamer.h tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.h tests/auto/xmlpatternsxqts/lib/Global.h tests/auto/xmlpatternsxqts/lib/ResultThreader.h tests/auto/xmlpatternsxqts/lib/TestBaseLine.h tests/auto/xmlpatternsxqts/lib/TestCase.h tests/auto/xmlpatternsxqts/lib/TestResult.h tests/auto/xmlpatternsxqts/lib/TestResultHandler.h tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.h tests/auto/xmlpatternsxqts/lib/Worker.h tests/auto/xmlpatternsxqts/lib/XMLWriter.h tests/auto/xmlpatternsxqts/lib/XQTSTestCase.h
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp137
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before8
2 files changed, 141 insertions, 4 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp
index 756c9a3..4abbda9 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite 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://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "finddialog.h"
#include "mainwindow.h"
#include "tabbedbrowser.h"
@@ -10,17 +51,86 @@
#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);
+
+
// Move it to another line and change the text,
// then lupdate should add this one as a new one, and mark the old one as obsolete.
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) {
@@ -34,4 +144,31 @@ void FindDialog::doFind(bool forward)
} 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());
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before
index 271cc39..1fa0fd3 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before
@@ -3,22 +3,22 @@
<context>
<name>FindDialog</name>
<message>
- <location filename="finddialog.cpp" line="57"/>
+ <location filename="finddialog.cpp" line="85"/>
<source>Enter the text you are looking for.</source>
<translation type="unfinished">Skriv inn teksten du soker etter</translation>
</message>
<message>
- <location filename="finddialog.cpp" line="107"/>
+ <location filename="finddialog.cpp" line="135"/>
<source>Search reached end of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="109"/>
+ <location filename="finddialog.cpp" line="137"/>
<source>Search reached start of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="111"/>
+ <location filename="finddialog.cpp" line="139"/>
<source>Text not found</source>
<translation type="unfinished"></translation>
</message>