summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-04-02 16:56:04 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-04-02 16:56:04 (GMT)
commit87d9469e428296a2fb8d0f266900cdfe816eaf0a (patch)
treef8219cadd57c0013f619030b44068adc009e2058
parentceb253c234f840f7aeec10fa4450e840c6b242f4 (diff)
parent7c09fda559760b8488d3130a5932fee04b2f6979 (diff)
downloadQt-87d9469e428296a2fb8d0f266900cdfe816eaf0a.zip
Qt-87d9469e428296a2fb8d0f266900cdfe816eaf0a.tar.gz
Qt-87d9469e428296a2fb8d0f266900cdfe816eaf0a.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: tools/linguist/shared/profileevaluator.cpp
-rwxr-xr-xconfigure3
-rw-r--r--dist/changes-4.5.114
-rw-r--r--doc/src/tutorials/addressbook-sdk.qdoc179
-rw-r--r--mkspecs/features/moc.prf5
-rw-r--r--mkspecs/features/uic.prf5
-rw-r--r--qmake/generators/makefile.cpp12
-rw-r--r--qmake/generators/makefile.h6
-rw-r--r--qmake/generators/metamakefile.cpp2
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp6
-rw-r--r--qmake/project.cpp2
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog22
-rw-r--r--src/corelib/io/qfile.cpp22
-rw-r--r--src/corelib/kernel/qmetaobject.cpp18
-rw-r--r--src/corelib/tools/qlinkedlist.cpp4
-rw-r--r--src/corelib/tools/qlistdata.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp11
-rw-r--r--src/gui/styles/gtksymbols.cpp4
-rw-r--r--src/gui/styles/qgtkstyle.cpp10
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp26
-rw-r--r--src/gui/text/qfontengine_mac.mm31
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/widgets/qcombobox.cpp2
-rw-r--r--tests/auto/qmake/qmake.pro2
-rw-r--r--tests/auto/qmake/testcompiler.cpp305
-rw-r--r--tests/auto/qmake/testcompiler.h49
-rw-r--r--tests/auto/qmake/testdata/shadow_files_build/README2
-rw-r--r--tests/auto/qmake/tst_qmake.cpp34
-rw-r--r--tools/assistant/tools/assistant/contentwindow.cpp21
-rw-r--r--tools/assistant/tools/assistant/contentwindow.h2
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp59
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h1
-rw-r--r--tools/assistant/tools/assistant/indexwindow.cpp13
-rw-r--r--tools/linguist/lconvert/main.cpp2
-rw-r--r--tools/linguist/linguist/messagemodel.cpp10
-rw-r--r--tools/linguist/lrelease/main.cpp15
-rw-r--r--tools/linguist/lupdate/main.cpp1
-rw-r--r--tools/linguist/shared/profileevaluator.cpp14
-rw-r--r--tools/linguist/shared/qm.cpp1
-rw-r--r--tools/linguist/shared/translator.cpp58
-rw-r--r--tools/linguist/shared/translator.h5
-rw-r--r--tools/linguist/shared/translatormessage.h26
-rw-r--r--tools/linguist/shared/ts.cpp6
-rwxr-xr-xutil/webkit/mkdist-webkit2
47 files changed, 439 insertions, 597 deletions
diff --git a/configure b/configure
index f0b7f90..f79b1e2 100755
--- a/configure
+++ b/configure
@@ -6177,6 +6177,9 @@ TARGET_OPERATING_SYSTEM=`echo $XPLATFORM | cut -f 2- -d/ | cut -f -1 -d-`
# when cross-compiling, don't include build-host information (build key is target specific)
QT_BUILD_KEY="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS"
+if [ -n "$QT_NAMESPACE" ]; then
+ QT_BUILD_KEY="$QT_BUILD_KEY $QT_NAMESPACE"
+fi
MAC_NEED_TWO_BUILD_KEYS="no"
if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then
QT_BUILD_KEY_CARBON=$QT_BUILD_KEY
diff --git a/dist/changes-4.5.1 b/dist/changes-4.5.1
index 4e3fcc7..fac0b5d 100644
--- a/dist/changes-4.5.1
+++ b/dist/changes-4.5.1
@@ -80,7 +80,13 @@ Qt for Windows CE
- Designer
-
+ * [249097] Fixed a crash related to undoing a QGridLayout re-layouting
+ operation.
+ * [247995] Fixed a crash occurring after layout operations that cause
+ an instance of QGridLayout or QFormLayout to shrink.
+ * [248000] Fixed a crash ocurring when re-layouting empty grid layouts.
+ * [245961] Restricted objectname-validation to known object name
+ properties only.
- Linguist
- Linguist GUI
@@ -97,7 +103,11 @@ Qt for Windows CE
- uic
-
+ * [244998] Fixed include file generation for phonon widgets.
+ * [248070] Fixed code generation for QStringList-type properties to use
+ encoding properly.
+ * [242447] Made uic generate class-specific code correctly in the case
+ of multiple levels of inheritance.
- uic3
diff --git a/doc/src/tutorials/addressbook-sdk.qdoc b/doc/src/tutorials/addressbook-sdk.qdoc
deleted file mode 100644
index b6b257d..0000000
--- a/doc/src/tutorials/addressbook-sdk.qdoc
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the documentation 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 qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page tutorials-addressbook-sdk.html
-
- \startpage {index.html}{Qt Reference Documentation}
- \nextpage \l{Designing the User Interface}{Chapter 1}
-
- \title Address Book Tutorial
- \ingroup howto
- \ingroup tutorials
- \brief An introduction to GUI programming with Qt and Qt Creator,
- describing in detail how to put together a simple yet fully-
- functioning application.
-
- This tutorial gives an introduction to GUI programming using the Qt SDK.
-
- ### Screenshot
-
- In the process, we will learn about some basic technologies provided by
- Qt, such as:
-
- \list
- \o Widgets and layout managers
- \o Container classes
- \o Signals and slots
- \o Input and output devices
- \endlist
-
- If you are completely new to Qt, please read \l{How to Learn Qt} if you
- have not already done so.
-
- The tutorial's source code is located in Qt's
- \c{examples/tutorials/addressbook} directory.
-
- Tutorial chapters:
-
- \list 1
- \o \l{Designing the User Interface}
- \o \l{Adding Addresses}
- \o \l{Navigating between Entries}
- \o \l{Editing and Removing Addresses}
- \o \l{Adding a Find Function}
- \o \l{Loading and Saving}
- \o \l{Additional Features}
- \endlist
-
- Although this little application does not look much like a fully-fledged
- modern GUI application, it uses many of the basic techniques that are used
- in more complex applications. After you have worked through it, we
- recommend checking out the \l{mainwindows/application}{Application}
- example, which presents a small GUI application, with menus, toolbars, a
- status bar, and so on.
-*/
-
-
-/*!
- \page tutorials-addressbook-sdk-part1.html
- \contentspage {Address Book Tutorial}{Contents}
- \nextpage \l{Adding Addresses}{Chapter 2}
- \title Address Book 1 - Designing the User Interface
-
- The first part of this tutorial covers the design of the basic graphical
- user interface (GUI) we use for the Address Book application.
-
- The first step to creating a GUI program is to design the user interface.
- In this chapter, our goal is to set up the labels and input fields needed
- to implement a basic address book application. The figure below is a
- screenshot of our expected output.
-
- \image addressbook-tutorial-part1-screenshot.png
-
- We begin by launching Qt Creator and use it to generate a new project. To
- do this, select \gui New from the \gui File menu. In the
- \gui{New File or Project} dialog. Follow the step by step guide on how to
- create a \gui Project with Qt Creator, refer to the document
- \l{Creating a Project in Qt Creator}{here}. Ensure that you select QWidget
- as your subclass and name it \c AddressBook.
-
- There are five files generated in this \gui{Project}:
-
- \list
- \o \c{addressbook.pro} - the project file,
- \o \c{addressbook.h} - the definition file for the \c AddressBook
- class,
- \o \c{addressbook.cpp} - the implementation file for the
- \c AddressBook class,
- \o \c{main.cpp} - the file containing a \c main() function, with an
- instance of \c AddressBook, and
- \o \c{addressbook.ui} - the user interface file created with \QD.
- \endlist
-
- Now we have all the files we need, let's move on to designing the user
- interface.
-
- \section1 Placing the Widgets on the Form
-
- In the \gui{Project Sidebar}, double-click on the \c{addressbook.ui} file.
- The \QD plugin will be launched, allowing you to design your program's user
- interface.
-
- We require two \l{QLabel}s to label the input fields as well as a
- QLineEdit and a QTextEdit as the input fields. So, drag those widgets from
- the \gui{Widget Box} to your form. In the \gui{Property Editor}, set their
- \gui{objectName} property to \c nameLabel and \c addressLabel for the
- \l{QLabel}s, \c nameLine for the QLineEdit and finally, \c addressText for
- the QTextEdit.
-
- Next, we have to position the widgets properly, according to the screenshot
- earlier. We use a QGridLayout to position our labels and input fields in a
- structured manner. QGridLayout divides the available space into a grid and
- places widgets in the cells we specify with row and column numbers. The
- diagram below shows the layout cells and the position of our widgets.
-
- \image addressbook-tutorial-part1-labeled-screenshot.png
-
-
- \section1 Qt Programming - Subclassing
-
- When writing Qt programs, we usually subclass Qt objects to add
- functionality. This is one of the essential concepts behind creating custom
- widgets or collections of standard widgets. Subclassing to extend or change
- the behavior of a widget has the following advantages:
-
- \list
- \o We can write implementations of virtual or pure virtual functions
- to obtain exactly what we need, falling back on the base class's
- implementation when necessary.
- \o It allows us to encapsulate parts of the user interface within a
- class, so that the other parts of the application do not need to
- know about the individual widgets in the user interface.
- \o The subclass can be used to create multiple custom widgets in the
- same application or library, and the code for the subclass can be
- reused in other projects.
- \endlist
-
-
-
-
-*/
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index faa9871..d3ad4b2 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -61,7 +61,10 @@ QMAKE_EXTRA_COMPILERS += moc_source
INCREDIBUILD_XGE += moc_source
#make sure we can include these files
-INCLUDEPATH += $$MOC_DIR
+moc_dir_short = $$MOC_DIR
+win32:moc_dir_short ~= s,^.:,/,
+contains(moc_dir_short, ^[/\\].*):INCLUDEPATH += $$MOC_DIR
+else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR
#auto depend on moc
unix:!no_mocdepend {
diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf
index 885fad7..f03d623 100644
--- a/mkspecs/features/uic.prf
+++ b/mkspecs/features/uic.prf
@@ -34,7 +34,10 @@ isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_
INCREDIBUILD_XGE += uic
}
-INCLUDEPATH += $$UI_HEADERS_DIR
+ui_dir_short = $$UI_HEADERS_DIR
+win32:ui_dir_short ~= s,^.:,/,
+contains(ui_dir_short, ^[/\\].*):INCLUDEPATH += $$UI_HEADERS_DIR
+else:INCLUDEPATH += $$OUT_PWD/$$UI_HEADERS_DIR
uic3 {
isEmpty(FORMS3) {
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index d0fbcbe..3e5452e 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2735,16 +2735,9 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
ret.prepend(pwd);
ret = Option::fixPathToTargetOS(ret, false, canon);
} else { //fix it..
- QString qfile(Option::fixPathToLocalOS(ret, true, canon)), in_dir(in_d), out_dir(out_d);
+ QString out_dir = QDir(Option::output_dir).absoluteFilePath(out_d);
+ QString in_dir = QDir(pwd).absoluteFilePath(in_d);
{
- if(out_dir.isNull() || QDir::isRelativePath(out_dir))
- out_dir.prepend(Option::output_dir + "/");
- else if(out_dir == ".")
- out_dir = pwd;
- if(in_dir.isEmpty() || QDir::isRelativePath(in_dir))
- in_dir.prepend(pwd);
- else if(in_dir == ".")
- in_dir = pwd;
QFileInfo in_fi(fileInfo(in_dir));
if(in_fi.exists())
in_dir = in_fi.canonicalFilePath();
@@ -2753,6 +2746,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
out_dir = out_fi.canonicalFilePath();
}
+ QString qfile(Option::fixPathToLocalOS(ret, true, canon));
QFileInfo qfileinfo(fileInfo(qfile));
if(out_dir != in_dir || !qfileinfo.isRelative()) {
if(qfileinfo.isRelative()) {
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index a26a247..cf09a6a 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -109,7 +109,7 @@ protected:
struct SubTarget
{
QString name;
- QString in_directory, out_directory;
+ QString in_directory, out_directory;
QString profile, target, makefile;
QStringList depends;
};
@@ -183,8 +183,8 @@ protected:
void filterIncludedFiles(const QString &);
virtual void processSources() {
- filterIncludedFiles("SOURCES");
- filterIncludedFiles("GENERATED_SOURCES");
+ filterIncludedFiles("SOURCES");
+ filterIncludedFiles("GENERATED_SOURCES");
}
//for cross-platform dependent directories
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index f0683a7..3f60791 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -360,7 +360,7 @@ SubdirsMetaMakefileGenerator::init()
}
--recurseDepth;
- Option::output.setFileName(old_output);
+ Option::output.setFileName(old_output);
Option::output_dir = old_output_dir;
qmake_setpwd(oldpwd);
}
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 4b1b66d..b5904cc 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -244,14 +244,14 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
project->variables().remove("QMAKE_RUN_CC");
QHash<QString, void*> source_directories;
- source_directories.insertMulti(".", (void*)1);
+ source_directories.insert(".", (void*)1);
QString directories[] = { QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString() };
for(int y = 0; !directories[y].isNull(); y++) {
QString dirTemp = project->first(directories[y]);
if (dirTemp.endsWith("\\"))
dirTemp.truncate(dirTemp.length()-1);
if(!dirTemp.isEmpty())
- source_directories.insertMulti(dirTemp, (void*)1);
+ source_directories.insert(dirTemp, (void*)1);
}
QString srcs[] = { QString("SOURCES"), QString("GENERATED_SOURCES"), QString() };
for(int x = 0; !srcs[x].isNull(); x++) {
@@ -262,7 +262,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
sep = "/";
QString dir = (*sit).section(sep, 0, -2);
if(!dir.isEmpty() && !source_directories[dir])
- source_directories.insertMulti(dir, (void*)1);
+ source_directories.insert(dir, (void*)1);
}
}
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 8d49788..eef32db 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -1105,7 +1105,7 @@ QMakeProject::parse(const QString &t, QMap<QString, QStringList> &place, int num
}
}
}
- } else if(!parens && *(d+d_off) == QLatin1Char('}')) {
+ } else if(!parens && *(d+d_off) == QLatin1Char('}')) {
if(start_block) {
--start_block;
} else if(!scope_blocks.count()) {
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 96840d0..1ebf6ef 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -8,4 +8,4 @@ The commit imported was from the
and has the sha1 checksum
- 1beae2b64b5b1e9b97e82dc94de18ebac1c19efc
+ 9c6a4a25fe741b43dd64f5dbaeccfb647cb321fb
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index ae71356..5dc6363 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -534,6 +534,8 @@ void QWebFrame::load(const QNetworkRequest &req,
Sets the content of this frame to \a html. \a baseUrl is optional and used to resolve relative
URLs in the document, such as referenced images or stylesheets.
+ The \a html is loaded immediately; external objects are loaded asynchronously.
+
When using this method WebKit assumes that external resources such as JavaScript programs or style
sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external
script can be specified through the charset attribute of the HTML script tag. It is also possible
@@ -558,6 +560,8 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl)
External objects referenced in the content are located relative to \a baseUrl.
+ The \a data is loaded immediately; external objects are loaded asynchronously.
+
\sa toHtml()
*/
void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 636b6e8..14288e2 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -896,14 +896,14 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
return;
}
- if (!ev->preeditString().isEmpty()) {
+ if (!ev->commitString().isEmpty())
+ editor->confirmComposition(ev->commitString());
+ else {
QString preedit = ev->preeditString();
// ### FIXME: use the provided QTextCharFormat (use color at least)
Vector<CompositionUnderline> underlines;
underlines.append(CompositionUnderline(0, preedit.length(), Color(0,0,0), false));
editor->setComposition(preedit, underlines, preedit.length(), 0);
- } else if (!ev->commitString().isEmpty()) {
- editor->confirmComposition(ev->commitString());
}
ev->accept();
}
@@ -1095,7 +1095,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
This enum describes the types of action which can be performed on the web page.
Actions only have an effect when they are applicable. The availability of
- actions can be be determined by checking \l{QAction::}{enabled()} on the
+ actions can be be determined by checking \l{QAction::}{isEnabled()} on the
action returned by \l{QWebPage::}{action()}.
One method of enabling the text editing, cursor movement, and text selection actions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
index ea503a1..a843eba 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
@@ -289,6 +289,8 @@ void QWebView::load(const QNetworkRequest &request,
External objects such as stylesheets or images referenced in the HTML
document are located relative to \a baseUrl.
+ The \a html is loaded immediately; external objects are loaded asynchronously.
+
When using this method, WebKit assumes that external resources such as
JavaScript programs or style sheets are encoded in UTF-8 unless otherwise
specified. For example, the encoding of an external script can be specified
@@ -309,6 +311,8 @@ void QWebView::setHtml(const QString &html, const QUrl &baseUrl)
External objects referenced in the content are located relative to \a baseUrl.
+ The \a data is loaded immediately; external objects are loaded asynchronously.
+
\sa load(), setHtml(), QWebFrame::toHtml()
*/
void QWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 32d27cd..41ca520 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,25 @@
+2009-04-02 Takumi Asaki <takumi.asaki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix pre-edit handling of text fields with input methods.
+
+ The input method sends an empty preeditString() if all characters of
+ the preedit should be deleted. So inputMethodEvent() has to use
+ preeditString() if it's empty.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::inputMethodEvent):
+
+2009-03-30 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Tor Arne Vestbø.
+
+ Document that setHtml/setContent loads only the html/data immediately, not external objects.
+
+ * Api/qwebframe.cpp:
+ * Api/qwebview.cpp:
+
2009-03-26 Simon Hausmann <simon.hausmann@nokia.com>
Rubber-stamped by Tor Arne Vestbø.
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index d8f08c9..d7da800 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -712,6 +712,9 @@ QFile::rename(const QString &newName)
if(error() == QFile::NoError) {
if (fileEngine()->rename(newName)) {
unsetError();
+ // engine was able to handle the new name so we just reset it
+ fileEngine()->setFileName(newName);
+ d->fileName = newName;
return true;
}
@@ -731,10 +734,18 @@ QFile::rename(const QString &newName)
}
if (read == -1) {
d->setError(QFile::RenameError, in.errorString());
- return true;
+ error = true;
+ }
+ if(!error) {
+ if (!in.remove()) {
+ d->setError(QFile::RenameError, tr("Cannot remove source file"));
+ error = true;
+ }
}
- if(!error)
- in.remove();
+ if (error)
+ out.remove();
+ else
+ setFileName(newName);
return !error;
}
}
@@ -889,7 +900,10 @@ QFile::copy(const QString &newName)
error = true;
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
}
-#ifndef QT_NO_TEMPORARYFILE
+#ifdef QT_NO_TEMPORARYFILE
+ if (error)
+ out.remove();
+#else
if (!error)
out.setAutoRemove(false);
#endif
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 719398c..b65f956 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1007,6 +1007,11 @@ enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value
a QEvent will be sent and the member is invoked as soon as the application
enters the main event loop.
+ \o If \a type is Qt::BlockingQueuedConnection, the method will be invoked in
+ the same way as for Qt::QueuedConnection, except that the current thread
+ will block until the event is delivered. Using this connection type to
+ communicate between objects in the same thread will lead to deadlocks.
+
\o If \a type is Qt::AutoConnection, the member is invoked
synchronously if \a obj lives in the same thread as the
caller; otherwise it will invoke the member asynchronously.
@@ -1897,6 +1902,12 @@ static QByteArray qualifiedName(const QMetaEnum &e)
\ingroup objectmodel
+ Property meta-data is obtained from an object's meta-object. See
+ QMetaObject::property() and QMetaObject::propertyCount() for
+ details.
+
+ \section1 Property Meta-Data
+
A property has a name() and a type(), as well as various
attributes that specify its behavior: isReadable(), isWritable(),
isDesignable(), isScriptable(), and isStored().
@@ -1912,9 +1923,10 @@ static QByteArray qualifiedName(const QMetaEnum &e)
functions. See QObject::setProperty() and QObject::property() for
details.
- You get property meta-data through an object's meta-object. See
- QMetaObject::property() and QMetaObject::propertyCount() for
- details.
+ \section1 Copying and Assignment
+
+ QMetaProperty objects can be copied by value. However, each copy will
+ refer to the same underlying property meta-data.
\sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System}
*/
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index a3cbecc..c454224 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -652,7 +652,7 @@ QLinkedListData QLinkedListData::shared_null = {
Constructs an uninitialized iterator.
Functions like operator*() and operator++() should not be called
- on an uninitialized iterartor. Use operator=() to assign a value
+ on an uninitialized iterator. Use operator=() to assign a value
to it before using it.
\sa QLinkedList::begin() QLinkedList::end()
@@ -858,7 +858,7 @@ QLinkedListData QLinkedListData::shared_null = {
Constructs an uninitialized iterator.
Functions like operator*() and operator++() should not be called
- on an uninitialized iterartor. Use operator=() to assign a value
+ on an uninitialized iterator. Use operator=() to assign a value
to it before using it.
\sa QLinkedList::constBegin() QLinkedList::constEnd()
diff --git a/src/corelib/tools/qlistdata.cpp b/src/corelib/tools/qlistdata.cpp
index 2b1c086..d7c39a7 100644
--- a/src/corelib/tools/qlistdata.cpp
+++ b/src/corelib/tools/qlistdata.cpp
@@ -1193,7 +1193,7 @@ void **QListData::erase(void **xi)
Constructs an uninitialized iterator.
Functions like operator*() and operator++() should not be called
- on an uninitialized iterartor. Use operator=() to assign a value
+ on an uninitialized iterator. Use operator=() to assign a value
to it before using it.
\sa QList::begin() QList::end()
@@ -1416,7 +1416,7 @@ void **QListData::erase(void **xi)
Constructs an uninitialized iterator.
Functions like operator*() and operator++() should not be called
- on an uninitialized iterartor. Use operator=() to assign a value
+ on an uninitialized iterator. Use operator=() to assign a value
to it before using it.
\sa QList::constBegin() QList::constEnd()
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 553967c..a9578f2 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4612,16 +4612,17 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
if (cacheMode == QGraphicsItem::ItemCoordinateCache) {
QSize pixmapSize;
bool fixedCacheSize = false;
+ QRectF brectAligned = brect.toAlignedRect();
if ((fixedCacheSize = itemCache->fixedSize.isValid())) {
pixmapSize = itemCache->fixedSize;
} else {
- pixmapSize = brect.toAlignedRect().size();
+ pixmapSize = brectAligned.size().toSize();
}
// Create or recreate the pixmap.
int adjust = itemCache->fixedSize.isValid() ? 0 : 2;
QSize adjustSize(adjust*2, adjust*2);
- QRectF br = brect.adjusted(-adjust, -adjust, adjust, adjust);
+ QRectF br = brectAligned.adjusted(-adjust, -adjust, adjust, adjust);
if (pix.isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) != pix.size())) {
pix = QPixmap(pixmapSize + adjustSize);
itemCache->exposed.clear();
@@ -4631,9 +4632,11 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
// Redraw any newly exposed areas.
if (itemCache->allExposed || !itemCache->exposed.isEmpty()) {
// Fit the item's bounding rect into the pixmap's coordinates.
- const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height());
QTransform itemToPixmap;
- itemToPixmap.scale(scale.x(), scale.y());
+ if (fixedCacheSize) {
+ const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height());
+ itemToPixmap.scale(scale.x(), scale.y());
+ }
itemToPixmap.translate(-br.x(), -br.y());
// Generate the item's exposedRect and map its list of expose
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index 3fbf233..f60c980 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -529,14 +529,14 @@ void QGtk::applyGtkSystemPalette(QWidget *widget)
ensureWidgetPalette(menubar, QLS("GtkMenuBar"));
else if (QToolBar *toolbar = qobject_cast<QToolBar*> (widget))
ensureWidgetPalette(toolbar, QLS("GtkToolbar"));
- else if (QMenu *menubar = qobject_cast<QMenu*> (widget)) {
+ else if (QMenu *menu = qobject_cast<QMenu*> (widget)) {
// This really applies to the combo box rendering since
// QComboBox copies the palette from a QMenu
QPalette pal = widget->palette();
GdkColor gdkBg = QGtk::gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL];
QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
pal.setBrush(QPalette::Base, bgColor);
- menubar->setPalette(pal);
+ menu->setPalette(pal);
}
widget->setAttribute(Qt::WA_SetPalette, false);
}
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 582962a..81d7cb8 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -2593,16 +2593,24 @@ void QGtkStyle::drawControl(ControlElement element,
opt.rect = vCheckRect;
drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
}
-
painter->drawPixmap(pmr.topLeft(), pixmap);
}
GdkColor gdkText = gtkMenuItem->style->fg[GTK_STATE_NORMAL];
GdkColor gdkDText = gtkMenuItem->style->fg[GTK_STATE_INSENSITIVE];
GdkColor gdkHText = gtkMenuItem->style->fg[GTK_STATE_PRELIGHT];
+ uint resolve_mask = option->palette.resolve();
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8);
+ if (resolve_mask & (1 << QPalette::ButtonText)) {
+ textColor = option->palette.buttonText().color();
+ disabledTextColor = option->palette.brush(QPalette::Disabled, QPalette::ButtonText);;
+ }
+
QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
+ if (resolve_mask & (1 << QPalette::HighlightedText)) {
+ highlightedTextColor = option->palette.highlightedText().color();
+ }
if (selected)
painter->setPen(highlightedTextColor);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index a39eeb7..49ac57a 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1514,20 +1514,11 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette
void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const QWidget *w, bool embedded)
{
-#ifdef QT_NO_COMBOBOX
- const bool isReadOnlyCombo = false;
-#else
- const bool isReadOnlyCombo = qobject_cast<const QComboBox *>(w) != 0;
-#endif
-
if (bg && bg->brush.style() != Qt::NoBrush) {
- if (isReadOnlyCombo) {
- p->setBrush(cg, QPalette::Base, bg->brush); // for windows, windowxp
- p->setBrush(cg, QPalette::Button, bg->brush); // for plastique
- } else {
- p->setBrush(cg, w->backgroundRole(), bg->brush);
- //p->setBrush(cg, QPalette::Window, bg->brush);
- }
+ p->setBrush(cg, QPalette::Base, bg->brush); // for windows, windowxp
+ p->setBrush(cg, QPalette::Button, bg->brush); // for plastique
+ p->setBrush(cg, w->backgroundRole(), bg->brush);
+ p->setBrush(cg, QPalette::Window, bg->brush);
}
if (embedded) {
@@ -1542,12 +1533,9 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q
return;
if (pal->foreground.style() != Qt::NoBrush) {
- if (isReadOnlyCombo) {
- p->setBrush(cg, QPalette::ButtonText, pal->foreground);
- } else {
- p->setBrush(cg, w->foregroundRole(), pal->foreground);
- p->setBrush(cg, QPalette::WindowText, pal->foreground);
- }
+ p->setBrush(cg, QPalette::ButtonText, pal->foreground);
+ p->setBrush(cg, w->foregroundRole(), pal->foreground);
+ p->setBrush(cg, QPalette::WindowText, pal->foreground);
p->setBrush(cg, QPalette::Text, pal->foreground);
}
if (pal->selectionBackground.style() != Qt::NoBrush)
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 40d145a..425cab2 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -120,7 +120,7 @@ OSStatus QMacFontPath::closePath(void *data)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, const ATSFontRef &atsFontRef, const QFontDef &fontDef, bool)
+QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, const ATSFontRef &atsFontRef, const QFontDef &fontDef, bool kerning)
: QFontEngineMulti(0)
{
this->fontDef = fontDef;
@@ -149,11 +149,15 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, con
CFRetain(ctfont);
}
- const void *keys[] = { NSFontAttributeName };
- const void *values[] = { ctfont };
- attributeDict = CFDictionaryCreate(0, keys, values, 1,
+ attributeDict = CFDictionaryCreateMutable(0, 2,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+ CFDictionaryAddValue(attributeDict, NSFontAttributeName, ctfont);
+ if (!kerning) {
+ float zero = 0.0;
+ QCFType<CFNumberRef> noKern = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
+ CFDictionaryAddValue(attributeDict, kCTKernAttributeName, &noKern);
+ }
QCoreTextFontEngine *fe = new QCoreTextFontEngine(ctfont, fontDef, this);
fe->ref.ref();
@@ -277,10 +281,11 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
outAdvances_x[idx] = QFixed::fromReal(tmpPoints[i + 1].x - tmpPoints[i].x);
outAdvances_y[idx] = QFixed::fromReal(tmpPoints[i + 1].y - tmpPoints[i].y);
}
- double runWidth = ceil(CTRunGetTypographicBounds(run, range, 0, 0, 0));
- runWidth += tmpPoints[0].x;
+ CGSize lastGlyphAdvance;
+ CTFontGetAdvancesForGlyphs(runFont, kCTFontHorizontalOrientation, tmpGlyphs + glyphCount - 1, &lastGlyphAdvance, 1);
+
outGlyphs[rtl ? 0 : (glyphCount - 1)] = tmpGlyphs[glyphCount - 1] | fontIndex;
- outAdvances_x[rtl ? 0 : (glyphCount - 1)] = QFixed::fromReal(runWidth - tmpPoints[glyphCount - 1].x);
+ outAdvances_x[rtl ? 0 : (glyphCount - 1)] = QFixed::fromReal(lastGlyphAdvance.width).ceil();
}
outGlyphs += glyphCount;
outAttributes += glyphCount;
@@ -365,26 +370,26 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
ret.y = -QFixed::fromReal(rect.origin.y) - ret.height;
CGSize advances[1];
CTFontGetAdvancesForGlyphs(ctfont, kCTFontHorizontalOrientation, &g, advances, 1);
- ret.xoff = QFixed::fromReal(advances[0].width);
- ret.yoff = QFixed::fromReal(advances[0].height);
+ ret.xoff = QFixed::fromReal(advances[0].width).ceil();
+ ret.yoff = QFixed::fromReal(advances[0].height).ceil();
return ret;
}
QFixed QCoreTextFontEngine::ascent() const
{
- return QFixed::fromReal(CTFontGetAscent(ctfont));
+ return QFixed::fromReal(CTFontGetAscent(ctfont)).ceil();
}
QFixed QCoreTextFontEngine::descent() const
{
- return QFixed::fromReal(CTFontGetDescent(ctfont));
+ return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil();
}
QFixed QCoreTextFontEngine::leading() const
{
- return QFixed::fromReal(CTFontGetLeading(ctfont));
+ return QFixed::fromReal(CTFontGetLeading(ctfont)).ceil();
}
QFixed QCoreTextFontEngine::xHeight() const
{
- return QFixed::fromReal(CTFontGetXHeight(ctfont));
+ return QFixed::fromReal(CTFontGetXHeight(ctfont)).ceil();
}
QFixed QCoreTextFontEngine::averageCharWidth() const
{
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index e289aa9..176c728 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -480,7 +480,7 @@ private:
uint fontIndexForFont(CTFontRef id) const;
CTFontRef ctfont;
- mutable QCFType<CFDictionaryRef> attributeDict;
+ mutable QCFType<CFMutableDictionaryRef> attributeDict;
friend class QFontDialogPrivate;
};
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index c7e2590..09a51fe 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -109,7 +109,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
const QModelIndex &index) const
{
QStyleOptionMenuItem menuOption;
- menuOption.palette = QComboBoxPrivate::viewContainerPalette(mCombo).resolve(QApplication::palette("QMenu"));
+ menuOption.palette = option.palette.resolve(QApplication::palette("QMenu"));
menuOption.state = QStyle::State_None;
if (mCombo->window()->isActiveWindow())
menuOption.state = QStyle::State_Active;
diff --git a/tests/auto/qmake/qmake.pro b/tests/auto/qmake/qmake.pro
index 59cc2be..8cae6be 100644
--- a/tests/auto/qmake/qmake.pro
+++ b/tests/auto/qmake/qmake.pro
@@ -2,8 +2,6 @@ load(qttest_p4)
HEADERS += testcompiler.h
SOURCES += tst_qmake.cpp testcompiler.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
-
cross_compile: DEFINES += QMAKE_CROSS_COMPILED
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp
index bfc8905..122a2b8 100644
--- a/tests/auto/qmake/testcompiler.cpp
+++ b/tests/auto/qmake/testcompiler.cpp
@@ -39,49 +39,37 @@
**
****************************************************************************/
-
#include "testcompiler.h"
-#include <stdlib.h>
-#include <qapplication.h>
-
-#ifdef QT3_SUPPORT
-
-#include <q3process.h>
-#include <qtimer.h>
-#ifdef Q_OS_WIN32
-# include <windows.h>
-#endif
-#include <QtTest/QtTest>
+#include <QProcess>
+#include <QDir>
-#undef SHOW_QDEBUG
-#undef SHOW_COMPLETENESS
-
-QString targetName( BuildType buildMode, const QString& target, const QString& version )
+static QString targetName( BuildType buildMode, const QString& target, const QString& version )
{
+ Q_UNUSED(version);
QString targetName = target;
#if defined (Q_OS_WIN32)
switch (buildMode)
{
case Exe: // app
- targetName.append(".exe");
- break;
+ targetName.append(".exe");
+ break;
case Dll: // dll
- if (version != "") {
- QStringList ver = QStringList::split(".", version);
- targetName.append(ver.first());
- }
+ if (version != "") {
+ QStringList ver = QStringList::split(".", version);
+ targetName.append(ver.first());
+ }
targetName.append(".dll");
- break;
+ break;
case Lib: // lib
#ifdef Q_CC_GNU
targetName.prepend("lib");
targetName.append(".a");
#else
- targetName.append(".lib");
+ targetName.append(".lib");
#endif
- break;
+ break;
case Plain:
// no conversion
break;
@@ -90,16 +78,16 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
switch (buildMode)
{
case Exe: // app
- targetName += ".app/Contents/MacOS/" + target.section('/', -1);
- break;
+ targetName += ".app/Contents/MacOS/" + target.section('/', -1);
+ break;
case Dll: // dll
- targetName.prepend("lib");
+ targetName.prepend("lib");
targetName.append("." + version + ".dylib");
- break;
+ break;
case Lib: // lib
- targetName.prepend("lib");
- targetName.append(".a");
- break;
+ targetName.prepend("lib");
+ targetName.append(".a");
+ break;
case Plain:
// no conversion
break;
@@ -108,9 +96,9 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
switch (buildMode)
{
case Exe: // app
- break;
+ break;
case Dll: // dll
- targetName.prepend("lib");
+ targetName.prepend("lib");
#if defined (Q_OS_HPUX) && !defined (__ia64)
targetName.append(".sl");
#elif defined (Q_OS_AIX)
@@ -118,11 +106,11 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
#else
targetName.append(".so");
#endif
- break;
+ break;
case Lib: // lib
- targetName.prepend("lib");
- targetName.append(".a");
- break;
+ targetName.prepend("lib");
+ targetName.append(".a");
+ break;
case Plain:
// no conversion
break;
@@ -131,223 +119,119 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
return targetName;
}
-
-
TestCompiler::TestCompiler()
{
- exit_ok = FALSE;
- childProc = 0;
- setBaseCommands( "", "", FALSE );
+ setBaseCommands( "", "" );
}
TestCompiler::~TestCompiler()
{
- if (childProc)
- delete childProc;
}
-bool TestCompiler::runChild( bool showOutput, QStringList argList, QStringList *envList )
+bool TestCompiler::runCommand( QString cmdline )
{
- //qDebug() << "executing" << argList;
- exit_ok = FALSE;
- if (childProc)
- delete childProc;
+ testOutput_.append("Running command: " + cmdline);
- child_show = showOutput;
- if ( showOutput ) {
+ QProcess child;
+ if (!environment_.empty())
+ child.setEnvironment(QProcess::systemEnvironment() + environment_);
- QString S = argList.join(" ");
- addMakeResult( S );
+ child.start(cmdline);
+ if (!child.waitForStarted(-1)) {
+ testOutput_.append( "Unable to start child process." );
+ return false;
}
- childProc = new Q3Process(argList, this, argList.join(" ").latin1());
- Q_ASSERT(childProc);
-
- connect(childProc,SIGNAL(readyReadStdout()),this,SLOT(childHasData()));
- connect(childProc,SIGNAL(processExited()),this,SLOT(childReady()));
-
- if (!childProc->start( envList )) {
-
- addMakeResult( "Error executing '" + argList[0] + "'." );
- childReady();
- return FALSE;
+ bool failed = false;
+ child.setReadChannel(QProcess::StandardError);
+ while (QProcess::Running == child.state()) {
+ if (child.waitForReadyRead(1000)) {
+ QString output = child.readAllStandardError();
+ testOutput_.append(output);
+
+ output.prepend('\n');
+ if (output.contains("\nProject MESSAGE: FAILED"))
+ failed = true;
+ }
}
- while (childProc != 0 && childProc->isRunning()) {
- qApp->processEvents();
- }
-
- childReady();
-
- return exit_ok;
-}
+ child.waitForFinished(-1);
-void TestCompiler::childReady()
-{
- if (childProc != 0) {
- childHasData();
-
- QString S;
- int pos;
- while (childProc->canReadLineStderr()) {
- S = childProc->readLineStderr();
- do {
- pos = S.find("\t");
- if (pos >= 0) {
- S.remove(pos,1);
- S.insert(pos," ");
- }
- } while (pos >= 0);
-
- if (child_show)
- addMakeResult( S );
- }
-
- exit_ok = childProc->normalExit() && childProc->exitStatus() == 0;
- delete childProc;
- }
- childProc = 0;
+ return failed
+ ? false
+ : (child.exitStatus() == QProcess::NormalExit)
+ && (child.exitCode() == 0);
}
-void TestCompiler::childHasData()
+void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd )
{
- QString S;
- int pos;
- while (childProc->canReadLineStderr()) {
-
- S = childProc->readLineStderr();
- do {
- pos = S.find("\t");
- if (pos >= 0) {
- S.remove(pos,1);
- S.insert(pos," ");
- }
-
- } while (pos >= 0);
-
- if ( S.startsWith("Project MESSAGE: FAILED") )
- QTest::qFail( S, __FILE__, __LINE__ );
- else if ( S.startsWith("Project MESSAGE: SKIPPED") )
- QTest::qSkip( S, QTest::SkipSingle, __FILE__, __LINE__ );
- else if (child_show)
- addMakeResult( S );
- }
+ makeCmd_ = makeCmd;
+ qmakeCmd_ = qmakeCmd;
}
-void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode )
+void TestCompiler::resetEnvironment()
{
- qws_mode = qwsMode;
- make_cmd = makeCmd;
-
- // not sure if i need this, but it doesn't hurt
- if (make_cmd.startsWith("\""))
- make_cmd = make_cmd.remove(0,1);
- if (make_cmd.endsWith("\""))
- make_cmd = make_cmd.remove(make_cmd.length()-1,1);
-
- qmake_cmd = qmakeCmd;
- // also not sure if i need this, but it doesn't hurt...
- if(qmake_cmd.length() >= 2 && (qmake_cmd.at(0) == '"' || qmake_cmd.at(0) == '\'') && qmake_cmd.at(qmake_cmd.length()-1) == qmake_cmd.at(0))
- qmake_cmd = qmake_cmd.mid(1, qmake_cmd.length()-2);
+ environment_.clear();
}
-bool TestCompiler::cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt )
+void TestCompiler::addToEnvironment( QString varAssignment )
{
- QDir D(workPath);
- if (!D.exists()) {
-
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
- }
-
- D.setCurrent(workPath);
- // must delete at least the executable file to be able to easily and safely
- // verify that the compilation was a success.
- D.remove( destPath + "/" + exeName + exeExt );
- D.remove( workPath + "/Makefile");
- QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("clean");
-
- return runChild( FALSE, args, 0 );
- }
-
- return TRUE;
+ environment_.push_back(varAssignment);
}
bool TestCompiler::makeClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
-
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("clean");
+ if (Fi.exists())
+ // Run make clean
+ return runCommand( makeCmd_ + " clean" );
- return runChild( FALSE, args, 0 );
- }
-
- return TRUE;
+ return true;
}
bool TestCompiler::makeDistClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
- // Run make distclean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("distclean");
-
- return runChild( FALSE, args, 0 );
- }
+ if (Fi.exists())
+ // Run make distclean
+ return runCommand( makeCmd_ + " distclean" );
- return TRUE;
+ return true;
}
bool TestCompiler::qmake( const QString &workDir, const QString &proName, const QString &buildDir )
{
- // Now start qmake and generate the makefile
-
- QDir D( workDir );
- // Make sure we start in the right directory
+ QDir D;
D.setCurrent( workDir );
if (D.exists("Makefile"))
- D.remove("Makefile");
-
- QStringList args;
- args = QStringList::split( " ", qmake_cmd );
+ D.remove("Makefile");
- QString project_fname = workDir + "/" + proName + ".pro";
- QString makefile_fname = (buildDir.isNull()?QString():(buildDir + "/")) + "Makefile";
+ QString projectFile = proName;
+ QString makeFile = buildDir;
+ if (!projectFile.endsWith(".pro"))
+ projectFile += ".pro";
+ if (!makeFile.isEmpty() && !makeFile.endsWith('/'))
+ makeFile += '/';
+ makeFile += "Makefile";
- args.append( project_fname );
- args.append( "-o" );
- args.append( makefile_fname );
-
- return runChild( TRUE, args, 0 );
+ // Now start qmake and generate the makefile
+ return runCommand( qmakeCmd_ + " " + projectFile + " -o " + makeFile );
}
bool TestCompiler::make( const QString &workPath, const QString &target )
@@ -355,14 +239,13 @@ bool TestCompiler::make( const QString &workPath, const QString &target )
QDir D;
D.setCurrent( workPath );
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- if ( make_cmd.lower().find("nmake") >= 0)
- args.append("/NOLOGO");
- if ( !target.isNull() )
- args.append(target);
+ QString cmdline = makeCmd_;
+ if ( cmdline.contains("nmake", Qt::CaseInsensitive) )
+ cmdline.append(" /NOLOGO");
+ if ( !target.isEmpty() )
+ cmdline += " " + target;
- return runChild( TRUE, args, 0 );
+ return runCommand( cmdline );
}
bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version )
@@ -371,20 +254,12 @@ bool TestCompiler::exists( const QString &destDir, const QString &exeName, Build
return f.exists();
}
-void TestCompiler::addMakeResult( const QString &result )
-{
- make_result.append( result );
-}
-
bool TestCompiler::removeMakefile( const QString &workPath )
{
QDir D;
D.setCurrent( workPath );
if ( D.exists( "Makefile" ) )
- return D.remove( "Makefile" );
+ return D.remove( "Makefile" );
else
- return TRUE;
+ return true;
}
-
-#endif //QT3_SUPPORT
-
diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h
index 597d440..41e5177 100644
--- a/tests/auto/qmake/testcompiler.h
+++ b/tests/auto/qmake/testcompiler.h
@@ -41,33 +41,22 @@
#ifndef TESTCOMPILER_H
#define TESTCOMPILER_H
-
-#ifdef QT3_SUPPORT
-
-#include <qobject.h>
-#include <qstringlist.h>
-
-QT_FORWARD_DECLARE_CLASS(Q3Process)
-
-#define COMPILE_ERROR "Compile error"
-#define COMPILE_SUCCESS "Compile successfull"
-#define COMPILE_NOT_AVAIL "Binary not available for testing"
-#define SELF_TEST "self-test"
+#include <QObject>
+#include <QStringList>
enum BuildType { Exe, Dll, Lib, Plain };
class TestCompiler : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
TestCompiler();
virtual ~TestCompiler();
- void setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode );
-
- // builds a complete project, e.g. qmake, make clean, make and exists.
- bool buildProject( const QString &project, BuildType buildType, const QString &targetName, const QString &destPath, const QString &version );
+ void setBaseCommands( QString makeCmd, QString qmakeCmd );
+ void resetEnvironment();
+ void addToEnvironment( QString varAssignment );
// executes a make clean in the specified workPath
bool makeClean( const QString &workPath );
@@ -77,34 +66,20 @@ public:
bool qmake( const QString &workDir, const QString &proName, const QString &buildDir = QString() );
// executes a make in the specified workPath, with an optional target (eg. install)
bool make( const QString &workPath, const QString &target = QString() );
- // executes a make clean and then deletes the makefile in workpath + deletes the executable
- // in destPath.
- bool cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt );
// checks if the executable exists in destDir
bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version );
// removes the makefile
bool removeMakefile( const QString &workPath );
private:
- QString make_cmd;
- QString qmake_cmd;
-
- Q3Process *childProc;
- QStringList env_list;
+ bool runCommand( QString cmdLine );
- bool child_show;
- bool qws_mode;
- bool exit_ok;
-
-private:
- bool runChild( bool showOutput, QStringList argList, QStringList *envList );
- void addMakeResult( const QString &result );
- QStringList make_result;
+ QString makeCmd_;
+ QString qmakeCmd_;
+ QStringList environment_;
-private slots:
- void childReady();
- void childHasData();
+ // need to make this available somewhere
+ QStringList testOutput_;
};
-#endif // QT3_SUPPORT
#endif // TESTCOMPILER_H
diff --git a/tests/auto/qmake/testdata/shadow_files_build/README b/tests/auto/qmake/testdata/shadow_files_build/README
index 46017fc..15e48c0 100644
--- a/tests/auto/qmake/testdata/shadow_files_build/README
+++ b/tests/auto/qmake/testdata/shadow_files_build/README
@@ -1 +1 @@
-Here to ensure include_dir_build exists
+Here to ensure shadow_files_build exists, used by the shadow_files test.
diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp
index facf0bb..70f1f3c 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -39,21 +39,13 @@
**
****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#if !defined(QMAKE_CROSS_COMPILED) && defined(QT3_SUPPORT)
-
-#include <qdir.h>
-#include <qprocess.h>
-
+#if !defined(QMAKE_CROSS_COMPILED)
#include "testcompiler.h"
-#include <stdlib.h>
-
-//TESTED_CLASS=
-//TESTED_FILES=corelib/tools/qlocale.h corelib/tools/qlocale.cpp
+#include <QObject>
+#include <QDir>
+#include <QtTest/QtTest>
class tst_qmake : public QObject
{
@@ -63,12 +55,12 @@ public:
tst_qmake();
virtual ~tst_qmake();
-
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
+
private slots:
void simple_app();
void simple_lib();
@@ -104,16 +96,16 @@ tst_qmake::tst_qmake()
{
QString cmd = QString("qmake \"QT_VERSION=%1\"").arg(QT_VERSION);
#ifdef Q_CC_MSVC
- test_compiler.setBaseCommands( "nmake", cmd, FALSE );
+ test_compiler.setBaseCommands( "nmake", cmd );
#elif defined(Q_CC_MINGW)
- test_compiler.setBaseCommands( "mingw32-make", cmd, FALSE );
+ test_compiler.setBaseCommands( "mingw32-make", cmd );
#elif defined(Q_OS_WIN) && defined(Q_CC_GNU)
- test_compiler.setBaseCommands( "mmmake", cmd, FALSE );
+ test_compiler.setBaseCommands( "mmmake", cmd );
#else
- test_compiler.setBaseCommands( "make", cmd, FALSE );
+ test_compiler.setBaseCommands( "make", cmd );
#endif
QDir dir;
- base_path = dir.currentDirPath();
+ base_path = dir.currentPath();
}
tst_qmake::~tst_qmake()
@@ -255,10 +247,10 @@ void tst_qmake::duplicateLibraryEntries()
void tst_qmake::export_across_file_boundaries()
{
// This relies on features so we need to set the QMAKEFEATURES environment variable
- putenv("QMAKEFEATURES=.");
+ test_compiler.addToEnvironment("QMAKEFEATURES=.");
QString workDir = base_path + "/testdata/export_across_file_boundaries";
QVERIFY( test_compiler.qmake( workDir, "foo" ));
- putenv("QMAKEFEATURES=");
+ test_compiler.resetEnvironment();
}
void tst_qmake::include_dir()
@@ -406,7 +398,7 @@ void tst_qmake::bundle_spaces()
// make (-n).
TestCompiler local_tc;
- local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++", FALSE);
+ local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++");
QVERIFY( local_tc.qmake(workDir, "bundle-spaces") );
diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp
index 24e7ca9..89060bd 100644
--- a/tools/assistant/tools/assistant/contentwindow.cpp
+++ b/tools/assistant/tools/assistant/contentwindow.cpp
@@ -132,7 +132,7 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
qobject_cast<QHelpContentModel*>(m_contentWidget->model());
if (contentModel) {
QHelpContentItem *itm = contentModel->contentItemAt(index);
- if (itm)
+ if (itm && !isPdfFile(itm))
CentralWidget::instance()->setSourceInNewTab(itm->url());
}
}
@@ -146,16 +146,19 @@ void ContentWindow::showContextMenu(const QPoint &pos)
if (!m_contentWidget->indexAt(pos).isValid())
return;
- QMenu menu;
- QAction *curTab = menu.addAction(tr("Open Link"));
- QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
- menu.move(m_contentWidget->mapToGlobal(pos));
-
QHelpContentModel *contentModel =
qobject_cast<QHelpContentModel*>(m_contentWidget->model());
QHelpContentItem *itm =
contentModel->contentItemAt(m_contentWidget->currentIndex());
+ QMenu menu;
+ QAction *curTab = menu.addAction(tr("Open Link"));
+ QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
+ if (isPdfFile(itm))
+ newTab->setEnabled(false);
+
+ menu.move(m_contentWidget->mapToGlobal(pos));
+
QAction *action = menu.exec();
if (curTab == action)
emit linkActivated(itm->url());
@@ -175,4 +178,10 @@ void ContentWindow::itemClicked(const QModelIndex &index)
}
}
+bool ContentWindow::isPdfFile(QHelpContentItem *item) const
+{
+ const QString &path = item->url().path();
+ return path.endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive);
+}
+
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/contentwindow.h b/tools/assistant/tools/assistant/contentwindow.h
index ab8f8dd..ddc3e7c 100644
--- a/tools/assistant/tools/assistant/contentwindow.h
+++ b/tools/assistant/tools/assistant/contentwindow.h
@@ -49,6 +49,7 @@
QT_BEGIN_NAMESPACE
class QHelpEngine;
+class QHelpContentItem;
class QHelpContentWidget;
class ContentWindow : public QWidget
@@ -75,6 +76,7 @@ private:
void focusInEvent(QFocusEvent *e);
void keyPressEvent(QKeyEvent *e);
bool eventFilter(QObject *o, QEvent *e);
+ bool isPdfFile(QHelpContentItem *item) const;
QHelpEngine *m_helpEngine;
QHelpContentWidget *m_contentWidget;
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index 6b049e8..f7225fa 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -164,6 +164,7 @@ public:
protected:
virtual QWebPage *createWindow(QWebPage::WebWindowType);
+ virtual void triggerAction(WebAction action, bool checked = false);
virtual bool acceptNavigationRequest(QWebFrame *frame,
const QNetworkRequest &request, NavigationType type);
@@ -171,16 +172,30 @@ protected:
private:
CentralWidget *centralWidget;
QHelpEngine *helpEngine;
+ bool closeNewTabIfNeeded;
+
+ friend class HelpViewer;
+ Qt::MouseButtons m_pressedButtons;
+ Qt::KeyboardModifiers m_keyboardModifiers;
};
HelpPage::HelpPage(CentralWidget *central, QHelpEngine *engine, QObject *parent)
- : QWebPage(parent), centralWidget(central), helpEngine(engine)
+ : QWebPage(parent)
+ , centralWidget(central)
+ , helpEngine(engine)
+ , closeNewTabIfNeeded(false)
+ , m_pressedButtons(Qt::NoButton)
+ , m_keyboardModifiers(Qt::NoModifier)
{
}
QWebPage *HelpPage::createWindow(QWebPage::WebWindowType)
{
- return centralWidget->newEmptyTab()->page();
+ HelpPage* newPage = static_cast<HelpPage*>(centralWidget->newEmptyTab()->page());
+ if (newPage)
+ newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
+ closeNewTabIfNeeded = false;
+ return newPage;
}
static bool isLocalUrl(const QUrl &url)
@@ -196,10 +211,24 @@ static bool isLocalUrl(const QUrl &url)
return false;
}
+void HelpPage::triggerAction(WebAction action, bool checked)
+{
+ switch (action) {
+ case OpenLinkInNewWindow:
+ closeNewTabIfNeeded = true;
+ default: // fall through
+ QWebPage::triggerAction(action, checked);
+ break;
+ }
+}
+
bool HelpPage::acceptNavigationRequest(QWebFrame *,
- const QNetworkRequest &request, QWebPage::NavigationType)
+ const QNetworkRequest &request, QWebPage::NavigationType type)
{
const QUrl &url = request.url();
+ const bool closeNewTab = closeNewTabIfNeeded;
+ closeNewTabIfNeeded = false;
+
if (isLocalUrl(url)) {
const QString& path = url.path();
if (path.endsWith(QLatin1String(".pdf"))) {
@@ -216,8 +245,22 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
tmpFile.close();
}
QDesktopServices::openUrl(QUrl(tmpFile.fileName()));
+
+ if (closeNewTab)
+ QMetaObject::invokeMethod(CentralWidget::instance(), "closeTab");
return false;
}
+
+ if (type == QWebPage::NavigationTypeLinkClicked
+ && (m_keyboardModifiers & Qt::ControlModifier
+ || m_pressedButtons == Qt::MidButton)) {
+ HelpViewer* viewer = centralWidget->newEmptyTab();
+ if (viewer)
+ CentralWidget::instance()->setSource(url);
+ m_pressedButtons = Qt::NoButton;
+ m_keyboardModifiers = Qt::NoModifier;
+ return false;
+ }
return true;
}
@@ -332,6 +375,16 @@ void HelpViewer::actionChanged()
emit forwardAvailable(a->isEnabled());
}
+void HelpViewer::mousePressEvent(QMouseEvent *event)
+{
+ HelpPage *currentPage = static_cast<HelpPage*>(page());
+ if (currentPage) {
+ currentPage->m_pressedButtons = event->buttons();
+ currentPage->m_keyboardModifiers = event->modifiers();
+ }
+ QWebView::mousePressEvent(event);
+}
+
#else // !defined(QT_NO_WEBKIT)
HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h
index af5c197..eea7340 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -107,6 +107,7 @@ Q_SIGNALS:
protected:
virtual void wheelEvent(QWheelEvent *);
void mouseReleaseEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *event);
private Q_SLOTS:
void actionChanged();
diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp
index 4bd6f4f..0beb5ee 100644
--- a/tools/assistant/tools/assistant/indexwindow.cpp
+++ b/tools/assistant/tools/assistant/indexwindow.cpp
@@ -189,13 +189,20 @@ void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
if (model) {
QString keyword = model->data(index, Qt::DisplayRole).toString();
QMap<QString, QUrl> links = model->linksForKeyword(keyword);
+
+ QUrl url;
if (links.count() > 1) {
TopicChooser tc(this, keyword, links);
- if (tc.exec() == QDialog::Accepted)
- CentralWidget::instance()->setSourceInNewTab(tc.link());
+ if (tc.exec() == QDialog::Accepted)
+ url = tc.link();
} else if (links.count() == 1) {
- CentralWidget::instance()->setSourceInNewTab(links.constBegin().value());
+ url = links.constBegin().value();
}
+
+ if (url.path().endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive))
+ CentralWidget::instance()->setSource(url);
+ else
+ CentralWidget::instance()->setSourceInNewTab(url);
}
}
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 8a21409..bdc6c9a 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -205,6 +205,7 @@ int main(int argc, char *argv[])
qWarning() << qPrintable(cd.error());
return 2;
}
+ Translator::reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose);
for (int i = 1; i < inFiles.size(); ++i) {
Translator tr2;
@@ -212,6 +213,7 @@ int main(int argc, char *argv[])
qWarning() << qPrintable(cd.error());
return 2;
}
+ Translator::reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose);
for (int j = 0; j < tr2.messageCount(); ++j)
tr.replaceSorted(tr2.message(j));
}
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index b049ab9..7a8063b 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -209,19 +209,19 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent
return false;
}
- QList<TranslatorMessage> dupes = tor.findDuplicates();
+ QSet<TranslatorMessagePtr> dupes = tor.resolveDuplicates();
if (!dupes.isEmpty()) {
QString err = tr("<qt>Duplicate messages found in '%1':").arg(Qt::escape(fileName));
int numdups = 0;
- foreach (const TranslatorMessage &msg, dupes) {
+ foreach (const TranslatorMessagePtr &msg, dupes) {
if (++numdups >= 5) {
err += tr("<p>[more duplicates omitted]");
break;
}
err += tr("<p>* Context: %1<br>* Source: %2")
- .arg(Qt::escape(msg.context()), Qt::escape(msg.sourceText()));
- if (!msg.comment().isEmpty())
- err += tr("<br>* Comment: %3").arg(Qt::escape(msg.comment()));
+ .arg(Qt::escape(msg->context()), Qt::escape(msg->sourceText()));
+ if (!msg->comment().isEmpty())
+ err += tr("<br>* Comment: %3").arg(Qt::escape(msg->comment()));
}
QMessageBox::warning(parent, QObject::tr("Qt Linguist"), err);
}
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index 0440325..7d0452f 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -93,19 +93,6 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo
} else {
if (!cd.errors().isEmpty())
printOut(cd.error());
- const QList<TranslatorMessage> dupes = tor.findDuplicates();
- if (!dupes.isEmpty()) {
- qWarning("lrelease error: duplicate messages found in '%s':",
- qPrintable(tsFileName));
- foreach (const TranslatorMessage &msg, dupes) {
- qWarning("\n* Context: %s\n* Source: %s",
- qPrintable(msg.context()),
- qPrintable(msg.sourceText()));
- if (!msg.comment().isEmpty())
- qWarning("\n* Comment: %s", qPrintable(msg.comment()));
- }
- ok = false;
- }
}
return ok;
}
@@ -114,6 +101,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
bool verbose, bool ignoreUnfinished,
bool removeIdentical, TranslatorSaveMode mode)
{
+ Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, verbose);
+
if (verbose)
printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName));
if (removeIdentical) {
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index b241857..8a70b55 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -150,6 +150,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil
*fail = true;
continue;
}
+ tor.resolveDuplicates();
cd.clearErrors();
if (!codecForTr.isEmpty() && codecForTr != tor.codecName())
qWarning("lupdate warning: Codec for tr() '%s' disagrees with "
diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp
index 173b46e..ec69156 100644
--- a/tools/linguist/shared/profileevaluator.cpp
+++ b/tools/linguist/shared/profileevaluator.cpp
@@ -258,8 +258,12 @@ bool ProFileEvaluator::Private::read(ProFile *pro)
return false;
}
+ m_block = 0;
+ m_commentItem = 0;
+ m_contNextLine = false;
m_syntaxError = false;
m_lineNo = 1;
+ m_blockstack.clear();
m_blockstack.push(pro);
QTextStream ts(&file);
@@ -1204,9 +1208,10 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex
QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &func, const QString &arguments)
{
QStringList argumentsList = split_arg_list(arguments);
+
QStringList args;
for (int i = 0; i < argumentsList.count(); ++i)
- args += expandVariableReferences(argumentsList[i]);
+ args += expandVariableReferences(argumentsList[i]).join(Option::field_sep);
enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST,
E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
@@ -1693,10 +1698,11 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
for (int mut = 0; mut < mutuals.count(); mut++) {
if (configs[i] == mutuals[mut].trimmed()) {
cond = (configs[i] == args[0]);
- break;
+ goto done_T_CONFIG;
}
}
}
+ done_T_CONFIG:
break;
}
case T_CONTAINS: {
@@ -1723,12 +1729,12 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
for (int mut = 0; mut < mutuals.count(); mut++) {
if (val == mutuals[mut].trimmed()) {
cond = (regx.exactMatch(val) || val == args[1]);
- break;
+ goto done_T_CONTAINS;
}
}
}
}
-
+ done_T_CONTAINS:
break;
}
case T_COUNT: {
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index d19b519..5563ac5 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -659,7 +659,6 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
msg.setComment(comment);
translator.append(msg);
}
- translator.resolveDualEncoded();
return ok;
}
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index 3721204..312bb71 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -416,38 +416,52 @@ void Translator::dropTranslations()
}
}
-QList<TranslatorMessage> Translator::findDuplicates() const
+QSet<TranslatorMessagePtr> Translator::resolveDuplicates()
{
- QHash<TranslatorMessage, int> dups;
- foreach (const TranslatorMessage &msg, m_messages)
- dups[msg]++;
- QList<TranslatorMessage> ret;
- QHash<TranslatorMessage, int>::ConstIterator it = dups.constBegin(), end = dups.constEnd();
- for (; it != end; ++it)
- if (it.value() > 1)
- ret.append(it.key());
- return ret;
-}
-
-void Translator::resolveDualEncoded()
-{
- QHash<TranslatorMessage, int> dups;
+ QSet<TranslatorMessagePtr> dups;
+ QHash<TranslatorMessagePtr, int> refs;
for (int i = 0; i < m_messages.count();) {
const TranslatorMessage &msg = m_messages.at(i);
- QHash<TranslatorMessage, int>::ConstIterator it = dups.constFind(msg);
- if (it != dups.constEnd()) {
+ QHash<TranslatorMessagePtr, int>::ConstIterator it = refs.constFind(msg);
+ if (it != refs.constEnd()) {
TranslatorMessage &omsg = m_messages[*it];
if (omsg.isUtf8() != msg.isUtf8() && !omsg.isNonUtf8()) {
+ // Dual-encoded message
omsg.setUtf8(true);
omsg.setNonUtf8(true);
- m_messages.removeAt(i);
- continue;
+ } else {
+ // Duplicate
+ dups.insert(omsg);
}
- // Regular dupe; will complain later
+ if (!omsg.isTranslated() && msg.isTranslated())
+ omsg.setTranslations(msg.translations());
+ m_messages.removeAt(i);
} else {
- dups[msg] = i;
+ refs[msg] = i;
+ ++i;
+ }
+ }
+ return dups;
+}
+
+void Translator::reportDuplicates(const QSet<TranslatorMessagePtr> &dupes,
+ const QString &fileName, bool verbose)
+{
+ if (!dupes.isEmpty()) {
+ if (!verbose) {
+ qWarning("Warning: dropping duplicate messages in '%s'\n(try -verbose for more info).",
+ qPrintable(fileName));
+ } else {
+ qWarning("Warning: dropping duplicate messages in '%s':", qPrintable(fileName));
+ foreach (const TranslatorMessagePtr &msg, dupes) {
+ qWarning("\n* Context: %s\n* Source: %s",
+ qPrintable(msg->context()),
+ qPrintable(msg->sourceText()));
+ if (!msg->comment().isEmpty())
+ qWarning("* Comment: %s", qPrintable(msg->comment()));
+ }
+ qWarning();
}
- ++i;
}
}
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index 0f83c1d..4e97000 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -132,9 +132,10 @@ public:
void stripNonPluralForms();
void stripIdenticalSourceTranslations();
void dropTranslations();
- QList<TranslatorMessage> findDuplicates() const;
- void resolveDualEncoded();
void makeFileNamesAbsolute(const QDir &originalPath);
+ QSet<TranslatorMessagePtr> resolveDuplicates();
+ static void reportDuplicates(const QSet<TranslatorMessagePtr> &dupes,
+ const QString &fileName, bool verbose);
void setCodecName(const QByteArray &name);
QByteArray codecName() const { return m_codecName; }
diff --git a/tools/linguist/shared/translatormessage.h b/tools/linguist/shared/translatormessage.h
index 363019e..7d31925 100644
--- a/tools/linguist/shared/translatormessage.h
+++ b/tools/linguist/shared/translatormessage.h
@@ -179,6 +179,32 @@ Q_DECLARE_TYPEINFO(TranslatorMessage, Q_MOVABLE_TYPE);
int qHash(const TranslatorMessage &msg);
+struct TranslatorMessagePtr {
+ TranslatorMessagePtr(const TranslatorMessage &tm)
+ {
+ ptr = &tm;
+ }
+
+ inline const TranslatorMessage *operator->() const
+ {
+ return ptr;
+ }
+
+ const TranslatorMessage *ptr;
+};
+
+Q_DECLARE_TYPEINFO(TranslatorMessagePtr, Q_MOVABLE_TYPE);
+
+static inline int qHash(TranslatorMessagePtr tmp)
+{
+ return qHash(*tmp.ptr);
+}
+
+static inline bool operator==(TranslatorMessagePtr tmp1, TranslatorMessagePtr tmp2)
+{
+ return *tmp1.ptr == *tmp2.ptr;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_TRANSLATION
diff --git a/tools/linguist/shared/ts.cpp b/tools/linguist/shared/ts.cpp
index 8a6d365..22f2a1b 100644
--- a/tools/linguist/shared/ts.cpp
+++ b/tools/linguist/shared/ts.cpp
@@ -242,7 +242,7 @@ bool TSReader::read(Translator &translator)
STRING(userdata);
STRING(utf8);
STRING(value);
- STRING(version);
+ //STRING(version);
STRING(yes);
static const QString strextrans(QLatin1String("extra-"));
@@ -266,15 +266,13 @@ bool TSReader::read(Translator &translator)
QString currentFile;
QXmlStreamAttributes atts = attributes();
- QString version = atts.value(strversion).toString();
+ //QString version = atts.value(strversion).toString();
translator.setLanguageCode(atts.value(strlanguage).toString());
translator.setSourceLanguageCode(atts.value(strsourcelanguage).toString());
while (!atEnd()) {
readNext();
if (isEndElement()) {
// </TS> found, finish local loop
- if (version == QLatin1String("1.1"))
- translator.resolveDualEncoded();
break;
} else if (isWhiteSpace()) {
// ignore these, just whitespace
diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit
index 3b513b4..701133e 100755
--- a/util/webkit/mkdist-webkit
+++ b/util/webkit/mkdist-webkit
@@ -252,7 +252,7 @@ echo "generating extra sources"
mkdir tmp &&
cd tmp &&
mkdir -p ../generated &&
- qmake -o Makefile QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated OUTPUT_DIR=`pwd` ../$proj.pro &&
+ qmake -o Makefile CONFIG-=QTDIR_build QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated OUTPUT_DIR=`pwd` ../$proj.pro &&
make generated_files &&
perl -pi -e "s,$absSrcDir/,,g" ../generated/*.cpp ../generated/*.h &&
git add ../generated &&