Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
mae
2009-04-30 19:32:26 +02:00
57 changed files with 1785 additions and 959 deletions

View File

@@ -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<const int *>(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<const int *>(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<int> &list = *reinterpret_cast<const std::list<int> *>(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\","

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -35,12 +35,36 @@
#include <QtCore/QFutureInterface>
#include <QtCore/QtConcurrentRun>
#include <QtCore/QRegExp>
#include <QtGui/QApplication>
#include <QtCore/QCoreApplication>
#include <qtconcurrent/runextensions.h>
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<FileSearchResult> &future,
@@ -71,9 +95,7 @@ void runFileSearch(QFutureInterface<FileSearchResult> &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<FileSearchResult> &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<FileSearchResult> &future,
@@ -165,17 +183,15 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResult> &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<FileSearchResult> &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

View File

@@ -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 <class A, class B> QStringBuilder< QStringBuilderPair<A, B> > operator%(const A &a, const B &b)
Creates a helper object containing both parameters.
This is the main function to build up
*/

View File

@@ -0,0 +1,206 @@
/****************************************************************************
**
** 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 <QtCore/qstring.h>
#include <string.h>
class QLatin1Literal
{
public:
template <int N>
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 A>
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<QString>
{
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 QStringBuilder<char>
{
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 A, class B>
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 <class A, class B>
QStringBuilder< QStringBuilderPair<A, B> >
operator%(const A &a, const B &b)
{
return QStringBuilderPair<A, B> (a, b);
}
// QString related specializations
template <class A>
inline QStringBuilder< QStringBuilderPair<A, QStringBuilder<QString> > >
operator%(const A &a, const QString &b)
{
return QStringBuilderPair<A, QStringBuilder<QString> > (a, b);
}
template <class B>
inline QStringBuilder< QStringBuilderPair<QStringBuilder<QString>, B> >
operator%(const QString &a, const B &b)
{
return QStringBuilderPair<QStringBuilder<QString>, B> (a, b);
}
inline QStringBuilder<
QStringBuilderPair<QStringBuilder<QString>, QStringBuilder<QString> >
>
operator%(const QString &a, const QString &b)
{
return QStringBuilderPair< QStringBuilder<QString>,
QStringBuilder<QString> > (a, b);
}
// char related specializations
template <class A>
inline QStringBuilder< QStringBuilderPair<A, QStringBuilder<char> > >
operator%(const A &a, char b)
{
return QStringBuilderPair<A, QStringBuilder<char> > (a, b);
}
template <class B>
inline QStringBuilder< QStringBuilderPair<QStringBuilder<char>, B> >
operator%(char a, const B &b)
{
return QStringBuilderPair<QStringBuilder<QString>, B> (a, b);
}
inline QStringBuilder<
QStringBuilderPair<QStringBuilder<QString>, QStringBuilder<char> >
>
operator%(const QString &a, char b)
{
return QStringBuilderPair<
QStringBuilder<QString>, QStringBuilder<char>
> (a, b);
}
#endif // QSTRINGBUILDER_H

View File

@@ -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);

View File

@@ -33,13 +33,13 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtGui/QWidget>
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;
};

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeneralSettings</class>
<widget class="QWidget" name="GeneralSettings">
<class>Core::Internal::GeneralSettings</class>
<widget class="QWidget" name="Core::Internal::GeneralSettings">
<property name="geometry">
<rect>
<x>0</x>
@@ -62,7 +62,7 @@
<height>0</height>
</size>
</property>
<property name="alphaAllowed" stdset="0">
<property name="alphaAllowed">
<bool>false</bool>
</property>
</widget>

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;
};

View File

@@ -40,6 +40,8 @@
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QComboBox>
@@ -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<int> 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<IOutputPane*> panes = ExtensionSystem::PluginManager::instance()
->getObjects<IOutputPane>();
@@ -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<IOutputPane*>(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);

View File

@@ -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<int, Core::IOutputPane*> m_pageMap;
int m_lastIndex;
QStackedWidget *m_outputWidgetPane;
QStackedWidget *m_opToolBarWidgets;
QAction *m_opToolBarAction;
QWidget *m_buttonsWidget;
QMap<int, QPushButton *> m_buttons;
QMap<QAction *, int> m_actions;

View File

@@ -120,7 +120,7 @@ WelcomeMode::~WelcomeMode()
QString WelcomeMode::name() const
{
return QLatin1String("Welcome");
return tr("Welcome");
}
QIcon WelcomeMode::icon() const

View File

@@ -43,4 +43,5 @@ typedef IDebugDataSpaces4 CIDebugDataSpaces;
typedef IDebugSymbolGroup2 CIDebugSymbolGroup;
typedef IDebugBreakpoint2 CIDebugBreakpoint;
#endif // CDBCOM_H

View File

@@ -32,6 +32,7 @@
#include "watchutils.h"
#include "cdbcom.h"
#include <QtCore/QStringList>
#include <QtCore/QMap>
@@ -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).

View File

@@ -28,6 +28,7 @@
**************************************************************************/
#include "cdboptions.h"
#include <QtCore/QSettings>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>

View File

@@ -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;

View File

@@ -31,6 +31,7 @@
#include "cdbdebugengine_p.h"
#include "watchhandler.h"
#include "watchutils.h"
#include <QtCore/QTextStream>
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)
{

View File

@@ -130,7 +130,8 @@ private:
};
// Helper to a sequence of WatchData into a list.
class WatchDataBackInserter {
class WatchDataBackInserter
{
public:
explicit WatchDataBackInserter(QList<WatchData> &wh) : m_wh(wh) {}

View File

@@ -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);

View File

@@ -38,6 +38,7 @@
#include "registerhandler.h"
#include "stackhandler.h"
#include "watchhandler.h"
#include "watchutils.h"
#include "moduleshandler.h"
#include <utils/qtcassert.h>
@@ -422,28 +423,6 @@ static WatchData m_toolTip;
static QPoint m_toolTipPos;
static QHash<QString, WatchData> 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);

View File

@@ -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<const ushort *>(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<const uint *>(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<const ushort *>(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="<binhex>",
* valueencoded="2"},{name="1",value="dAB3AG8A",valueencoded="2"},{name="2",
* value="dABoAHIAZQBlAA==",valueencoded="2"}]" */
* numchild="3",childtype="QString",childnumchild="0",
* children=[{name="0",value="<binhex>",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);

View File

@@ -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

View File

@@ -34,6 +34,7 @@
#ifdef USE_PSAPI
# include <psapi.h>
#endif
namespace Debugger {
namespace Internal {
@@ -75,5 +76,5 @@ QList<ProcData> winProcessList()
return rc;
}
}
}
} // namespace Internal
} // namespace Debugger

View File

@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef _DBG_WINDUTILS_H
#define _DBG_WINDUTILS_H
#ifndef DEBUGGER_DBG_WINUTILS_H
#define DEBUGGER_DBG_WINUTILS_H
#include <QtCore/QList>
@@ -39,6 +39,7 @@ struct ProcData; // debuggerdialogs, used by the process listing dialogs
QList<ProcData> winProcessList();
}
}
#endif
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_DBG_WINUTILS_H

