diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-08-17 17:13:58 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-08-17 19:15:13 (GMT) |
commit | 33e1639ba798a5726d322139770dc771d03cae72 (patch) | |
tree | 62477e6c91156ed75182fc0178c6e714c0def6ff /tests | |
parent | 725d3a60c62468553c63a0269282ebdb821c650c (diff) | |
download | Qt-33e1639ba798a5726d322139770dc771d03cae72.zip Qt-33e1639ba798a5726d322139770dc771d03cae72.tar.gz Qt-33e1639ba798a5726d322139770dc771d03cae72.tar.bz2 |
cut down on real code
remove all c++ code which is not part of the critical test data. as a
result, remove the license headers where the remaining text cannot be
reasonably considered copyright-worthy any more.
this is a somewhat persistent solution to the ever-changing license
headers screwing up the tests.
Diffstat (limited to 'tests')
14 files changed, 37 insertions, 541 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp index 7958055..7215ebe 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -1,44 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests 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" @@ -51,83 +10,18 @@ #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) { @@ -141,8 +35,6 @@ void FindDialog::doFind(bool forward) } else { browser->setTextCursor(found); } - onceFound |= !found.isNull(); - lastBrowser = browser; } bool FindDialog::hasFindExpression() const diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result index 21d1ca0..de2c45a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -4,22 +4,22 @@ <context> <name>FindDialog</name> <message> - <location filename="finddialog.cpp" line="57"/> + <location filename="finddialog.cpp" line="19"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="107"/> + <location filename="finddialog.cpp" line="29"/> <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="31"/> <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="33"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> 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 045fab1..756c9a3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -1,44 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests 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" @@ -51,86 +10,17 @@ #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) { @@ -144,31 +34,4 @@ 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.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result index b7074fe..4012182 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -8,22 +8,22 @@ <translation type="obsolete">Skriv inn teksten du soker etter</translation> </message> <message> - <location filename="finddialog.cpp" line="60"/> + <location filename="finddialog.cpp" line="18"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="110"/> + <location filename="finddialog.cpp" line="28"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="112"/> + <location filename="finddialog.cpp" line="30"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="114"/> + <location filename="finddialog.cpp" line="32"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before index 076520a..1ad6ec8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before @@ -3,18 +3,18 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Find text</source> <!--should be changed to unfinished, since we are changing the sourcetext in the UI file--> <translation>Qt Assistant - Finn tekst</translation> </message> <message> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>300px</source> <translation>300px</translation> </message> <message> - <location filename="project.ui" line="33"/> + <location filename="project.ui" line="21"/> <source>400px</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result index b21f583..4c5f74d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -4,18 +4,18 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Find Text</source> <oldsource>Qt Assistant - Find text</oldsource> <translation type="unfinished">Qt Assistant - Finn tekst</translation> </message> <message> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>300px</source> <translation>300px</translation> </message> <message> - <location filename="project.ui" line="33"/> + <location filename="project.ui" line="21"/> <source>401 pixels</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui index 2a0bb70..d332eeb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui @@ -1,45 +1,5 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests 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$ -** -*********************************************************************</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 97d3bce..8c48245 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -79,27 +79,27 @@ backslashed \ stuff.</source> <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"></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> <message> - <location filename="finddialog.cpp" line="147"/> + <location filename="finddialog.cpp" line="175"/> <source>null comment</source> <translation type="unfinished"></translation> </message> @@ -107,7 +107,7 @@ backslashed \ stuff.</source> <context> <name>Kåntekst</name> <message utf8="true"> - <location filename="finddialog.cpp" line="152"/> + <location filename="finddialog.cpp" line="180"/> <source>encoding, using QApplication</source> <translation type="unfinished"></translation> </message> @@ -151,28 +151,28 @@ backslashed \ stuff.</source> <context> <name>QCoreApplication</name> <message> - <location filename="finddialog.cpp" line="144"/> + <location filename="finddialog.cpp" line="172"/> <source>with comment</source> <comment>comment</comment> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="145"/> + <location filename="finddialog.cpp" line="173"/> <source>empty comment</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="146"/> + <location filename="finddialog.cpp" line="174"/> <source>null comment</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="149"/> + <location filename="finddialog.cpp" line="177"/> <source>encoding, using QCoreApplication</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="150"/> + <location filename="finddialog.cpp" line="178"/> <source>encoding, using QApplication</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index ddf58c3..7f665f4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message utf8="true"> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui index 9beb8d5..65a00c7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui @@ -1,45 +1,5 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests 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$ -** -*********************************************************************</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result index e132342..f6415bf 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result @@ -4,22 +4,22 @@ <context> <name>FindDialog</name> <message> - <location filename="sub/finddialog.cpp" line="57"/> + <location filename="sub/finddialog.cpp" line="16"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="107"/> + <location filename="sub/finddialog.cpp" line="25"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="109"/> + <location filename="sub/finddialog.cpp" line="27"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="111"/> + <location filename="sub/finddialog.cpp" line="29"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result index 6646014..581e4b6 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result @@ -4,32 +4,32 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>Finn tekst</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="57"/> + <location filename="sub/finddialog.cpp" line="16"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="107"/> + <location filename="sub/finddialog.cpp" line="25"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="109"/> + <location filename="sub/finddialog.cpp" line="27"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="111"/> + <location filename="sub/finddialog.cpp" line="29"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui index 97553db..8dea10b 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui @@ -1,45 +1,5 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests 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$ -** -*********************************************************************</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp index 3800ee7..3875473 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp @@ -1,44 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests 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" @@ -51,83 +10,14 @@ #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) { @@ -138,34 +28,5 @@ void FindDialog::doFind(bool forward) } 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()); } |