summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-06-30 09:21:56 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-06-30 09:21:56 (GMT)
commit197df24edfe095a10e2bf65116796e027fea44e2 (patch)
tree4ffb08f614b550298663f90297c9e559ecb47a3c /tools/linguist
parent1e84894225e31adf80a7a33da7f655fb5c38ea0e (diff)
parente3c1039d4d10aa383a1f681e7dd9c1129d22d8ca (diff)
downloadQt-197df24edfe095a10e2bf65116796e027fea44e2.zip
Qt-197df24edfe095a10e2bf65116796e027fea44e2.tar.gz
Qt-197df24edfe095a10e2bf65116796e027fea44e2.tar.bz2
Merge commit 'qt/master-stable' into 4.6-merged
Conflicts: .gitignore configure.exe src/corelib/concurrent/qtconcurrentthreadengine.h src/corelib/global/qnamespace.h src/gui/graphicsview/qgraphicssceneevent.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qapplication_p.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qwidget.h src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontdatabase.cpp src/network/access/qnetworkaccesshttpbackend.cpp tests/auto/network-settings.h tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro tests/auto/qvariant/tst_qvariant.cpp
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/lconvert/main.cpp14
-rw-r--r--tools/linguist/linguist/batchtranslation.ui8
-rw-r--r--tools/linguist/linguist/batchtranslationdialog.cpp4
-rw-r--r--tools/linguist/linguist/batchtranslationdialog.h4
-rw-r--r--tools/linguist/linguist/errorsview.cpp4
-rw-r--r--tools/linguist/linguist/errorsview.h4
-rw-r--r--tools/linguist/linguist/finddialog.cpp4
-rw-r--r--tools/linguist/linguist/finddialog.h4
-rw-r--r--tools/linguist/linguist/finddialog.ui4
-rw-r--r--tools/linguist/linguist/formpreviewview.cpp4
-rw-r--r--tools/linguist/linguist/formpreviewview.h4
-rw-r--r--tools/linguist/linguist/globals.cpp55
-rw-r--r--tools/linguist/linguist/globals.h50
-rw-r--r--tools/linguist/linguist/images/minus.pngbin0 -> 296 bytes
-rw-r--r--tools/linguist/linguist/images/plus.pngbin0 -> 383 bytes
-rw-r--r--tools/linguist/linguist/linguist.pro3
-rw-r--r--tools/linguist/linguist/linguist.qrc2
-rw-r--r--tools/linguist/linguist/main.cpp9
-rw-r--r--tools/linguist/linguist/mainwindow.cpp65
-rw-r--r--tools/linguist/linguist/mainwindow.h6
-rw-r--r--tools/linguist/linguist/mainwindow.ui35
-rw-r--r--tools/linguist/linguist/messageeditor.cpp333
-rw-r--r--tools/linguist/linguist/messageeditor.h43
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.cpp263
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.h62
-rw-r--r--tools/linguist/linguist/messagehighlighter.cpp4
-rw-r--r--tools/linguist/linguist/messagehighlighter.h4
-rw-r--r--tools/linguist/linguist/messagemodel.cpp4
-rw-r--r--tools/linguist/linguist/messagemodel.h4
-rw-r--r--tools/linguist/linguist/phrase.cpp4
-rw-r--r--tools/linguist/linguist/phrase.h4
-rw-r--r--tools/linguist/linguist/phrasebookbox.cpp4
-rw-r--r--tools/linguist/linguist/phrasebookbox.h4
-rw-r--r--tools/linguist/linguist/phrasebookbox.ui4
-rw-r--r--tools/linguist/linguist/phrasemodel.cpp4
-rw-r--r--tools/linguist/linguist/phrasemodel.h4
-rw-r--r--tools/linguist/linguist/phraseview.cpp7
-rw-r--r--tools/linguist/linguist/phraseview.h4
-rw-r--r--tools/linguist/linguist/printout.cpp4
-rw-r--r--tools/linguist/linguist/printout.h4
-rw-r--r--tools/linguist/linguist/recentfiles.cpp9
-rw-r--r--tools/linguist/linguist/recentfiles.h4
-rw-r--r--tools/linguist/linguist/sourcecodeview.cpp4
-rw-r--r--tools/linguist/linguist/sourcecodeview.h4
-rw-r--r--tools/linguist/linguist/statistics.cpp4
-rw-r--r--tools/linguist/linguist/statistics.h4
-rw-r--r--tools/linguist/linguist/statistics.ui4
-rw-r--r--tools/linguist/linguist/translatedialog.cpp4
-rw-r--r--tools/linguist/linguist/translatedialog.h4
-rw-r--r--tools/linguist/linguist/translatedialog.ui4
-rw-r--r--tools/linguist/linguist/translationsettingsdialog.cpp4
-rw-r--r--tools/linguist/linguist/translationsettingsdialog.h4
-rw-r--r--tools/linguist/lrelease/lrelease.149
-rw-r--r--tools/linguist/lrelease/lrelease.pro2
-rw-r--r--tools/linguist/lrelease/main.cpp4
-rw-r--r--tools/linguist/lupdate/cpp.cpp8
-rw-r--r--tools/linguist/lupdate/java.cpp4
-rw-r--r--tools/linguist/lupdate/lupdate.141
-rw-r--r--tools/linguist/lupdate/lupdate.h4
-rw-r--r--tools/linguist/lupdate/main.cpp4
-rw-r--r--tools/linguist/lupdate/merge.cpp4
-rw-r--r--tools/linguist/lupdate/qscript.cpp4
-rw-r--r--tools/linguist/lupdate/qscript.g4
-rw-r--r--tools/linguist/lupdate/ui.cpp4
-rw-r--r--tools/linguist/phrasebooks/russian.qph127
-rw-r--r--tools/linguist/shared/abstractproitemvisitor.h4
-rw-r--r--tools/linguist/shared/numerus.cpp5
-rw-r--r--tools/linguist/shared/po.cpp14
-rw-r--r--tools/linguist/shared/profileevaluator.cpp4
-rw-r--r--tools/linguist/shared/profileevaluator.h4
-rw-r--r--tools/linguist/shared/proitems.cpp4
-rw-r--r--tools/linguist/shared/proitems.h9
-rw-r--r--tools/linguist/shared/proparserutils.h4
-rw-r--r--tools/linguist/shared/qm.cpp37
-rw-r--r--tools/linguist/shared/qph.cpp33
-rw-r--r--tools/linguist/shared/simtexth.cpp4
-rw-r--r--tools/linguist/shared/simtexth.h4
-rw-r--r--tools/linguist/shared/translator.cpp5
-rw-r--r--tools/linguist/shared/translator.h10
-rw-r--r--tools/linguist/shared/translatormessage.cpp4
-rw-r--r--tools/linguist/shared/translatormessage.h4
-rw-r--r--tools/linguist/shared/ts.cpp10
-rw-r--r--tools/linguist/shared/xliff.cpp11
-rw-r--r--tools/linguist/tests/tst_lupdate.cpp2
-rw-r--r--tools/linguist/tests/tst_simtexth.cpp2
85 files changed, 1068 insertions, 465 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index ce17b6f..534bc11 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -80,6 +80,9 @@ static int usage(const QStringList &args)
" -of <outformat>\n"
" --output-format <outformat>\n"
" Specify output format. See -if.\n\n"
+ " --input-codec <codec>\n"
+ " Specify encoding for .qm input files. Default is 'Latin1'.\n"
+ " UTF-8 is always tried as well, corresponding to the trUtf8() function.\n\n"
" --drop-tags <regexp>\n"
" Drop named extra tags when writing 'ts' or 'xlf' files.\n"
" May be specified repeatedly.\n\n"
@@ -99,7 +102,7 @@ static int usage(const QStringList &args)
" Drop finished messages.\n\n"
" --locations {absolute|relative|none}\n"
" Override how source code references are saved in ts files.\n"
- " Default is absolute.\n}n"
+ " Default is absolute.\n\n"
" --no-ui-lines\n"
" Drop line numbers from references to .ui files.\n\n"
" --verbose\n"
@@ -138,6 +141,7 @@ int main(int argc, char *argv[])
Translator::LocationsType locations = Translator::DefaultLocations;
ConversionData cd;
+ cd.m_codecForSource = "Latin1";
Translator tr;
for (int i = 1; i < args.size(); ++i) {
@@ -166,6 +170,10 @@ int main(int argc, char *argv[])
if (++i >= args.size())
return usage(args);
inFormat = args[i];
+ } else if (args[i] == QLatin1String("-input-codec")) {
+ if (++i >= args.size())
+ return usage(args);
+ cd.m_codecForSource = args[i].toLatin1();
} else if (args[i] == QLatin1String("-drop-tag")) {
if (++i >= args.size())
return usage(args);
diff --git a/tools/linguist/linguist/batchtranslation.ui b/tools/linguist/linguist/batchtranslation.ui
index 4824dfb..0f7fe4b 100644
--- a/tools/linguist/linguist/batchtranslation.ui
+++ b/tools/linguist/linguist/batchtranslation.ui
@@ -3,7 +3,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -36,7 +36,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
*********************************************************************</comment>
@@ -104,7 +104,7 @@
<item>
<widget class="QCheckBox" name="ckTranslateFinished">
<property name="toolTip">
- <string>Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked.</string>
+ <string>Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked</string>
</property>
<property name="text">
<string>Translate also finished entries</string>
@@ -189,7 +189,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
- <string>The batch translator will search through the selected phrase books in the order given above.</string>
+ <string>The batch translator will search through the selected phrase books in the order given above</string>
</property>
<property name="wordWrap">
<bool>true</bool>
diff --git a/tools/linguist/linguist/batchtranslationdialog.cpp b/tools/linguist/linguist/batchtranslationdialog.cpp
index 101ad97..c8d1dde 100644
--- a/tools/linguist/linguist/batchtranslationdialog.cpp
+++ b/tools/linguist/linguist/batchtranslationdialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/batchtranslationdialog.h b/tools/linguist/linguist/batchtranslationdialog.h
index 1ceeb6e..58f9d3c 100644
--- a/tools/linguist/linguist/batchtranslationdialog.h
+++ b/tools/linguist/linguist/batchtranslationdialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/errorsview.cpp b/tools/linguist/linguist/errorsview.cpp
index 9ffebaa..fec1df9 100644
--- a/tools/linguist/linguist/errorsview.cpp
+++ b/tools/linguist/linguist/errorsview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/errorsview.h b/tools/linguist/linguist/errorsview.h
index bc6097b..af3417c 100644
--- a/tools/linguist/linguist/errorsview.h
+++ b/tools/linguist/linguist/errorsview.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/finddialog.cpp b/tools/linguist/linguist/finddialog.cpp
index ae243ea..d78900f 100644
--- a/tools/linguist/linguist/finddialog.cpp
+++ b/tools/linguist/linguist/finddialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/finddialog.h b/tools/linguist/linguist/finddialog.h
index a9fc146..035fcd8 100644
--- a/tools/linguist/linguist/finddialog.h
+++ b/tools/linguist/linguist/finddialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/finddialog.ui b/tools/linguist/linguist/finddialog.ui
index fd1c4a1..2d7f8dc 100644
--- a/tools/linguist/linguist/finddialog.ui
+++ b/tools/linguist/linguist/finddialog.ui
@@ -3,7 +3,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -36,7 +36,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
*********************************************************************</comment>
diff --git a/tools/linguist/linguist/formpreviewview.cpp b/tools/linguist/linguist/formpreviewview.cpp
index 184f01b..6f8df58 100644
--- a/tools/linguist/linguist/formpreviewview.cpp
+++ b/tools/linguist/linguist/formpreviewview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/formpreviewview.h b/tools/linguist/linguist/formpreviewview.h
index 5923f24..4eb043f 100644
--- a/tools/linguist/linguist/formpreviewview.h
+++ b/tools/linguist/linguist/formpreviewview.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/globals.cpp b/tools/linguist/linguist/globals.cpp
new file mode 100644
index 0000000..03062ba
--- /dev/null
+++ b/tools/linguist/linguist/globals.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Linguist 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://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "globals.h"
+
+const QString &settingsPrefix()
+{
+ static QString prefix = QString(QLatin1String("%1.%2/"))
+ .arg((QT_VERSION >> 16) & 0xff)
+ .arg((QT_VERSION >> 8) & 0xff);
+ return prefix;
+}
+
+QString settingPath(const char *path)
+{
+ return settingsPrefix() + QLatin1String(path);
+}
diff --git a/tools/linguist/linguist/globals.h b/tools/linguist/linguist/globals.h
new file mode 100644
index 0000000..b4bfb9c
--- /dev/null
+++ b/tools/linguist/linguist/globals.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Linguist 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://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GLOBALS_H
+#define GLOBALS_H
+
+#include <QString>
+
+const QString &settingsPrefix();
+QString settingPath(const char *path);
+
+#endif // GLOBALS_H
diff --git a/tools/linguist/linguist/images/minus.png b/tools/linguist/linguist/images/minus.png
new file mode 100644
index 0000000..745b445
--- /dev/null
+++ b/tools/linguist/linguist/images/minus.png
Binary files differ
diff --git a/tools/linguist/linguist/images/plus.png b/tools/linguist/linguist/images/plus.png
new file mode 100644
index 0000000..ef43788
--- /dev/null
+++ b/tools/linguist/linguist/images/plus.png
Binary files differ
diff --git a/tools/linguist/linguist/linguist.pro b/tools/linguist/linguist/linguist.pro
index 968293a..890b252 100644
--- a/tools/linguist/linguist/linguist.pro
+++ b/tools/linguist/linguist/linguist.pro
@@ -26,6 +26,7 @@ SOURCES += \
errorsview.cpp \
finddialog.cpp \
formpreviewview.cpp \
+ globals.cpp \
main.cpp \
mainwindow.cpp \
messageeditor.cpp \
@@ -49,6 +50,7 @@ HEADERS += \
errorsview.h \
finddialog.h \
formpreviewview.h \
+ globals.h \
mainwindow.h \
messageeditor.h \
messageeditorwidgets.h \
@@ -99,6 +101,7 @@ RESOURCES += linguist.qrc
TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/linguist_ja.ts \
$$[QT_INSTALL_TRANSLATIONS]/linguist_pl.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/linguist_ru.ts \
$$[QT_INSTALL_TRANSLATIONS]/linguist_untranslated.ts \
$$[QT_INSTALL_TRANSLATIONS]/linguist_zh_CN.ts \
$$[QT_INSTALL_TRANSLATIONS]/linguist_zh_TW.ts \
diff --git a/tools/linguist/linguist/linguist.qrc b/tools/linguist/linguist/linguist.qrc
index 42cf6e3..a43f0ce 100644
--- a/tools/linguist/linguist/linguist.qrc
+++ b/tools/linguist/linguist/linguist.qrc
@@ -32,6 +32,8 @@
<file>images/up.png</file>
<file>images/down.png</file>
<file>images/editdelete.png</file>
+ <file>images/minus.png</file>
+ <file>images/plus.png</file>
<file>images/win/accelerator.png</file>
<file>images/win/book.png</file>
<file>images/win/doneandnext.png</file>
diff --git a/tools/linguist/linguist/main.cpp b/tools/linguist/linguist/main.cpp
index a6a0d27..e276ff1 100644
--- a/tools/linguist/linguist/main.cpp
+++ b/tools/linguist/linguist/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,12 +34,13 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "mainwindow.h"
+#include "globals.h"
#include <QtCore/QFile>
#include <QtCore/QLibraryInfo>
@@ -92,13 +93,11 @@ int main(int argc, char **argv)
app.setOrganizationName(QLatin1String("Trolltech"));
app.setApplicationName(QLatin1String("Linguist"));
- QString keybase(QString::number( (QT_VERSION >> 16) & 0xff ) +
- QLatin1Char('.') + QString::number( (QT_VERSION >> 8) & 0xff ) + QLatin1Char('/') );
QSettings config;
QWidget tmp;
- tmp.restoreGeometry(config.value(keybase + QLatin1String("Geometry/WindowGeometry")).toByteArray());
+ tmp.restoreGeometry(config.value(settingPath("Geometry/WindowGeometry")).toByteArray());
QSplashScreen *splash = 0;
int screenId = QApplication::desktop()->screenNumber(tmp.geometry().center());
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index f91175d..2b1df39 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,6 +50,7 @@
#include "errorsview.h"
#include "finddialog.h"
#include "formpreviewview.h"
+#include "globals.h"
#include "messageeditor.h"
#include "messagemodel.h"
#include "phrasebookbox.h"
@@ -96,14 +97,6 @@ QT_BEGIN_NAMESPACE
static const int MessageMS = 2500;
-const QString &settingsPrefix()
-{
- static QString prefix = QString(QLatin1String("%1.%2/"))
- .arg((QT_VERSION >> 16) & 0xff)
- .arg((QT_VERSION >> 8) & 0xff);
- return prefix;
-}
-
enum Ending {
End_None,
End_FullStop,
@@ -121,11 +114,10 @@ static bool hasFormPreview(const QString &fileName)
static Ending ending(QString str, QLocale::Language lang)
{
str = str.simplified();
- int ch = 0;
- if (!str.isEmpty())
- ch = str.right(1)[0].unicode();
+ if (str.isEmpty())
+ return End_None;
- switch (ch) {
+ switch (str.at(str.length() - 1).unicode()) {
case 0x002e: // full stop
if (str.endsWith(QLatin1String("...")))
return End_Ellipsis;
@@ -488,6 +480,10 @@ MainWindow::MainWindow()
readConfig();
m_statistics = 0;
+ connect(m_ui.actionLenghtVariants, SIGNAL(toggled(bool)),
+ m_messageEditor, SLOT(setLenghtVariants(bool)));
+ m_messageEditor->setLenghtVariants(m_ui.actionLenghtVariants->isChecked());
+
m_focusWatcher = new FocusWatcher(m_messageEditor, this);
m_contextView->installEventFilter(m_focusWatcher);
m_messageView->installEventFilter(m_focusWatcher);
@@ -2366,6 +2362,13 @@ void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose)
}
QStringList translations = m->translations();
+ // Truncated variants are permitted to be "denormalized"
+ for (int i = 0; i < translations.count(); ++i) {
+ int sep = translations.at(i).indexOf(QChar(Translator::BinaryVariantSeparator));
+ if (sep >= 0)
+ translations[i].truncate(sep);
+ }
+
if (m_ui.actionAccelerators->isChecked()) {
bool sk = !QKeySequence::mnemonic(source).isEmpty();
bool tk = true;
@@ -2494,25 +2497,26 @@ void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose)
void MainWindow::readConfig()
{
- QString keybase = settingsPrefix();
QSettings config;
QRect r(pos(), size());
- restoreGeometry(config.value(keybase + QLatin1String("Geometry/WindowGeometry")).toByteArray());
- restoreState(config.value(keybase + QLatin1String("MainWindowState")).toByteArray());
+ restoreGeometry(config.value(settingPath("Geometry/WindowGeometry")).toByteArray());
+ restoreState(config.value(settingPath("MainWindowState")).toByteArray());
m_ui.actionAccelerators->setChecked(
- config.value(keybase + QLatin1String("Validators/Accelerator"), true).toBool());
+ config.value(settingPath("Validators/Accelerator"), true).toBool());
m_ui.actionEndingPunctuation->setChecked(
- config.value(keybase + QLatin1String("Validators/EndingPunctuation"), true).toBool());
+ config.value(settingPath("Validators/EndingPunctuation"), true).toBool());
m_ui.actionPhraseMatches->setChecked(
- config.value(keybase + QLatin1String("Validators/PhraseMatch"), true).toBool());
+ config.value(settingPath("Validators/PhraseMatch"), true).toBool());
m_ui.actionPlaceMarkerMatches->setChecked(
- config.value(keybase + QLatin1String("Validators/PlaceMarkers"), true).toBool());
+ config.value(settingPath("Validators/PlaceMarkers"), true).toBool());
+ m_ui.actionLenghtVariants->setChecked(
+ config.value(settingPath("Options/LengthVariants"), false).toBool());
recentFiles().readConfig();
- int size = config.beginReadArray(keybase + QLatin1String("OpenedPhraseBooks"));
+ int size = config.beginReadArray(settingPath("OpenedPhraseBooks"));
for (int i = 0; i < size; ++i) {
config.setArrayIndex(i);
openPhraseBook(config.value(QLatin1String("FileName")).toString());
@@ -2522,23 +2526,24 @@ void MainWindow::readConfig()
void MainWindow::writeConfig()
{
- QString keybase = settingsPrefix();
QSettings config;
- config.setValue(keybase + QLatin1String("Geometry/WindowGeometry"),
+ config.setValue(settingPath("Geometry/WindowGeometry"),
saveGeometry());
- config.setValue(keybase + QLatin1String("Validators/Accelerator"),
+ config.setValue(settingPath("Validators/Accelerator"),
m_ui.actionAccelerators->isChecked());
- config.setValue(keybase + QLatin1String("Validators/EndingPunctuation"),
+ config.setValue(settingPath("Validators/EndingPunctuation"),
m_ui.actionEndingPunctuation->isChecked());
- config.setValue(keybase + QLatin1String("Validators/PhraseMatch"),
+ config.setValue(settingPath("Validators/PhraseMatch"),
m_ui.actionPhraseMatches->isChecked());
- config.setValue(keybase + QLatin1String("Validators/PlaceMarkers"),
+ config.setValue(settingPath("Validators/PlaceMarkers"),
m_ui.actionPlaceMarkerMatches->isChecked());
- config.setValue(keybase + QLatin1String("MainWindowState"),
+ config.setValue(settingPath("Options/LengthVariants"),
+ m_ui.actionLenghtVariants->isChecked());
+ config.setValue(settingPath("MainWindowState"),
saveState());
recentFiles().writeConfig();
- config.beginWriteArray(keybase + QLatin1String("OpenedPhraseBooks"),
+ config.beginWriteArray(settingPath("OpenedPhraseBooks"),
m_phraseBooks.size());
for (int i = 0; i < m_phraseBooks.size(); ++i) {
config.setArrayIndex(i);
diff --git a/tools/linguist/linguist/mainwindow.h b/tools/linguist/linguist/mainwindow.h
index 9f6b4d9..167dfe4 100644
--- a/tools/linguist/linguist/mainwindow.h
+++ b/tools/linguist/linguist/mainwindow.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -79,8 +79,6 @@ class Statistics;
class TranslateDialog;
class TranslationSettingsDialog;
-const QString &settingsPrefix();
-
class MainWindow : public QMainWindow
{
Q_OBJECT
diff --git a/tools/linguist/linguist/mainwindow.ui b/tools/linguist/linguist/mainwindow.ui
index 6cc74ac..4f66f31 100644
--- a/tools/linguist/linguist/mainwindow.ui
+++ b/tools/linguist/linguist/mainwindow.ui
@@ -3,7 +3,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -36,7 +36,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
*********************************************************************</comment>
@@ -60,7 +60,7 @@
<x>0</x>
<y>0</y>
<width>673</width>
- <height>30</height>
+ <height>28</height>
</rect>
</property>
<widget class="QMenu" name="menuPhrases">
@@ -116,6 +116,7 @@
<addaction name="actionResetSorting"/>
<addaction name="actionDisplayGuesses"/>
<addaction name="actionStatistics"/>
+ <addaction name="actionLenghtVariants"/>
<addaction name="separator"/>
<addaction name="menuToolbars"/>
<addaction name="menuViewViews"/>
@@ -401,7 +402,7 @@
<string>&amp;Prev Unfinished</string>
</property>
<property name="toolTip">
- <string>Previous unfinished item.</string>
+ <string>Previous unfinished item</string>
</property>
<property name="whatsThis">
<string>Move to the previous unfinished item.</string>
@@ -418,7 +419,7 @@
<string>&amp;Next Unfinished</string>
</property>
<property name="toolTip">
- <string>Next unfinished item.</string>
+ <string>Next unfinished item</string>
</property>
<property name="whatsThis">
<string>Move to the next unfinished item.</string>
@@ -435,7 +436,7 @@
<string>P&amp;rev</string>
</property>
<property name="toolTip">
- <string>Move to previous item.</string>
+ <string>Move to previous item</string>
</property>
<property name="whatsThis">
<string>Move to the previous item.</string>
@@ -452,7 +453,7 @@
<string>Ne&amp;xt</string>
</property>
<property name="toolTip">
- <string>Next item.</string>
+ <string>Next item</string>
</property>
<property name="whatsThis">
<string>Move to the next item.</string>
@@ -472,7 +473,7 @@
<string>&amp;Done and Next</string>
</property>
<property name="toolTip">
- <string>Mark item as done and move to the next unfinished item.</string>
+ <string>Mark item as done and move to the next unfinished item</string>
</property>
<property name="whatsThis">
<string>Mark this item as done and move to the next unfinished item.</string>
@@ -492,7 +493,7 @@
<string>Copy from source text</string>
</property>
<property name="toolTip">
- <string>Copies the source text into the translation field.</string>
+ <string>Copies the source text into the translation field</string>
</property>
<property name="whatsThis">
<string>Copies the source text into the translation field.</string>
@@ -512,7 +513,7 @@
<string>&amp;Accelerators</string>
</property>
<property name="toolTip">
- <string>Toggle the validity check of accelerators.</string>
+ <string>Toggle the validity check of accelerators</string>
</property>
<property name="whatsThis">
<string>Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window.</string>
@@ -529,7 +530,7 @@
<string>&amp;Ending Punctuation</string>
</property>
<property name="toolTip">
- <string>Toggle the validity check of ending punctuation.</string>
+ <string>Toggle the validity check of ending punctuation</string>
</property>
<property name="whatsThis">
<string>Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window.</string>
@@ -546,7 +547,7 @@
<string>&amp;Phrase matches</string>
</property>
<property name="toolTip">
- <string>Toggle checking that phrase suggestions are used.</string>
+ <string>Toggle checking that phrase suggestions are used</string>
</property>
<property name="whatsThis">
<string>Toggle checking that phrase suggestions are used. If the check fails, a message is shown in the warnings window.</string>
@@ -563,7 +564,7 @@
<string>Place &amp;Marker Matches</string>
</property>
<property name="toolTip">
- <string>Toggle the validity check of place markers.</string>
+ <string>Toggle the validity check of place markers</string>
</property>
<property name="whatsThis">
<string>Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window.</string>
@@ -877,6 +878,14 @@
<string>Ctrl+W</string>
</property>
</action>
+ <action name="actionLenghtVariants">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Lenght Variants</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp
index 6351577..fa1ee88 100644
--- a/tools/linguist/linguist/messageeditor.cpp
+++ b/tools/linguist/linguist/messageeditor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -87,13 +87,13 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent)
m_dataModel(dataModel),
m_currentModel(-1),
m_currentNumerus(-1),
+ m_lengthVariants(false),
m_undoAvail(false),
m_redoAvail(false),
m_cutAvail(false),
m_copyAvail(false),
- m_sourceSelected(false),
- m_pluralSourceSelected(false),
- m_currentSelected(false)
+ m_selectionHolder(0),
+ m_focusWidget(0)
{
setObjectName(QLatin1String("scroll area"));
@@ -121,6 +121,9 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent)
connect(m_dataModel, SIGNAL(languageChanged(int)),
SLOT(setTargetLanguage(int)));
+ m_tabOrderTimer.setSingleShot(true);
+ connect(&m_tabOrderTimer, SIGNAL(timeout()), SLOT(reallyFixTabOrder()));
+
clipboardChanged();
setWhatsThis(tr("This whole panel allows you to view and edit "
@@ -144,12 +147,14 @@ void MessageEditor::setupEditorPage()
m_source = new FormWidget(tr("Source text"), false);
m_source->setHideWhenEmpty(true);
m_source->setWhatsThis(tr("This area shows the source text."));
- connect(m_source, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+ connect(m_source, SIGNAL(selectionChanged(QTextEdit *)),
+ SLOT(selectionChanged(QTextEdit *)));
m_pluralSource = new FormWidget(tr("Source text (Plural)"), false);
m_pluralSource->setHideWhenEmpty(true);
m_pluralSource->setWhatsThis(tr("This area shows the plural form of the source text."));
- connect(m_pluralSource, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+ connect(m_pluralSource, SIGNAL(selectionChanged(QTextEdit *)),
+ SLOT(selectionChanged(QTextEdit *)));
m_commentText = new FormWidget(tr("Developer comments"), false);
m_commentText->setHideWhenEmpty(true);
@@ -216,10 +221,13 @@ void MessageEditor::messageModelAppended()
ed.transCommentText->setWhatsThis(tr("Here you can enter comments for your own use."
" They have no effect on the translated applications.") );
ed.transCommentText->getEditor()->installEventFilter(this);
- connect(ed.transCommentText, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
- connect(ed.transCommentText, SIGNAL(textChanged()), SLOT(emitTranslatorCommentChanged()));
- connect(ed.transCommentText, SIGNAL(textChanged()), SLOT(resetHoverSelection()));
+ connect(ed.transCommentText, SIGNAL(selectionChanged(QTextEdit *)),
+ SLOT(selectionChanged(QTextEdit *)));
+ connect(ed.transCommentText, SIGNAL(textChanged(QTextEdit *)),
+ SLOT(emitTranslatorCommentChanged(QTextEdit *)));
+ connect(ed.transCommentText, SIGNAL(textChanged(QTextEdit *)), SLOT(resetHoverSelection()));
connect(ed.transCommentText, SIGNAL(cursorPositionChanged()), SLOT(resetHoverSelection()));
+ fixTabOrder();
QBoxLayout *box = new QVBoxLayout(ed.container);
box->setMargin(5);
box->addWidget(ed.transCommentText);
@@ -250,7 +258,7 @@ void MessageEditor::messageModelDeleted(int model)
if (m_currentModel >= 0) {
if (m_currentNumerus >= m_editors[m_currentModel].transTexts.size())
m_currentNumerus = m_editors[m_currentModel].transTexts.size() - 1;
- activeEditor()->getEditor()->setFocus();
+ activeEditor()->setFocus();
} else {
m_currentNumerus = -1;
}
@@ -265,26 +273,64 @@ void MessageEditor::messageModelDeleted(int model)
void MessageEditor::addPluralForm(int model, const QString &label, bool writable)
{
- FormWidget *transEditor = new FormWidget(label, true);
- QFont font;
- font.setPointSize(static_cast<int>(m_editors[model].fontSize));
- transEditor->getEditor()->setFont(font);
+ FormMultiWidget *transEditor = new FormMultiWidget(label);
+ connect(transEditor, SIGNAL(editorCreated(QTextEdit *)), SLOT(editorCreated(QTextEdit *)));
transEditor->setEditingEnabled(writable);
transEditor->setHideWhenEmpty(!writable);
if (!m_editors[model].transTexts.isEmpty())
transEditor->setVisible(false);
+ transEditor->setMultiEnabled(m_lengthVariants);
static_cast<QBoxLayout *>(m_editors[model].container->layout())->insertWidget(
m_editors[model].transTexts.count(), transEditor);
- transEditor->getEditor()->installEventFilter(this);
- connect(transEditor, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
- connect(transEditor, SIGNAL(textChanged()), SLOT(emitTranslationChanged()));
- connect(transEditor, SIGNAL(textChanged()), SLOT(resetHoverSelection()));
+ connect(transEditor, SIGNAL(selectionChanged(QTextEdit *)),
+ SLOT(selectionChanged(QTextEdit *)));
+ connect(transEditor, SIGNAL(textChanged(QTextEdit *)),
+ SLOT(emitTranslationChanged(QTextEdit *)));
+ connect(transEditor, SIGNAL(textChanged(QTextEdit *)), SLOT(resetHoverSelection()));
connect(transEditor, SIGNAL(cursorPositionChanged()), SLOT(resetHoverSelection()));
m_editors[model].transTexts << transEditor;
}
+void MessageEditor::editorCreated(QTextEdit *te)
+{
+ FormMultiWidget *snd = static_cast<FormMultiWidget *>(sender());
+ for (int model = 0; ; ++model) {
+ MessageEditorData med = m_editors.at(model);
+ if (med.transTexts.contains(snd)) {
+ QFont font;
+ font.setPointSize(static_cast<int>(med.fontSize));
+ te->setFont(font);
+
+ te->installEventFilter(this);
+
+ fixTabOrder();
+ return;
+ }
+ }
+}
+
+void MessageEditor::fixTabOrder()
+{
+ m_tabOrderTimer.start(0);
+}
+
+void MessageEditor::reallyFixTabOrder()
+{
+ QWidget *prev = this;
+ foreach (const MessageEditorData &med, m_editors) {
+ foreach (FormMultiWidget *fmw, med.transTexts)
+ foreach (QTextEdit *te, fmw->getEditors()) {
+ setTabOrder(prev, te);
+ prev = te;
+ }
+ QTextEdit *te = med.transCommentText->getEditor();
+ setTabOrder(prev, te);
+ prev = te;
+ }
+}
+
/*! internal
Returns all translations for an item.
The number of translations is dependent on if we have a plural form or not.
@@ -300,69 +346,53 @@ QStringList MessageEditor::translations(int model) const
return translations;
}
-static bool clearFormSelection(FormWidget *fw, FormWidget *te)
+static void clearSelection(QTextEdit *t)
{
- if (fw != te) {
- QTextEdit *t = fw->getEditor();
- bool oldBlockState = t->blockSignals(true);
- QTextCursor c = t->textCursor();
- c.clearSelection();
- t->setTextCursor(c);
- t->blockSignals(oldBlockState);
- return true;
- }
- return false;
+ bool oldBlockState = t->blockSignals(true);
+ QTextCursor c = t->textCursor();
+ c.clearSelection();
+ t->setTextCursor(c);
+ t->blockSignals(oldBlockState);
}
-// Clear the selection for all textedits except the sender
-void MessageEditor::selectionChanged()
+void MessageEditor::selectionChanged(QTextEdit *te)
{
- if (!resetSelection(qobject_cast<FormWidget *>(sender())))
+ if (te != m_selectionHolder) {
+ if (m_selectionHolder)
+ clearSelection(m_selectionHolder);
+ m_selectionHolder = (te->textCursor().hasSelection() ? te : 0);
updateCanCutCopy();
+ }
}
-bool MessageEditor::resetHoverSelection(FormWidget *fw)
+void MessageEditor::resetHoverSelection()
{
- if (m_sourceSelected) {
- if (clearFormSelection(m_source, fw)) {
- updateCanCutCopy();
- return true;
- }
- } else if (m_pluralSourceSelected) {
- if (clearFormSelection(m_pluralSource, fw)) {
- updateCanCutCopy();
- return true;
- }
- }
- return false;
+ if (m_selectionHolder &&
+ (m_selectionHolder == m_source->getEditor()
+ || m_selectionHolder == m_pluralSource->getEditor()))
+ resetSelection();
}
-bool MessageEditor::resetSelection(FormWidget *fw)
+void MessageEditor::resetSelection()
{
- if (resetHoverSelection(fw))
- return true;
- if (m_currentSelected) {
- MessageEditorData &ed = m_editors[m_currentModel];
- FormWidget *cfw = (m_currentNumerus < 0) ? ed.transCommentText
- : ed.transTexts[m_currentNumerus];
- if (clearFormSelection(cfw, fw)) {
- updateCanCutCopy();
- return true;
- }
+ if (m_selectionHolder) {
+ clearSelection(m_selectionHolder);
+ m_selectionHolder = 0;
+ updateCanCutCopy();
}
- return false;
}
void MessageEditor::activeModelAndNumerus(int *model, int *numerus) const
{
for (int j = 0; j < m_editors.count(); ++j) {
for (int i = 0; i < m_editors[j].transTexts.count(); ++i)
- if (m_editors[j].transTexts[i]->getEditor()->hasFocus()) {
- *model = j;
- *numerus = i;
- return;
- }
- if (m_editors[j].transCommentText->getEditor()->hasFocus()) {
+ foreach (QTextEdit *te, m_editors[j].transTexts[i]->getEditors())
+ if (m_focusWidget == te) {
+ *model = j;
+ *numerus = i;
+ return;
+ }
+ if (m_focusWidget == m_editors[j].transCommentText->getEditor()) {
*model = j;
*numerus = -1;
return;
@@ -372,43 +402,46 @@ void MessageEditor::activeModelAndNumerus(int *model, int *numerus) const
*numerus = -1;
}
-FormWidget *MessageEditor::activeTranslation() const
+QTextEdit *MessageEditor::activeTranslation() const
{
if (m_currentNumerus < 0)
return 0;
- return m_editors[m_currentModel].transTexts[m_currentNumerus];
+ foreach (QTextEdit *te, m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditors())
+ if (te->hasFocus())
+ return te;
+ return 0; // This cannot happen
}
-FormWidget *MessageEditor::activeOr1stTranslation() const
+QTextEdit *MessageEditor::activeOr1stTranslation() const
{
if (m_currentNumerus < 0) {
for (int i = 0; i < m_editors.size(); ++i)
if (m_editors[i].container->isVisible()
- && !m_editors[i].transTexts[0]->getEditor()->isReadOnly())
- return m_editors[i].transTexts[0];
+ && !m_editors[i].transTexts.first()->getEditors().first()->isReadOnly())
+ return m_editors[i].transTexts.first()->getEditors().first();
return 0;
}
- return m_editors[m_currentModel].transTexts[m_currentNumerus];
+ return activeTranslation();
}
-FormWidget *MessageEditor::activeTransComment() const
+QTextEdit *MessageEditor::activeTransComment() const
{
if (m_currentModel < 0 || m_currentNumerus >= 0)
return 0;
- return m_editors[m_currentModel].transCommentText;
+ return m_editors[m_currentModel].transCommentText->getEditor();
}
-FormWidget *MessageEditor::activeEditor() const
+QTextEdit *MessageEditor::activeEditor() const
{
- if (FormWidget *fw = activeTransComment())
- return fw;
+ if (QTextEdit *te = activeTransComment())
+ return te;
return activeTranslation();
}
-FormWidget *MessageEditor::activeOr1stEditor() const
+QTextEdit *MessageEditor::activeOr1stEditor() const
{
- if (FormWidget *fw = activeTransComment())
- return fw;
+ if (QTextEdit *te = activeTransComment())
+ return te;
return activeOr1stTranslation();
}
@@ -416,25 +449,14 @@ void MessageEditor::setTargetLanguage(int model)
{
const QStringList &numerusForms = m_dataModel->model(model)->numerusForms();
const QString &langLocalized = m_dataModel->model(model)->localizedLanguage();
- bool added = false;
for (int i = 0; i < numerusForms.count(); ++i) {
const QString &label = tr("%1 translation (%2)").arg(langLocalized, numerusForms[i]);
if (!i)
m_editors[model].firstForm = label;
- if (i >= m_editors[model].transTexts.count()) {
+ if (i >= m_editors[model].transTexts.count())
addPluralForm(model, label, m_dataModel->isModelWritable(model));
- QWidget *prev;
- if (i > 0)
- prev = m_editors[model].transTexts[i - 1]->getEditor();
- else if (model)
- prev = m_editors[model - 1].transCommentText->getEditor();
- else
- prev = this;
- setTabOrder(prev, m_editors[model].transTexts[i]->getEditor());
- added = true;
- } else {
+ else
m_editors[model].transTexts[i]->setLabel(label);
- }
m_editors[model].transTexts[i]->setVisible(!i || m_editors[model].pluralEditMode);
m_editors[model].transTexts[i]->setWhatsThis(
tr("This is where you can enter or modify"
@@ -444,16 +466,15 @@ void MessageEditor::setTargetLanguage(int model)
delete m_editors[model].transTexts.takeLast();
m_editors[model].invariantForm = tr("%1 translation").arg(langLocalized);
m_editors[model].transCommentText->setLabel(tr("%1 translator comments").arg(langLocalized));
- if (added)
- setTabOrder(m_editors[model].transTexts.last()->getEditor(), m_editors[model].transCommentText->getEditor());
}
MessageEditorData *MessageEditor::modelForWidget(const QObject *o)
{
for (int j = 0; j < m_editors.count(); ++j) {
for (int i = 0; i < m_editors[j].transTexts.count(); ++i)
- if (m_editors[j].transTexts[i]->getEditor() == o)
- return &m_editors[j];
+ foreach (QTextEdit *te, m_editors[j].transTexts[i]->getEditors())
+ if (te == o)
+ return &m_editors[j];
if (m_editors[j].transCommentText->getEditor() == o)
return &m_editors[j];
}
@@ -465,7 +486,8 @@ static bool applyFont(MessageEditorData *med)
QFont font;
font.setPointSize(static_cast<int>(med->fontSize));
for (int i = 0; i < med->transTexts.count(); ++i)
- med->transTexts[i]->getEditor()->setFont(font);
+ foreach (QTextEdit *te, med->transTexts[i]->getEditors())
+ te->setFont(font);
med->transCommentText->getEditor()->setFont(font);
return true;
}
@@ -528,22 +550,39 @@ bool MessageEditor::eventFilter(QObject *o, QEvent *e)
return decFont(modelForWidget(o));
}
} else if (e->type() == QEvent::FocusIn) {
- int model, numerus;
- activeModelAndNumerus(&model, &numerus);
- if (model != m_currentModel || numerus != m_currentNumerus) {
- resetSelection();
- m_currentModel = model;
- m_currentNumerus = numerus;
- emit activeModelChanged(activeModel());
- updateBeginFromSource();
- updateUndoRedo();
- updateCanPaste();
- }
+ QWidget *widget = static_cast<QWidget *>(o);
+ if (widget != m_focusWidget)
+ trackFocus(widget);
}
return QScrollArea::eventFilter(o, e);
}
+void MessageEditor::grabFocus(QWidget *widget)
+{
+ if (widget != m_focusWidget) {
+ widget->setFocus();
+ trackFocus(widget);
+ }
+}
+
+void MessageEditor::trackFocus(QWidget *widget)
+{
+ m_focusWidget = widget;
+
+ int model, numerus;
+ activeModelAndNumerus(&model, &numerus);
+ if (model != m_currentModel || numerus != m_currentNumerus) {
+ resetSelection();
+ m_currentModel = model;
+ m_currentNumerus = numerus;
+ emit activeModelChanged(activeModel());
+ updateBeginFromSource();
+ updateUndoRedo();
+ updateCanPaste();
+ }
+}
+
void MessageEditor::showNothing()
{
m_source->clearTranslation();
@@ -551,7 +590,7 @@ void MessageEditor::showNothing()
m_commentText->clearTranslation();
for (int j = 0; j < m_editors.count(); ++j) {
setEditingEnabled(j, false);
- foreach (FormWidget *widget, m_editors[j].transTexts)
+ foreach (FormMultiWidget *widget, m_editors[j].transTexts)
widget->clearTranslation();
m_editors[j].transCommentText->clearTranslation();
}
@@ -638,7 +677,7 @@ void MessageEditor::setTranslation(int model, const QString &translation, int nu
MessageEditorData &ed = m_editors[model];
if (numerus >= ed.transTexts.count())
numerus = 0;
- FormWidget *transForm = ed.transTexts[numerus];
+ FormMultiWidget *transForm = ed.transTexts[numerus];
transForm->setTranslation(translation, false);
updateBeginFromSource();
@@ -653,8 +692,8 @@ void MessageEditor::setTranslation(int latestModel, const QString &translation)
latestModel = m_currentModel;
numerus = m_currentNumerus;
}
- FormWidget *transForm = m_editors[latestModel].transTexts[numerus];
- transForm->getEditor()->setFocus();
+ FormMultiWidget *transForm = m_editors[latestModel].transTexts[numerus];
+ transForm->getEditors().first()->setFocus();
transForm->setTranslation(translation, true);
updateBeginFromSource();
@@ -663,29 +702,37 @@ void MessageEditor::setTranslation(int latestModel, const QString &translation)
void MessageEditor::setEditingEnabled(int model, bool enabled)
{
MessageEditorData &ed = m_editors[model];
- foreach (FormWidget *widget, ed.transTexts)
+ foreach (FormMultiWidget *widget, ed.transTexts)
widget->setEditingEnabled(enabled);
ed.transCommentText->setEditingEnabled(enabled);
updateCanPaste();
}
+void MessageEditor::setLenghtVariants(bool on)
+{
+ m_lengthVariants = on;
+ foreach (const MessageEditorData &ed, m_editors)
+ foreach (FormMultiWidget *widget, ed.transTexts)
+ widget->setMultiEnabled(on);
+}
+
void MessageEditor::undo()
{
- activeEditor()->getEditor()->document()->undo();
+ activeEditor()->document()->undo();
}
void MessageEditor::redo()
{
- activeEditor()->getEditor()->document()->redo();
+ activeEditor()->document()->redo();
}
void MessageEditor::updateUndoRedo()
{
bool newUndoAvail = false;
bool newRedoAvail = false;
- if (FormWidget *fw = activeEditor()) {
- QTextDocument *doc = fw->getEditor()->document();
+ if (QTextEdit *te = activeEditor()) {
+ QTextDocument *doc = te->document();
newUndoAvail = doc->isUndoAvailable();
newRedoAvail = doc->isRedoAvailable();
}
@@ -703,18 +750,12 @@ void MessageEditor::updateUndoRedo()
void MessageEditor::cut()
{
- QTextEdit *editor = activeEditor()->getEditor();
- if (editor->textCursor().hasSelection())
- editor->cut();
+ m_selectionHolder->cut();
}
void MessageEditor::copy()
{
- QTextEdit *te;
- if ((te = m_source->getEditor())->textCursor().hasSelection()
- || (te = m_pluralSource->getEditor())->textCursor().hasSelection()
- || (te = activeEditor()->getEditor())->textCursor().hasSelection())
- te->copy();
+ m_selectionHolder->copy();
}
void MessageEditor::updateCanCutCopy()
@@ -722,19 +763,9 @@ void MessageEditor::updateCanCutCopy()
bool newCopyState = false;
bool newCutState = false;
- m_sourceSelected = m_source->getEditor()->textCursor().hasSelection();
- m_pluralSourceSelected = m_pluralSource->getEditor()->textCursor().hasSelection();
- m_currentSelected = false;
-
- if (m_sourceSelected || m_pluralSourceSelected) {
+ if (m_selectionHolder) {
newCopyState = true;
- } else if (FormWidget *fw = activeEditor()) {
- QTextEdit *te = fw->getEditor();
- if (te->textCursor().hasSelection()) {
- m_currentSelected = true;
- newCopyState = true;
- newCutState = !te->isReadOnly();
- }
+ newCutState = !m_selectionHolder->isReadOnly();
}
if (newCopyState != m_copyAvail) {
@@ -750,14 +781,14 @@ void MessageEditor::updateCanCutCopy()
void MessageEditor::paste()
{
- activeEditor()->getEditor()->paste();
+ activeEditor()->paste();
}
void MessageEditor::updateCanPaste()
{
- FormWidget *fw;
+ QTextEdit *te;
emit pasteAvailable(!m_clipboardEmpty
- && (fw = activeEditor()) && !fw->getEditor()->isReadOnly());
+ && (te = activeEditor()) && !te->isReadOnly());
}
void MessageEditor::clipboardChanged()
@@ -772,24 +803,23 @@ void MessageEditor::selectAll()
// make sure we don't select the selection of a translator textedit,
// if we really want the source text editor to be selected.
QTextEdit *te;
- FormWidget *fw;
if ((te = m_source->getEditor())->underMouse()
|| (te = m_pluralSource->getEditor())->underMouse()
- || ((fw = activeEditor()) && (te = fw->getEditor())->hasFocus()))
+ || ((te = activeEditor()) && te->hasFocus()))
te->selectAll();
}
-void MessageEditor::emitTranslationChanged()
+void MessageEditor::emitTranslationChanged(QTextEdit *widget)
{
- static_cast<FormWidget *>(sender())->getEditor()->setFocus(); // DND proofness
+ grabFocus(widget); // DND proofness
updateBeginFromSource();
updateUndoRedo();
emit translationChanged(translations(m_currentModel));
}
-void MessageEditor::emitTranslatorCommentChanged()
+void MessageEditor::emitTranslatorCommentChanged(QTextEdit *widget)
{
- static_cast<FormWidget *>(sender())->getEditor()->setFocus(); // DND proofness
+ grabFocus(widget); // DND proofness
updateUndoRedo();
emit translatorCommentChanged(m_editors[m_currentModel].transCommentText->getTranslation());
}
@@ -797,11 +827,9 @@ void MessageEditor::emitTranslatorCommentChanged()
void MessageEditor::updateBeginFromSource()
{
bool overwrite = false;
- if (FormWidget *transForm = activeTranslation()) {
- QTextEdit *activeEditor = transForm->getEditor();
+ if (QTextEdit *activeEditor = activeTranslation())
overwrite = !activeEditor->isReadOnly()
&& activeEditor->toPlainText().trimmed().isEmpty();
- }
emit beginFromSourceAvailable(overwrite);
}
@@ -816,8 +844,8 @@ void MessageEditor::beginFromSource()
void MessageEditor::setEditorFocus()
{
if (!widget()->hasFocus())
- if (FormWidget *transForm = activeOr1stEditor())
- transForm->getEditor()->setFocus();
+ if (QTextEdit *activeEditor = activeOr1stEditor())
+ activeEditor->setFocus();
}
void MessageEditor::setEditorFocus(int model)
@@ -827,12 +855,13 @@ void MessageEditor::setEditorFocus(int model)
resetSelection();
m_currentNumerus = -1;
m_currentModel = -1;
+ m_focusWidget = 0;
emit activeModelChanged(activeModel());
updateBeginFromSource();
updateUndoRedo();
updateCanPaste();
} else {
- m_editors[model].transTexts[0]->getEditor()->setFocus();
+ m_editors[model].transTexts.first()->getEditors().first()->setFocus();
}
}
}
@@ -843,7 +872,7 @@ bool MessageEditor::focusNextUnfinished(int start)
if (m_dataModel->isModelWritable(j))
if (MessageItem *item = m_dataModel->messageItem(m_currentIndex, j))
if (item->type() == TranslatorMessage::Unfinished) {
- m_editors[j].transTexts[0]->getEditor()->setFocus();
+ m_editors[j].transTexts.first()->getEditors().first()->setFocus();
return true;
}
return false;
diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h
index de563ec..4106036 100644
--- a/tools/linguist/linguist/messageeditor.h
+++ b/tools/linguist/linguist/messageeditor.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,6 +45,7 @@
#include "messagemodel.h"
#include <QtCore/QLocale>
+#include <QtCore/QTimer>
#include <QtGui/QFrame>
#include <QtGui/QScrollArea>
@@ -58,11 +59,12 @@ class QTextEdit;
class MessageEditor;
class FormatTextEdit;
class FormWidget;
+class FormMultiWidget;
struct MessageEditorData {
QWidget *container;
FormWidget *transCommentText;
- QList<FormWidget*> transTexts;
+ QList<FormMultiWidget *> transTexts;
QString invariantForm;
QString firstForm;
float fontSize;
@@ -108,30 +110,35 @@ public slots:
void beginFromSource();
void setEditorFocus();
void setTranslation(int latestModel, const QString &translation);
+ void setLenghtVariants(bool on);
private slots:
- void selectionChanged();
- bool resetHoverSelection(FormWidget *fw = 0);
- void emitTranslationChanged();
- void emitTranslatorCommentChanged();
+ void editorCreated(QTextEdit *);
+ void selectionChanged(QTextEdit *);
+ void resetHoverSelection();
+ void emitTranslationChanged(QTextEdit *);
+ void emitTranslatorCommentChanged(QTextEdit *);
void updateCanPaste();
void clipboardChanged();
void messageModelAppended();
void messageModelDeleted(int model);
void allModelsDeleted();
void setTargetLanguage(int model);
+ void reallyFixTabOrder();
private:
void setupEditorPage();
void setEditingEnabled(int model, bool enabled);
bool focusNextUnfinished(int start);
- bool resetSelection(FormWidget *fw = 0);
+ void resetSelection();
+ void grabFocus(QWidget *widget);
+ void trackFocus(QWidget *widget);
void activeModelAndNumerus(int *model, int *numerus) const;
- FormWidget *activeTranslation() const;
- FormWidget *activeOr1stTranslation() const;
- FormWidget *activeTransComment() const;
- FormWidget *activeEditor() const;
- FormWidget *activeOr1stEditor() const;
+ QTextEdit *activeTranslation() const;
+ QTextEdit *activeOr1stTranslation() const;
+ QTextEdit *activeTransComment() const;
+ QTextEdit *activeEditor() const;
+ QTextEdit *activeOr1stEditor() const;
MessageEditorData *modelForWidget(const QObject *o);
int activeTranslationNumerus() const;
QStringList translations(int model) const;
@@ -139,6 +146,7 @@ private:
void updateUndoRedo();
void updateCanCutCopy();
void addPluralForm(int model, const QString &label, bool writable);
+ void fixTabOrder();
QPalette paletteForModel(int model) const;
MultiDataModel *m_dataModel;
@@ -147,21 +155,24 @@ private:
int m_currentModel;
int m_currentNumerus;
+ bool m_lengthVariants;
+
bool m_undoAvail;
bool m_redoAvail;
bool m_cutAvail;
bool m_copyAvail;
- bool m_sourceSelected;
- bool m_pluralSourceSelected;
- bool m_currentSelected;
bool m_clipboardEmpty;
+ QTextEdit *m_selectionHolder;
+ QWidget *m_focusWidget;
QBoxLayout *m_layout;
FormWidget *m_source;
FormWidget *m_pluralSource;
FormWidget *m_commentText;
QList<MessageEditorData> m_editors;
+
+ QTimer m_tabOrderTimer;
};
QT_END_NAMESPACE
diff --git a/tools/linguist/linguist/messageeditorwidgets.cpp b/tools/linguist/linguist/messageeditorwidgets.cpp
index 7412571..f8e2dc2 100644
--- a/tools/linguist/linguist/messageeditorwidgets.cpp
+++ b/tools/linguist/linguist/messageeditorwidgets.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,6 +42,8 @@
#include "messageeditorwidgets.h"
#include "messagehighlighter.h"
+#include <translator.h>
+
#include <QAbstractTextDocumentLayout>
#include <QAction>
#include <QApplication>
@@ -49,10 +51,12 @@
#include <QDebug>
#include <QLayout>
#include <QMenu>
+#include <QMessageBox>
#include <QPainter>
#include <QScrollArea>
#include <QTextBlock>
#include <QTextDocumentFragment>
+#include <QToolButton>
#include <QVBoxLayout>
QT_BEGIN_NAMESPACE
@@ -145,16 +149,15 @@ void FormatTextEdit::setEditable(bool editable)
void FormatTextEdit::setPlainText(const QString &text, bool userAction)
{
- bool oldBlockState = false;
if (!userAction) {
// Prevent contentsChanged signal
- oldBlockState = document()->blockSignals(true);
+ bool oldBlockState = blockSignals(true);
document()->setUndoRedoEnabled(false);
ExpandingTextEdit::setPlainText(text);
// highlighter is out of sync because of blocked signals
m_highlighter->rehighlight();
document()->setUndoRedoEnabled(true);
- document()->blockSignals(oldBlockState);
+ blockSignals(oldBlockState);
} else {
ExpandingTextEdit::setPlainText(text);
}
@@ -178,11 +181,21 @@ FormWidget::FormWidget(const QString &label, bool isEditable, QWidget *parent)
setLayout(layout);
- connect(m_editor->document(), SIGNAL(contentsChanged()), SIGNAL(textChanged()));
- connect(m_editor, SIGNAL(selectionChanged()), SIGNAL(selectionChanged()));
+ connect(m_editor, SIGNAL(textChanged()), SLOT(slotTextChanged()));
+ connect(m_editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
connect(m_editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
}
+void FormWidget::slotTextChanged()
+{
+ emit textChanged(m_editor);
+}
+
+void FormWidget::slotSelectionChanged()
+{
+ emit selectionChanged(m_editor);
+}
+
void FormWidget::setTranslation(const QString &text, bool userAction)
{
m_editor->setPlainText(text, userAction);
@@ -198,4 +211,240 @@ void FormWidget::setEditingEnabled(bool enable)
}
+class ButtonWrapper : public QWidget
+{
+ // no Q_OBJECT: no need to, and don't want the useless moc file
+
+public:
+ ButtonWrapper(QWidget *wrapee, QWidget *relator) : m_wrapee(wrapee)
+ {
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
+ QBoxLayout *box = new QVBoxLayout;
+ box->setMargin(0);
+ setLayout(box);
+ box->addWidget(wrapee, 0, Qt::AlignBottom);
+ if (relator)
+ relator->installEventFilter(this);
+ }
+
+protected:
+ virtual bool eventFilter(QObject *object, QEvent *event)
+ {
+ if (event->type() == QEvent::Resize) {
+ QWidget *relator = static_cast<QWidget *>(object);
+ setFixedHeight((relator->height() + layout()->spacing() + m_wrapee->height()) / 2);
+ }
+ return false;
+ }
+
+private:
+ QWidget *m_wrapee;
+};
+
+FormMultiWidget::FormMultiWidget(const QString &label, QWidget *parent)
+ : QWidget(parent),
+ m_hideWhenEmpty(false),
+ m_multiEnabled(false),
+ m_plusIcon(QIcon(QLatin1String(":/images/plus.png"))), // make static
+ m_minusIcon(QIcon(QLatin1String(":/images/minus.png")))
+{
+ m_label = new QLabel(this);
+ m_label->setText(label);
+
+ m_plusButtons.append(
+ new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), 0));
+}
+
+QAbstractButton *FormMultiWidget::makeButton(const QIcon &icon, const char *slot)
+{
+ QAbstractButton *btn = new QToolButton(this);
+ btn->setIcon(icon);
+ btn->setFixedSize(icon.availableSizes().first() /* + something */);
+ btn->setFocusPolicy(Qt::NoFocus);
+ connect(btn, SIGNAL(clicked()), slot);
+ return btn;
+}
+
+void FormMultiWidget::addEditor(int idx)
+{
+ FormatTextEdit *editor = new FormatTextEdit(this);
+ m_editors.insert(idx, editor);
+
+ m_minusButtons.insert(idx, makeButton(m_minusIcon, SLOT(minusButtonClicked())));
+ m_plusButtons.insert(idx + 1,
+ new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), editor));
+
+ connect(editor, SIGNAL(textChanged()), SLOT(slotTextChanged()));
+ connect(editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
+ connect(editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
+ editor->installEventFilter(this);
+
+ emit editorCreated(editor);
+}
+
+bool FormMultiWidget::eventFilter(QObject *watched, QEvent *event)
+{
+ int i = 0;
+ while (m_editors.at(i) != watched)
+ if (++i >= m_editors.count()) // Happens when deleting an editor
+ return false;
+ if (event->type() == QEvent::FocusOut) {
+ m_minusButtons.at(i)->setToolTip(QString());
+ m_plusButtons.at(i)->setToolTip(QString());
+ m_plusButtons.at(i + 1)->setToolTip(QString());
+ } else if (event->type() == QEvent::FocusIn) {
+ m_minusButtons.at(i)->setToolTip(/*: translate, but don't change */ tr("Alt+Delete"));
+ m_plusButtons.at(i)->setToolTip(/*: translate, but don't change */ tr("Shift+Alt+Insert"));
+ m_plusButtons.at(i + 1)->setToolTip(/*: translate, but don't change */ tr("Alt+Insert"));
+ } else if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ if (ke->modifiers() & Qt::AltModifier) {
+ if (ke->key() == Qt::Key_Delete) {
+ deleteEditor(i);
+ return true;
+ } else if (ke->key() == Qt::Key_Insert) {
+ if (!(ke->modifiers() & Qt::ShiftModifier))
+ ++i;
+ insertEditor(i);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void FormMultiWidget::updateLayout()
+{
+ delete layout();
+
+ QGridLayout *layout = new QGridLayout;
+ layout->setMargin(0);
+ setLayout(layout);
+
+ bool variants = m_multiEnabled && m_label->isEnabled();
+
+ layout->addWidget(m_label, 0, 0, 1, variants ? 3 : 1);
+
+ for (int i = 0; i < m_plusButtons.count(); ++i) {
+ if (variants)
+ layout->addWidget(m_plusButtons.at(i), 1 + i * 2, 0, 2, 1, Qt::AlignTop);
+ m_plusButtons.at(i)->setVisible(variants);
+ }
+ for (int j = 0; j < m_minusButtons.count(); ++j) {
+ if (variants)
+ layout->addWidget(m_minusButtons.at(j), 2 + j * 2, 2, 2, 1, Qt::AlignVCenter);
+ m_minusButtons.at(j)->setVisible(variants);
+ }
+ for (int k = 0; k < m_editors.count(); ++k)
+ layout->addWidget(m_editors.at(k), 2 + k * 2, variants ? 1 : 0, 2, 1, Qt::AlignVCenter);
+
+ updateGeometry();
+}
+
+void FormMultiWidget::slotTextChanged()
+{
+ emit textChanged(static_cast<QTextEdit *>(sender()));
+}
+
+void FormMultiWidget::slotSelectionChanged()
+{
+ emit selectionChanged(static_cast<QTextEdit *>(sender()));
+}
+
+void FormMultiWidget::setTranslation(const QString &text, bool userAction)
+{
+ QStringList texts = text.split(QChar(Translator::BinaryVariantSeparator), QString::KeepEmptyParts);
+
+ while (m_editors.count() > texts.count()) {
+ delete m_minusButtons.takeLast();
+ delete m_plusButtons.takeLast();
+ delete m_editors.takeLast();
+ }
+ while (m_editors.count() < texts.count())
+ addEditor(m_editors.count());
+ updateLayout();
+
+ for (int i = 0; i < texts.count(); ++i)
+ // XXX this will emit n textChanged signals
+ m_editors.at(i)->setPlainText(texts.at(i), userAction);
+
+ if (m_hideWhenEmpty)
+ setHidden(text.isEmpty());
+}
+
+QString FormMultiWidget::getTranslation() const
+{
+ QString ret;
+ for (int i = 0; i < m_editors.count(); ++i) {
+ if (i)
+ ret += QChar(Translator::BinaryVariantSeparator);
+ ret += m_editors.at(i)->toPlainText();
+ }
+ return ret;
+}
+
+void FormMultiWidget::setEditingEnabled(bool enable)
+{
+ // Use read-only state so that the text can still be copied
+ for (int i = 0; i < m_editors.count(); ++i)
+ m_editors.at(i)->setReadOnly(!enable);
+ m_label->setEnabled(enable);
+ if (m_multiEnabled)
+ updateLayout();
+}
+
+void FormMultiWidget::setMultiEnabled(bool enable)
+{
+ m_multiEnabled = enable;
+ if (m_label->isEnabled())
+ updateLayout();
+}
+
+void FormMultiWidget::minusButtonClicked()
+{
+ int i = 0;
+ while (m_minusButtons.at(i) != sender())
+ ++i;
+ deleteEditor(i);
+}
+
+void FormMultiWidget::plusButtonClicked()
+{
+ QWidget *btn = static_cast<QAbstractButton *>(sender())->parentWidget();
+ int i = 0;
+ while (m_plusButtons.at(i) != btn)
+ ++i;
+ insertEditor(i);
+}
+
+void FormMultiWidget::deleteEditor(int idx)
+{
+ if (m_editors.count() == 1) {
+ // Don't just clear(), so the undo history is not lost
+ QTextCursor c = m_editors.first()->textCursor();
+ c.select(QTextCursor::Document);
+ c.removeSelectedText();
+ } else {
+ if (!m_editors.at(idx)->toPlainText().isEmpty()) {
+ if (QMessageBox::question(topLevelWidget(), tr("Confirmation - Qt Linguist"),
+ tr("Delete non-empty length variant?"),
+ QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)
+ != QMessageBox::Yes)
+ return;
+ }
+ delete m_editors.takeAt(idx);
+ delete m_minusButtons.takeAt(idx);
+ delete m_plusButtons.takeAt(idx + 1);
+ updateLayout();
+ emit textChanged(m_editors.at((m_editors.count() == idx) ? idx - 1 : idx));
+ }
+}
+
+void FormMultiWidget::insertEditor(int idx)
+{
+ addEditor(idx);
+ updateLayout();
+ emit textChanged(m_editors.at(idx));
+}
+
QT_END_NAMESPACE
diff --git a/tools/linguist/linguist/messageeditorwidgets.h b/tools/linguist/linguist/messageeditorwidgets.h
index b1609e5..c0b445c 100644
--- a/tools/linguist/linguist/messageeditorwidgets.h
+++ b/tools/linguist/linguist/messageeditorwidgets.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,6 +42,7 @@
#ifndef MESSAGEEDITORWIDGETS_H
#define MESSAGEEDITORWIDGETS_H
+#include <QIcon>
#include <QImage>
#include <QLabel>
#include <QMap>
@@ -51,6 +52,7 @@
QT_BEGIN_NAMESPACE
+class QAbstractButton;
class QAction;
class QContextMenuEvent;
class QKeyEvent;
@@ -115,16 +117,68 @@ public:
FormatTextEdit *getEditor() { return m_editor; }
signals:
- void textChanged();
- void selectionChanged();
+ void textChanged(QTextEdit *);
+ void selectionChanged(QTextEdit *);
void cursorPositionChanged();
+private slots:
+ void slotSelectionChanged();
+ void slotTextChanged();
+
private:
QLabel *m_label;
FormatTextEdit *m_editor;
bool m_hideWhenEmpty;
};
+/*
+ Displays text fields & associated label
+*/
+class FormMultiWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ FormMultiWidget(const QString &label, QWidget *parent = 0);
+ void setLabel(const QString &label) { m_label->setText(label); }
+ void setTranslation(const QString &text, bool userAction = false);
+ void clearTranslation() { setTranslation(QString(), false); }
+ QString getTranslation() const;
+ void setEditingEnabled(bool enable);
+ void setMultiEnabled(bool enable);
+ void setHideWhenEmpty(bool optional) { m_hideWhenEmpty = optional; }
+ const QList<FormatTextEdit *> &getEditors() const { return m_editors; }
+
+signals:
+ void editorCreated(QTextEdit *);
+ void textChanged(QTextEdit *);
+ void selectionChanged(QTextEdit *);
+ void cursorPositionChanged();
+
+protected:
+ bool eventFilter(QObject *watched, QEvent *event);
+
+private slots:
+ void slotTextChanged();
+ void slotSelectionChanged();
+ void minusButtonClicked();
+ void plusButtonClicked();
+
+private:
+ void addEditor(int idx);
+ void updateLayout();
+ QAbstractButton *makeButton(const QIcon &icon, const char *slot);
+ void insertEditor(int idx);
+ void deleteEditor(int idx);
+
+ QLabel *m_label;
+ QList<FormatTextEdit *> m_editors;
+ QList<QWidget *> m_plusButtons;
+ QList<QAbstractButton *> m_minusButtons;
+ bool m_hideWhenEmpty;
+ bool m_multiEnabled;
+ QIcon m_plusIcon, m_minusIcon;
+};
+
QT_END_NAMESPACE
#endif // MESSAGEEDITORWIDGETS_H
diff --git a/tools/linguist/linguist/messagehighlighter.cpp b/tools/linguist/linguist/messagehighlighter.cpp
index 4965582..64e4ad8 100644
--- a/tools/linguist/linguist/messagehighlighter.cpp
+++ b/tools/linguist/linguist/messagehighlighter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/messagehighlighter.h b/tools/linguist/linguist/messagehighlighter.h
index 0fd061b..3372c9d 100644
--- a/tools/linguist/linguist/messagehighlighter.h
+++ b/tools/linguist/linguist/messagehighlighter.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index 7a8063b..6bbf6f3 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/messagemodel.h b/tools/linguist/linguist/messagemodel.h
index 3b75f7a..b951b70 100644
--- a/tools/linguist/linguist/messagemodel.h
+++ b/tools/linguist/linguist/messagemodel.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp
index b1f9818..463e699 100644
--- a/tools/linguist/linguist/phrase.cpp
+++ b/tools/linguist/linguist/phrase.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phrase.h b/tools/linguist/linguist/phrase.h
index 6747c80..f105b53 100644
--- a/tools/linguist/linguist/phrase.h
+++ b/tools/linguist/linguist/phrase.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phrasebookbox.cpp b/tools/linguist/linguist/phrasebookbox.cpp
index d3bb937..9a6819b 100644
--- a/tools/linguist/linguist/phrasebookbox.cpp
+++ b/tools/linguist/linguist/phrasebookbox.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phrasebookbox.h b/tools/linguist/linguist/phrasebookbox.h
index b34cae5..a2eb1fb 100644
--- a/tools/linguist/linguist/phrasebookbox.h
+++ b/tools/linguist/linguist/phrasebookbox.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phrasebookbox.ui b/tools/linguist/linguist/phrasebookbox.ui
index 32c51f6..153a0c4 100644
--- a/tools/linguist/linguist/phrasebookbox.ui
+++ b/tools/linguist/linguist/phrasebookbox.ui
@@ -3,7 +3,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -36,7 +36,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
*********************************************************************</comment>
diff --git a/tools/linguist/linguist/phrasemodel.cpp b/tools/linguist/linguist/phrasemodel.cpp
index 5368978..0c32682 100644
--- a/tools/linguist/linguist/phrasemodel.cpp
+++ b/tools/linguist/linguist/phrasemodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phrasemodel.h b/tools/linguist/linguist/phrasemodel.h
index 4013a0b..2eecc38 100644
--- a/tools/linguist/linguist/phrasemodel.h
+++ b/tools/linguist/linguist/phrasemodel.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/phraseview.cpp b/tools/linguist/linguist/phraseview.cpp
index 72c27dc..a959b66 100644
--- a/tools/linguist/linguist/phraseview.cpp
+++ b/tools/linguist/linguist/phraseview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,11 +34,12 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "globals.h"
#include "mainwindow.h"
#include "messagemodel.h"
#include "phrase.h"
@@ -61,7 +62,7 @@ static const int MaxCandidates = 5;
static QString phraseViewHeaderKey()
{
- return settingsPrefix() + QLatin1String("PhraseViewHeader");
+ return settingPath("PhraseViewHeader");
}
PhraseView::PhraseView(MultiDataModel *model, QList<QHash<QString, QList<Phrase *> > > *phraseDict, QWidget *parent)
diff --git a/tools/linguist/linguist/phraseview.h b/tools/linguist/linguist/phraseview.h
index 39a5355..3cacfa4 100644
--- a/tools/linguist/linguist/phraseview.h
+++ b/tools/linguist/linguist/phraseview.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/printout.cpp b/tools/linguist/linguist/printout.cpp
index 924180c..772f55d 100644
--- a/tools/linguist/linguist/printout.cpp
+++ b/tools/linguist/linguist/printout.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/printout.h b/tools/linguist/linguist/printout.h
index 11ffa63..5ac493d 100644
--- a/tools/linguist/linguist/printout.h
+++ b/tools/linguist/linguist/printout.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/recentfiles.cpp b/tools/linguist/linguist/recentfiles.cpp
index 6fc72f7..0dc14a4 100644
--- a/tools/linguist/linguist/recentfiles.cpp
+++ b/tools/linguist/linguist/recentfiles.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,12 +34,13 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "recentfiles.h"
+#include "globals.h"
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
@@ -49,11 +50,9 @@
QT_BEGIN_NAMESPACE
-const QString &settingsPrefix();
-
static QString configKey()
{
- return settingsPrefix() + QLatin1String("RecentlyOpenedFiles");
+ return settingPath("RecentlyOpenedFiles");
}
diff --git a/tools/linguist/linguist/recentfiles.h b/tools/linguist/linguist/recentfiles.h
index d0d25eb..e45c5d7 100644
--- a/tools/linguist/linguist/recentfiles.h
+++ b/tools/linguist/linguist/recentfiles.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/sourcecodeview.cpp b/tools/linguist/linguist/sourcecodeview.cpp
index c948d77..fbd1f2e 100644
--- a/tools/linguist/linguist/sourcecodeview.cpp
+++ b/tools/linguist/linguist/sourcecodeview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/sourcecodeview.h b/tools/linguist/linguist/sourcecodeview.h
index 99a28c5..1e97b3b 100644
--- a/tools/linguist/linguist/sourcecodeview.h
+++ b/tools/linguist/linguist/sourcecodeview.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/statistics.cpp b/tools/linguist/linguist/statistics.cpp
index 2cd197f..e120337 100644
--- a/tools/linguist/linguist/statistics.cpp
+++ b/tools/linguist/linguist/statistics.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/statistics.h b/tools/linguist/linguist/statistics.h
index 175f2e1..c7f0c3c 100644
--- a/tools/linguist/linguist/statistics.h
+++ b/tools/linguist/linguist/statistics.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/statistics.ui b/tools/linguist/linguist/statistics.ui
index b7b2e04..72e5c98 100644
--- a/tools/linguist/linguist/statistics.ui
+++ b/tools/linguist/linguist/statistics.ui
@@ -3,7 +3,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -36,7 +36,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
*********************************************************************</comment>
diff --git a/tools/linguist/linguist/translatedialog.cpp b/tools/linguist/linguist/translatedialog.cpp
index 537c364..edc22da 100644
--- a/tools/linguist/linguist/translatedialog.cpp
+++ b/tools/linguist/linguist/translatedialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/translatedialog.h b/tools/linguist/linguist/translatedialog.h
index fbed2df..8f33fa3 100644
--- a/tools/linguist/linguist/translatedialog.h
+++ b/tools/linguist/linguist/translatedialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/translatedialog.ui b/tools/linguist/linguist/translatedialog.ui
index 89f2138..cb5e751 100644
--- a/tools/linguist/linguist/translatedialog.ui
+++ b/tools/linguist/linguist/translatedialog.ui
@@ -3,7 +3,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -36,7 +36,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
*********************************************************************</comment>
diff --git a/tools/linguist/linguist/translationsettingsdialog.cpp b/tools/linguist/linguist/translationsettingsdialog.cpp
index 32f5c58..2344365 100644
--- a/tools/linguist/linguist/translationsettingsdialog.cpp
+++ b/tools/linguist/linguist/translationsettingsdialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/linguist/translationsettingsdialog.h b/tools/linguist/linguist/translationsettingsdialog.h
index a7ed1b4..18037c5 100644
--- a/tools/linguist/linguist/translationsettingsdialog.h
+++ b/tools/linguist/linguist/translationsettingsdialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lrelease/lrelease.1 b/tools/linguist/lrelease/lrelease.1
index 7e01d68..9e77504 100644
--- a/tools/linguist/lrelease/lrelease.1
+++ b/tools/linguist/lrelease/lrelease.1
@@ -1,21 +1,42 @@
.TH lrelease 1 "18 October 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*-
.\"
.\" Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-\" Contact: Qt Software Information (qt-info@nokia.com)
-.\"
-.\" This file may be distributed and/or modified under the terms of the
-.\" GNU General Public License version 2 as published by the Free Software
+.\" Contact: Nokia Corporation (qt-info@nokia.com)
+.\"
+.\" This file is part of the QtGui module 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.
-.\"
-.\" This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-.\" WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-.\"
-.\" See http://qtsoftware.com/gpl/ for GPL licensing information.
-.\"
-.\" Contact qt-info@nokia.com if any conditions of this licensing are
-.\" not clear to you.
-.\"
+.\" 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://www.qtsoftware.com/contact.
+.\" $QT_END_LICENSE$
+.\"
.SH NAME
lrelease \- generate Qt message files from Qt Linguist translation files
.SH SYNOPSIS
diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro
index 03ea0d0..01091b3 100644
--- a/tools/linguist/lrelease/lrelease.pro
+++ b/tools/linguist/lrelease/lrelease.pro
@@ -15,10 +15,8 @@ build_all:!build_pass {
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
SOURCES += main.cpp
-include(../../../src/qt_professional.pri)
include(../shared/formats.pri)
include(../shared/proparser.pri)
-include(../shared/translatortools.pri)
target.path=$$[QT_INSTALL_BINS]
INSTALLS += target
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index 7d0452f..86b7866 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index b9e8406..eb743c2 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1153,7 +1153,9 @@ bool CppParser::matchString(QString *s)
s->clear();
while (yyTok == Tok_String) {
*s += yyString;
- yyTok = getToken();
+ do {
+ yyTok = getToken();
+ } while (yyTok == Tok_Comment);
}
return matches;
}
diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp
index 658aebf..8a5d975 100644
--- a/tools/linguist/lupdate/java.cpp
+++ b/tools/linguist/lupdate/java.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lupdate/lupdate.1 b/tools/linguist/lupdate/lupdate.1
index e953273..68958b9 100644
--- a/tools/linguist/lupdate/lupdate.1
+++ b/tools/linguist/lupdate/lupdate.1
@@ -1,20 +1,41 @@
.TH lupdate 1 "18 October 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*-
.\"
.\" Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-.\" Contact: Qt Software Information (qt-info@nokia.com)
+.\" Contact: Nokia Corporation (qt-info@nokia.com)
.\"
-.\" This file may be distributed and/or modified under the terms of the
-.\" GNU General Public License version 2 as published by the Free Software
-.\" Foundation and appearing in the file LICENSE.GPL included in the
-.\" packaging of this file.
+.\" This file is part of the QtGui module 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.
.\"
-.\" This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-.\" WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\" 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.
.\"
-.\" See http://qtsoftware.com/gpl/ for GPL licensing information.
+.\" 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.
.\"
-.\" Contact qt-info@nokia.com if any conditions of this licensing are
-.\" not clear to you.
+.\" If you are unsure which license is appropriate for your use, please
+.\" contact the sales department at http://www.qtsoftware.com/contact.
+.\" $QT_END_LICENSE$
.\"
.SH NAME
lupdate \- update Qt Linguist translation files
diff --git a/tools/linguist/lupdate/lupdate.h b/tools/linguist/lupdate/lupdate.h
index 2f98643..7e28cf5 100644
--- a/tools/linguist/lupdate/lupdate.h
+++ b/tools/linguist/lupdate/lupdate.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index 8a70b55..18c8932 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp
index 4849d6e..7925fb2 100644
--- a/tools/linguist/lupdate/merge.cpp
+++ b/tools/linguist/lupdate/merge.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp
index 64adde6..7a701ae 100644
--- a/tools/linguist/lupdate/qscript.cpp
+++ b/tools/linguist/lupdate/qscript.cpp
@@ -2,7 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -35,7 +35,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g
index 563974a..4e36395 100644
--- a/tools/linguist/lupdate/qscript.g
+++ b/tools/linguist/lupdate/qscript.g
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
--
-- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
--- Contact: Qt Software Information (qt-info@nokia.com)
+-- Contact: Nokia Corporation (qt-info@nokia.com)
--
-- This file is part of the Qt Linguist of the Qt Toolkit.
--
@@ -34,7 +34,7 @@
-- 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.
+-- contact the sales department at http://www.qtsoftware.com/contact.
-- $QT_END_LICENSE$
--
-- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
diff --git a/tools/linguist/lupdate/ui.cpp b/tools/linguist/lupdate/ui.cpp
index 935cac4..fb78b2a 100644
--- a/tools/linguist/lupdate/ui.cpp
+++ b/tools/linguist/lupdate/ui.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph
index 0b06cea..629c60b 100644
--- a/tools/linguist/phrasebooks/russian.qph
+++ b/tools/linguist/phrasebooks/russian.qph
@@ -1,4 +1,5 @@
-<!DOCTYPE QPH><QPH language="ru">
+<!DOCTYPE QPH>
+<QPH language="ru">
<phrase>
<source>About</source>
<target>О программе</target>
@@ -68,10 +69,6 @@
<target>авто-прокрутка</target>
</phrase>
<phrase>
- <source>Back</source>
- <target>Назад</target>
-</phrase>
-<phrase>
<source>boxed edit</source>
<target>окно редактирования</target>
</phrase>
@@ -117,11 +114,11 @@
</phrase>
<phrase>
<source>Close button</source>
- <target>кнопка закрытия</target>
+ <target>Кнопка закрытия</target>
</phrase>
<phrase>
<source>collapse</source>
- <target>крах</target>
+ <target>свернуть</target>
</phrase>
<phrase>
<source>column heading</source>
@@ -257,7 +254,7 @@
</phrase>
<phrase>
<source>expand</source>
- <target>расширять</target>
+ <target>развернуть</target>
</phrase>
<phrase>
<source>Explore</source>
@@ -285,15 +282,15 @@
</phrase>
<phrase>
<source>Find Next</source>
- <target>Продолжить поиск</target>
+ <target>Найти далее</target>
</phrase>
<phrase>
<source>Find What</source>
- <target>Поиск</target>
+ <target>Искать</target>
</phrase>
<phrase>
<source>folder</source>
- <target>каталог</target>
+ <target>папка</target>
</phrase>
<phrase>
<source>font</source>
@@ -385,7 +382,7 @@
</phrase>
<phrase>
<source>landscape</source>
- <target>альбом</target>
+ <target>альбомная</target>
</phrase>
<phrase>
<source>link</source>
@@ -513,7 +510,7 @@
</phrase>
<phrase>
<source>OK</source>
- <target>OK</target>
+ <target>Готово</target>
</phrase>
<phrase>
<source>OLE</source>
@@ -525,7 +522,7 @@
</phrase>
<phrase>
<source>OLE embedded object</source>
- <target>внедренный OLE-объект</target>
+ <target>внедрённый OLE-объект</target>
</phrase>
<phrase>
<source>OLE linked object</source>
@@ -533,7 +530,7 @@
</phrase>
<phrase>
<source>OLE nondefault drag and drop</source>
- <target>предопределенный OLE-механизм</target>
+ <target>предопределённый OLE-механизм</target>
</phrase>
<phrase>
<source>Open</source>
@@ -557,7 +554,7 @@
</phrase>
<phrase>
<source>Page Setup</source>
- <target>шаг установки</target>
+ <target>Параметры страницы</target>
</phrase>
<phrase>
<source>palette window</source>
@@ -625,11 +622,11 @@
</phrase>
<phrase>
<source>portrait</source>
- <target>портрет</target>
+ <target>книжная</target>
</phrase>
<phrase>
<source>press</source>
- <target>нажимать</target>
+ <target>нажать</target>
</phrase>
<phrase>
<source>primary container</source>
@@ -757,7 +754,7 @@
</phrase>
<phrase>
<source>secondary window</source>
- <target>подчиненное окно</target>
+ <target>подчинённое окно</target>
</phrase>
<phrase>
<source>select</source>
@@ -765,7 +762,7 @@
</phrase>
<phrase>
<source>Select All</source>
- <target>Выделить все</target>
+ <target>Выделить всё</target>
</phrase>
<phrase>
<source>selection</source>
@@ -861,11 +858,11 @@
</phrase>
<phrase>
<source>status bar</source>
- <target>статусная строка</target>
+ <target>строка состояния</target>
</phrase>
<phrase>
<source>Stop</source>
- <target>Стоп</target>
+ <target>Остановить</target>
</phrase>
<phrase>
<source>tab control</source>
@@ -897,7 +894,7 @@
</phrase>
<phrase>
<source>toggle key</source>
- <target>кнопка-выключатель</target>
+ <target>кнопка-переключатель</target>
</phrase>
<phrase>
<source>toolbar</source>
@@ -979,4 +976,88 @@
<source>Yes</source>
<target>Да</target>
</phrase>
+<phrase>
+ <source>No</source>
+ <target>Нет</target>
+</phrase>
+<phrase>
+ <source>Options</source>
+ <target>Параметры</target>
+</phrase>
+<phrase>
+ <source>directory</source>
+ <target>каталог</target>
+</phrase>
+<phrase>
+ <source>Finish</source>
+ <target>Завершить</target>
+</phrase>
+<phrase>
+ <source>Continue</source>
+ <target>Продолжить</target>
+</phrase>
+<phrase>
+ <source>advanced</source>
+ <target>расширенный</target>
+</phrase>
+<phrase>
+ <source>layout</source>
+ <target>компоновка</target>
+</phrase>
+<phrase>
+ <source>layout</source>
+ <target>компоновщик</target>
+</phrase>
+<phrase>
+ <source>plugin</source>
+ <target>модуль</target>
+</phrase>
+<phrase>
+ <source>script</source>
+ <target>сценарий</target>
+</phrase>
+<phrase>
+ <source>spacer</source>
+ <target>разделитель</target>
+</phrase>
+<phrase>
+ <source>tabbar</source>
+ <target>панель вкладок</target>
+</phrase>
+<phrase>
+ <source>whitespace</source>
+ <target>символ пробела</target>
+</phrase>
+<phrase>
+ <source>Forward</source>
+ <target>Вперёд</target>
+</phrase>
+<phrase>
+ <source>Back</source>
+ <target>Назад</target>
+</phrase>
+<phrase>
+ <source>Search wrapped</source>
+ <target>Поиск с начала</target>
+</phrase>
+<phrase>
+ <source>OK</source>
+ <target>Выбрать</target>
+</phrase>
+<phrase>
+ <source>OK</source>
+ <target>Закрыть</target>
+</phrase>
+<phrase>
+ <source>Match case</source>
+ <target>С учётом регистра</target>
+</phrase>
+<phrase>
+ <source>Case Sensitive</source>
+ <target>Регистрозависимо</target>
+</phrase>
+<phrase>
+ <source>Whole words</source>
+ <target>Слова полностью</target>
+</phrase>
</QPH>
diff --git a/tools/linguist/shared/abstractproitemvisitor.h b/tools/linguist/shared/abstractproitemvisitor.h
index b108e7e..0691fdc 100644
--- a/tools/linguist/shared/abstractproitemvisitor.h
+++ b/tools/linguist/shared/abstractproitemvisitor.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp
index c0960da..e39cd4d 100644
--- a/tools/linguist/shared/numerus.cpp
+++ b/tools/linguist/shared/numerus.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,14 +34,13 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "translator.h"
-#include <QtCore/QCoreApplication>
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
#include <QtCore/QDir>
diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp
index 5842771..e22aa7d 100644
--- a/tools/linguist/shared/po.cpp
+++ b/tools/linguist/shared/po.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -395,7 +395,10 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
const QString prefix = QLatin1String(isObsolete ? "#~ " : "");
while (true) {
int idx = line.indexOf(QLatin1Char(' '), prefix.length());
- item.msgStr.append(slurpEscapedString(lines, l, idx, prefix, cd));
+ QString str = slurpEscapedString(lines, l, idx, prefix, cd);
+ str.replace(QChar(Translator::TextVariantSeparator),
+ QChar(Translator::BinaryVariantSeparator));
+ item.msgStr.append(str);
if (l + 1 >= lines.size() || !isTranslationLine(lines.at(l + 1)))
break;
++l;
@@ -635,8 +638,11 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd)
out << poEscapedString(prefix, QLatin1String("msgid_plural"), noWrap, plural);
QStringList translations = translator.normalizedTranslations(msg, cd, &ok);
for (int i = 0; i != translations.size(); ++i) {
+ QString str = translations.at(i);
+ str.replace(QChar(Translator::BinaryVariantSeparator),
+ QChar(Translator::TextVariantSeparator));
out << poEscapedString(prefix, QString::fromLatin1("msgstr[%1]").arg(i), noWrap,
- translations.at(i));
+ str);
}
}
first = false;
diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp
index ae46ad8..ef59543 100644
--- a/tools/linguist/shared/profileevaluator.cpp
+++ b/tools/linguist/shared/profileevaluator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h
index ae1422a..69f47f5 100644
--- a/tools/linguist/shared/profileevaluator.h
+++ b/tools/linguist/shared/profileevaluator.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/proitems.cpp b/tools/linguist/shared/proitems.cpp
index 1895852..471417e 100644
--- a/tools/linguist/shared/proitems.cpp
+++ b/tools/linguist/shared/proitems.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/proitems.h b/tools/linguist/shared/proitems.h
index befaa88..aad0ba2 100644
--- a/tools/linguist/shared/proitems.h
+++ b/tools/linguist/shared/proitems.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,7 +42,6 @@
#ifndef PROITEMS_H
#define PROITEMS_H
-#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QList>
@@ -207,10 +206,8 @@ private:
OperatorKind m_operatorKind;
};
-class ProFile : public QObject, public ProBlock
+class ProFile : public ProBlock
{
- Q_OBJECT
-
public:
explicit ProFile(const QString &fileName);
~ProFile();
diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h
index 3eab43f..0ffe4d2 100644
--- a/tools/linguist/shared/proparserutils.h
+++ b/tools/linguist/shared/proparserutils.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index 5563ac5..ec61cb6 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -238,12 +238,8 @@ Prefix Releaser::commonPrefix(const ByteTranslatorMessage &m1, const ByteTransla
void Releaser::writeMessage(const ByteTranslatorMessage &msg, QDataStream &stream,
TranslatorSaveMode mode, Prefix prefix) const
{
- for (int i = 0; i < msg.translations().count(); ++i) {
- QString str = msg.translations().at(i);
- str.replace(QChar(Translator::DefaultVariantSeparator),
- QChar(Translator::InternalVariantSeparator));
- stream << quint8(Tag_Translation) << str;
- }
+ for (int i = 0; i < msg.translations().count(); ++i)
+ stream << quint8(Tag_Translation) << msg.translations().at(i);
if (mode == SaveEverything)
prefix = HashContextSourceTextComment;
@@ -545,12 +541,20 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
size_t numItems = offsetLength / (2 * sizeof(quint32));
//qDebug() << "NUMITEMS: " << numItems;
- // FIXME: that's just a guess, the original locale data is lost...
- QTextCodec *codec = QTextCodec::codecForLocale();
+ QTextCodec *codec = QTextCodec::codecForName(cd.m_codecForSource);
QTextCodec *utf8Codec = 0;
if (codec->name() != "UTF-8")
utf8Codec = QTextCodec::codecForName("UTF-8");
+ QString strProN = QLatin1String("%n");
+ QLocale::Language l;
+ QLocale::Country c;
+ Translator::languageAndCountry(translator.languageCode(), &l, &c);
+ QStringList numerusForms;
+ bool guessPlurals = true;
+ if (getNumerusInfo(l, c, 0, &numerusForms))
+ guessPlurals = (numerusForms.count() == 1);
+
QString context, contextUtf8;
bool contextIsSystem, contextIsUtf8, contextNeeds8Bit;
QString sourcetext, sourcetextUtf8;
@@ -584,8 +588,6 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
str[i] = QChar((str.at(i).unicode() >> 8) +
((str.at(i).unicode() << 8) & 0xff00));
}
- str.replace(QChar(Translator::InternalVariantSeparator),
- QChar(Translator::DefaultVariantSeparator));
translations << str;
m += len;
break;
@@ -635,6 +637,15 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
end:;
TranslatorMessage msg;
msg.setType(TranslatorMessage::Finished);
+ if (translations.count() > 1) {
+ // If guessPlurals is not false here, plural form discard messages
+ // will be spewn out later.
+ msg.setPlural(true);
+ } else if (guessPlurals) {
+ // This might cause false positives, so it is a fallback only.
+ if (sourcetext.contains(strProN))
+ msg.setPlural(true);
+ }
msg.setTranslations(translations);
translations.clear();
if (contextNeeds8Bit || sourcetextNeeds8Bit || commentNeeds8Bit) {
@@ -649,7 +660,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
}
if (!(contextIsSystem && sourcetextIsSystem && commentIsSystem)) {
cd.appendError(QLatin1String(
- "Cannot read file with current system character codec"));
+ "Cannot read file with specified input codec"));
return false;
}
// The message is 8-bit in the file's encoding (utf-8 or not).
diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp
index 799bf7d..4a29e0f 100644
--- a/tools/linguist/shared/qph.cpp
+++ b/tools/linguist/shared/qph.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,33 +54,19 @@ QT_BEGIN_NAMESPACE
class QPHReader : public QXmlStreamReader
{
public:
- QPHReader(QIODevice &dev, ConversionData &cd)
- : QXmlStreamReader(&dev), m_cd(cd)
+ QPHReader(QIODevice &dev)
+ : QXmlStreamReader(&dev)
{}
// the "real thing"
bool read(Translator &translator);
private:
- bool elementStarts(const QString &str) const
- {
- return isStartElement() && name() == str;
- }
-
bool isWhiteSpace() const
{
return isCharacters() && text().toString().trimmed().isEmpty();
}
- // needed to expand <byte ... />
- QString readContents();
- // needed to join <lengthvariant>s
- QString readTransContents();
-
- void handleError();
-
- ConversionData &m_cd;
-
enum DataField { NoField, SourceField, TargetField, DefinitionField };
DataField m_currentField;
QString m_currentSource;
@@ -113,6 +99,8 @@ bool QPHReader::read(Translator &translator)
else if (m_currentField == DefinitionField)
m_currentDefinition += text();
} else if (isEndElement() && name() == QLatin1String("phrase")) {
+ m_currentTarget.replace(QChar(Translator::TextVariantSeparator),
+ QChar(Translator::BinaryVariantSeparator));
TranslatorMessage msg;
msg.setSourceText(m_currentSource);
msg.setTranslation(m_currentTarget);
@@ -126,10 +114,10 @@ bool QPHReader::read(Translator &translator)
return true;
}
-static bool loadQPH(Translator &translator, QIODevice &dev, ConversionData &cd)
+static bool loadQPH(Translator &translator, QIODevice &dev, ConversionData &)
{
translator.setLocationsType(Translator::NoLocations);
- QPHReader reader(dev, cd);
+ QPHReader reader(dev);
return reader.read(translator);
}
@@ -173,7 +161,10 @@ static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData
foreach (const TranslatorMessage &msg, translator.messages()) {
t << "<phrase>\n";
t << " <source>" << protect(msg.sourceText()) << "</source>\n";
- t << " <target>" << protect(msg.translations().join(QLatin1String("@")))
+ QString str = msg.translations().join(QLatin1String("@"));
+ str.replace(QChar(Translator::BinaryVariantSeparator),
+ QChar(Translator::TextVariantSeparator));
+ t << " <target>" << protect(str)
<< "</target>\n";
if (!msg.context().isEmpty() || !msg.comment().isEmpty())
t << " <definition>" << msg.context() << msg.comment()
diff --git a/tools/linguist/shared/simtexth.cpp b/tools/linguist/shared/simtexth.cpp
index 0556ed6..090af91 100644
--- a/tools/linguist/shared/simtexth.cpp
+++ b/tools/linguist/shared/simtexth.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/simtexth.h b/tools/linguist/shared/simtexth.h
index e3cad91..8886d02 100644
--- a/tools/linguist/shared/simtexth.h
+++ b/tools/linguist/shared/simtexth.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index c1f242d..305681d 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,7 +45,6 @@
#include <stdio.h>
-#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index 5d0549b..ac824f3 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -190,9 +190,9 @@ public:
static void registerFileFormat(const FileFormat &format);
static QList<FileFormat> &registeredFileFormats();
- enum VariantSeparators {
- DefaultVariantSeparator = 0x2762, // some weird character nobody ever heard of :-D
- InternalVariantSeparator = 0x9c // unicode "STRING TERMINATOR"
+ enum {
+ TextVariantSeparator = 0x2762, // some weird character nobody ever heard of :-D
+ BinaryVariantSeparator = 0x9c // unicode "STRING TERMINATOR"
};
private:
diff --git a/tools/linguist/shared/translatormessage.cpp b/tools/linguist/shared/translatormessage.cpp
index afe66fe..2d9320a 100644
--- a/tools/linguist/shared/translatormessage.cpp
+++ b/tools/linguist/shared/translatormessage.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/translatormessage.h b/tools/linguist/shared/translatormessage.h
index 9f847b0..e5ac1a5 100644
--- a/tools/linguist/shared/translatormessage.h
+++ b/tools/linguist/shared/translatormessage.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/linguist/shared/ts.cpp b/tools/linguist/shared/ts.cpp
index 22f2a1b..3efce15 100644
--- a/tools/linguist/shared/ts.cpp
+++ b/tools/linguist/shared/ts.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -197,7 +197,7 @@ QString TSReader::readTransContents()
// ignore these, just whitespace
} else if (elementStarts(strlengthvariant)) {
if (!result.isEmpty())
- result += QChar(Translator::DefaultVariantSeparator);
+ result += QChar(Translator::BinaryVariantSeparator);
result += readContents();
} else {
handleError();
@@ -514,7 +514,7 @@ static void writeExtras(QTextStream &t, const char *indent,
static void writeVariants(QTextStream &t, const char *indent, const QString &input)
{
int offset;
- if ((offset = input.indexOf(QChar(Translator::DefaultVariantSeparator))) >= 0) {
+ if ((offset = input.indexOf(QChar(Translator::BinaryVariantSeparator))) >= 0) {
t << " variants=\"yes\">";
int start = 0;
forever {
@@ -524,7 +524,7 @@ static void writeVariants(QTextStream &t, const char *indent, const QString &inp
if (offset == input.length())
break;
start = offset + 1;
- offset = input.indexOf(QChar(Translator::DefaultVariantSeparator), start);
+ offset = input.indexOf(QChar(Translator::BinaryVariantSeparator), start);
if (offset < 0)
offset = input.length();
}
diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp
index 6acf67a..1313172 100644
--- a/tools/linguist/shared/xliff.cpp
+++ b/tools/linguist/shared/xliff.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -303,6 +303,8 @@ static void writeTransUnits(QTextStream &ts, const TranslatorMessage &msg, const
QString translation;
if (transit != transend) {
translation = *transit;
+ translation.replace(QChar(Translator::BinaryVariantSeparator),
+ QChar(Translator::TextVariantSeparator));
++transit;
puttrans = true;
}
@@ -598,8 +600,11 @@ bool XLIFFHandler::endElement(const QString &namespaceURI, const QString& localN
m_sources.append(accum);
}
} else if (localName == QLatin1String("target")) {
- if (popContext(XC_restype_translation))
+ if (popContext(XC_restype_translation)) {
+ accum.replace(QChar(Translator::TextVariantSeparator),
+ QChar(Translator::BinaryVariantSeparator));
m_translations.append(accum);
+ }
} else if (localName == QLatin1String("context-group")) {
if (popContext(XC_context_group)) {
m_refs.append(TranslatorMessage::Reference(
diff --git a/tools/linguist/tests/tst_lupdate.cpp b/tools/linguist/tests/tst_lupdate.cpp
index 043e653..d3b7a1c 100644
--- a/tools/linguist/tests/tst_lupdate.cpp
+++ b/tools/linguist/tests/tst_lupdate.cpp
@@ -2,7 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/tools/linguist/tests/tst_simtexth.cpp b/tools/linguist/tests/tst_simtexth.cpp
index 81a7f19..d8315ad 100644
--- a/tools/linguist/tests/tst_simtexth.cpp
+++ b/tools/linguist/tests/tst_simtexth.cpp
@@ -2,7 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.