View File

@@ -40,7 +40,7 @@ using Core::Utils::winErrorMessage;
// a memory mapped file
template <class Ptr>
inline Ptr *makePtr(void *base, ptrdiff_t offset)
inline Ptr *makePtr(void *base, ptrdiff_t offset)
{
return reinterpret_cast<Ptr*>(static_cast<char*>(base) + offset);
}
@@ -275,5 +275,5 @@ bool getPDBFiles(const QString &peExecutableFileName, QStringList *rc, QString *
return success;
}
}
}
} // namespace Internal
} // namespace Debugger

View File

@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef PEUTILS_H
#define PEUTILS_H
#ifndef DEBUGGER_PEUTILS_H
#define DEBUGGER_PEUTILS_H
#include <QtCore/qnamespace.h>
@@ -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

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -99,3 +99,8 @@ void SearchResultTreeView::keyPressEvent(QKeyEvent *e)
}
QTreeView::keyPressEvent(e);
}
SearchResultTreeModel *SearchResultTreeView::model() const
{
return m_model;
}

View File

@@ -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:

View File

@@ -35,6 +35,7 @@
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QtCore/QSettings>
#include <QtCore/QDebug>
#include <QtGui/QListWidget>
#include <QtGui/QToolButton>
@@ -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;
}

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -57,6 +57,12 @@ public:
bool hasFocus();
void setFocus();
bool canNext();
bool canPrevious();
void goToNext();
void goToPrev();
bool canNavigate();
private:
QPlainTextEdit *m_textEdit;
};

