From f1603d5a8738b13e1c1402e29f393dfbdf079a25 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Feb 2010 14:30:49 +0100 Subject: add const Reviewed-by: hjk --- src/corelib/tools/qstringbuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index ddb5c7d..74661c2 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -71,7 +71,7 @@ public: private: const int m_size; - const char *m_data; + const char * const m_data; }; struct Q_CORE_EXPORT QAbstractConcatenable -- cgit v0.12 From b0e4af35ec8ddb5e7bfa658f916fbf29caa5a550 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Feb 2010 14:32:10 +0100 Subject: remove the rounded extra frame around the main message editor for one, it just added visual noise. second, it did not respect the color scheme, which made it unusable with light-on-dark colors. Task-number: QTBUG-7778 --- tools/linguist/linguist/messageeditor.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index 91c88da..4aeac89 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -135,12 +135,8 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent) void MessageEditor::setupEditorPage() { QFrame *editorPage = new QFrame; - editorPage->setObjectName(QLatin1String("editorPage")); editorPage->setStyleSheet(QLatin1String( - "QFrame#editorPage { border-image: url(:/images/transbox.png) 12 16 16 12 repeat;" - " border-width: 12px 16px 16px 12px; }" - "QFrame#editorPage { background-color: white; }" "QLabel { font-weight: bold; }" )); editorPage->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); -- cgit v0.12 From 662f94d478063f05155e3d2345aa6617f602ef38 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Feb 2010 14:35:55 +0100 Subject: don't use stylesheet for just making labels bold --- tools/linguist/linguist/messageeditor.cpp | 4 ---- tools/linguist/linguist/messageeditorwidgets.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index 4aeac89..b6c1688 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -135,10 +135,6 @@ MessageEditor::MessageEditor(MultiDataModel *dataModel, QMainWindow *parent) void MessageEditor::setupEditorPage() { QFrame *editorPage = new QFrame; - - editorPage->setStyleSheet(QLatin1String( - "QLabel { font-weight: bold; }" - )); editorPage->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); m_source = new FormWidget(tr("Source text"), false); diff --git a/tools/linguist/linguist/messageeditorwidgets.cpp b/tools/linguist/linguist/messageeditorwidgets.cpp index 8b4fa62..4d31db2 100644 --- a/tools/linguist/linguist/messageeditorwidgets.cpp +++ b/tools/linguist/linguist/messageeditorwidgets.cpp @@ -171,6 +171,9 @@ FormWidget::FormWidget(const QString &label, bool isEditable, QWidget *parent) layout->setMargin(0); m_label = new QLabel(this); + QFont fnt; + fnt.setBold(true); + m_label->setFont(fnt); m_label->setText(label); layout->addWidget(m_label); @@ -249,6 +252,9 @@ FormMultiWidget::FormMultiWidget(const QString &label, QWidget *parent) m_minusIcon(QIcon(QLatin1String(":/images/minus.png"))) { m_label = new QLabel(this); + QFont fnt; + fnt.setBold(true); + m_label->setFont(fnt); m_label->setText(label); m_plusButtons.append( -- cgit v0.12 From cf14db1f16fffd7755d6200aaa6769a57a9da99d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Feb 2010 16:27:19 +0100 Subject: don't use QKeySequence::mnemonic() after all it wastes cpu cycles, and it started flooding the console with irrelevant messages. --- tools/linguist/linguist/mainwindow.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 008ebb1..6e5c656 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -94,6 +94,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE static const int MessageMS = 2500; @@ -2356,13 +2358,28 @@ void MainWindow::updatePhraseDicts() static bool haveMnemonic(const QString &str) { - QString mnemonic = QKeySequence::mnemonic(str); - if (mnemonic == QLatin1String("Alt+Space")) { - // "Nobody" ever really uses these, and they are highly annoying - // because we get a lot of false positives. - return false; + for (const ushort *p = (ushort *)str.constData();; ) { // Assume null-termination + ushort c = *p++; + if (!c) + break; + if (c == '&') { + c = *p++; + if (!c) + return false; + // "Nobody" ever really uses these alt-space, and they are highly annoying + // because we get a lot of false positives. + if (c != '&' && c != ' ' && QChar(c).isPrint()) { + const ushort *pp = p; + for (; ::isalpha(*p); p++) ; + if (pp == p || *p != ';') + return true; + // This looks like a HTML &entity;, so ignore it. As a HTML string + // won't contain accels anyway, we can stop scanning here. + break; + } + } } - return !mnemonic.isEmpty(); + return false; } void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose) -- cgit v0.12