summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/lib/qhelpgenerator.cpp94
-rw-r--r--tools/assistant/lib/qhelpsearchengine.cpp2
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp3
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp4
-rw-r--r--tools/linguist/linguist/globals.cpp55
-rw-r--r--tools/linguist/linguist/globals.h50
-rw-r--r--tools/linguist/linguist/linguist.pro2
-rw-r--r--tools/linguist/linguist/main.cpp5
-rw-r--r--tools/linguist/linguist/mainwindow.cpp46
-rw-r--r--tools/linguist/linguist/mainwindow.h2
-rw-r--r--tools/linguist/linguist/messageeditor.cpp218
-rw-r--r--tools/linguist/linguist/messageeditor.h27
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.cpp19
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.h8
-rw-r--r--tools/linguist/linguist/phraseview.cpp3
-rw-r--r--tools/linguist/linguist/recentfiles.cpp5
-rw-r--r--tools/linguist/lupdate/cpp.cpp4
-rw-r--r--tools/linguist/shared/numerus.cpp5
-rw-r--r--tools/linguist/shared/qph.cpp22
-rw-r--r--tools/qdoc3/htmlgenerator.cpp53
-rw-r--r--tools/qdoc3/test/classic.css76
-rw-r--r--tools/qdoc3/test/qt-cpp-ignore.qdocconf3
-rw-r--r--tools/qdoc3/test/qt-inc.qdocconf3
-rw-r--r--tools/qdoc3/test/standalone-eclipse-integration.qdocconf2
24 files changed, 411 insertions, 300 deletions
diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp
index 03df3cc..8512adb 100644
--- a/tools/assistant/lib/qhelpgenerator.cpp
+++ b/tools/assistant/lib/qhelpgenerator.cpp
@@ -467,8 +467,9 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
emit statusChanged(tr("Insert files..."));
QList<int> filterAtts;
- foreach (QString filterAtt, filterAttributes) {
- d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable WHERE Name=?"));
+ foreach (const QString &filterAtt, filterAttributes) {
+ d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable "
+ "WHERE Name=?"));
d->query->bindValue(0, filterAtt);
d->query->exec();
if (d->query->next())
@@ -482,76 +483,76 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
if (filterSetId < 0)
return false;
++filterSetId;
- foreach (int attId, filterAtts) {
- d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable VALUES(?, ?)"));
+ foreach (const int &attId, filterAtts) {
+ d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable "
+ "VALUES(?, ?)"));
d->query->bindValue(0, filterSetId);
d->query->bindValue(1, attId);
d->query->exec();
}
- QString title;
- QString charSet;
- QMap<int, QSet<int> > tmpFileFilterMap;
- QList<FileNameTableData> fileNameDataList;
- QList<QByteArray> fileDataList;
-
int tableFileId = 1;
d->query->exec(QLatin1String("SELECT MAX(Id) FROM FileDataTable"));
if (d->query->next())
tableFileId = d->query->value(0).toInt() + 1;
+ QString title;
+ QString charSet;
FileNameTableData fileNameData;
+ QList<QByteArray> fileDataList;
+ QMap<int, QSet<int> > tmpFileFilterMap;
+ QList<FileNameTableData> fileNameDataList;
int i = 0;
- foreach (QString file, files) {
- QFileInfo fi(rootPath + QDir::separator() + file);
+ foreach (const QString &file, files) {
+ const QString fileName = QDir::cleanPath(file);
+ if (fileName.startsWith(QLatin1String("../"))) {
+ emit warning(tr("The referenced file %1 must be inside or within a "
+ "subdirectory of (%2). Skipping it.").arg(fileName).arg(rootPath));
+ continue;
+ }
+
+ QFile fi(rootPath + QDir::separator() + fileName);
if (!fi.exists()) {
emit warning(tr("The file %1 does not exist! Skipping it.")
- .arg(fi.absoluteFilePath()));
+ .arg(QDir::cleanPath(rootPath + QDir::separator() + fileName)));
continue;
}
- QFile f(fi.absoluteFilePath());
- if (!f.open(QIODevice::ReadOnly)) {
+ if (!fi.open(QIODevice::ReadOnly)) {
emit warning(tr("Cannot open file %1! Skipping it.")
- .arg(fi.absoluteFilePath()));
+ .arg(QDir::cleanPath(rootPath + QDir::separator() + fileName)));
continue;
}
- title.clear();
- QByteArray data;
- data = f.readAll();
-
- if (fi.suffix() == QLatin1String("html") || fi.suffix() == QLatin1String("htm")) {
- charSet = QHelpGlobal::charsetFromData(data);
- QTextStream stream(&data);
- stream.setCodec(QTextCodec::codecForName(charSet.toLatin1().constData()));
- title = QHelpGlobal::documentTitle(stream.readAll());
+ QByteArray data = fi.readAll();
+ if (fileName.endsWith(QLatin1String(".html"))
+ || fileName.endsWith(QLatin1String(".htm"))) {
+ charSet = QHelpGlobal::charsetFromData(data);
+ QTextStream stream(&data);
+ stream.setCodec(QTextCodec::codecForName(charSet.toLatin1().constData()));
+ title = QHelpGlobal::documentTitle(stream.readAll());
} else {
title = fi.fileName();
}
- QString fName = QDir::cleanPath(file);
- if (fName.startsWith(QLatin1String("./")))
- fName = fName.mid(2);
-
int fileId = -1;
- if (!d->fileMap.contains(fName)) {
+ if (!d->fileMap.contains(fileName)) {
fileDataList.append(qCompress(data));
- fileNameData.name = fName;
+ fileNameData.name = fileName;
fileNameData.fileId = tableFileId;
fileNameData.title = title;
fileNameDataList.append(fileNameData);
- d->fileMap.insert(fName, tableFileId);
+ d->fileMap.insert(fileName, tableFileId);
d->fileFilterMap.insert(tableFileId, filterAtts.toSet());
tmpFileFilterMap.insert(tableFileId, filterAtts.toSet());
++tableFileId;
} else {
- fileId = d->fileMap.value(fName);
- foreach (int filter, filterAtts) {
+ fileId = d->fileMap.value(fileName);
+ foreach (const int &filter, filterAtts) {
if (!d->fileFilterMap.value(fileId).contains(filter)
&& !tmpFileFilterMap.value(fileId).contains(filter)) {
d->fileFilterMap[fileId].insert(filter);
@@ -565,20 +566,22 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
d->query->exec(QLatin1String("BEGIN"));
QMap<int, QSet<int> >::const_iterator it = tmpFileFilterMap.constBegin();
while (it != tmpFileFilterMap.constEnd()) {
- QSet<int>::const_iterator i = it.value().constBegin();
- while (i != it.value().constEnd()) {
- d->query->prepare(QLatin1String("INSERT INTO FileFilterTable VALUES(?, ?)"));
- d->query->bindValue(0, *i);
+ QSet<int>::const_iterator si = it.value().constBegin();
+ while (si != it.value().constEnd()) {
+ d->query->prepare(QLatin1String("INSERT INTO FileFilterTable "
+ "VALUES(?, ?)"));
+ d->query->bindValue(0, *si);
d->query->bindValue(1, it.key());
d->query->exec();
- ++i;
+ ++si;
}
++it;
}
QList<QByteArray>::const_iterator fileIt = fileDataList.constBegin();
while (fileIt != fileDataList.constEnd()) {
- d->query->prepare(QLatin1String("INSERT INTO FileDataTable VALUES (Null, ?)"));
+ d->query->prepare(QLatin1String("INSERT INTO FileDataTable VALUES "
+ "(Null, ?)"));
d->query->bindValue(0, *fileIt);
d->query->exec();
++fileIt;
@@ -586,10 +589,11 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
addProgress(d->fileStep*20.0);
}
- QList<FileNameTableData>::const_iterator fileNameIt = fileNameDataList.constBegin();
+ QList<FileNameTableData>::const_iterator fileNameIt =
+ fileNameDataList.constBegin();
while (fileNameIt != fileNameDataList.constEnd()) {
- d->query->prepare(QLatin1String("INSERT INTO FileNameTable (FolderId, Name, FileId, Title) "
- " VALUES (?, ?, ?, ?)"));
+ d->query->prepare(QLatin1String("INSERT INTO FileNameTable "
+ "(FolderId, Name, FileId, Title) VALUES (?, ?, ?, ?)"));
d->query->bindValue(0, 1);
d->query->bindValue(1, (*fileNameIt).name);
d->query->bindValue(2, (*fileNameIt).fileId);
@@ -609,8 +613,8 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
return false;
}
-bool QHelpGenerator::registerCustomFilter(const QString &filterName, const QStringList &filterAttribs,
- bool forceUpdate)
+bool QHelpGenerator::registerCustomFilter(const QString &filterName,
+ const QStringList &filterAttribs, bool forceUpdate)
{
if (!d->query)
return false;
diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp
index 9025f4f..5e7974d 100644
--- a/tools/assistant/lib/qhelpsearchengine.cpp
+++ b/tools/assistant/lib/qhelpsearchengine.cpp
@@ -243,7 +243,7 @@ private:
This enum type specifies the field names that are handled by the search engine.
\value DEFAULT the default field provided by the search widget, several terms should be
- splitted and stored in the wordlist except search terms enclosed in quotes.
+ split and stored in the word list except search terms enclosed in quotes.
\value FUZZY a field only provided in use with clucene. Terms should be split in seperate
words and passed to the search engine.
\value WITHOUT a field only provided in use with clucene. Terms should be split in seperate
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 52d48d5..95e458c 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -780,6 +780,9 @@ void CentralWidget::showTabBarContextMenu(const QPoint &point)
menu.addSeparator();
QAction *newBookmark = menu.addAction(tr("Add Bookmark for this Page..."));
+ const QString &url = viewer->source().toString();
+ if (url.isEmpty() || url == QLatin1String("about:blank"))
+ newBookmark->setEnabled(false);
QAction *pickedAction = menu.exec(tabBar->mapToGlobal(point));
if (pickedAction == newPage)
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index 2b53f09..44ef211 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -468,7 +468,7 @@ void MainWindow::setupActions()
menu = menuBar()->addMenu(tr("&Go"));
m_homeAction = menu->addAction(tr("&Home"), m_centralWidget, SLOT(home()));
- m_homeAction->setShortcut(tr("Ctrl+Home"));
+ m_homeAction->setShortcut(tr("ALT+Home"));
m_homeAction->setIcon(QIcon(resourcePath + QLatin1String("/home.png")));
m_backAction = menu->addAction(tr("&Back"), m_centralWidget, SLOT(backward()));
@@ -748,7 +748,7 @@ void MainWindow::copyAvailable(bool yes)
void MainWindow::addNewBookmark(const QString &title, const QString &url)
{
- if (url.isEmpty())
+ if (url.isEmpty() || url == QLatin1String("about:blank"))
return;
m_bookmarkManager->showBookmarkDialog(this, title, url);
diff --git a/tools/linguist/linguist/globals.cpp b/tools/linguist/linguist/globals.cpp
new file mode 100644
index 0000000..697b28b
--- /dev/null
+++ b/tools/linguist/linguist/globals.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 qt-sales@nokia.com.
+** $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..6b7293f
--- /dev/null
+++ b/tools/linguist/linguist/globals.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 qt-sales@nokia.com.
+** $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/linguist.pro b/tools/linguist/linguist/linguist.pro
index 968293a..234b0b1 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 \
diff --git a/tools/linguist/linguist/main.cpp b/tools/linguist/linguist/main.cpp
index a6a0d27..98cd876 100644
--- a/tools/linguist/linguist/main.cpp
+++ b/tools/linguist/linguist/main.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#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..783587c 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -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;
@@ -2494,25 +2486,24 @@ 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());
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 +2513,22 @@ 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("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..6eed8ac 100644
--- a/tools/linguist/linguist/mainwindow.h
+++ b/tools/linguist/linguist/mainwindow.h
@@ -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/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp
index fb2fb1d..aacf482 100644
--- a/tools/linguist/linguist/messageeditor.cpp
+++ b/tools/linguist/linguist/messageeditor.cpp
@@ -91,9 +91,8 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent)
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"));
@@ -144,12 +143,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,9 +217,11 @@ 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()));
QBoxLayout *box = new QVBoxLayout(ed.container);
box->setMargin(5);
@@ -250,7 +253,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;
}
@@ -277,9 +280,11 @@ void MessageEditor::addPluralForm(int model, const QString &label, bool writable
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;
@@ -300,69 +305,52 @@ 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()) {
+ if (m_focusWidget == m_editors[j].transTexts[i]->getEditor()) {
*model = j;
*numerus = i;
return;
}
- if (m_editors[j].transCommentText->getEditor()->hasFocus()) {
+ if (m_focusWidget == m_editors[j].transCommentText->getEditor()) {
*model = j;
*numerus = -1;
return;
@@ -372,43 +360,43 @@ 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];
+ return m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditor();
}
-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];
+ return m_editors[i].transTexts[0]->getEditor();
return 0;
}
- return m_editors[m_currentModel].transTexts[m_currentNumerus];
+ return m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditor();
}
-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();
}
@@ -502,6 +490,8 @@ bool MessageEditor::eventFilter(QObject *o, QEvent *e)
m_pluralSource->getEditor()->copy();
return true;
}
+ } else if (ke->key() == Qt::Key_A) {
+ return true;
}
}
} else if (e->type() == QEvent::KeyPress) {
@@ -526,22 +516,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();
@@ -670,20 +677,20 @@ void MessageEditor::setEditingEnabled(int model, bool enabled)
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();
}
@@ -701,18 +708,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()
@@ -720,19 +721,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) {
@@ -748,14 +739,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()
@@ -770,24 +761,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());
}
@@ -795,11 +785,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);
}
@@ -814,8 +802,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)
diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h
index de563ec..9dd26f9 100644
--- a/tools/linguist/linguist/messageeditor.h
+++ b/tools/linguist/linguist/messageeditor.h
@@ -110,10 +110,10 @@ public slots:
void setTranslation(int latestModel, const QString &translation);
private slots:
- void selectionChanged();
- bool resetHoverSelection(FormWidget *fw = 0);
- void emitTranslationChanged();
- void emitTranslatorCommentChanged();
+ void selectionChanged(QTextEdit *);
+ void resetHoverSelection();
+ void emitTranslationChanged(QTextEdit *);
+ void emitTranslatorCommentChanged(QTextEdit *);
void updateCanPaste();
void clipboardChanged();
void messageModelAppended();
@@ -125,13 +125,15 @@ 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;
@@ -151,12 +153,11 @@ private:
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;
diff --git a/tools/linguist/linguist/messageeditorwidgets.cpp b/tools/linguist/linguist/messageeditorwidgets.cpp
index 7412571..d23d42e 100644
--- a/tools/linguist/linguist/messageeditorwidgets.cpp
+++ b/tools/linguist/linguist/messageeditorwidgets.cpp
@@ -145,16 +145,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 +177,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::slotSelectionChanged()
+{
+ emit selectionChanged(m_editor);
+}
+
+void FormWidget::slotTextChanged()
+{
+ emit textChanged(m_editor);
+}
+
void FormWidget::setTranslation(const QString &text, bool userAction)
{
m_editor->setPlainText(text, userAction);
diff --git a/tools/linguist/linguist/messageeditorwidgets.h b/tools/linguist/linguist/messageeditorwidgets.h
index b1609e5..fa65f3b 100644
--- a/tools/linguist/linguist/messageeditorwidgets.h
+++ b/tools/linguist/linguist/messageeditorwidgets.h
@@ -115,10 +115,14 @@ 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;
diff --git a/tools/linguist/linguist/phraseview.cpp b/tools/linguist/linguist/phraseview.cpp
index 72c27dc..e5c3508 100644
--- a/tools/linguist/linguist/phraseview.cpp
+++ b/tools/linguist/linguist/phraseview.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#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/recentfiles.cpp b/tools/linguist/linguist/recentfiles.cpp
index 6fc72f7..568f5c2 100644
--- a/tools/linguist/linguist/recentfiles.cpp
+++ b/tools/linguist/linguist/recentfiles.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#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/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index b9e8406..7f52c53 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -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/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp
index 50e85cb..c0960da 100644
--- a/tools/linguist/shared/numerus.cpp
+++ b/tools/linguist/shared/numerus.cpp
@@ -101,7 +101,7 @@ static const uchar arabicRules[] =
Q_EQ, 1, Q_NEWRULE,
Q_EQ, 2, Q_NEWRULE,
Q_MOD_100 | Q_BETWEEN, 3, 10, Q_NEWRULE,
- Q_MOD_100 | Q_NEQ, 0 };
+ Q_MOD_100 | Q_NOT | Q_BETWEEN, 0, 2 };
static const uchar tagalogRules[] =
{ Q_LEQ, 1, Q_NEWRULE,
Q_MOD_10 | Q_EQ, 4, Q_OR, Q_MOD_10 | Q_EQ, 6, Q_OR, Q_MOD_10 | Q_EQ, 9 };
@@ -127,7 +127,7 @@ static const char * const malteseForms[] =
static const char * const welshForms[] =
{ "Nullar", "Singular", "Dual", "Sexal", "Plural", 0 };
static const char * const arabicForms[] =
- { "Nullar", "Singular", "Dual", "Minority Plural", "Plural", "Plural Form for 100, 200, ...", 0 };
+ { "Nullar", "Singular", "Dual", "Minority Plural", "Plural", "Plural (100-102, ...)", 0 };
static const char * const tagalogForms[] =
{ "Singular", "Plural (consonant-ended)", "Plural (vowel-ended)", 0 };
static const char * const catalanForms[] = { "Singular", "Undecal (11)", "Plural", 0 };
@@ -246,6 +246,7 @@ static const QLocale::Language englishStyleLanguages[] = {
QLocale::Turkmen,
QLocale::Twi,
QLocale::Uigur,
+ QLocale::Urdu,
QLocale::Uzbek,
QLocale::Volapuk,
QLocale::Wolof,
diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp
index 799bf7d..77e74ef 100644
--- a/tools/linguist/shared/qph.cpp
+++ b/tools/linguist/shared/qph.cpp
@@ -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;
@@ -126,10 +112,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);
}
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index fb33de4..44401ed 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -678,13 +678,17 @@ int HtmlGenerator::generateAtom(const Atom *atom,
else if (atom->string() == ATOM_LIST_VALUE) {
threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom);
if (threeColumnEnumValueTable) {
- out() << "<p><table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">\n"
- "<tr><th width=\"25%\">Constant</th><th width=\"15%\">Value</th>"
- "<th width=\"60%\">Description</th></tr>\n";
+ out() << "<p><table class=\"valuelist\" border=\"1\" cellpadding=\"2\" "
+ << "cellspacing=\"1\" width=\"100%\">\n"
+ << "<tr><th width=\"25%\">Constant</th>"
+ << "<th width=\"15%\">Value</th>"
+ << "<th width=\"60%\">Description</th></tr>\n";
}
else {
- out() << "<p><table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" width=\"40%\">\n"
- << "<tr><th width=\"60%\">Constant</th><th width=\"40%\">Value</th></tr>\n";
+ out() << "<p><table class=\"valuelist\" border=\"1\" cellpadding=\"2\" "
+ << "cellspacing=\"1\" width=\"40%\">\n"
+ << "<tr><th width=\"60%\">Constant</th><th "
+ << "width=\"40%\">Value</th></tr>\n";
}
}
else {
@@ -858,14 +862,17 @@ int HtmlGenerator::generateAtom(const Atom *atom,
}
if (!atom->string().isEmpty()) {
if (atom->string().contains("%"))
- out() << "<p><table width=\"" << atom->string() << "\" "
+ out() << "<p><table class=\"generic\" width=\"" << atom->string() << "\" "
<< "align=\"center\" cellpadding=\"2\" "
<< "cellspacing=\"1\" border=\"0\">\n";
- else
- out() << "<p><table align=\"center\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n";
+ else {
+ out() << "<p><table class=\"generic\" align=\"center\" cellpadding=\"2\" "
+ << "cellspacing=\"1\" border=\"0\">\n";
+ }
}
else {
- out() << "<p><table align=\"center\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n";
+ out() << "<p><table class=\"generic\" align=\"center\" cellpadding=\"2\" "
+ << "cellspacing=\"1\" border=\"0\">\n";
}
numTableRows = 0;
break;
@@ -1577,7 +1584,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
QString tdTag;
if (numColumns > 1) {
tdTag = "<td width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";
- out() << "<p><table width=\"100%\">\n<tr valign=\"top\">" << tdTag << "\n";
+ out() << "<p><table class=\"toc\" width=\"100%\">\n<tr valign=\"top\">"
+ << tdTag << "\n";
}
// disable nested links in table of contents
@@ -1596,7 +1604,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
out() << "<ul>";
sectionNumber.append("1");
} while (sectionNumber.size() < nextLevel);
- } else {
+ }
+ else {
while (sectionNumber.size() > nextLevel) {
out() << "</ul>\n";
sectionNumber.removeLast();
@@ -1804,10 +1813,13 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative,
}
}
-void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker,
- const QMap<QString, const Node *> &nodeMap)
+void
+HtmlGenerator::generateAnnotatedList(const Node *relative,
+ CodeMarker *marker,
+ const QMap<QString,const Node *>&nodeMap)
{
- out() << "<p><table width=\"100%\" class=\"annotated\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n";
+ out() << "<p><table width=\"100%\" class=\"annotated\" cellpadding=\"2\" "
+ << "cellspacing=\"1\" border=\"0\">\n";
int row = 0;
foreach (const QString &name, nodeMap.keys()) {
@@ -1960,7 +1972,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker
}
firstOffset[NumColumns] = classMap.count();
- out() << "<p><table width=\"100%\">\n";
+ out() << "<p><table class=\"generic\" width=\"100%\">\n";
for (k = 0; k < numRows; k++) {
out() << "<tr>\n";
for (i = 0; i < NumColumns; i++) {
@@ -2213,12 +2225,12 @@ void HtmlGenerator::generateSectionList(const Section& section,
name_alignment = false;
}
if (name_alignment) {
- out() << "<table border=\"0\" cellpadding=\"0\" "
+ out() << "<table class=\"alignedsummary\" border=\"0\" cellpadding=\"0\" "
<< "cellspacing=\"0\" width=\"100%\">\n";
}
else {
if (twoColumn)
- out() << "<p><table width=\"100%\" "
+ out() << "<p><table class=\"propsummary\" width=\"100%\" "
<< "border=\"0\" cellpadding=\"0\""
<< " cellspacing=\"0\">\n"
<< "<tr><td width=\"45%\" valign=\"top\">";
@@ -2513,12 +2525,13 @@ void HtmlGenerator::generateSectionList(const Section& section,
bool twoColumn = false;
if (style == CodeMarker::SeparateList) {
twoColumn = (section.members.count() >= 16);
- } else if (section.members.first()->type() == Node::Property) {
+ }
+ else if (section.members.first()->type() == Node::Property) {
twoColumn = (section.members.count() >= 5);
}
if (twoColumn)
- out() << "<p><table width=\"100%\" border=\"0\" cellpadding=\"0\""
- " cellspacing=\"0\">\n"
+ out() << "<p><table class=\"generic\" width=\"100%\" border=\"0\" "
+ << "cellpadding=\"0\" cellspacing=\"0\">\n"
<< "<tr><td width=\"45%\" valign=\"top\">";
out() << "<ul>\n";
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index 9c59c81..7f22861 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -17,7 +17,7 @@ h3.fn,span.fn
background-color: #eee;
border-width: 1px;
border-style: solid;
- border-color: #ddd #ddd #ddd #ddd ;
+ border-color: #ddd;
font-weight: bold;
padding: 6px 0px 6px 10px;
margin: 42px 0px 0px 0px;
@@ -25,7 +25,7 @@ h3.fn,span.fn
hr {
border: 0;
- color: #9E9E9E;
+ color: #a0a0a0;
background-color: #ccc;
height: 1px;
width: 100%;
@@ -33,29 +33,44 @@ hr {
margin: 34px 0px 34px 0px;
}
-table {
+table.valuelist {
border-width: 1px 1px 1px 1px;
border-style: solid;
border-color: #dddddd;
border-collapse: collapse;
background-color: #f0f0f0;
- margin-left: 1.5%;
- width: 97%
}
-table th {
+table.indextable {
+ border-width: 1px 1px 1px 1px;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+ border-color:#555;
+}
+
+
+table.valuelist th {
border-width: 1px 1px 1px 2px;
padding: 4px;
border-style: solid;
+ border-color: #666;
+ color:white;
+ background-color:#666;
+}
+
+th.titleheader {
+ border-width: 1px 0px 1px 0px;
+ padding: 4px;
+ border-style: solid;
border-color: #444;
color:white;
- background-color:#444;
+ background-color:#555555;
}
p {
- margin-left: 1.5%;
+
+ margin-left: 4px;
margin-top: 8px;
- width: 97%
margin-bottom: 8px;
}
@@ -101,42 +116,31 @@ body
color: black
}
+table.generic, table.annotated
+{
+ border-width: 1px;
+ border-color:#bbb;
+ border-style:solid;
+ border-collapse:collapse;
+}
+
table td.memItemLeft {
- width: 200px;
+ width: 160px;
padding: 2px 0px 0px 8px;
margin: 4px;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-color: #E0E0E0;
- border-right-color: #E0E0E0;
- border-bottom-color: #E0E0E0;
- border-left-color: #E0E0E0;
- border-top-style: none;
- border-right-style: none;
- border-bottom-style: none;
- border-left-style: none;
- background-color: #FAFAFA;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
font-size: 100%;
white-space: nowrap
}
+
table td.memItemRight {
padding: 2px 8px 0px 8px;
margin: 4px;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-color: #E0E0E0;
- border-right-color: #E0E0E0;
- border-bottom-color: #E0E0E0;
- border-left-color: #E0E0E0;
- border-top-style: none;
- border-right-style: none;
- border-bottom-style: none;
- border-left-style: none;
- background-color: #FAFAFA;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
font-size: 100%;
}
diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf
index 107c692..cfb3afd 100644
--- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf
+++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf
@@ -65,7 +65,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
QT_BEGIN_INCLUDE_NAMESPACE \
QT_END_NAMESPACE \
QT_END_INCLUDE_NAMESPACE \
- PHONON_EXPORT
+ PHONON_EXPORT \
+ Q_GADGET
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \
diff --git a/tools/qdoc3/test/qt-inc.qdocconf b/tools/qdoc3/test/qt-inc.qdocconf
index d6cb0e6..01b07b3 100644
--- a/tools/qdoc3/test/qt-inc.qdocconf
+++ b/tools/qdoc3/test/qt-inc.qdocconf
@@ -99,7 +99,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
Q_TESTLIB_EXPORT \
Q_TYPENAME \
Q_XML_EXPORT \
- QDBUS_EXPORT
+ QDBUS_EXPORT \
+ Q_GADGET
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \
diff --git a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf
index 127b578..3a22886 100644
--- a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf
+++ b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf
@@ -7,5 +7,5 @@ HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
"<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\"><a href=\"http://doc.qtsoftware.com/trademarks.html\">Trademarks</a></td>\n" \
- "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt Eclipse Integration 1.4.3</div></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt Eclipse Integration 1.5.2</div></td>\n" \
"</tr></table></div></address>"