View File

@@ -31,6 +31,8 @@
#include "environment.h"
#include "project.h"
#include <projectexplorer/debugginghelper.h>
#include <QtGui/QCheckBox>
#include <QtGui/QFormLayout>
#include <QtGui/QLineEdit>
@@ -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()

View File

@@ -305,6 +305,30 @@ RunControl* OutputPane::runControlForTab(int index) const
return m_outputWindows.key(qobject_cast<OutputWindow *>(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;
}
/*******************/
@@ -350,368 +374,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<int>(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<int>(line.height());
same_height = same_height && (line.height() + leading) == spacing;
width_used = qMax(width_used, 8 + static_cast<int>(line.naturalTextWidth()));
}
textLayout.endLayout();
if (lineNumber >= sel_start.line && lineNumber <= sel_end.line) {
QVector<QTextLayout::FormatRange> 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

View File

@@ -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

View File

@@ -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 <QDebug>
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
/////

View File

@@ -74,6 +74,12 @@ public:
bool hasFocus();
void setFocus();
bool canNext();
bool canPrevious();
void goToNext();
void goToPrev();
bool canNavigate();
signals:
void tasksChanged();

View File

@@ -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<void> &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();

View File

@@ -63,7 +63,7 @@
</property>
<property name="toolTip">
<string>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.</string>
To do this, you type this shortcut and a space in the Locator entry field, and then the word to search for.</string>
</property>
</widget>
</item>

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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<br>"
"remove it's content. Are you sure to continue?"),
tr("You are going to delete a Folder which will also<br>"
"remove its content. Are you sure to continue?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if (value == QMessageBox::Cancel)

View File

@@ -0,0 +1,11 @@
load(qttest_p4)
SOURCES += tst_qstringbuilder.cpp
QT -= gui
QT = core
DEFINES += QT_NO_CAST_TO_ASCII

View File

@@ -0,0 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
****************************************************************************/
#include <QtTest/QtTest>
#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"

View File

@@ -0,0 +1,106 @@
#include <QDebug>
#include <QString>
#include "../../../src/libs/utils/qstringbuilder.h"
#include <qtest.h>
class tst_qstringbuilder : public QObject
{
Q_OBJECT
public:
tst_qstringbuilder();
private slots:
// QStringBuilder based
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 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"),
string(l1string),
achar('c')
{}
void tst_qstringbuilder::b_2_l1literal()
{
QString result;
QBENCHMARK { result = l1literal % l1literal; }
QCOMPARE(result, l1string + l1string);
}
void tst_qstringbuilder::b_3_l1literal()
{
QString result;
QBENCHMARK { result = l1literal % l1literal % l1literal; }
QCOMPARE(result, l1string + l1string + l1string);
}
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::s_2_l1string()
{
QString result;
QBENCHMARK { result = l1string + l1string; }
QCOMPARE(result, QString(l1literal % l1literal));
}
void tst_qstringbuilder::s_3_l1string()
{
QString result;
QBENCHMARK { result = l1string + l1string + l1string; }
QCOMPARE(result, QString(l1literal % l1literal % l1literal));
}
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"

View File

@@ -0,0 +1,12 @@
load(qttest_p4)
TEMPLATE = app
TARGET = tst_qstringbuilder
DEPENDPATH += .
INCLUDEPATH += .
QT -= gui
CONFIG += release
# Input
SOURCES += main.cpp

View File

@@ -549,9 +549,13 @@ void testQSharedPointer()
QSharedPointer<QString> ptr2 = ptr;
QSharedPointer<QString> ptr3 = ptr;
//QWeakPointer<QString> wptr(ptr);
//QWeakPointer<QString> wptr2 = wptr;
//QWeakPointer<QString> wptr3 = wptr;
QWeakPointer<int> wiptr(iptr);
QWeakPointer<int> wiptr2 = wiptr;
QWeakPointer<int> wiptr3 = wiptr;
QWeakPointer<QString> wptr(ptr);
QWeakPointer<QString> wptr2 = wptr;
QWeakPointer<QString> wptr3 = wptr;
}
void stringRefTest(const QString &refstring)