From 14321e675ddf5cea86077044493885c010b01131 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 29 Apr 2009 17:46:37 +0200 Subject: [PATCH 01/11] debugger: add dumper for QWeakPointer --- share/qtcreator/gdbmacros/gdbmacros.cpp | 62 +++++++++++++++++++++---- src/plugins/debugger/gdbengine.cpp | 5 +- tests/manual/gdbdebugger/simple/app.cpp | 10 ++-- 3 files changed, 61 insertions(+), 16 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 029de5f6a6c..5cd7ed519ce 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -2187,6 +2187,44 @@ static void qDumpQVector(QDumper &d) d.disarm(); } +static void qDumpQWeakPointer(QDumper &d) +{ + const int v = sizeof(void *); + const void *value = deref(addOffset(d.data, v)); + + if (isSimpleType(d.innertype)) + qDumpInnerValueHelper(d, d.innertype, value); + else + P(d, "value", ""); + P(d, "valuedisabled", "true"); + P(d, "numchild", 1); + if (d.dumpChildren) { + d << ",children=["; + d.beginHash(); + P(d, "name", "data"); + qDumpInnerValue(d, d.innertype, value); + d.endHash(); + d.beginHash(); + const void *weak = addOffset(deref(d.data), v); + P(d, "name", "weakref"); + P(d, "value", *static_cast(weak)); + P(d, "type", "int"); + P(d, "addr", weak); + P(d, "numchild", "0"); + d.endHash(); + d.beginHash(); + const void *strong = addOffset(weak, sizeof(int)); + P(d, "name", "strongref"); + P(d, "value", *static_cast(strong)); + P(d, "type", "int"); + P(d, "addr", strong); + P(d, "numchild", "0"); + d.endHash(); + d << "]"; + } + d.disarm(); +} + static void qDumpStdList(QDumper &d) { const std::list &list = *reinterpret_cast *>(d.data); @@ -2559,16 +2597,6 @@ static void handleProtocolVersion2and3(QDumper & d) else if (isEqual(type, "QStringList")) qDumpQStringList(d); break; - case 'T': - if (isEqual(type, "QTextCodec")) - qDumpQTextCodec(d); - break; - case 'V': - if (isEqual(type, "QVariant")) - qDumpQVariant(d); - else if (isEqual(type, "QVector")) - qDumpQVector(d); - break; case 's': if (isEqual(type, "wstring")) qDumpStdWString(d); @@ -2589,6 +2617,19 @@ static void handleProtocolVersion2and3(QDumper & d) else if (isEqual(type, "std::wstring")) qDumpStdWString(d); break; + case 'T': + if (isEqual(type, "QTextCodec")) + qDumpQTextCodec(d); + break; + case 'V': + if (isEqual(type, "QVariant")) + qDumpQVariant(d); + else if (isEqual(type, "QVector")) + qDumpQVector(d); + break; + case 'W': + if (isEqual(type, "QWeakPointer")) + qDumpQWeakPointer(d); } if (!d.success) @@ -2664,6 +2705,7 @@ void *qDumpObjectData440( "\""NS"QTextCodec\"," "\""NS"QVariant\"," "\""NS"QVector\"," + "\""NS"QWeakPointer\"," "\""NS"QWidget\"," #ifdef Q_OS_WIN "\"basic_string\"," diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 04966d4023d..d391907adca 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -3047,11 +3047,10 @@ void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren) //int protocol = isDisplayedIName(data.iname) ? 3 : 2; QString addr; - if (data.addr.startsWith(QLatin1String("0x"))) { + if (data.addr.startsWith(QLatin1String("0x"))) addr = QLatin1String("(void*)") + data.addr; - } else { + else addr = QLatin1String("&(") + data.exp + QLatin1Char(')'); - } sendWatchParameters(params); diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 608198bb28d..a5b0d0c2a6a 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -549,9 +549,13 @@ void testQSharedPointer() QSharedPointer ptr2 = ptr; QSharedPointer ptr3 = ptr; - //QWeakPointer wptr(ptr); - //QWeakPointer wptr2 = wptr; - //QWeakPointer wptr3 = wptr; + QWeakPointer wiptr(iptr); + QWeakPointer wiptr2 = wiptr; + QWeakPointer wiptr3 = wiptr; + + QWeakPointer wptr(ptr); + QWeakPointer wptr2 = wptr; + QWeakPointer wptr3 = wptr; } void stringRefTest(const QString &refstring) From 0ce788a42af778ed1fe524d872f9776e6066b899 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 29 Apr 2009 17:52:19 +0200 Subject: [PATCH 02/11] debugger: remove some duplicated code --- src/plugins/debugger/scriptengine.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp index a0feae91826..76451774c71 100644 --- a/src/plugins/debugger/scriptengine.cpp +++ b/src/plugins/debugger/scriptengine.cpp @@ -38,6 +38,7 @@ #include "registerhandler.h" #include "stackhandler.h" #include "watchhandler.h" +#include "watchutils.h" #include "moduleshandler.h" #include @@ -422,28 +423,6 @@ static WatchData m_toolTip; static QPoint m_toolTipPos; static QHash m_toolTipCache; -static bool hasLetterOrNumber(const QString &exp) -{ - for (int i = exp.size(); --i >= 0; ) - if (exp[i].isLetterOrNumber()) - return true; - return false; -} - -static bool hasSideEffects(const QString &exp) -{ - // FIXME: complete? - return exp.contains("-=") - || exp.contains("+=") - || exp.contains("/=") - || exp.contains("*=") - || exp.contains("&=") - || exp.contains("|=") - || exp.contains("^=") - || exp.contains("--") - || exp.contains("++"); -} - void ScriptEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) { Q_UNUSED(pos); From b72b4142dc201f6de07989628bcc23bd1f03a3e3 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 29 Apr 2009 18:03:35 +0200 Subject: [PATCH 03/11] debugger: code cosmetics --- src/plugins/debugger/watchutils.cpp | 38 +++++++++++++++-------------- src/plugins/debugger/watchutils.h | 6 +++-- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index c77fc0a5b39..5be973677e1 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -166,8 +166,10 @@ bool isPointerType(const QString &type) bool isAccessSpecifier(const QString &str) { - static const QStringList items = - QStringList() << QLatin1String("private") << QLatin1String("protected") << QLatin1String("public"); + static const QStringList items = QStringList() + << QLatin1String("private") + << QLatin1String("protected") + << QLatin1String("public"); return items.contains(str); } @@ -326,28 +328,28 @@ static QString quoteUnprintableLatin1(const QByteArray &ba) return res; } -QString decodeData(const QByteArray &baIn, int encoding) +QString decodeData(const QByteArray &ba, int encoding) { switch (encoding) { case 0: // unencoded 8 bit data - return quoteUnprintableLatin1(baIn); + return quoteUnprintableLatin1(ba); case 1: { // base64 encoded 8 bit data, used for QByteArray const QChar doubleQuote(QLatin1Char('"')); QString rc = doubleQuote; - rc += quoteUnprintableLatin1(QByteArray::fromBase64(baIn)); + rc += quoteUnprintableLatin1(QByteArray::fromBase64(ba)); rc += doubleQuote; return rc; } case 2: { // base64 encoded 16 bit data, used for QString const QChar doubleQuote(QLatin1Char('"')); - const QByteArray ba = QByteArray::fromBase64(baIn); + const QByteArray ba = QByteArray::fromBase64(ba); QString rc = doubleQuote; rc += QString::fromUtf16(reinterpret_cast(ba.data()), ba.size() / 2); rc += doubleQuote; return rc; } case 3: { // base64 encoded 32 bit data - const QByteArray ba = QByteArray::fromBase64(baIn); + const QByteArray ba = QByteArray::fromBase64(ba); const QChar doubleQuote(QLatin1Char('"')); QString rc = doubleQuote; rc += QString::fromUcs4(reinterpret_cast(ba.data()), ba.size() / 4); @@ -355,7 +357,7 @@ QString decodeData(const QByteArray &baIn, int encoding) return rc; } case 4: { // base64 encoded 16 bit data, without quotes (see 2) - const QByteArray ba = QByteArray::fromBase64(baIn); + const QByteArray ba = QByteArray::fromBase64(ba); return QString::fromUtf16(reinterpret_cast(ba.data()), ba.size() / 2); } } @@ -374,7 +376,6 @@ QtDumperResult::QtDumperResult() : valuedisabled(false), childCount(0), internal(false) - { } @@ -598,7 +599,6 @@ QtDumperHelper::Type QtDumperHelper::specialType(QString s) return UnknownType; } - bool QtDumperHelper::needsExpressionSyntax(Type t) { switch (t) { @@ -614,7 +614,7 @@ bool QtDumperHelper::needsExpressionSyntax(Type t) return true; default: break; - } + } return false; } @@ -652,9 +652,8 @@ void QtDumperHelper::parseQueryTypes(const QStringList &l, Debugger debugger) const Type t = specialType(l.at(i)); if (t != UnknownType) { // Exclude types that require expression syntax for CDB - if (debugger == GdbDebugger || !needsExpressionSyntax(t)) { + if (debugger == GdbDebugger || !needsExpressionSyntax(t)) m_nameTypeMap.insert(l.at(i), t); - } } else { m_nameTypeMap.insert(l.at(i), SupportedType); } @@ -668,7 +667,8 @@ void QtDumperHelper::parseQueryTypes(const QStringList &l, Debugger debugger) * value="dABoAHIAZQBlAA==",valueencoded="2"}]" * Default implementation can be used for debugging purposes. */ -class DumperParser { +class DumperParser +{ public: explicit DumperParser(const char *s) : m_s(s) {} bool run(); @@ -1182,11 +1182,13 @@ void QtDumperHelper::evaluationParameters(const WatchData &data, /* Parse value: * "iname="local.sl",addr="0x0012BA84",value="<3 items>",valuedisabled="true", - * numchild="3",childtype="QString",childnumchild="0",children=[{name="0",value="", - * valueencoded="2"},{name="1",value="dAB3AG8A",valueencoded="2"},{name="2", - * value="dABoAHIAZQBlAA==",valueencoded="2"}]" */ + * numchild="3",childtype="QString",childnumchild="0", + * children=[{name="0",value="",valueencoded="2"}, + * {name="1",value="dAB3AG8A",valueencoded="2"}, + * {name="2",value="dABoAHIAZQBlAA==",valueencoded="2"}]" */ -class ValueDumperParser : public DumperParser { +class ValueDumperParser : public DumperParser +{ public: explicit ValueDumperParser(const char *s); diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h index e316973ca13..47f73a8bb79 100644 --- a/src/plugins/debugger/watchutils.h +++ b/src/plugins/debugger/watchutils.h @@ -114,7 +114,8 @@ QDebug operator<<(QDebug in, const QtDumperResult &d); * 2) Evaluate symbol, taking address and some additional parameters * depending on type. */ -class QtDumperHelper { +class QtDumperHelper +{ public: enum Debugger { GdbDebugger, // Can evalulate expressions in function calls @@ -127,7 +128,7 @@ public: // Below types require special handling QObjectType, QWidgetType, QObjectSlotType, QObjectSignalType, QVectorType, QMapType, QMultiMapType, QMapNodeType, - StdVectorType, StdDequeType, StdSetType,StdMapType, StdStackType, + StdVectorType, StdDequeType, StdSetType, StdMapType, StdStackType, StdStringType }; @@ -203,6 +204,7 @@ private: }; QDebug operator<<(QDebug in, const QtDumperHelper::TypeData &d); + } // namespace Internal } // namespace Debugger From feb34c0e6fde4f04f04476054554a5fef75a32a4 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 Apr 2009 10:01:54 +0200 Subject: [PATCH 04/11] Introduce a new QStringBuilder helper class to speed up building strings from smaller chunks using expression templates. Simple test and benchmark included, the class is not yet complete. --- src/libs/utils/qstringbuilder.cpp | 131 ++++++++++++++ src/libs/utils/qstringbuilder.h | 162 ++++++++++++++++++ tests/auto/qstringbuilder/qstringbuilder.pro | 11 ++ .../qstringbuilder/tst_qstringbuilder.cpp | 48 ++++++ tests/benchmarks/qstringbuilder/main.cpp | 84 +++++++++ .../qstringbuilder/qstringbuilder.pro | 12 ++ 6 files changed, 448 insertions(+) create mode 100644 src/libs/utils/qstringbuilder.cpp create mode 100644 src/libs/utils/qstringbuilder.h create mode 100644 tests/auto/qstringbuilder/qstringbuilder.pro create mode 100644 tests/auto/qstringbuilder/tst_qstringbuilder.cpp create mode 100644 tests/benchmarks/qstringbuilder/main.cpp create mode 100644 tests/benchmarks/qstringbuilder/qstringbuilder.pro diff --git a/src/libs/utils/qstringbuilder.cpp b/src/libs/utils/qstringbuilder.cpp new file mode 100644 index 00000000000..f3925e56b5e --- /dev/null +++ b/src/libs/utils/qstringbuilder.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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 "qstringbuilder.h" + +/*! + \class QLatin1Literal + \reentrant + + \brief The QLatin1Literal class provides a thin wrapper of string literal + used in source codes. + + The main use of \c QLatin1Literal is in conjunction with \c QStringBuilder + to reduce the number of reallocations needed to build up a string from + smaller chunks. + + Contrary to \c QLatin1String, a \c QLatin1Literal can retrieve its size + int \i{O(1)}. + + \ingroup tools + \ingroup shared + \ingroup text + \mainclass + + \sa QStringBuilder, QLatin1String, QString + +*/ + +/*! \fn QLatin1Literal::QLatin1Literal(const char(&literal)[]) + + The only constructor of the class. +*/ + +/*! \fn int QLatin1Literal::size() const + + Returns the number of characters in the literal \i{not} including + the trailing NUL char. +*/ + +/*! \fn char *QLatin1Literal::size() const + + Returns a pointer to the first character of the string literal. + The string literal is terminated by a NUL character. +*/ + +/*! \fn QLatin1Literal::operator QString() const + + Converts the \c QLatin1Literal into a \c QString object. +*/ + + +/*! + \class QStringBuilderPair + \reentrant + + \brief QStringBuilderPair is a helper class template for building + QStringBuilder objects wrapping two smaller QStringBuilder object. +*/ + + +/*! + \class QStringBuilder + \reentrant + + \brief QStringBuilder is a template class providing a facility to build + up QStrings from smaller chunks. + + \ingroup tools + \ingroup shared + \ingroup text + \mainclass + + When creating strings from smaller chunks, typically \c QString::operator+() + is used, resulting \i{n - 1} reallocations when operating on \i{n} chunks. + + QStringBuilder uses expression + templates to collect the individual parts, compute the total size, + allocate memory for the resulting QString object, and copy the contents + of the chunks into the result. + + Using \c QStringBuilder::operator%() yield generally better performance then + using \c QString::operator+() on the same chunks if there are three or + more of them, and equal performance otherwise. + + \sa QLatin1Literal, QString +*/ + +/* !fn template QStringBuilder< QStringBuilderPair > operator%(const A &a, const B &b) + + Creates a helper object containing both parameters. + + This is the main function to build up +*/ diff --git a/src/libs/utils/qstringbuilder.h b/src/libs/utils/qstringbuilder.h new file mode 100644 index 00000000000..cbe0d443531 --- /dev/null +++ b/src/libs/utils/qstringbuilder.h @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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 QSTRINGBUILDER_H +#define QSTRINGBUILDER_H + +#include + +#include + +class QLatin1Literal +{ +public: + template + QLatin1Literal(const char (&str)[N]) : m_size(N - 1), m_data(str) {} + + int size() const { return m_size; } + const char *data() const { return m_data; } + + void append(QChar *&out) const + { + const char *s = m_data; + for (int i = m_size; --i >= 0;) + *out++ = *s++; + } + + operator QString() const + { + QString s; + s.resize(m_size); + QChar *d = s.data(); + append(d); + return s; + } + +private: + const int m_size; + const char *m_data; +}; + +template +class QStringBuilder : public A +{ +public: + QStringBuilder(A a_) : A(a_) {} + + operator QString() const + { + QString s; + s.resize(this->size()); + QChar *d = s.data(); + this->append(d); + return s; + } + +}; + +template <> +class QStringBuilder +{ +public: + QStringBuilder(const QString &a_) : a(&a_) {} + + inline int size() const { return a->size(); } + + inline void append(QChar *&out) const + { + const int n = a->size(); + memcpy(out, (char*)a->constData(), sizeof(QChar) * n); + out += n; + } + + inline operator QString() const { return *a; } + +private: + const QString *a; +}; + +template +class QStringBuilderPair +{ +public: + QStringBuilderPair(A a_, B b_) : a(a_), b(b_) {} + inline int size() const { return a.size() + b.size(); } + inline void append(QChar *&out) const { a.append(out); b.append(out); } +private: + A a; + B b; +}; + + +template +QStringBuilder< QStringBuilderPair > +operator%(const A &a, const B &b) +{ + return QStringBuilderPair (a, b); +} + +template +inline QStringBuilder< QStringBuilderPair > > +operator%(const A &a, const QString &b) +{ + return QStringBuilderPair > (a, b); +} + +template +inline QStringBuilder< QStringBuilderPair, B> > +operator%(const QString &a, const B &b) +{ + return QStringBuilderPair, B> (a, b); +} + + +inline QStringBuilder< + QStringBuilderPair, + QStringBuilder > +> +operator%(const QString &a, const QString &b) +{ + return QStringBuilderPair< QStringBuilder, + QStringBuilder > (a, b); +} + +#endif // QSTRINGBUILDER_H diff --git a/tests/auto/qstringbuilder/qstringbuilder.pro b/tests/auto/qstringbuilder/qstringbuilder.pro new file mode 100644 index 00000000000..5416ca413ab --- /dev/null +++ b/tests/auto/qstringbuilder/qstringbuilder.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +SOURCES += tst_qstringbuilder.cpp + +QT -= gui + +QT = core + +DEFINES += QT_NO_CAST_TO_ASCII + + + diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp new file mode 100644 index 00000000000..2e58d1252aa --- /dev/null +++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +****************************************************************************/ + +#include +#include "../../../src/libs/utils/qstringbuilder.h" + +//TESTED_CLASS=QStringBuilder +//TESTED_FILES=qstringbuilder.h + +class tst_QStringBuilder : public QObject +{ + Q_OBJECT + +public: + tst_QStringBuilder(); + ~tst_QStringBuilder() {} + +public slots: + void init() {} + void cleanup() {} + +private slots: + void operator_percent(); +}; + + +tst_QStringBuilder::tst_QStringBuilder() +{ + //QTextCodec::setCodecForLocale(QTextCodec::codecForName("ISO 8859-1")); +} + +void tst_QStringBuilder::operator_percent() +{ + QLatin1Literal l1literal("a literal"); + QLatin1String l1string("a literal"); + QLatin1Char l1char('c'); + QChar qchar(l1char); + + QCOMPARE(QString(l1literal % l1literal), QString(l1string + l1string)); +} + +QTEST_APPLESS_MAIN(tst_QStringBuilder) + +#include "tst_qstringbuilder.moc" diff --git a/tests/benchmarks/qstringbuilder/main.cpp b/tests/benchmarks/qstringbuilder/main.cpp new file mode 100644 index 00000000000..9b2bc99a7cd --- /dev/null +++ b/tests/benchmarks/qstringbuilder/main.cpp @@ -0,0 +1,84 @@ + +#include +#include + +#include "../../../src/libs/utils/qstringbuilder.h" + +#include + + +class tst_qstringbuilder : public QObject +{ + Q_OBJECT + +public: + tst_qstringbuilder(); + +private slots: + // QStringBuilder based + void builderbased_l1literal_l1literal(); + void builderbased_l1literal_l1literal_l1literal(); + void builderbased_l1literal_l1literal_l1literal_l1literal(); + + // QString based for comparison + void stringbased_l1string_l1string(); + void stringbased_l1string_l1string_l1string(); + void stringbased_l1string_l1string_l1string_l1string(); + +private: + const QLatin1Literal l1literal; + const QLatin1String l1string; +}; + + +tst_qstringbuilder::tst_qstringbuilder() + : l1literal("some literal"), l1string("some literal") +{} + +void tst_qstringbuilder::builderbased_l1literal_l1literal() +{ + QString result; + QBENCHMARK { result = l1literal % l1literal; } + QCOMPARE(result, l1string + l1string); +} + +void tst_qstringbuilder::builderbased_l1literal_l1literal_l1literal() +{ + QString result; + QBENCHMARK { result = l1literal % l1literal % l1literal; } + QCOMPARE(result, l1string + l1string + l1string); +} + +void tst_qstringbuilder::builderbased_l1literal_l1literal_l1literal_l1literal() +{ + QString result; + QBENCHMARK { result = l1literal % l1literal % l1literal % l1literal; } + QCOMPARE(result, l1string + l1string + l1string + l1string); +} + + + +void tst_qstringbuilder::stringbased_l1string_l1string() +{ + QString result; + QBENCHMARK { result = l1string + l1string; } + QCOMPARE(result, QString(l1literal % l1literal)); +} + +void tst_qstringbuilder::stringbased_l1string_l1string_l1string() +{ + QString result; + QBENCHMARK { result = l1string + l1string + l1string; } + QCOMPARE(result, QString(l1literal % l1literal % l1literal)); +} + +void tst_qstringbuilder::stringbased_l1string_l1string_l1string_l1string() +{ + QString result; + QBENCHMARK { result = l1string + l1string + l1string + l1string; } + QCOMPARE(result, QString(l1literal % l1literal % l1literal % l1literal)); +} + +QTEST_MAIN(tst_qstringbuilder) + +#include "main.moc" diff --git a/tests/benchmarks/qstringbuilder/qstringbuilder.pro b/tests/benchmarks/qstringbuilder/qstringbuilder.pro new file mode 100644 index 00000000000..81c42bc565d --- /dev/null +++ b/tests/benchmarks/qstringbuilder/qstringbuilder.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qstringbuilder +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp From 7c8735b7715df8139646a13838f6f6750a56020b Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 Apr 2009 10:29:48 +0200 Subject: [PATCH 05/11] Make QStringBuilder work with plain 'char' "chunks". --- src/libs/utils/qstringbuilder.h | 50 ++++++++++++++++++++++-- tests/benchmarks/qstringbuilder/main.cpp | 48 +++++++++++++++++------ 2 files changed, 82 insertions(+), 16 deletions(-) diff --git a/src/libs/utils/qstringbuilder.h b/src/libs/utils/qstringbuilder.h index cbe0d443531..d9a5d9132cf 100644 --- a/src/libs/utils/qstringbuilder.h +++ b/src/libs/utils/qstringbuilder.h @@ -114,6 +114,22 @@ private: const QString *a; }; + +template <> +class QStringBuilder +{ +public: + QStringBuilder(char c_) : c(c_) {} + + inline int size() const { return 1; } + inline void append(QChar *&out) const { *out++ = QLatin1Char(c); } + +private: + const char c; +}; + + + template class QStringBuilderPair { @@ -134,6 +150,9 @@ operator%(const A &a, const B &b) return QStringBuilderPair (a, b); } + +// QString related specializations + template inline QStringBuilder< QStringBuilderPair > > operator%(const A &a, const QString &b) @@ -148,10 +167,8 @@ operator%(const QString &a, const B &b) return QStringBuilderPair, B> (a, b); } - inline QStringBuilder< - QStringBuilderPair, - QStringBuilder > + QStringBuilderPair, QStringBuilder > > operator%(const QString &a, const QString &b) { @@ -159,4 +176,31 @@ operator%(const QString &a, const QString &b) QStringBuilder > (a, b); } +// char related specializations + +template +inline QStringBuilder< QStringBuilderPair > > +operator%(const A &a, char b) +{ + return QStringBuilderPair > (a, b); +} + +template +inline QStringBuilder< QStringBuilderPair, B> > +operator%(char a, const B &b) +{ + return QStringBuilderPair, B> (a, b); +} + +inline QStringBuilder< + QStringBuilderPair, QStringBuilder > +> +operator%(const QString &a, char b) +{ + return QStringBuilderPair< + QStringBuilder, QStringBuilder + > (a, b); +} + + #endif // QSTRINGBUILDER_H diff --git a/tests/benchmarks/qstringbuilder/main.cpp b/tests/benchmarks/qstringbuilder/main.cpp index 9b2bc99a7cd..ba5cfe0a762 100644 --- a/tests/benchmarks/qstringbuilder/main.cpp +++ b/tests/benchmarks/qstringbuilder/main.cpp @@ -16,69 +16,91 @@ public: private slots: // QStringBuilder based - void builderbased_l1literal_l1literal(); - void builderbased_l1literal_l1literal_l1literal(); - void builderbased_l1literal_l1literal_l1literal_l1literal(); + void b_separator() { qDebug() << "\n------- QStringBuilder based ----------"; } + void b_2_l1literal(); + void b_3_l1literal(); + void b_4_l1literal(); + void b_string_4_char(); // QString based for comparison - void stringbased_l1string_l1string(); - void stringbased_l1string_l1string_l1string(); - void stringbased_l1string_l1string_l1string_l1string(); + void s_separator() { qDebug() << "\n-------- QString based ---------"; } + void s_2_l1string(); + void s_3_l1string(); + void s_4_l1string(); + void s_string_4_char(); private: const QLatin1Literal l1literal; const QLatin1String l1string; + const QString string; + const char achar; }; tst_qstringbuilder::tst_qstringbuilder() - : l1literal("some literal"), l1string("some literal") + : l1literal("some literal"), + l1string("some literal"), + string(l1string), + achar('c') {} -void tst_qstringbuilder::builderbased_l1literal_l1literal() +void tst_qstringbuilder::b_2_l1literal() { QString result; QBENCHMARK { result = l1literal % l1literal; } QCOMPARE(result, l1string + l1string); } -void tst_qstringbuilder::builderbased_l1literal_l1literal_l1literal() +void tst_qstringbuilder::b_3_l1literal() { QString result; QBENCHMARK { result = l1literal % l1literal % l1literal; } QCOMPARE(result, l1string + l1string + l1string); } -void tst_qstringbuilder::builderbased_l1literal_l1literal_l1literal_l1literal() +void tst_qstringbuilder::b_4_l1literal() { QString result; QBENCHMARK { result = l1literal % l1literal % l1literal % l1literal; } QCOMPARE(result, l1string + l1string + l1string + l1string); } +void tst_qstringbuilder::b_string_4_char() +{ + QString result; + QBENCHMARK { result = string + achar + achar + achar; } + QCOMPARE(result, QString(string % achar % achar % achar)); +} -void tst_qstringbuilder::stringbased_l1string_l1string() +void tst_qstringbuilder::s_2_l1string() { QString result; QBENCHMARK { result = l1string + l1string; } QCOMPARE(result, QString(l1literal % l1literal)); } -void tst_qstringbuilder::stringbased_l1string_l1string_l1string() +void tst_qstringbuilder::s_3_l1string() { QString result; QBENCHMARK { result = l1string + l1string + l1string; } QCOMPARE(result, QString(l1literal % l1literal % l1literal)); } -void tst_qstringbuilder::stringbased_l1string_l1string_l1string_l1string() +void tst_qstringbuilder::s_4_l1string() { QString result; QBENCHMARK { result = l1string + l1string + l1string + l1string; } QCOMPARE(result, QString(l1literal % l1literal % l1literal % l1literal)); } +void tst_qstringbuilder::s_string_4_char() +{ + QString result; + QBENCHMARK { result = string + achar + achar + achar; } + QCOMPARE(result, QString(string % achar % achar % achar)); +} + QTEST_MAIN(tst_qstringbuilder) #include "main.moc" From b68a06799c6b3ab753c2a5c40d60de37c3dad7db Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 Apr 2009 12:16:48 +0200 Subject: [PATCH 06/11] debugger: code cosmetics --- src/plugins/debugger/cdb/cdbcom.h | 1 + src/plugins/debugger/cdb/cdbdumperhelper.h | 4 ++-- src/plugins/debugger/cdb/cdboptions.cpp | 1 + src/plugins/debugger/cdb/cdbstacktracecontext.h | 2 +- src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp | 6 +++++- src/plugins/debugger/cdb/cdbsymbolgroupcontext.h | 3 ++- src/plugins/debugger/win/dbgwinutils.cpp | 5 +++-- src/plugins/debugger/win/dbgwinutils.h | 11 ++++++----- src/plugins/debugger/win/peutils.cpp | 6 +++--- src/plugins/debugger/win/peutils.h | 10 +++++----- 10 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbcom.h b/src/plugins/debugger/cdb/cdbcom.h index 8a631e3f1fc..19208710a9f 100644 --- a/src/plugins/debugger/cdb/cdbcom.h +++ b/src/plugins/debugger/cdb/cdbcom.h @@ -43,4 +43,5 @@ typedef IDebugDataSpaces4 CIDebugDataSpaces; typedef IDebugSymbolGroup2 CIDebugSymbolGroup; typedef IDebugBreakpoint2 CIDebugBreakpoint; + #endif // CDBCOM_H diff --git a/src/plugins/debugger/cdb/cdbdumperhelper.h b/src/plugins/debugger/cdb/cdbdumperhelper.h index b9ec2bccccb..9500d4d4e01 100644 --- a/src/plugins/debugger/cdb/cdbdumperhelper.h +++ b/src/plugins/debugger/cdb/cdbdumperhelper.h @@ -32,6 +32,7 @@ #include "watchutils.h" #include "cdbcom.h" + #include #include @@ -42,8 +43,7 @@ struct CdbComInterfaces; class IDebuggerManagerAccessForEngines; class DebuggerManager; -/* For code clarity, all the stuff related to custom dumpers - * goes here. +/* For code clarity, all the stuff related to custom dumpers goes here. * "Custom dumper" is a library compiled against the current * Qt containing functions to evaluate values of Qt classes * (such as QString, taking pointers to their addresses). diff --git a/src/plugins/debugger/cdb/cdboptions.cpp b/src/plugins/debugger/cdb/cdboptions.cpp index b26053beee8..1740c3a6d7b 100644 --- a/src/plugins/debugger/cdb/cdboptions.cpp +++ b/src/plugins/debugger/cdb/cdboptions.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "cdboptions.h" + #include #include #include diff --git a/src/plugins/debugger/cdb/cdbstacktracecontext.h b/src/plugins/debugger/cdb/cdbstacktracecontext.h index 98e509ad982..b5e041d2c2f 100644 --- a/src/plugins/debugger/cdb/cdbstacktracecontext.h +++ b/src/plugins/debugger/cdb/cdbstacktracecontext.h @@ -73,7 +73,7 @@ public: // Top-Level instruction offset for disassembler ULONG64 instructionOffset() const { return m_instructionOffset; } - CdbStackFrameContext*frameContextAt(int index, QString *errorMessage); + CdbStackFrameContext *frameContextAt(int index, QString *errorMessage); // Format for logging void format(QTextStream &str) const; diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp index 7daba56a587..47035c5ec4d 100644 --- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp +++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp @@ -31,6 +31,7 @@ #include "cdbdebugengine_p.h" #include "watchhandler.h" #include "watchutils.h" + #include enum { debug = 0 }; @@ -40,7 +41,10 @@ static inline QString msgSymbolNotFound(const QString &s) return QString::fromLatin1("The symbol '%1' could not be found.").arg(s); } -static inline bool isTopLevelSymbol(const DEBUG_SYMBOL_PARAMETERS &p) { return p.ParentSymbol == DEBUG_ANY_ID; } +static inline bool isTopLevelSymbol(const DEBUG_SYMBOL_PARAMETERS &p) +{ + return p.ParentSymbol == DEBUG_ANY_ID; +} static inline void debugSymbolFlags(unsigned long f, QTextStream &str) { diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.h b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.h index 033252e387c..ea992e546cf 100644 --- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.h +++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.h @@ -130,7 +130,8 @@ private: }; // Helper to a sequence of WatchData into a list. -class WatchDataBackInserter { +class WatchDataBackInserter +{ public: explicit WatchDataBackInserter(QList &wh) : m_wh(wh) {} diff --git a/src/plugins/debugger/win/dbgwinutils.cpp b/src/plugins/debugger/win/dbgwinutils.cpp index 2145f001ad2..9ef66aa1ad9 100644 --- a/src/plugins/debugger/win/dbgwinutils.cpp +++ b/src/plugins/debugger/win/dbgwinutils.cpp @@ -34,6 +34,7 @@ #ifdef USE_PSAPI # include #endif + namespace Debugger { namespace Internal { @@ -75,5 +76,5 @@ QList winProcessList() return rc; } -} -} +} // namespace Internal +} // namespace Debugger diff --git a/src/plugins/debugger/win/dbgwinutils.h b/src/plugins/debugger/win/dbgwinutils.h index 1045e822b42..af16913a8ed 100644 --- a/src/plugins/debugger/win/dbgwinutils.h +++ b/src/plugins/debugger/win/dbgwinutils.h @@ -27,8 +27,8 @@ ** **************************************************************************/ -#ifndef _DBG_WINDUTILS_H -#define _DBG_WINDUTILS_H +#ifndef DEBUGGER_DBG_WINUTILS_H +#define DEBUGGER_DBG_WINUTILS_H #include @@ -39,6 +39,7 @@ struct ProcData; // debuggerdialogs, used by the process listing dialogs QList winProcessList(); -} -} -#endif +} // namespace Internal +} // namespace Debugger + +#endif // DEBUGGER_DBG_WINUTILS_H diff --git a/src/plugins/debugger/win/peutils.cpp b/src/plugins/debugger/win/peutils.cpp index 23cabb8bc3b..084e511f468 100644 --- a/src/plugins/debugger/win/peutils.cpp +++ b/src/plugins/debugger/win/peutils.cpp @@ -40,7 +40,7 @@ using Core::Utils::winErrorMessage; // a memory mapped file template - inline Ptr *makePtr(void *base, ptrdiff_t offset) +inline Ptr *makePtr(void *base, ptrdiff_t offset) { return reinterpret_cast(static_cast(base) + offset); } @@ -275,5 +275,5 @@ bool getPDBFiles(const QString &peExecutableFileName, QStringList *rc, QString * return success; } -} -} +} // namespace Internal +} // namespace Debugger diff --git a/src/plugins/debugger/win/peutils.h b/src/plugins/debugger/win/peutils.h index c9885991be9..7b4b0061fc9 100644 --- a/src/plugins/debugger/win/peutils.h +++ b/src/plugins/debugger/win/peutils.h @@ -27,8 +27,8 @@ ** **************************************************************************/ -#ifndef PEUTILS_H -#define PEUTILS_H +#ifndef DEBUGGER_PEUTILS_H +#define DEBUGGER_PEUTILS_H #include @@ -45,7 +45,7 @@ namespace Internal { // Return a list of Program-Database (*.pdb) files a PE executable refers to. */ bool getPDBFiles(const QString &peExecutableFileName, QStringList *rc, QString *errorMessage); -} -} +} // namespace Internal +} // namespace Debugger -#endif // PEUTILS_H +#endif // DEBUGGER_PEUTILS_H From 4e6e5408939bc33b8ecac67bc4e1dc4ac1f3c64c Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 30 Apr 2009 12:45:02 +0200 Subject: [PATCH 07/11] Remove code that was long obsoleted and commented out. --- src/plugins/projectexplorer/outputwindow.cpp | 365 ------------------- 1 file changed, 365 deletions(-) diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index 3ead27b6105..d047253b8fd 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -350,368 +350,3 @@ void OutputWindow::insertLine() appendPlainText(QString()); } -#if 0 -OutputWindow::OutputWindow(QWidget *parent) - : QAbstractScrollArea(parent) -{ - max_lines = 1000; - width_used = 0; - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - same_height = true; - block_scroll = false; - setWindowTitle(tr("Application Output Window")); - setWindowIcon(QIcon(":/qt4projectmanager/images/window.png")); -} - -void OutputWindow::changed() { - int remove = lines.size() - max_lines; - if (remove > 0) { - selection_start.line -= remove; - selection_end.line -= remove; - selection_start = qMax(selection_start, Selection()); - selection_end = qMax(selection_end, Selection()); - if (remove > verticalScrollBar()->value()) { - if (same_height) - viewport()->scroll(0, -remove * fontMetrics().lineSpacing()); - else - viewport()->update(); - } else { - block_scroll = true; - verticalScrollBar()->setValue(verticalScrollBar()->value() - remove); - block_scroll = false; - } - while (remove--) - lines.removeFirst(); - } - - verticalScrollBar()->setRange(0, lines.size() - 1); - -} - - -bool OutputWindow::getCursorPos(int *lineNumber, int *position, const QPoint &pos) { - if (lines.isEmpty()) - return false; - *lineNumber = verticalScrollBar()->value(); - - int x = 4 - horizontalScrollBar()->value(); - - int spacing = fontMetrics().lineSpacing(); - int leading = fontMetrics().leading(); - int height = 0; - - QTextLayout textLayout; - textLayout.setFont(font()); - - if (same_height && pos.y() > 0) { - int skipLines = pos.y() / spacing; - height += skipLines * spacing; - *lineNumber = qMin(*lineNumber + skipLines, lines.size() - 1); - } - - same_height = true; - - while ( *lineNumber < lines.size()) { - textLayout.setText(lines.at(*lineNumber)); - - textLayout.beginLayout(); - while (1) { - QTextLine line = textLayout.createLine(); - if (!line.isValid()) - break; - line.setLineWidth(INT_MAX/256); - height += leading; - line.setPosition(QPoint(x, height)); - height += static_cast(line.height()); - } - textLayout.endLayout(); - if (height > pos.y()) { - *position = textLayout.lineAt(0).xToCursor(pos.x()); - break; - } - ++*lineNumber; - } - return true; -} - -void OutputWindow::setNumberOfLines(int max) -{ - max_lines = qMax(1, max); - while (lines.size() > max_lines) - lines.removeLast(); - changed(); -} - -int OutputWindow::numberOfLines() const -{ - return max_lines; -} - -bool OutputWindow::hasSelectedText() const -{ - return selection_start != selection_end; -} - -void OutputWindow::clearSelection() -{ - bool hadSelectedText = hasSelectedText(); - selection_start = selection_end = Selection(); - if (hadSelectedText) - viewport()->update(); -} - -QString OutputWindow::selectedText() const -{ - Selection sel_start = qMin(selection_start, selection_end); - Selection sel_end = qMax(selection_start, selection_end); - QString text; - - if (sel_start.line == sel_end.line) { - text += lines.at(sel_start.line).mid(sel_start.pos, sel_end.pos - sel_start.pos); - } else { - int line = sel_start.line; - text += lines.at(line++).mid(sel_start.pos); - text += QLatin1Char('\n'); - while (line < sel_end.line) { - text += lines.at(line++); - text += QLatin1Char('\n'); - } - text += lines.at(sel_end.line).left(sel_end.pos); - } - return text; -} - -void OutputWindow::appendOutput(const QString &text) -{ - lines.append(text); - if (same_height) - viewport()->update( - QRect(0, (lines.size() - verticalScrollBar()->value() - 1) * fontMetrics().lineSpacing(), - viewport()->width(), viewport()->height())); - else - viewport()->update(); - - changed(); - int top = lines.size() - (viewport()->height() / fontMetrics().lineSpacing()); - if (verticalScrollBar()->value() == top - 1) - verticalScrollBar()->setValue(top); -} - -void OutputWindow::clear() -{ - clearSelection(); - lines.clear(); - viewport()->update(); -} - -void OutputWindow::copy() -{ - if (hasSelectedText()) - QApplication::clipboard()->setText(selectedText()); -} - -void OutputWindow::selectAll() -{ - selection_start = Selection(); - selection_end.line = lines.size() - 1; - selection_end.pos = lines.last().length() - 1; - viewport()->update(); -} - -void OutputWindow::scrollContentsBy(int dx, int dy) -{ - if (block_scroll) - return; - if (dx && dy) { - viewport()->update(); - } else if (dx && !dy) { - viewport()->scroll(dx, 0); - } else { - if (same_height) { - viewport()->scroll(0, fontMetrics().lineSpacing() * dy); - } else { - viewport()->update(); - } - } -} - -void OutputWindow::keyPressEvent(QKeyEvent *e) -{ - bool accept = true; - if (e == QKeySequence::Copy) { - copy(); - } else if (e == QKeySequence::SelectAll) { - selectAll(); - } else if (e->key() == Qt::Key_Enter - || e->key() == Qt::Key_Return) { - insertLine(); - } else { - accept = false; - } - - if (accept) - e->accept(); - else - QAbstractScrollArea::keyPressEvent(e); -} - -void OutputWindow::paintEvent(QPaintEvent *e) -{ - int lineNumber = verticalScrollBar()->value(); - - int x = 4 - horizontalScrollBar()->value(); - QPainter p(viewport()); - - int spacing = fontMetrics().lineSpacing(); - int leading = fontMetrics().leading(); - int height = 0; - - QTextLayout textLayout; - textLayout.setFont(font()); - - QTextCharFormat selectionFormat; - selectionFormat.setBackground(palette().highlight()); - selectionFormat.setForeground(palette().highlightedText()); - - if (e->rect().top() <= 0 && e->rect().bottom() >= viewport()->rect().bottom()) - width_used = 0; // recalculate - - if (same_height) { - int skipLines = e->rect().top() / spacing; - height += skipLines * spacing; - lineNumber += skipLines; - } - - same_height = true; - - Selection sel_start = qMin(selection_start, selection_end); - Selection sel_end = qMax(selection_start, selection_end); - - while ( lineNumber < lines.size() && height <= e->rect().bottom()) { - - QString line = lines.at(lineNumber); - - if (line.size() == 1 && line.at(0) == QChar::ParagraphSeparator) { - int y = height + spacing/2; - p.drawLine(e->rect().left(), y, e->rect().right(), y); - height += spacing; - - } else { - textLayout.setText(line); - textLayout.beginLayout(); - while (1) { - QTextLine line = textLayout.createLine(); - if (!line.isValid()) - break; - line.setLineWidth(INT_MAX/256); - height += leading; - line.setPosition(QPoint(x, height)); - height += static_cast(line.height()); - - same_height = same_height && (line.height() + leading) == spacing; - width_used = qMax(width_used, 8 + static_cast(line.naturalTextWidth())); - } - textLayout.endLayout(); - - if (lineNumber >= sel_start.line && lineNumber <= sel_end.line) { - QVector selection(1); - selection[0].start = (lineNumber == sel_start.line)? sel_start.pos : 0; - selection[0].length = ((lineNumber == sel_end.line) ? sel_end.pos : lines.at(lineNumber).size()) - selection[0].start; - selection[0].format = selectionFormat; - - textLayout.draw(&p, QPoint(0, 0), selection); - } else { - textLayout.draw(&p, QPoint(0, 0)); - } - } - - - ++lineNumber; - } - - horizontalScrollBar()->setRange(0, qMax(0, width_used - viewport()->width())); - if (horizontalScrollBar()->pageStep() != viewport()->width()) - horizontalScrollBar()->setPageStep(viewport()->width()); - if (height > viewport()->height()) - verticalScrollBar()->setPageStep(lineNumber - verticalScrollBar()->value()); - else if (verticalScrollBar()->pageStep() != viewport()->height() / fontMetrics().lineSpacing()) - verticalScrollBar()->setPageStep(viewport()->height() / fontMetrics().lineSpacing()); -} - -void OutputWindow::mousePressEvent(QMouseEvent *e) -{ - if (e->button() == Qt::LeftButton) { - clearSelection(); - if (getCursorPos(&selection_start.line, &selection_start.pos, e->pos())) { - selection_end = selection_start; - autoscroll = 0; - } - } -} - -void OutputWindow::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == autoscroll_timer.timerId()) { - int autoscroll = 0; - if (lastMouseMove.y() < 0) - autoscroll = -1; - else if (lastMouseMove.y() > viewport()->height()) - autoscroll = 1; - if (autoscroll) { - verticalScrollBar()->setValue(verticalScrollBar()->value() + autoscroll); - OutputWindow::mouseMoveEvent(0); - } - } - QAbstractScrollArea::timerEvent(e); -} - -void OutputWindow::mouseReleaseEvent(QMouseEvent *e) -{ - if (e->button() == Qt::LeftButton) { - autoscroll_timer.stop(); - if (hasSelectedText() && QApplication::clipboard()->supportsSelection()) - QApplication::clipboard()->setText(selectedText(), QClipboard::Selection); - } -} - -void OutputWindow::mouseMoveEvent(QMouseEvent *e) -{ - if (e) { - lastMouseMove = e->pos(); - if (viewport()->rect().contains(e->pos())) - autoscroll_timer.stop(); - else - autoscroll_timer.start(20, this); - } - - - Selection old = selection_end; - if (!getCursorPos(&selection_end.line, &selection_end.pos, lastMouseMove)) - return; - if (same_height) { - Selection from = qMin(old, selection_end); - Selection to = qMax(old, selection_end); - viewport()->update(QRect(0, -1 + (from.line - verticalScrollBar()->value()) * fontMetrics().lineSpacing(), - viewport()->width(), 2 + (to.line - from.line + 1) * fontMetrics().lineSpacing())); - } else { - viewport()->update(); - } -} - -void OutputWindow::contextMenuEvent(QContextMenuEvent * e) -{ - QMenu menu(this); - QAction *clearAction = menu.addAction("Clear", this, SLOT(clear())); - QAction *copyAction = menu.addAction("Copy", this, SLOT(copy()), QKeySequence::Copy); - QAction *selectAllAction = menu.addAction("Select All", this, SLOT(selectAll()), QKeySequence::SelectAll); - if (lines.empty()) { - clearAction->setDisabled(true); - selectAllAction->setDisabled(true); - } - if (!hasSelectedText()) - copyAction->setDisabled(true); - - menu.exec(e->globalPos()); -} - -#endif // 0 From 540ddcd562728b2be4bb8cb72c5c999d1341d1f4 Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 30 Apr 2009 12:50:52 +0200 Subject: [PATCH 08/11] Add a next/prev shortcut (F6 for now) for outputpanes. This one has some magic inside to always use the current outputpane. This solves the issue that I don't want Search and Build Issues list to have its own set of next/prev shortcuts. todo is a better definition of next for the build issues and/or a way to restrict it only to errors. --- src/plugins/coreplugin/ioutputpane.h | 12 +++ .../coreplugin/messageoutputwindow.cpp | 25 ++++++ src/plugins/coreplugin/messageoutputwindow.h | 6 ++ src/plugins/coreplugin/outputpane.cpp | 88 +++++++++++++++++-- src/plugins/coreplugin/outputpane.h | 9 ++ src/plugins/find/searchresulttreemodel.cpp | 58 ++++++++++++ src/plugins/find/searchresulttreemodel.h | 3 + src/plugins/find/searchresulttreeview.cpp | 5 ++ src/plugins/find/searchresulttreeview.h | 4 +- src/plugins/find/searchresultwindow.cpp | 40 ++++++++- src/plugins/find/searchresultwindow.h | 6 ++ src/plugins/git/gitoutputwindow.cpp | 24 +++++ src/plugins/git/gitoutputwindow.h | 6 ++ src/plugins/perforce/perforceoutputwindow.cpp | 25 ++++++ src/plugins/perforce/perforceoutputwindow.h | 6 ++ .../projectexplorer/compileoutputwindow.cpp | 25 ++++++ .../projectexplorer/compileoutputwindow.h | 6 ++ src/plugins/projectexplorer/outputwindow.cpp | 24 +++++ src/plugins/projectexplorer/outputwindow.h | 6 ++ src/plugins/projectexplorer/taskwindow.cpp | 54 +++++++++++- src/plugins/projectexplorer/taskwindow.h | 6 ++ .../subversion/subversionoutputwindow.cpp | 25 ++++++ .../subversion/subversionoutputwindow.h | 12 ++- 23 files changed, 460 insertions(+), 15 deletions(-) diff --git a/src/plugins/coreplugin/ioutputpane.h b/src/plugins/coreplugin/ioutputpane.h index e38e9fbe8b3..5a841011c9c 100644 --- a/src/plugins/coreplugin/ioutputpane.h +++ b/src/plugins/coreplugin/ioutputpane.h @@ -64,6 +64,12 @@ public: // Wheter the outputpane can be focused at the moment. // (E.g. the search result window doesn't want to be focussed if the are no results.) virtual bool canFocus() = 0; + + virtual bool canNavigate() = 0; + virtual bool canNext() = 0; + virtual bool canPrevious() = 0; + virtual void goToNext() = 0; + virtual void goToPrev() = 0; public slots: void popup() { @@ -89,10 +95,16 @@ public slots: emit togglePage(withFocusIfShown); } + void navigateStateChanged() + { + emit navigateStateUpdate(); + } + signals: void showPage(bool withFocus); void hidePage(); void togglePage(bool withFocusIfShown); + void navigateStateUpdate(); }; } // namespace Core diff --git a/src/plugins/coreplugin/messageoutputwindow.cpp b/src/plugins/coreplugin/messageoutputwindow.cpp index 3fb45034450..7fc733744b5 100644 --- a/src/plugins/coreplugin/messageoutputwindow.cpp +++ b/src/plugins/coreplugin/messageoutputwindow.cpp @@ -89,3 +89,28 @@ int MessageOutputWindow::priorityInStatusBar() const { return -1; } + +bool MessageOutputWindow::canNext() +{ + return false; +} + +bool MessageOutputWindow::canPrevious() +{ + return false; +} + +void MessageOutputWindow::goToNext() +{ + +} + +void MessageOutputWindow::goToPrev() +{ + +} + +bool MessageOutputWindow::canNavigate() +{ + return false; +} diff --git a/src/plugins/coreplugin/messageoutputwindow.h b/src/plugins/coreplugin/messageoutputwindow.h index 70e1308e0dd..821aa671420 100644 --- a/src/plugins/coreplugin/messageoutputwindow.h +++ b/src/plugins/coreplugin/messageoutputwindow.h @@ -60,6 +60,12 @@ public: bool hasFocus(); void setFocus(); + virtual bool canNext(); + virtual bool canPrevious(); + virtual void goToNext(); + virtual void goToPrev(); + bool canNavigate(); + private: QTextEdit *m_widget; }; diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index e141473162d..92adb63e89d 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -40,6 +40,8 @@ #include +#include + #include #include #include @@ -159,6 +161,8 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : m_widgetComboBox(new QComboBox), m_clearButton(new QToolButton), m_closeButton(new QToolButton), + m_nextAction(0), + m_prevAction(0), m_closeAction(0), m_lastIndex(-1), m_outputWidgetPane(new QStackedWidget), @@ -171,6 +175,18 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : m_clearButton->setToolTip(tr("Clear")); connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearPage())); + m_nextAction = new QAction(this); + m_nextAction->setIcon(QIcon(":/core/images/next.png")); + m_nextAction->setProperty("type", QLatin1String("dockbutton")); + m_nextAction->setText(tr("Next Item")); + connect(m_nextAction, SIGNAL(triggered()), this, SLOT(slotNext())); + + m_prevAction = new QAction(this); + m_prevAction->setIcon(QIcon(":/core/images/prev.png")); + m_prevAction->setProperty("type", QLatin1String("dockbutton")); + m_prevAction->setText(tr("Previous Item")); + connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev())); + m_closeButton->setIcon(QIcon(":/core/images/closebutton.png")); m_closeButton->setProperty("type", QLatin1String("dockbutton")); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide())); @@ -178,12 +194,13 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : QVBoxLayout *mainlayout = new QVBoxLayout; mainlayout->setSpacing(0); mainlayout->setMargin(0); - QToolBar *toolBar = new QToolBar; - toolBar->addWidget(m_widgetComboBox); - toolBar->addWidget(m_clearButton); - toolBar->addWidget(m_opToolBarWidgets); - m_closeAction = toolBar->addWidget(m_closeButton); - mainlayout->addWidget(toolBar); + m_toolBar = new QToolBar; + m_toolBar->addWidget(m_widgetComboBox); + m_toolBar->addWidget(m_clearButton); + + m_opToolBarAction = m_toolBar->addWidget(m_opToolBarWidgets); + m_closeAction = m_toolBar->addWidget(m_closeButton); + mainlayout->addWidget(m_toolBar); mainlayout->addWidget(m_outputWidgetPane, 10); setLayout(mainlayout); @@ -195,6 +212,7 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : #else m_buttonsWidget->layout()->setSpacing(4); #endif + } OutputPaneManager::~OutputPaneManager() @@ -216,11 +234,32 @@ void OutputPaneManager::init() { ActionManager *am = Core::ICore::instance()->actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); + QList globalcontext; + globalcontext.append(Core::Constants::C_GLOBAL_ID); // Window->Output Panes ActionContainer *mpanes = am->createMenu(Constants::M_WINDOW_PANES); mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); mpanes->menu()->setTitle(tr("Output &Panes")); + mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup"); + mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup"); + + Core::Command *cmd; + + cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalcontext); + cmd->setDefaultKeySequence(QKeySequence("Shift+F6")); + m_toolBar->insertAction(m_opToolBarAction ,cmd->action()); + mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); + + cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalcontext); + m_toolBar->insertAction(m_opToolBarAction, cmd->action()); + cmd->setDefaultKeySequence(QKeySequence("F6")); + mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); + + QAction *sep = new QAction(this); + sep->setSeparator(true); + cmd = am->registerAction(sep, QLatin1String("Coreplugin.OutputPane.Sep"), globalcontext); + mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); QList panes = ExtensionSystem::PluginManager::instance() ->getObjects(); @@ -241,6 +280,7 @@ void OutputPaneManager::init() connect(outPane, SIGNAL(showPage(bool)), this, SLOT(showPage(bool))); connect(outPane, SIGNAL(hidePage()), this, SLOT(slotHide())); connect(outPane, SIGNAL(togglePage(bool)), this, SLOT(togglePage(bool))); + connect(outPane, SIGNAL(navigateStateUpdate()), this, SLOT(updateNavigateState())); QWidget *toolButtonsContainer = new QWidget(m_opToolBarWidgets); QHBoxLayout *toolButtonsLayout = new QHBoxLayout; @@ -265,7 +305,7 @@ void OutputPaneManager::init() cmd->setDefaultKeySequence(QKeySequence(paneShortCut(Qt::ALT, shortcutNumber))); #endif } - mpanes->addAction(cmd); + mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); m_actions.insert(cmd->action(), idx); // TODO priority -1 @@ -343,6 +383,24 @@ void OutputPaneManager::updateToolTip() } } +void OutputPaneManager::slotNext() +{ + int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); + ensurePageVisible(idx); + IOutputPane *out = m_pageMap.value(idx); + if (out->canNext()) + out->goToNext(); +} + +void OutputPaneManager::slotPrev() +{ + int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); + ensurePageVisible(idx); + IOutputPane *out = m_pageMap.value(idx); + if (out->canPrevious()) + out->goToPrev(); +} + void OutputPaneManager::slotHide() { if (OutputPanePlaceHolder::m_current) { @@ -384,6 +442,16 @@ void OutputPaneManager::ensurePageVisible(int idx) } } +void OutputPaneManager::updateNavigateState() +{ + IOutputPane* pane = qobject_cast(sender()); + int idx = findIndexForPage(pane); + if (m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) { + m_prevAction->setEnabled(pane->canNavigate() && pane->canPrevious()); + m_nextAction->setEnabled(pane->canNavigate() && pane->canNext()); + } +} + // Slot connected to showPage signal of each page void OutputPaneManager::showPage(bool focus) { @@ -457,11 +525,17 @@ void OutputPaneManager::changePage() } int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); + if (m_lastIndex == idx) + return; m_outputWidgetPane->setCurrentIndex(idx); m_opToolBarWidgets->setCurrentIndex(idx); m_pageMap.value(idx)->visibilityChanged(true); m_pageMap.value(m_lastIndex)->visibilityChanged(false); + bool canNavigate = m_pageMap.value(idx)->canNavigate(); + m_prevAction->setEnabled(canNavigate && m_pageMap.value(idx)->canPrevious()); + m_nextAction->setEnabled(canNavigate && m_pageMap.value(idx)->canNext()); + if (m_buttons.value(m_lastIndex)) m_buttons.value(m_lastIndex)->setChecked(false); diff --git a/src/plugins/coreplugin/outputpane.h b/src/plugins/coreplugin/outputpane.h index 86dccdcdb5a..9fbbf780c6b 100644 --- a/src/plugins/coreplugin/outputpane.h +++ b/src/plugins/coreplugin/outputpane.h @@ -39,6 +39,7 @@ QT_BEGIN_NAMESPACE class QAction; class QComboBox; class QToolButton; +class QToolBar; class QStackedWidget; class QPushButton; QT_END_NAMESPACE @@ -89,6 +90,8 @@ public: public slots: void slotHide(); + void slotNext(); + void slotPrev(); void shortcutTriggered(); protected: @@ -101,6 +104,7 @@ private slots: void clearPage(); void updateToolTip(); void buttonTriggered(); + void updateNavigateState(); private: // the only class that is allowed to create and destroy @@ -118,13 +122,18 @@ private: QComboBox *m_widgetComboBox; QToolButton *m_clearButton; QToolButton *m_closeButton; + + QAction *m_nextAction; + QAction *m_prevAction; QAction *m_closeAction; + QToolBar *m_toolBar; QMap m_pageMap; int m_lastIndex; QStackedWidget *m_outputWidgetPane; QStackedWidget *m_opToolBarWidgets; + QAction *m_opToolBarAction; QWidget *m_buttonsWidget; QMap m_buttons; QMap m_actions; diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index 68beb2afb8f..0afd1fa459e 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -255,3 +255,61 @@ void SearchResultTreeModel::clear() m_rootItem->clearChildren(); reset(); } + +QModelIndex SearchResultTreeModel::next(const QModelIndex &idx) const +{ + QModelIndex parent = idx.parent(); + if (parent.isValid()) { + int row = idx.row(); + if (row + 1 < rowCount(parent)) { + // Same parent + return index(row + 1, 0, parent); + } else { + // Next parent + int parentRow = parent.row(); + QModelIndex nextParent; + if (parentRow + 1 < rowCount()) { + nextParent = index(parentRow + 1, 0); + } else { + // Wrap around + nextParent = index(0,0); + } + return nextParent.child(0, 0); + } + } else { + // We are on a top level item + return idx.child(0,0); + } + return QModelIndex(); +} + +QModelIndex SearchResultTreeModel::prev(const QModelIndex &idx) const +{ + QModelIndex parent = idx.parent(); + if (parent.isValid()) { + int row = idx.row(); + if (row > 0) { + // Same parent + return index(row - 1, 0, parent); + } else { + // Prev parent + int parentRow = parent.row(); + QModelIndex prevParent; + if (parentRow > 0 ) { + prevParent = index(parentRow - 1, 0); + } else { + // Wrap around + prevParent = index(rowCount() - 1, 0); + } + return prevParent.child(rowCount(prevParent) - 1, 0); + } + } else { + // We are on a top level item + int row = idx.row(); + if (row > 0) { + QModelIndex prevParent = index(row - 1, 0); + return prevParent.child(rowCount(prevParent) ,0); + } + } + return QModelIndex(); +} diff --git a/src/plugins/find/searchresulttreemodel.h b/src/plugins/find/searchresulttreemodel.h index b4036c0e7b6..dacbf9e6b42 100644 --- a/src/plugins/find/searchresulttreemodel.h +++ b/src/plugins/find/searchresulttreemodel.h @@ -57,6 +57,9 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QModelIndex next(const QModelIndex &idx) const; + QModelIndex prev(const QModelIndex &idx) const; + signals: void jumpToSearchResult(const QString &fileName, int lineNumber, int searchTermStart, int searchTermLength); diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/find/searchresulttreeview.cpp index b12e3f15885..7b5cc6ca35d 100644 --- a/src/plugins/find/searchresulttreeview.cpp +++ b/src/plugins/find/searchresulttreeview.cpp @@ -99,3 +99,8 @@ void SearchResultTreeView::keyPressEvent(QKeyEvent *e) } QTreeView::keyPressEvent(e); } + +SearchResultTreeModel *SearchResultTreeView::model() const +{ + return m_model; +} diff --git a/src/plugins/find/searchresulttreeview.h b/src/plugins/find/searchresulttreeview.h index 1fcf03599f4..37d137e8158 100644 --- a/src/plugins/find/searchresulttreeview.h +++ b/src/plugins/find/searchresulttreeview.h @@ -48,6 +48,8 @@ public: void setAutoExpandResults(bool expand); void setTextEditorFont(const QFont &font); + SearchResultTreeModel *model() const; + signals: void jumpToSearchResult(int index, const QString &fileName, int lineNumber, int searchTermStart, int searchTermLength); @@ -56,8 +58,6 @@ public slots: void clear(); void appendResultLine(int index, const QString &fileName, int lineNumber, const QString &lineText, int searchTermStart, int searchTermLength); - -private slots: void emitJumpToSearchResult(const QModelIndex &index); protected: diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 19c252a4177..334bb862d9c 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -102,6 +103,7 @@ void SearchResultWindow::clearContents() m_searchResultTreeView->clear(); qDeleteAll(m_items); m_items.clear(); + navigateStateChanged(); } void SearchResultWindow::showNoMatchesFound() @@ -160,8 +162,8 @@ ResultWindowItem *SearchResultWindow::addResult(const QString &fileName, int lin // We didn't have an item before, set the focus to the m_searchResultTreeView m_searchResultTreeView->setFocus(); m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select); + emit navigateStateChanged(); } - return item; } @@ -198,3 +200,39 @@ int SearchResultWindow::priorityInStatusBar() const { return 80; } + +bool SearchResultWindow::canNext() +{ + return m_searchResultTreeView->model()->rowCount(); +} + +bool SearchResultWindow::canPrevious() +{ + return m_searchResultTreeView->model()->rowCount(); +} + +void SearchResultWindow::goToNext() +{ + if (!m_searchResultTreeView->model()->rowCount()) + return; + QModelIndex idx = m_searchResultTreeView->model()->next(m_searchResultTreeView->currentIndex()); + if (idx.isValid()) { + m_searchResultTreeView->setCurrentIndex(idx); + m_searchResultTreeView->emitJumpToSearchResult(idx); + } +} +void SearchResultWindow::goToPrev() +{ + if (!m_searchResultTreeView->model()->rowCount()) + return; + QModelIndex idx = m_searchResultTreeView->model()->prev(m_searchResultTreeView->currentIndex()); + if (idx.isValid()) { + m_searchResultTreeView->setCurrentIndex(idx); + m_searchResultTreeView->emitJumpToSearchResult(idx); + } +} + +bool SearchResultWindow::canNavigate() +{ + return true; +} diff --git a/src/plugins/find/searchresultwindow.h b/src/plugins/find/searchresultwindow.h index da371971cf7..83d4c9f3b1f 100644 --- a/src/plugins/find/searchresultwindow.h +++ b/src/plugins/find/searchresultwindow.h @@ -75,6 +75,12 @@ public: bool canFocus(); void setFocus(); + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + void setTextEditorFont(const QFont &font); public slots: diff --git a/src/plugins/git/gitoutputwindow.cpp b/src/plugins/git/gitoutputwindow.cpp index 6985b64baeb..369df74fcac 100644 --- a/src/plugins/git/gitoutputwindow.cpp +++ b/src/plugins/git/gitoutputwindow.cpp @@ -117,3 +117,27 @@ int GitOutputWindow::priorityInStatusBar() const { return -1; } + +bool GitOutputWindow::canNext() +{ + return false; +} + +bool GitOutputWindow::canPrevious() +{ + return false; +} + +void GitOutputWindow::goToNext() +{ +} + +void GitOutputWindow::goToPrev() +{ + +} + +bool GitOutputWindow::canNavigate() +{ + return false; +} diff --git a/src/plugins/git/gitoutputwindow.h b/src/plugins/git/gitoutputwindow.h index 8ada72c16be..81eff4fe66b 100644 --- a/src/plugins/git/gitoutputwindow.h +++ b/src/plugins/git/gitoutputwindow.h @@ -59,6 +59,12 @@ public: bool hasFocus(); void setFocus(); + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + public slots: void setText(const QString &text); void append(const QString &text); diff --git a/src/plugins/perforce/perforceoutputwindow.cpp b/src/plugins/perforce/perforceoutputwindow.cpp index 0ed35c401c7..93cdc5442c9 100644 --- a/src/plugins/perforce/perforceoutputwindow.cpp +++ b/src/plugins/perforce/perforceoutputwindow.cpp @@ -159,3 +159,28 @@ int PerforceOutputWindow::priorityInStatusBar() const { return -1; } + +bool PerforceOutputWindow::canNext() +{ + return false; +} + +bool PerforceOutputWindow::canPrevious() +{ + return false; +} + +void PerforceOutputWindow::goToNext() +{ + +} + +void PerforceOutputWindow::goToPrev() +{ + +} + +bool PerforceOutputWindow::canNavigate() +{ + return false; +} diff --git a/src/plugins/perforce/perforceoutputwindow.h b/src/plugins/perforce/perforceoutputwindow.h index d88d5b57789..da17a5d3f6d 100644 --- a/src/plugins/perforce/perforceoutputwindow.h +++ b/src/plugins/perforce/perforceoutputwindow.h @@ -61,6 +61,12 @@ public: bool hasFocus(); void setFocus(); + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + public slots: void append(const QString &txt, bool doPopup = false); diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 493e6c492dc..eeab3f133b1 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -93,3 +93,28 @@ int CompileOutputWindow::priorityInStatusBar() const { return 50; } + +bool CompileOutputWindow::canNext() +{ + return false; +} + +bool CompileOutputWindow::canPrevious() +{ + return false; +} + +void CompileOutputWindow::goToNext() +{ + +} + +void CompileOutputWindow::goToPrev() +{ + +} + +bool CompileOutputWindow::canNavigate() +{ + return false; +} diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h index 55a4b988b00..f18c9a4b01e 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.h +++ b/src/plugins/projectexplorer/compileoutputwindow.h @@ -57,6 +57,12 @@ public: bool hasFocus(); void setFocus(); + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + private: QPlainTextEdit *m_textEdit; }; diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index d047253b8fd..74adafc2fee 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -305,6 +305,30 @@ RunControl* OutputPane::runControlForTab(int index) const return m_outputWindows.key(qobject_cast(m_tabWidget->widget(index))); } +bool OutputPane::canNext() +{ + return false; +} + +bool OutputPane::canPrevious() +{ + return false; +} + +void OutputPane::goToNext() +{ + +} + +void OutputPane::goToPrev() +{ + +} + +bool OutputPane::canNavigate() +{ + return false; +} /*******************/ diff --git a/src/plugins/projectexplorer/outputwindow.h b/src/plugins/projectexplorer/outputwindow.h index 7542269bfc5..225ae4a3080 100644 --- a/src/plugins/projectexplorer/outputwindow.h +++ b/src/plugins/projectexplorer/outputwindow.h @@ -70,6 +70,12 @@ public: bool hasFocus(); void setFocus(); + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + void appendOutput(const QString &out); // ApplicationOutputspecifics diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index e3a431be859..2af18a03b78 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -319,6 +319,7 @@ void TaskWindow::clearContents() m_model->clear(); m_copyAction->setEnabled(false); emit tasksChanged(); + navigateStateChanged(); } void TaskWindow::visibilityChanged(bool /* b */) @@ -333,6 +334,8 @@ void TaskWindow::addItem(ProjectExplorer::BuildParserInterface::PatternType type ++m_errorCount; m_copyAction->setEnabled(true); emit tasksChanged(); + if (m_model->rowCount() == 1) + navigateStateChanged(); } void TaskWindow::showTaskInFile(const QModelIndex &index) @@ -406,8 +409,6 @@ bool TaskWindow::canFocus() return m_model->rowCount(); } -#include - void TaskWindow::setFocus() { if (m_model->rowCount()) { @@ -418,6 +419,55 @@ void TaskWindow::setFocus() } } +bool TaskWindow::canNext() +{ + return m_model->rowCount(); +} + +bool TaskWindow::canPrevious() +{ + return m_model->rowCount(); +} + +void TaskWindow::goToNext() +{ + if (!m_model->rowCount()) + return; + QModelIndex currentIndex = m_listview->currentIndex(); + if (currentIndex.isValid()) { + int row = currentIndex.row() + 1; + if (row == m_model->rowCount()) + row = 0; + currentIndex = m_model->index(row, 0); + } else { + currentIndex = m_model->index(0, 0); + } + m_listview->setCurrentIndex(currentIndex); + showTaskInFile(currentIndex); +} + +void TaskWindow::goToPrev() +{ + if (!m_model->rowCount()) + return; + QModelIndex currentIndex = m_listview->currentIndex(); + if (currentIndex.isValid()) { + int row = currentIndex.row() -1; + if (row < 0) + row = m_model->rowCount() - 1; + currentIndex = m_model->index(row, 0); + } else { + currentIndex = m_model->index(m_model->rowCount()-1, 0); + } + m_listview->setCurrentIndex(currentIndex); + showTaskInFile(currentIndex); +} + +bool TaskWindow::canNavigate() +{ + return true; +} + ///// // Delegate ///// diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h index fffd6904e77..862fa7dbcee 100644 --- a/src/plugins/projectexplorer/taskwindow.h +++ b/src/plugins/projectexplorer/taskwindow.h @@ -74,6 +74,12 @@ public: bool hasFocus(); void setFocus(); + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + signals: void tasksChanged(); diff --git a/src/plugins/subversion/subversionoutputwindow.cpp b/src/plugins/subversion/subversionoutputwindow.cpp index 387c88f3f33..e7191bd1c9c 100644 --- a/src/plugins/subversion/subversionoutputwindow.cpp +++ b/src/plugins/subversion/subversionoutputwindow.cpp @@ -100,3 +100,28 @@ bool SubversionOutputWindow::hasFocus() void SubversionOutputWindow::setFocus() { } + +bool SubversionOutputWindow::canNext() +{ + return false; +} + +bool SubversionOutputWindow::canPrevious() +{ + return false; +} + +void SubversionOutputWindow::goToNext() +{ + +} + +void SubversionOutputWindow::goToPrev() +{ + +} + +bool SubversionOutputWindow::canNavigate() +{ + return false; +} diff --git a/src/plugins/subversion/subversionoutputwindow.h b/src/plugins/subversion/subversionoutputwindow.h index fc5b76eec46..35c22423b11 100644 --- a/src/plugins/subversion/subversionoutputwindow.h +++ b/src/plugins/subversion/subversionoutputwindow.h @@ -59,9 +59,15 @@ public: int priorityInStatusBar() const; void visibilityChanged(bool visible); - virtual bool canFocus(); - virtual bool hasFocus(); - virtual void setFocus(); + bool canFocus(); + bool hasFocus(); + void setFocus(); + + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); public slots: void append(const QString &txt, bool popup = false); From afe68f0d13ef1605b2418f87781dc2b6c61efbd7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Apr 2009 16:08:17 +0200 Subject: [PATCH 09/11] Continue German translation. --- share/qtcreator/translations/qtcreator_de.ts | 1073 ++++++++++-------- 1 file changed, 626 insertions(+), 447 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 59f68968298..c657df16058 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -52,7 +52,7 @@ Filter: - + Filter: @@ -75,7 +75,7 @@ Filter: - + Filter: @@ -106,12 +106,12 @@ Bookmark: - + Lesezeichen: Add in Folder: - + Im Ordner: @@ -121,7 +121,7 @@ New Folder - + Neuer Ordner @@ -135,12 +135,12 @@ Delete Folder - + Ordner löschen Rename Folder - + Ordner umbenennen @@ -149,7 +149,7 @@ Bookmark - + Lesezeichen @@ -159,66 +159,70 @@ Remove - + Entfernen - You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? - + Beim Löschen eines Ordners wird auch der Inhalt gelöscht.<br>Möchten Sie trotzdem fortsetzen? - + New Folder - + Neuer Ordner + + + + You are going to delete a Folder which will also<br>remove its content. Are you sure to continue? + Beim Löschen eines Ordners wird auch dessen Inhalt gelöscht.<br>Möchten Sie trotzdem fortsetzen? BookmarkWidget - + Delete Folder - + Ordner löschen Rename Folder - + Ordner umbenennen Show Bookmark - + Lesezeichen anzeigen Show Bookmark in New Tab - + Lesezeichen in neuem Reiter anzeigen Delete Bookmark - + Lesezeichen löschen Rename Bookmark - + Lesezeichen umbenennen Filter: - + Filter: Add - + Hinzufügen Remove - + Entfernen @@ -231,12 +235,12 @@ &Remove Bookmark - + Lesezeichen &Löschen Remove all Bookmarks - + Alle Lesezeichen löschen @@ -244,13 +248,13 @@ &Bookmarks - + &Lesezeichen Toggle Bookmark - + Lesezeichen umschalten @@ -265,17 +269,17 @@ Move Up - + Nach oben Move Down - + Nach unten Previous Bookmark - + Vorhergehendes Lesezeichen @@ -290,7 +294,7 @@ Next Bookmark - + Nächstes Lesezeichen @@ -305,12 +309,12 @@ Previous Bookmark In Document - + Vorhergehendes Lesezeichen im Dokument Next Bookmark In Document - + Nächstes Lesezeichen im Dokument @@ -355,7 +359,7 @@ CMakeProjectManager::Internal::CMakeRunConfiguration - + Arguments: @@ -396,7 +400,7 @@ CMakeProjectManager::Internal::CMakeSettingsPage - + CMake @@ -465,17 +469,17 @@ CdbDumperHelper - + Loading dumpers... - + The debugger does not appear to be Qt application. - + The dumper module appears to be already loaded. @@ -491,18 +495,10 @@ - - <none> + + Querying dumpers for '%1'/'%2' (%3) - - - %n known types, Qt version: %1, Qt namespace: %2 - - - - - CdbOptionsPageWidget @@ -983,7 +979,7 @@ Sollen sie überschrieben werden? Split - + Teilen @@ -1117,7 +1113,7 @@ Sollen sie überschrieben werden? Abbrechen - + <table border=1 cellspacing=0 cellpadding=3><tr><th>Variable</th><th>Expands to</th></tr><tr><td>%f</td><td>file name</td></tr><tr><td>%l</td><td>current line number</td></tr><tr><td>%c</td><td>current column number</td></tr><tr><td>%x</td><td>editor's x position on screen</td></tr><tr><td>%y</td><td>editor's y position on screen</td></tr><tr><td>%w</td><td>editor's width in pixels</td></tr><tr><td>%h</td><td>editor's height in pixels</td></tr><tr><td>%W</td><td>editor's width in characters</td></tr><tr><td>%H</td><td>editor's height in characters</td></tr><tr><td>%%</td><td>%</td></tr></table> @@ -1125,7 +1121,7 @@ Sollen sie überschrieben werden? Core::FileManager - + Can't save file Die Datei kann nicht gespeichert werden @@ -1161,9 +1157,9 @@ Sollen sie überschrieben werden? Core::Internal::CommandPrivate - + Other - + Andere @@ -1179,37 +1175,37 @@ Sollen sie überschrieben werden? Split Left/Right - + Links/rechts teilen Split Top/Bottom - + Open/unten teilen Unsplit - + Teilung aufheben Default Splitter Layout - + Vorgabe wiederherstellen Save Current as Default - + Gegenwärtige Anordnung als Vorgabe speichern Restore Default Layout - + Vorgabe wiederherstellen Previous Document - + Voriges Dokument @@ -1219,7 +1215,7 @@ Sollen sie überschrieben werden? Next Document - + Nächstes Dokument @@ -1229,22 +1225,22 @@ Sollen sie überschrieben werden? Previous Group - + Vorige Gruppe Next Group - + Nächste Gruppe Move Document to Previous Group - + Dokument in vorige Gruppe verschieben Move Document to Next Group - + Dokument in nächste Gruppe verschieben @@ -1253,7 +1249,7 @@ Sollen sie überschrieben werden? Placeholder - + Platzhalter @@ -1281,11 +1277,51 @@ Sollen sie überschrieben werden? Environment - + Allgemeine Einstellungen Variables + Variablen + + + + Form + + + + + General settings + Allgemeine Einstellungen + + + + User &interface color: + Farbe der Benutzeroberfläche: + + + + Reset to default + Zurücksetzen + + + + R + + + + + Terminal: + Terminal: + + + + External editor: + 'Externer Editor: + + + + ? @@ -1494,7 +1530,7 @@ Sollen sie überschrieben werden? Split - + Teilen @@ -1555,7 +1591,7 @@ Sollen sie überschrieben werden? Core::Internal::OutputPaneManager - + Output Ausgaben @@ -1565,9 +1601,19 @@ Sollen sie überschrieben werden? Löschen - + + Next Item + Nächstes Element + + + + Previous Item + Voriges Element + + + Output &Panes - Ausgabe&panels + Ausgabe&panele @@ -1640,28 +1686,28 @@ Sollen sie überschrieben werden? Keyboard - + Tastatur Environment - + Umgebung Import Keyboard Mapping Scheme - + Tastaturschema importieren Keyboard Mapping Scheme (*.kms) - + Tastaturschema-Datei (*.kms) Export Keyboard Mapping Scheme - + Tastaturschema exportieren @@ -1669,7 +1715,7 @@ Sollen sie überschrieben werden? Split - + Teilen @@ -1697,7 +1743,12 @@ Sollen sie überschrieben werden? (letzte Sitzung) - + + Welcome + Willkommen + + + %1 (last session) %1 (zuletzt benutzt) @@ -1750,27 +1801,38 @@ p { <p>Qt Creator ist eine intuitive, moderne cross-platform IDE, die</p> <p>es Entwicklern ermöglicht, graphisch ansprechende</p> <p>Anwendungen für die Bereiche Desktop und Embedded sowie</p> -<p>mobile Geräte zu erstellen. Klicken Sie auf <strong>Start</strong>,</p> +<p>mobile Geräte zu erstellen. Klicken Sie auf <strong>Schnelleinstieg</strong>,</p> <p> um die Entwicklung mit Qt Creator zu beginnen.</p> <hr style="margin-top:15px"/> * { - background-image: url(":/core/images/welcomemode/btn_getting_started.png"); + border-image: url(:/core/images/welcomemode/btn_27.png) 7; + border-width: 7; + padding: -2px 0; + font-size: 12px; + font-family: lucida sans, dejavu sans, sans serif; + color: black; } *:hover { - background-image: url(:/core/images/welcomemode/btn_getting_started_hover.png) + border-image: url(:/core/images/welcomemode/btn_27_hover.png) 7; + color: white; } + + + <qt>Getting Started &gt;&gt; + <qt>Schnelleinstieg &gt;&gt; + #recentSessionsFrame { -border-image: url(:/core/images/welcomemode/rc_combined.png) 8 8 8 8 stretch stretch; -border-width: 8 8 8 8; + border-image: url(:/core/images/welcomemode/rc_combined.png) 8; + border-width: 8; } @@ -1778,19 +1840,30 @@ border-width: 8 8 8 8; * { - background-image: url(":/core/images/welcomemode/btn_restore_session.png"); + border-image: url(:/core/images/welcomemode/btn_26.png) 7; + border-width: 7; + padding: -2px 0; + font-size: 12px; + font-family: lucida sans, dejavu sans, sans serif; + color: black; } *:hover { - background-image: url(:/core/images/welcomemode/btn_restore_session_hover.png) + border-image: url(:/core/images/welcomemode/btn_26_hover.png) 7; + color: white; } + + + <qt>Restore Last Session &gt;&gt; + <qt>Zuletzt benutzt &gt;&gt; + #bottomWidget { -background-image: url(:/core/images/welcomemode/feedback-bar-background.png); + background-image: url(:/core/images/welcomemode/feedback-bar-background.png); } @@ -1798,15 +1871,30 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); * { - background-image: url(":/core/images/welcomemode/btn_feedback.png"); + border-image: url(:/core/images/welcomemode/btn_26.png) 7; + border-width: 7; + padding: -2px 2px; + font-size: 12px; + font-family: lucida sans, dejavu sans, sans serif; } *:hover { - background-image: url(:/core/images/welcomemode/btn_feedback_hover.png) + border-image: url(:/core/images/welcomemode/btn_26_hover.png) 7; + color: white; } + + + <qt>Feedback&nbsp;&nbsp;<img src=":/core/images/welcomemode/feedback_arrow.png" /> + <qt>Rückmeldung&nbsp;&nbsp;<img src=":/core/images/welcomemode/feedback_arrow.png" /> + + + + Help us make Qt Creator even better + Helfen Sie uns, Qt Creator zu verbessern + Core::ModeManager @@ -1859,76 +1947,88 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Core::Utils::ConsoleProcess + + Cannot set up comm channel: %1 + Es konnte kein Kommunikationskanal hergestellt werden: %1 + + + Cannot create temp file: %1 + Es konnte keine temporäre Datei erstellt werden: %1 + - Cannot set up comm channel: %1 - + Cannot set up communication channel: %1 + Es konnte kein Kommunikationskanal hergestellt werden: %1 + - Cannot create temp file: %1 - + Cannot create temporary file: %1 + Es konnte keine temporäre Datei erstellt werden: %1 - + Press <RETURN> to close this window... - + Betätigen Sie die <RETURN> Taste, um das Fenster zu schließen... - Cannot start terminal emulator %1. - + Cannot start the terminal emulator '%1'. + Der Terminal-Emulator '%1' konnte nicht gestartet werden. - - Cannot create temporary file: %2 - - - - - Cannot create temporary directory %1: %2 - + + Cannot create temporary directory '%1': %2 + Das temporäre Verzeichnis '%1' konnte nicht erstellt werden: %2 - Cannot create socket %1: %2 - + Cannot create socket '%1': %2 + Der Socket '%1' konnte nicht erstellt werden: %2 - Cannot change to working directory %1: %2 - + Cannot change to working directory '%1': %2 + Es konnte nicht zum Arbeitsverzeichnis '%1' gewechselt werden: %2 - Cannot execute %1: %2 - + Cannot execute '%1': %2 + Das Kommando '%1' konnte nicht ausgeführt werden: %2 + + + Cannot start terminal emulator %1. + E + + + Cannot create temporary file: %2 + Es konnte keine temporäre Datei erstellt werden: %1 Unexpected output from helper program. - + Die Ausgabe des Hilfsprogrammes kann nicht ausgewertet werden. The process '%1' could not be started: %2 - + Der Prozess '%1; konnte nicht gestartet werden: %2 Cannot obtain a handle to the inferior: %1 - + Der zu debuggende Prozess konnte nicht angesprochen werden: %1 Cannot obtain exit status from inferior: %1 - + Der Rückgabewert des zu debuggenden Prozesses konnte nicht erhalten werden: %1 @@ -1954,6 +2054,33 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Namen von Windows-Geräten dürfen nicht verwendet werden (%1). + + Core::Utils::FileSearch + + + %1: canceled. %n occurrences found in %2 files. + + %1: Abgebrochen. Eine Fundstelle in %2 Dateien. + %1: Abgebrochen. %n Fundstellen in %2 Dateien. + + + + + %1: %n occurrences found in %2 files. + + %1: Eine Fundstelle in %2 Dateien. + %1: %n Fundstellen in %2 Dateien. + + + + + %1: %n occurrences found in %2 of %3 files. + + %1: Eine Fundstelle in %2 von %3 Dateien. + %1: %n Fundstelle in %2 von %3 Dateien. + + + Core::Utils::NewClassWidget @@ -2022,12 +2149,12 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Choose... - + Auswählen... Browse... - + Auswählen... @@ -2162,7 +2289,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Sort alphabetically - + Alphabetisch sortieren @@ -2227,32 +2354,32 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Creates a new C++ source file. - + Erzeugt eine neue C++-Quelldatei C++ Source File - + C++-Quelldatei C++ Class - + C++-Klasse Creates a header and a source file for a new class. - + Erzeugt C++-Header- und Quelldatei für eine neue Klasse Follow Symbol under Cursor - + Symbol unter Einfügemarke verfolgen Switch between Method Declaration/Definition - + Wechsel zwischen Deklaration und Definition der Methode. @@ -2265,22 +2392,22 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Header suffix: - + Endung für Header-Dateien: This determines how the file names of the class wizards are generated ("MyClass.h" versus "myclass.h"). - + Legt fest, wie die Dateinamen aus dem Klassennamen generiert werden ("MyClass.h" beziehungsweise "myclass.h"). Lower case file names: - + Kleinbuchstaben für Dateinamen verwenden: Source suffix: - + Endung für Quelldateien: @@ -2288,7 +2415,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); %1: No such file or directory - + %1: Es existiert keine Datei oder kein Verzeichnis dieses Namens @@ -2296,7 +2423,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); File naming conventions - + Konventionen für die Bildung von Dateinamen @@ -2309,7 +2436,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Completion - + Ergänzung @@ -2322,7 +2449,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Classes - + Klassen @@ -2330,7 +2457,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Methods - + Methoden @@ -2338,7 +2465,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Indexing - + Indizierung @@ -2346,20 +2473,20 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Classes and Methods - + Klassen und Methoden CppTools::Internal::CppToolsPlugin - + &C++ - + &C++ Switch Header/Source - + Zwischen Header- und Quelldatei wechseln @@ -2367,7 +2494,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); %1 of %2 - + %1 von %2 @@ -2382,6 +2509,11 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Debugger + + + <Encoding error> + + Debugger::Internal::AttachCoreDialog @@ -2416,7 +2548,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Refresh - + Aktualisieren @@ -2424,13 +2556,13 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Refresh - + Aktualisieren Debugger::Internal::BreakHandler - + Number Zahl @@ -2460,7 +2592,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Breakpoint will only be hit if this condition is met. @@ -2478,7 +2610,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Delete breakpoint @@ -2503,7 +2635,17 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + + Disable breakpoint + + + + + Enable breakpoint + + + + Conditions on Breakpoint %1 @@ -2511,7 +2653,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Debugger::Internal::CdbDebugEngine - + Unable to load the debugger engine library '%1': %2 @@ -2551,12 +2693,12 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Unable to assign the value '%1' to '%2': %3 - + Cannot retrieve symbols while the debuggee is running. @@ -2583,7 +2725,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Debugger::Internal::DebugMode - + Debug Debuggen @@ -2612,12 +2754,12 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Interrupt Anhalten - + Reset Debugger Debugger zurücksetzen @@ -2703,12 +2845,13 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Läuft... - + + Changing breakpoint state requires either a fully running or fully stopped application. - + Debugging VS executables is not supported. @@ -2780,12 +2923,11 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Debugger::Internal::DebuggerPlugin - Toggle Breakpoint - Haltepunkt umschalten + Haltepunkt umschalten - + Stop Debugger/Interrupt Debugger @@ -2814,6 +2956,26 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Threads: + + + Remove Breakpoint + + + + + Disable Breakpoint + + + + + Enable Breakpoint + + + + + Set Breakpoint + + Debugger::Internal::DebuggerRunner @@ -2871,12 +3033,12 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Debug debugging helper - + Recheck debugging helper availability @@ -2886,7 +3048,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Hexadecimal @@ -2949,7 +3111,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Debugger::Internal::DebuggingHelperOptionPage - + Debugging Helper @@ -3013,7 +3175,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); Debugger::Internal::GdbEngine - + The Gdb process failed to start. Either the invoked program '%1' is missing, or you may have insufficient permissions to invoke the program. @@ -3044,13 +3206,48 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Error - + + Library %1 loaded. + + + + + Library %1 unloaded. + + + + + Thread group %1 created. + + + + + Thread %1 created. + + + + + Thread group %1 exited. + + + + + Thread %1 in group %2 exited. + + + + + Thread %1 selected. + + + + Reading @@ -3070,7 +3267,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); - + Core file loaded. @@ -3181,7 +3378,7 @@ Using gdb 6.7 or later is strongly recommended. - + <could not retreive module information> @@ -3212,8 +3409,8 @@ Using gdb 6.7 or later is strongly recommended. - - + + Retrieving data for watch view (%1 requests pending)... @@ -3228,7 +3425,7 @@ Using gdb 6.7 or later is strongly recommended. - + Debugging helpers not found. @@ -3238,7 +3435,7 @@ Using gdb 6.7 or later is strongly recommended. - + Custom dumper setup: %1 @@ -3413,7 +3610,7 @@ Using gdb 6.7 or later is strongly recommended. Cannot create temporary file: %2 - + Es konnte keine temporäre Datei erstellt werden: %1 @@ -3470,7 +3667,7 @@ Using gdb 6.7 or later is strongly recommended. Debugger::Internal::ScriptEngine - + '%1' contains no identifier @@ -3653,7 +3850,7 @@ Using gdb 6.7 or later is strongly recommended. Debugger::Internal::WatchHandler - + Root @@ -3711,7 +3908,7 @@ Using gdb 6.7 or later is strongly recommended. - + Adjust column widths to contents @@ -3785,7 +3982,7 @@ Using gdb 6.7 or later is strongly recommended. DependenciesModel - + Unable to add dependency @@ -4146,17 +4343,17 @@ Rebuilding the project might help. Registered Documentation: - + Registrierte Dokumentationen Add... - + Hinzufügen... Remove - + Entfernen @@ -4450,7 +4647,7 @@ Reason: %3 - + E20: Mark '%1' not set @@ -4645,22 +4842,8 @@ Reason: %3 FileSearch - - %1: canceled. %2 occurrences found in %3 files. - %1: abgebrochen. - - - - - %1: %2 occurrences found in %3 of %4 files. - - - - - - %1: %2 occurrences found in %3 files. - + %1: abgebrochen. @@ -4686,7 +4869,7 @@ Reason: %3 Filter: - + Filter: @@ -4701,12 +4884,12 @@ Reason: %3 Add - + Hinzufügen Remove - + Entfernen @@ -4750,7 +4933,7 @@ Reason: %3 Find::Internal::FindPlugin - + &Find/Replace &Suchen/Ersetzen @@ -4854,7 +5037,7 @@ Reason: %3 Suchergebnisse - + No matches found! Es wurden keine Treffer gefunden! @@ -4932,49 +5115,6 @@ Reason: %3 - - GeneralSettings - - - Form - - - - - General settings - - - - - User &interface color: - - - - - Reset to default - - - - - R - - - - - External editor: - - - - - ? - - - - - Terminal: - - - GenericMakeStep @@ -5009,7 +5149,7 @@ Reason: %3 GenericProjectManager::Internal::GenericBuildSettingsWidget - + Build directory: @@ -5545,7 +5685,7 @@ Reason: %3 Cannot create temporary file: %1 - + Es konnte keine temporäre Datei erstellt werden: %1 @@ -6110,7 +6250,7 @@ Skipping file. &Look for: - + &Suche nach: @@ -6350,7 +6490,7 @@ in your .pro file. Filter: - + Filter: @@ -6460,7 +6600,7 @@ in your .pro file. Add - + Hinzufügen @@ -7346,7 +7486,7 @@ Library base name: %1 ProjectExplorer::Internal::CompileOutputWindow - + Compile Output Kompilierung @@ -7355,7 +7495,7 @@ Library base name: %1 ProjectExplorer::Internal::CoreListenerCheckingForRunningBuild - + Cancel Build && Close Erstellen abbrechen und schließen @@ -7552,8 +7692,7 @@ Library base name: %1 ProjectExplorer::Internal::OutputWindow - - + Application Output Window @@ -7688,115 +7827,11 @@ Library base name: %1 - - ProjectExplorer::Internal::QtOptionsPageWidget - - - <specify a name> - - - - - <specify a path> - - - - - Select QTDIR - - - - - Select the Qt Directory - - - - - The Qt Version %1 is not installed. Run make install - - - - - %1 is not a valid qt directory - - - - - Found Qt version %1, using mkspec %2 - - - ProjectExplorer::Internal::QtVersionManager - - Form - - - - - Qt versions - - - - - + - - - - - - - - - - - Name - - - - - Path - - - - - Debugging Helper - - - - - Version Name: - - - - Path: - Pfad: - - - - MinGw Directory: - - - - - Debugging Helper: - - - - - Show &Log - - - - - &Rebuild - - - - - Default Qt Version: - + Pfad: @@ -7903,7 +7938,7 @@ Library base name: %1 ProjectExplorer::Internal::TaskDelegate - + File not found: %1 @@ -7911,7 +7946,7 @@ Library base name: %1 ProjectExplorer::Internal::TaskWindow - + Build Issues @@ -7980,7 +8015,7 @@ Library base name: %1 Projekte - + &Build &Erstellen @@ -8247,15 +8282,12 @@ unter Versionsverwaltung (%2) gestellt werden? ProjectExplorer::QtVersionManager - - Auto-detected Qt - Vorgefundene Qt-Installation + Vorgefundene Qt-Installation - <not found> - <nicht gefunden> + <nicht gefunden> @@ -8415,7 +8447,7 @@ unter Versionsverwaltung (%2) gestellt werden? - + File is Read Only @@ -8548,13 +8580,13 @@ unter Versionsverwaltung (%2) gestellt werden? Add - + Hinzufügen Remove - + Entfernen @@ -8566,7 +8598,7 @@ unter Versionsverwaltung (%2) gestellt werden? Prefix: - + Präfix: @@ -8683,12 +8715,12 @@ unter Versionsverwaltung (%2) gestellt werden? Add... - + Hinzufügen... Edit... - + Ändern... @@ -8809,7 +8841,7 @@ unter Versionsverwaltung (%2) gestellt werden? Remove - + Entfernen @@ -8918,7 +8950,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Internal::ProjectLoadWizard - + Import existing settings @@ -8983,13 +9015,13 @@ unter Versionsverwaltung (%2) gestellt werden? Remove - + Entfernen Qt4ProjectManager::Internal::Qt4PriFileNode - + Failed! Fehler @@ -9023,7 +9055,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Internal::Qt4ProFileNode - + Error while parsing file %1. Giving up. @@ -9076,7 +9108,7 @@ unter Versionsverwaltung (%2) gestellt werden? - + Shadow Build Directory @@ -9094,7 +9126,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Internal::Qt4ProjectManagerPlugin - + Run qmake qmake ausführen @@ -9103,13 +9135,13 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Internal::Qt4RunConfiguration - + Qt4RunConfiguration - + Could not parse %1. The Qt4 run configuration %2 can not be started. @@ -9117,7 +9149,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Internal::Qt4RunConfigurationWidget - + Name: Name: @@ -9147,11 +9179,115 @@ unter Versionsverwaltung (%2) gestellt werden? + + Qt4ProjectManager::Internal::QtOptionsPageWidget + + + <specify a name> + + + + + <specify a path> + + + + + Select QTDIR + + + + + Select the Qt Directory + + + + + The Qt Version %1 is not installed. Run make install + + + + + %1 is not a valid qt directory + + + + + Found Qt version %1, using mkspec %2 + + + Qt4ProjectManager::Internal::QtVersionManager + Path: - Pfad: + Pfad: + + + + Form + + + + + Qt versions + + + + + + + + + + + - + + + + + Name + + + + + Path + + + + + Debugging Helper + + + + + Version Name: + + + + + MinGw Directory: + + + + + Debugging Helper: + + + + + Show &Log + + + + + &Rebuild + + + + + Default Qt Version: + @@ -9237,7 +9373,7 @@ unter Versionsverwaltung (%2) gestellt werden? Remove - + Entfernen @@ -9263,7 +9399,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::MakeStep - + <font color="#ff0000">Could not find make command: %1 in the build environment</font> @@ -9311,7 +9447,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Qt4Manager - + Loading project %1 ... @@ -9342,6 +9478,36 @@ unter Versionsverwaltung (%2) gestellt werden? + + Qt4ProjectManager::QtVersionManager + + + <not found> + <nicht gefunden> + + + + + Auto-detected Qt + Vorgefundene Qt-Installation + + + + QtDumperHelper + + + <none> + + + + + %n known types, Qt version: %1, Qt namespace: %2 + + + + + + QtScriptEditor::Internal::QtScriptEditorActionHandler @@ -9392,12 +9558,12 @@ unter Versionsverwaltung (%2) gestellt werden? Limit to prefix - + Auf Präfix beschränken Prefix: - + Präfix: @@ -9405,39 +9571,36 @@ unter Versionsverwaltung (%2) gestellt werden? Generic Directory Filter - + Allgemeines Verzeichnisfilter - + Filter Configuration Filterkonfiguration - - - , - - - - + Choose a directory to add - + Bitte wählen Sie das hinzuzufügende Verzeichnis %1 filter update: 0 files - + %1 Filterstatus: Keine Dateien - - - %1 filter update: %2 files - + + + %1 filter update: %n files + + %1 Filterstatus: Eine Datei + %1 Filterstatus: %n Dateien + %1 filter update: canceled - + %1 Filterstatus: Abgebrochen @@ -9455,48 +9618,49 @@ unter Versionsverwaltung (%2) gestellt werden? File Types: - + Dateitypen: Specify file name filters, separated by comma. Filters may contain wildcards. - + Eine Liste von durch Kommata getrennte Filtern für Dateinamen. Die Filter können Suchmuster enthalten. Prefix: - - - - - Specify a short word/abbreviation that can be used to restrict completions to files from this directory tree. -To do this you type this shortcut and a space in the QuickOpen entry field, and then the word to search for. - + Präfix: Limit to prefix - + Auf Präfix beschränken Add... - + Hinzufügen... Edit... - + Ändern... Remove - + Entfernen Directories: - + Verzeichnisse: + + + + Specify a short word/abbreviation that can be used to restrict completions to files from this directory tree. +To do this, you type this shortcut and a space in the Locator entry field, and then the word to search for. + Geben Sie ein Kürzel oder eine Abkürzung ein, die die Funde auf Dateien von diesem Verzeichnis beschränkt. +Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeichen und dem Suchbegriff. @@ -9504,7 +9668,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Files in file system - + Dateien aus dem Dateisystem @@ -9512,27 +9676,27 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Filter configuration - + Filterkonfiguration Prefix: - + Präfix: Limit to prefix - + Auf Präfix beschränken Include hidden files - + Versteckte Dateien zeigen Filter: - + Filter: @@ -9540,7 +9704,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Open documents - + Offene Dokumente @@ -9548,15 +9712,15 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Available filters - + Verfügbare Filter QuickOpen::Internal::QuickOpenPlugin - + Indexing - + Indizierung @@ -9564,7 +9728,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Refresh - + Aktualisieren @@ -9574,17 +9738,17 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Locate... - + Finden... Type to locate - + Suchmuster <type here> - + <Tippen Sie hier> @@ -9592,17 +9756,17 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Configure Filters - + Filter konfigurieren Add - + Hinzufügen Remove - + Entfernen @@ -9612,17 +9776,17 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Refresh Intervall: - + Aktualisierungsintervall: min - + minuten Refresh now! - + Jetzt aktualisieren! @@ -9630,7 +9794,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and %1 (Prefix: %2) - + %1 (Präfix: %2) @@ -9638,17 +9802,17 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Configure Filters - + Filterkonfiguration Add - + Hinzufügen Remove - + Entfernen @@ -9658,12 +9822,12 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Refresh Interval: - + Aktualisierungsintervall: min - + minuten @@ -9978,7 +10142,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Filter: - + Filter: @@ -10028,13 +10192,13 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Remove - + Entfernen ShowBuildLog - + Debugging Helper Build Log @@ -10470,7 +10634,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Add - + Hinzufügen @@ -10635,7 +10799,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Cannot create temporary file: %1 - + Es konnte keine temporäre Datei erstellt werden: %1 @@ -10723,7 +10887,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and TextEditor::BaseTextEditor - + Print Document Dokument drucken @@ -10741,7 +10905,7 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and TextEditor::BaseTextEditorEditable - + Line: %1, Col: %2 Zeile: %1, Spalte: %2 @@ -10891,6 +11055,16 @@ To do this you type this shortcut and a space in the QuickOpen entry field, and Highlight &blocks Blöcke hervorheben + + + Use fancy style + + + + + Animate matching parentheses + Passende Klammern animieren + TextEditor::FontSettingsPage @@ -11319,6 +11493,11 @@ Die folgenden Encodings scheinen der Datei zu entsprechen: Current Line Aktuelle Zeile + + + Current Line Number + + Number From 2f129dfad3dea632cfb14d1100cc4999ebebb47b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Apr 2009 16:09:57 +0200 Subject: [PATCH 10/11] Fixed some translation errors. --- src/libs/utils/consoleprocess_unix.cpp | 16 +++--- src/libs/utils/consoleprocess_win.cpp | 8 +-- src/libs/utils/filesearch.cpp | 58 +++++++++++++--------- src/plugins/coreplugin/generalsettings.cpp | 2 +- src/plugins/coreplugin/generalsettings.h | 10 ++-- src/plugins/coreplugin/generalsettings.ui | 6 +-- src/plugins/coreplugin/welcomemode.cpp | 2 +- src/plugins/quickopen/directoryfilter.cpp | 10 ++-- src/plugins/quickopen/directoryfilter.ui | 2 +- src/shared/help/bookmarkmanager.cpp | 4 +- 10 files changed, 66 insertions(+), 52 deletions(-) diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index a43264b59d0..c1183734d09 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -71,7 +71,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) QString err = stubServerListen(); if (!err.isEmpty()) { - emit processError(tr("Cannot set up comm channel: %1").arg(err)); + emit processError(tr("Cannot set up communication channel: %1").arg(err)); return false; } @@ -79,7 +79,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) m_tempFile = new QTemporaryFile(); if (!m_tempFile->open()) { stubServerShutdown(); - emit processError(tr("Cannot create temp file: %1").arg(m_tempFile->errorString())); + emit processError(tr("Cannot create temporary file: %1").arg(m_tempFile->errorString())); delete m_tempFile; m_tempFile = 0; return false; @@ -109,7 +109,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) m_process.start(xterm, xtermArgs); if (!m_process.waitForStarted()) { stubServerShutdown(); - emit processError(tr("Cannot start terminal emulator %1.").arg(xterm)); + emit processError(tr("Cannot start the terminal emulator '%1'.").arg(xterm)); delete m_tempFile; m_tempFile = 0; return false; @@ -145,7 +145,7 @@ QString ConsoleProcess::stubServerListen() { QTemporaryFile tf; if (!tf.open()) - return tr("Cannot create temporary file: %2").arg(tf.errorString()); + return tr("Cannot create temporary file: %1").arg(tf.errorString()); stubFifoDir = QFile::encodeName(tf.fileName()); } // By now the temp file was deleted again @@ -153,12 +153,12 @@ QString ConsoleProcess::stubServerListen() if (!::mkdir(m_stubServerDir.constData(), 0700)) break; if (errno != EEXIST) - return tr("Cannot create temporary directory %1: %2").arg(stubFifoDir, strerror(errno)); + return tr("Cannot create temporary directory '%1': %2").arg(stubFifoDir, strerror(errno)); } QString stubServer = stubFifoDir + "/stub-socket"; if (!m_stubServer.listen(stubServer)) { ::rmdir(m_stubServerDir.constData()); - return tr("Cannot create socket %1: %2").arg(stubServer, m_stubServer.errorString()); + return tr("Cannot create socket '%1': %2").arg(stubServer, m_stubServer.errorString()); } return QString(); } @@ -190,10 +190,10 @@ void ConsoleProcess::readStubOutput() QByteArray out = m_stubSocket->readLine(); out.chop(1); // \n if (out.startsWith("err:chdir ")) { - emit processError(tr("Cannot change to working directory %1: %2") + emit processError(tr("Cannot change to working directory '%1': %2") .arg(workingDirectory(), errorMsg(out.mid(10).toInt()))); } else if (out.startsWith("err:exec ")) { - emit processError(tr("Cannot execute %1: %2") + emit processError(tr("Cannot execute '%1': %2") .arg(m_executable, errorMsg(out.mid(9).toInt()))); } else if (out.startsWith("pid ")) { // Will not need it any more diff --git a/src/libs/utils/consoleprocess_win.cpp b/src/libs/utils/consoleprocess_win.cpp index ce5d15029d8..bc4b9a31e91 100644 --- a/src/libs/utils/consoleprocess_win.cpp +++ b/src/libs/utils/consoleprocess_win.cpp @@ -69,7 +69,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) QString err = stubServerListen(); if (!err.isEmpty()) { - emit processError(tr("Cannot set up comm channel: %1").arg(err)); + emit processError(tr("Cannot set up communication channel: %1").arg(err)); return false; } @@ -77,7 +77,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) m_tempFile = new QTemporaryFile(); if (!m_tempFile->open()) { stubServerShutdown(); - emit processError(tr("Cannot create temp file: %1").arg(m_tempFile->errorString())); + emit processError(tr("Cannot create temporary file: %1").arg(m_tempFile->errorString())); delete m_tempFile; m_tempFile = 0; return false; @@ -180,10 +180,10 @@ void ConsoleProcess::readStubOutput() QByteArray out = m_stubSocket->readLine(); out.chop(2); // \r\n if (out.startsWith("err:chdir ")) { - emit processError(tr("Cannot change to working directory %1: %2") + emit processError(tr("Cannot change to working directory '%1': %2") .arg(workingDirectory(), winErrorMessage(out.mid(10).toInt()))); } else if (out.startsWith("err:exec ")) { - emit processError(tr("Cannot execute %1: %2") + emit processError(tr("Cannot execute '%1': %2") .arg(m_executable, winErrorMessage(out.mid(9).toInt()))); } else if (out.startsWith("pid ")) { // Will not need it any more diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index 7cf1d822578..063ac124b73 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -35,12 +35,36 @@ #include #include #include -#include +#include #include using namespace Core::Utils; +static inline QString msgCanceled(const QString &searchTerm, int numMatches, int numFilesSearched) +{ + return QCoreApplication::translate("Core::Utils::FileSearch", + "%1: canceled. %n occurrences found in %2 files.", + 0, QCoreApplication::CodecForTr, numMatches). + arg(searchTerm).arg(numFilesSearched); +} + +static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched) +{ + return QCoreApplication::translate("Core::Utils::FileSearch", + "%1: %n occurrences found in %2 files.", + 0, QCoreApplication::CodecForTr, numMatches). + arg(searchTerm).arg(numFilesSearched); +} + +static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched, int filesSize) +{ + return QCoreApplication::translate("Core::Utils::FileSearch", + "%1: %n occurrences found in %2 of %3 files.", + 0, QCoreApplication::CodecForTr, numMatches). + arg(searchTerm).arg(numFilesSearched).arg(filesSize); +} + namespace { void runFileSearch(QFutureInterface &future, @@ -71,9 +95,7 @@ void runFileSearch(QFutureInterface &future, if (future.isPaused()) future.waitForResume(); if (future.isCanceled()) { - future.setProgressValueAndText(numFilesSearched, - QApplication::translate("FileSearch", "%1: canceled. %2 occurrences found in %3 files."). - arg(searchTerm).arg(numMatches).arg(numFilesSearched)); + future.setProgressValueAndText(numFilesSearched, msgCanceled(searchTerm, numMatches, numFilesSearched)); break; } QFile file(s); @@ -146,14 +168,10 @@ void runFileSearch(QFutureInterface &future, firstChunk = false; } ++numFilesSearched; - future.setProgressValueAndText(numFilesSearched, - QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 of %4 files."). - arg(searchTerm).arg(numMatches).arg(numFilesSearched).arg(files.size())); + future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched, files.size())); } if (!future.isCanceled()) - future.setProgressValueAndText(numFilesSearched, - QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 files."). - arg(searchTerm).arg(numMatches).arg(numFilesSearched)); + future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched)); } void runFileSearchRegExp(QFutureInterface &future, @@ -165,17 +183,15 @@ void runFileSearchRegExp(QFutureInterface &future, int numFilesSearched = 0; int numMatches = 0; if (flags & QTextDocument::FindWholeWords) - searchTerm = QString("\\b%1\\b").arg(searchTerm); - Qt::CaseSensitivity caseSensitivity = (flags & QTextDocument::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive; - QRegExp expression(searchTerm, caseSensitivity); + searchTerm = QString::fromLatin1("\\b%1\\b").arg(searchTerm); + const Qt::CaseSensitivity caseSensitivity = (flags & QTextDocument::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive; + const QRegExp expression(searchTerm, caseSensitivity); - foreach (QString s, files) { + foreach (const QString &s, files) { if (future.isPaused()) future.waitForResume(); if (future.isCanceled()) { - future.setProgressValueAndText(numFilesSearched, - QApplication::translate("FileSearch", "%1: canceled. %2 occurrences found in %3 files."). - arg(searchTerm).arg(numMatches).arg(numFilesSearched)); + future.setProgressValueAndText(numFilesSearched, msgCanceled(searchTerm, numMatches, numFilesSearched)); break; } QFile file(s); @@ -195,14 +211,10 @@ void runFileSearchRegExp(QFutureInterface &future, ++lineNr; } ++numFilesSearched; - future.setProgressValueAndText(numFilesSearched, - QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 of %4 files."). - arg(searchTerm).arg(numMatches).arg(numFilesSearched).arg(files.size())); + future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched, files.size())); } if (!future.isCanceled()) - future.setProgressValueAndText(numFilesSearched, - QApplication::translate("FileSearch", "%1: %2 occurrences found in %3 files."). - arg(searchTerm).arg(numMatches).arg(numFilesSearched)); + future.setProgressValueAndText(numFilesSearched, msgFound(searchTerm, numMatches, numFilesSearched)); } } // namespace diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index ff0f73f3302..f57931627b5 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -68,7 +68,7 @@ QString GeneralSettings::trCategory() const QWidget *GeneralSettings::createPage(QWidget *parent) { - m_page = new Ui_GeneralSettings(); + m_page = new Ui::GeneralSettings(); QWidget *w = new QWidget(parent); m_page->setupUi(w); diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h index d75cd2d8a39..aedef6d4206 100644 --- a/src/plugins/coreplugin/generalsettings.h +++ b/src/plugins/coreplugin/generalsettings.h @@ -33,13 +33,13 @@ #include #include -QT_BEGIN_NAMESPACE -class Ui_GeneralSettings; -QT_END_NAMESPACE - namespace Core { namespace Internal { +namespace Ui { + class GeneralSettings; +} + class GeneralSettings : public IOptionsPage { Q_OBJECT @@ -64,7 +64,7 @@ private slots: #endif private: - Ui_GeneralSettings *m_page; + Ui::GeneralSettings *m_page; QWidget *m_dialog; }; diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index 826c45ae6bc..84cdf128815 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -1,7 +1,7 @@ - GeneralSettings - + Core::Internal::GeneralSettings + 0 @@ -62,7 +62,7 @@ 0 - + false diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index ee85691c425..59bd555e7e9 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -120,7 +120,7 @@ WelcomeMode::~WelcomeMode() QString WelcomeMode::name() const { - return QLatin1String("Welcome"); + return tr("Welcome"); } QIcon WelcomeMode::icon() const diff --git a/src/plugins/quickopen/directoryfilter.cpp b/src/plugins/quickopen/directoryfilter.cpp index b1030ee66aa..714399dcb7a 100644 --- a/src/plugins/quickopen/directoryfilter.cpp +++ b/src/plugins/quickopen/directoryfilter.cpp @@ -42,7 +42,8 @@ using namespace QuickOpen::Internal; DirectoryFilter::DirectoryFilter() : m_name(tr("Generic Directory Filter")), - m_filters(QStringList() << "*.h" << "*.cpp" << "*.ui" << "*.qrc") + m_filters(QStringList() << QLatin1String("*.h") << QLatin1String("*.cpp") + << QLatin1String("*.ui") << QLatin1String("*.qrc")) { setIncludedByDefault(true); } @@ -112,7 +113,7 @@ bool DirectoryFilter::openConfigDialog(QWidget *parent, bool &needsRefresh) m_ui.nameEdit->selectAll(); m_ui.directoryList->clear(); m_ui.directoryList->addItems(m_directories); - m_ui.fileTypeEdit->setText(m_filters.join(tr(","))); + m_ui.fileTypeEdit->setText(m_filters.join(QString(QLatin1Char(',')))); m_ui.shortcutEdit->setText(shortcutString()); m_ui.defaultFlag->setChecked(!isIncludedByDefault()); updateOptionButtons(); @@ -132,7 +133,7 @@ bool DirectoryFilter::openConfigDialog(QWidget *parent, bool &needsRefresh) if (!directoriesChanged && m_directories.at(i) != oldDirectories.at(i)) directoriesChanged = true; } - m_filters = m_ui.fileTypeEdit->text().trimmed().split(tr(",")); + m_filters = m_ui.fileTypeEdit->text().trimmed().split(QLatin1Char(',')); setShortcutString(m_ui.shortcutEdit->text().trimmed()); setIncludedByDefault(!m_ui.defaultFlag->isChecked()); if (directoriesChanged || oldFilters != m_filters) @@ -207,7 +208,8 @@ void DirectoryFilter::refresh(QFutureInterface &future) } while (!dirs.isEmpty() && !future.isCanceled()) { if (future.isProgressUpdateNeeded()) { - future.setProgressValueAndText(progress, tr("%1 filter update: %2 files").arg(m_name).arg(files.size())); + future.setProgressValueAndText(progress, + tr("%1 filter update: %n files", 0, files.size()).arg(m_name)); } QDir dir = dirs.pop(); int dirProgressMax = progressValues.pop(); diff --git a/src/plugins/quickopen/directoryfilter.ui b/src/plugins/quickopen/directoryfilter.ui index 41fa3d5bdeb..9e618324e94 100644 --- a/src/plugins/quickopen/directoryfilter.ui +++ b/src/plugins/quickopen/directoryfilter.ui @@ -63,7 +63,7 @@ Specify a short word/abbreviation that can be used to restrict completions to files from this directory tree. -To do this you type this shortcut and a space in the QuickOpen entry field, and then the word to search for. +To do this, you type this shortcut and a space in the Locator entry field, and then the word to search for. diff --git a/src/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp index e3cfbfc493b..4531cb5bb83 100644 --- a/src/shared/help/bookmarkmanager.cpp +++ b/src/shared/help/bookmarkmanager.cpp @@ -699,8 +699,8 @@ void BookmarkManager::removeBookmarkItem(QTreeView *treeView, const QModelIndex& QString data = index.data(Qt::UserRole + 10).toString(); if (data == QLatin1String("Folder") && item->rowCount() > 0) { int value = QMessageBox::question(treeView, tr("Remove"), - tr("You are going to delete a Folder, this will also
" - "remove it's content. Are you sure to continue?"), + tr("You are going to delete a Folder which will also
" + "remove its content. Are you sure to continue?"), QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); if (value == QMessageBox::Cancel) From 769f065d34ccf453b255273c1ce17daee96057c3 Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 30 Apr 2009 16:54:51 +0200 Subject: [PATCH 11/11] Add custom dumpers to custom run executables --- .../projectexplorer/customexecutablerunconfiguration.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 71920dd8b5c..e25718033c7 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -31,6 +31,8 @@ #include "environment.h" #include "project.h" +#include + #include #include #include @@ -312,11 +314,11 @@ void CustomExecutableRunConfiguration::setUserName(const QString &name) QString CustomExecutableRunConfiguration::dumperLibrary() const { - return QString(); + QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment()); + return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibrary(qmakePath); } - // Factory CustomExecutableRunConfigurationFactory::CustomExecutableRunConfigurationFactory()